123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- lb: MACRO ; r, hi, lo
- ld \1, (\2) << 8 + ((\3) & $ff)
- ENDM
- homecall: MACRO
- ld a, [H_LOADEDROMBANK]
- push af
- ld a, BANK(\1)
- ld [H_LOADEDROMBANK], a
- ld [MBC1RomBank], a
- call \1
- pop af
- ld [H_LOADEDROMBANK], a
- ld [MBC1RomBank], a
- ENDM
- farcall EQUS "callba"
- callba: MACRO
- ld b, BANK(\1)
- ld hl, \1
- call Bankswitch
- ENDM
- callab: MACRO
- ld hl, \1
- ld b, BANK(\1)
- call Bankswitch
- ENDM
- jpba: MACRO
- ld b, BANK(\1)
- ld hl, \1
- jp Bankswitch
- ENDM
- jpab: MACRO
- ld hl, \1
- ld b, BANK(\1)
- jp Bankswitch
- ENDM
- validateCoords: MACRO
- IF \1 >= SCREEN_WIDTH
- fail "x coord out of range"
- ENDC
- IF \2 >= SCREEN_HEIGHT
- fail "y coord out of range"
- ENDC
- ENDM
- ;\1 = r
- ;\2 = X
- ;\3 = Y
- ;\4 = which tilemap (optional)
- coord: MACRO
- validateCoords \2, \3
- IF _NARG >= 4
- ld \1, \4 + SCREEN_WIDTH * \3 + \2
- ELSE
- ld \1, wTileMap + SCREEN_WIDTH * \3 + \2
- ENDC
- ENDM
- ;\1 = X
- ;\2 = Y
- ;\3 = which tilemap (optional)
- aCoord: MACRO
- validateCoords \1, \2
- IF _NARG >= 3
- ld a, [\3 + SCREEN_WIDTH * \2 + \1]
- ELSE
- ld a, [wTileMap + SCREEN_WIDTH * \2 + \1]
- ENDC
- ENDM
- ;\1 = X
- ;\2 = Y
- ;\3 = which tilemap (optional)
- Coorda: MACRO
- validateCoords \1, \2
- IF _NARG >= 3
- ld [\3 + SCREEN_WIDTH * \2 + \1], a
- ELSE
- ld [wTileMap + SCREEN_WIDTH * \2 + \1], a
- ENDC
- ENDM
- ;\1 = X
- ;\2 = Y
- ;\3 = which tilemap (optional)
- dwCoord: MACRO
- validateCoords \1, \2
- IF _NARG >= 3
- dw \3 + SCREEN_WIDTH * \2 + \1
- ELSE
- dw wTileMap + SCREEN_WIDTH * \2 + \1
- ENDC
- ENDM
- ;\1 = r
- ;\2 = X
- ;\3 = Y
- ;\4 = map width
- overworldMapCoord: MACRO
- ld \1, wOverworldMap + ((\2) + 3) + (((\3) + 3) * ((\4) + (3 * 2)))
- ENDM
- ; macro for two nibbles
- dn: MACRO
- db (\1 << 4 | \2)
- ENDM
- ; macro for putting a byte then a word
- dbw: MACRO
- db \1
- dw \2
- ENDM
- dba: MACRO
- dbw BANK(\1), \1
- ENDM
- dwb: MACRO
- dw \1
- db \2
- ENDM
- dab: MACRO
- dwb \1, BANK(\1)
- ENDM
- dbbw: MACRO
- db \1, \2
- dw \3
- ENDM
- ; Predef macro.
- predef_const: MACRO
- const \1PredefID
- ENDM
- add_predef: MACRO
- \1Predef::
- db BANK(\1)
- dw \1
- ENDM
- predef_id: MACRO
- ld a, (\1Predef - PredefPointers) / 3
- ENDM
- predef: MACRO
- predef_id \1
- call Predef
- ENDM
- predef_jump: MACRO
- predef_id \1
- jp Predef
- ENDM
- tx_pre_const: MACRO
- const \1_id
- ENDM
- add_tx_pre: MACRO
- \1_id:: dw \1
- ENDM
- db_tx_pre: MACRO
- db (\1_id - TextPredefs) / 2 + 1
- ENDM
- tx_pre_id: MACRO
- ld a, (\1_id - TextPredefs) / 2 + 1
- ENDM
- tx_pre: MACRO
- tx_pre_id \1
- call PrintPredefTextID
- ENDM
- tx_pre_jump: MACRO
- tx_pre_id \1
- jp PrintPredefTextID
- ENDM
|