Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (37 sloc) 1.01 KB
; Notch's second "hello word" program.
; Supposed to show formatting.
set i, 0
set j, 0
set b, 0xf100
set a, [data+i]
ife a, 0
set PC, end
ifg a, 0xff
set PC, setcolor
bor a, b
set [0x8000+j], a
add i, 1
add j, 1
set PC, nextchar
set b, a
and b, 0xff
shl b, 8
ifg a, 0x1ff
add b, 0x80 ; Add high bit to each character we color. So the character must be 7-bit ASCII
add i, 1
set PC, nextchar
dat 0x170, "Hello ", 0x2e1, "world", 0x170, ", how are you?", 0
; Color format:
; After processing:
; 0x170 -> b = 0x7000 -> 0111 0000 0XXX XXXX = white(grey) on black
; 0x2e1 -> b = 0xe180 -> 1110 0001 1XXX XXXX = yellow on blue
; b gets OR'd with each character.
; ANSI says: black is 0, white is 7, yellow is 3, blue is 4
; If black is 0 and grey is 7, it's <FORE> <BACK> <EXTRA BIT> or <FORE> <EXTRA BIT> <BACK>
set PC, start
Jump to Line
Something went wrong with that request. Please try again.