Mirror of CollapseOS
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.

36 lines
740B

  1. ( Words allowing printing strings. Require core )
  2. ( This used to be in core, but some drivers providing EMIT
  3. are much much easier to write with access to core words,
  4. and these words below need EMIT... )
  5. : (print)
  6. BEGIN
  7. DUP C@ ( a c )
  8. ( exit if null )
  9. DUP NOT IF 2DROP EXIT THEN
  10. EMIT ( a )
  11. 1 + ( a+1 )
  12. AGAIN
  13. ;
  14. : ."
  15. 34 , ( 34 == litWord )
  16. BEGIN
  17. C< DUP ( c c )
  18. ( 34 is ASCII for " )
  19. DUP 34 = IF DROP DROP 0 0 THEN
  20. C,
  21. 0 = UNTIL
  22. COMPILE (print)
  23. ; IMMEDIATE
  24. : ABORT" [COMPILE] ." COMPILE ABORT ; IMMEDIATE
  25. : (uflw) ABORT" stack underflow" ;
  26. : (wnf) ABORT" word not found" ;
  27. : BS 8 EMIT ;
  28. : LF 10 EMIT ;
  29. : CR 13 EMIT ;
  30. : SPC 32 EMIT ;