diff options
Diffstat (limited to 'macros')
-rw-r--r-- | macros/code.asm | 11 | ||||
-rw-r--r-- | macros/coords.asm | 9 | ||||
-rw-r--r-- | macros/data.asm | 29 | ||||
-rw-r--r-- | macros/enum.asm | 8 | ||||
-rw-r--r-- | macros/gfx.asm | 32 | ||||
-rw-r--r-- | macros/legacy.asm | 5 | ||||
-rw-r--r-- | macros/rst.asm | 4 |
7 files changed, 43 insertions, 55 deletions
diff --git a/macros/code.asm b/macros/code.asm index 9429884ca..58d39aa00 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -8,17 +8,6 @@ ln: MACRO ; r, hi, lo ld \1, ((\2) & $f) << 4 | ((\3) & $f) ENDM -ldpixel: MACRO -if _NARG >= 5 - lb \1, \2 * 8 + \4, \3 * 8 + \5 -else - lb \1, \2 * 8, \3 * 8 -endc -ENDM - -depixel EQUS "ldpixel de," -bcpixel EQUS "ldpixel bc," - ; Design patterns jumptable: MACRO diff --git a/macros/coords.asm b/macros/coords.asm index 0fbf96ccd..5a87e1d3d 100644 --- a/macros/coords.asm +++ b/macros/coords.asm @@ -28,8 +28,7 @@ dwcoord: MACRO ; x, y rept _NARG / 2 dw (\2) * SCREEN_WIDTH + (\1) + wTilemap - shift - shift + shift 2 endr ENDM @@ -50,3 +49,9 @@ lda_coord: MACRO ld a, [(\2) * SCREEN_WIDTH + (\1) + \3] endc ENDM + +menu_coords: MACRO +; x1, y1, x2, y2 + db \2, \1 ; start coords + db \4, \3 ; end coords +ENDM diff --git a/macros/data.asm b/macros/data.asm index 76a5d31de..e9052f6b2 100644 --- a/macros/data.asm +++ b/macros/data.asm @@ -32,18 +32,14 @@ ENDM dn: MACRO ; nybbles rept _NARG / 2 db ((\1) << 4) | (\2) - shift - shift + shift 2 endr ENDM dc: MACRO ; "crumbs" rept _NARG / 4 db ((\1) << 6) | ((\2) << 4) | ((\3) << 2) | (\4) - shift - shift - shift - shift + shift 4 endr ENDM @@ -86,27 +82,6 @@ dba_pic: MACRO ; dbw bank, address dw \1 ENDM -dbpixel: MACRO -if _NARG >= 4 -; x tile, x pxl, y tile, y pxl - db \1 * 8 + \3, \2 * 8 + \4 -else -; x, y - db \1 * 8, \2 * 8 -endc -ENDM - -dsprite: MACRO -; y tile, y pxl, x tile, x pxl, vtile offset, attributes - db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5, \6 -ENDM - -menu_coords: MACRO -; x1, y1, x2, y2 - db \2, \1 ; start coords - db \4, \3 ; end coords -ENDM - bcd: MACRO rept _NARG dn ((\1) % 100) / 10, (\1) % 10 diff --git a/macros/enum.asm b/macros/enum.asm index 41d1da167..8fe5b5343 100644 --- a/macros/enum.asm +++ b/macros/enum.asm @@ -41,11 +41,3 @@ shift_const: MACRO \1 EQU (1 << const_value) const_value = const_value + 1 ENDM - -; Enumerate strings - -define: MACRO -if !DEF(\1) -\1 EQUS \2 -endc -ENDM diff --git a/macros/gfx.asm b/macros/gfx.asm index 2753373e0..2c67cfc8a 100644 --- a/macros/gfx.asm +++ b/macros/gfx.asm @@ -1,9 +1,7 @@ RGB: MACRO rept _NARG / 3 dw palred (\1) + palgreen (\2) + palblue (\3) - shift - shift - shift + shift 3 endr ENDM @@ -22,3 +20,31 @@ tile EQUS "+ LEN_2BPP_TILE *" ; example usage: ; INCBIN "foo.gbcpal", middle_colors middle_colors EQUS "PAL_COLOR_SIZE, PAL_COLOR_SIZE * 2" + +dbpixel: MACRO +if _NARG >= 4 +; x tile, y tile, x pixel, y pixel + db \1 * TILE_WIDTH + \3, \2 * TILE_WIDTH + \4 +else +; x tile, y tile + db \1 * TILE_WIDTH, \2 * TILE_WIDTH +endc +ENDM + +ldpixel: MACRO +if _NARG >= 5 +; register, x tile, y tile, x pixel, y pixel + lb \1, \2 * TILE_WIDTH + \4, \3 * TILE_WIDTH + \5 +else +; register, x tile, y tile + lb \1, \2 * TILE_WIDTH, \3 * TILE_WIDTH +endc +ENDM + +depixel EQUS "ldpixel de," +bcpixel EQUS "ldpixel bc," + +dbsprite: MACRO +; x tile, y tile, x pixel, y pixel, vtile offset, attributes + db (\2 * TILE_WIDTH) % $100 + \4, (\1 * TILE_WIDTH) % $100 + \3, \5, \6 +ENDM diff --git a/macros/legacy.asm b/macros/legacy.asm index 6234b8343..8c6f2a9dd 100644 --- a/macros/legacy.asm +++ b/macros/legacy.asm @@ -6,6 +6,11 @@ callba EQUS "farcall" callab EQUS "callfar" +; macros/gfx.asm +dsprite: MACRO + dbsprite \2, \4, \1, \3, \5, \6 +ENDM + ; macros/scripts/audio.asm __ EQU 0 CC EQU 13 diff --git a/macros/rst.asm b/macros/rst.asm index 773a5c60d..c8b80aab2 100644 --- a/macros/rst.asm +++ b/macros/rst.asm @@ -1,7 +1,3 @@ -FarCall EQU $08 -Bankswitch EQU $10 -JumpTable EQU $28 - farcall: MACRO ; bank, address ld a, BANK(\1) ld hl, \1 |