BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
rilesdebuglib.c File Reference
#include "blitzlib.h"
#include "blitzexec.h"
#include "blitzdos.h"
#include <dos/dosextens.h>
#include <graphics/gfx.h>
#include <graphics/rastport.h>
#include <graphics/text.h>
#include <proto/graphics.h>
#include <proto/dos.h>

Data Structures

struct  ptok
struct  dt

Macros

#define __NOLIBBASE__
#define GRAPHICS_BASE_NAME   gfxbase
#define DOS_BASE_NAME   dosbase
#define TOK_rawstatus   0x3102
#define RAW_SPACE   64
#define FONT_FILE   "rilesdebuglib-font.bin"
#define FONTSIZE   2048
#define USERTOKENS   20
#define LOWMEM(p)
#define FINDFLAGS   (LDF_READ | LDF_DEVICES | LDF_VOLUMES | LDF_ASSIGNS | LDF_ENTRY)
 D_FindVolume(volumename): look up a device, volume or assign (Amiga mode only).
#define CHECKEND()

Functions

void rilesdebuglib_finddev (void)
void _getsr (void)
void _hexword (void)
void _checknmove (void)
void _checknmove2 (void)
void _findstringptr (void)
void _getcopins (void)
void _flocate (void)
void _fprint (void)
void _fnprint (void)
void _finverse (void)
void _getprogmode (void)
void _fyoffset (void)
void _searchmem (void)
void _searchmemfound (void)
void _peekmax (void)
void _checknmoveword (void)
void _checknmoveword2 (void)
void _gethex (void)
void _gethexadr (void)
void _getcustomreg (void)
void _getcustomregadr (void)
void _fprintdetoke (void)
void _setuplesdebug (void)
void _extractlabel (void)
void _outtext (void)
void _checknmovea (void)
void _checknmovea2 (void)
void _outtextpen (void)
void _initparse (void)
void rilesdebuglib_nextparsearg (void)
void _processstring (void)
void _addprocessptr (void)
void _clearprocessptrs (void)
void _findlinetoken (void)
void _getdataitem (void)
void rilesdebuglib_libinit (void)
void _fprintchk (void)
void _addprocessptrchk (void)
void rilesdebuglib_libfinit (void)
static void libinit_c (void)
 init: open graphics.library (any version) and set ProcessString's p ("REDDebugger") and c (the token list address in hex) entries.
static void libfinit_c (void)
 finit: close graphics.library.
static ULONG finddev_c (CONST_STRPTR name, struct DosLibrary *dosbase)
static void getsr_c (UBYTE *buf, UBYTE sr)
 D_GetSR buffer,SR: the condition codes as text.
static UBYTE * hexbyte (UBYTE *d, const UBYTE **s)
static void hexword_c (const UBYTE *src, UBYTE *dst, UWORD num)
 D_HexWord source,address,num: num words of memory as hex text.
static void checknmove2_c (const UBYTE *s, UBYTE *d, UWORD count)
 D_CheckNMove source_address,dest_address,count: count longs as 4 characters each, one byte left between them.
static void checknmove_c (const UBYTE *s, UBYTE *d)
 D_CheckNMove source_address,dest_address: one long (count 1).
static UBYTE * checkbyte (UBYTE *d, const UBYTE **s)
static void checknmovea2_c (const UBYTE *s, UBYTE *d, UWORD count)
 D_CheckNMoveA source_address,dest_address,count: as D_CheckNMove, with no 0 in the characters and "*" below $420.
static void checknmovea_c (const UBYTE *s, UBYTE *d)
 D_CheckNMoveA source_address,dest_address: one long (count 1).
static void checknmoveword2_c (const UBYTE *s, UBYTE *d, UWORD count)
 D_CheckNMoveWord source_address,dest_address,count: count words as 2 characters each, no gap; no 0, "*" below $420.
static void checknmoveword_c (const UBYTE *s, UBYTE *d)
 D_CheckNMoveWord source_address,dest_address: one word (count 1).
static ULONG findstringptr_c (const UBYTE *areg5, ULONG look)
 D_FindStringPtr(areg5,lookfor): search a long in the 32 KB below an address.
static ULONG peekmax_c (const UBYTE *s, UWORD max)
 PeekMax$(address,max_chars): the string at an address, at most max_chars characters.
