BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
ridisasmlib.c File Reference
#include "blitzlib.h"
#include <stddef.h>

Data Structures

struct  disdata

Macros

#define STDEA   0b0000000000111111
#define STDSIZE   0b0000000011000000
#define LINEBUFF   128

Enumerations

enum  {
  IMMED , NONE , RRRMMM11 , TOCCR ,
  TOSR , DESTADDR11 , DESTDATA11 , QIMMED11 ,
  DESTDATA2 , DISPLACE , IMMED2 , DAREG215 ,
  ADDRPI2 , ADDRPI11 , ADDRPD2 , ADDRPD11 ,
  DISPLACE2 , _DATA214202 , DESTADDR2 , TUSP ,
  CONTROL2 , RLIST , BYTE7 , VNUM
}

Functions

void disoneline (void)
void instrsize (void)
static void libinit (void)
 init: clears InstrSize's size (Fixed (#1170): the original's init is RTS); the library needs no system library.
static void libfinit (void)
 finit: nothing (RTS).
static UWORD peekw (void)
static UWORD rdw (void)
static ULONG rdl (void)
static void put (char c)
static UWORD lsrw (UWORD x, UWORD n)
static char * hexprint (ULONG n)
static const char * decprint (ULONG n)
static const char * sdecprint (ULONG n)
static void strcopy (void)
static void hexlast (ULONG n, int digits)
static void error6 (void)
static void immediate (void)
static void indexreg (UWORD ext, char reg, UWORD scale)
static void basereg (char reg, int pc)
static ULONG disp (UWORD sz)
static void indexed (char reg, int pc)
static void decodeearev (UWORD mode, UWORD r)
static void decodeea (UWORD ea)
static void rlist (UWORD op)
static void decodespecial (UWORD code, UWORD op)
static int decode (const struct disdata *e, UWORD op)
ULONG c_disoneline (ULONG addr)
 DisAssemble$(address.l): the instruction at address as a line of at least 34 columns.
ULONG c_instrsize (void)
 InstrSize: the size of the last instruction disassembled.

Variables

static const struct disdata disdata []
struct { 
   UBYTE   code [4] 
   char   linebuff [LINEBUFF] 
   UWORD   opsize 
   UWORD   opextra 
   UWORD   extrainstr 
   UWORD   isdestop 
   UWORD   docomma 
   char   condtable [32] 
   char   bcondtable [32] 
} v
static ULONG disasm_add
static const UBYTE * instr
static char * linepos
static const char * opstr
static char hexbuff2 [11] = "$00000000"
static const char hexchrtab [] = "0123456789ABCDEF"
struct { 
   char   prefix [2] 
   char   digits [16] 
} dec = { "#-", "" }
static const char deczero [] = "0"
static const char scaletab [] = "0248"
static const char pdrlist [32]
static char pdrbuff [50]
static char rangereg
static char rangedigit

Macro Definition Documentation

◆ LINEBUFF

#define LINEBUFF   128

◆ STDEA

#define STDEA   0b0000000000111111

◆ STDSIZE

#define STDSIZE   0b0000000011000000

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
IMMED 
NONE 
RRRMMM11 
TOCCR 
TOSR 
DESTADDR11 
DESTDATA11 
QIMMED11 
DESTDATA2 
DISPLACE 
IMMED2 
DAREG215 
ADDRPI2 
ADDRPI11 
ADDRPD2 
ADDRPD11 
DISPLACE2 
_DATA214202 
DESTADDR2 
TUSP 
CONTROL2 
RLIST 
BYTE7 
VNUM 

Function Documentation

◆ basereg()

void basereg ( char reg,
int pc )
static

◆ c_disoneline()

ULONG c_disoneline ( ULONG addr)

DisAssemble$(address.l): the instruction at address as a line of at least 34 columns.

