aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-05-10 08:01:48 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-05-10 08:01:48 +0100
commitd1c70c8118e53f28bc2cfe3de64f7c30762c8b33 (patch)
tree66dd8c71db50b981786d9e675275876ba1f62b8a
parentd532317c011b9e5653241d50b961ee8caa710144 (diff)
downloadtr8vm-d1c70c8118e53f28bc2cfe3de64f7c30762c8b33.tar.gz
tr8vm-d1c70c8118e53f28bc2cfe3de64f7c30762c8b33.zip
Removed subroutine as it is more readable like this
-rw-r--r--game/entities.asm190
1 files changed, 87 insertions, 103 deletions
diff --git a/game/entities.asm b/game/entities.asm
index fa9d8fd..aaab135 100644
--- a/game/entities.asm
+++ b/game/entities.asm
@@ -23,37 +23,44 @@ entities_erase_next:
bz
jmp entities_erase_done
- ; write, no transparent
- ld y, 1
- push y
+ ; settings mode
+ ld y, 128
+ ld b, 0xb0
+ port b, y
+
+ ; setup
+ inc b
- ; dst: x
+ ; addr: bg data
+ ld y, 0
+ port b, y
+ ld y, [sp + 0]
+ port b, y
+
+ ; x
inc x
bo
inc a
ld y, [a : x]
- push y
+ port b, y
- ; dst: y
+ ; y
inc x
bo
inc a
ld y, [a : x]
- push y
-
- ; src: saved bg
- ld y, [sp + 3]
- push y
- ld y, 0
- push y
+ port b, y
- call entities_blt
+ ; 16x16
+ ld y, 16
+ port b, y
+ port b, y
- pop y
- pop y
- pop y
- pop y
- pop y
+ ; blit
+ dec b
+ ; write, no transparent
+ ld y, 1
+ port b, y
; next entity
add x, 5
@@ -132,102 +139,59 @@ entities_draw_next:
inc x
bo
inc a
- ; save x addr for later
- push a
- push x
-
- ; save bg
-
- ; read, no transparent
- ld y, 4
- push y
-
- ; dst: x
ld y, [a : x]
+ ; x coord
push y
- ; dst: y
inc x
bo
inc a
ld y, [a : x]
+ ; y coord
push y
- ; dst: save bg
- ld y, [sp + 5]
- push y
- ld y, 0
- push y
-
- call entities_blt
-
- pop y
- pop y
- pop y
- pop y
- pop y
-
- ; draw sprite
-
- ; x addr
- pop x
- pop a
-
- ; write, transparent
- ld y, 3
- push y
-
- ; dst: x
- ld y, [a : x]
- push y
-
- ; dst: y
inc x
bo
inc a
- ld y, [a : x]
- push y
+ ; a : x points to sprite data
- ; src: the sprite
- inc x
- bo
- inc a
- ld y, [a : x]
- inc x
- bo
- inc a
- ld b, [a : x]
- push b
- push y
+ ; get gb data
- call entities_blt
+ ; settings mode
+ ld y, 128
+ ld b, 0xb0
+ port b, y
- pop y
- pop y
- pop y
- pop y
- pop y
+ ; setup
+ inc b
- ; next entity
- add x, 3
- bo
- inc a
+ ; addr: bg data saving space
+ ld y, 0
+ port b, y
+ ld y, [sp + 2]
+ port b, y
- pop b
- inc b
- push b
+ ; x
+ ld y, [sp + 1]
+ port b, y
- jmp entities_draw_next
+ ; y
+ ld y, [sp + 0]
+ port b, y
-entities_draw_done:
- pop a
- ret
+ ; 16x16
+ ld y, 16
+ port b, y
+ port b, y
+
+ ; blit
+ dec b
+ ; read, no transparent
+ ld y, 4
+ port b, y
+
+ ; draw sprite
-; sp: write mode
-; y coord
-; x coord
-; addr
-entities_blt:
; settings mode
ld y, 128
ld b, 0xb0
@@ -236,17 +200,21 @@ entities_blt:
; setup
inc b
- ; addr
- ld y, [sp + 2]
+ ; addr: sprite data
+ ld y, [a : x]
port b, y
- ld y, [sp + 3]
+ inc x
+ bo
+ inc a
+ ld y, [a : x]
port b, y
; x
- ld y, [sp + 5]
+ ld y, [sp + 1]
port b, y
+
; y
- ld y, [sp + 4]
+ ld y, [sp + 0]
port b, y
; 16x16
@@ -256,8 +224,24 @@ entities_blt:
; blit
dec b
- ; write mode
- ld y, [sp + 6]
+ ; writw, transparent
+ ld y, 3
port b, y
- ret
+ pop y
+ pop y
+
+ ; next entity
+ add x, 3
+ bo
+ inc a
+
+ pop b
+ inc b
+ push b
+
+ jmp entities_draw_next
+
+entities_draw_done:
+ pop a
+ ret