static ULONG hexout (ULONG v, int mode)
static ULONG gethex_c (ULONG v, UBYTE mode)
 GetHex$(value,mode): a value as 2, 4 or 8 hex digits.
static ULONG gethexadr_c (const UBYTE *addr, UBYTE mode)
 GetHexAdr$(*value,mode): the byte, word or long at an address in hex.
static ULONG getdataitem_c (const UBYTE *addr, UWORD size)
 GetDataItem(address,size): the byte, word or long at an address.
static ULONG findlinetoken_c (const UBYTE *s)
 FindLineToken(Start_Address): the first token of a tokenised line.
static int column_ok (ULONG x)
static ULONG cursor_offset (void)
static void flocate_c (UWORD x, UWORD y)
 FLocate x,y: the cursor of the font printer.
static void finverse_c (UWORD on)
 FInverse inversemode: inverse printing on or off.
static void fyoffset_c (UWORD off)
 FYOffset pixel_offset: the pixel offset added to the cursor's row.
static void fprint_c (const UBYTE *s, struct BitMap *bm, const ULONG *args)
 FPrint a$: print a string with the 8x8 font into plane 0 of the used bitmap.
static void fnprint_c (const UBYTE *s, struct BitMap *bm, const ULONG *args)
 FNPrint a$: FPrint, then the cursor to the start of the next row.
static void draw_char (struct dt *t, UWORD glyph)
static void fprintdetoke_c (const UBYTE *line, UWORD cio, UWORD typ, UWORD lineoff, ULONG callercol, struct BitMap *bm)
 FPrintDetoke tokenised_string,cio,typ,lineoffset: print a tokenised line with the 8x8 font, its tokens as their names.
static void outtext_c (ULONG x, ULONG y, struct RastPort *rp, CONST_STRPTR s)
 OutText x,y,rastport,address/string: print a string on a RastPort.
static void outtextpen_c (struct RastPort *rp, UWORD pen)
 OutTextPen rastport,pen: SetAPen on a RastPort.
static void coords (UWORD w)
static void outs (const char *s)
static ULONG getcopins_c (const UWORD *ins)
 GetCopIns$(copdata): a copper instruction as text.
static ULONG getcustomreg_c (ULONG reg)
 GetCustomReg(address): the name of a custom chip register.
static ULONG getcustomregadr_c (const UBYTE *name)
 GetCustomRegAdr(name$): the offset of a custom chip register.
static void getprogmode_c (WORD mode, UBYTE *buf)
 GetProgMode mode,buffer: the name of a program mode.
static int space_down (void)
static ULONG searchmem_c (UBYTE type, ULONG value, const UBYTE *p, const UBYTE *end)
 SearchMem(type,value,start_ad,end_ad): search memory for a value.
static ULONG searchmemfound_c (void)
 SearchMemFound: the address SearchMem found.
static void setuplesdebug_c (ULONG tok, UBYTE tokenise)
 SetupLESDebug token_addr,tokenise: the token list for FPrintDetoke.
static ULONG extractlabel_c (const UBYTE *s)
 ExtractLabel(label_string): the label name in a line.
static void initparse_c (const UBYTE *s)
 D_InitParse string: start parsing a string of comma separated arguments.
static ULONG nextparsearg_c (void)
 D_NextArg$: the next argument of D_InitParse's string.
static ULONG processstring_c (void)
 ProcessString: the parser's text with x replaced.
static void addprocessptr_c (const UBYTE *ch, const UBYTE *s)
 AddProcessPtr character,string: a new x entry for ProcessString.
static void clearprocessptrs_c (void)
 ClearProcessPtrs: remove AddProcessPtr's entries.
static void fprintchk_c (const struct BitMap *bm)
 The error check of FPrint, FNPrint and FPrintDetoke (debugger only).
static void addprocessptrchk_c (void)
 The error check of AddProcessPtr (debugger only).

Variables

