aboutsummaryrefslogtreecommitdiffstats
path: root/src/tasks.asm
diff options
context:
space:
mode:
Diffstat (limited to 'src/tasks.asm')
-rw-r--r--src/tasks.asm33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/tasks.asm b/src/tasks.asm
new file mode 100644
index 0000000..1f84142
--- /dev/null
+++ b/src/tasks.asm
@@ -0,0 +1,33 @@
+; =============================================================================
+; tasks.asm - two demo userland tasks (text-in-ROM model).
+; Each loops: write its letter to the console, then yield. This exercises the
+; whole pipeline: syscall trap, console, and the HRAM context switch swapping
+; RAM banks / SVBK between tasks.
+; =============================================================================
+INCLUDE "include/gbos.inc"
+
+SECTION "tasks", ROM0
+
+TaskA::
+.loop
+ ld de, .msg
+ ld b, 1 ; len
+ ld c, SYS_WRITE
+ rst $30
+ ld c, SYS_YIELD
+ rst $30
+ jr .loop
+.msg
+ db "A"
+
+TaskB::
+.loop
+ ld de, .msg
+ ld b, 1
+ ld c, SYS_WRITE
+ rst $30
+ ld c, SYS_YIELD
+ rst $30
+ jr .loop
+.msg
+ db "B"