9836-alpha.sl 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. %
  3. % 9836-Alpha.SL - Terminal Interface for 9836 Alpha Memory
  4. %
  5. % Author: Alan Snyder
  6. % Hewlett-Packard/CRC
  7. % Date: 13 December 1982
  8. % Revised: 27 January 1983
  9. %
  10. % Note: uses efficiency hacks that require 80-column width!
  11. % Note: contains 68000 LAP code; must be compiled!
  12. % Note: uses all 25 lines; assumes keyboard input buffer has been relocated
  13. %
  14. % 27-Jan-83 Alan Snyder
  15. % Revise to use all 25 lines of the screen.
  16. %
  17. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  18. (BothTimes (load objects))
  19. (CompileTime (load display-char fast-int syslisp))
  20. (defflavor 9836-alpha (
  21. (height 25) % number of rows (0 indexed)
  22. (maxrow 24) % highest numbered row
  23. (width 80) % number of columns (0 indexed)
  24. (maxcol 79) % highest numbered column
  25. (cursor-row 0) % cursor position
  26. (cursor-column 0) % cursor position
  27. (raw-mode NIL)
  28. (buffer-address (int2sys 16#512000)) % an absolute address
  29. )
  30. ()
  31. (gettable-instance-variables height width maxrow maxcol raw-mode)
  32. )
  33. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  34. (defmethod (9836-alpha get-character) ()
  35. (keyboard-input-character)
  36. )
  37. (defmethod (9836-alpha ring-bell) ()
  38. (ChannelWriteChar 1 #\Bell)
  39. )
  40. (defmethod (9836-alpha move-cursor) (row column)
  41. (setf cursor-row row)
  42. (setf cursor-column column)
  43. (screen-set-cursor-position row column)
  44. )
  45. (defmethod (9836-alpha enter-raw-mode) ()
  46. (when (not raw-mode)
  47. % (EchoOff)
  48. % Enable Keypad?
  49. (setf raw-mode T)
  50. ))
  51. (defmethod (9836-alpha leave-raw-mode) ()
  52. (when raw-mode
  53. (setf raw-mode NIL)
  54. % Disable Keypad?
  55. % (EchoOn)
  56. ))
  57. (defmethod (9836-alpha erase) ()
  58. % This method should be invoked to initialize the screen to a known state.
  59. (setf cursor-column 0)
  60. (for (from row 0 maxrow)
  61. (do (setf cursor-row row)
  62. (=> self clear-line)
  63. ))
  64. (setf cursor-row 0)
  65. )
  66. (defmethod (9836-alpha clear-line) ()
  67. (=> self write-line cursor-row #.(make-vector 80 32))
  68. )
  69. (defmethod (9836-alpha convert-character) (ch)
  70. (setq ch (& ch (display-character-cons
  71. (dc-make-enhancement-mask INVERSE-VIDEO
  72. BLINK
  73. UNDERLINE
  74. INTENSIFY)
  75. (dc-make-font-mask 0)
  76. 16#FF)))
  77. ch)
  78. (defmethod (9836-alpha normal-enhancement) ()
  79. (dc-make-enhancement-mask)
  80. )
  81. (defmethod (9836-alpha highlighted-enhancement) ()
  82. (dc-make-enhancement-mask INVERSE-VIDEO)
  83. )
  84. (defmethod (9836-alpha supported-enhancements) ()
  85. (dc-make-enhancement-mask INVERSE-VIDEO BLINK UNDERLINE INTENSIFY)
  86. )
  87. (defmethod (9836-alpha write-char) (row column ch)
  88. (screen80-write-char buffer-address row column ch)
  89. )
  90. (defmethod (9836-alpha write-line) (row data)
  91. (screen80-write-line buffer-address row data)
  92. )
  93. (defmethod (9836-alpha read-char) (row column)
  94. (let ((offset (+ column (* row width))))
  95. (halfword buffer-address offset)
  96. ))
  97. % The following methods are provided for INTERNAL use only!
  98. (defmethod (9836-alpha init) ()
  99. )
  100. (lap '((*entry screen80-write-char expr 4) % buffer-address row column word
  101. (move!.l (reg 2) (reg t1))
  102. (moveq 80 (reg t2))
  103. (mulu (reg t1) (reg t2))
  104. (add!.l (reg 3) (reg t2))
  105. (lsl!.l 1 (reg t2))
  106. (move!.w (reg 4) (indexed (reg t2) (displacement (reg 1) 0)))
  107. (rts)
  108. ))
  109. (lap '((*entry screen80-write-line expr 3) % buffer-address row data
  110. (move!.l (reg 2) (reg t1)) % move row address to T1
  111. (moveq 80 (reg t2)) % move 80 to T2
  112. (mulu (reg t1) (reg t2)) % multiply row address by 80
  113. (lsl!.l 1 (reg t2)) % convert to byte offset
  114. (adda!.l (reg t2) (reg 1)) % A1: address of line in buffer
  115. (move!.l (minus 80) (reg t1))
  116. (addq!.l 4 (reg 3)) % skip data header word
  117. (*lbl (label loop))
  118. (addq!.l 2 (reg 3)) % skip upper halfword in data
  119. (move!.w (autoincrement (reg 3)) (autoincrement (reg 1)))
  120. (addq!.l 1 (reg t1))
  121. (bmi (label loop))
  122. (rts)
  123. ))