diff options
author | Pedro de Medeiros <pedro.medeiros@gmail.com> | 2022-01-07 15:53:15 -0300 |
---|---|---|
committer | Pedro de Medeiros <pedro.medeiros@gmail.com> | 2022-01-07 15:59:19 -0300 |
commit | ce3c89948e6fc3c7234e8f47e048d74f917e6bf9 (patch) | |
tree | d9e29728697bc3ccf34d322a29a7e9b47e6ea2b0 /src/ubox | |
parent | c149e9f96d9f6901656a2dfe4482bb8b45f1f62b (diff) | |
download | ubox-msx-lib-ce3c89948e6fc3c7234e8f47e048d74f917e6bf9.tar.gz ubox-msx-lib-ce3c89948e6fc3c7234e8f47e048d74f917e6bf9.zip |
Replacing VRAM magic numbers with constants
Diffstat (limited to 'src/ubox')
-rw-r--r-- | src/ubox/ubox_fill_screen.z80 | 3 | ||||
-rw-r--r-- | src/ubox/ubox_get_tile.z80 | 3 | ||||
-rw-r--r-- | src/ubox/ubox_put_tile.z80 | 3 | ||||
-rw-r--r-- | src/ubox/ubox_set_sprite_attr.z80 | 4 | ||||
-rw-r--r-- | src/ubox/ubox_set_sprite_pat16.z80 | 4 | ||||
-rw-r--r-- | src/ubox/ubox_set_sprite_pat16_flip.z80 | 3 | ||||
-rw-r--r-- | src/ubox/ubox_set_sprite_pat8.z80 | 4 | ||||
-rw-r--r-- | src/ubox/ubox_set_sprite_pat8_flip.z80 | 3 | ||||
-rw-r--r-- | src/ubox/ubox_set_tiles.z80 | 7 | ||||
-rw-r--r-- | src/ubox/ubox_set_tiles_colors.z80 | 7 |
10 files changed, 27 insertions, 14 deletions
diff --git a/src/ubox/ubox_fill_screen.z80 b/src/ubox/ubox_fill_screen.z80 index ed8c58f..e803f76 100644 --- a/src/ubox/ubox_fill_screen.z80 +++ b/src/ubox/ubox_fill_screen.z80 @@ -1,10 +1,11 @@ .globl _ubox_fill_screen FILVRM = 0x0056 +BG_TILE_MAP = 0x1800 _ubox_fill_screen:: ld a, l - ld hl, #0x1800 + ld hl, #BG_TILE_MAP ld bc, #768 jp FILVRM diff --git a/src/ubox/ubox_get_tile.z80 b/src/ubox/ubox_get_tile.z80 index 49dcb30..3a6004d 100644 --- a/src/ubox/ubox_get_tile.z80 +++ b/src/ubox/ubox_get_tile.z80 @@ -1,6 +1,7 @@ .globl _ubox_get_tile RDVRM = 0x004a +BG_TILE_MAP = 0x1800 _ubox_get_tile:: ld hl, #2 @@ -19,7 +20,7 @@ _ubox_get_tile:: add hl, hl add hl, bc - ld bc, #0x1800 + ld bc, #BG_TILE_MAP add hl, bc call RDVRM diff --git a/src/ubox/ubox_put_tile.z80 b/src/ubox/ubox_put_tile.z80 index 1bdf3ce..24e58b2 100644 --- a/src/ubox/ubox_put_tile.z80 +++ b/src/ubox/ubox_put_tile.z80 @@ -1,6 +1,7 @@ .globl _ubox_put_tile WRTVRM = 0x004d +BG_TILE_MAP = 0x1800 _ubox_put_tile:: ld hl, #2 @@ -23,7 +24,7 @@ _ubox_put_tile:: ld b, #0 add hl, bc - ld bc, #0x1800 + ld bc, #BG_TILE_MAP add hl, bc jp WRTVRM diff --git a/src/ubox/ubox_set_sprite_attr.z80 b/src/ubox/ubox_set_sprite_attr.z80 index fe573b6..4e5c80e 100644 --- a/src/ubox/ubox_set_sprite_attr.z80 +++ b/src/ubox/ubox_set_sprite_attr.z80 @@ -1,6 +1,8 @@ .globl _ubox_set_sprite_attr .globl _ubox_write_vm +SP_ATTRS = 0x1b00 + _ubox_set_sprite_attr:: ld hl, #2 add hl, sp @@ -14,7 +16,7 @@ _ubox_set_sprite_attr:: sla l sla l ld h, #0 - ld bc, #0x1b00 + ld bc, #SP_ATTRS add hl, bc push de diff --git a/src/ubox/ubox_set_sprite_pat16.z80 b/src/ubox/ubox_set_sprite_pat16.z80 index 4689267..59d7ccb 100644 --- a/src/ubox/ubox_set_sprite_pat16.z80 +++ b/src/ubox/ubox_set_sprite_pat16.z80 @@ -1,6 +1,8 @@ .globl _ubox_set_sprite_pat16 .globl _ubox_write_vm +SP_PATTERNS = 0x3800 + _ubox_set_sprite_pat16:: ld hl, #2 add hl, sp @@ -17,7 +19,7 @@ _ubox_set_sprite_pat16:: add hl, hl add hl, hl add hl, hl - ld bc, #0x3800 + ld bc, #SP_PATTERNS add hl, bc push de diff --git a/src/ubox/ubox_set_sprite_pat16_flip.z80 b/src/ubox/ubox_set_sprite_pat16_flip.z80 index bb960f8..5631808 100644 --- a/src/ubox/ubox_set_sprite_pat16_flip.z80 +++ b/src/ubox/ubox_set_sprite_pat16_flip.z80 @@ -1,6 +1,7 @@ .globl _ubox_set_sprite_pat16_flip WRTVRM = 0x004d +SP_PATTERNS = 0x3800 _ubox_set_sprite_pat16_flip:: ld hl, #2 @@ -18,7 +19,7 @@ _ubox_set_sprite_pat16_flip:: add hl, hl add hl, hl add hl, hl - ld bc, #0x3800 + ld bc, #SP_PATTERNS add hl, bc push de diff --git a/src/ubox/ubox_set_sprite_pat8.z80 b/src/ubox/ubox_set_sprite_pat8.z80 index 11b0205..06b484c 100644 --- a/src/ubox/ubox_set_sprite_pat8.z80 +++ b/src/ubox/ubox_set_sprite_pat8.z80 @@ -1,6 +1,8 @@ .globl _ubox_set_sprite_pat8 .globl _ubox_write_vm +SP_PATTERNS = 0x3800 + _ubox_set_sprite_pat8:: ld hl, #2 add hl, sp @@ -15,7 +17,7 @@ _ubox_set_sprite_pat8:: add hl, hl add hl, hl add hl, hl - ld bc, #0x3800 + ld bc, #SP_PATTERNS add hl, bc push de diff --git a/src/ubox/ubox_set_sprite_pat8_flip.z80 b/src/ubox/ubox_set_sprite_pat8_flip.z80 index a3f8d1d..fdcf9ec 100644 --- a/src/ubox/ubox_set_sprite_pat8_flip.z80 +++ b/src/ubox/ubox_set_sprite_pat8_flip.z80 @@ -1,6 +1,7 @@ .globl _ubox_set_sprite_pat8_flip WRTVRM = 0x004d +SP_PATTERNS = 0x3800 _ubox_set_sprite_pat8_flip:: ld hl, #2 @@ -16,7 +17,7 @@ _ubox_set_sprite_pat8_flip:: add hl, hl add hl, hl add hl, hl - ld bc, #0x3800 + ld bc, #SP_PATTERNS add hl, bc ld b, #8 diff --git a/src/ubox/ubox_set_tiles.z80 b/src/ubox/ubox_set_tiles.z80 index fbb2ff9..7e4f42e 100644 --- a/src/ubox/ubox_set_tiles.z80 +++ b/src/ubox/ubox_set_tiles.z80 @@ -1,21 +1,22 @@ .globl _ubox_set_tiles LDIRVM = 0x005c +BG_TILES = 0x0 _ubox_set_tiles:: - ld de, #0 + ld de, #BG_TILES ld bc, #256 * 8 push hl call LDIRVM pop hl - ld de, #256 * 8 + ld de, #BG_TILES + #256 * 8 ld bc, #256 * 8 push hl call LDIRVM pop hl - ld de, #256 * 8 * 2 + ld de, #BG_TILES + #256 * 8 * 2 ld bc, #256 * 8 jp LDIRVM diff --git a/src/ubox/ubox_set_tiles_colors.z80 b/src/ubox/ubox_set_tiles_colors.z80 index 8ba2609..4c4591b 100644 --- a/src/ubox/ubox_set_tiles_colors.z80 +++ b/src/ubox/ubox_set_tiles_colors.z80 @@ -1,21 +1,22 @@ .globl _ubox_set_tiles_colors LDIRVM = 0x005c +BG_COLS = 0x2000 _ubox_set_tiles_colors:: - ld de, #0x2000 + ld de, #BG_COLS ld bc, #256 * 8 push hl call LDIRVM pop hl - ld de, #0x2000 + 256 * 8 + ld de, #BG_COLS + 256 * 8 ld bc, #256 * 8 push hl call LDIRVM pop hl - ld de, #0x2000 + 256 * 8 * 2 + ld de, #BG_COLS + 256 * 8 * 2 ld bc, #256 * 8 jp LDIRVM |