Created
December 2, 2012 00:52
-
-
Save irl/4186207 to your computer and use it in GitHub Desktop.
SpaceBarOS/DCPU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
; SpaceBarOS/DCPU | |
; (C) Iain R. Learmonth 2012. All rights reserved. | |
; | |
; Requires: | |
; DCPU-16 | |
; LEM1802 | |
; | |
; Tasks: | |
; Memory management | |
; Terminal driver | |
; Virtual file system | |
; | |
; | |
jsr detect_hardware | |
; print a welcome message | |
set a, welcome | |
jsr kprint | |
; update the monitor | |
set a, 0 | |
set b, 0x8000 | |
hwi [monitor] | |
:end | |
; do some halting | |
set pc, end | |
:kprint | |
; print a null-terminated string | |
; whose first character is at the | |
; address stored in A register | |
set b, 0x8000 | |
:kprint_loop | |
ife [a], 0x0000 | |
set pc, pop | |
set [b], [a] | |
bor [b], 0x7000 | |
add a, 1 | |
add b, 1 | |
set pc, kprint_loop | |
:detect_hardware | |
; how many devices are there | |
hwn i | |
:detect_hardware_loop | |
; what are you | |
hwq i | |
; is it a monitor | |
ife a, 0xf615 | |
ife b, 0x7349 | |
set [monitor], i | |
sub i, 1 ;next hardware id | |
; are we done | |
ife i, 0xffff | |
set pc, pop | |
; check next device | |
set pc, detect_hardware_loop | |
:monitor DAT 0 ; Monitor Hardware ID | |
:welcome DAT "Welcome to SpaceBarOS/DCPU", 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment