Source Writer

By T.J.P. Peart-Jackson

 

Issue 26

Mar/Apr 87

Next Article >>

<< Prev Article

 

 

Take the hard work out of disassembly by writing direct to disk

The normal run of the mill disassemblers available will produce a listing to printer or screen. This is normally very fine and informative but sometimes we need to customise an existing object code program and to do this the whole disassembly has to be typed in by hand, modified and reassembled. SOURCE WRITER makes this task redundant as you can disassemble your choice of object code and obtain a disassembled source file on disk ready to modify and assemble as you please.

SOURCE WRITER will disassemble a disk file or a collection of disk sectors, a cassette file or an area of memory. Try 0600 to 0620 from memory, for example, and you'll get a disassembly of the cassette loading routine. The format of the disassembly is: line no., address, instruction, and optional data such as Hex and ASCII representation of the code to assist in determining text. An example output is - 11 A0600 PLA *68 " followed by ASCII representation.

The address noted in the label field is essential for tracing branch JMP and JSR instructions. These can be deleted and replaced by your own labels or left as they are, as you wish. The source files can now be customised and assembled as required.

SYNASSEMBLER OR ASSEMBLER EDITOR?

The files generated by SOURCE WRITER are Synassembler compatible but this can easily be made Assembler Editor compatible by making the following changes:

Replace ' .OR$' in line 430 with'* = $'

Replace ' .HS ' in line 480 with '.BYTE $'.

Replace ' *' in line 880 with ';'.

USING THE PROGRAM

After initialising, SOURCE WRITER will display the options available

1 Object code from disk
2 Object code from cassette

3 Object code from memory
4 Object code from disk by sector

Option 1 will read a DOS object code file into F$ for disassembly. Option 2 will read a cassette based object code file into F$. Option 3 will transfer a specified area of memory (ROM or RAM) into F$. The start and end addresses are required in hexadecimal. Option 4 will read a sequence of sectors into F$ in two ways. The first prompt is for starting sector, the second prompt asks if you are anticipating a six byte header. With a DOS disk in drive 1 SOURCE WRITER will disassemble the first 3 boot sectors, however, if you are not expecting a six byte header SOURCE WRITER will next ask for the origin the disassembly is to start at (hexadecimal of course) and the final prompt will then ask for the final sector to be read.

After one of the four options has been completed the next prompt is "Disassembly with Hex Y/N" a 'Y' will cause a note of the object code to be made in the remark field in the line of a disassembly. The next prompt will ask "Disassembly with Ascii Y/N" a 'Y' will cause a note of the Ascii characters represented by the object code to be made in the remark field. This option is extremely useful when trying to determine areas of text within a disassembly.

The final prompt of all is to ask for the name you wish the generated source files to be called. "D1:" is assumed so just type in the file name with no extender. A large file will be broken down into a collection of small manageable files. Each file will be forty to fifty sectors in length. The first file will be "D1:TEST.1" followed by "D1:TEST.2" etc. At ten file intervals you will be asked to insert a blank formatted disk and so on, every ten files. This prevents nasty disk full errors and gives you some work space on each disk.

Unfortunately SOURCE WRITER is a little slow at this stage, so drag out the duster and vacuum and help with the housework. Do not be disheartened however as you are saving yourself hours of keyboard work and making a friend of the au pair!

When SOURCE WRITER has finished you will be given the option of starting another disassembly.

Your limitations? I'm afraid 16k of object code on a 48k RAM machine. Still that's an awful lot of files.

PROGRAM BREAKDOWN

10-60

start display

70-190

sets up and initialises strings and arrays

200-280

displays options

290-970

is the disassembler and source file writer

980-1100

will read a DOS file into F$ for disassembly

1100-1260

will read a cassette file into F$

1270-1430

will transfer a specified area of memory into F$

1440-1610

will load specified sectors into F$

1620-1720

sequentially numbers the source files and prevents disk overflow

1730-2000

is data for the disassembler

2010

is cassette loader data

2020-2030

is the DOS file loader data.

 

 

AtariLister - requires Java

top