Videopac / Odyssey2 forum
September 27, 2021, 08:25:54 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Al lot of attachments from Nov 2011 till april 2012 are damaged. Please ask the original poster to re-upload if you need them.
 
   Home   Help Login Register links videopac.nl  
Pages: [1]   Go Down
  Print  
Author Topic: 8048 Disassembler - any good options?  (Read 339 times)
Pickaxe Brad!
Trying to get the cartridge in...
*
Posts: 12



« on: May 04, 2021, 05:33:01 AM »

I thought it would be interesting to take a stab at to fix/hack the invisible asteroids in VP34+.  It seemed like something I could learn from as well as being able to play UFO! with Plus graphics!  (We had an O2, so the 7400 backgrounds are new and novel to me.)

My plan:
1) acquire an 8048 disassembler,
2) disassemble the 2k vp_34.bin from Rene's zip (not the plus version yet) and practice poking around at it (probably look at the vdccolor calls, but really I'd probably play around with all sorts of stuff)
3) compile and realize what that I broke things; revert vp_34.bin and go back to #2 until I've learned something about changing asteroid colors
4) take what I learned from the 2k ROM and see if disassembly of the 8K rom (Plus version) is more difficult.  If so, figure it out.
5) make the mods to the vp_34pl.bin (Rene's)

Step one has been a bit of a challenge.  I can't seem to find something that works correctly (or that I'm not screwing up).

What I've done so far:
* Used 8048DIS.exe from DanB's page.  Per the manual, I'm starting offset of 0 and ending offset of 800 (2048 in hex).  It mostly works, but leaves a dozen lines that say "*** Illegal ***", and not disassembled.  It's a bit weird that it asks me for the offsets twice (starting, ending, starting, ending).  Is that how it's supposed to work?
* Tried 8048 with compatibility modes, and even tried it on an XP VM and a Win2000 VM. Same result.  Are people running this on an old DOS box or something?
* Found DASMx 1.4 online.  Ran with "dasmx.exe -a -c8048 -o0x400 vp_34.bin" which seems to work (but looks a bit strage), but fails to generate some of the labels that the code is jumping to (addresses above 400).  After fixing those and fixing the labels for jmps/calls to the BIOS (addresses below 400?), I get a bunch of 'jump location is not on the same page' (I didn't save the exact error, sorry) when trying to assemble it again.  Suspicious that it's already screwed up, but eager to press on, I added 'align 256's and nops to try to repaginate the code.  If you've read this far, you probably guessed correctly that after Select Game, the game fails and just buzzes and flashes like crazy.
* Found DASM 1.1 online.  Ran with the same command.  Noticed that the assembly code looks a bit less suspicious, but requires more work to fix addresses ("#$01" -> "#001h", for example).  But all of the labels we jump to (400h+) are created from this version, and after adjusting the calls/jumps to the BIOS to addresses (not labels), I get the same alignment/page problems.  Tried to fix it the same way, and failed the same way as DASM1.4

My options:
1) Figure out if I'm disassembling incorrectly with either of these programs. Hopefully someone here can set me straight if this is the case.
2) Buy Borland Turbo C++ and compile my own 8048DIS.exe, and debug it.  But this seems unlikely for me to debug.
3) Use the 8048DIS output, manually disassemble the "*** Illegal ***" commands myself, then try to assemble it.  Is this what everybody does when they use 8048DIS?
4) Get DASMxx (a different program from DASMx) from GitHub, build it, and try to use it for 8048 (which at the moment I'm not sure if it supports 8048).
5) Find something else that everyone else uses, but I didn't find yet.  Anyone have anything that works for them?

Thanks for reading all the way though this far.  Do you have any better ideas for what I should have done?
Logged

Making a game for my Odyssey2, keeping my eye out for any programmable cartridges I can buy, trying to search the forums before pestering you with n00b questions, and frequent replier on decade old forum threads.
manopac
Game & App Development
Give this man a Jopac!
*
Posts: 1157



« Reply #1 on: May 04, 2021, 03:31:19 PM »

hm - maybe a few hints:
- not every byte is a command, there is probably data that you are trying to disassemble (sprites for example, but also other stuff)
- 2 K are not loaded to $0 but to $400 because of the way the memory is setup in the Odyssey 2 - basically the BIOS is mapped to $0-$3FF, so a 2K ROM is loaded from $400 - and the address space would actually be 3K ($40-$1FFF) - the way the cartridge is wired results probably in $400-$7FFF, $1400-$1FFF  (from memory ... not sure thats how it actually is, but you would figure it out by looking at the jumps)

I hope that helps ;-)
Logged

sex, lies, and videopac
TedFoolery
Attacked the Timelord
***
Posts: 101


« Reply #2 on: May 04, 2021, 03:45:01 PM »

Another "fun" aspect is some compilers insert SEL MB0 commands before RETs (and no way to turn that "feature" off). This could be the cause of the "not on same page" errors if it's pushing code to other pages. The only way to avoid it is to find another compiler or get a hex editor and manually insert the RET (or RETR) commands -- rather tedious.
Logged
Pickaxe Brad!
Trying to get the cartridge in...
*
Posts: 12



« Reply #3 on: May 04, 2021, 07:02:49 PM »

hm - maybe a few hints:
- not every byte is a command, there is probably data that you are trying to disassemble (sprites for example, but also other stuff)
- 2 K are not loaded to $0 but to $400 because of the way the memory is setup in the Odyssey 2 - basically the BIOS is mapped to $0-$3FF, so a 2K ROM is loaded from $400 - and the address space would actually be 3K ($40-$1FFF) - the way the cartridge is wired results probably in $400-$7FFF, $1400-$1FFF  (from memory ... not sure thats how it actually is, but you would figure it out by looking at the jumps)

I hope that helps ;-)


In DASMx, I was seeing db commands for this type of data (if I'm talking about the same thing you are) and I was able to set the hex 400 offset for the addressing. I believe this was working because the reset/selectgame jump worked (in emulator).

8048DIS seems to address from 0 so that would be a problem, but I never tried to run that code because it was incomplete anyway.

I'll take another look at it to see if there's other types of data that I'm not accounting for. Mostly, I was posting because I was hoping that someone knew of an amazingly great disassembler I haven't stumbled upon yet. But I can dig into it more if these are the best we have.

Thanks for the info.
Logged

Making a game for my Odyssey2, keeping my eye out for any programmable cartridges I can buy, trying to search the forums before pestering you with n00b questions, and frequent replier on decade old forum threads.
Pickaxe Brad!
Trying to get the cartridge in...
*
Posts: 12



« Reply #4 on: May 04, 2021, 07:27:50 PM »

Another "fun" aspect is some compilers insert SEL MB0 commands before RETs (and no way to turn that "feature" off). This could be the cause of the "not on same page" errors if it's pushing code to other pages. The only way to avoid it is to find another compiler or get a hex editor and manually insert the RET (or RETR) commands -- rather tedious.

I'm using asw, so I have one of those "fun" compilers. Thanks; even though I stumbled on that sometimes-auto-sel-mb generation when programing my "game"**, It didn't occur to me as a the problem here.

I think I saw TASM on DanB's or maybe on Soren's (wayback machine) page. I should give that a try too. Those are the two main alternatives, right?

Thanks for the info.

** I'm calling it a "game" as I programmed it from scratch to be one, though it currently is an ill-designed, not-fun-yet, learning-as-I-go ROM with no way to "win" yet. I'm claiming poetic license.
Logged

Making a game for my Odyssey2, keeping my eye out for any programmable cartridges I can buy, trying to search the forums before pestering you with n00b questions, and frequent replier on decade old forum threads.
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!