Croissant Runtime
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.

47 lines
962 B

; Create a table of strings
(sym TXT r7)
(def T_HELLO 0)
(def T_UNK 1)
(mkbf TXT)
(mkbf r0 "*** Type ascii to uppercase. Press q to quit. ***\n")
(bfins @TXT T_HELLO r0)
(mkbf 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)
(bfrd ch @str pos)
(ld @cout ch)
(inc pos)
(j :next)
(ld r0 @cin)
(cmp r0 'q'
(eq? (ld @cout '\n')
; uppercase ASCII
(cmp r0 'a' (<? (j :badchar)))
(cmp r0 'z' (>? (j :badchar)))
(sub r0 ' ')
(ld @cout r0)
(j :loop)
(ld @cout r0)
(bfrd r0 @TXT T_UNK)
(call print r0)
(j :loop)