Jump to content
IGNORED

PAM Galaxian Source Code


Curt Vendel

Recommended Posts

Let me see what Dutchman and I can pull together... and post.

 

For anyone who wants, there is a Vax simulator called SIMH (well it simulates more then vaxes) but you could potentially do all of the compiling in a vax simulator, compile it to object files and have usable code.

 

Here was Atari, making cash hand over first, and I've found numerous memo's from the software programmer groups all complaining that the eprom programmers were limited and it was annoying that they were offsite in other buildings, so they'd have to call over, have someone insert the eprom's, they send the command to burn the code, then have to go and get the eproms for testing... instead of just having 1, 2 or more right in the programmers area's to do locally...

 

Talking about working with stone knifes and sticks "back in the day..."

 

 

 

Curt

 

Anyone have any luck compiling this? MadMac doesnt seem to like it. :(

 

Mitch

 

In order to compile it, you will need Atari Mac65, which ran on the PDP and VAX systems Atari had. Not the OSS version. It is possible to translate the game for use with DASM, but it is very tedious and time consuming.

 

It might be worth while to at least create some info on doing this if Curt finds more pre-ST source codes. Are there any docs on this Mac65 program? Maybe Curt will come across that as well.

 

Allan

Link to comment
Share on other sites

I took a stab at trying to massage the sources so that they would assemble using ATASM. The biggest issue I have is with local labels. It is difficult at times to tell when a local label region (in ATASM terms) should begin. If I could learn the rules for local labels for this assembler I don't think it would be too difficult to write a perl script to make the necessary source changes. I nearly got it to assemble but I'm sure it would likely crash as I know there are places where I got the local label regions wrong.

 

If we could simply get the docs for this assember I think that would be enough to be able to convert the sources to your favorite assembler.

 

tjb

Link to comment
Share on other sites

I took a stab at trying to massage the sources so that they would assemble using ATASM. The biggest issue I have is with local labels. It is difficult at times to tell when a local label region (in ATASM terms) should begin. If I could learn the rules for local labels for this assembler I don't think it would be too difficult to write a perl script to make the necessary source changes. I nearly got it to assemble but I'm sure it would likely crash as I know there are places where I got the local label regions wrong.

 

If we could simply get the docs for this assember I think that would be enough to be able to convert the sources to your favorite assembler.

 

tjb

 

I think the local label regions are delimited by the non-local lables. Here is a chuck of code from one of the Galaxian source files as an example. DODX: stats a block and it has two locals 1$: and 2$:. DECRX: starts the next block, it has one local 1$.

 

Dan

 

 

 

DODX:		;X SHOULD STILL HAVE INDEX TO DYDX TABLE
LDA	DYDX(X)
STA	BTEMP	;SAVE FOR BIT TEST
AND	#7
LDX	ANMAT0(Y)
CPX	#4	;ARE WE STILL PEELING OFF
BCC	1$	;IF NOT, MAKE SHORT DX SWEEP
LDX	STRTY0(Y)
CPX	#0B0
BCS	1$
LDX	FLTBND
BEQ	1$	;DONT MOVE SO FAST IF AT END GAME
ASL		;MAKE BROADER SWEEP
1$:	BIT	BTEMP
BMI	DECRX	;MSB INDICATES VECTOR IN MINUS X DIRECTION
CLC
ADC	HPOS0(Y)
CMP	#RBOUND	;SEE IF AT THE RIGHT BOUND OF SCREEN
BCC	2$
JMP	FLANDN
2$:	STA	HPOS0(Y)
BCC	DOGRFX	;UNCONDITIONALLY DO GRAPHICS
;
DECRX:	STA	BTEMP	;SAVE SUBTRAHEND
SEC
LDA	HPOS0(Y)
SBC	BTEMP
CMP	#LBOUND	;IS LEFT BOUND ABOUT TO BE EXCEEDED?
BCS	1$
JMP	FLANDN
1$:	STA	HPOS0(Y);ELSE RECORD IT
;
DOGRFX:	JSR	STUFEX

Link to comment
Share on other sites

I took a stab at trying to massage the sources so that they would assemble using ATASM. The biggest issue I have is with local labels. It is difficult at times to tell when a local label region (in ATASM terms) should begin. If I could learn the rules for local labels for this assembler I don't think it would be too difficult to write a perl script to make the necessary source changes. I nearly got it to assemble but I'm sure it would likely crash as I know there are places where I got the local label regions wrong.

 

If we could simply get the docs for this assember I think that would be enough to be able to convert the sources to your favorite assembler.

 

tjb

 

I think the local label regions are delimited by the non-local lables. Here is a chuck of code from one of the Galaxian source files as an example. DODX: stats a block and it has two locals 1$: and 2$:. DECRX: starts the next block, it has one local 1$.

 

Dan

 

 

 

DODX:	;X SHOULD STILL HAVE INDEX TO DYDX TABLE
LDA	DYDX(X)
STA	BTEMP;SAVE FOR BIT TEST
AND	#7
LDX	ANMAT0(Y)
CPX	#4;ARE WE STILL PEELING OFF
BCC	1$;IF NOT, MAKE SHORT DX SWEEP
LDX	STRTY0(Y)
CPX	#0B0
BCS	1$
LDX	FLTBND
BEQ	1$;DONT MOVE SO FAST IF AT END GAME
ASL	;MAKE BROADER SWEEP
1$:	BIT	BTEMP
BMI	DECRX;MSB INDICATES VECTOR IN MINUS X DIRECTION
CLC
ADC	HPOS0(Y)
CMP	#RBOUND;SEE IF AT THE RIGHT BOUND OF SCREEN
BCC	2$
JMP	FLANDN
2$:	STA	HPOS0(Y)
BCC	DOGRFX;UNCONDITIONALLY DO GRAPHICS
;
DECRX:	STA	BTEMP;SAVE SUBTRAHEND
SEC
LDA	HPOS0(Y)
SBC	BTEMP
CMP	#LBOUND;IS LEFT BOUND ABOUT TO BE EXCEEDED?
BCS	1$
JMP	FLANDN
1$:	STA	HPOS0(Y);ELSE RECORD IT
;
DOGRFX:	JSR	STUFEX

 

I was thinking of either trying to figure out where to place the .LOCAL directives or ensure that each local label is unique. Since most of the local labels are used with branching instructions the target has to be + or - 128 bytes from the branch instruction. For JMPs I was thinking of using the closest label. It's not as bad as I originally thought since they all have the name format n$. Last night I started on a Perl script and then ended up trying to do most of it manually. I went back and updated the script and have quite a bit of it working (changing .= and .=.+1 to *= and*=*+1, converting Macros from using named parameters to %1, %2, etc. , converting .IF statements, converting numeric values to have a leading $ (I am assuming the .RADIX 16 means that all numbers are hex - I noticed that numbers beginning with a letter have a leading 0). I'm hoping to have something later this evening (if time permits, it's Valentines' day/ our Anniversary so we're going to dinner...)

 

tjb

Link to comment
Share on other sites

Ok, I'm making progress but I'm running into snags here and there. Check out this Macro:

 

;SOUNDS FOR THE EXPLOSIONS, FLEET, ATTACK AND MISSILES
;RES DEFINES THE RESOLUTION OF THE CHANNEL, 1 OR 2 GANGED TOGETHER
;INDEX IS THE INDEX VARIABLE THAT INDEXS THRU THE REPEAT, VOLUME AND
;FREQUENCY ARRAYS.  RP IS THE REPEAT COUNT REGISTER.  IF RAMP IS DEFINED
;THEN REPEAT IS NOT USED AND RP IS USED TO INDEX THRU THE RAMP FUNCTION
;
.MACRO	SND	RES,INDEX,RP,REPEAT,VOLUME,FREQ,?A,?B
LDY	INDEX
BEQ	B
LDX	RP
BNE	A
DEC	INDEX
LDX	REPEAT(Y)
STX	RP
A:	DEC	RP
CMP	VOLUME(Y)
BCS	B
.IF	EQ,RES-1
LDA	FREQ(Y)
STA	VTEMP
.ENDC
.IF	EQ,RES-2
TYA
ASL
TAX
LDA	FREQ(X)
STA	VTEMP
LDA	FREQ+1(X)
STA	VTEMP+1
.ENDC
LDA	VOLUME(Y)
B:
.ENDM

 

After conversion it looks like this:

 

	.MACRO	SND
LDY	%2
BEQ	B
LDX	%3
BNE	A
DEC	%2
LDX	%4,Y
STX	%3
A:	DEC	%3
CMP	%5,Y
BCS	B
.IF	EQ,%1-1
LDA	%6,Y
STA	VTEMP
.ENDIF
.IF	EQ,%1-2
TYA
ASL
TAX
LDA	%6,X
STA	VTEMP
LDA	%6+1,X
STA	VTEMP+1
.ENDIF
LDA	%5,Y
B:
.ENDM

 

I overlooked the form of the .IF directive that includes .EQ. What do you suppose this line means:

 

.IF EQ,RES-1

 

Since the comments state that RES can be 1 or 2 I'm guessing the .IF evaluates to true if RES-1 evalutes to 0 (if RES = 1 then 1-1 = 0). There is another .IF that has EQ RES-2 and since RES is either 1 or 2 one of the .EQ (within the .IF directives) directives will evalute to 0. I did correctly convert the .ENDC directives to .ENDIF. Now I just need to handle the case where the .EQ is used.

As soon as I get this puppy to assemble I'll post the modified sources.

 

tjb

Link to comment
Share on other sites

  • 1 month later...
Does anybody know what would be Dasm's equivalents to:.PAGE, .SBTTL, .REPT, .ENDR from this compiler.

 

OK. I figured out the .REPT and .ENDR. Now I just need .SBTTL and .PAGE.

 

Allan

 

Well I think figured out the .PAGE AND .SBTTL. They are just output format commands and can just be ignored.

 

Anybody else have any luck with this?

 

Allan

Link to comment
Share on other sites

Does anybody know what would be Dasm's equivalents to:.PAGE, .SBTTL, .REPT, .ENDR from this compiler.

 

OK. I figured out the .REPT and .ENDR. Now I just need .SBTTL and .PAGE.

 

Allan

 

Well I think figured out the .PAGE AND .SBTTL. They are just output format commands and can just be ignored.

 

Anybody else have any luck with this?

 

Allan

 

I got pretty far converting it to ATASM format but it's still a work in progress (in other words I'm still getting errors). I ended up just commenting out the directives that didn't have an ATASM equivilent.

 

 

tjb

Link to comment
Share on other sites

  • 2 months later...

Hi,

 

Work in progress - the GALDEM code can build to a ROM image that runs in 5200 mode of A800WinPLus. A screen appears after the logo with "5200 SUPER SYSTEM press start" but with corrupt graphics at the top, pressing start does nothing?!

 

I'm using the cc65 suite (well the assembler and linker) and a cygwin environment to provide the 'make' but cc65 is available on many platforms and straight forward enough to get working with.

 

I haven't finished the MV and WV sources conversion yet and so these won't build.

 

CA65 has no direct equivalent of the .ASCII directive in the original code, so using .BYTE causes so behind the scenes remapping of the char-code values. This won't take much to rectify but is a pain (you would think 'target system equals "none"' could leave it alone).

 

More as it happens, if anyone can chip in with fixes then please do. :)

 

