6502 Windows-based disassembler

Questions, bug reports, features requests, ... about the Oric Software Development Kit. Please indicate clearly in the title the related element (OSDK for generic questions, PictConv, FilePack, XA, Euphoric, etc...) to make it easy to locate messages.

User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

Post by Twilighte »

waskol wrote:$DF=$E0 - 1 , I've been blind...

I don't know why I was reading it like this :
$2E(0-1) instead of ($2E0)-1 !!!
hehe, i did exactly the same last week. I had a dinner party and found a recipe for Palenta, and read 11/4 Cups. I must have spent a day trying to work out whether they meant 11 divided by 4 cups, 11 or 4 cups, etc. until my sister enlightened me that it said 1 and a quarter cups.
hahaha doh!

Anyway, regards this disassembler thing. It just so happened i was searching today for a bin2xa utility.
Never found one. How i currently do it is far too lengthy.
I load up euphoric, insert my alleds.dsk which contain ORION and its supplied utility PDUMPO which links into orion to print the output. I then switch on the printer, load the binary file and dump to printer file.
The generated code is ok, but not perfect.

I would much rather have something a little more clever. One theory swirling around in my mind is that technically it is possible for any converter to automatically reformat the disassembly into labels (like r2063 where 2063 is the hex address) and to identify and separate embedded tables into xa compliant .byt statements.

Sort of like if the code being disassembled has unrecognised op-codes or data is fetched from locations in the code, then mark this as an embedded table or variable list.

I am also thinking for a longer listing it is possible to get the converter to work out the files start address, examining JSR's and JMP's, but that is purely an intellectual question and doesn't really have any real use. :wink:

Anyway, does anyone have a disassembly of the Microdisc rom?
User avatar
waskol
Flight Lieutenant
Posts: 414
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Post by waskol »

OK, so far, my disassembler has evolved a little bit. The dissassembling is now very accurate and takes into account "undocumented" opcodes.

I still have a little work on it, but not much.

My only concern at the moment, is that my ADSL is down for "migration" : my old web provider (Club internet) have been bought by another one (Neuf). Just right now, I am posting from my job location.

Well... :?
it is possible for any converter to automatically reformat the disassembly into labels
I don't think so... Once you compile, you loose the Labels you included in your code. I don't think one could reverse the process.

For the Microdisc rom, you'll be able to dissasemble it very soon. :wink:
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Post by Chema »

waskol wrote: I don't think so... Once you compile, you loose the Labels you included in your code. I don't think one could reverse the process.
Well... maybe there is an option. It is for sure possible to keep a dictionary with all the addresses (relative or absolute) that appear in branch, jmp and jsr instructions. Also you can take them from other kind of instructions like lda hhhh or lda hhhh,x or whatever.

Then you can generate the output on the second pass, where you can add labels, even with generic names.

You can be even smart and try to figure out (which won't be always correct) if a certain label is a table (for instance lda hhhh,x) a routine (jsr or jmp) or simply a local loop (from bne kind instructions...). If the dictionary keeps track of these memory positions, it can somewhat decide the status by something like voting. If a certain location is referenced in jsr, then it is most probably a subroutine, but if it appears both after jmp and branches, then you can see what happens more often and decide.

This way you can have generic labels that look like label1, label2,... and also routine1, routine2,... and table1, table2,...

The next step would be having a list of known memory locations in Oric's ROM and lower pages of RAM and assign them labels statically. The clear example is the ROM routines, but also the BASIC variables in page 2, the I/O regs in page 3 and, why not, maybe even give names to page0 locations...

Just some ideas...
User avatar
waskol
Flight Lieutenant
Posts: 414
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Post by waskol »

I thought about it Chema, but there is a major problem.

For instance :
Last week, I was trying to port tyrann from tape to disk.
The thing is that there is a piece of assembly code that resides in page 4, as the Jasmin put some essential code in page 4, I was trying to move it to a available location.
For this I dissassembled it in order to see where were located the branch instructions and so forth and I got something like this :

Start address $0400

XX XX XX : ......
XX XX XX : ...... //Various instructions
XX XX XX : ......
D0 XX : BNE $XX //<-- branch instruction to the 00 of the last line below
XX XX XX : ......
XX XX XX : ......
XX XX XX : ......
XX XX XX : ......
4C 00 04 : JMP $0400
EA : NOP
EA : NOP
60 : RTS


The BNE instruction, here, branches the the 00 marked in red, which is used as a BRK instruction, that jumps over the $04 byte ater an interrupt and then leads to the return instrucction (RTS).

Well, I rewrote it like I could remember it, but it is the principle...

All of that to ask : In this kind of case, how do you manage Labels ? :lol:
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Post by Chema »

waskol wrote:I thought about it Chema, but there is a major problem.

...
All of that to ask : In this kind of case, how do you manage Labels ? :lol:
Yeah, indeed there are places where you cannot (at least easily) manage labels.

In fact with self modifying code in which you have something like:

Code: Select all

lda XX
sta label+1
lda YY
sta label+2
...

label 
 lda $xxxx,y
The problem is quite similar, I think.

Also it is quite often to find code such as lda mytable-1,x , where reg x never reaches zero.

Now that I think of it... If the program runs in two passess... it whould be possible to notice a given label does not fit at the start of an instruction or data block at the end of first pass, so you can fix it and change references to something similar as label+-X, depending on the case...

Anyway, it might be difficult or, at least, cumbersome... and it won't work right in all the cases, but maybe most of the loops, subroutines and such could be easier to read with this help... don't know...
User avatar
Symoon
Archivist
Posts: 2307
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Post by Symoon »

:?: Hey Waskol,
did you ever have time to update OricDasm ?

I'd love to use it :)
Cheers
Yicker
Pilot Officer
Posts: 97
Joined: Thu Jan 26, 2006 11:27 pm
Location: St. Helens, Merseyside, UK

Post by Yicker »

Hi Symoon.

Don't know if it's of any use to you but I've got two utilities that can be downloaded from my website that will produce a disassembly of a file from a Tape or Disk.

They can be downloaded from here : http://oric.mrandmrsdavies.com/

Just go to the download page.

OricDiskInfo is a kinda cut down version of Oric Explorer but just for Disks. I've not finished developing either program so not all the functions are currently working but there should be enough functionality to get what you need.

Cheers
Scott
User avatar
Symoon
Archivist
Posts: 2307
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Post by Symoon »

Hey Yicker,

Seems to be wonderful tools :) Thanks !
I just took a look at them, and will try to actually use them.

I already managed to crah Oric Explorer, I guess it doesn't like the very long path I gave to check the TAP files... Oh well, not so important, but if you ever want to investigate let me know.
(I had to reduce the path in the registry, otherwise the program was crashing when scanning for TAP files).

EDIT: actually, it's not a path problem. The program crashes when it reads a TAP file that holds transfer errors and special loading routines.
If you're interested I can send the file to you.
Yicker
Pilot Officer
Posts: 97
Joined: Thu Jan 26, 2006 11:27 pm
Location: St. Helens, Merseyside, UK

Post by Yicker »

Hi Symoon,

Thanks for trying out Oric Explorer. I'd be very grateful if you could send me the file in question so that I can debug the program.

I'm sure there's lots of other little bugs in there but hopefully not too many. Haven't had much time to do any development on it later but if people are using it then that'll spur me on to get it finished.

Cheers
Scott
User avatar
Symoon
Archivist
Posts: 2307
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Post by Symoon »

You can get the faulty file here:
http://mercenarysite.free.fr/oric/ta3.zip

It holds the TAP file, as well as a TXT file describing the detected errors during the transfer (there might be more than the ones detected). I'll remove it once you have downloaded it.

Good luck ;-)
I tried the programe further and it's great indeed. Having the source code like this, in Basic or ASM, is excellent! The data viewer is amazing, too :shock: .

I didn't check yet if you did it but here's another idea: have an option to display the position in the TAP file itself, so it could correspond to the error report we get when the transfer detected an error. This could be: memory location - binary code - ASM instruction - bytes display - TAP position. Especially useful in a multipart TAP file.

Just found another tape that doesn't display all the parts. This could be due to "parasite" bytes between each part of the TAP file. I'll clean it and let you know.
Yicker
Pilot Officer
Posts: 97
Joined: Thu Jan 26, 2006 11:27 pm
Location: St. Helens, Merseyside, UK

Post by Yicker »

Hi Symoon.

I've downloaded the tape file, I'll try and take a look at it sometime over the next few days.

Thanks for your feedback it's very much appreciated. I'll look at implementing some better error reporting as you suggested as well.

The Data Viewer by the way came about by accident when the software put the wrong end address in the preview window and displayed the whole of the Dambusters tape as HIRES and I noticed the graphics for the Dam screen, funny how these things come about :-D

Cheers
Scott
User avatar
Symoon
Archivist
Posts: 2307
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Post by Symoon »

I'll look at implementing some better error reporting
Actually, I just meant the byte position in the TAP file. This will match with the transfer errors report generated by Fabrice's conversion tools.
EDIT: That would also be very useful for a disk, so one knows exactly where to write in the DSK file to change a file.

I noticed something else tonight.
Are you sure you are displaying the very last byte from a TAP file ?
Seems like it is missing to me.

For instance, you display "$0281-$02CB ; 74 bytes", to me it should be 75 bytes, as both 281 and 2CB are included.
Take a file of 2 bytes long, stored in $0001-$0002. If you do 2-1, you will find a length of 1 byte instead of 2.
The actual lenght of a tape file is ((end address - start address) +1)
:wink:
Yicker
Pilot Officer
Posts: 97
Joined: Thu Jan 26, 2006 11:27 pm
Location: St. Helens, Merseyside, UK

Post by Yicker »

Oops, well spotted.

All the times I've looked at those numbers and didn't notice :oops:

Cheers
Scott :)
User avatar
Symoon
Archivist
Posts: 2307
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Post by Symoon »

Well, after looking at some disks, Oric Explorer is definitely a killer application !

Other "to do" things, if you ever need some :wink:
- saving files as TAP files (from a multipart TAP, or a disk)
- recognise Jasmin disks
I didn't try RANDOS or other DOS yet ;-)

I suspect the lack of spare time made me miss this wonderful program.
Congratulations :D
User avatar
waskol
Flight Lieutenant
Posts: 414
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Post by waskol »

Symoon wrote::?: Hey Waskol,
did you ever have time to update OricDasm ?

I'd love to use it :)
Cheers
I's not dead ! Just a lack of spare time, and i was more worried about an emulator for VISTA/XP :wink:
Post Reply