Jump to content
IGNORED

64 bit assember/disassembler for 7800?


Wayne2072

Recommended Posts

Is there a 64 bit assembly/disassembly package for the Atari 7800? I have only been able to find 32 bit ones, and they won't run on my current laptop.

 

 

There shouldn't be any issue running a 32 bit app on a 64 bit machine, so it might not be the bit size that's the issue. For example I am running 64 bit Windows 10 and DASM runs just fine.

  • Like 1
Link to comment
Share on other sites

 

 

There shouldn't be any issue running a 32 bit app on a 64 bit machine, so it might not be the bit size that's the issue. For example I am running 64 bit Windows 10 and DASM runs just fine.

Are you using a virtual machine with something like XP to do this? DASM gives me the 32 vs. 64 bit error message if I try to run it in Windows 7.

Link to comment
Share on other sites

Are you using a virtual machine with something like XP to do this? DASM gives me the 32 vs. 64 bit error message if I try to run it in Windows 7.

 

Just a stab in the dark reply for this as I really don't know, but would running dasm in compatibility mode work? (I keep seeing people recommend stuff like that. :))

Link to comment
Share on other sites

 

Just a stab in the dark reply for this as I really don't know, but would running dasm in compatibility mode work? (I keep seeing people recommend stuff like that. :))

Thanks for that suggestion. I tried it, and it still reports as an incompatible program, no matter which version of Windows I choose in compatibility mode. I even tried setting up XP Mode on MS Virtual PC, but I get a blue screen on the setup. So.... apparently, my Win 7 Pro machine just isn't showing any love for Atari.

 

What I'm hoping to accomplish is to be able to get to the source code for two games, make a couple of tweaks, to make them a bit "friendlier" for my almost 6 year old son who loves the games. Then, I would re-assemble(?) them and test them on the ProSystem emulator, before asking Al to make a cart of both.

 

I'll keep exploring both running DASM in Win 7, and setting up a virtual machine. Or, perhaps someone could take the two binaries and help me out, with de- and re-assembly? Anyhow, thank you again for your response.

Link to comment
Share on other sites

Do you have to use DASM? I run dis6502 and MADS on a 64bit Win7 machine without any problems.

 

dis6502 works! :-) Now, I just have to figure out where I need to change the code... this will be quite a learning experience. I am a programmer, by trade, but never have worked with assembler, especially not 6502. :-)

 

Thank you for the suggestion!

Edited by Wayne2072
Link to comment
Share on other sites

Thanks for that suggestion. I tried it, and it still reports as an incompatible program, no matter which version of Windows I choose in compatibility mode. I even tried setting up XP Mode on MS Virtual PC, but I get a blue screen on the setup. So.... apparently, my Win 7 Pro machine just isn't showing any love for Atari.

 

What I'm hoping to accomplish is to be able to get to the source code for two games, make a couple of tweaks, to make them a bit "friendlier" for my almost 6 year old son who loves the games. Then, I would re-assemble(?) them and test them on the ProSystem emulator, before asking Al to make a cart of both.

 

I'll keep exploring both running DASM in Win 7, and setting up a virtual machine. Or, perhaps someone could take the two binaries and help me out, with de- and re-assembly? Anyhow, thank you again for your response.

Hmm. This guy called Blue has done lots of 7800 game hacks and modified them for infinite lives etc. You might wanna check them out.
Link to comment
Share on other sites

Hmm. This guy called Blue has done lots of 7800 game hacks and modified them for infinite lives etc. You might wanna check them out.

Thanks! I did, and there is a great number of hacks. What I didn't find, though, and am seeking, is Scrapyard Dog with infinite lives. My son *loves* this game, but gets frustrated when he loses his last man, and has to start back at the 1st world of a level.

Link to comment
Share on other sites

Thanks! I did, and there is a great number of hacks. What I didn't find, though, and am seeking, is Scrapyard Dog with infinite lives. My son *loves* this game, but gets frustrated when he loses his last man, and has to start back at the 1st world of a level.

I understand his frustration.

Link to comment
Share on other sites

I found a disassmbler (Distella), and disassembled Galaga to start with. I made the change that I wanted to make, where I think it goes, based on a documented disassembly word doc I found. When I run dasm (downloaded from another site, and it works... well... sort of), it creates an a.out file, which I can't seem to get the 7800sign and 7800header to work. When I try to run 7800asm, it appears to create the .bin, but it's only 26K, not 32K, and won't run on an emulator. I tried 7800header, and created an A78, also 26K, and it won't run on an emulator. Ugh.

Link to comment
Share on other sites

There's a bug with the existing distella and 7800 binaries. It tries to fold the address space into 4k like it was the 2600, which messes up the labels.

 

Try redoing the disassembly with the attached version, and let me know if it works better.

 

If the assembled binary isn't the right size, adding a header or signing won't fix it.

distella-301a.zip

Link to comment
Share on other sites

One problem that can arise is if a program uses absolute addressing to access zero page memory. When reassembled, they can get written as zero page instructions which are one byte shorter in length. This results in the code shifting down in memory which will cause it to break. This will also happen with self modifying code where the addresses are assembled as $0000.

 

The assemblers provide a way to code zero page addresses to force them to absolute addressing mode, so this can be used to fix these errors. I always test a disassembly by assembling it without changes and then using a hex editor to do a file compare and search for differences. This makes it easy to find these kinds of errors.

Link to comment
Share on other sites

There's a bug with the existing distella and 7800 binaries. It tries to fold the address space into 4k like it was the 2600, which messes up the labels.

 

Try redoing the disassembly with the attached version, and let me know if it works better.

 

If the assembled binary isn't the right size, adding a header or signing won't fix it.

The attached version is still ultimately producing a .bin that's too small. What parameters should I use on distella for the 7800? I tried -7 and -f7.

 

At this point, I would pay someone for their time to create the two hacks I'm wanting, but then there's this part of me that wants to stick it out and learn this. Ugh.

Link to comment
Share on other sites

The attached version is still ultimately producing a .bin that's too small. What parameters should I use on distella for the 7800? I tried -7 and -f7.

 

At this point, I would pay someone for their time to create the two hacks I'm wanting, but then there's this part of me that wants to stick it out and learn this. Ugh.

How about posting your files? I'm sure someone would take a look at them.

Link to comment
Share on other sites

Well, I went back and looked at the Distella examples. I used one of them, in terms of the number of parameters to add to the command. It created a larger file, which successfully assembled. (Hooray!) But, my coding change didn't change anything. I guess I don't know enough about 6502 assembler to make the changes I want to make. I used a documented disassembly of Galaga as a guide, but things didn't look the same in mine.

 

So... I can now disassemble/assemble, but need help with coding. I am trying to do the following:

 

1) Galaga - change it so that instead of getting faster on stage 10 in the Advanced mode, it does it at a later stage, I was thinking 99, but that might be too much. Maybe 50.

 

2) Scrapyard Dog - grant infinite lives.

 

I thought these two changes wouldn't be too bad, but now I wish I had been able to learn more about assembler when I was working in the credit programming area of a major retailer a few years back. There was a bit of assembler code (mainframe), but I never got the chance to get acquainted with it.

 

Wayne

Link to comment
Share on other sites

Today I spent time online looking for 6502 assembler resources, to try to learn the commands that I was seeing in the disassembled version of Galaga I created, but also the documented disassembly. This helped greatly, and I was able to make the change I wanted to Galaga. Thank you to everyone for your advice over the past few days, and your patience. The "bonzo" speed up doesn't happen at stage 10 any more. But, one thing I'm noticing is that there is no longer the slight delay between waves of ships in the formation build part of each stage. Each row of ships zooms in almost before the last row has finished. I only changed (I believe) one value, and that was the check of the value of the rack, to see if the enemies needed to go faster. But, that's a task to try to figure out... tomorrow...

 

Now, if I can get Scrapyard Dog disassembled. I am trying, but I keep getting an error about the file size. I guess Distella doesn't handle 128K files?

Edited by Wayne2072
Link to comment
Share on other sites

Now, if I can get Scrapyard Dog disassembled. I am trying, but I keep getting an error about the file size. I guess Distella doesn't handle 128K files?

Correct. Distella doesn't know how to handle bankswitched binary, whether it's a 2600 or 7800 binary.

 

For the Toki 7800 disassembly, I had to create several 32k binaries with with each bank "switched in", generate a dissassembly from each, and then merge the disassemblies together by hand.