Regards,

Mark

post-1822-1214310951_thumb.png

PAMgalaxian_ca65.zip

Link to comment
Share on other sites

A few updates:

 

Fixes to GALDEM source to put right some decimal values I'd incorrectly set as hex.

This was causing the corrupted graphics on the 'super system' screen which now displays the word 'Atari'.

This is supposed to display rainbow colours inside from what I can tell, but this doesn't seem to work.

Also the keyboard routine is never called. I'm not so familiar with the 5200 so is the vector used for hooking this wrong?

 

I've also updated the MV and WV sources so that they compile (and so also included in the makefile).

These are odd as the galaxians appear more like pacman ghost's eyes. :(

 

In GALDEM, if you bypass the 'press start' screen, e.g. add JMP GALAXI at line 136, then you see the start of the game but this crashes after a little while.

 

More comparisons against the original sources to do later...

 

Regards,

Mark

PAMgalaxian_ca65_rel2.zip

Link to comment
Share on other sites

Last update for a little while (I think). If someone else can try and spot the remaining mistakes that would be good. ;)

 

Some fixups made throughout the sources, generally some more radix issues and general tidying of comments.

 

The big breakthough however was made through switching on the ZZZROM define, now the galaxians look right and the game & demo plays. :)

 

Some issues do remain though:

 

GALDEM : Some graphics corruption - I have seen this eariler tonight on the MV rom which has since gone - so hopefully this could be identified as a single line fix in the galdem code somewhere.

 

MV: Game is playable but when starting a wave the controller appears to get stuck on a direction. E.g. player's ship moves to the left. Pressing right moves the ship right but when released the ship drifts left again.

 

WV: This seems to work OK.

 

Sources and ROMs separated this time.

 

Enjoy,

Mark

PAMgalaxian_roms_rel3.zip

PAMgalaxian_ca65_rel3.zip

Edited by Wrathchild
Link to comment
Share on other sites

Hard to say, probably in the conversion but I've been through each file quite a few times now to find mistakes and think I've got all now. I've used 'Beyond Compare' which is a very neat diff tool as it highlights the differences in characters on a single line which really helps.

 

A fresh pair of eyes going over the differences maybe able to spot something I've missed.

 

Regards,

Mark

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...