You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
(
|
|
|
|
; Create a table of strings
|
|
|
|
(sym TXT r7)
|
|
|
|
(def T_HELLO 0)
|
|
|
|
(def T_UNK 1)
|
|
|
|
(mkbf TXT)
|
|
|
|
(mkbfv r0 "*** Type ascii to uppercase. Press q to quit. ***\n")
|
|
|
|
(bfins @TXT T_HELLO r0)
|
|
|
|
(mkbfv r0 "🐈")
|
|
|
|
(bfins @TXT T_UNK r0)
|
|
|
|
|
|
|
|
; Print string from the table
|
|
|
|
(bfrd r0 @TXT T_HELLO)
|
|
|
|
(call print r0)
|
|
|
|
|
|
|
|
(proc print str
|
|
|
|
; Print string from a buffer
|
|
|
|
(sym ch r1) (sym pos r2)
|
|
|
|
(ld pos 0)
|
|
|
|
(:next)
|
|
|
|
(bfrd ch @str pos)
|
|
|
|
(ret.ov)
|
|
|
|
(ld @stdout ch)
|
|
|
|
(inc pos)
|
|
|
|
(j :next)
|
|
|
|
)
|
|
|
|
|
|
|
|
(:loop)
|
|
|
|
(ld r0 @stdin)
|
|
|
|
|
|
|
|
(cmp r0 'q'
|
|
|
|
(eq? (ld @stdout '\n')
|
|
|
|
(halt)))
|
|
|
|
|
|
|
|
; uppercase ASCII
|
|
|
|
(cmp r0 'a' (<? (j :badchar)))
|
|
|
|
(cmp r0 'z' (>? (j :badchar)))
|
|
|
|
(sub r0 ' ')
|
|
|
|
(ld @stdout r0)
|
|
|
|
(j :loop)
|
|
|
|
|
|
|
|
(:badchar)
|
|
|
|
(ld @stdout r0)
|
|
|
|
(bfrd r0 @TXT T_UNK)
|
|
|
|
(call print r0)
|
|
|
|
(j :loop)
|
|
|
|
)
|