diff defs.s @ 0:605ff82c4618

Initial check in with cleaned up sources This is the initial check in the source code in a state where it builds byte accurate copies of all the various ROM versions included.
author William Astle <lost@l-w.ca>
date Sat, 08 Dec 2018 19:57:01 -0700
parents
children 704b2c9dc19e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/defs.s	Sat Dec 08 19:57:01 2018 -0700
@@ -0,0 +1,477 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; First, some useful macro definitions to avoid most instances with FCB standing for actual code.
+skip1           macro noexpand
+                fcb 0x21                        ; opcode of BRN which causes next code byte to be skipped
+                endm
+skip2           macro noexpand
+                fcb 0x8c                        ; opcode of CMPX immediate which will skip two bytes (but clobbers flags)
+                endm
+skip2keepc      macro noexpand
+                fcb 0x7d                        ; opcode of TST extended which will skip two bytes like above but preserves C
+                endm
+skip1lda        macro noexpand
+                fcb 0x86                        ; opcode of LDA immediate; used to load A with nonzero and skip a CLRA, usually
+                endm
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Now various constants used in the ROMs.
+STKBUF          equ 58                          ; extra room kept between the stack and variables during memory checks
+DEBDEL          equ 0x45e                       ; delay constant for debouncing the keyboard (10ms at standard clock speed)
+LBUFMX          equ 250                         ; size of the line input buffer
+MAXLIN          equ 0xfa                        ; the maximum MS byte of a line number
+DOSBUF          equ 0x2600                      ; address where DOS command loads track 24
+DIRLEN          equ 32                          ; size of a directory entry on disk
+SECLEN          equ 256                         ; length of a disk sector
+SECMAX          equ 18                          ; number of sectors per track
+TRKLEN          equ SECMAX*SECLEN               ; number of bytes on a track
+TRKMAX          equ 35                          ; number of tracks per disk
+FATLEN          equ 6+(TRKMAX-1)*2              ; size of memory copy of a file allocation table
+GRANMX          equ (TRKMAX-1)*2                ; number of granules per disk
+FCBLEN          equ SECLEN+25                   ; size of a file control block
+INPFIL          equ 0x10                        ; input file type
+OUTFIL          equ 0x20                        ; output file type
+RANFIL          equ 0x40                        ; random file type
+ROWMAX          equ 24                          ; the number of rows on the hi-res text screen
+HRESSCRN        equ 0x2000                      ; where the hi-res text screen starts in logical memory
+HRESBUFF        equ 0xc000                      ; where the HGET/HPUT buffers are in logical memory
+TMPSTACK        equ 0xdfff                      ; temporary stack location when in secondary memory map
+CURCHAR         equ SPACE                       ; hi-res text screen cursor character
+; HGET/HPUT buffer header structure
+HB.ADDR         equ 0                           ; address of next buffer (2 bytes)
+HB.NUM          equ 2                           ; number of this buffer (1 byte)
+HB.SIZE         equ 3                           ; number of bytes in this buffer (2 bytes)
+HB.LEN          equ 5                           ; number of bytes in a buffer header
+; Video register definitions
+; INIT0
+COCO            equ 0x80                        ; 1 = Coco2 compatible mode
+MMUEN           equ 0x40                        ; 1 = MMU enabled
+IEN             equ 0x20                        ; 1 = IRQ enabled
+FEN             equ 0x10                        ; 1 = FIRQ enabled
+MC3             equ 0x08                        ; 1 = FExx constant page enabled
+MC2             equ 0x04                        ; 1 = Standard SCS operation
+MC1             equ 0x02                        ; ROM map control bit 1
+MC0             equ 0x01                        ; ROM map control bit 0
+; Interrupt enable/status bits
+TMR             equ 0x20                        ; TIMER
+HBORD           equ 0x10                        ; horizontal border
+VBORD           equ 0x08                        ; vertical border
+EI2             equ 0x04                        ; serial data
+EI1             equ 0x02                        ; keyboard
+EI0             equ 0x01                        ; cartridge port
+; Memory block definitions
+BLOCK6.0        equ 0x30                        ; hi-res graphics screen
+BLOCK6.1        equ 0x31                        ; hi-res graphics screen
+BLOCK6.2        equ 0x32                        ; hi-res graphics screen
+BLOCK6.3        equ 0x33                        ; hi-res graphics screen
+BLOCK6.4        equ 0x34                        ; HGET/HPUT buffers
+BLOCK6.5        equ 0x35                        ; stack space for hi-res graphics operations
+BLOCK6.6        equ 0x36                        ; hi-res text screen
+BLOCK6.7        equ 0x37                        ; unused by Basic
+BLOCK7.0        equ 0x38                        ; standard 64K memory map
+BLOCK7.1        equ 0x39                        ; standard 64K memory map
+BLOCK7.2        equ 0x3a                        ; standard 64K memory map
+BLOCK7.3        equ 0x3b                        ; standard 64K memory map
+BLOCK7.4        equ 0x3c                        ; standard 64K memory map
+BLOCK7.5        equ 0x3d                        ; standard 64K memory map
+BLOCK7.6        equ 0x3e                        ; standard 64K memory map
+BLOCK7.7        equ 0x3f                        ; standard 64K memory map (constant page comes from this block)
+; Disk Basic FAT data format. The memory image contains a six byte header followed by the cached copy
+; of the FAT from the disk. The cached copy may be modified compared to the copy on disk. This is indicated
+; by a nonzero of the "FAT1" byte.
+FAT0            equ 0                           ; active file counter for this image
+FAT1            equ 1                           ; data changed flag - nonzero means write is needed
+FATCON          equ 6                           ; offset to start of FAT data
+; Directory entry format. Entries are 32 bytes long but only the first 16 are used.
+DIRNAM          equ 0                           ; file name (8 characters)
+DIREXT          equ 8                           ; extention (3 characters)
+DIRTYP          equ 11                          ; file type number
+DIRASC          equ 12                          ; ASCII flag
+DIRGRN          equ 13                          ; first granule number for the file
+DIRLST          equ 14                          ; number of bytes used in last sector (two bytes are needed)
+; File control block format.
+FCBTYP          equ 0                           ; file type: 0x40=RANDOM, 0x20=WRITE, 0x10=READ
+FCBDRV          equ 1                           ; drive number
+FCBFGR          equ 2                           ; first granule in the file
+FCBCGR          equ 3                           ; current granule being used
+FCBSEC          equ 4                           ; current sector within granule
+FCBCPT          equ 5                           ; input file - next char to be read; output: sector full flag (sequential)
+FCBPOS          equ 6                           ; current print position (0 for random files)
+FCBREC          equ 7                           ; current record number (random files)
+FCBRLN          equ 9                           ; random file record length
+FCBBUF          equ 11                          ; pointer to the start of this files buffer
+FCBSOF          equ 13                          ; sector offset to current position in the record
+FCBFLG          equ 15                          ; GET/PUT flag
+FCBCFL          equ 16                          ; cache flag: nonzero is cache full (sequential)
+FCBCDT          equ 17                          ; cache byte (sequential)
+FCBDIR          equ 18                          ; directory entry number
+FCBLST          equ 19                          ; number of bytes in last sector of the file
+FCBGET          equ 21                          ; GET record counter (how many pulled from record)
+FCBPUT          equ 23                          ; PUT record counter (where to put next byte in record)
+FCBDFL          equ 23                          ; input file: data left flag (nonzero is no data)
+FCBLFT          equ 24                          ; number of characters left in input file buffer
+FCBCON          equ 25                          ; offset to data buffer
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; This is the memory map and variable definitions for the entire system (all levels of Basic)
+; NOTE: unnamed variables (Vxx) are generally scratch variables used for various purpose. As such, no further description is
+; provided for those.
+                org 0
+                setdp 0
+ENDFLG          rmb 1                           ; STOP/END flag: bit 7 set means STOP, bit 7 clear means END
+CHARAC          rmb 1                           ; terminator character for searches
+ENDCHR          rmb 1                           ; terminator character for searches
+TMPLOC          rmb 1                           ; scratch variable
+IFCTR           rmb 1                           ; number of "IF" statements encountered while scanning a line
+DIMFLG          rmb 1                           ; nonzero means dimensioning, zero means evaluating (when parsing array)
+VALTYP          rmb 1                           ; the type of the current value when evaluating expressions
+GARBFL          rmb 1                           ; flag for whether garbage collection has been done yet when allocating strings
+ARYDIS          rmb 1                           ; nonzero means don't parse arrays when parsing variables
+INPFLG          rmb 1                           ; are we running INPUT or READ - nonzero for INPUT
+RELFLG          rmb 1                           ; which relational operators are currently in play
+TEMPPT          rmb 2                           ; pinter to the top of the string stack
+LASTPT          rmb 2                           ; pointer to the last entry on the string stack
+TEMPTR          rmb 2                           ; scratch pointer
+TMPTR1          rmb 2                           ; scratch pointer
+FPA2            rmb 4                           ; floating point accumulator, mantissa only
+BOTSTK          rmb 2                           ; bottom of stack during last check; also a scratch variable
+TXTTAB          rmb 2                           ; pointer to the beginning of the program
+VARTAB          rmb 2                           ; pointer to the beginning of the scalar variable table (end of program)
+ARYTAB          rmb 2                           ; pointer to the beginning of the array table (end of scalars)
+ARYEND          rmb 2                           ; pointer to the end of the array table (start of free memory)
+FRETOP          rmb 2                           ; top of free memory (start of string space)
+STRTAB          rmb 2                           ; start of allocates string space
+FRESPC          rmb 2                           ; pointer to newly allocated string space
+MEMSIZ          rmb 2                           ; top of memory (and string space) allowed for the interpreter to size
+OLDTXT          rmb 2                           ; save line number during STOP
+BINVAL          rmb 2                           ; binary value of line number during parsing
+OLDPTR          rmb 2                           ; saving input pointer during STOP
+TINPTR          rmb 2                           ; temporary input pointer storage
+DATTXT          rmb 2                           ; line number where we're looking for DATA
+DATPTR          rmb 2                           ; input pointer where we're looking for DATA
+DATTMP          rmb 2                           ; scratch pointer for INPUT and READ
+VARNAM          rmb 2                           ; storage for variable name during parsing
+VARPTR          rmb 2                           ; pointer to variable descriptor
+VARDES          rmb 2                           ; pointer to variable descriptor
+RELPTR          rmb 2                           ; pointer to relational operator processing routine
+TRELFL          rmb 1                           ; temporary relational operator flags
+V40             rmb 1
+V41             rmb 1
+V42             rmb 1
+V43             rmb 1
+V44             rmb 1
+V45             rmb 1
+V46             rmb 1
+V47             rmb 1
+V48             rmb 2
+V4A             rmb 1
+V4B             rmb 2 
+V4D             rmb 2
+FP0EXP          rmb 1                           ; floating point accumulator #0 exponent
+FPA0            rmb 4                           ; floating point accumulator #0 mantissa
+FP0SGN          rmb 1                           ; floating point accumulator #0 sign
+COEFCT          rmb 1                           ; polynomial expansion coefficient counter
+STRDES          rmb 5                           ; temporary string descriptor
+FPCARY          rmb 1                           ; floating point carry byte
+FP1EXP          rmb 1                           ; floating point accumulator #1 exponent
+FPA1            rmb 4                           ; floating point accumulator #1 mantissa
+FP1SGN          rmb 1                           ; floating point accumulator #1 sign
+RESSGN          rmb 1                           ; pre-calculated result sign
+FPSBYT          rmb 1                           ; floating point extra precision underflow byte
+COEFPT          rmb 2                           ; polynomial expansion coefficient pointer
+LSTTXT          rmb 2                           ; current line pointer during LIST
+CURLIN          rmb 2                           ; line number of currently executing statement (0xffff for direct)
+DEVCFW          rmb 1                           ; width of tab field for current device
+DEVLCF          rmb 1                           ; column of last tab field for current device
+DEVPOS          rmb 1                           ; current output column for current device
+DEVWID          rmb 1                           ; number of characters per line for current device
+PRTDEV          rmb 1                           ; print device flag: 0xff for non-display device (tape)
+DEVNUM          rmb 1                           ; current I/O device/file number (signed)
+CINBFL          rmb 1                           ; EOF flag for console in (0xff for EOF)
+RSTFLG          rmb 1                           ; warm start enable flag: 0x55 for enabled
+RSTVEC          rmb 2                           ; pointer to warm start routine (must start with NOP)
+TOPRAM          rmb 2                           ; the actual top of memory
+                rmb 2                           ; *unused*
+FILSTA          rmb 1                           ; status of tape file (0=closed, 1=input, 2=output)
+CINCTR          rmb 1                           ; number of characters in buffer
+CINPTR          rmb 2                           ; pointer to current buffer location
+BLKTYP          rmb 1                           ; cassette block type
+BLKLEN          rmb 1                           ; length of cassette block
+CBUFAD          rmb 2                           ; pointer to data buffer for cassette I/O
+CCKSUM          rmb 1                           ; cassette checksum
+CSRERR          rmb 1                           ; cassette error flag/charactercount
+CPULWD          rmb 1                           ; pulse width counter
+CPERTM          rmb 1                           ; bit counter
+CBTPHA          rmb 1                           ; sync phase flag
+CLSTSN          rmb 1                           ; last sine table entry
+GRBLOK          rmb 1                           ; graphic block value for SET/RESET/POINT
+IKEYIM          rmb 1                           ; cached key read during BREAK check
+CURPOS          rmb 2                           ; screen cursor position
+ZERO            rmb 2                           ; always kept as 0
+SNDTON          rmb 1                           ; tone value for SOUND
+SNDDUR          rmb 2                           ; duration value for SOUND
+CMPMID          rmb 1                           ; 1200/2400 Hz partition (why is this a variable?)
+CMP0            rmb 1                           ; upper limit of 1200 Hz period (why is this a variable?)
+CMP1            rmb 1                           ; upper limit of 2400 Hz period (why is this a variable?)
+SYNCLN          rmb 2                           ; number of 0x55s for a cassette leader (why is this a variable?)
+BLKCNT          rmb 1                           ; cursor blink delay counter
+LPTBTD          rmb 2                           ; serial baud rate delay count
+LPTLND          rmb 2                           ; delay for waiting for carriage return
+LPTCFW          rmb 1                           ; tab field width for printer
+LPTLCF          rmb 1                           ; last tab field position for printer
+LPTWID          rmb 1                           ; width of printer line
+LPTPOS          rmb 1                           ; current character position for printer
+EXECJP          rmb 2                           ; default jump address for EXEC
+GETNCH          rmb 6                           ; fetch next character for interpretation (INC CHARAD+1\BNE GETCCH\INC CHARAD)
+GETCCH          rmb 1                           ; re-fetch the current character for interpretation (opcode of LDA extended)
+CHARAD          rmb 2                           ; current input pointer
+                rmb 3                           ; (JMP BROMHK)
+VAB             rmb 1
+VAC             rmb 1
+VAD             rmb 1
+VAE             rmb 1
+TRCFLG          rmb 1                           ; is TRACE enabled? nonzero is on
+USRADR          rmb 2                           ; address of the start of USR vectors
+FORCOL          rmb 1                           ; bitmap foreground colour
+BAKCOL          rmb 1                           ; bitmap background colour
+WCOLOR          rmb 1                           ; bitmap working colour
+ALLCOL          rmb 1                           ; byte with all pixels set to WCOLOR
+PMODE           rmb 1                           ; which PMODE is active
+ENDGRP          rmb 2                           ; end of current bitmap graphics page
+HORBYT          rmb 1                           ; number of bytes per bitmap row
+BEGGRP          rmb 2                           ; start of current bitmap graphics page
+GRPRAM          rmb 1                           ; MSB of start of bitmap graphics
+HORBEG          rmb 2                           ; horizontal starting coordinate
+VERBEG          rmb 2                           ; vertical starting coordinate
+CSSVAL          rmb 1                           ; SCREEN's colour set value
+SETFLG          rmb 1                           ; doing PSET or PRESET? (nonzero = PSET)
+HOREND          rmb 2                           ; horizontal ending coordinate
+VEREND          rmb 2                           ; vertical ending coordinate
+HORDEF          rmb 2                           ; default horizontal coordinate
+VERDEF          rmb 2                           ; default vertical coordinate
+VCB             rmb 2
+VCD             rmb 2
+VCF             rmb 2
+VD1             rmb 2
+VD3             rmb 1
+VD4             rmb 1
+VD5             rmb 1
+VD6             rmb 1
+VD7             rmb 1
+VD8             rmb 1
+VD9             rmb 1
+VDA             rmb 1
+CHGFLG          rmb 1                           ; flag indicating if graphic data changed
+TMPSTK          rmb 2                           ; temporary stack pointer during PAINT
+OCTAVE          rmb 1                           ; PLAY octave
+VOLHI           rmb 1                           ; PLAY high volume value
+VOLLOW          rmb 1                           ; PLAY low volumnevalue
+NOTELN          rmb 1                           ; PLAY notelength
+TEMPO           rmb 1                           ; PLAY tempo
+PLYTMR          rmb 2                           ; PLAY timer
+DOTVAL          rmb 1                           ; PLAY dotted note timer scale factor
+HRMODE          equ *                           ; Coco3 graphics mode
+DLBAUD          rmb 1                           ; DLOAD BAUD constant
+HRWIDTH         equ *                           ; Coco3 text mode
+TIMOUT          rmb 1                           ; DLOAD timeout constant
+ANGLE           rmb 1                           ; DRAW angle
+SCALE           rmb 1                           ; DRAW scale
+DCOPC           rmb 1                           ; DSKCON operation code
+DCDRV           rmb 1                           ; DSKCON drive number
+DCTRK           rmb 1                           ; DSKCON track number
+DSEC            rmb 1                           ; DSKCON sector number
+DCBPT           rmb 2                           ; DSKCON buffer pointer
+DCSTA           rmb 1                           ; DSKCON status
+FCBTMP          rmb 2                           ; temp file control block  pointer
+                rmb 13                          ; *unused*
+SW3VEC          rmb 3                           ; SWI3 vector
+SW2VEC          rmb 3                           ; SWI2 vector
+SWIVEC          rmb 3                           ; SWI vector
+NMIVEC          rmb 3                           ; NMI vector
+IRQVEC          rmb 3                           ; IRQ vector
+FRQVEC          rmb 3                           ; FIRQ vector
+TIMVAL          equ *                           ; Extended Basic TIMER value (2 bytes only)
+USRJMP          rmb 3                           ; jump address for USR function
+RVSEED          rmb 5                           ; floating point random number seed
+CASFLG          rmb 1                           ; capslock state for keyboard
+DEBVAL          rmb 2                           ; keyboar debounce delay (why is this a variable?)
+EXPJMP          rmb 3                           ; exponentiation handler
+COMVEC          rmb 10                          ; Color Basic's command table
+                rmb 10                          ; Extended Basic's command table
+                rmb 10                          ; Disk Basic's command table
+USR0            rmb 20                          ; ECB USR jump addresses (extra user command table and unused for Disk Basic)
+KEYBUF          rmb 8                           ; keyboard state table
+POTVAL          rmb 4                           ; joystick axis values (left vert, left horiz, right vert, right horiz)
+RVEC0           rmb 3                           ; RAM hook: OPEN
+RVEC1           rmb 3                           ; RAM hook: device number check
+RVEC2           rmb 3                           ; RAM hook: set print parameters
+RVEC3           rmb 3                           ; RAM hook: console out
+RVEC4           rmb 3                           ; RAM hook: console in
+RVEC5           rmb 3                           ; RAM hook: input device number check
+RVEC6           rmb 3                           ; RAM hook: output device number check
+RVEC7           rmb 3                           ; RAM hook: close all files
+RVEC8           rmb 3                           ; RAM hook: close current file
+RVEC9           rmb 3                           ; RAM hook: PRINT
+RVEC10          rmb 3                           ; RAM hook: INPUT
+RVEC11          rmb 3                           ; RAM hook: BREAK check
+RVEC12          rmb 3                           ; RAM hook: line input
+RVEC13          rmb 3                           ; RAM hook: terminating line input
+RVEC14          rmb 3                           ; RAM hook: EOF
+RVEC15          rmb 3                           ; RAM hook: expression evaluation
+RVEC16          rmb 3                           ; RAM hook: ERROR handler (on error goto)
+RVEC17          rmb 3                           ; RAM hook: ERROR handler (regular handling)
+RVEC18          rmb 3                           ; RAM hook: RUN
+RVEC19          rmb 3                           ; RAM hook: parse number
+RVEC20          rmb 3                           ; RAM hook: main interpretation loop
+RVEC21          rmb 3                           ; RAM hook: SET/RESET/POINT
+RVEC22          rmb 3                           ; RAM hook: CLS/ECB secondary/RENUM token/GET/PUT
+RVEC23          rmb 3                           ; RAM hook: crunch line
+RVEC24          rmb 3                           ; RAM hook: uncrunch line
+STRSTK          rmb 8*5                         ; string stack
+CFNBUF          rmb 9                           ; cassette file name buffer
+CASBUF          rmb 256                         ; cassette I/O buffer
+LINHDR          rmb 2                           ; header for line input (holds line number when editing program)
+LINBUF          rmb LBUFMX+1                    ; line input buffer
+STRBUF          rmb 41                          ; temporary string buffer
+VIDRAM          rmb 0x200                       ; VDG text screen
+DBUF0           rmb SECLEN                      ; Main disk I/O buffer
+DBUF1           rmb SECLEN                      ; Secondary disk I/O buffer (used for VERIFY)
+FATBL0          rmb FATLEN                      ; File allocation table cache for drive 0
+FATBL1          rmb FATLEN                      ; File allocation table cache for drive 1
+FATBL2          rmb FATLEN                      ; File allocation table cache for drive 2
+FATBL3          rmb FATLEN                      ; File allocation table cache for drive 3
+FCBV1           rmb 16*2                        ; FCB pointers
+RNBFAD          rmb 2                           ; start of free random file buffer area
+FCBADR          rmb 2                           ; start of file control blocks
+DNAMBF          rmb 8                           ; disk file name buffer
+DEXTBF          rmb 3                           ; disk file name extension buffer
+DFLTYP          rmb 1                           ; disk file type (0=Basic, 1=Data, 2=M/L)
+DASCFL          rmb 1                           ; disk file ASCII flag (0=binary, 0xff=ASCII)
+DRUNFL          rmb 1                           ; RUN flag (bit 1 set then RUN, bit 0 set then close files)
+DEFDRV          rmb 1                           ; default drive number
+FCBACT          rmb 1                           ; number of active file control blocks
+DRESFL          rmb 1                           ; reset flag - will cause all FCBs to be shut down
+DLODFL          rmb 1                           ; load flag - cause a "NEW" on error
+DMRGFL          rmb 1                           ; merge flag: nonzero means we're merging
+DUSRVC          rmb 20                          ; Disk Basic USR addresses
+V973            rmb 1
+V974            rmb 2
+V976            rmb 1
+V977            rmb 1
+V978            rmb 2
+WFATVL          rmb 2                           ; number of granules allocated to trigger a FAT cache write
+DFFLEN          rmb 2                           ; direct access file recrod length
+DR0TRK          rmb 4                           ; current track number for each drive
+NMIFLG          rmb 1                           ; nonzero means NMI vectoring is enabled
+DNMIVC          rmb 2                           ; address to vector to in NMI
+RDYTMR          rmb 1                           ; number of ticks before turning off drive motors
+DRGRAM          rmb 1                           ; cached value of write-only disk control register
+DVERFL          rmb 1                           ; nonzero means write verifies on
+ATTCTR          rmb 1                           ; read/write attempt counter
+DFLBUF          equ *                           ; start of random file area, FCBs, etc.
+
+
+                org 0x8000
+EXBAS           rmb 0x2000                      ; Extended Basic ROM area
+BASIC           rmb 0x2000                      ; Color Basic ROM area
+ROMPAK          equ *                           ; external ROM address
+DOSBAS          rmb 0x2000                      ; Disk Basic ROM area
+                rmb 0x1e00                      ; Super Extended Basic ROM area
+; These are the variables used by SECB on the "constant FExx page" which is unaffected by the MMU
+; when the FExx bit in INIT0 is set.
+H.CRSLOC        rmb 2                           ; current cursor location pointer (hi-res)
+H.CURSX         rmb 1                           ; current X coordinate of the cursor (hi-res)
+H.CURSY         rmb 1                           ; current Y coordinate of the cursor (hi-res)
+H.COLUMN        rmb 1                           ; the number of columns on the screen (hi-res)
+H.ROW           rmb 1                           ; the number of rows on the screen (hi-res)
+H.DISPEN        rmb 2                           ; pointer to the end of the screen (hi-res)
+H.CRSATT        rmb 1                           ; current cursor attributes (hi-res)
+                rmb 1                           ; *unused*
+H.FCOLOR        rmb 1                           ; foreground colour (hi-res)
+H.BCOLOR        rmb 1                           ; background colour (hi-res)
+H.ONBRK         rmb 2                           ; ON BRK GOTO line number
+H.ONERR         rmb 2                           ; ON ERR GOTO line number
+H.ERROR         rmb 1                           ; most recent error number encountered (-1 for no error)
+H.ONERRS        rmb 2                           ; line number where ON ERR GOTO was encountered
+H.ERLINE        rmb 2                           ; line number where error actually occurred
+H.ONBRKS        rmb 2                           ; line number where ON BRK GOTO was encountered
+H.ERRBRK        rmb 1                           ; flag for whether we're processing an error or a break event
+H.PCOUNT        rmb 1                           ; number of characters in the HPRINT buffer
+H.PBUF          rmb 80                          ; HPRINT line buffer (max 80 characters per line)
+                rmb 132                         ; *unused*
+; This is the set of primary interrupt vectors on the Coco3. These are here so that systems other
+; than Basic do not have to rely on low memory remaining constant. Under Basic, these simply bounce
+; to the traditional vectors starting at 0x100.
+INT.FLAG        rmb 1                           ; interrupt vector validity flag: 0x55 for valid
+INT.JUMP        equ *
+INT.SWI3        rmb 3                           ; SWI3 bounce vector
+INT.SWI2        rmb 3                           ; SWI2 bounce vector
+INT.FIRQ        rmb 3                           ; FIRQ bounce vector
+INT.IRQ         rmb 3                           ; IRQ bounce vector
+INT.SWI         rmb 3                           ; SWI bounce vector
+INT.NMI         rmb 3                           ; NMI bounce vector
+; This is that start of the I/O page. Everything above here is hardware defined.
+PIA0            rmb 4                           ; PIA0 (keyboard/joystick)
+                rmb 28                          ; PIA0 images (due to sloppy-ass decode)
+DA              equ *                           ; DAC address
+PIA1            rmb 4                           ; PIA1 (misc hardware)
+                rmb 28                          ; PIA1 images (due to sloppy-ass decode)
+DSKREG          rmb 1                           ; Disk control register
+                rmb 7                           ; images of DSKREG due to (sloppy-ass decode)
+FDCREG          rmb 1                           ; FDC command/status register
+                rmb 1                           ; FDC track register
+                rmb 1                           ; FDC sector register
+                rmb 1                           ; FDC data register
+                rmb 4                           ; mirror of FDCREG
+                rmb 16                          ; unused SCS area
+                rmb 32                          ; misc hardware area
+                rmb 16                          ; *coco3 reserved*
+INIT0           rmb 1                           ; GIME initialization register 0
+INIT1           rmb 1                           ; GIME initialization register 1
+IRQENR          rmb 1                           ; GIME IRQ enable/status register
+FIRQENR         rmb 1                           ; GIME FIRQ enable/status register
+V.TIMER         rmb 2                           ; GIME timer setting
+                rmb 2                           ; *reserved*
+VIDEOMOD        rmb 1                           ; GIME video mode register
+VIDEORES        rmb 1                           ; GIME video resolution register
+V.BORDER        rmb 1                           ; GIME border colour register
+                rmb 1                           ; *reserved*
+V.SCROLL        rmb 1                           ; GIME vertical scroll register
+V.OFFSET        rmb 2                           ; GIME vertical offset (screen address) register
+H.OFFSET        rmb 1                           ; GIME horizontal offset register
+MMUREG          rmb 16                          ; GIME MMU registers (two tasks of 8)
+PALETREG        rmb 16                          ; GIME palette registers
+SAMREG          equ *                           ; the SAM registers
+V0CLR           rmb 1                           ; SAM video mode bits
+V0SET           rmb 1
+V1CLR           rmb 1
+V1SET           rmb 1
+V2CLR           rmb 1
+V2SET           rmb 1
+F0CLR           rmb 1                           ; SAM screen address bits
+F0SET           rmb 1
+F1CLR           rmb 1
+F1SET           rmb 1
+F2CLR           rmb 1
+F2SET           rmb 1
+F3CLR           rmb 1
+F3SET           rmb 1
+F4CLR           rmb 1
+F4SET           rmb 1
+F5CLR           rmb 1
+F5SET           rmb 1
+F6CLR           rmb 1
+F6SET           rmb 1
+                rmb 2                           ; *reserved*
+R0CLR           rmb 1                           ; SAM R0 bit (address dependent speedup)
+R0SET           rmb 1
+R1CLR           rmb 1                           ; SAM R1 bit (full speedup/coco3 speedup)
+R1SET           rmb 1
+                rmb 4                           ; *reserved*
+TYCLR           rmb 1                           ; force ROM mode
+TYSET           rmb 1                           ; set RAM mode
+                rmb 18                          ; *MPU reserved*
+SWI3            rmb 2                           ; MPU SWI3 vector
+SWI2            rmb 2                           ; MPU SWI2 vector
+FIRQ            rmb 2                           ; MPU FIRQ vector
+IRQ             rmb 2                           ; MPU IRQ vector
+SWI             rmb 2                           ; MPU SWI vector
+NMI             rmb 2                           ; MPU NMI vector
+RESETV          rmb 2                           ; MPU reset vector