Link to comment
Share on other sites

Correct. Distella doesn't know how to handle bankswitched binary, whether it's a 2600 or 7800 binary.

 

For the Toki 7800 disassembly, I had to create several 32k binaries with with each bank "switched in", generate a dissassembly from each, and then merge the disassemblies together by hand.

Will 7800asm then take the merged file and produce the bin? If so, are there instructions somewhere on how to disassemble the file in parts, like you did for Toki? Or, could you walk me through the process? I was able to muddle through Galaga, so maybe I could use what was learned there to tweak SD.

Link to comment
Share on other sites

As background info, I'll leave this quote from ATARI 7800 BANKSWITCHING GUIDE here...

Then there are several different types of Atari's SuperGame bankswitching. It basically consists of 8 16KB banks (0-7)
that can be mapped in at $8000-$bfff. Bank 7 always is fixed at $c000-$ffff. To map in a chosen bank into $8000-$bfff you
write it's bank number (0-7) to any address between $8000-bfff.


You've already figured out how to disassemble non-bankswitched games, so I won't go over that. This recipe is fairly hairy, but I can confirm it does work for Supergame/Supercart ROMs that don't have ROM at $4000 (Scrapyard Dog doesn't)

  • Strip off the 128 byte header if you have an A78 file, to get the raw game ROM.
  • Split the ROM into 8 "bank ROMs". Each should have 16k of data. e.g. bank.00, bank.01, bank.02, bank.03, bank.04, bank.05, bank.06, and bank.07
  • Combine the bank roms into 7 new "address space ROMS" that represent only what the 6502 sees when each bank is switched in. e.g. scrapdog.00 (bank.00+bank.07), scrapdog.01 (bank.01+bank07), ..., scrapdog.06 (bank.06+bank07)
  • Run distella on each "address space ROM" and produce disassemblies. e.g. scrapdis.00, scrapdis.02, ..., scrapdis.06
  • Purge any disassembly of address space $c000-$ffff from all disassemblies, except for the last one.
  • Add lines "ORG = $8000" and "RORG = $8000" to the top of the first disassembly. Use "ORG = $C000" and "RORG = $8000" for the second, "ORG = $10000" "RORG = $8000" for the third. Continue the pattern for the rest of the disassemblies.
  • Merge all of the disassemblies together into a single file.

If all of the steps were followed correctly, you should be able to assemble the final disassembly, and get a ROM identical to the original.

  • Like 2
Link to comment
Share on other sites

As background info, I'll leave this quote from ATARI 7800 BANKSWITCHING GUIDE here...

You've already figured out how to disassemble non-bankswitched games, so I won't go over that. This recipe is fairly hairy, but I can confirm it does work for Supergame/Supercart ROMs that don't have ROM at $4000 (Scrapyard Dog doesn't)

  • Strip off the 128 byte header if you have an A78 file, to get the raw game ROM.
  • Split the ROM into 8 "bank ROMs". Each should have 16k of data. e.g. bank.00, bank.01, bank.02, bank.03, bank.04, bank.05, bank.06, and bank.07
  • Combine the bank roms into 7 new "address space ROMS" that represent only what the 6502 sees when each bank is switched in. e.g. scrapdog.00 (bank.00+bank.07), scrapdog.01 (bank.01+bank07), ..., scrapdog.06 (bank.06+bank07)
  • Run distella on each "address space ROM" and produce disassemblies. e.g. scrapdis.00, scrapdis.02, ..., scrapdis.06
  • Purge any disassembly of address space $c000-$ffff from all disassemblies, except for the last one.
  • Add lines "ORG = $8000" and "RORG = $8000" to the top of the first disassembly. Use "ORG = $C000" and "RORG = $8000" for the second, "ORG = $10000" "RORG = $8000" for the third. Continue the pattern for the rest of the disassemblies.
  • Merge all of the disassemblies together into a single file.

If all of the steps were followed correctly, you should be able to assemble the final disassembly, and get a ROM identical to the original.

 

 

Thank you for sharing this. I have SD split into 8 bank ROMS now, thanks to 7-zip. I have two questions, please, from the above. I think I get the process, with two exceptions:

 