static const UBYTE font_dat [FONTSIZE]
static const UBYTE hexdigits [16] = "0123456789ABCDEF"
static struct GfxBase * gfxbase
static UWORD xcurs
static UWORD ycurs
static UWORD inverse
static UWORD yoffset
static ULONG tokens
static const UBYTE notoke [] = "?????"
static UBYTE chartyp
static UBYTE plz_tokenise
static ULONG findaddress
static UBYTE parseadr [256]
static UBYTE * curadr
struct { 
   struct ptok   fixed [2] 
   struct ptok   user [USERTOKENS] 
   UBYTE   end [2] 
} stringtokens = { { { 'p', 0, NULL }, { 'c', 0, NULL } } }
static const UBYTE progname [] = "REDDebugger"
static UBYTE tokenaddr [9]
static const UBYTE qamigatext [6] = "QAMIGA"
static const UBYTE amigatext [6] = "AMIGA "
static const UBYTE blitztext [6] = "BLITZ "
static const UBYTE customchipnames [256][8]

Macro Definition Documentation

◆ __NOLIBBASE__

#define __NOLIBBASE__

◆ CHECKEND

#define CHECKEND ( )
Value:
do { \
if (!--steps) { \
if (space_down()) \
return 1; \
steps = 127; \
} \
if (p == end) \
goto notfound; \
} while (0)
struct TagItem end
Definition asllib.c:144
static int space_down(void)
Definition rilesdebuglib.c:1373

◆ DOS_BASE_NAME

#define DOS_BASE_NAME   dosbase

◆ FINDFLAGS

#define FINDFLAGS   (LDF_READ | LDF_DEVICES | LDF_VOLUMES | LDF_ASSIGNS | LDF_ENTRY)

D_FindVolume(volumename): look up a device, volume or assign (Amiga mode only).

