Table of Contents

AIST2R

Table Of Contents

  • [00008] ASCII IST2 ROM PROGRAM
  • [00027] I/O
  • [00077] EQUATE TABLES
  • [00223] INITIALIZE ROM PROGRAM
  • [00285] COMM SET
  • [00335] LOAD FILE
  • [00356] ASCII LOAD
  • [00378] LOAD SEQUENCE
  • [00558] LOAD DATA TO RAM
  • [00711] LOAD REQUEST
  • [00749] INPUT DATA
  • [00804] OUTPUT DATA
  • [00836] CRC GENERATOR
  • [00883] GET LOAD FILE NUMBER
  • [00950] PRESET HOST MESSAGES
  • [00999] LOADER MESSAGE DISPLAY
  • [01138] DISK LOADER
  • [01246] DIAGNOSTIC TESTS

Source Code

AIST2R.txt
  1. AIST2R
  2. * /--- FILE TYPE = E
  3. * /--- BLOCK TITLE 00 000 82/10/27 09.21
  4. IDENT AIST2R,ORIGIN
  5. ABS
  6. ORIGIN EQU 0000
  7. ORG ORIGIN
  8. TITLE ASCII IST2 ROM PROGRAM
  9. * * * * * * * * * * * * * * * * * *
  10. *
  11. * 'INFORMATION 'SYSTEMS 'TERMINAL 2 'R'O'M 'PROGRAM
  12. *
  13. * COPYRIGHT CONTROL DATA CORPERATION 1982
  14. *
  15. * PROCESSOR MOSTEK Z80
  16. * PROGRAMMER T E LARSOM
  17. **
  18. *
  19. * REVISION 00
  20. *
  21. * THIS IS A REWRITE OF THE IST2 ROM RESIDENT FOR
  22. * THE ASCII PROTOCAL. THE 21/12 BIT COMM PORT IS
  23. * NOT USED. THE SERIAL PORT WILL BE USED TO
  24. * COMMUNICATE TO THE HOST.
  25. *
  26. * * * * * * * * * * * * * * * * * *
  27. TITLE I/O
  28. * * * * * * * * * * * * * * * * * *
  29. *
  30. * THE FOLLOWING DESCRIBES THE SERIAL PORT AND
  31. * DEFAULT CONDITIONS.
  32. *
  33. * S2-6 1 = ENABLE PARITY, 0 = DISABLE PARITY
  34. * S2-1 ON = CONSTANT RTS, OFF = SWITCHED RTS
  35. * S2-8 ON = 1 STOP BIT, OFF = 2 STOP BITS
  36. *
  37. * DEFAULT SWITCHES, (PROGRAM INTERPRETE)
  38. * SE-4,5 00 = 300 BAUD
  39. * 01 = 1200 BAUD
  40. * 10 = 2400 BAUD
  41. * 11 = 4800 BAUD
  42. * S2-9 ON = EVEN PARITY, OFF = ODD PARITY
  43. * IF SE-1 = SKIP DIAGNOSTICS
  44. * THEN SE-2 ON = PROD. LOAD FILE, OFF EXPERIM.
  45. * SE-3 ON = AUTO SELECT, OFF = OPERATOR SEL
  46. *
  47. * OUTPUT (07)
  48. * BIT 0 = ENABLE CREQ
  49. * BIT 1 = ENABLE CRDY
  50. * BIT 2,3 = WORD LENGTH
  51. * BIT 4 = ODD/EVEN PARITY
  52. * BIT 5,6,7 = BAUD RATE
  53. *
  54. * INPUT (00)
  55. * BIT 0 SE-1 ON = 0 = SKIP DIAGNOSTICS
  56. * OFF = 1 = RUN DIAGNOSTICS
  57. * BIT 1 SE-2 ON = 0 = SKIP KEYBOARD TEST
  58. * = PRODUCTION LOAD FIL
  59. * OFF = 1 = RUN KEYBOARD TEST
  60. * = EXP. LOAD FILE
  61. * BIT 2 SE-3 ON = 0 = EXIT DIAGNOSTICS
  62. * = AUTO SELECT
  63. * OFF = 1 = REPEAT DIAGNOSTICS
  64. * = OPERATOR SELECT
  65. * BITS 3,4 SE-4,5 ON = 0, OFF = 1
  66. * 00 = 300 BAUD
  67. * 01 = 1200 BAUD
  68. * 10 = 2400 BAUD
  69. * 11 = 4800 BAUD
  70. * BIT 5 S2-10 ON = 0 = 16K RAM
  71. * OFF = 1 = 32K RAM
  72. * BIT 6 S2-9 ON = 0 = EVEN PARITY
  73. * OFF = 1 = ODD PARITY
  74. *
  75. * * * * * * * * * * * * * * * * * * * *
  76. * /--- BLOCK EQUATES 00 000 82/04/27 08.46
  77. TITLE EQUATE TABLES
  78. *
  79. * EQUATE TABLE
  80. *
  81.  
  82. * INPUT
  83.  
  84. MNTSW EQU 00 MAINTAINENCE SWITCHES
  85. * BIT 0 SE-1
  86. * BIT 1 SE-2
  87. * BIT 2 SE-3
  88. * BIT 3 SE-4
  89. * BIT 4 SE-5
  90. * BIT 5 S2-10
  91. * BIT 6 S2-9
  92. * BIT 7 S2-8
  93. KBDATA EQU 01 KEY BOARD DATA
  94. TPDATA EQU 02 TOUCH PANEL DATA
  95. SERDATI EQU 05 SERIAL CHANNEL DATA INPUT
  96. SERSTAT EQU 06 INPUT SERIAL CHANNEL STATUS
  97. * BIT 0 INTERRUPT PENDING (1)
  98. * BIT 1 CREQ (1)
  99. * BIT 2 CRDY (1)
  100. * BIT 3 RECEIVE ERROR (1)
  101. * BIT 4 CARRIER DETECT (0)
  102. * BIT 5 CTS (1)
  103. * BIT 6 DSR (1)
  104. SYSSTAT EQU 07 TERMINAL INTERNAL STATUS
  105. * BIT 0 COMM CRDY
  106. * BIT 1 HARDWARE FLAG
  107. * BIT 2 COMM CREQ
  108. * BIT 3 KEY BOARD DATA READY
  109. * BIT 4 TOUCH PANEL DATA READY
  110. * BIT 5 TIMEOUT
  111. * BIT 6 RESET SWITCH
  112. * BIT 7 BULK WRITE/ERASE BUSY
  113. CLADATA EQU 08 CLA DATA
  114.  
  115.  
  116. * OUTPUT
  117.  
  118. PNLLTS EQU 00 MAINTAINENCE PANEL LIGHTS
  119. * BIT 0 ERROR LIGHT
  120. * BIT 1 TRANSMIT LIGHT
  121. * BIT 2 RECEIVE LIGHT
  122. * BIT 3 RTS LIGHT
  123. * BIT 4 DSR LIGHT
  124. * BIT 5 DTR LIGHT
  125. * BIT 6 0 = TEST MODE, 1 = NORMAL MODE
  126. * BIT 7 0 = ROM SELECT, 1 = RAM SELECT
  127. CLAL EQU 01 OUTPUT LOWER DATA BITS
  128. CLAU EQU 02 OUTPUT UPPER DATA BITS
  129. BLKERS EQU 03 DISPLAY BULK ERASE
  130. * BIT 2 BIT 1 BIT 0
  131. * 0 0 X DISBLE VIDEO
  132. * 0 1 X ENABLE VIDEO
  133. * 1 0 0 BULK ERASE - DISABLE VIDEO
  134. * 1 0 1 BULK WRITE - DISABLE VIDEO
  135. * 1 1 0 BULK ERASE - ENABLE VIDEO
  136. * 1 1 1 BULK WRITE - ENABLE VIDEO
  137. * BITS 3 THRU 7 IGNORED
  138. INTMSK EQU 04 SYSTEM INTERRUPT MASK
  139. * BIT 0 SERIAL CHANNEL
  140. * BIT 1 COMM LINE CHAR READY
  141. * BIT 2 COMM LINE CHAR REQUEST
  142. * BIT 3 KEYBOARD DATA READY
  143. * BIT 4 TOUCH PANEL DATA READY
  144. * BIT 5 SHORT INTERVAL TIMER
  145. * BIT 6 EXTERNAL INTERRUPT
  146. * BIT 7 LONG INTERVAL TIMER
  147. MISCTL EQU 05 MISCELLANEOUS CONTROL
  148. * BIT 0 0 = NOOPERATION, 1 = SOUND ALARM
  149. * BIT 1 0 = DTR ON, 1 = DTR OFF
  150. * BIT 2 0 = RESET FLAG, 1 = SET FLAG
  151. SERDATO EQU 06 OUTPUT SERIAL DATA
  152. SERCTRL EQU 07 OUTPUT SERIAL CHANNEL CONTROL
  153. *
  154. FDCMND EQU 0EFH FLOPPY DISK COMMAND
  155. FDSTAT EQU 0EFH FLOPPY DISK STATUS
  156. FDDATA EQU 0EEH FLOPPY DISK DATA
  157. * /--- BLOCK EQUATES 00 000 82/05/24 11.14
  158.  
  159. * EQUATES USED BY LOADER
  160.  
  161. STX EQU 82H
  162. ETX EQU 03H
  163. DLE EQU 90H
  164. ETB EQU 17H
  165. SLASH EQU 0AFH
  166. IST2SBTP EQU 00 IST2 SUBTYPE
  167. *
  168. ZSTACK EQU 3000H PROCESSOR STACK
  169. *
  170. R.INIT EQU 0040H RESIDENT ENTRY POINT
  171.  
  172. * LOADER VARS
  173.  
  174. CKSUMTBL EQU 22C8H CHECKSUM TABLE FWA
  175. CHECKSUM EQU 22CAH CHECKSUM STORED BY LOADER
  176. LOADFLAG EQU 22CBH LOAD FLAG, 3CH = LOAD COMPLETE
  177. RESETFLG EQU 22CCH RESET FLAG 3CH = SHORT RESET
  178. MODEFLG EQU 22CDH 00 = PLATO, 01 = TS
  179. LOADINFO EQU 22CEH LOAD PARAMETERS
  180. * BIT 0 0 = RS232, 1 = LONG LIN
  181. * BIT 1 0=INTERNAL, 1=EXTERNAL
  182. * BIT 2 ALWAYS 1 FOR ASCII
  183. * BIT 3,4 00=HOST,10=ROM,11=DIS
  184. * BIT 5,6,7 BAUD RATE,(S5-6,7,8
  185. RUNINFO EQU 22CFH SAME AS LOADINFO
  186.  
  187. * MICRO PLATO VARS
  188.  
  189. M.LDFILE EQU 22E5H LOAD FILE NUMBER
  190.  
  191. * * * * * * * * * * * * * * * * * * * *
  192. *
  193. * ASCII LOAD VARIABLES AND SCRATCH AREA
  194. *
  195. * * * * * * * * * * * * * * * * * * * *
  196. *
  197. * THE FOLLOWING FLAGS ARE USE FOR ASCII LOAD.
  198. * VARIABLES SEQ1..A3 MUST BE IN THE ORDER SHOWN.
  199.  
  200. SEQ1 EQU 3300H 16 BIT LOAD BLOCK
  201. SEQ2 EQU 3301H SEQUENCE NUMBER
  202. LDN EQU 3302H LOAD FILE NUMBER
  203. ADR1 EQU 3303H 24 BIT STARTING ADDRESS
  204. ADR2 EQU 3304H OF LOAD DATA
  205. ADR3 EQU 3305H
  206.  
  207. ABORT EQU 3306H HEADER ABORT FLAG
  208. CLOCK EQU 3307H CLOCK TIMER, 250 MS PERIOD
  209. TIMER1 EQU 3309H OVERALL TIMER FOR LOAD
  210. FLAGREG EQU 330AH ETX RECEIVED FLAG
  211. CNTR EQU 330BH RETRY COUNTER
  212. CHAR EQU 330CH INPUT DATA SAVE
  213. CRC1 EQU 330DH 16 BIT CRC
  214. CRC2 EQU 330EH REMAINDER
  215. SAVE EQU 330FH BYTE COUNTER
  216. SAVADR EQU 3311H
  217. FWASAVE EQU 3314H LOAD FWA SAVE AREA
  218. LITES EQU 3316H LIGHTS REGISTER
  219.  
  220. MADDR EQU 3400H
  221. SADDR EQU 3500H RESIDENT SAVE AREA
  222. * /--- BLOCK BEGIN 00 000 82/05/25 13.23
  223. TITLE INITIALIZE ROM PROGRAM
  224. * * * * * * * * * * * * * * * * * * * *
  225. *
  226. * ROM RESIDENT PROGRAM
  227. *
  228. * * * * * * * * * * * * * * * * * * *
  229.  
  230. BEGIN EQU *
  231. DI
  232. LD A,00 DISABLE INTERRUPTS
  233. OUT (INTMSK),A
  234. LD SP,ZSTACK
  235. LD A,02
  236. OUT (BLKERS),A ENABLE VIDEO
  237.  
  238. LD B,6 SET 3 SECOND TIMEOUT
  239. BEGIN1 EQU *
  240. LD HL,38462
  241. BEGIN2 EQU *
  242. IN A,(SYSSTAT) IS RESET SWITCH ON
  243. BIT 6,A
  244. JR NZ,BEGIN4 JUMP IF NO
  245. DEC HL
  246. LD A,L
  247. OR H
  248. JR NZ,BEGIN2
  249. DJNZ BEGIN1
  250.  
  251. LD (RESETFLG),A 3 SECONDS HAVE ELAPSED, SO
  252.  
  253. BEGIN3 EQU *
  254. IN A,(SYSSTAT)
  255. BIT 6,A LOOP TILL RESET OFF
  256. JR Z,BEGIN3
  257.  
  258. JR BEGIN5 CLEAR SHORT RESET FLAG
  259.  
  260. BEGIN4 EQU *
  261. XOR A CLEAR HARDWARE FLAG AND
  262. OUT (MISCTL),A SET DTR ON.
  263.  
  264. LD A,(LOADFLAG) IS CODE ALREADY LOADED
  265. XOR 3CH
  266. JR NZ,BEGIN5 FORCE LOAD IF NO
  267.  
  268. LD A,(RESETFLG) IS THIS A SHORT RESET
  269. XOR 3CH
  270. JP Z,AEXIT
  271.  
  272. BEGIN5 EQU *
  273. LD HL,SEQ1
  274. LD DE,SEQ2
  275. LD BC,0040
  276. LD (HL),00
  277. LDIR CLEAR LOADER VARIABLES
  278.  
  279. IN A,(MNTSW) SKIP DIAGNOSTICS IF
  280. BIT 0,A SWITCH 0 IS OFF
  281. JP NZ,DIAG
  282.  
  283.  
  284. * /--- BLOCK COMSET 00 000 82/05/25 08.04
  285. TITLE COMM SET
  286. * SET UP SERIAL PORT FOR COMM TO ASCII PLATO
  287. * ACCORDING TO THE SWITCH SETTINGS.
  288.  
  289. COMSET EQU *
  290. CALL D.CLEAR CLEAR THE SCREEN.
  291. LD A,5FH CLEAR TEST MODE TO ENABLE
  292. LD (LITES),A SAVE LIGHTS REGISTER
  293. OUT (PNLLTS),A THE ASCII COMM CHANNEL
  294.  
  295. IN A,(MNTSW) GET SWITCH SETTINGS
  296. LD C,A
  297.  
  298. LD B,20H
  299. AND 18H MASK BAUD RATE
  300. JR Z,COMSET1 TEST FOR 300 BAUD
  301. LD B,60H
  302. CP 08 TEST FOR 1200 BAUD
  303. JR Z,COMSET1
  304. LD B,80H
  305. CP 10H TEST FOR 2400 BAUD
  306. JR Z,COMSET1
  307. LD B,0A0H SET 4800 BAUD
  308.  
  309. COMSET1 EQU *
  310. LD A,0CH SET WORD LENGTH
  311. OR B AND INCLUDE IN CONTROL BYTE
  312. OUT (SERCTRL),A
  313. LD HL,BACKMSG POINT TO BACKOUT MESSAGE
  314. LD BC,0300H
  315.  
  316. * SEND BACKOUT MESSAGE TO PLATO
  317.  
  318. BACKOUT EQU *
  319. IN A,(SERSTAT) READ ASCII COMM STATUS
  320. AND 12H TEST FOR CREQ, CARRIER
  321. CP 02
  322. JR Z,BACKOUT1 WAIT FOR CHAR REQUEST
  323.  
  324. DEC C
  325. JR Z,FLOAD EXIT IF NO CO, CREQ.
  326. JR BACKOUT
  327.  
  328. BACKOUT1 EQU *
  329. LD A,(HL) OUTPUT CHARACTER
  330. OUT (SERDATO),A
  331. INC HL POINT TO NEXT CHAR
  332. LD C,00
  333. DJNZ BACKOUT LOOP TILL ALL CHARS ARE OUTPUT
  334. * /--- BLOCK FLOAD 00 000 82/05/25 09.11
  335. TITLE LOAD FILE
  336. *
  337. * DETERMINE LOAD SOURCE AND LOAD FILE
  338. *
  339. FLOAD EQU *
  340. XOR A CLEAR CODE LOADED FLAG
  341. LD (LOADFLAG),A
  342. LD (RESETFLG),A CLEAR SHORT RESET FLAG
  343. IN A,(MNTSW)
  344. BIT 2,A TEST FOR AUTO SELECT
  345. JR NZ,FLOAD2 JUMP IF MANUAL
  346.  
  347. LD A,01 SET LOAD FILE 01
  348. LD (M.LDFILE),A STORE LOAD FILE NUMBER
  349. CALL DISKLOAD TRY TO LOAD FROM DISK FIRST
  350. JR HLOAD ELSE LOAD FROM HOST
  351.  
  352. FLOAD2 EQU *
  353. CALL GETLFN GET LOAD FILE NUMBER
  354. LD (M.LDFILE),A STORE LOAD FILE NUMBER
  355.  
  356. TITLE ASCII LOAD
  357. * * * * * * * * * * * * * * * * * * * *
  358. *
  359. * LOAD FROM ASCII COMMUNICATIONS PORT
  360. *
  361. * * * * * * * * * * * * * * * * * * * *
  362.  
  363. HLOAD EQU *
  364. LD A,(M.LDFILE)
  365. LD (LDN),A
  366. LD HL,SADDR SET FWA OF LOAD
  367. CALL S100 DO THE LOAD
  368. POP DE PUT SAVED LOAD INFO INTO D
  369. JP C,COMSET TRY AGAIN IF LOAD FAILED
  370.  
  371. AEXIT EQU *
  372. LD HL,MOVE PUT RESIDENT MOVE
  373. LD DE,MADDR ROUTINE OUT IN
  374. LD BC,ENDMV-MOVE RAM AREA.
  375. LDIR
  376. JP MADDR AND JUMP TO MOVE ROUTINE.
  377. * /--- BLOCK S100 00 000 82/05/25 08.07
  378. TITLE LOAD SEQUENCE
  379. * * * * * * * * * * * * * * * * * * * *
  380. * CALLABLE ENTRY FOR ASCII LOAD ROUTINE
  381. * ON ENTRY,
  382. * FWA OF LOAD IS IN HL REG.
  383. * ON EXIT, CARRY SET SAYS LOAD FAILED.
  384. * CARRY CLEAR SAYS LOAD WAS SUCCESSFUL.
  385. * IF CARRY IS CLEAR, C-REG CONTAINS THE
  386. * COMPUTED MEMORY CHECKSUM OF THE LOADED DATA.
  387. * * * * * * * * * * * * * * * * * * * *
  388. S100 EQU *
  389. LD (FWASAVE),HL SAVE LOAD FWA
  390. LD HL,VARBEG INITIALIZE LOAD MESSAGES
  391. LD DE,LNN
  392. LD BC,VAREND-VARBEG
  393. LDIR
  394.  
  395. S102 EQU *
  396. LD HL,6600 RESET CLOCK
  397. LD (CLOCK),HL
  398. LD A,4 START 1 SECOND TIMER
  399. LD (TIMER1),A
  400.  
  401. * LOOK FOR INITIAL / (STATE 0)
  402. S103 EQU *
  403. CALL INDATA GET NEXT CHARACTER
  404. JR C,S107 INPUT FAILED
  405.  
  406. CP SLASH
  407. JR NZ,S103 WAIT FOR / CODE
  408.  
  409.  
  410. * /--- BLOCK S105 00 000 82/05/26 11.36
  411. * / RECEIVED OR / TIMEOUT HAS OCCURRED
  412. S105 EQU *
  413. LD A,2 SET RETRY COUNT
  414. LD (CNTR),A
  415. JR S200 LOOK FOR DLE STX NEXT
  416.  
  417. S107 EQU *
  418. CALL D.CLEAR CLEAR SCREEN.
  419. IN A,(SERSTAT)
  420. BIT 4,A TEST FOR CARRIER
  421. JR Z,S105
  422. CALL D.NOCARR
  423. JR S102
  424.  
  425. * CALLABLE ROUTINE TO TERMINATE THE LOAD IF THE RETRY COUNT
  426. * IN (CNTR) HAS EXPIRED. ROUTINE WILL JUMP TO TERLD IF
  427. * RETRY COUNT HAS EXPIRED. OTHERWISE IT WILL RETURN TO
  428. * THE CALLER.
  429. CHKRETRY EQU *
  430. LD A,(LITES) SET ERR LIGHT (DTR LIGHT ON)
  431. RES 0,A
  432. OUT (PNLLTS),A
  433. LD A,(CNTR) CHECK RETRY COUNTER
  434. OR A
  435. JR Z,TERLD TERMINATE IF =0
  436. DEC A DECREMENT COUNTER
  437. LD (CNTR),A
  438. JR S200
  439.  
  440. * TERMINATE THE LOAD
  441. TERLD CALL D.LFAIL DISPLAY - LOAD FAILURE -
  442. JR HLOAD
  443.  
  444. * SEND LOAD REQUEST AND INITIALIZE FOR NEW LOAD
  445. S200 EQU *
  446. CALL LOADREQ SEND LOAD REQUEST
  447. JR NC,TERLD TERMINATE IF ERROR
  448. XOR A CLEAR LOAD VARIABLES
  449. LD (SEQ1),A
  450. LD (SEQ2),A
  451. LD (ADR1),A
  452. LD (ADR2),A
  453. LD A,R.INIT
  454. LD (ADR3),A
  455.  
  456. * /--- BLOCK S201 00 000 82/04/30 15.29
  457. * START A NEW BLOCK
  458. S201 EQU *
  459. LD A,120 START 30 SECOND TIMER
  460. LD (TIMER1),A
  461.  
  462. * LOOK FOR DLE-STX (STATE 1)
  463. S202 EQU *
  464. CALL INDATA GET NEXT CHARACTER
  465. JR C,CHKRETRY
  466.  
  467. S205 CP DLE IS CHAR A DLE
  468. JR NZ,S202 IF NOT, CONTINUE LOOKING
  469.  
  470. * DLE RECEIVED, LOOK FOR STX (STATE 2)
  471. S206 EQU *
  472. CALL INDATA GET NEXT CHAR
  473. JR C,CHKRETRY
  474.  
  475. CP STX IS IT AN STX
  476. JR NZ,S205 JUMP IF NOT
  477.  
  478. * DLE-STX HAS BEEN RECEIVED, SO PROCESS HEADER.
  479. S210 LD A,5FH CLEAR ERR LIGHT (DTR LIGHT ON)
  480. OUT (PNLLTS),A
  481. LD A,1 SET ABORT FLAG
  482. LD (ABORT),A
  483. XOR A CLEAR CRC
  484. LD (CRC1),A
  485. LD (CRC2),A
  486. LD (FLAGREG),A CLEAR ETX FLAG
  487.  
  488. CALL D.LDBLK - BLOCK XX-
  489. LD HL,SEQ1 PRESET HEADER POINTER
  490. LD B,6 HEADER LENGTH IN BYTES
  491. LD A,2 PRESET BYTE COUNTER
  492. LD (SAVE),A
  493.  
  494. * /--- BLOCK B001 00 000 82/04/30 15.35
  495. * WAIT FOR NEXT HEADER CHARACTER. (STATE 3)
  496. B001 CALL INDATA GET NEXT CHAR
  497. B001A JR C,CHKRETRY
  498.  
  499. CP DLE IS IT A DLE
  500. JR Z,B004 JUMP IF YES
  501.  
  502. B002 LD A,(SAVE) TEST BYTE COUNT
  503. OR A
  504. JR NZ,B005 JUMP IF FIRST OR SECOND BYTE
  505.  
  506. LD A,(HL) BYTE 3-6, SO COMPARE =
  507. CP C
  508. JR NZ,C000 SEND NAK IF NOT =
  509.  
  510. B003 CALL CRCGEN ACCUMULATE CRC
  511. DEC B
  512. JR Z,D000 JUMP IF DONE WITH HEADER
  513. INC HL STEP TO NEXT HEADER BYTE
  514. JR B001 LOOP
  515.  
  516. * DLE DETECTED. (STATE 5)
  517. B004 CALL INDATA HAVE DLE, GET NEXT CHAR
  518. JR C,B001A
  519.  
  520. CP DLE IS IT A DLE
  521. JR Z,B002 TREAT AS DATA IF YES
  522. JP E000 OTHERWISE, END OF THIS BLOCK
  523.  
  524. B005 LD A,(HL) BYTES 1-2, SO COMPARE
  525. CP C
  526. JR NZ,B006 ERROR IF NOT EQUAL
  527. LD A,(SAVE) DECREMENT BYTE COUNTER
  528. DEC A
  529. LD (SAVE),A
  530. JR B003 COMPARE OK, SO CONTINUE
  531.  
  532. B006 EQU *
  533. JR NC,S202 IGNORE BLOCK IF TOO SMALL
  534.  
  535. * /--- BLOCK C000 00 000 82/04/23 14.20
  536. * SEND NAK,SEQ1,SEQ2,/SEQ1,/SEQ2 MESSAGE
  537. C000 LD A,5EH SET ERR LIGHT
  538. OUT (PNLLTS),A
  539. LD HL,(SEQ1) HL=SEQ2,SEQ1
  540. LD (NAKXY+1),HL SAVE SEQ1,SEQ2
  541. LD A,H HL=NOT SEQ2,NOT SEQ1
  542. CPL
  543. LD H,A
  544. LD A,L
  545. CPL
  546. LD L,A
  547. LD (NAKXY+3),HL SAVE NOT SEQ1,NOT SEQ2
  548.  
  549. LD HL,NAKXY POINT TO MESSAGE
  550. LD B,5 MESSAGE LENGTH
  551. C001 CALL OUTDATA OUTPUT ONE CHAR
  552. JP NC,TERLD TERMINATE IF ERROR
  553. INC HL
  554. DJNZ C001 LOOP TILL ALL CHARS ARE SENT
  555. JP S202 LOOK FOR DLE STX
  556.  
  557. * /--- BLOCK D000 00 000 82/05/26 15.15
  558. TITLE LOAD DATA TO RAM
  559. * DONE WITH HEADER. LOAD DATA TO RAM.
  560. * (SAVE) BYTE COUNT OF CHARS STORED THIS BLOCK
  561. * B REG BYTE COUNT OF CHARS IN THIS BLOCK
  562. * HL REG DATA STORE ADDRESS
  563. * THERE IS A MAXIMUM OF 240 DATA CHARS IN A RECEIVED BLOCK.
  564.  
  565. D000 EQU *
  566. LD HL,(FWASAVE) HL = LOAD ADDRESS
  567. XOR A CLEAR BYTE COUNTERS
  568. LD B,A
  569. LD (SAVE),A
  570. LD (ABORT),A CLEAR ABORT FLAG
  571.  
  572. * WAIT FOR DATA CHARACTER. (STATE 4)
  573. D001 EQU *
  574. CALL INDATA GET NEXT DATA BYTE
  575. JR C,C000 ERROR IF TIME OUT
  576. CP DLE IS IT A DLE
  577. JR NZ,D002 JUMP IF NO
  578.  
  579. * DLE DETECTED. (STATE 5)
  580. CALL INDATA HAVE DLE, GET NEXT BYTE
  581. JR C,C000 ERROR IF TIME OUT
  582. CP DLE IS IT A DLE
  583. JR NZ,E000 END OF BLOCK IF NOT
  584. INC B UPDATE BYTE COUNT
  585.  
  586. D002 EQU *
  587. LD A,B CHECK BYTE COUNT
  588. CP 240
  589. JR NC,C000 SEND NAK IF BLOCK TOO LONG
  590.  
  591. LD (HL),C STORE COMM DATA
  592.  
  593. D003 EQU *
  594. CALL CRCGEN ACCUMULATE CRC
  595. INC HL INCREMENT STORE POINTER
  596. INC B INCREMENT BYTE COUNTERS
  597. LD A,(SAVE)
  598. INC A
  599. LD (SAVE),A
  600. JR D001 LOOP
  601.  
  602. * /--- BLOCK E000 00 000 82/04/28 13.51
  603. * END OF BLOCK. DLE-XXX DETECTED.
  604. E000 CP ETB IS CHAR AN ETB
  605. JR Z,E001 JUMP IF YES
  606. CP ETX IS CHAR AN ETX
  607. JR Z,E000A JUMP IF YES
  608. CP STX IS CHAR AN STX
  609. JP Z,S210 NEW BLOCK IF YES
  610. JP C000 OTHERWISE SEND NAK MESSAGE
  611.  
  612. E000A LD A,01 HAVE ETX, SET ETX FLAG
  613. LD (FLAGREG),A
  614.  
  615. E001 CALL CRCGEN ACCUMULATE CRC
  616.  
  617. * PROCESS FIRST CRC CHARACTER (STATE 6)
  618. CALL INDATA GET NEXT CHAR
  619. LD HL,CRC1 CHECK CHAR AGAINST CRC
  620. CP (HL)
  621. JP NZ,C000 SEND NAK IF BAD
  622.  
  623. * PROCESS SECOND CRC CHARACTER (STATE 7)
  624. CALL INDATA GET NEXT CHAR
  625. LD HL,CRC2 CHECK CHAR AGAINST CRC
  626. CP (HL)
  627. JP NZ,C000 SEND NAK IF BAD
  628.  
  629. LD A,(ABORT) SEND NAK IF ABORT FLAG IS
  630. OR A STILL ON FROM HEADER
  631. JP NZ,C000
  632.  
  633. * /--- BLOCK E000 00 000 82/05/26 07.59
  634. * GOOD BLOCK RECEIVED
  635. LD HL,(FWASAVE)
  636. LD A,(SAVE)
  637. LD E,A
  638. LD D,00
  639. ADD HL,DE
  640. LD (FWASAVE),HL
  641.  
  642. LD HL,ADR3 IN A2,A3
  643. ADD A,(HL)
  644. LD (HL),A
  645. LD E,A
  646.  
  647. JR NC,E002
  648. DEC HL
  649. INC (HL)
  650.  
  651. LD A,(HL)
  652. AND 0F8H TEST FOR LOAD ABOVE 800 HEX
  653. JR Z,E002
  654.  
  655. LD A,(SAVADR)
  656. OR A TEST IF SET ALREADY
  657. JR NZ,E002
  658.  
  659. LD D,(HL) GET ADDRESS IF OVER 800 HEX
  660. LD HL,(FWASAVE)
  661. LD (SAVADR),HL SAVE TOP ADDRESS FOR LATER
  662. LD (FWASAVE),DE
  663.  
  664. E002 EQU *
  665. LD HL,SEQ2 UPDATE BLOCK SEQUENCE NUMBER
  666. LD A,01
  667. ADD A,(HL)
  668. LD (HL),A
  669. JR NC,E004
  670.  
  671. DEC HL
  672. INC (HL)
  673.  
  674. E004 EQU *
  675. LD A,(FLAGREG) CHECK ETX FLAG.
  676. OR A
  677. JP Z,S201 NEXT BLOCK IF NOT ETX
  678.  
  679. * DLE-ETX RECEIVED.
  680. LD C,2 SET RETRY COUNTER
  681.  
  682. * SEND DLE-EOT MESSAGE.
  683. E006 LD HL,DLEEOT
  684. LD B,2
  685. E007 CALL OUTDATA
  686. JP NC,TERLD TERMINATE IF ERROR
  687. INC HL
  688. DJNZ E007 LOOP UNTIL BOTH CHARS SENT
  689.  
  690. LD A,120 START 30 SECOND TIMER
  691. LD (TIMER1),A
  692.  
  693. * /--- BLOCK G000 00 000 82/04/30 11.00
  694.  
  695. * WAIT FOR PRE-SIGN-ON SLASH (STATE 8)
  696. G000 EQU *
  697. CALL INDATA GET NEXT CHARACTER
  698. CP SLASH
  699. JR NZ,G001 WAIT FOR SLASH
  700.  
  701. OR A CLEAR CARRY
  702. RET AND EXIT (DONE WITH LOAD)
  703.  
  704. * / TIMEOUT
  705. G001 EQU *
  706. XOR A
  707. OR C TEST RESEND COUNT
  708. JR Z,G000
  709. DEC C
  710. JR E006 SEND DLE-EOT AGAIN
  711. TITLE LOAD REQUEST
  712.  
  713. * CALLABLE ROUTINE TO OUTPUT L,N,N,CR MESSAGE (LOAD REQUEST)
  714.  
  715. LOADREQ EQU *
  716. CALL D.LDFILE -LOADING FILE XX-
  717. LD HL,LNN+1 CONVERT UPPER HEX DIG TO ASCII
  718. LD A,(M.LDFILE)
  719. LD C,A
  720. RLCA
  721. RLCA
  722. RLCA
  723. RLCA
  724. CALL HEXASC
  725. LD A,C CONVERT LOWER HEX DIG TO ASCII
  726. CALL HEXASC
  727. LD HL,LNN OUTPUT THE MESSAGE
  728. LD B,4
  729. LOADREQ1 CALL OUTDATA
  730. RET NC EXIT IF ERROR
  731. INC HL
  732. DJNZ LOADREQ1 LOOP UNTIL DONE
  733. RET
  734. SPACE 4
  735. * CALLABLE ROUTINE TO CONVERT LOWER HEX DIGIT IN A-REG
  736. * TO ASCII IN (HL) AND THEN INCREMENT HL.
  737. HEXASC EQU *
  738. AND 0FH GET HEX DIGIT
  739. ADD A,90H CONVERT TO ASCII
  740. DAA
  741. ADC A,40H
  742. DAA
  743. JP PE,HEXASC1 SET EVEN PARITY
  744. XOR 80H
  745. HEXASC1 LD (HL),A STORE THE CHAR
  746. INC HL INCREMENT ADDRESS POINTER
  747. RET
  748. * /--- BLOCK INDATA 00 000 82/05/24 14.45
  749. TITLE INPUT DATA
  750. * CALLABLE ROUTINE TO INPUT COMMUNICATIONS DATA.
  751. * DATA INPUT IS REGULATED BY COMM. STATUS.
  752. * ON ENTRY, TIMER VALUES CAN BE IN EITHER (TIMER1) OR
  753. * (TIMER2) OR BOTH. VALUES IN (TIMER1) AND (TIMER2) ARE
  754. * IN MULTIPLES OF 250 MILLISECONDS. THE ROUTINE COUNTS
  755. * A TIMER IF ITS VALUE IS NONZERO ON ENTRY. OTHERWISE THE
  756. * TIMER IS CONSIDERED TO BE STOPPED. IF A TIMER GOES TO
  757. * ZERO, THE APPROPRIATE TIMEOUT EXIT IS TAKEN.
  758. * IF NO TIMEOUT OCCURS WHILE WAITING FOR A CHARACTER,
  759. * THE ROUTINE INPUTS THE CHARACTER TO THE A-REGISTER AND
  760. * LOCATION (CHAR). UPON NORMAL EXIT, INPUT CHARACTER IS
  761. * IN REGISTERS A AND C.
  762.  
  763. INDATA EQU *
  764. PUSH HL
  765. PUSH BC
  766.  
  767. INDATA1 EQU *
  768. LD HL,(CLOCK) ADVANCE THE CLOCK
  769. LD A,L
  770. OR H
  771. DEC HL
  772. LD (CLOCK),HL
  773. JR NZ,INDATA2
  774.  
  775. LD HL,6600 RESET CLOCK
  776. LD (CLOCK),HL
  777.  
  778. LD HL,TIMER1 COUNT TIMER IF RUNNING
  779. DEC (HL)
  780. JR Z,INDATA3 JUMP IF TIMED OUT
  781.  
  782. INDATA2 EQU *
  783. IN A,(SERSTAT) CHECK STATUS
  784. LD B,A
  785. BIT 2,B TEST FOR CRDY
  786. JR Z,INDATA1 LOOP FOR CHARACTER READY
  787.  
  788. IN A,(SERDATI) GET CHAR
  789.  
  790. BIT 3,B TEST FOR DATA ERROR
  791. JR NZ,INDATA3
  792.  
  793. POP BC
  794. POP HL
  795. LD C,A SAVE CHARACTER
  796. RET
  797.  
  798. INDATA3 EQU *
  799. POP BC
  800. POP HL
  801. SCF
  802. RET
  803. * /--- BLOCK OUTDATA 00 000 82/05/25 13.25
  804. TITLE OUTPUT DATA
  805. * CALLABLE ROUTINE TO OUTPUT COMMUNICATIONS DATA.
  806. * OUTPUT IS REGULATED BY COMM. STATUS.
  807. * ON ENTRY HL POINTS TO THE CHAR IN MEMORY TO BE TRANSMITTED
  808. * ON EXIT CARRY FLAG INDICATES DATA TRANSMITTED.
  809.  
  810. OUTDATA EQU *
  811. LD DE,20000 PRESET TIMER FOR 400 MSECS.
  812. OUT1 EQU *
  813. DEC DE DECREMENT TIMER COUNT
  814. LD A,D
  815. OR E (CLEARS CARRY)
  816. RET Z EXIT IF TIMER EXPIRED
  817.  
  818. IN A,(SERSTAT) CHECK STATUS
  819. BIT 5,A
  820. JR Z,OUT1 LOOP IF NO CTS
  821.  
  822. OUT2 EQU *
  823. BIT 1,A
  824. JR Z,OUT1 LOOP IF NO CHAR REQUEST
  825.  
  826. LD A,(HL) GET DATA
  827. OR A TEST PARITY
  828. JP PE,OUT3
  829. SET 7,A
  830.  
  831. OUT3 EQU *
  832. OUT (SERDATO),A OUTPUT DATA
  833. SCF SET DATA TRANSMITTED FLAG
  834. RET
  835. * /--- BLOCK CRCGEN 00 000 82/04/28 09.52
  836. TITLE CRC GENERATOR
  837. * CRC GENERATOR CALLABLE ROUTINE
  838. * POLYNOMIAL DIVISOR IS X**16+X**15+X**2+1
  839. * CRC REMAINDER IN (CRC1),(CRC2) IS UPDATED
  840. * DATA CHAR IS IN (CHAR) ON ENTRY
  841. * B REG AND HL REG ARE NOT CHANGED.
  842. CRCGEN LD A,(CRC1)
  843. XOR C
  844. LD C,A
  845. RRA
  846. AND 7FH
  847. XOR C
  848. LD C,A
  849. RRA
  850. RRA
  851. XOR C
  852. LD D,A
  853. RRA
  854. RRA
  855. RRA
  856. RRA
  857. XOR D
  858. AND 03H
  859. LD D,A
  860. LD A,C
  861. RLCA
  862. RLCA
  863. LD E,A
  864. AND 0FCH
  865. OR D
  866. LD D,A
  867. LD A,E
  868. RLCA
  869. AND 06H
  870. LD E,A
  871. LD A,D
  872. RRA
  873. LD A,E
  874. RRA
  875. LD C,A
  876. LD A,(CRC2)
  877. XOR C
  878. LD (CRC1),A
  879. LD A,D
  880. LD (CRC2),A
  881. RET
  882. * /--- BLOCK GETLFN 00 000 82/04/30 08.23
  883. TITLE GET LOAD FILE NUMBER
  884. * CALLABLE ROUTINE TO GET LOAD FILE NUMBER IN A-REGISTER
  885. * FROM KEYBOARD. OPERATOR ENTERS ONE OR TWO HEX DIGITS
  886. * FOLLOWED BY -NEXT- TO SELECT THE LOAD FILE. IF AN ERROR
  887. * IS MADE THE ENTRY CAN BE CLEARED BY PRESSING -ERASE-.
  888. * IF NO FILE NUMBER IS ENTERED BEFORE PRESSING -NEXT-, THE
  889. * ROUTINE WILL SET A=0FFH TO INDICATE NO ENTRY WAS DONE.
  890. * LOAD FILE NUMBERS ARE LIMITED TO 01-FF HEX.
  891. *
  892. *
  893. GETLFN EQU *
  894. CALL D.SELLDF DISPLAY -SELECT LOAD FILE -
  895. LD BC,0300H SET CTR=3, CLEAR LOAD FILE NO.
  896. GETLFN1 EQU *
  897. IN A,(SYSSTAT) WAIT FOR KB DATA READY
  898. BIT 3,A
  899. JR Z,GETLFN1
  900. IN A,(KBDATA) GET KB KEY
  901. AND 5FH IGNORE CTRL AND SHIFT
  902. CP 16H
  903. JR Z,GETLFN4 DONE IF -NEXT- KEY
  904. CP 13H
  905. JR Z,GETLFN START OVER IF -ERASE- KEY
  906. CP 10
  907. JR C,GETLFN2 JUMP IF 00-09 (OK)
  908. SUB 41H
  909. JR C,GETLFN1 IGNORE IF 0A-40
  910. CP 6
  911. JR NC,GETLFN1 IGNORE IF 47-5F
  912. ADD A,10 41-46 IS OK (A-F)
  913.  
  914. GETLFN2 EQU * HAVE A VALID HEX DIGIT
  915. DJNZ GETLFN3
  916. INC B SET CTR BACK TO 1
  917. JR GETLFN1 IGNORE EXTRA DIGITS OVER TWO
  918.  
  919. GETLFN3 EQU *
  920. LD H,A INSERT NEW DIGIT INTO
  921. LD A,C LOAD FILE NUMBER
  922. ADD A,A
  923. ADD A,A
  924. ADD A,A
  925. ADD A,A
  926. OR H
  927. LD C,A
  928. LD A,H
  929. PUSH BC
  930. CALL D.DIG DISPLAY DIGIT AT (DE)
  931. POP BC
  932. JR GETLFN1
  933.  
  934. * /--- BLOCK GETLFN 00 000 82/04/30 09.06
  935. * PROCESS -NEXT- KEY
  936. *
  937. GETLFN4 EQU *
  938. LD A,B CHECK FOR DEFAULT FILE
  939. CP 3
  940. JR Z,GETLFN5
  941. LD A,C PUT LOAD FILE NO. INTO A-REG.
  942. RET
  943.  
  944. GETLFN5 EQU *
  945. LD A,01 FLAG AS DEFAULT FILE
  946. RET
  947.  
  948.  
  949.  
  950. TITLE PRESET HOST MESSAGES
  951. * THE FOLLOWING LOCATIONS ARE PRESET MESSAGES
  952. * AND MUST BE IN THE ORDER SHOWN.
  953.  
  954. LNN EQU 3325H
  955. DLEEOT EQU 3329H
  956. NAKXY EQU 332BH
  957.  
  958. VARBEG EQU *
  959. HEX CC,00,00,8D LOAD REQUEST MESSAGE
  960. HEX 90,84 DLE EOT MESSAGE
  961. HEX 95,00,00,00,00 NAK MESSAGE
  962. VAREND EQU *
  963.  
  964.  
  965. * BACKOUT MESSAGE TO PLATO
  966.  
  967. BACKMSG EQU *
  968. HEX 1B,FF,CF BACKOUT MESSAGE FOR PLATO
  969.  
  970. * THIS ROUTINE IS MOVED TO RAM AND MOVES THE
  971. * RESIDENT INTO THE ROM AREA AFTER THE LOAD IS
  972. * COMPLETED.
  973.  
  974. MOVE EQU *
  975. LD A,(LITES)
  976. SET 7,A SELECT RAM MEMORY
  977. OUT (PNLLTS),A
  978. LD DE,SADDR GET ADDRESS OF SAVE AREA
  979. LD HL,(SAVADR)
  980. SBC HL,DE GET LENGTH OF DATA TO MOVE
  981. LD C,L
  982. LD B,H
  983. EX DE,HL
  984. LD DE,R.INIT
  985. LDIR MOVE RESIDENT
  986. LD HL,R.INIT
  987. LD DE,0050H
  988. ADD HL,DE POINT TO HOST LOAD ADDRESS
  989. LD E,(HL)
  990. INC HL
  991. LD D,(HL) GET ENTRY POINT ADDRESS
  992. EX DE,HL
  993. LD C,00 LOAD SUBTYPE FOR IST2
  994. LD A,(M.LDFILE)
  995. LD B,A LOAD LOAD FILE NUMBER
  996. JP (HL) EXIT HOST LOAD
  997. ENDMV EQU *
  998. * /--- BLOCK LDRMSG 00 000 82/04/30 09.20
  999. TITLE LOADER MESSAGE DISPLAY
  1000. * * * * * * * * * * * * * * * * * * * *
  1001. *
  1002. * LOADER DISPLAY ROUTINES
  1003. *
  1004. * * * * * * * * * * * * * * * * * * * *
  1005. D.NOCARR EQU *
  1006. LD HL,W.HOST DISPLAY -HOST -
  1007. JR D.P
  1008.  
  1009. D.SELLDF EQU *
  1010. LD DE,0ABF8H POINT TO DISPLAY AREA
  1011. LD HL,W.SELECT DISPLAY -SELECT LOAD -
  1012. JR D.P1
  1013.  
  1014. D.LFAIL EQU *
  1015. LD HL,W.FAILUR DISPLAY -FAILURE-
  1016.  
  1017. D.P EQU *
  1018. LD DE,0ADF8H POINT TO DISPLAY AREA
  1019. D.P1 EQU *
  1020. CALL D.CLEAR CLEAR THE SCREEN
  1021.  
  1022. DISPLAY EQU *
  1023. LD A,(HL) GET CHARACTER CODE
  1024. OR A
  1025. RET Z DONE IF CODE = 00
  1026. PUSH HL
  1027. CALL DISP DISPLAY THE CHARACTER
  1028. POP HL
  1029. INC HL
  1030. JR DISPLAY
  1031.  
  1032. D.LDBLK EQU *
  1033. LD DE,0C5F8H SET DISPLAY ADDRESS
  1034. LD HL,W.BLOCK DISPLAY - BLOCK -
  1035. CALL DISPLAY
  1036.  
  1037. LD A,(SEQ2)
  1038. JR D.TWODIG
  1039.  
  1040. D.LDFILE EQU *
  1041. LD DE,0A7F8H POINT TO DISPLAY AREA
  1042. CALL D.CLEAR CLEAR THE SCREEN
  1043. LD HL,W.LOADIN DISPLAY -LOADING -
  1044. CALL DISPLAY
  1045.  
  1046. LD A,(SEQ2+1)
  1047.  
  1048. * /--- BLOCK LDRMSG 00 000 82/04/13 15.05
  1049. D.TWODIG EQU *
  1050. PUSH AF DISPLAY 2 HEX DIGITS IN A-REG
  1051. RLCA UPPER DIGIT
  1052. RLCA
  1053. RLCA
  1054. RLCA
  1055. CALL D.DIG
  1056. POP AF LOWER DIGIT
  1057.  
  1058. D.DIG EQU *
  1059. AND 0FH GET HEX DIGIT
  1060. LD C,A GET DIGIT*7 IN A-REG
  1061. ADD A,A
  1062. ADD A,A
  1063. ADD A,A
  1064. SUB C
  1065.  
  1066. DISP EQU *
  1067. LD HL,CHARBASE INDEX TO FIND CHAR DATA
  1068. ADD A,L
  1069. LD L,A
  1070. JR NC,DISP1
  1071. INC H
  1072.  
  1073. DISP1 LD BC,7
  1074. INC D MOVE ONE CHAR POSITION RIGHT
  1075. INC D
  1076. EX DE,HL
  1077. OR A CLEAR CARRY
  1078. SBC HL,BC
  1079. EX DE,HL
  1080. LDIR DISPLAY THE CHARACTER
  1081. RET
  1082.  
  1083. D.CLEAR EQU *
  1084. LD A,06H BULK ERASE
  1085. OUT (BLKERS),A
  1086. D.CLEAR1 IN A,(SYSSTAT) WAIT UNTIL COMPLETED
  1087. BIT 7,A
  1088. JR NZ,D.CLEAR1
  1089. RET
  1090.  
  1091. * /--- BLOCK LDRMSG 00 000 82/04/30 08.06
  1092. W.BLOCK HEX BD,4D,8C,9A,54,85,BD,00
  1093.  
  1094. W.FAILUR HEX 8C,9A,46,5B,7E,93,70,BD LOADING
  1095. HEX 69,46,7E,8C,B6,A1,62,00 FAILURE
  1096.  
  1097. W.LOADIN HEX 8C,9A,46,5B,7E,93,70,BD LOADING
  1098. HEX 69,7E,8C,62,BD,00 FILE
  1099.  
  1100. W.HOST HEX 77,9A,A8,AF,BD HOST
  1101. HEX 93,9A,AF,BD NOT
  1102. HEX 54,9A,93,93,62,54,AF,62,5B,00 CONNECTED
  1103.  
  1104. W.SELECT HEX A8,62,8C,62,54,AF,BD SELECT
  1105. HEX 8C,9A,46,5B,BD LOAD
  1106. HEX 69,7E,8C,62,BD,00 FILE
  1107.  
  1108. CHARBASE EQU *
  1109. HEX 0E,11,19,15,13,11,0E 00 0
  1110. HEX 04,06,04,04,04,04,0E 07 1
  1111. HEX 0E,11,10,08,04,02,1F 0E 2
  1112. HEX 0E,11,10,0C,10,11,0E 15 3
  1113. HEX 09,09,09,1F,08,08,08 1C 4
  1114. HEX 1F,01,01,0F,10,11,0E 23 5
  1115. HEX 0E,11,01,0F,11,11,0E 2A 6
  1116. HEX 1F,10,08,08,04,04,04 31 7
  1117. HEX 0E,11,11,0E,11,11,0E 38 8
  1118. HEX 0E,11,11,1E,10,08,06 3F 9
  1119. HEX 04,0A,11,1F,11,11,11 46 A
  1120. HEX 0F,11,11,0F,11,11,0F 4D B
  1121. HEX 0E,11,01,01,01,11,0E 54 C
  1122. HEX 0F,11,11,11,11,11,0F 5B D
  1123. HEX 1F,01,01,0F,01,01,1F 62 E
  1124. HEX 1F,01,01,0F,01,01,01 69 F
  1125. HEX 0E,11,01,01,19,11,0E 70 G
  1126. HEX 11,11,11,1F,11,11,11 77 H
  1127. HEX 0E,04,04,04,04,04,0E 7E I
  1128. HEX 11,09,05,03,05,09,11 85 K
  1129. HEX 01,01,01,01,01,01,1F 8C L
  1130. HEX 11,13,15,15,15,19,11 93 N
  1131. HEX 0E,11,11,11,11,11,0E 9A O
  1132. HEX 0F,11,11,0F,05,09,11 A1 R
  1133. HEX 0E,11,01,0E,10,11,0E A8 S
  1134. HEX 1F,04,04,04,04,04,04 AF T
  1135. HEX 11,11,11,11,11,11,0E B6 U
  1136. HEX 00,00,00,00,00,00,00 BD SPACE
  1137. * /--- BLOCK DISKLD 00 000 82/04/22 14.30
  1138. TITLE DISK LOADER
  1139. * * * * * * * * * * * * * * * * * *
  1140. *
  1141. * FLOPPY DISK LOADER
  1142. *
  1143. * LOAD FORMAT.
  1144. * FIRST DATA ADDRESS (2 BYTES, LSB FIRST)
  1145. * DATA LENGTH IN BYTES (2 BYTES, LSB FIRST)
  1146. * DATA
  1147. * CHECKSUM (2 BYTES)
  1148. *
  1149. * CHECKSUM ALGORITHM.
  1150. * START WITH HL=0
  1151. * FOR EACH DATA BYTE,
  1152. * H = (H .XOR. DATA) CLS 1
  1153. * L = (L .XOR. DATA) CRS 1
  1154. * CHECK FOR FIRST CHECKSUM BYTE = L
  1155. * CHECK FOR SECOND CHECKSUM BYTE = H
  1156. *
  1157. * AFTER SUCCESSFUL LOAD, CONTROL IS TRANSFERRED
  1158. * TO FIRST DATA ADDRESS.
  1159. *
  1160. * * * * * * * * * * * * * * * * * *
  1161.  
  1162. DISKLOAD EQU *
  1163. CALL D.CLEAR CLEAR THE SCREEN
  1164.  
  1165. CALL FDWAIT
  1166. IN A,(FDSTAT)
  1167. XOR 40H CHECK IF FDC IS LOADED
  1168. JR Z,WLOOPD JUMP IF OK
  1169.  
  1170. CALL FDWAIT WAIT AND THEN TRY AGAIN
  1171. IN A,(FDSTAT)
  1172. XOR 40H
  1173. SCF
  1174. RET NZ RETURN IF DISK LOAD FAILED.
  1175.  
  1176. * /--- BLOCK DISKLD 00 000 82/05/27 07.18
  1177. WLOOPD LD B,40H
  1178. LD A,0EH
  1179. OUT (FDCMND),A OUTPUT COMMAND
  1180. WLOOPA DEC B
  1181. JR Z,DISKFAIL
  1182. CALL FDWAIT
  1183. IN A,(FDSTAT)
  1184. XOR 48H
  1185. JR NZ,WLOOPA
  1186.  
  1187. LD A,0F1H
  1188. OUT (FDCMND),A OUTPUT INVERSE COMMAND
  1189. LD B,40H
  1190. WLOOPC DEC B
  1191. JR Z,DISKFAIL
  1192. CALL FDWAIT
  1193. IN A,(FDSTAT)
  1194. XOR 4AH
  1195. JR NZ,WLOOPC
  1196. *
  1197. IN A,(FDDATA) ADDRESS
  1198. LD E,A
  1199. IN A,(FDDATA)
  1200. LD D,A
  1201. LD (FWASAVE),DE
  1202. IN A,(FDDATA) LENGTH
  1203. LD C,A
  1204. IN A,(FDDATA)
  1205. LD B,A
  1206. LD HL,00
  1207. WLOOPB IN A,(FDDATA) INPUT DATA
  1208. LD (DE),A AND STORE IT
  1209. XOR H UPDATE BLOCK CHECK IN HL
  1210. RLCA
  1211. LD H,A
  1212. LD A,(DE)
  1213. XOR L
  1214. RRCA
  1215. LD L,A
  1216. INC DE UPDATE COUNTERS
  1217. DEC BC
  1218. LD A,B
  1219. OR C
  1220. JR NZ,WLOOPB
  1221. IN A,(FDDATA) SEE IF BLOCK CHECK IS OK
  1222. XOR L
  1223. JR NZ,DISKFAIL
  1224. IN A,(FDDATA)
  1225. XOR H
  1226. JR NZ,DISKFAIL
  1227.  
  1228. LD A,3CH SET CODE LOADED FLAG
  1229. LD (LOADFLAG),A
  1230. LD BC,8000H PUT IST2 ASCII SUBTYPE IN BC.
  1231. LD HL,(FWASAVE)
  1232. JP (HL) GO TO LOADED PROGRAM
  1233.  
  1234. DISKFAIL EQU *
  1235. SCF
  1236. RET
  1237.  
  1238. * WAIT ROUTINE FOR FLOPPY DISK
  1239. FDWAIT LD HL,1000H
  1240. FDWAIT1 DEC HL
  1241. LD A,H
  1242. OR L
  1243. JR NZ,FDWAIT1
  1244. RET
  1245. * /--- BLOCK DIAG 00 000 82/04/29 09.36
  1246. TITLE DIAGNOSTIC TESTS
  1247. * * * * * * * * * * * * * * * * * * *
  1248. *
  1249. * 'DIAGNOSTICS TEST - 'SECTION 1
  1250. *
  1251. * 'THIS SECTION WRITES AND READS 55 HEX THROUGHOUT
  1252. * 'R'A'M 'MEMORY. 'PANEL 'LIGHTS WILL 'DISPLAY CODE 01 HEX
  1253. * WHILE RUNNING.
  1254. *
  1255. * 'THE ALARM WILL SOUND IF AN ERROR IS DETECTED AND
  1256. * WILL SOUND UNTIL ANY KEYBOARD KEY IS DEPRESSED
  1257. * AT WHICH TIME THE ALARM STOPS AND THE ERROR CODE
  1258. * IS DISPLAYED.. 'THE MICROPROCESSOR IS NOW HALTED
  1259. * AND ONLY THE RESET SWITCH CAN RESTART THE TERMINAL.
  1260. *
  1261. * 'THE VALUE OF THE 'L'E'D INDICATORS ARE
  1262. * 'D'T'R = 2**5 (10 0000)
  1263. * 'D'S'R = 2**4 (01 0000)
  1264. * 'R'T'S = 2**3 (00 1000)
  1265. * 'R'C'V = 2**2 (00 0100)
  1266. * 'X'M'T = 2**1 (00 0010)
  1267. * 'E'R'R = 2**0 (00 0001)
  1268. *
  1269. * 'THE MEANING OF THE ERROR CODES ARE
  1270. * 'FIRST HEX 'BYTE = 0 'MEMORY 'ADDRESS 0000 - 3FFF
  1271. * 1 'MEMORY 'ADDRESS 4000 - 7FFF
  1272. * 2 'MEMORY 'ADDRESS 8000 - BFFF
  1273. * 3 'MEMORY 'ADDRESS C000 - FFFF
  1274. * 'SECOND 'BYTE = 1 'DATA 'BIT 0
  1275. * 2 'DATA 'BIT 1
  1276. * 3 'DATA 'BIT 2
  1277. * 4 'DATA 'BIT 3
  1278. * 5 'DATA 'BIT 4
  1279. * 6 'DATA 'BIT 5
  1280. * 7 'DATA 'BIT 6
  1281. * 8 'DATA 'BIT 7
  1282. *
  1283. * * * * * * * * * * * * * * * * * * * *
  1284.  
  1285. DEFS 05B3H+BEGIN-*
  1286.  
  1287. * /--- BLOCK DIAG 00 000 82/04/09 14.17
  1288. DIAG EQU *
  1289. LD A,3EH
  1290. OUT (PNLLTS),A DISPLAY CODE 01
  1291. LD A,55H ENTER DATA TO WRITE
  1292. LD IX,DIAG01 SAVE RETURN ADDRESS
  1293. JP DWR1 GO TO WRITE ROUTINE
  1294. *
  1295. DIAG01 EQU *
  1296. LD HL,0FFFFH LOAD HIGHEST ADDRESS
  1297. LD DE,7FFEH LOAD BLOCK LENGTH
  1298. LD C,55H LOAD EXPECTED DATA
  1299. LD IX,DIAG02 SAVE RETURN ADDRESS
  1300. JP DREAD1 GO TO READ ROUTINE
  1301. * * * * * * * * * * * * * * * * *@ *
  1302. *
  1303. * 'DIAGNOSTICS 'TEST - 'SECTION 2
  1304. *
  1305. * 'THIS SECTION WRITES AND READS 'A'A HEX THROUGHTOUT
  1306. * MEMORY. 'PANEL 'LIGHTS WILL DISPLAY CODE 02 HEX WHILE
  1307. * RUNNING. 'ERROR STOPS SAME AS SECTION 1
  1308. *
  1309. * * * * * * * * * * * * * * * * * * *
  1310. DIAG02 EQU *
  1311. LD A,3DH
  1312. OUT (PNLLTS),A OUTPUT CODE 02
  1313. LD HL,8000H
  1314. LD A,0AAH
  1315. LD IX,DIAG0201 SAVE RETURN ADDRESS
  1316. JP DWR1
  1317. *
  1318. DIAG0201 EQU *
  1319. LD HL,0FFFFH LOAD HIGHEST ADDRESS
  1320. LD DE,7FFEH BLOCK LENGTH
  1321. LD C,0AAH EXPECTED DATA
  1322. LD IX,DIAG03 SAVE RETURN ADDRESS
  1323. JP DREAD1 GO TO READ ROUTINE
  1324. * * * * * * * * * * * * * * * * * * *
  1325. *
  1326. * 'DIAGNOSTICS 'TEST - 'SECTION 3
  1327. *
  1328. *
  1329. * * * * * * * * * * * * * * * * * * * *
  1330. * /--- BLOCK DIAG 00 000 82/04/13 13.32
  1331. DIAG03 EQU *
  1332. LD A,3CH
  1333. OUT (PNLLTS),A OUTPUT CODE 03
  1334. LD DE,8001H
  1335. LD C,00H
  1336. LD A,06H
  1337. OUT (BLKERS),A BULK ERASE
  1338. *
  1339. JP DIAG04
  1340. *
  1341. DWR1 EQU *
  1342. LD HL,0FFFFH SET HL TO HIGHEST ADDRESS
  1343. LD DE,0FFFEH SET DE TO HL MINUS ONE
  1344. LD BC,0F700H SET COUNTER
  1345. LD (HL),A STORE DATA
  1346. LDDR MOVE DATA TO ALL LOCATIONS
  1347. LD A,(0FFFFH)
  1348. LD HL,3FFFH SET HL TO HIGHEST ADDRESS
  1349. LD DE,3FFEH SET DE TO HL MINUS ONE
  1350. LD BC,3700H SET COUNTER
  1351. LD (HL),A STORE DATA
  1352. LDDR MOVE DATA TO ALL LOCATIONS
  1353. JP (IX) RETURN
  1354. *
  1355. DREAD1 EQU *
  1356. LD A,(HL) LOAD DATA
  1357. LD B,A SAVE ACTUAL DATA IN B REG
  1358. XOR C COMPARE WITH EXPECTED
  1359. JP Z,DREAD2 CONTINUE
  1360. JR DERROR
  1361. *
  1362. DREAD2 EQU *
  1363. DEC HL
  1364. DEC DE
  1365. LD A,E
  1366. OR D
  1367. JR NZ,DREAD1
  1368. LD A,H
  1369. BIT 7,A
  1370. JR NZ,DREAD3
  1371. JP (IX)
  1372. DREAD3 EQU *
  1373. IN A,(MNTSW)
  1374. BIT 5,A
  1375. JR NZ,DREAD4
  1376. LD HL,3FFFH
  1377. LD DE,3700H
  1378. JR DREAD1
  1379. DREAD4 LD HL,7FFFH
  1380. LD DE,7700H
  1381. JR DREAD1
  1382. *
  1383. DERROR EQU *
  1384. IN A,(KBDATA) CLEAR KEYBOARD
  1385. DERROR1 EQU *
  1386. SET 0,A
  1387. OUT (MISCTL),A SOUND BEEPER
  1388. IN A,(SYSSTAT)
  1389. BIT 3,A TEST FOR KEYBOARD INPUT
  1390. JR Z,DERROR1 WAIT
  1391. *
  1392. LD A,B LOAD BAD DATA
  1393. XOR C SET FAILING BITS
  1394. LD B,37H SET B TO START FORMING NUMBER
  1395. *
  1396. DERROR2 EQU *
  1397. RLA ROTATE DATA
  1398. JR C,DERROR3
  1399. DJNZ DERROR2 DECREASE CHIP NUMBER
  1400. *
  1401. DERROR3 EQU *
  1402. LD A,B MOVE CHIP NUMBER TO A
  1403. BIT 7,H
  1404. JR NZ,DERROR4 REFRESSH MEMORY - ERROR CODE 2X OR 3X
  1405. RES 5,A
  1406. BIT 6,H
  1407. JR NZ,DERROR5 CODE 0X
  1408. RES 4,A
  1409. JR DERROR5
  1410. *
  1411. DERROR4 EQU *
  1412. BIT 1,H TEST FOR UPPPER BANK
  1413. JR NZ,DERROR5 YES - CODE 3X
  1414. RES 4,A LOWER BANK - 2X
  1415.  
  1416. DERROR5 EQU *
  1417. CPL
  1418. * /--- BLOCK DIAG 00 000 73/00/00 00.00
  1419. RES 7,A
  1420. RES 6,A
  1421. OUT (PNLLTS),A OUTPUT CHIP NUMBER
  1422. HALT1 JR HALT1
  1423. * * * * * * * * * * * * * * * * * * *
  1424. *
  1425. * 'D'I'A'G'N'O'S'T'I'C'S 'T'E'S'T - 'SECTION 4
  1426. *
  1427. * 'THIS SECTION CHECKS THE 'P'L'A'T'O SERIAL 'INTERFACE
  1428. *
  1429. * 'PANEL 'DISPLAYS CODE 04 WHILE RUNNING.
  1430. *
  1431. * 'IF AN ERROR IS DETECTED THE ALARM WILL SOUND DISPLAYING
  1432. * THE SECTION NUMBER UNTIL ANY KEYBOARD KSY IS DEPRESSED.
  1433. * 'THE ALARM WILL THEN STOP AND THE ERROR CODE DISPLAYED.
  1434. *
  1435. * 'CODE 01 = 'NO CHARACTER REQUEST STATUS
  1436. * 02 = CHREQ DROPPED AFTER LOWER BITS OUTPUT
  1437. * 03 = CHREQ ACTIVE AFTER UPPER BITS OUTPUT
  1438. * 04 = FIRST BYTE FLAG NOT SET
  1439. * 05 = START BIT NOT RECEIVED
  1440. * 06 = NO CHARACTER READY STATUS
  1441. * 07 = DATA ERROR
  1442. *
  1443. * 'THE PROCESSOR WILL HALT AND THE RESET SWITCH IS THE ONLY
  1444. * WAY TO RESTART THE TERMINAL
  1445. *
  1446. * * * * * * * * * * * * * * * * * * *
  1447. DIAG04 EQU *
  1448. LD A,3BH
  1449. OUT (PNLLTS),A LOOPBACK MODE, DISPLAY 06
  1450. LD IY,DIAG0401 SAVE CONTINUE ADDRESS
  1451. LD DE,3F80H INITIALIZE DATA
  1452. IN A,(CLADATA) CLEAR CHAR READY STATUS
  1453. JP PCR WAIT FOR 'P'L'A'T'O CHARACTER REQUEST
  1454. *
  1455. DIAG0401 EQU *
  1456. LD A,E LOAD LOWER DATA BITS
  1457. OUT (CLAL),A AND OUTPUT
  1458. IN A,(SYSSTAT) INPUT STATUS
  1459. BIT 2,A TEST FOR CHAR REQ STILL ACTIVE
  1460. JR NZ,DIAG0402
  1461. LD A,3DH
  1462. JP LED DISPLAY OUTPUT
  1463. *
  1464. DIAG0402 EQU *
  1465. LD A,D LOAD UPPER BITS
  1466. SET 3,A SET START BIT
  1467. OUT (CLAU),A AND OUTPUT
  1468. IN A,(SYSSTAT)
  1469. BIT 2,A TEST CHARACTER REQ DROPPED
  1470. JR Z,DIAG0403
  1471. LD A,3CH
  1472. JP LED OUTPUT ERROR CODE 03
  1473. *
  1474. DIAG0403 EQU *
  1475. LD HL,DIAG0404
  1476. JP PRCV GO TO 'P'L'A'T'O RECEIVER
  1477. *
  1478. DIAG0404 EQU *
  1479. BIT 7,A TEST FOR FIRST BYTE
  1480. JR NZ,DIAG0405 OK
  1481. LD A,3BH
  1482. JP LED OUTPUT ERROR CODE 04
  1483. *
  1484. DIAG0405 EQU *
  1485. BIT 6,A TEST FOR START BIT
  1486. JR NZ,DIAG0406
  1487. LD A,3AH
  1488. JP LED OUTPUT ERROR CODE 05
  1489. *
  1490. DIAG0406 EQU *
  1491. XOR D COMPARE WITH EXPECTED DATA
  1492. AND 3FH MASK OFF UNWANTED BITS
  1493. JR NZ,DIAG0409 ERROR
  1494. *
  1495. * /--- BLOCK DIAG 00 000 82/04/13 13.33
  1496. LD HL,DIAG0407 SAVE GOOD RETURN ADDRESS
  1497. JP PRCV GET SECOND BYTE
  1498. *
  1499. DIAG0407 EQU *
  1500. RLCA ROTATE DATA
  1501. XOR E COMPARE WITH
  1502. AND 0F8H
  1503. JR NZ,DIAG0409 ERROR
  1504. *
  1505. LD HL,DIAG0408 SAVE GOOD RETURN ADDRESS
  1506. JP PRCV GET THIRD BYTE
  1507. *
  1508. DIAG0408 EQU *
  1509. XOR 00H SET ZERO FLAG
  1510. JR Z,DIAG0410 OK
  1511. *
  1512. DIAG0409 EQU *
  1513. LD A,38H
  1514. JR LED OUTPUT ERROR CODE 07
  1515. *
  1516. DIAG0410 EQU *
  1517. LD A,E
  1518. ADD A,08H
  1519. LD E,A
  1520. JR NC,DIAG0401
  1521. JR DIAG05
  1522. *
  1523. PCR EQU *
  1524. LD HL,0FFFFH LOAD COUNTER
  1525. *
  1526. PCR1 EQU *
  1527. IN A,(SYSSTAT) INPUT STATUS
  1528. BIT 2,A TEST FOR CHARACTER REQUEST
  1529. JR Z,PCR2
  1530. JP (IY) RETURN
  1531. *
  1532. PCR2 EQU *
  1533. DEC HL
  1534. LD A,H
  1535. OR L TEST FOR TIMEOUT
  1536. JR NZ,PCR1 NO
  1537. LD A,3EH LOAD ERROR CODE
  1538. JR LED AND OUTPUT
  1539. *
  1540. PRCV EQU *
  1541. LD BC,0FFFFH LOAD COUNTER
  1542. *
  1543. PRCV1 EQU *
  1544. IN A,(SYSSTAT)
  1545. BIT 0,A TEST FOR CHARACTER READY
  1546. JP NZ,PRCV2 YES
  1547. DEC BC
  1548. LD A,B
  1549. OR C
  1550. JR NZ,PRCV1
  1551. LD A,39H TIME-OUT ERROR
  1552. JR LED OUTPUT CODE
  1553. *
  1554. PRCV2 EQU *
  1555. IN A,(CLADATA) INPUT DATA
  1556. JP (HL) RETURN
  1557. *
  1558. LED EQU *
  1559. LD B,A
  1560. *
  1561. LED1 EQU *
  1562. SET 0,A
  1563. OUT (MISCTL),A SOUND BEEPER
  1564. IN A,(SYSSTAT)
  1565. BIT 3,A TEST FOR KEYBOARD DATA
  1566. JR Z,LED1 WAIT
  1567. *
  1568. LD A,B RESTORE DATA
  1569. OUT (PNLLTS),A
  1570. HALT2 JR HALT2
  1571. * * * * * * * * * * * * * * * * * * * *
  1572. *
  1573. * 'D'I'A'G'N'O'S'T'I'C'S 'T'E'S'T - 'SECTION 5
  1574. *
  1575. *
  1576. * * * * * * * * * * * * * * * * * * *
  1577. DIAG05 EQU *
  1578. LD A,3AH
  1579. OUT (PNLLTS),A LOOPBACK AND CODE 07
  1580. * * * * * * * * * * * * * * * * * * *
  1581. *
  1582. * 'D'I'A'G'N'O'S'T'I'C'S 'T'E'S'T - 'SECTION 6
  1583. *
  1584. * 'THIS SECTION CHECKS THE KEYBOARD, TOUCHPANEL AND
  1585. * DISPLAYS AN ALIGNMENT PATTERN. 'PANEL LIGHTS WILL
  1586. * /--- BLOCK DIAG 00 000 73/00/00 00.00
  1587. * DISPLAY CODE 06 HEX WHILE RUNNING.
  1588. *
  1589. * 'PRESS SHIFT-STOP TO EXIT DIAGNOTICS PROGRAM.
  1590. *
  1591. * * * * * * * * * * * * * * * * * * * *
  1592. DIAG06 EQU *
  1593. LD A,39H
  1594. OUT (PNLLTS),A DISPLAY SECTION 8
  1595. IN A,(MNTSW)
  1596. BIT 1,A TEST FOR KEYBOARD/TOUCHPANEL
  1597. JP Z,DIAG07
  1598. LD A,06H
  1599. OUT (BLKERS),A DO BULK ERASE
  1600. *
  1601. DIAG0601 EQU *
  1602. IN A,(SYSSTAT)
  1603. BIT 7,A
  1604. JR NZ,DIAG0601 WAIT FOR BULK COMPLETED
  1605. LD HL,8000H
  1606. LD DE,8001H
  1607. LD BC,01FFH
  1608. LD A,01H
  1609. LD (HL),A
  1610. LDIR WRITE BOTTOM LINE
  1611. *
  1612. LD HL,8000H
  1613. LD A,0FFH
  1614. *
  1615. DIAG0602 EQU *
  1616. LD (HL),A
  1617. INC H
  1618. DEC L
  1619. LD (HL),A
  1620. INC HL
  1621. BIT 7,H
  1622. JR NZ,DIAG0602 WRITE LEFT AND RIGHT BOUNDARIES
  1623. *
  1624. LD HL,0FFFEH
  1625. LD DE,0FFFDH
  1626. LD BC,01FDH
  1627. LD A,80H
  1628. LD (HL),A
  1629. LDDR WRITE TOP LINE
  1630. *
  1631. LD HL,8001H
  1632. LD DE,81FEH
  1633. LD C,02H
  1634. DIAG0603 EQU *
  1635. LD A,C LOAD MASK
  1636. OR (HL)
  1637. LD (HL),A STORE FIRST QUADRANT POINT
  1638. LD (DE),A STORE THIRD QUADRANT POINT
  1639. INC HL
  1640. DEC DE
  1641. RLC C
  1642. JR NC,DIAG0603
  1643. INC H
  1644. INC H
  1645. INC D
  1646. INC D
  1647. BIT 7,H
  1648. JR NZ,DIAG0603
  1649. *
  1650. IN A,(KBDATA) CLEAR KEYBOARD
  1651. IN A,(TPDATA) CLEAR TOUCHPANEL
  1652. *
  1653. DIAG0604 EQU *
  1654. IN A,(SYSSTAT)
  1655. BIT 3,A TEST FOR KYBD READY
  1656. JR NZ,DIAG0605 YES - PROCESS
  1657. BIT 4,A TEST TOUCHPANEL READY
  1658. JR Z,DIAG0604 NO - CHECK AGAIN
  1659. * * * * * * * * * * * * * * * * * *
  1660. *
  1661. * 'TOUCHPANEL 'PROCESSOR
  1662. *
  1663. * * * * * * * * * * * * * * * * * * *
  1664. IN A,(TPDATA) INPUT DATA
  1665. * RLCA ROTATE A
  1666. RRCA
  1667. RRCA
  1668. RRCA
  1669. XOR 0E1H
  1670. LD B,A SAVE DATA
  1671. AND 0E0H SAVE UPPER BITS
  1672. LD L,A LOWER BITS OF HL
  1673. LD A,B GET ROTATED DATA
  1674. AND 01H SAVE LOWER BIT
  1675. LD C,A SAVE X8
  1676. * /--- BLOCK DIAG 00 000 82/04/13 13.34
  1677. LD A,B ROTATED DATA
  1678. RLCA ROTATE TWICE TO
  1679. RLCA ADJUST UPPER BITS
  1680. AND 78H SAVE Y BITS
  1681. OR C ADD X8
  1682. SET 7,A
  1683. LD H,A UPPER BITS OF HL
  1684. LD D,02H SET PASS COUNTER
  1685. *
  1686. DIAG0610 EQU *
  1687. LD B,20H SET WORD COUNTER
  1688. *
  1689. DIAG0611 EQU *
  1690. LD A,(HL)
  1691. XOR 0FFH
  1692. LD (HL),A
  1693. INC HL
  1694. DJNZ DIAG0611
  1695. LD B,20H
  1696. INC H
  1697. INC H
  1698. *
  1699. DIAG0612 EQU *
  1700. DEC HL
  1701. LD A,(HL)
  1702. XOR 0FFH
  1703. LD (HL),A
  1704. DJNZ DIAG0612
  1705. INC H
  1706. INC H
  1707. DEC D
  1708. JR NZ,DIAG0610
  1709. SET 0,A
  1710. OUT (MISCTL),A SOUND BEEPER
  1711. JP DIAG0604 GO BACK TO STATUS ROUTINE
  1712. * * * * * * * * * * * * * * * * * *
  1713. *
  1714. * 'KEYBOARD 'PROCESSOR
  1715. *
  1716. * * * * * * * * * * * * * * * * * *
  1717. DIAG0605 EQU *
  1718. LD D,02H SET COUNTER
  1719. IN A,(KBDATA) COMPARE WITH SHIFT-STOP CODE
  1720. CP 3AH
  1721. JP Z,DIAG07
  1722. *
  1723. LD HL,0C1B0H HL TO CENTER OF BOTTOM LINE
  1724. LD B,03H SET BIT COUNTER
  1725. RLCA THROW AWAY BIT SEVEN
  1726. LD C,A
  1727. *
  1728. DIAG0606 EQU *
  1729. LD A,C
  1730. RLCA ROTATE DATA
  1731. LD C,A AND SAVE
  1732. LD A,03H ZERO PATTERN
  1733. JR NC,DIAG0607 WRITE PATTERN
  1734. LD A,7FH ONE PATTERN
  1735. *
  1736. DIAG0607 EQU *
  1737. LD (HL),A STORE PATTERN
  1738. INC HL IN FOUR CONSECUTIVE
  1739. LD (HL),A LOCATIONS
  1740. INC HL
  1741. LD (HL),A
  1742. INC HL
  1743. LD (HL),A
  1744. XOR A ADD TWO SPACES
  1745. INC HL BETWEEN CHARACTERS
  1746. LD (HL),A
  1747. INC HL
  1748. LD (HL),A
  1749. INC HL
  1750. DJNZ DIAG0606
  1751. DEC D
  1752. JP Z,DIAG0604 GOT TO STATUS LOOP
  1753. LD B,05H SET BIT COUNTER
  1754. XOR A CLEAR A
  1755. JR DIAG0607 WRITE GAP BETWEEN BYTES AND DO BYTE 2
  1756. * * * * * * * * * * * * * * * * * * * *
  1757. *
  1758. * 'END OF 'DIAGNOSTICS PROGRAM
  1759. *
  1760. * * * * * * * * * * * * * * * * * * * *
  1761. DIAG07 EQU *
  1762. IN A,(MNTSW)
  1763. * /--- BLOCK DIAG 00 000 82/04/29 10.42
  1764. BIT 2,A TEST FOR REPEAT BIT
  1765. JP NZ,DIAG
  1766. JP COMSET
  1767. *
  1768. END BEGIN