The first word is matched against DisData; the line (name and size in columns 0-8, the operands from column 9) is written to a3 byte by byte (Fixed (#617): the original's word writes were an address error at an odd a3 on a 68000): a line shorter than 34 columns padded with spaces to 34, a longer one whole (Fixed (#616): the original cut it after 34 columns). InstrSize becomes the bytes the instruction took. A decimal 0 is "0" (Fixed (#614): the original gave the bytes at address 8). An odd address is an address error on a 68000.

Parameters
addrd0: the address of the instruction
Returns
d0: the length, 34 or more; 5 for an instruction not in the table ("?????", InstrSize 2)

◆ c_instrsize()

ULONG c_instrsize ( void )

InstrSize: the size of the last instruction disassembled.

Returns
d0: its bytes (0 before the first DisAssemble$ of the run)

◆ decode()

int decode ( const struct disdata * e,
UWORD op )
static

◆ decodeea()

void decodeea ( UWORD ea)
static

◆ decodeearev()

void decodeearev ( UWORD mode,
UWORD r )
static

◆ decodespecial()

void decodespecial ( UWORD code,
UWORD op )
static

◆ decprint()

const char * decprint ( ULONG n)
static

◆ disoneline()

void disoneline ( void )

◆ disp()

ULONG disp ( UWORD sz)
static

◆ error6()

void error6 ( void )
static

◆ hexlast()

void hexlast ( ULONG n,
int digits )
static

◆ hexprint()

char * hexprint ( ULONG n)
static

◆ immediate()

void immediate ( void )
static

◆ indexed()

void indexed ( char reg,
int pc )
static

◆ indexreg()

void indexreg ( UWORD ext,
char reg,
UWORD scale )
static

◆ instrsize()

void instrsize ( void )

◆ libfinit()

void libfinit ( void )
static

finit: nothing (RTS).

◆ libinit()

void libinit ( void )
static

init: clears InstrSize's size (Fixed (#1170): the original's init is RTS); the library needs no system library.

◆ lsrw()

UWORD lsrw ( UWORD x,
UWORD n )
static

◆ peekw()

UWORD peekw ( void )
static

◆ put()

void put ( char c)
static

◆ rdl()

ULONG rdl ( void )
static

◆ rdw()

UWORD rdw ( void )
static

◆ rlist()

void rlist ( UWORD op)
static

◆ sdecprint()

const char * sdecprint ( ULONG n)
static

◆ strcopy()

void strcopy ( void )
static

Variable Documentation

◆ bcondtable

char bcondtable[32]

◆ code

UBYTE code[4]

◆ condtable

char condtable[32]

◆ [struct]

struct { ... } dec

◆ deczero

const char deczero[] = "0"
static

◆ digits

char digits[16]

◆ disasm_add

ULONG disasm_add
static

◆ disdata

const struct disdata disdata[]
static

◆ docomma

UWORD docomma

◆ extrainstr

UWORD extrainstr

◆ hexbuff2

char hexbuff2[11] = "$00000000"
static

◆ hexchrtab

const char hexchrtab[] = "0123456789ABCDEF"
static

◆ instr

const UBYTE* instr
static

◆ isdestop

UWORD isdestop

◆ linebuff

char linebuff[LINEBUFF]

◆ linepos

char* linepos
static

◆ opextra

UWORD opextra

◆ opsize

UWORD opsize

◆ opstr

const char* opstr
static

◆ pdrbuff

char pdrbuff[50]
static

◆ pdrlist

const char pdrlist[32]
static
Initial value:
=
"d0d1d2d3d4d5d6d7a0a1a2a3a4a5a6a7"

◆ prefix

char prefix[2]

◆ rangedigit

char rangedigit
static

◆ rangereg

char rangereg
static

◆ scaletab

const char scaletab[] = "0248"
static

◆ [struct]

struct { ... } v
Initial value:
= {
{ 0x70, 0x22, 0x4e, 0x75 }, "", 0, 0, 0, 0, 0,
"t f hilscccsneeqvcvsplmigeltgtle",
"rasrhilscccsneeqvcvsplmigeltgtle"
}