aboutsummaryrefslogtreecommitdiffstats
path: root/src/tasks.asm
blob: 1f84142132552539e6dcf79fd627b61395b9e2bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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"