aboutsummaryrefslogtreecommitdiff
path: root/example.asm
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-05-06 12:06:02 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-05-06 12:13:00 +0100
commit2f50827c3d2bb48e79f202cd084de08b5ad65732 (patch)
tree3027a753af4ae891d5de4baa997846f11b28f58c /example.asm
parentdd194bf4de0d54cef7e14aeb7576d799acb61840 (diff)
downloadtr8vm-2f50827c3d2bb48e79f202cd084de08b5ad65732.tar.gz
tr8vm-2f50827c3d2bb48e79f202cd084de08b5ad65732.zip
Implement hardware blitter
Diffstat (limited to 'example.asm')
-rw-r--r--example.asm85
1 files changed, 24 insertions, 61 deletions
diff --git a/example.asm b/example.asm
index 2ab0ee7..cffef5e 100644
--- a/example.asm
+++ b/example.asm
@@ -61,71 +61,34 @@ int_handler:
iret
draw_sprite:
- push y
- ld y, 16
- ld [sp + 0], y
+ ; blitter in settings mode
+ ld x, 128
+ ld a, 0xb0
+ port a, x
- ; src
- ld a, >sprite
- ld x, <sprite
-
- ; dst
- ld b, 0xdb
- ld y, 56
-line:
- push x
- ld x, [a : x]
-
- ; any color with index > 15
- ; is transparent
- cmp x, 16
- bnc
- jmp transparent
-
- ld [b : y], x
-
-transparent:
- pop x
-
- inc x
- bo
+ ; setup
inc a
-
- inc y
-
- push y
- ld y, [sp + 1]
- dec y
- ld [sp + 1], y
- pop y
-
- bnz
- jmp line
-
- add y, 112
- bo
- inc b
-
- cmp x, <end_sprite
- bnz
- jmp next_row
- cmp a, >end_sprite
- bz
- jmp done
-
-next_row:
- push y
- ld y, 16
- ld [sp + 1], y
- pop y
-
- jmp line
-
-done:
- pop y
+ ; source
+ ld x, <sprite
+ port a, x
+ ld x, >sprite
+ port a, x
+ ; destination (56, 56)
+ ld x, 56
+ port a, x
+ port a, x
+ ; size 16x16
+ ld x, 16
+ port a, x
+ port a, x
+
+ ; now blit
+ dec a
+ ld x, 3
+ ; 3: write with transparent color support
+ port a, x
ret
sprite:
.incpng "assets/icon.png"
-end_sprite: