undar-lang/test/hardcoded-while.tal

14 lines
406 B
Tal

|100
!{ @i $2 } #0000 ;i STA2
&while.1 [ ;i LDA2 #0008 LTH2 ] #03 JCN !{ ( Loop while iterator is less than limit. )
;i LDA2 print-num ( Run function to print number )
;i LDA2 INC2 ;i STA2 ( incriment counter )
!&while.1 }
BRK ( Halt. )
@print-num ( int -- )
LIT "0 ADD ( Add number to ascii character 0 )
#18 DEO ( Send to Console/write )
JMP2r