aboutsummaryrefslogtreecommitdiffstats
path: root/resources/asm
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2024-04-12 19:01:52 +0300
committerJan Tuomi <jan@jantuomi.fi>2024-04-12 19:01:52 +0300
commitd993f522cfd091d35e538a8c3f77bc233a560bf2 (patch)
tree0cab4973e13b5972a4b1038ebf45c3910135d003 /resources/asm
parent4f78086920cd4e2cee6d970decaee7025875f2a9 (diff)
Add initial TPU emu
Diffstat (limited to 'resources/asm')
-rw-r--r--resources/asm/bootstrap.atk1613
-rw-r--r--resources/asm/tpu.atk1612
2 files changed, 22 insertions, 3 deletions
diff --git a/resources/asm/bootstrap.atk16 b/resources/asm/bootstrap.atk16
index 4e5cd24..9b024e6 100644
--- a/resources/asm/bootstrap.atk16
+++ b/resources/asm/bootstrap.atk16
@@ -1,3 +1,5 @@
+@let SP RH
+
; vector table fields
@let vector_table 0x10
@let vt_ISR0 0x10 ; ISR0
@@ -44,7 +46,8 @@
hlt
@label keyboard_isr
- stack_stash RA RB
+ spu RA
+ spu RB
ldi vt_kb_pp_addr RA ; RA := Keyboard peripheral address pointer
ldr RA RA ; RA := Keyboard peripheral address deref
ldr RA RA ; RA := <16-bit keyboard character code> from MMIO register
@@ -52,7 +55,8 @@
ldr RB RB ; RB := Terminal peripheral address deref
str RA RB ; terminal <- character code (ASCII?)
mov RA RE ; RE := character code (for debugging)
- stack_restore RA RB
+ spo RB
+ spo RA
rti
@label program_segment
@@ -66,6 +70,9 @@
@address program_segment
; set graphics mode to disabled
- set_graphics_mode gr_disabled_mode
+ ldi vt_gr_mode_addr RA
+ ldr RA RA
+ ldi gr_disabled_mode RB
+ str RB RA
; jump to main (user defined)
jpi main
diff --git a/resources/asm/tpu.atk16 b/resources/asm/tpu.atk16
new file mode 100644
index 0000000..1278f71
--- /dev/null
+++ b/resources/asm/tpu.atk16
@@ -0,0 +1,12 @@
+@include bootstrap
+
+@label main
+ ldi vt_gr_mode_addr RA
+ ldr RA RA
+ ldi gr_text_mode RB
+ str RB RA
+
+@label loop
+ jpi loop
+
+ hlt