"Combine the bank roms into 7 new "address space ROMS" that represent only what the 6502 sees when each bank is switched in. e.g. scrapdog.00 (bank.00+bank.07), scrapdog.01 (bank.01+bank07), ..., scrapdog.06 (bank.06+bank07)"

So, for example, am I copying the contents of bank07 to the bottom of the bank00 file, and saving it as scrapdog.00, bank07 to the bottom of the bank01 file, and saving it as scrapdog.01, and so on?

 

"Add lines "ORG = $8000" and "RORG = $8000" to the top of the first disassembly. Use "ORG = $C000" and "RORG = $8000" for the second, "ORG = $10000" "RORG = $8000" for the third. Continue the pattern for the rest of the disassemblies."

I must admit that I am clueless about how to continue the pattern. Looks like RORG stays the same throughout. But, I am not sure how to continue ORG from $8000 to $C000 to $10000, to......the rest of the values. Not sure what they'd be.

 

Sorry, this entire 6502 programming is still fairly new to me. I appreciate your patience and help.

Link to comment
Share on other sites

"Combine the bank roms into 7 new "address space ROMS" that represent only what the 6502 sees when each bank is switched in. e.g. scrapdog.00 (bank.00+bank.07), scrapdog.01 (bank.01+bank07), ..., scrapdog.06 (bank.06+bank07)"

So, for example, am I copying the contents of bank07 to the bottom of the bank00 file, and saving it as scrapdog.00, bank07 to the bottom of the bank01 file, and saving it as scrapdog.01, and so on?

You're concatenating the 2 files together, into a new 3rd file. In Windows you can do this from the command line with "copy and /b". e.g. "copy bank.00 \b bank.07 \b scrapdog.00". In Linux and OSX it would be something like "cat bank.00 bank.07 > scrapdog.00"

 

"Add lines "ORG = $8000" and "RORG = $8000" to the top of the first disassembly. Use "ORG = $C000" and "RORG = $8000" for the second, "ORG = $10000" "RORG = $8000" for the third. Continue the pattern for the rest of the disassemblies."

I must admit that I am clueless about how to continue the pattern. Looks like RORG stays the same throughout. But, I am not sure how to continue ORG from $8000 to $C000 to $10000, to......the rest of the values. Not sure what they'd be.

The ORG starts at the hexadecimal $8000 value, and $4000 gets added each time...

 

ORG = $8000

ORG = $C000

ORG = $10000

ORG = $14000

ORG = $18000

ORG = $1C000

ORG = $20000

 

...we do this because each bank takes up $4000 (aka 16K). Technically you could skip all but the very first ORG, but it's one part protection against you accidentally adding or removing bytes, and one part self-documentation.

 

 

Sorry, this entire 6502 programming is still fairly new to me. I appreciate your patience and help.

No worries, and no need to apologize. We all were new to it, at some point. :)

Link to comment
Share on other sites

You're concatenating the 2 files together, into a new 3rd file. In Windows you can do this from the command line with "copy and /b". e.g. "copy bank.00 \b bank.07 \b scrapdog.00". In Linux and OSX it would be something like "cat bank.00 bank.07 > scrapdog.00"

 

 

The ORG starts at the hexadecimal $8000 value, and $4000 gets added each time...

 

ORG = $8000

ORG = $C000

ORG = $10000

ORG = $14000

ORG = $18000

ORG = $1C000

ORG = $20000

 

...we do this because each bank takes up $4000 (aka 16K). Technically you could skip all but the very first ORG, but it's one part protection against you accidentally adding or removing bytes, and one part self-documentation.

 

 

 

No worries, and no need to apologize. We all were new to it, at some point. :)

 

 

Thanks. The copy command and the ORG values make sense.

 

I performed all of the copies and then started the disassembly with distella. All of them worked, except for scrpdog.05. I am not sure why, but regardless of the parameters I supply, distella makes its first pass, and then dies, with no indication of why. I am attaching the scrpdog.05 and the bank 5 and 7 files.

bank.005.txt

bank.007.txt

scrpdog.05.txt

Link to comment
Share on other sites

It seems to partially work for me, but I'm using Linux. I do see a weird junk line at the top, just before the disassembly, and distella completely messes up the address range. I'm guessing its a bug.

 

I'll try to look into it, and let you know. The distella source isn't the easiest to follow.

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...