Constants used by the ROM


§1. Hardware.

 The Electron version is courtesy of SteveF on the Stardot forum (aka ZornsLemma on GitHub).
     see https://stardot.org.uk/forums/viewtopic.php?p=295211#p295211 and
     see https://github.com/ZornsLemma/GXR
!macro unknown_machine {
    !error "Unknown machine"
}

Use these numbers on the acme command line with -D to define the MACHINE to assemble for.
BBC_B       = 1000
BBC_B_PLUS  = 1001
ELECTRON    = 1002

Set version strings based on the machine we are assembling for.
!if MACHINE = BBC_B {
    .version     = "1.20"
    .fullVersion = "1.20"
} else if MACHINE = BBC_B_PLUS {
    .version     = "2.00"
    .fullVersion = "2.00"
} else if MACHINE = ELECTRON {
    .version     = "1.00"
    .fullVersion = "1.00a"
} else {
    +unknown_machine
}

§2. Characters.

.charLF                                     = $0A       
.charCR                                     = $0D       
.charDefineTextColour                       = $11       
.charHomeCursor                             = $1E       
.charMoveCursor                             = $1F       

§3. Offsets into the private workspace.

 The GXR ROM uses the first page of its private workspace to store variables. These constants are
 offsets from the start of the ROM's private workspace.

 The first 72 bytes ($00-$47) contain the code for intercepting OSWRCH, checking for VDU 22 and
 VDU 25 and switching in the ROM and calling into it. The next 81 bytes ($48-$98) are for the
 variables listed below. The remaining 103 bytes ($99-$ff) are used to cache the 'soft character
 definitions' (from $0c00-$0c66) temporarily while a PLOT routine is executing. The soft character
 definitions are reinstated either at the end of the PLOT routine, or on a reset when the ROM
 re-initialises itself (checks for flag .workspaceOffsetHasCachedSoftCharacterDefinitions).
.workspaceOffsetTotalPagesWithoutSprites    = $48       1 or 3 pages, depending if *FLOOD is
                                                        enabled
.workspaceOffsetOptions                     = $49       bit 7 = flood fill enabled, bit 6 =
                                                        flood pending, bit 0=pen up/down in
                                                        sprite editor
.workspaceOffsetSpritePages                 = $4a       number of pages reserved for sprites
.workspaceOffsetNumberOfSprites             = $4b       
.workspaceOffsetCurrentSpriteAddressLow     = $4c       
.workspaceOffsetCurrentSpriteAddressHigh    = $4d       
.workspaceOffsetSpriteStartPage             = $4e       the first page of the sprite data.
.workspaceOffsetSpriteEndPage               = $4f       the page after the sprite data.
.workspaceOffsetChosenSpriteAddressLow      = $50       
.workspaceOffsetChosenSpriteAddressHigh     = $51       
.workspaceOffsetChosenSpriteIndex           = $52       

OSFILE parameter block (used when loading and saving sprite data)
.workspaceOffsetParamBlock                  = $53       
.workspaceOffsetFilenameLow                 = $53       
.workspaceOffsetFilenameHigh                = $54       
.workspaceOffsetLoadAddressLow              = $55       
.workspaceOffsetLoadAddressMid1             = $56       
.workspaceOffsetLoadAddressMid2             = $57       
.workspaceOffsetLoadAddressHigh             = $58       
.workspaceOffsetExecAddressLow              = $59       
.workspaceOffsetExecAddressMid1             = $5a       
.workspaceOffsetExecAddressMid2             = $5b       
.workspaceOffsetExecAddressHigh             = $5c       
.workspaceOffsetStartAddressLow             = $5d       
.workspaceOffsetStartAddressMid1            = $5e       
.workspaceOffsetStartAddressMid2            = $5f       
.workspaceOffsetStartAddressHigh            = $60       
.workspaceOffsetEndAddressLow               = $61       
.workspaceOffsetEndAddressMid1              = $62       
.workspaceOffsetEndAddressMid2              = $63       
.workspaceOffsetEndAddressHigh              = $64       
.workspaceOffsetEndOfSpritesAddressLow      = $65       
.workspaceOffsetEndOfSpritesAddressHigh     = $66       

.workspaceOffsetOldVDUVectorVLow            = $67       }
.workspaceOffsetOldVDUVectorVHigh           = $68       } old VDU Vector

.workspaceOffsetOldExtendedVDUVLow          = $69       }
.workspaceOffsetOldExtendedVDUVHigh         = $6a       } old extended vector
.workspaceOffsetOldExtendedVDUVROM          = $6b       } (see
                                                        } .swapWorkspaceWithVDUVectors)

.workspaceOffsetCurrentPatterns             = $6c       [32 bytes]

The four patterns are stored at $6c to $8b (four patterns of 8 bytes each = 32 bytes)

pattern 1         = workspace[$6c to $73]
pattern 2         = workspace[$74 to $7b]
pattern 3         = workspace[$7c to $83]
pattern 4         = workspace[$84 to $8b]

.workspaceOffsetDotDashPattern              = $8c       dot-dash pattern [8 bytes]

.workspaceOffsetDotDashRepeatLength         = $94       pattern length in bits

Dot-dash pattern state
.workspaceOffsetDotDashBitsRemaining        = $95       current remaining bits of pattern
.workspaceOffsetDotDashBit                  = $96       current bit within current byte
.workspaceOffsetDotDashPatternByte          = $97       current byte

.workspaceOffsetHasCachedSoftCharacterDefinitions = $98 set to $80 if soft character
                                                        definitions have been cached into
                                                        workspace, otherwise $00.
.workspaceOffsetSoftFontCache               = $99       copy of some soft character
                                                        definitions while PLOTting
                                                        [$67 bytes, i.e. to end of page]

§4. Sprites are stored (in memory and on disk) with a six byte header.

   0: width - 1
   1: height - 1
   2: } size in bytes of the sprite data (without the six byte header)
   3: }
   4: MODE in which the sprite was defined
   5: sprite number
.spriteHeaderOffsetWidth                    = 0
.spriteHeaderOffsetHeight                   = 1
.spriteHeaderOffsetSizeInBytesLow           = 2
.spriteHeaderOffsetSizeInBytesHigh          = 3
.spriteHeaderOffsetModeNumber               = 4
.spriteHeaderOffsetSpriteNumber             = 5