diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-04 22:55:50 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-04 22:55:50 +0100 |
commit | bdbb811ac1a60920f87a5640f2f68e7f349fe2c0 (patch) | |
tree | 5cb0a043213f87f21136247fcb28810f3f304129 /example.asm | |
parent | 2fc29f20a343504780125aa2bed048cece79a37b (diff) | |
download | tr8vm-bdbb811ac1a60920f87a5640f2f68e7f349fe2c0.tar.gz tr8vm-bdbb811ac1a60920f87a5640f2f68e7f349fe2c0.zip |
Include PNG images as data
Diffstat (limited to 'example.asm')
-rw-r--r-- | example.asm | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/example.asm b/example.asm index 56afcba..73aa9a5 100644 --- a/example.asm +++ b/example.asm @@ -27,6 +27,10 @@ loop: inc b and b, 15 + push b + call draw_sprite + pop b + ; wait 1 second ld x, 60 wait_loop: @@ -55,3 +59,64 @@ fill_loop: int_handler: iret + +draw_sprite: + push y + ld y, 16 + ld [sp + 0], y + + ; src + ld a, >sprite + ld x, <sprite + + ; dst + ld b, 0xdb + ld y, 56 +line: + push x + ld x, [a : x] + ld [b : y], x + pop x + + inc x + bo + 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 + ret + +sprite: + .incpng "assets/icon.png" +end_sprite: + |