Skip to content

ridisasmlib

This library turns machine code into assembler text, one instruction per call. DisAssemble$ reads the instruction at an address and returns it as a line; InstrSize then gives the number of bytes that instruction took, so the next instruction starts that many bytes further on. It knows the instructions and addressing modes of the 68000 and part of the 68020’s, including the extended addressing modes of the 68020, register lists of MOVEM and the control registers of MOVEC; floating point, MMU, bit field and CAS instructions are not known.

The line of a known instruction is at least 34 characters long, padded with spaces: the instruction name with its size and condition, in lower case, in the first 9 columns, the operands from column 10 on. A longer line comes back whole. Addresses and immediate values are shown in hexadecimal ($ and upper case digits), displacements as signed decimal numbers. An instruction the library does not know gives ?????.

The library needs no other library and works in Amiga and Blitz mode. The address must be even on a 68000.

This lists the first instructions of the program’s own code at the label mycode:

mycode:
a.l=?mycode
For i=1 To 5
  NPrint DisAssemble$(a)
  a=a+InstrSize
Next

Library number 50.

Commands

DisAssemble$

The instruction at address as a line of assembler text, at least 34 characters long; ????? for an instruction the library does not know.

Function, result $. Help text: (address.l)
Arguments: .l

A shorter line is padded with spaces to 34 characters; a longer one, such as a 68020 instruction with two memory indirect operands, comes back whole.

On a 68000 the address must be even, as the code is read in words.

InstrSize

The size in bytes of the instruction last disassembled with DisAssemble$; 2 for an unknown one, 0 before the first call.

Function, result .l. Help text: - returns size of last instruction disassembled
No arguments.