( ; 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))) (sub r0 ' ') (ld @stdout r0) (j :loop) (:badchar) (ld @stdout r0) (bfrd r0 @TXT T_UNK) (call print r0) (j :loop) )