/forth/system09.f

http://rekonstrukt.googlecode.com/ · FORTRAN Legacy · 102 lines · 83 code · 16 blank · 3 comment · 6 complexity · fb7282516a2dffcf873db17fe8f601aa MD5 · raw file

  1. \ System09 words
  2. HEX
  3. \ VDU stuff
  4. B020 constant vdu-char
  5. B021 constant vdu-color
  6. B022 constant vdu-hcursor
  7. B023 constant vdu-vcursor
  8. B024 constant vdu-voffset
  9. variable x-pos 0 x-pos c!
  10. variable y-pos 0 y-pos c!
  11. variable color 0 color c!
  12. : at-xy-vdu ( x y -- )
  13. y-pos !
  14. x-pos !
  15. ;
  16. decimal
  17. : emit-vdu ( c -- )
  18. x-pos @ vdu-hcursor c!
  19. y-pos @ vdu-vcursor c!
  20. color @ vdu-color c!
  21. vdu-char c!
  22. x-pos @ 80 = if
  23. 0 x-pos !
  24. 1 y-pos +!
  25. else
  26. 1 x-pos +!
  27. then
  28. ;
  29. : type-vdu ( s n -- )
  30. 0 do
  31. dup i + c@ emit-vdu
  32. loop
  33. drop
  34. ;
  35. : cls ( -- )
  36. 0 x-pos !
  37. 0 y-pos !
  38. 0 color !
  39. 80 26 * 0 do
  40. 32 emit-vdu
  41. loop
  42. 0 x-pos !
  43. 0 y-pos !
  44. 7 color !
  45. ;
  46. : liebesschwur ( -- )
  47. cls
  48. 0 3 at-xy-vdu
  49. s" Hallo Suesse, guten Morgen!" type-vdu
  50. 30 8 at-xy-vdu
  51. s" Ich " type-vdu
  52. 1 color !
  53. s" liebe " type-vdu
  54. 7 color !
  55. s" Dich!" type-vdu
  56. 60 13 at-xy-vdu
  57. s" Dein Hans" type-vdu
  58. 0 color !
  59. 0 20 at-xy-vdu
  60. s" ." type-vdu
  61. ;
  62. liebesschwur
  63. \ SECD interface
  64. hex
  65. B140 constant secd-status
  66. B141 constant secd-address-high
  67. B200 constant secd-ram-base
  68. decimal
  69. : .secd-status ( -- )
  70. ." SECD: "
  71. secd-status c@
  72. dup 1 and 0= if ." running " else ." stopped " then
  73. 1 rshift 3 and
  74. dup 0 = if ." running" then
  75. dup 1 = if ." halted" then
  76. dup 2 = if ." gc" then
  77. 3 = if ." unknown" then
  78. cr
  79. ;
  80. : .secd-page ( n -- )
  81. secd-address-high c!
  82. base @
  83. hex
  84. secd-ram-base 100 dump
  85. base !
  86. ;