boo-os/example.asm

71 lines
1.3 KiB
NASM
Raw Normal View History

2021-11-09 02:19:34 +00:00
@ $00000:
label vbuf:
@ $4B000:
$5B000 ; Set Instruction Pointer to $5B000
label RAX:
$0000000 ; RAX
$0000000 ; R2 - Temp Scratch
$0000000 ; R3 - Temp Scratch
$0000000 ; R4 - ARG 1
$0000000 ; R5 - ARG 2
$0000000 ; R6 - ARG 3
$0000000 ; R7 - ARG 4
$0000000 ; R8 - ARG 5
$0000000 ; RX
$0000000 ; RY
$0000000 ; RVBUF (RY * 640) + RX
@ $4B0C0:
import display.asm
import charset.asm
import strings.asm
import util.asm
; Common Strings
data ascii HelloWorld Welcome to Boo OS Running on Boo Byte Code!
data ascii Welcome !@#$%^&*()_+=-0987654321
data ascii Introspection We Can Now Do Introspection:
data ascii label_rax RAX:
data ascii label_rip RIP:
data ascii label_cycles Instruction Count:
; Kernel Begins
@ $5B000:
loadi $9 1;
loadi $A 1;
call set_pos
loadi $4 HelloWorld
call draw_string;
loadi $9 1;
loadi $A 10;
call set_pos
loadi $4 Welcome
call draw_string;
; OK! Time for some self referencing!!
loadi $9 1;
loadi $A 20;
call set_pos
loadi $4 Introspection
call draw_string;
loadi $9 1;
loadi $A 30;
call set_pos
loadi $4 label_cycles
call draw_string;
loadi $4 $4B000
loadi $2 $40
add $2 $4 $4
call print_addr
updsp
jmp $5B000;