LockDosList, FindDosEntry, UnLockDosList with LDF_READ, devices, volumes and assigns. Fixed (#1148): below dos.library V36 (no LockDosList) the device list of DosInfo is walked under Forbid; the original called the V36 functions there, a crash on Kickstart 1.x.

Parameters
named0: the name (without the colon)
dosbasea6: dos.library (!libs doslib)
Returns
d0: -1 if the name is there, 0 if not (or LockDosList failed) (fixed #1167: the original returned the entry it found, after the unlock - below V36 after Permit - an entry of a list the program no longer held), as riamosfunclib's FindVolume

◆ FONT_FILE

#define FONT_FILE   "rilesdebuglib-font.bin"

◆ FONTSIZE

#define FONTSIZE   2048

◆ GRAPHICS_BASE_NAME

#define GRAPHICS_BASE_NAME   gfxbase

◆ LOWMEM

#define LOWMEM ( p)
Value:
((ULONG)(p) < 0x420)

◆ RAW_SPACE

#define RAW_SPACE   64

◆ TOK_rawstatus

#define TOK_rawstatus   0x3102

◆ USERTOKENS

#define USERTOKENS   20

Function Documentation

◆ _addprocessptr()

void _addprocessptr ( void )

◆ _addprocessptrchk()

void _addprocessptrchk ( void )

◆ _checknmove()

void _checknmove ( void )

◆ _checknmove2()

void _checknmove2 ( void )

◆ _checknmovea()

void _checknmovea ( void )

◆ _checknmovea2()

void _checknmovea2 ( void )

◆ _checknmoveword()

void _checknmoveword ( void )

◆ _checknmoveword2()

void _checknmoveword2 ( void )

◆ _clearprocessptrs()

void _clearprocessptrs ( void )

◆ _extractlabel()

void _extractlabel ( void )

◆ _findlinetoken()

void _findlinetoken ( void )

◆ _findstringptr()

void _findstringptr ( void )

◆ _finverse()

void _finverse ( void )

◆ _flocate()

void _flocate ( void )

◆ _fnprint()

void _fnprint ( void )

◆ _fprint()

void _fprint ( void )

◆ _fprintchk()

void _fprintchk ( void )

◆ _fprintdetoke()

void _fprintdetoke ( void )

◆ _fyoffset()

void _fyoffset ( void )

◆ _getcopins()

void _getcopins ( void )

◆ _getcustomreg()

void _getcustomreg ( void )

◆ _getcustomregadr()

void _getcustomregadr ( void )

◆ _getdataitem()

void _getdataitem ( void )

◆ _gethex()

void _gethex ( void )

◆ _gethexadr()

void _gethexadr ( void )

◆ _getprogmode()

void _getprogmode ( void )

◆ _getsr()

void _getsr ( void )

◆ _hexword()

void _hexword ( void )

◆ _initparse()

void _initparse ( void )

◆ _outtext()

void _outtext ( void )

◆ _outtextpen()

void _outtextpen ( void )

◆ _peekmax()

void _peekmax ( void )

◆ _processstring()

void _processstring ( void )

◆ _searchmem()

void _searchmem ( void )

◆ _searchmemfound()

void _searchmemfound ( void )

◆ _setuplesdebug()

void _setuplesdebug ( void )

◆ addprocessptr_c()

void addprocessptr_c ( const UBYTE * ch,
const UBYTE * s )
static

AddProcessPtr character,string: a new x entry for ProcessString.

Behind the last entry; the table holds 20, a 21st is ignored (with runtime error checking refused by addprocessptrchk) (fixed #700: the original had no limit, the 21st entry went over the end mark and overwrote the code of D_InitParse behind the table).

Parameters
chd0: the string whose first character is x
sd1: the string x stands for

◆ addprocessptrchk_c()

void addprocessptrchk_c ( void )
static

The error check of AddProcessPtr (debugger only).

Fixed (#700), not in the original: the table has room for 20 entries; the release code ignores further ones, the check tells the programmer.

Errors: "AddProcessPtr table holds at most 20 entries" when all 20 are in use.

◆ checkbyte()

UBYTE * checkbyte ( UBYTE * d,
const UBYTE ** s )
static

◆ checknmove2_c()

void checknmove2_c ( const UBYTE * s,
UBYTE * d,
UWORD count )
static

D_CheckNMove source_address,dest_address,count: count longs as 4 characters each, one byte left between them.

The bytes are copied as they are (also 0 and below $420). count 0 copies nothing (fixed #701: the original's DBRA ran 65536 times).

Parameters
sd0: the source
dd1: the destination (5 bytes per long)
countd2.w: the number of longs

◆ checknmove_c()

void checknmove_c ( const UBYTE * s,
UBYTE * d )
static

D_CheckNMove source_address,dest_address: one long (count 1).

Parameters
sd0: the source
dd1: the destination

◆ checknmovea2_c()

void checknmovea2_c ( const UBYTE * s,
UBYTE * d,
UWORD count )
static

D_CheckNMoveA source_address,dest_address,count: as D_CheckNMove, with no 0 in the characters and "*" below $420.

A 0 byte becomes 1; an address below $420 (unsigned compare, fixed #717) gives '*'. count 0 writes nothing (fixed #701: the original's DBRA ran 65536 times).

Parameters
sd0: the source
dd1: the destination (5 bytes per long)
countd2.w: the number of longs

◆ checknmovea_c()

void checknmovea_c ( const UBYTE * s,
UBYTE * d )
static

D_CheckNMoveA source_address,dest_address: one long (count 1).

Parameters
sd0: the source
dd1: the destination

◆ checknmoveword2_c()

void checknmoveword2_c ( const UBYTE * s,
UBYTE * d,
UWORD count )
static

D_CheckNMoveWord source_address,dest_address,count: count words as 2 characters each, no gap; no 0, "*" below $420.

count 0 writes nothing, and the byte count count*2 is a long (fixed #701: the original's DBRA of the word count*2-1 ran 65536 times for 0 and $8000, and counts above $8000 lost their top bit); the address check is unsigned (fixed #717).

Parameters
sd0: the source
dd1: the destination
countd2.w: the number of words

◆ checknmoveword_c()

void checknmoveword_c ( const UBYTE * s,
UBYTE * d )
static

D_CheckNMoveWord source_address,dest_address: one word (count 1).

Parameters
sd0: the source
dd1: the destination

◆ clearprocessptrs_c()

void clearprocessptrs_c ( void )
static

ClearProcessPtrs: remove AddProcessPtr's entries.

Only the first entry is cleared: it ends the lookup, and the next AddProcessPtr reuses it (no defect). p and c stay.

◆ column_ok()

int column_ok ( ULONG x)
static

◆ coords()

void coords ( UWORD w)
static

◆ cursor_offset()

ULONG cursor_offset ( void )
static

◆ draw_char()

void draw_char ( struct dt * t,
UWORD glyph )
static

◆ extractlabel_c()

ULONG extractlabel_c ( const UBYTE * s)
static

ExtractLabel(label_string): the label name in a line.

From 9 characters on, the name behind the first '.' up to a 0, ':' or space, at a3; a line without a '.' there (or shorter than 9 characters) gives the empty string (fixed #703: the original searched the '.' without a limit, also behind a 0 among the 9 characters it skips). The space as the source says (fixed #704: the CD's blitz2 2.10 assembled the source's test for it as CMPI.b #0, compiler bug #343, fixed in blitz2-c; in every binary a space did not end the label).

Parameters
sd0: the line
Returns
d0: the length of the name

◆ finddev_c()

ULONG finddev_c ( CONST_STRPTR name,
struct DosLibrary * dosbase )
static

◆ findlinetoken_c()

ULONG findlinetoken_c ( const UBYTE * s)
static

FindLineToken(Start_Address): the first token of a tokenised line.

A token is a byte with bit 7 and the next byte.

Parameters
sd0: the line
Returns
d0.w: the token as a word without bit 15, 0 at the end of the line; d0's high word stays (the address's)

◆ findstringptr_c()

ULONG findstringptr_c ( const UBYTE * areg5,
ULONG look )
static

D_FindStringPtr(areg5,lookfor): search a long in the 32 KB below an address.

From areg5-32768 in steps of 2 up to areg5; the long at areg5 itself is not compared (like the original, no defect: the 32 KB below a5 are what the caller searches, #705).

Parameters
areg5d0: the end of the search
lookd1: the long to find
Returns
d0: the first address with the long, -1 if not found (not a truth value)

◆ finverse_c()

void finverse_c ( UWORD on)
static

FInverse inversemode: inverse printing on or off.

FPrint and FPrintDetoke test the word (fixed #706: FPrintDetoke tested only its high byte, FInverse 1 inverted FPrint only).

Parameters
ond0.w: nonzero inverse

◆ flocate_c()

void flocate_c ( UWORD x,
UWORD y )
static

FLocate x,y: the cursor of the font printer.

Parameters
xd0.w: the column (8 pixels each)
yd1.w: the row (8 pixels each)

◆ fnprint_c()

void fnprint_c ( const UBYTE * s,
struct BitMap * bm,
const ULONG * args )
static

FNPrint a$: FPrint, then the cursor to the start of the next row.

Parameters
sd0: the string
bma0: the used bitmap (!libs bitmaplib)
argsa2: the argument stack, the string's length at -4(a2)

◆ fprint_c()

void fprint_c ( const UBYTE * s,
struct BitMap * bm,
const ULONG * args )
static

FPrint a$: print a string with the 8x8 font into plane 0 of the used bitmap.

At the cursor, 8 bytes per character in rows of 80 bytes, inverted if the FInverse word is set; the cursor moves on. Columns of 80 and more print nothing (fixed #707: the original compared the column's low byte on the sign of the difference, columns 208-255 printed on); the bitmap's size is checked only with runtime error checking (fprintchk, fixed #707). The length is counted as a long (fixed #710: the original's SUBQ.w/BMI printed nothing for a string of 32769 characters or more).

Parameters
sd0: the string
bma0: the used bitmap (!libs bitmaplib)
argsa2: the argument stack, the string's length at -4(a2)

◆ fprintchk_c()

void fprintchk_c ( const struct BitMap * bm)
static

The error check of FPrint, FNPrint and FPrintDetoke (debugger only).

Fixed (#707), not in the original (rilesdebuglib had no error check area): the font printer writes rows of 80 bytes, 8 rows of pixels per character, at the cursor's row plus FYOffset, and never looked at the used bitmap's size: in a narrower bitmap the characters landed in the wrong rows, and rows below the bitmap were written. Arguments the programmer controls (D-005): the release code prints as before.

Errors: "Font printer needs a bitmap of 640 pixels" for fewer than 80 bytes per row; "Font printer row outside the bitmap" when the 8 pixel rows at the cursor do not all lie in the bitmap.

Parameters
bma0: the used bitmap (!libs bitmaplib,ua0)

◆ fprintdetoke_c()

void fprintdetoke_c ( const UBYTE * line,
UWORD cio,
UWORD typ,
UWORD lineoff,
ULONG callercol,
struct BitMap * bm )
static

FPrintDetoke tokenised_string,cio,typ,lineoffset: print a tokenised line with the 8x8 font, its tokens as their names.

At the cursor in plane 0 of the used bitmap; tokens (a byte with bit 7 and the next) as their names from the token list of SetupLESDebug ("?????" for an unknown one), also into plane 1 with SetupLESDebug's tokenise; lineoffset characters skipped from the left; before the character at cio a marker, '>' (typ 0) or an inverse space. Inverse printing tests the FInverse word, and the marker leaves it as it was (fixed #706: the original tested its high byte, so FInverse 1 did not invert here, and the marker set and cleared that byte); with it set and tokens drawn into two planes, plane 1 gets the same inverted glyphs (fixed #709: the original gave it the glyph of the character of the last glyph byte). The '>' marker is never followed by the inverse space (fixed #708: the original's BSR draw_char : SBNE 'con drew it too when the column count, d6 with the caller's high word, became 0). The column check is FPrint's, also for the character behind a marker (fixed #707: the original drew that one without the test).

Parameters
lined0: the tokenised line (0-terminated)
ciod1.w: the character before which the marker goes
typd2.b: the marker, 0 '>', else an inverse space
lineoffd3.w: the characters to skip
callercold6: the caller's d6, its high word kept in the column count
bma0: the used bitmap (!libs bitmaplib)

◆ fyoffset_c()

void fyoffset_c ( UWORD off)
static

FYOffset pixel_offset: the pixel offset added to the cursor's row.

Parameters
offd0.w: the offset in pixel lines

◆ getcopins_c()

ULONG getcopins_c ( const UWORD * ins)
static

GetCopIns$(copdata): a copper instruction as text.

"MOVE vvvv to NAME " (the register's 8 character name) or "WAIT|SKIP (xx,yy) MASK (xx,yy)[ [BFD]]"; the low horizontal digit without bit 0, the instruction bit (fixed #711: the original cleared bit 0 of the high digit too, its odd values never showed). Written at a3, no 0.

Parameters
insd0: the instruction (two words)
Returns
d0: the length (21, 25 or 31)

◆ getcustomreg_c()

ULONG getcustomreg_c ( ULONG reg)
static

GetCustomReg(address): the name of a custom chip register.

The name up to its first space, at most 8 characters, at a3 (fixed #712: the original stopped only after a 9th character, so a name of 8 characters got the first one of the next name behind it, a3 one behind the result of the length 8). The range is $000-$1FE (fixed #702: the original stopped at $1FC, the last register NOOP had no name); the range test compares the word unsigned (fixed #714: the original tested the word signed and the long for negative, so a negative word with d0.l not negative read in front of the name table); the high word is not looked at.

Parameters
regd0.w: the register's offset ($000-$1FE)
Returns
d0: the length, 0 for an offset out of range

◆ getcustomregadr_c()

ULONG getcustomregadr_c ( const UBYTE * name)
static

GetCustomRegAdr(name$): the offset of a custom chip register.

The first register among $000-$1FE whose name (up to a space, at most 8 characters) the string is (fixed #713: the original matched a prefix, the string could go on behind the name, and never found a name of 8 characters, its compare ran into the next name). The last register, $1FE NOOP, is looked at too (fixed #702: the original stopped at $1FC).

Parameters
named0: the name
Returns
d0: the offset, -1 if not found (not a truth value)

◆ getdataitem_c()

ULONG getdataitem_c ( const UBYTE * addr,
UWORD size )
static

GetDataItem(address,size): the byte, word or long at an address.

Read byte by byte (also at odd addresses); every size but 1 and 2 is a long, as the help text says (fixed #701: the original read a long only from size 3 on, size 0 shifted 65536 bytes through the result and a negative size fewer, -1 65535, by a DBRA from the word size-1).

Parameters
addrd0: the address
sized1.w: 1 byte, 2 word, otherwise long
Returns
d0: the value, 0 for an address below $420 (an unsigned compare, fixed #717)

◆ gethex_c()

ULONG gethex_c ( ULONG v,
UBYTE mode )
static

GetHex$(value,mode): a value as 2, 4 or 8 hex digits.

Written at a3, no 0.

Parameters
vd0: the value
moded1.b: 1 byte, 2 word, otherwise long
Returns
d0: the length (2, 4, 8)

◆ gethexadr_c()

ULONG gethexadr_c ( const UBYTE * addr,
UBYTE mode )
static

GetHexAdr$(*value,mode): the byte, word or long at an address in hex.

As GetHex$; no check of low addresses. The word or long is read byte by byte, as GetDataItem does, so an odd address works on a 68000 too (fixed #1168: the original read it with one MOVE.w or MOVE.l, an address error there).

Parameters
addrd0: the address
moded1.b: 1 byte, 2 word, otherwise long
Returns
d0: the length (2, 4, 8)

◆ getprogmode_c()

void getprogmode_c ( WORD mode,
UBYTE * buf )
static

GetProgMode mode,buffer: the name of a program mode.

Six characters, no 0: "BLITZ " (< 0), "AMIGA " (0), "QAMIGA" (> 0).

Parameters
moded0.w: the mode
bufd1: the buffer

◆ getsr_c()

void getsr_c ( UBYTE * buf,
UBYTE sr )
static

D_GetSR buffer,SR: the condition codes as text.

"XNZVC" with '-' for the bits not set, and a 0 (6 bytes).

Parameters
bufd0: the buffer
srd1.b: the status register (its low byte)

◆ hexbyte()

UBYTE * hexbyte ( UBYTE * d,
const UBYTE ** s )
static

◆ hexout()

ULONG hexout ( ULONG v,
int mode )
static

◆ hexword_c()

void hexword_c ( const UBYTE * src,
UBYTE * dst,
UWORD num )
static

D_HexWord source,address,num: num words of memory as hex text.

"XXXX " each; at an odd source "XX YY" per loop, the words at the even addresses (like the original, no defect, #715). Bytes at addresses below $420 show "*" (an unsigned compare, fixed #717). No 0 is written. num 0 writes nothing (fixed #701: the original's DBRA ran 65536 times).

Parameters
srcd0: the source address
dstd1: the buffer
numd2.w: the number of words

◆ initparse_c()

void initparse_c ( const UBYTE * s)
static

D_InitParse string: start parsing a string of comma separated arguments.

At most 255 characters of the string are copied into the parser's 256 byte buffer, with a 0 behind them (fixed #716: the original copied without a limit, over the parser's pointer and code behind the buffer); the position goes to its start.

Parameters
sd0: the string

◆ libfinit_c()

void libfinit_c ( void )
static

finit: close graphics.library.

◆ libinit_c()

void libinit_c ( void )
static

init: open graphics.library (any version) and set ProcessString's p ("REDDebugger") and c (the token list address in hex) entries.

AddProcessPtr's 20 entries are cleared (fixed #700: a run from the editor started with the run before's entries, which counted toward the limit and pointed into its freed strings). The rest of the state gets its first load's values too (fixed #1169: a second run started with the run before's cursor, FInverse, FYOffset, SearchMemFound, token list and tokenise, parser position and c text): the library stays loaded between two runs of a program from the editor.

◆ nextparsearg_c()

ULONG nextparsearg_c ( void )
static

D_NextArg$: the next argument of D_InitParse's string.

The characters up to the next ',' (at a3); after the last argument the position is 0 and the result empty.

Returns
d0: the length

◆ outs()

void outs ( const char * s)
static

◆ outtext_c()

void outtext_c ( ULONG x,
ULONG y,
struct RastPort * rp,
CONST_STRPTR s )
static

OutText x,y,rastport,address/string: print a string on a RastPort.

Move to x, y + the baseline of the rastport's font (a word add), Text with the string's length (counted up to the 0).

Parameters
xd0.w: the x position
yd1.w: the y position (of the top of the text)
rpd2: the RastPort
sd3: the string (an address or a string)

◆ outtextpen_c()

void outtextpen_c ( struct RastPort * rp,
UWORD pen )
static

OutTextPen rastport,pen: SetAPen on a RastPort.

Parameters
rpd0: the RastPort
pend1.w: the pen (SetAPen gets d0's high word, the rastport's, with the pen as the low word)

◆ peekmax_c()

ULONG peekmax_c ( const UBYTE * s,
UWORD max )
static

PeekMax$(address,max_chars): the string at an address, at most max_chars characters.

The characters up to the 0, at most max, go to a3; a max below 1 gives the empty string (fixed #718: the original tested the count after the copy, wrote max+1 characters and returned the length max, a3 one behind the result). No check of low addresses.

Parameters
sd0: the address
maxd1.w: the maximum number of characters
Returns
d0: the length

◆ processstring_c()

ULONG processstring_c ( void )
static

ProcessString: the parser's text with x replaced.

The text from the parser's current position (no argument: the command works on what D_InitParse stored, as its caller uses it), at a3, with x replaced by the string of entry x (p "REDDebugger", c the token list address, then AddProcessPtr's entries); %% gives a '', a x without an entry drops x. Without a parser position (before D_InitParse, after the last D_NextArg$) the result is empty, as D_NextArg$'s (fixed #719: the original read the text at address 0, and its help text named an argument "string"). A '' at the end of the text ends it (fixed #720: the original took the 0 behind it as the entry's name and went on behind the text).

Returns
d0: the length

◆ rilesdebuglib_finddev()

void rilesdebuglib_finddev ( void )

◆ rilesdebuglib_libfinit()

void rilesdebuglib_libfinit ( void )

◆ rilesdebuglib_libinit()

void rilesdebuglib_libinit ( void )

◆ rilesdebuglib_nextparsearg()

void rilesdebuglib_nextparsearg ( void )

◆ searchmem_c()

ULONG searchmem_c ( UBYTE type,
ULONG value,
const UBYTE * p,
const UBYTE * end )
static

SearchMem(type,value,start_ad,end_ad): search memory for a value.

The first place in start..end-1 with the byte (type 1), word (2), long (3, 5, 6) or string (4, value = its address); another type finds nothing. The space bar is tested (RawStatus) every 127 steps and ends the search. After a mismatch behind a partial match the string search goes on one byte behind the partial match's start (fixed #723: the original went on behind the mismatch, "ab" was not found in "aab"); an empty string finds nothing (fixed #721: the original compared its 0 and the bytes behind it). A word or long counts only if it lies in front of the end (fixed #722: the original compared bytes up to 1 or 3 behind the end).

Parameters
typed0.b: the type
valued1: the value, or the string's address
pd2: the start
endd3: the end (exclusive)
Returns
d0: -1 found (SearchMemFound = the address), 0 not found (SearchMemFound = 0), 1 when the space bar was down (SearchMemFound kept) - three values, so not BB_BOOL

◆ searchmemfound_c()

ULONG searchmemfound_c ( void )
static

SearchMemFound: the address SearchMem found.

Returns
d0: the address, 0 after a search that found nothing

◆ setuplesdebug_c()

void setuplesdebug_c ( ULONG tok,
UBYTE tokenise )
static

SetupLESDebug token_addr,tokenise: the token list for FPrintDetoke.

Also its address as 8 hex digits, ProcessString's c. The list: a chain of entries, the next at +0, the token number at +4, the name at +6.

Parameters
tokd0: the token list
tokenised1.b: nonzero: FPrintDetoke draws token names into plane 1 too

◆ space_down()

int space_down ( void )
static

Variable Documentation

◆ amigatext

const UBYTE amigatext[6] = "AMIGA "
static

◆ blitztext

const UBYTE blitztext[6] = "BLITZ "
static

◆ chartyp

UBYTE chartyp
static

◆ curadr

UBYTE* curadr
static

◆ customchipnames

const UBYTE customchipnames[256][8]
static

◆ end

UBYTE end[2]

◆ findaddress

ULONG findaddress
static

◆ fixed

struct ptok fixed[2]

◆ font_dat

const UBYTE font_dat[FONTSIZE]
static
Initial value:
= {
}

◆ gfxbase

struct GfxBase* gfxbase
static

◆ hexdigits

const UBYTE hexdigits[16] = "0123456789ABCDEF"
static

◆ inverse

UWORD inverse
static

◆ notoke

const UBYTE notoke[] = "?????"
static

◆ parseadr

UBYTE parseadr[256]
static

◆ plz_tokenise

UBYTE plz_tokenise
static

◆ progname

const UBYTE progname[] = "REDDebugger"
static

◆ qamigatext

const UBYTE qamigatext[6] = "QAMIGA"
static

◆ [struct]

struct { ... } stringtokens

◆ tokenaddr

UBYTE tokenaddr[9]
static

◆ tokens

ULONG tokens
static

◆ user

struct ptok user[USERTOKENS]

◆ xcurs

UWORD xcurs
static

◆ ycurs

UWORD ycurs
static

◆ yoffset

UWORD yoffset
static