Cleaned up examples

This commit is contained in:
neauoire 2021-02-10 19:05:40 -08:00
parent e86503901c
commit 4e9ca47e38
5 changed files with 30 additions and 35 deletions

View File

@ -1,5 +1,8 @@
( blank )
:dev/r fff8 ( std read port )
:dev/w fff9 ( std write port )
|0100 @RESET BRK
|c000 @FRAME BRK
|d000 @ERROR BRK

View File

@ -1,29 +1,25 @@
( hello world )
( hello world, to console )
;iterator
:dev/w fff9 ( const write port )
;i 1 ( var iterator )
|0100 @RESET
@word1 "hello_world ( len: 0x0b )
,00 ,dev/w STR ( set dev/write to console )
@loop
IOW ( write to device#0 )
,incr JSR ( increment itr )
,word1 ,strlen JSR ( get strlen )
NEQ ,loop ROT JSR? ( loop != strlen )
@word1 "hello_world ( len: 0x0b )
@loop
IOW ( write to device#0 )
,incr JSR ( increment itr )
,i LDR ( a = i )
,word1 ,strlen JSR ( b = string length )
NEQ ,loop ROT JSR? ( a != b ? loop )
BRK
@strlen
,0001 ADD^ LDR
RTS
@incr
,iterator LDR
,01 ADD
,iterator STR
,iterator LDR
RTS
@strlen ,0001 ADD^ LDR RTS
@incr ,i LDR ,01 ADD ,i STR RTS
|c000 @FRAME BRK
|d000 @ERROR BRK

View File

@ -1,4 +1,4 @@
( draw pixel )
( draw a single pixel )
:dev/w fff9 ( keep write port in a const )
;x 2

View File

@ -3,7 +3,7 @@
:dev/r fff8 ( std read port )
:dev/w fff9 ( std write port )
;x 2 ;y 2 ;color 1
;x 2 ;y 2 ;color 1 ;alive 1
|0100 @RESET
@ -11,36 +11,34 @@
,01 ,color STR ( set color )
,0020 ,x STR^ ( set x-pos )
,0030 ,y STR^ ( set y-pos )
,01 ,alive STR ( set alive = true )
BRK
|c000 @FRAME
,colorize JSR
,move JSR
( draw )
,alive LDR ,00 EQU BRK?
,01 ,color LDR ,x LDR^ ,y LDR^ ,putpixel JSR
,move JSR
BRK
@colorize
,color LDR ,01 ADD ,color STR ( incr color )
,color LDR ,04 LTH RTS?
,01 ,color STR
RTS
@move
,x LDR^ ,0001 ADD^ ,x STR^ ( incr x )
,x LDR^ ,0060 LTH^ RTS? ( if x > 60 )
,x LDR^ ,0040 LTH^ RTS? ( if x > 60 )
,0020 ,x STR^ ( x = 0x0020 )
,y LDR^ ,0001 ADD^ ,y STR^ ( incr y )
,y LDR^ ,0050 LTH^ RTS? ( y > 50 )
,00 ,alive STR ( alive = 0 )
RTS
@putpixel
IOW^ ( y short )
IOW^ ( x short )
IOW ( color byte )
IOW ( redraw byte )
IOW ( color byte )
IOW ( redraw byte )
RTS
|d000 @ERROR BRK

View File

@ -1,11 +1,9 @@
( my default test file )
( my test file, junk )
:dev/r fff8 ( std read port )
:dev/w fff9 ( std write port )
|0100 @RESET
,01 ,dev/w STR ( set dev/write screen#01 )
BRK