Skip to content
Browse files

Added examples for dasm programs

  • Loading branch information...
1 parent dd4422a commit c3eca800208d29461807a877975649c33560251b @pksunkara pksunkara committed May 2, 2012
Showing with 75 additions and 0 deletions.
  1. +39 −0 examples/assembler/font.dasm
  2. +36 −0 examples/assembler/hello.dasm
View
39 examples/assembler/font.dasm
@@ -0,0 +1,39 @@
+set pc, main
+:message .dat "QWERTYUIOPASDFGHJKLZXCVBNMMqwertyuiopasdfghjklzxcvbnm1234567890!?", 0
+:scroff .dat 0x0
+
+:main
+ set a, 0x0
+ set b, 0x8000
+ hwi 0
+
+ set a, 0x1
+ set b, font
+ hwi 0
+
+ set a, message
+ jsr printstr
+
+:end set pc, end
+
+:printstr
+ ife [a], 0
+ set pc, pop
+ jsr putc
+ add a, 1
+ set pc, printstr
+
+:putc
+ set push, a
+ set a, [a]
+ bor a, 0xf000
+ set b, 0x8000
+ add b, [scroff]
+ set [b], a
+
+ add [scroff], 1
+ ife [scroff], 0x17f
+ set [scroff], 0x0
+
+ set a, pop
+ set pc, pop
View
36 examples/assembler/hello.dasm
@@ -0,0 +1,36 @@
+set pc, main
+
+:message .dat "Hello world!", 0
+:scroff .dat 0x0
+
+:main
+ set a, 0x0
+ set b, 0x8000
+ hwi 0
+
+ set a, message
+ jsr printstr
+
+:end set pc, end
+
+:printstr
+ ife [a], 0
+ set pc, pop
+ jsr putc
+ add a, 1
+ set pc, printstr
+
+:putc
+ set push, a
+ set a, [a]
+ bor a, 0xf000
+ set b, 0x8000
+ add b, [scroff]
+ set [b], a
+
+ add [scroff], 1
+ ife [scroff], 0x17f
+ set [scroff], 0x0
+
+ set a, pop
+ set pc, pop

0 comments on commit c3eca80

Please sign in to comment.
Something went wrong with that request. Please try again.