aboutsummaryrefslogtreecommitdiff
path: root/game/text.asm
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-05-22 07:13:54 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-05-22 07:13:54 +0100
commitc09a85ef9da7c1608b9d78c41975b4fdbbadf3e4 (patch)
tree710c0ca794e69d77a7e6ac5b035c1547c706a073 /game/text.asm
parent82e506390d12a3ce30604e42af8cbccc448ad861 (diff)
downloadtr8vm-c09a85ef9da7c1608b9d78c41975b4fdbbadf3e4.tar.gz
tr8vm-c09a85ef9da7c1608b9d78c41975b4fdbbadf3e4.zip
Use a bitmap font
Diffstat (limited to 'game/text.asm')
-rw-r--r--game/text.asm95
1 files changed, 95 insertions, 0 deletions
diff --git a/game/text.asm b/game/text.asm
new file mode 100644
index 0000000..06a40b3
--- /dev/null
+++ b/game/text.asm
@@ -0,0 +1,95 @@
+;
+; Bitmap font
+;
+
+;
+; Write text on screen
+;
+; Expects a 4x8 font on "font" label.
+;
+; in: a : x: text to write
+; b, y : (x, y) dst coords
+put_text:
+ push y
+ push b
+
+put_text_loop:
+ ld y, [a : x]
+ cmp y, 0
+ bz
+ jmp put_text_exit
+
+ sub y, 32
+
+ push a
+ push x
+
+ rol y, 5
+ ld x, y
+ and x, 31
+ and y, 224
+
+ ld a, >font
+ add a, x
+
+ ld x, <font
+ add x, y
+ bo
+ inc a
+
+ call put_text_c
+
+ pop x
+ pop a
+
+ inc x
+ bo
+ inc a
+
+ pop b
+ add b, 4
+ push b
+
+ jmp put_text_loop
+
+put_text_exit:
+ pop b
+ pop y
+ ret
+
+put_text_c:
+ ; settings mode
+ ld y, 128
+ ld b, 0xb0
+ port b, y
+
+ ; setup
+ inc b
+
+ ; addr: char sprite
+ ld y, x
+ port b, y
+ ld y, a
+ port b, y
+
+ ; x
+ ld y, [sp + 4]
+ port b, y
+
+ ; y
+ ld y, [sp + 5]
+ port b, y
+
+ ; w
+ ld y, 4
+ port b, y
+ ; h
+ ld y, 8
+ port b, y
+
+ ; blit
+ dec b
+ ; write, transparent
+ ld y, 3
+ port b, y
+ ret