Disassembling Oric Programs to XA Source code

Here you can ask questions or provide insights about how to use efficiently 6502 assembly code on the Oric.
Post Reply
User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

Disassembling Oric Programs to XA Source code

Post by Twilighte » Sun Jun 15, 2008 1:00 am

I recently wanted to enhance Sonix 3.40 to have a Note Tempo setting in the Pattern Editor.
This requires 4 changes.
A change to the Pattern Editor to detect the additional key to place the note tempo command.
A change in the Pattern display routine to show the Note Tempo Command.
A change in the player to change the tempo on the occurrence of the command.
A change to the compiler to change the tempo on the occurrence of the command.
The upshot is that it is very very difficult to modify unknown (or in my case forgotten) code so i then decided the best answer would be to disassemble the program to xa cross asm format on the pc, which would then make amendments much easier to do.

But how do we do it?
Well first i saved the complete Sonix file to a tape file..
SONIX.MEM,V
4200-BFDF
SONIX.MEM:TRANSPOSE.MOD:CSAVE"SONIXZ",A#4200,E#BFDF

Then removed the header

HEADER -h0 SONIXZ.TAP SONIXZ.BIN

Now this was just a flat file on the PC. So i found DIS6502..
http://www.atarimax.com/dis6502/

I then loaded Raw, removed System and user Equates (in Labels) and saved the generated disassembly to SONIXMC.S

This generates the disassembly as a number of files. I am still unsure why a number just one file isn't generated by no matter. From Command prompt i combined these files (which always ended in the extension as a sequence number and began with SONIXZ.)..

COPY SONIXZ.0* SONIXMC.S

The generated file was not far off what i wanted, but there was still some formatting errors in the listing.
So i wrote a utility to convert most of the formatting issues.
The utility also scans a File that holds location labels as a list of #DEFINE statements and replaces the generated LXXXX with the label.
This has saved an awful lot of work.
I will upload and link this utility as soon as i am able(Windows).

The second problem is that the listing contained alot of table areas, some of which DIS6502 had converted to CODE (Incorrect).
This is the stage i am currently at. Manually editing the code is now an option, and any large areas known to be tables or data can be seperately converted to .byt blocks by saving them to tape (from Euphoric), removing the header and finally running BIN2TXT which converts the binary file to a text file with .byt statements. :P

mmu_man
Flying Officer
Posts: 213
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man » Wed Jun 18, 2008 12:47 am

You know bash+sed+awk would have saved you from writing a custom tool...

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests