THE ATARI 6502 DISASSEMBLER

Setting Type To Bytes

As we said earlier, DISASSEMBLY is an INTERACTIVE and ITERATIVE PROCESS. This chapter explains how this is achieved by DIS6502.

You can improve the disassembly process by looking at the dump and changing the byte type. Each byte of the object file has an associated type given by DIS6502. At first, all the bytes are considered as CODE so the disassembler tries to disassemble all bytes of the file as if they were code.

You can change the byte type by selecting some bytes in the dump window and clicking with the right button. A popup menu will appear. Choose 'Type' and a sub-menu will appear. Then you can select the new type for the selection.

For exemple load RAMDISK.COM from DOS 2.5 master disk. In the first segment, scroll the dump window until the end. You see a text saying "Setting Up ATARI 130XE Ram Disk". There is no code here. We have to tell DIS6502.

To do this, in the hexadecimal or ASCII part of the dump window, select bytes from address $3B81 to $3BAA then click the right mouse button inside the dump window and choose "String" in the "Type" sub-menu.


NOTE: In this example, we set the type to Bytes but there are many other types supported by DIS6502 that help you get your disassembly listing nicer and also more readable and understandable.

DIS6502 will disassemble again the file but this time the text "Setting Up ATARI 130XE Ram Disk..." appears in .BYTE directives and not as 6502 instructions (AND #$7D, ORA L1D1D,X...).


The different types are:

Each type is described in the following paragraphs.

Changing the type of one or several bytes is useful to improve the disassembly. You have to look at both the disassembly listing and the dump window. If you see parts of code that mean nothing, then you should look at the dump window to check if it is really 6502 code. You may find that there is a string, a display list, a sprite or anything else. In that case, just select the area and change the byte type to whatever you think it is. These paragraphs explains the different types known by DIS6502.


Code

This byte will be disassembled as code.


Code with Low Byte and Code with High Byte

This type must be applied only on an immediate operand. For example, if you see these bytes in the disassembly:

The disassembler will produce the following listing:

When you see this, you know that $80 and $40 are the Low and Hi bytes of an address. So you select 80 in the dump window and set the type to 'Code with Low Byte'.

When you do this, you tell DIS6502 that $80 is the low byte of an address...but which address? That's what DIS6502 asks you when it opens a dialog box. You have to enter the missing byte of the address (40 in our example).


Then you select 40 and set the type to 'Code with High Byte'. DIS6502 opens again its dialog box but this time you have to enter the low byte (80 in our example). After that, the listing will show:


Byte and Word

You can set some bytes to Byte or Word type. They will appear in .BYTE or .WORD directives in the listing.


Label

This is used when you know that 2 consecutive bytes are an address. If you want to see it as a label, you set both bytes to Label. It will appear as a .WORD directive with a name instead of an hexadecimal address. This name can be either a system equate or a name generated by the disassembler. For example

These 4 bytes are marked as Label. The listing looks like this:


String and Screen Byte

These 2 types are strings. The first one is an ASCII string while the second one is for strings that are used by Antic in the screen memory. Strings appear as .BYTE "hello". Screen bytes appear as .SBYTE "hello" (if this directive is supported by the assembler).


Display List

If you know that some bytes are parts of a display list, you can tell the disassembler. It will produce a readable listing instead of bytes. For example, if you have

It will produce the following listing:

If you are familiar with display list, you recognize LMS, JMP,... with a 'A' prefix which stands for Antic. AEMPTY8 means 8 empty scan lines. ALMS+$06 means Load Memory for Antic mode 6. AEMPTY8, ALMS, AJMP and AVB are predefined labels in ATARI.EQU file.


Data Storage

Data Storage is used to skip bytes in memory. If you see a bunch of .BYTE $00 and you know that it is an uninitialized area that the disassembler has translated into .BYTE directive, then you can set the type of all these bytes to Data Storage. A single .DS directive with the number of bytes skipped will appear in the disassembly listing.