defines.inc - RLH-2110/gbCalc GitHub Wiki
Table of Contents
Overview
Constants
Tilemap Indexes
Tile defines
Overview
Sometimes I don't want to remember the memory location or the offsets of things, then I define them in here.
defines.inc is included in almost all files and is used everywhere. If you see something you never saw before into a register, it's likely defined here or in hardware.inc
Constants
def screen equ _SCRN0
This aliases _SCRN0 from hardware.inc to screen.
def last_cursor_state equ $04
This saved the last cursor state (i.e. what's the rightmost cursor position) Used in cursorLogic.asm
def doubleDabbleSize equ $5
How many bytes your double dabble buffer is in bytes. Used in doubleDabble.asm
def dd_numberIndex equ $3
This is after what offset in the double dabble buffer we put the number to convert. Used in doubleDabble.asm
def cursorOffset equ $20
How far is the cursor position from the cursor graphics. The graphics are one low above/below the cursor position, so the graphics are 1 row apart from the position, A Row is 20h long. (i.e. what's the rightmost cursor position) Used in cursorLogic.asm
Here are names for the different Cursor States. See cursorLogic.asm
def cursorState_Number0Sign equ $00
def cursorState_Number0 equ $01
def cursorState_Operator equ $02
def cursorState_Number1Sign equ $03
def cursorState_Number1 equ $04
Tilemap Indexes
These show the location of important elements on the screen.
In theory, changing these will change where the elements are[^1]
def num0_prefixI equ $102
This points to the sign of number0
def num0I equ $103
This points at the start of number0
def operatorI equ $109
This points at the operator
def num1_prefixI equ $10B
This is the sign of number1
def num1I equ $10C
And this is the start of number1
def res_prefixI equ $167
The sign of the result
def resI equ $168
And the start of the result
[^1]: You would also need to adjust the initial graphics in grapicsROM.asm
Tile defines
These are just to quickly tell what tile we have, and to tell that we are doing something with tiles in the first place.
def tile_empty equ $00
def tile_zero equ $01
def tile_one equ $02
def tile_two equ $03
def tile_three equ $04
def tile_four equ $05
def tile_five equ $06
def tile_six equ $07
def tile_seven equ $08
def tile_eight equ $09
def tile_nine equ $0A
def tile_add equ $0C
def tile_sub equ $0D
def tile_mul equ $0E
def tile_div equ $0F
def tile_modulus equ $10
def tile_c equ $0B
def tile_e equ $14
def tile_equals equ $11
def upper_cursor equ $12
def lower_cursor equ $13