aboutsummaryrefslogtreecommitdiff
path: root/example.asm
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-05-01 21:44:35 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-05-01 21:44:35 +0100
commitef84fb6fcb45a86fce97acda58606a76a937a1da (patch)
treea3e049b858724837cc9ce0106e30c9e1c028ddc6 /example.asm
parentc081dfe226c6e92865cbb97d8e9a2ef86d8c6acb (diff)
downloadtr8vm-ef84fb6fcb45a86fce97acda58606a76a937a1da.tar.gz
tr8vm-ef84fb6fcb45a86fce97acda58606a76a937a1da.zip
Added the VM player using SDL
- Wired basic functionality (fram-buffer, frame interrupt) - Bug fixes in the assembler
Diffstat (limited to 'example.asm')
-rw-r--r--example.asm137
1 files changed, 37 insertions, 100 deletions
diff --git a/example.asm b/example.asm
index 6d4521e..d96277b 100644
--- a/example.asm
+++ b/example.asm
@@ -3,54 +3,44 @@
;
.org 0
-; ; copy 16K from 0x0000 to 0xbf00
-; ;
-; start:
-; ld a, 0
-; ld b, 0xbf
-; ld x, 0
-; ld y, 0x40
-; loop:
-; push y
-; ld y, [a : x]
-; ld [b : x], y
-; pop y
-; inc x
-; bno
-; jmp loop
-; inc a
-; inc b
-; dec y
-; bnz
-; jmp loop
-;
- ld b, 15
+ ; setup an int handler so we
+ ; can use the frame int to sync
+ ld a, 0xff
+ ld x, 0
+ ld b, <int_handler
+ ld [a : x], b
+ inc x
+ ld b, >int_handler
+ ld [a : x], b
+
+ ; enable interrupts
+ cif
+
+ ; loop filling the screen with one
+ ; colour cycling the whole palette
+ ld b, 0
+loop:
call fill
+ inc b
+ and b, 15
+ ; wait some frames
+ halt
+ halt
+ halt
+ halt
+
+ halt
+ halt
+ halt
halt
-;
-; ; void copy(void *dst, void *src, uint16_t size)
-; ; size = 0x1000
-; ; src = 0
-; ; dst 0xbf00
-; ld a, 0x10
-; push a
-; ld a, 0
-; push a
-; push a
-; push a
-; ld a, 0xbf
-; push a
-; ld a, 0
-; push a
-; call copy
-; pop a
-; pop a
-; pop a
-; pop a
-; pop a
-; pop a
-; halt
+
+ halt
+ halt
+ halt
+ halt
+
+ jmp loop
; fill frame-buffer with a color in reg b
fill:
@@ -68,58 +58,5 @@ fill_loop:
jmp fill_loop
ret
- ; void copy(void *dst, void *src, uint16_t size)
- ;
- ; using C calling convention with the stack
- ; not used, but return value in a (8-bit), a: x (16-bit)
-; copy:
-; ld x, [sp + 6]
-; ld a, [sp + 7] ; size a:x
-;
-; ; local variable
-; push a
-; push x
-;
-; ld y, [sp + 4]
-; ld b, [sp + 5] ; dst b:y
-; ld x, [sp + 6]
-; ld a, [sp + 7] ; src a:x
-; copy_loop:
-; ; copy byte from a:x to b:y
-; push x
-; ld x, [a : x]
-; ld [b : y], x
-; pop x
-;
-; ; inc a:x
-; inc x
-; bo
-; inc a
-;
-; ; inc b:y
-; inc y
-; bo
-; inc b
-;
-; ; dec local var size
-; push a
-; push x
-; ld x, [sp + 2]
-; ld a, [sp + 3]
-; dec x
-; bo
-; dec a
-; ld [sp + 2], x
-; ld [sp + 3], a
-; or x, a
-; pop x
-; pop a
-;
-; bnz
-; jmp copy_loop
-;
-; pop x
-; pop x ; free local var
-; ret
-;
-;
+int_handler:
+ iret