plato:source:plaopl:aist2r
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
- AIST2R
- * /--- FILE TYPE = E
- * /--- BLOCK TITLE 00 000 82/10/27 09.21
- IDENT AIST2R,ORIGIN
- ABS
- ORIGIN EQU 0000
- ORG ORIGIN
- TITLE ASCII IST2 ROM PROGRAM
- * * * * * * * * * * * * * * * * * *
- *
- * 'INFORMATION 'SYSTEMS 'TERMINAL 2 'R'O'M 'PROGRAM
- *
- * COPYRIGHT CONTROL DATA CORPERATION 1982
- *
- * PROCESSOR MOSTEK Z80
- * PROGRAMMER T E LARSOM
- **
- *
- * REVISION 00
- *
- * THIS IS A REWRITE OF THE IST2 ROM RESIDENT FOR
- * THE ASCII PROTOCAL. THE 21/12 BIT COMM PORT IS
- * NOT USED. THE SERIAL PORT WILL BE USED TO
- * COMMUNICATE TO THE HOST.
- *
- * * * * * * * * * * * * * * * * * *
- TITLE I/O
- * * * * * * * * * * * * * * * * * *
- *
- * THE FOLLOWING DESCRIBES THE SERIAL PORT AND
- * DEFAULT CONDITIONS.
- *
- * S2-6 1 = ENABLE PARITY, 0 = DISABLE PARITY
- * S2-1 ON = CONSTANT RTS, OFF = SWITCHED RTS
- * S2-8 ON = 1 STOP BIT, OFF = 2 STOP BITS
- *
- * DEFAULT SWITCHES, (PROGRAM INTERPRETE)
- * SE-4,5 00 = 300 BAUD
- * 01 = 1200 BAUD
- * 10 = 2400 BAUD
- * 11 = 4800 BAUD
- * S2-9 ON = EVEN PARITY, OFF = ODD PARITY
- * IF SE-1 = SKIP DIAGNOSTICS
- * THEN SE-2 ON = PROD. LOAD FILE, OFF EXPERIM.
- * SE-3 ON = AUTO SELECT, OFF = OPERATOR SEL
- *
- * OUTPUT (07)
- * BIT 0 = ENABLE CREQ
- * BIT 1 = ENABLE CRDY
- * BIT 2,3 = WORD LENGTH
- * BIT 4 = ODD/EVEN PARITY
- * BIT 5,6,7 = BAUD RATE
- *
- * INPUT (00)
- * BIT 0 SE-1 ON = 0 = SKIP DIAGNOSTICS
- * OFF = 1 = RUN DIAGNOSTICS
- * BIT 1 SE-2 ON = 0 = SKIP KEYBOARD TEST
- * = PRODUCTION LOAD FIL
- * OFF = 1 = RUN KEYBOARD TEST
- * = EXP. LOAD FILE
- * BIT 2 SE-3 ON = 0 = EXIT DIAGNOSTICS
- * = AUTO SELECT
- * OFF = 1 = REPEAT DIAGNOSTICS
- * = OPERATOR SELECT
- * BITS 3,4 SE-4,5 ON = 0, OFF = 1
- * 00 = 300 BAUD
- * 01 = 1200 BAUD
- * 10 = 2400 BAUD
- * 11 = 4800 BAUD
- * BIT 5 S2-10 ON = 0 = 16K RAM
- * OFF = 1 = 32K RAM
- * BIT 6 S2-9 ON = 0 = EVEN PARITY
- * OFF = 1 = ODD PARITY
- *
- * * * * * * * * * * * * * * * * * * * *
- * /--- BLOCK EQUATES 00 000 82/04/27 08.46
- TITLE EQUATE TABLES
- *
- * EQUATE TABLE
- *
- * INPUT
- MNTSW EQU 00 MAINTAINENCE SWITCHES
- * BIT 0 SE-1
- * BIT 1 SE-2
- * BIT 2 SE-3
- * BIT 3 SE-4
- * BIT 4 SE-5
- * BIT 5 S2-10
- * BIT 6 S2-9
- * BIT 7 S2-8
- KBDATA EQU 01 KEY BOARD DATA
- TPDATA EQU 02 TOUCH PANEL DATA
- SERDATI EQU 05 SERIAL CHANNEL DATA INPUT
- SERSTAT EQU 06 INPUT SERIAL CHANNEL STATUS
- * BIT 0 INTERRUPT PENDING (1)
- * BIT 1 CREQ (1)
- * BIT 2 CRDY (1)
- * BIT 3 RECEIVE ERROR (1)
- * BIT 4 CARRIER DETECT (0)
- * BIT 5 CTS (1)
- * BIT 6 DSR (1)
- SYSSTAT EQU 07 TERMINAL INTERNAL STATUS
- * BIT 0 COMM CRDY
- * BIT 1 HARDWARE FLAG
- * BIT 2 COMM CREQ
- * BIT 3 KEY BOARD DATA READY
- * BIT 4 TOUCH PANEL DATA READY
- * BIT 5 TIMEOUT
- * BIT 6 RESET SWITCH
- * BIT 7 BULK WRITE/ERASE BUSY
- CLADATA EQU 08 CLA DATA
- * OUTPUT
- PNLLTS EQU 00 MAINTAINENCE PANEL LIGHTS
- * BIT 0 ERROR LIGHT
- * BIT 1 TRANSMIT LIGHT
- * BIT 2 RECEIVE LIGHT
- * BIT 3 RTS LIGHT
- * BIT 4 DSR LIGHT
- * BIT 5 DTR LIGHT
- * BIT 6 0 = TEST MODE, 1 = NORMAL MODE
- * BIT 7 0 = ROM SELECT, 1 = RAM SELECT
- CLAL EQU 01 OUTPUT LOWER DATA BITS
- CLAU EQU 02 OUTPUT UPPER DATA BITS
- BLKERS EQU 03 DISPLAY BULK ERASE
- * BIT 2 BIT 1 BIT 0
- * 0 0 X DISBLE VIDEO
- * 0 1 X ENABLE VIDEO
- * 1 0 0 BULK ERASE - DISABLE VIDEO
- * 1 0 1 BULK WRITE - DISABLE VIDEO
- * 1 1 0 BULK ERASE - ENABLE VIDEO
- * 1 1 1 BULK WRITE - ENABLE VIDEO
- * BITS 3 THRU 7 IGNORED
- INTMSK EQU 04 SYSTEM INTERRUPT MASK
- * BIT 0 SERIAL CHANNEL
- * BIT 1 COMM LINE CHAR READY
- * BIT 2 COMM LINE CHAR REQUEST
- * BIT 3 KEYBOARD DATA READY
- * BIT 4 TOUCH PANEL DATA READY
- * BIT 5 SHORT INTERVAL TIMER
- * BIT 6 EXTERNAL INTERRUPT
- * BIT 7 LONG INTERVAL TIMER
- MISCTL EQU 05 MISCELLANEOUS CONTROL
- * BIT 0 0 = NOOPERATION, 1 = SOUND ALARM
- * BIT 1 0 = DTR ON, 1 = DTR OFF
- * BIT 2 0 = RESET FLAG, 1 = SET FLAG
- SERDATO EQU 06 OUTPUT SERIAL DATA
- SERCTRL EQU 07 OUTPUT SERIAL CHANNEL CONTROL
- *
- FDCMND EQU 0EFH FLOPPY DISK COMMAND
- FDSTAT EQU 0EFH FLOPPY DISK STATUS
- FDDATA EQU 0EEH FLOPPY DISK DATA
- * /--- BLOCK EQUATES 00 000 82/05/24 11.14
- * EQUATES USED BY LOADER
- STX EQU 82H
- ETX EQU 03H
- DLE EQU 90H
- ETB EQU 17H
- SLASH EQU 0AFH
- IST2SBTP EQU 00 IST2 SUBTYPE
- *
- ZSTACK EQU 3000H PROCESSOR STACK
- *
- R.INIT EQU 0040H RESIDENT ENTRY POINT
- * LOADER VARS
- CKSUMTBL EQU 22C8H CHECKSUM TABLE FWA
- CHECKSUM EQU 22CAH CHECKSUM STORED BY LOADER
- LOADFLAG EQU 22CBH LOAD FLAG, 3CH = LOAD COMPLETE
- RESETFLG EQU 22CCH RESET FLAG 3CH = SHORT RESET
- MODEFLG EQU 22CDH 00 = PLATO, 01 = TS
- LOADINFO EQU 22CEH LOAD PARAMETERS
- * BIT 0 0 = RS232, 1 = LONG LIN
- * BIT 1 0=INTERNAL, 1=EXTERNAL
- * BIT 2 ALWAYS 1 FOR ASCII
- * BIT 3,4 00=HOST,10=ROM,11=DIS
- * BIT 5,6,7 BAUD RATE,(S5-6,7,8
- RUNINFO EQU 22CFH SAME AS LOADINFO
- * MICRO PLATO VARS
- M.LDFILE EQU 22E5H LOAD FILE NUMBER
- * * * * * * * * * * * * * * * * * * * *
- *
- * ASCII LOAD VARIABLES AND SCRATCH AREA
- *
- * * * * * * * * * * * * * * * * * * * *
- *
- * THE FOLLOWING FLAGS ARE USE FOR ASCII LOAD.
- * VARIABLES SEQ1..A3 MUST BE IN THE ORDER SHOWN.
- SEQ1 EQU 3300H 16 BIT LOAD BLOCK
- SEQ2 EQU 3301H SEQUENCE NUMBER
- LDN EQU 3302H LOAD FILE NUMBER
- ADR1 EQU 3303H 24 BIT STARTING ADDRESS
- ADR2 EQU 3304H OF LOAD DATA
- ADR3 EQU 3305H
- ABORT EQU 3306H HEADER ABORT FLAG
- CLOCK EQU 3307H CLOCK TIMER, 250 MS PERIOD
- TIMER1 EQU 3309H OVERALL TIMER FOR LOAD
- FLAGREG EQU 330AH ETX RECEIVED FLAG
- CNTR EQU 330BH RETRY COUNTER
- CHAR EQU 330CH INPUT DATA SAVE
- CRC1 EQU 330DH 16 BIT CRC
- CRC2 EQU 330EH REMAINDER
- SAVE EQU 330FH BYTE COUNTER
- SAVADR EQU 3311H
- FWASAVE EQU 3314H LOAD FWA SAVE AREA
- LITES EQU 3316H LIGHTS REGISTER
- MADDR EQU 3400H
- SADDR EQU 3500H RESIDENT SAVE AREA
- * /--- BLOCK BEGIN 00 000 82/05/25 13.23
- TITLE INITIALIZE ROM PROGRAM
- * * * * * * * * * * * * * * * * * * * *
- *
- * ROM RESIDENT PROGRAM
- *
- * * * * * * * * * * * * * * * * * * *
- BEGIN EQU *
- DI
- LD A,00 DISABLE INTERRUPTS
- OUT (INTMSK),A
- LD SP,ZSTACK
- LD A,02
- OUT (BLKERS),A ENABLE VIDEO
- LD B,6 SET 3 SECOND TIMEOUT
- BEGIN1 EQU *
- LD HL,38462
- BEGIN2 EQU *
- IN A,(SYSSTAT) IS RESET SWITCH ON
- BIT 6,A
- JR NZ,BEGIN4 JUMP IF NO
- DEC HL
- LD A,L
- OR H
- JR NZ,BEGIN2
- DJNZ BEGIN1
- LD (RESETFLG),A 3 SECONDS HAVE ELAPSED, SO
- BEGIN3 EQU *
- IN A,(SYSSTAT)
- BIT 6,A LOOP TILL RESET OFF
- JR Z,BEGIN3
- JR BEGIN5 CLEAR SHORT RESET FLAG
- BEGIN4 EQU *
- XOR A CLEAR HARDWARE FLAG AND
- OUT (MISCTL),A SET DTR ON.
- LD A,(LOADFLAG) IS CODE ALREADY LOADED
- XOR 3CH
- JR NZ,BEGIN5 FORCE LOAD IF NO
- LD A,(RESETFLG) IS THIS A SHORT RESET
- XOR 3CH
- JP Z,AEXIT
- BEGIN5 EQU *
- LD HL,SEQ1
- LD DE,SEQ2
- LD BC,0040
- LD (HL),00
- LDIR CLEAR LOADER VARIABLES
- IN A,(MNTSW) SKIP DIAGNOSTICS IF
- BIT 0,A SWITCH 0 IS OFF
- JP NZ,DIAG
- * /--- BLOCK COMSET 00 000 82/05/25 08.04
- TITLE COMM SET
- * SET UP SERIAL PORT FOR COMM TO ASCII PLATO
- * ACCORDING TO THE SWITCH SETTINGS.
- COMSET EQU *
- CALL D.CLEAR CLEAR THE SCREEN.
- LD A,5FH CLEAR TEST MODE TO ENABLE
- LD (LITES),A SAVE LIGHTS REGISTER
- OUT (PNLLTS),A THE ASCII COMM CHANNEL
- IN A,(MNTSW) GET SWITCH SETTINGS
- LD C,A
- LD B,20H
- AND 18H MASK BAUD RATE
- JR Z,COMSET1 TEST FOR 300 BAUD
- LD B,60H
- CP 08 TEST FOR 1200 BAUD
- JR Z,COMSET1
- LD B,80H
- CP 10H TEST FOR 2400 BAUD
- JR Z,COMSET1
- LD B,0A0H SET 4800 BAUD
- COMSET1 EQU *
- LD A,0CH SET WORD LENGTH
- OR B AND INCLUDE IN CONTROL BYTE
- OUT (SERCTRL),A
- LD HL,BACKMSG POINT TO BACKOUT MESSAGE
- LD BC,0300H
- * SEND BACKOUT MESSAGE TO PLATO
- BACKOUT EQU *
- IN A,(SERSTAT) READ ASCII COMM STATUS
- AND 12H TEST FOR CREQ, CARRIER
- CP 02
- JR Z,BACKOUT1 WAIT FOR CHAR REQUEST
- DEC C
- JR Z,FLOAD EXIT IF NO CO, CREQ.
- JR BACKOUT
- BACKOUT1 EQU *
- LD A,(HL) OUTPUT CHARACTER
- OUT (SERDATO),A
- INC HL POINT TO NEXT CHAR
- LD C,00
- DJNZ BACKOUT LOOP TILL ALL CHARS ARE OUTPUT
- * /--- BLOCK FLOAD 00 000 82/05/25 09.11
- TITLE LOAD FILE
- *
- * DETERMINE LOAD SOURCE AND LOAD FILE
- *
- FLOAD EQU *
- XOR A CLEAR CODE LOADED FLAG
- LD (LOADFLAG),A
- LD (RESETFLG),A CLEAR SHORT RESET FLAG
- IN A,(MNTSW)
- BIT 2,A TEST FOR AUTO SELECT
- JR NZ,FLOAD2 JUMP IF MANUAL
- LD A,01 SET LOAD FILE 01
- LD (M.LDFILE),A STORE LOAD FILE NUMBER
- CALL DISKLOAD TRY TO LOAD FROM DISK FIRST
- JR HLOAD ELSE LOAD FROM HOST
- FLOAD2 EQU *
- CALL GETLFN GET LOAD FILE NUMBER
- LD (M.LDFILE),A STORE LOAD FILE NUMBER
- TITLE ASCII LOAD
- * * * * * * * * * * * * * * * * * * * *
- *
- * LOAD FROM ASCII COMMUNICATIONS PORT
- *
- * * * * * * * * * * * * * * * * * * * *
- HLOAD EQU *
- LD A,(M.LDFILE)
- LD (LDN),A
- LD HL,SADDR SET FWA OF LOAD
- CALL S100 DO THE LOAD
- POP DE PUT SAVED LOAD INFO INTO D
- JP C,COMSET TRY AGAIN IF LOAD FAILED
- AEXIT EQU *
- LD HL,MOVE PUT RESIDENT MOVE
- LD DE,MADDR ROUTINE OUT IN
- LD BC,ENDMV-MOVE RAM AREA.
- LDIR
- JP MADDR AND JUMP TO MOVE ROUTINE.
- * /--- BLOCK S100 00 000 82/05/25 08.07
- TITLE LOAD SEQUENCE
- * * * * * * * * * * * * * * * * * * * *
- * CALLABLE ENTRY FOR ASCII LOAD ROUTINE
- * ON ENTRY,
- * FWA OF LOAD IS IN HL REG.
- * ON EXIT, CARRY SET SAYS LOAD FAILED.
- * CARRY CLEAR SAYS LOAD WAS SUCCESSFUL.
- * IF CARRY IS CLEAR, C-REG CONTAINS THE
- * COMPUTED MEMORY CHECKSUM OF THE LOADED DATA.
- * * * * * * * * * * * * * * * * * * * *
- S100 EQU *
- LD (FWASAVE),HL SAVE LOAD FWA
- LD HL,VARBEG INITIALIZE LOAD MESSAGES
- LD DE,LNN
- LD BC,VAREND-VARBEG
- LDIR
- S102 EQU *
- LD HL,6600 RESET CLOCK
- LD (CLOCK),HL
- LD A,4 START 1 SECOND TIMER
- LD (TIMER1),A
- * LOOK FOR INITIAL / (STATE 0)
- S103 EQU *
- CALL INDATA GET NEXT CHARACTER
- JR C,S107 INPUT FAILED
- CP SLASH
- JR NZ,S103 WAIT FOR / CODE
- * /--- BLOCK S105 00 000 82/05/26 11.36
- * / RECEIVED OR / TIMEOUT HAS OCCURRED
- S105 EQU *
- LD A,2 SET RETRY COUNT
- LD (CNTR),A
- JR S200 LOOK FOR DLE STX NEXT
- S107 EQU *
- CALL D.CLEAR CLEAR SCREEN.
- IN A,(SERSTAT)
- BIT 4,A TEST FOR CARRIER
- JR Z,S105
- CALL D.NOCARR
- JR S102
- * CALLABLE ROUTINE TO TERMINATE THE LOAD IF THE RETRY COUNT
- * IN (CNTR) HAS EXPIRED. ROUTINE WILL JUMP TO TERLD IF
- * RETRY COUNT HAS EXPIRED. OTHERWISE IT WILL RETURN TO
- * THE CALLER.
- CHKRETRY EQU *
- LD A,(LITES) SET ERR LIGHT (DTR LIGHT ON)
- RES 0,A
- OUT (PNLLTS),A
- LD A,(CNTR) CHECK RETRY COUNTER
- OR A
- JR Z,TERLD TERMINATE IF =0
- DEC A DECREMENT COUNTER
- LD (CNTR),A
- JR S200
- * TERMINATE THE LOAD
- TERLD CALL D.LFAIL DISPLAY - LOAD FAILURE -
- JR HLOAD
- * SEND LOAD REQUEST AND INITIALIZE FOR NEW LOAD
- S200 EQU *
- CALL LOADREQ SEND LOAD REQUEST
- JR NC,TERLD TERMINATE IF ERROR
- XOR A CLEAR LOAD VARIABLES
- LD (SEQ1),A
- LD (SEQ2),A
- LD (ADR1),A
- LD (ADR2),A
- LD A,R.INIT
- LD (ADR3),A
- * /--- BLOCK S201 00 000 82/04/30 15.29
- * START A NEW BLOCK
- S201 EQU *
- LD A,120 START 30 SECOND TIMER
- LD (TIMER1),A
- * LOOK FOR DLE-STX (STATE 1)
- S202 EQU *
- CALL INDATA GET NEXT CHARACTER
- JR C,CHKRETRY
- S205 CP DLE IS CHAR A DLE
- JR NZ,S202 IF NOT, CONTINUE LOOKING
- * DLE RECEIVED, LOOK FOR STX (STATE 2)
- S206 EQU *
- CALL INDATA GET NEXT CHAR
- JR C,CHKRETRY
- CP STX IS IT AN STX
- JR NZ,S205 JUMP IF NOT
- * DLE-STX HAS BEEN RECEIVED, SO PROCESS HEADER.
- S210 LD A,5FH CLEAR ERR LIGHT (DTR LIGHT ON)
- OUT (PNLLTS),A
- LD A,1 SET ABORT FLAG
- LD (ABORT),A
- XOR A CLEAR CRC
- LD (CRC1),A
- LD (CRC2),A
- LD (FLAGREG),A CLEAR ETX FLAG
- CALL D.LDBLK - BLOCK XX-
- LD HL,SEQ1 PRESET HEADER POINTER
- LD B,6 HEADER LENGTH IN BYTES
- LD A,2 PRESET BYTE COUNTER
- LD (SAVE),A
- * /--- BLOCK B001 00 000 82/04/30 15.35
- * WAIT FOR NEXT HEADER CHARACTER. (STATE 3)
- B001 CALL INDATA GET NEXT CHAR
- B001A JR C,CHKRETRY
- CP DLE IS IT A DLE
- JR Z,B004 JUMP IF YES
- B002 LD A,(SAVE) TEST BYTE COUNT
- OR A
- JR NZ,B005 JUMP IF FIRST OR SECOND BYTE
- LD A,(HL) BYTE 3-6, SO COMPARE =
- CP C
- JR NZ,C000 SEND NAK IF NOT =
- B003 CALL CRCGEN ACCUMULATE CRC
- DEC B
- JR Z,D000 JUMP IF DONE WITH HEADER
- INC HL STEP TO NEXT HEADER BYTE
- JR B001 LOOP
- * DLE DETECTED. (STATE 5)
- B004 CALL INDATA HAVE DLE, GET NEXT CHAR
- JR C,B001A
- CP DLE IS IT A DLE
- JR Z,B002 TREAT AS DATA IF YES
- JP E000 OTHERWISE, END OF THIS BLOCK
- B005 LD A,(HL) BYTES 1-2, SO COMPARE
- CP C
- JR NZ,B006 ERROR IF NOT EQUAL
- LD A,(SAVE) DECREMENT BYTE COUNTER
- DEC A
- LD (SAVE),A
- JR B003 COMPARE OK, SO CONTINUE
- B006 EQU *
- JR NC,S202 IGNORE BLOCK IF TOO SMALL
- * /--- BLOCK C000 00 000 82/04/23 14.20
- * SEND NAK,SEQ1,SEQ2,/SEQ1,/SEQ2 MESSAGE
- C000 LD A,5EH SET ERR LIGHT
- OUT (PNLLTS),A
- LD HL,(SEQ1) HL=SEQ2,SEQ1
- LD (NAKXY+1),HL SAVE SEQ1,SEQ2
- LD A,H HL=NOT SEQ2,NOT SEQ1
- CPL
- LD H,A
- LD A,L
- CPL
- LD L,A
- LD (NAKXY+3),HL SAVE NOT SEQ1,NOT SEQ2
- LD HL,NAKXY POINT TO MESSAGE
- LD B,5 MESSAGE LENGTH
- C001 CALL OUTDATA OUTPUT ONE CHAR
- JP NC,TERLD TERMINATE IF ERROR
- INC HL
- DJNZ C001 LOOP TILL ALL CHARS ARE SENT
- JP S202 LOOK FOR DLE STX
- * /--- BLOCK D000 00 000 82/05/26 15.15
- TITLE LOAD DATA TO RAM
- * DONE WITH HEADER. LOAD DATA TO RAM.
- * (SAVE) BYTE COUNT OF CHARS STORED THIS BLOCK
- * B REG BYTE COUNT OF CHARS IN THIS BLOCK
- * HL REG DATA STORE ADDRESS
- * THERE IS A MAXIMUM OF 240 DATA CHARS IN A RECEIVED BLOCK.
- D000 EQU *
- LD HL,(FWASAVE) HL = LOAD ADDRESS
- XOR A CLEAR BYTE COUNTERS
- LD B,A
- LD (SAVE),A
- LD (ABORT),A CLEAR ABORT FLAG
- * WAIT FOR DATA CHARACTER. (STATE 4)
- D001 EQU *
- CALL INDATA GET NEXT DATA BYTE
- JR C,C000 ERROR IF TIME OUT
- CP DLE IS IT A DLE
- JR NZ,D002 JUMP IF NO
- * DLE DETECTED. (STATE 5)
- CALL INDATA HAVE DLE, GET NEXT BYTE
- JR C,C000 ERROR IF TIME OUT
- CP DLE IS IT A DLE
- JR NZ,E000 END OF BLOCK IF NOT
- INC B UPDATE BYTE COUNT
- D002 EQU *
- LD A,B CHECK BYTE COUNT
- CP 240
- JR NC,C000 SEND NAK IF BLOCK TOO LONG
- LD (HL),C STORE COMM DATA
- D003 EQU *
- CALL CRCGEN ACCUMULATE CRC
- INC HL INCREMENT STORE POINTER
- INC B INCREMENT BYTE COUNTERS
- LD A,(SAVE)
- INC A
- LD (SAVE),A
- JR D001 LOOP
- * /--- BLOCK E000 00 000 82/04/28 13.51
- * END OF BLOCK. DLE-XXX DETECTED.
- E000 CP ETB IS CHAR AN ETB
- JR Z,E001 JUMP IF YES
- CP ETX IS CHAR AN ETX
- JR Z,E000A JUMP IF YES
- CP STX IS CHAR AN STX
- JP Z,S210 NEW BLOCK IF YES
- JP C000 OTHERWISE SEND NAK MESSAGE
- E000A LD A,01 HAVE ETX, SET ETX FLAG
- LD (FLAGREG),A
- E001 CALL CRCGEN ACCUMULATE CRC
- * PROCESS FIRST CRC CHARACTER (STATE 6)
- CALL INDATA GET NEXT CHAR
- LD HL,CRC1 CHECK CHAR AGAINST CRC
- CP (HL)
- JP NZ,C000 SEND NAK IF BAD
- * PROCESS SECOND CRC CHARACTER (STATE 7)
- CALL INDATA GET NEXT CHAR
- LD HL,CRC2 CHECK CHAR AGAINST CRC
- CP (HL)
- JP NZ,C000 SEND NAK IF BAD
- LD A,(ABORT) SEND NAK IF ABORT FLAG IS
- OR A STILL ON FROM HEADER
- JP NZ,C000
- * /--- BLOCK E000 00 000 82/05/26 07.59
- * GOOD BLOCK RECEIVED
- LD HL,(FWASAVE)
- LD A,(SAVE)
- LD E,A
- LD D,00
- ADD HL,DE
- LD (FWASAVE),HL
- LD HL,ADR3 IN A2,A3
- ADD A,(HL)
- LD (HL),A
- LD E,A
- JR NC,E002
- DEC HL
- INC (HL)
- LD A,(HL)
- AND 0F8H TEST FOR LOAD ABOVE 800 HEX
- JR Z,E002
- LD A,(SAVADR)
- OR A TEST IF SET ALREADY
- JR NZ,E002
- LD D,(HL) GET ADDRESS IF OVER 800 HEX
- LD HL,(FWASAVE)
- LD (SAVADR),HL SAVE TOP ADDRESS FOR LATER
- LD (FWASAVE),DE
- E002 EQU *
- LD HL,SEQ2 UPDATE BLOCK SEQUENCE NUMBER
- LD A,01
- ADD A,(HL)
- LD (HL),A
- JR NC,E004
- DEC HL
- INC (HL)
- E004 EQU *
- LD A,(FLAGREG) CHECK ETX FLAG.
- OR A
- JP Z,S201 NEXT BLOCK IF NOT ETX
- * DLE-ETX RECEIVED.
- LD C,2 SET RETRY COUNTER
- * SEND DLE-EOT MESSAGE.
- E006 LD HL,DLEEOT
- LD B,2
- E007 CALL OUTDATA
- JP NC,TERLD TERMINATE IF ERROR
- INC HL
- DJNZ E007 LOOP UNTIL BOTH CHARS SENT
- LD A,120 START 30 SECOND TIMER
- LD (TIMER1),A
- * /--- BLOCK G000 00 000 82/04/30 11.00
- * WAIT FOR PRE-SIGN-ON SLASH (STATE 8)
- G000 EQU *
- CALL INDATA GET NEXT CHARACTER
- CP SLASH
- JR NZ,G001 WAIT FOR SLASH
- OR A CLEAR CARRY
- RET AND EXIT (DONE WITH LOAD)
- * / TIMEOUT
- G001 EQU *
- XOR A
- OR C TEST RESEND COUNT
- JR Z,G000
- DEC C
- JR E006 SEND DLE-EOT AGAIN
- TITLE LOAD REQUEST
- * CALLABLE ROUTINE TO OUTPUT L,N,N,CR MESSAGE (LOAD REQUEST)
- LOADREQ EQU *
- CALL D.LDFILE -LOADING FILE XX-
- LD HL,LNN+1 CONVERT UPPER HEX DIG TO ASCII
- LD A,(M.LDFILE)
- LD C,A
- RLCA
- RLCA
- RLCA
- RLCA
- CALL HEXASC
- LD A,C CONVERT LOWER HEX DIG TO ASCII
- CALL HEXASC
- LD HL,LNN OUTPUT THE MESSAGE
- LD B,4
- LOADREQ1 CALL OUTDATA
- RET NC EXIT IF ERROR
- INC HL
- DJNZ LOADREQ1 LOOP UNTIL DONE
- RET
- SPACE 4
- * CALLABLE ROUTINE TO CONVERT LOWER HEX DIGIT IN A-REG
- * TO ASCII IN (HL) AND THEN INCREMENT HL.
- HEXASC EQU *
- AND 0FH GET HEX DIGIT
- ADD A,90H CONVERT TO ASCII
- DAA
- ADC A,40H
- DAA
- JP PE,HEXASC1 SET EVEN PARITY
- XOR 80H
- HEXASC1 LD (HL),A STORE THE CHAR
- INC HL INCREMENT ADDRESS POINTER
- RET
- * /--- BLOCK INDATA 00 000 82/05/24 14.45
- TITLE INPUT DATA
- * CALLABLE ROUTINE TO INPUT COMMUNICATIONS DATA.
- * DATA INPUT IS REGULATED BY COMM. STATUS.
- * ON ENTRY, TIMER VALUES CAN BE IN EITHER (TIMER1) OR
- * (TIMER2) OR BOTH. VALUES IN (TIMER1) AND (TIMER2) ARE
- * IN MULTIPLES OF 250 MILLISECONDS. THE ROUTINE COUNTS
- * A TIMER IF ITS VALUE IS NONZERO ON ENTRY. OTHERWISE THE
- * TIMER IS CONSIDERED TO BE STOPPED. IF A TIMER GOES TO
- * ZERO, THE APPROPRIATE TIMEOUT EXIT IS TAKEN.
- * IF NO TIMEOUT OCCURS WHILE WAITING FOR A CHARACTER,
- * THE ROUTINE INPUTS THE CHARACTER TO THE A-REGISTER AND
- * LOCATION (CHAR). UPON NORMAL EXIT, INPUT CHARACTER IS
- * IN REGISTERS A AND C.
- INDATA EQU *
- PUSH HL
- PUSH BC
- INDATA1 EQU *
- LD HL,(CLOCK) ADVANCE THE CLOCK
- LD A,L
- OR H
- DEC HL
- LD (CLOCK),HL
- JR NZ,INDATA2
- LD HL,6600 RESET CLOCK
- LD (CLOCK),HL
- LD HL,TIMER1 COUNT TIMER IF RUNNING
- DEC (HL)
- JR Z,INDATA3 JUMP IF TIMED OUT
- INDATA2 EQU *
- IN A,(SERSTAT) CHECK STATUS
- LD B,A
- BIT 2,B TEST FOR CRDY
- JR Z,INDATA1 LOOP FOR CHARACTER READY
- IN A,(SERDATI) GET CHAR
- BIT 3,B TEST FOR DATA ERROR
- JR NZ,INDATA3
- POP BC
- POP HL
- LD C,A SAVE CHARACTER
- RET
- INDATA3 EQU *
- POP BC
- POP HL
- SCF
- RET
- * /--- BLOCK OUTDATA 00 000 82/05/25 13.25
- TITLE OUTPUT DATA
- * CALLABLE ROUTINE TO OUTPUT COMMUNICATIONS DATA.
- * OUTPUT IS REGULATED BY COMM. STATUS.
- * ON ENTRY HL POINTS TO THE CHAR IN MEMORY TO BE TRANSMITTED
- * ON EXIT CARRY FLAG INDICATES DATA TRANSMITTED.
- OUTDATA EQU *
- LD DE,20000 PRESET TIMER FOR 400 MSECS.
- OUT1 EQU *
- DEC DE DECREMENT TIMER COUNT
- LD A,D
- OR E (CLEARS CARRY)
- RET Z EXIT IF TIMER EXPIRED
- IN A,(SERSTAT) CHECK STATUS
- BIT 5,A
- JR Z,OUT1 LOOP IF NO CTS
- OUT2 EQU *
- BIT 1,A
- JR Z,OUT1 LOOP IF NO CHAR REQUEST
- LD A,(HL) GET DATA
- OR A TEST PARITY
- JP PE,OUT3
- SET 7,A
- OUT3 EQU *
- OUT (SERDATO),A OUTPUT DATA
- SCF SET DATA TRANSMITTED FLAG
- RET
- * /--- BLOCK CRCGEN 00 000 82/04/28 09.52
- TITLE CRC GENERATOR
- * CRC GENERATOR CALLABLE ROUTINE
- * POLYNOMIAL DIVISOR IS X**16+X**15+X**2+1
- * CRC REMAINDER IN (CRC1),(CRC2) IS UPDATED
- * DATA CHAR IS IN (CHAR) ON ENTRY
- * B REG AND HL REG ARE NOT CHANGED.
- CRCGEN LD A,(CRC1)
- XOR C
- LD C,A
- RRA
- AND 7FH
- XOR C
- LD C,A
- RRA
- RRA
- XOR C
- LD D,A
- RRA
- RRA
- RRA
- RRA
- XOR D
- AND 03H
- LD D,A
- LD A,C
- RLCA
- RLCA
- LD E,A
- AND 0FCH
- OR D
- LD D,A
- LD A,E
- RLCA
- AND 06H
- LD E,A
- LD A,D
- RRA
- LD A,E
- RRA
- LD C,A
- LD A,(CRC2)
- XOR C
- LD (CRC1),A
- LD A,D
- LD (CRC2),A
- RET
- * /--- BLOCK GETLFN 00 000 82/04/30 08.23
- TITLE GET LOAD FILE NUMBER
- * CALLABLE ROUTINE TO GET LOAD FILE NUMBER IN A-REGISTER
- * FROM KEYBOARD. OPERATOR ENTERS ONE OR TWO HEX DIGITS
- * FOLLOWED BY -NEXT- TO SELECT THE LOAD FILE. IF AN ERROR
- * IS MADE THE ENTRY CAN BE CLEARED BY PRESSING -ERASE-.
- * IF NO FILE NUMBER IS ENTERED BEFORE PRESSING -NEXT-, THE
- * ROUTINE WILL SET A=0FFH TO INDICATE NO ENTRY WAS DONE.
- * LOAD FILE NUMBERS ARE LIMITED TO 01-FF HEX.
- *
- *
- GETLFN EQU *
- CALL D.SELLDF DISPLAY -SELECT LOAD FILE -
- LD BC,0300H SET CTR=3, CLEAR LOAD FILE NO.
- GETLFN1 EQU *
- IN A,(SYSSTAT) WAIT FOR KB DATA READY
- BIT 3,A
- JR Z,GETLFN1
- IN A,(KBDATA) GET KB KEY
- AND 5FH IGNORE CTRL AND SHIFT
- CP 16H
- JR Z,GETLFN4 DONE IF -NEXT- KEY
- CP 13H
- JR Z,GETLFN START OVER IF -ERASE- KEY
- CP 10
- JR C,GETLFN2 JUMP IF 00-09 (OK)
- SUB 41H
- JR C,GETLFN1 IGNORE IF 0A-40
- CP 6
- JR NC,GETLFN1 IGNORE IF 47-5F
- ADD A,10 41-46 IS OK (A-F)
- GETLFN2 EQU * HAVE A VALID HEX DIGIT
- DJNZ GETLFN3
- INC B SET CTR BACK TO 1
- JR GETLFN1 IGNORE EXTRA DIGITS OVER TWO
- GETLFN3 EQU *
- LD H,A INSERT NEW DIGIT INTO
- LD A,C LOAD FILE NUMBER
- ADD A,A
- ADD A,A
- ADD A,A
- ADD A,A
- OR H
- LD C,A
- LD A,H
- PUSH BC
- CALL D.DIG DISPLAY DIGIT AT (DE)
- POP BC
- JR GETLFN1
- * /--- BLOCK GETLFN 00 000 82/04/30 09.06
- * PROCESS -NEXT- KEY
- *
- GETLFN4 EQU *
- LD A,B CHECK FOR DEFAULT FILE
- CP 3
- JR Z,GETLFN5
- LD A,C PUT LOAD FILE NO. INTO A-REG.
- RET
- GETLFN5 EQU *
- LD A,01 FLAG AS DEFAULT FILE
- RET
- TITLE PRESET HOST MESSAGES
- * THE FOLLOWING LOCATIONS ARE PRESET MESSAGES
- * AND MUST BE IN THE ORDER SHOWN.
- LNN EQU 3325H
- DLEEOT EQU 3329H
- NAKXY EQU 332BH
- VARBEG EQU *
- HEX CC,00,00,8D LOAD REQUEST MESSAGE
- HEX 90,84 DLE EOT MESSAGE
- HEX 95,00,00,00,00 NAK MESSAGE
- VAREND EQU *
- * BACKOUT MESSAGE TO PLATO
- BACKMSG EQU *
- HEX 1B,FF,CF BACKOUT MESSAGE FOR PLATO
- * THIS ROUTINE IS MOVED TO RAM AND MOVES THE
- * RESIDENT INTO THE ROM AREA AFTER THE LOAD IS
- * COMPLETED.
- MOVE EQU *
- LD A,(LITES)
- SET 7,A SELECT RAM MEMORY
- OUT (PNLLTS),A
- LD DE,SADDR GET ADDRESS OF SAVE AREA
- LD HL,(SAVADR)
- SBC HL,DE GET LENGTH OF DATA TO MOVE
- LD C,L
- LD B,H
- EX DE,HL
- LD DE,R.INIT
- LDIR MOVE RESIDENT
- LD HL,R.INIT
- LD DE,0050H
- ADD HL,DE POINT TO HOST LOAD ADDRESS
- LD E,(HL)
- INC HL
- LD D,(HL) GET ENTRY POINT ADDRESS
- EX DE,HL
- LD C,00 LOAD SUBTYPE FOR IST2
- LD A,(M.LDFILE)
- LD B,A LOAD LOAD FILE NUMBER
- JP (HL) EXIT HOST LOAD
- ENDMV EQU *
- * /--- BLOCK LDRMSG 00 000 82/04/30 09.20
- TITLE LOADER MESSAGE DISPLAY
- * * * * * * * * * * * * * * * * * * * *
- *
- * LOADER DISPLAY ROUTINES
- *
- * * * * * * * * * * * * * * * * * * * *
- D.NOCARR EQU *
- LD HL,W.HOST DISPLAY -HOST -
- JR D.P
- D.SELLDF EQU *
- LD DE,0ABF8H POINT TO DISPLAY AREA
- LD HL,W.SELECT DISPLAY -SELECT LOAD -
- JR D.P1
- D.LFAIL EQU *
- LD HL,W.FAILUR DISPLAY -FAILURE-
- D.P EQU *
- LD DE,0ADF8H POINT TO DISPLAY AREA
- D.P1 EQU *
- CALL D.CLEAR CLEAR THE SCREEN
- DISPLAY EQU *
- LD A,(HL) GET CHARACTER CODE
- OR A
- RET Z DONE IF CODE = 00
- PUSH HL
- CALL DISP DISPLAY THE CHARACTER
- POP HL
- INC HL
- JR DISPLAY
- D.LDBLK EQU *
- LD DE,0C5F8H SET DISPLAY ADDRESS
- LD HL,W.BLOCK DISPLAY - BLOCK -
- CALL DISPLAY
- LD A,(SEQ2)
- JR D.TWODIG
- D.LDFILE EQU *
- LD DE,0A7F8H POINT TO DISPLAY AREA
- CALL D.CLEAR CLEAR THE SCREEN
- LD HL,W.LOADIN DISPLAY -LOADING -
- CALL DISPLAY
- LD A,(SEQ2+1)
- * /--- BLOCK LDRMSG 00 000 82/04/13 15.05
- D.TWODIG EQU *
- PUSH AF DISPLAY 2 HEX DIGITS IN A-REG
- RLCA UPPER DIGIT
- RLCA
- RLCA
- RLCA
- CALL D.DIG
- POP AF LOWER DIGIT
- D.DIG EQU *
- AND 0FH GET HEX DIGIT
- LD C,A GET DIGIT*7 IN A-REG
- ADD A,A
- ADD A,A
- ADD A,A
- SUB C
- DISP EQU *
- LD HL,CHARBASE INDEX TO FIND CHAR DATA
- ADD A,L
- LD L,A
- JR NC,DISP1
- INC H
- DISP1 LD BC,7
- INC D MOVE ONE CHAR POSITION RIGHT
- INC D
- EX DE,HL
- OR A CLEAR CARRY
- SBC HL,BC
- EX DE,HL
- LDIR DISPLAY THE CHARACTER
- RET
- D.CLEAR EQU *
- LD A,06H BULK ERASE
- OUT (BLKERS),A
- D.CLEAR1 IN A,(SYSSTAT) WAIT UNTIL COMPLETED
- BIT 7,A
- JR NZ,D.CLEAR1
- RET
- * /--- BLOCK LDRMSG 00 000 82/04/30 08.06
- W.BLOCK HEX BD,4D,8C,9A,54,85,BD,00
- W.FAILUR HEX 8C,9A,46,5B,7E,93,70,BD LOADING
- HEX 69,46,7E,8C,B6,A1,62,00 FAILURE
- W.LOADIN HEX 8C,9A,46,5B,7E,93,70,BD LOADING
- HEX 69,7E,8C,62,BD,00 FILE
- W.HOST HEX 77,9A,A8,AF,BD HOST
- HEX 93,9A,AF,BD NOT
- HEX 54,9A,93,93,62,54,AF,62,5B,00 CONNECTED
- W.SELECT HEX A8,62,8C,62,54,AF,BD SELECT
- HEX 8C,9A,46,5B,BD LOAD
- HEX 69,7E,8C,62,BD,00 FILE
- CHARBASE EQU *
- HEX 0E,11,19,15,13,11,0E 00 0
- HEX 04,06,04,04,04,04,0E 07 1
- HEX 0E,11,10,08,04,02,1F 0E 2
- HEX 0E,11,10,0C,10,11,0E 15 3
- HEX 09,09,09,1F,08,08,08 1C 4
- HEX 1F,01,01,0F,10,11,0E 23 5
- HEX 0E,11,01,0F,11,11,0E 2A 6
- HEX 1F,10,08,08,04,04,04 31 7
- HEX 0E,11,11,0E,11,11,0E 38 8
- HEX 0E,11,11,1E,10,08,06 3F 9
- HEX 04,0A,11,1F,11,11,11 46 A
- HEX 0F,11,11,0F,11,11,0F 4D B
- HEX 0E,11,01,01,01,11,0E 54 C
- HEX 0F,11,11,11,11,11,0F 5B D
- HEX 1F,01,01,0F,01,01,1F 62 E
- HEX 1F,01,01,0F,01,01,01 69 F
- HEX 0E,11,01,01,19,11,0E 70 G
- HEX 11,11,11,1F,11,11,11 77 H
- HEX 0E,04,04,04,04,04,0E 7E I
- HEX 11,09,05,03,05,09,11 85 K
- HEX 01,01,01,01,01,01,1F 8C L
- HEX 11,13,15,15,15,19,11 93 N
- HEX 0E,11,11,11,11,11,0E 9A O
- HEX 0F,11,11,0F,05,09,11 A1 R
- HEX 0E,11,01,0E,10,11,0E A8 S
- HEX 1F,04,04,04,04,04,04 AF T
- HEX 11,11,11,11,11,11,0E B6 U
- HEX 00,00,00,00,00,00,00 BD SPACE
- * /--- BLOCK DISKLD 00 000 82/04/22 14.30
- TITLE DISK LOADER
- * * * * * * * * * * * * * * * * * *
- *
- * FLOPPY DISK LOADER
- *
- * LOAD FORMAT.
- * FIRST DATA ADDRESS (2 BYTES, LSB FIRST)
- * DATA LENGTH IN BYTES (2 BYTES, LSB FIRST)
- * DATA
- * CHECKSUM (2 BYTES)
- *
- * CHECKSUM ALGORITHM.
- * START WITH HL=0
- * FOR EACH DATA BYTE,
- * H = (H .XOR. DATA) CLS 1
- * L = (L .XOR. DATA) CRS 1
- * CHECK FOR FIRST CHECKSUM BYTE = L
- * CHECK FOR SECOND CHECKSUM BYTE = H
- *
- * AFTER SUCCESSFUL LOAD, CONTROL IS TRANSFERRED
- * TO FIRST DATA ADDRESS.
- *
- * * * * * * * * * * * * * * * * * *
- DISKLOAD EQU *
- CALL D.CLEAR CLEAR THE SCREEN
- CALL FDWAIT
- IN A,(FDSTAT)
- XOR 40H CHECK IF FDC IS LOADED
- JR Z,WLOOPD JUMP IF OK
- CALL FDWAIT WAIT AND THEN TRY AGAIN
- IN A,(FDSTAT)
- XOR 40H
- SCF
- RET NZ RETURN IF DISK LOAD FAILED.
- * /--- BLOCK DISKLD 00 000 82/05/27 07.18
- WLOOPD LD B,40H
- LD A,0EH
- OUT (FDCMND),A OUTPUT COMMAND
- WLOOPA DEC B
- JR Z,DISKFAIL
- CALL FDWAIT
- IN A,(FDSTAT)
- XOR 48H
- JR NZ,WLOOPA
- LD A,0F1H
- OUT (FDCMND),A OUTPUT INVERSE COMMAND
- LD B,40H
- WLOOPC DEC B
- JR Z,DISKFAIL
- CALL FDWAIT
- IN A,(FDSTAT)
- XOR 4AH
- JR NZ,WLOOPC
- *
- IN A,(FDDATA) ADDRESS
- LD E,A
- IN A,(FDDATA)
- LD D,A
- LD (FWASAVE),DE
- IN A,(FDDATA) LENGTH
- LD C,A
- IN A,(FDDATA)
- LD B,A
- LD HL,00
- WLOOPB IN A,(FDDATA) INPUT DATA
- LD (DE),A AND STORE IT
- XOR H UPDATE BLOCK CHECK IN HL
- RLCA
- LD H,A
- LD A,(DE)
- XOR L
- RRCA
- LD L,A
- INC DE UPDATE COUNTERS
- DEC BC
- LD A,B
- OR C
- JR NZ,WLOOPB
- IN A,(FDDATA) SEE IF BLOCK CHECK IS OK
- XOR L
- JR NZ,DISKFAIL
- IN A,(FDDATA)
- XOR H
- JR NZ,DISKFAIL
- LD A,3CH SET CODE LOADED FLAG
- LD (LOADFLAG),A
- LD BC,8000H PUT IST2 ASCII SUBTYPE IN BC.
- LD HL,(FWASAVE)
- JP (HL) GO TO LOADED PROGRAM
- DISKFAIL EQU *
- SCF
- RET
- * WAIT ROUTINE FOR FLOPPY DISK
- FDWAIT LD HL,1000H
- FDWAIT1 DEC HL
- LD A,H
- OR L
- JR NZ,FDWAIT1
- RET
- * /--- BLOCK DIAG 00 000 82/04/29 09.36
- TITLE DIAGNOSTIC TESTS
- * * * * * * * * * * * * * * * * * * *
- *
- * 'DIAGNOSTICS TEST - 'SECTION 1
- *
- * 'THIS SECTION WRITES AND READS 55 HEX THROUGHOUT
- * 'R'A'M 'MEMORY. 'PANEL 'LIGHTS WILL 'DISPLAY CODE 01 HEX
- * WHILE RUNNING.
- *
- * 'THE ALARM WILL SOUND IF AN ERROR IS DETECTED AND
- * WILL SOUND UNTIL ANY KEYBOARD KEY IS DEPRESSED
- * AT WHICH TIME THE ALARM STOPS AND THE ERROR CODE
- * IS DISPLAYED.. 'THE MICROPROCESSOR IS NOW HALTED
- * AND ONLY THE RESET SWITCH CAN RESTART THE TERMINAL.
- *
- * 'THE VALUE OF THE 'L'E'D INDICATORS ARE
- * 'D'T'R = 2**5 (10 0000)
- * 'D'S'R = 2**4 (01 0000)
- * 'R'T'S = 2**3 (00 1000)
- * 'R'C'V = 2**2 (00 0100)
- * 'X'M'T = 2**1 (00 0010)
- * 'E'R'R = 2**0 (00 0001)
- *
- * 'THE MEANING OF THE ERROR CODES ARE
- * 'FIRST HEX 'BYTE = 0 'MEMORY 'ADDRESS 0000 - 3FFF
- * 1 'MEMORY 'ADDRESS 4000 - 7FFF
- * 2 'MEMORY 'ADDRESS 8000 - BFFF
- * 3 'MEMORY 'ADDRESS C000 - FFFF
- * 'SECOND 'BYTE = 1 'DATA 'BIT 0
- * 2 'DATA 'BIT 1
- * 3 'DATA 'BIT 2
- * 4 'DATA 'BIT 3
- * 5 'DATA 'BIT 4
- * 6 'DATA 'BIT 5
- * 7 'DATA 'BIT 6
- * 8 'DATA 'BIT 7
- *
- * * * * * * * * * * * * * * * * * * * *
- DEFS 05B3H+BEGIN-*
- * /--- BLOCK DIAG 00 000 82/04/09 14.17
- DIAG EQU *
- LD A,3EH
- OUT (PNLLTS),A DISPLAY CODE 01
- LD A,55H ENTER DATA TO WRITE
- LD IX,DIAG01 SAVE RETURN ADDRESS
- JP DWR1 GO TO WRITE ROUTINE
- *
- DIAG01 EQU *
- LD HL,0FFFFH LOAD HIGHEST ADDRESS
- LD DE,7FFEH LOAD BLOCK LENGTH
- LD C,55H LOAD EXPECTED DATA
- LD IX,DIAG02 SAVE RETURN ADDRESS
- JP DREAD1 GO TO READ ROUTINE
- * * * * * * * * * * * * * * * * *@ *
- *
- * 'DIAGNOSTICS 'TEST - 'SECTION 2
- *
- * 'THIS SECTION WRITES AND READS 'A'A HEX THROUGHTOUT
- * MEMORY. 'PANEL 'LIGHTS WILL DISPLAY CODE 02 HEX WHILE
- * RUNNING. 'ERROR STOPS SAME AS SECTION 1
- *
- * * * * * * * * * * * * * * * * * * *
- DIAG02 EQU *
- LD A,3DH
- OUT (PNLLTS),A OUTPUT CODE 02
- LD HL,8000H
- LD A,0AAH
- LD IX,DIAG0201 SAVE RETURN ADDRESS
- JP DWR1
- *
- DIAG0201 EQU *
- LD HL,0FFFFH LOAD HIGHEST ADDRESS
- LD DE,7FFEH BLOCK LENGTH
- LD C,0AAH EXPECTED DATA
- LD IX,DIAG03 SAVE RETURN ADDRESS
- JP DREAD1 GO TO READ ROUTINE
- * * * * * * * * * * * * * * * * * * *
- *
- * 'DIAGNOSTICS 'TEST - 'SECTION 3
- *
- *
- * * * * * * * * * * * * * * * * * * * *
- * /--- BLOCK DIAG 00 000 82/04/13 13.32
- DIAG03 EQU *
- LD A,3CH
- OUT (PNLLTS),A OUTPUT CODE 03
- LD DE,8001H
- LD C,00H
- LD A,06H
- OUT (BLKERS),A BULK ERASE
- *
- JP DIAG04
- *
- DWR1 EQU *
- LD HL,0FFFFH SET HL TO HIGHEST ADDRESS
- LD DE,0FFFEH SET DE TO HL MINUS ONE
- LD BC,0F700H SET COUNTER
- LD (HL),A STORE DATA
- LDDR MOVE DATA TO ALL LOCATIONS
- LD A,(0FFFFH)
- LD HL,3FFFH SET HL TO HIGHEST ADDRESS
- LD DE,3FFEH SET DE TO HL MINUS ONE
- LD BC,3700H SET COUNTER
- LD (HL),A STORE DATA
- LDDR MOVE DATA TO ALL LOCATIONS
- JP (IX) RETURN
- *
- DREAD1 EQU *
- LD A,(HL) LOAD DATA
- LD B,A SAVE ACTUAL DATA IN B REG
- XOR C COMPARE WITH EXPECTED
- JP Z,DREAD2 CONTINUE
- JR DERROR
- *
- DREAD2 EQU *
- DEC HL
- DEC DE
- LD A,E
- OR D
- JR NZ,DREAD1
- LD A,H
- BIT 7,A
- JR NZ,DREAD3
- JP (IX)
- DREAD3 EQU *
- IN A,(MNTSW)
- BIT 5,A
- JR NZ,DREAD4
- LD HL,3FFFH
- LD DE,3700H
- JR DREAD1
- DREAD4 LD HL,7FFFH
- LD DE,7700H
- JR DREAD1
- *
- DERROR EQU *
- IN A,(KBDATA) CLEAR KEYBOARD
- DERROR1 EQU *
- SET 0,A
- OUT (MISCTL),A SOUND BEEPER
- IN A,(SYSSTAT)
- BIT 3,A TEST FOR KEYBOARD INPUT
- JR Z,DERROR1 WAIT
- *
- LD A,B LOAD BAD DATA
- XOR C SET FAILING BITS
- LD B,37H SET B TO START FORMING NUMBER
- *
- DERROR2 EQU *
- RLA ROTATE DATA
- JR C,DERROR3
- DJNZ DERROR2 DECREASE CHIP NUMBER
- *
- DERROR3 EQU *
- LD A,B MOVE CHIP NUMBER TO A
- BIT 7,H
- JR NZ,DERROR4 REFRESSH MEMORY - ERROR CODE 2X OR 3X
- RES 5,A
- BIT 6,H
- JR NZ,DERROR5 CODE 0X
- RES 4,A
- JR DERROR5
- *
- DERROR4 EQU *
- BIT 1,H TEST FOR UPPPER BANK
- JR NZ,DERROR5 YES - CODE 3X
- RES 4,A LOWER BANK - 2X
- DERROR5 EQU *
- CPL
- * /--- BLOCK DIAG 00 000 73/00/00 00.00
- RES 7,A
- RES 6,A
- OUT (PNLLTS),A OUTPUT CHIP NUMBER
- HALT1 JR HALT1
- * * * * * * * * * * * * * * * * * * *
- *
- * 'D'I'A'G'N'O'S'T'I'C'S 'T'E'S'T - 'SECTION 4
- *
- * 'THIS SECTION CHECKS THE 'P'L'A'T'O SERIAL 'INTERFACE
- *
- * 'PANEL 'DISPLAYS CODE 04 WHILE RUNNING.
- *
- * 'IF AN ERROR IS DETECTED THE ALARM WILL SOUND DISPLAYING
- * THE SECTION NUMBER UNTIL ANY KEYBOARD KSY IS DEPRESSED.
- * 'THE ALARM WILL THEN STOP AND THE ERROR CODE DISPLAYED.
- *
- * 'CODE 01 = 'NO CHARACTER REQUEST STATUS
- * 02 = CHREQ DROPPED AFTER LOWER BITS OUTPUT
- * 03 = CHREQ ACTIVE AFTER UPPER BITS OUTPUT
- * 04 = FIRST BYTE FLAG NOT SET
- * 05 = START BIT NOT RECEIVED
- * 06 = NO CHARACTER READY STATUS
- * 07 = DATA ERROR
- *
- * 'THE PROCESSOR WILL HALT AND THE RESET SWITCH IS THE ONLY
- * WAY TO RESTART THE TERMINAL
- *
- * * * * * * * * * * * * * * * * * * *
- DIAG04 EQU *
- LD A,3BH
- OUT (PNLLTS),A LOOPBACK MODE, DISPLAY 06
- LD IY,DIAG0401 SAVE CONTINUE ADDRESS
- LD DE,3F80H INITIALIZE DATA
- IN A,(CLADATA) CLEAR CHAR READY STATUS
- JP PCR WAIT FOR 'P'L'A'T'O CHARACTER REQUEST
- *
- DIAG0401 EQU *
- LD A,E LOAD LOWER DATA BITS
- OUT (CLAL),A AND OUTPUT
- IN A,(SYSSTAT) INPUT STATUS
- BIT 2,A TEST FOR CHAR REQ STILL ACTIVE
- JR NZ,DIAG0402
- LD A,3DH
- JP LED DISPLAY OUTPUT
- *
- DIAG0402 EQU *
- LD A,D LOAD UPPER BITS
- SET 3,A SET START BIT
- OUT (CLAU),A AND OUTPUT
- IN A,(SYSSTAT)
- BIT 2,A TEST CHARACTER REQ DROPPED
- JR Z,DIAG0403
- LD A,3CH
- JP LED OUTPUT ERROR CODE 03
- *
- DIAG0403 EQU *
- LD HL,DIAG0404
- JP PRCV GO TO 'P'L'A'T'O RECEIVER
- *
- DIAG0404 EQU *
- BIT 7,A TEST FOR FIRST BYTE
- JR NZ,DIAG0405 OK
- LD A,3BH
- JP LED OUTPUT ERROR CODE 04
- *
- DIAG0405 EQU *
- BIT 6,A TEST FOR START BIT
- JR NZ,DIAG0406
- LD A,3AH
- JP LED OUTPUT ERROR CODE 05
- *
- DIAG0406 EQU *
- XOR D COMPARE WITH EXPECTED DATA
- AND 3FH MASK OFF UNWANTED BITS
- JR NZ,DIAG0409 ERROR
- *
- * /--- BLOCK DIAG 00 000 82/04/13 13.33
- LD HL,DIAG0407 SAVE GOOD RETURN ADDRESS
- JP PRCV GET SECOND BYTE
- *
- DIAG0407 EQU *
- RLCA ROTATE DATA
- XOR E COMPARE WITH
- AND 0F8H
- JR NZ,DIAG0409 ERROR
- *
- LD HL,DIAG0408 SAVE GOOD RETURN ADDRESS
- JP PRCV GET THIRD BYTE
- *
- DIAG0408 EQU *
- XOR 00H SET ZERO FLAG
- JR Z,DIAG0410 OK
- *
- DIAG0409 EQU *
- LD A,38H
- JR LED OUTPUT ERROR CODE 07
- *
- DIAG0410 EQU *
- LD A,E
- ADD A,08H
- LD E,A
- JR NC,DIAG0401
- JR DIAG05
- *
- PCR EQU *
- LD HL,0FFFFH LOAD COUNTER
- *
- PCR1 EQU *
- IN A,(SYSSTAT) INPUT STATUS
- BIT 2,A TEST FOR CHARACTER REQUEST
- JR Z,PCR2
- JP (IY) RETURN
- *
- PCR2 EQU *
- DEC HL
- LD A,H
- OR L TEST FOR TIMEOUT
- JR NZ,PCR1 NO
- LD A,3EH LOAD ERROR CODE
- JR LED AND OUTPUT
- *
- PRCV EQU *
- LD BC,0FFFFH LOAD COUNTER
- *
- PRCV1 EQU *
- IN A,(SYSSTAT)
- BIT 0,A TEST FOR CHARACTER READY
- JP NZ,PRCV2 YES
- DEC BC
- LD A,B
- OR C
- JR NZ,PRCV1
- LD A,39H TIME-OUT ERROR
- JR LED OUTPUT CODE
- *
- PRCV2 EQU *
- IN A,(CLADATA) INPUT DATA
- JP (HL) RETURN
- *
- LED EQU *
- LD B,A
- *
- LED1 EQU *
- SET 0,A
- OUT (MISCTL),A SOUND BEEPER
- IN A,(SYSSTAT)
- BIT 3,A TEST FOR KEYBOARD DATA
- JR Z,LED1 WAIT
- *
- LD A,B RESTORE DATA
- OUT (PNLLTS),A
- HALT2 JR HALT2
- * * * * * * * * * * * * * * * * * * * *
- *
- * 'D'I'A'G'N'O'S'T'I'C'S 'T'E'S'T - 'SECTION 5
- *
- *
- * * * * * * * * * * * * * * * * * * *
- DIAG05 EQU *
- LD A,3AH
- OUT (PNLLTS),A LOOPBACK AND CODE 07
- * * * * * * * * * * * * * * * * * * *
- *
- * 'D'I'A'G'N'O'S'T'I'C'S 'T'E'S'T - 'SECTION 6
- *
- * 'THIS SECTION CHECKS THE KEYBOARD, TOUCHPANEL AND
- * DISPLAYS AN ALIGNMENT PATTERN. 'PANEL LIGHTS WILL
- * /--- BLOCK DIAG 00 000 73/00/00 00.00
- * DISPLAY CODE 06 HEX WHILE RUNNING.
- *
- * 'PRESS SHIFT-STOP TO EXIT DIAGNOTICS PROGRAM.
- *
- * * * * * * * * * * * * * * * * * * * *
- DIAG06 EQU *
- LD A,39H
- OUT (PNLLTS),A DISPLAY SECTION 8
- IN A,(MNTSW)
- BIT 1,A TEST FOR KEYBOARD/TOUCHPANEL
- JP Z,DIAG07
- LD A,06H
- OUT (BLKERS),A DO BULK ERASE
- *
- DIAG0601 EQU *
- IN A,(SYSSTAT)
- BIT 7,A
- JR NZ,DIAG0601 WAIT FOR BULK COMPLETED
- LD HL,8000H
- LD DE,8001H
- LD BC,01FFH
- LD A,01H
- LD (HL),A
- LDIR WRITE BOTTOM LINE
- *
- LD HL,8000H
- LD A,0FFH
- *
- DIAG0602 EQU *
- LD (HL),A
- INC H
- DEC L
- LD (HL),A
- INC HL
- BIT 7,H
- JR NZ,DIAG0602 WRITE LEFT AND RIGHT BOUNDARIES
- *
- LD HL,0FFFEH
- LD DE,0FFFDH
- LD BC,01FDH
- LD A,80H
- LD (HL),A
- LDDR WRITE TOP LINE
- *
- LD HL,8001H
- LD DE,81FEH
- LD C,02H
- DIAG0603 EQU *
- LD A,C LOAD MASK
- OR (HL)
- LD (HL),A STORE FIRST QUADRANT POINT
- LD (DE),A STORE THIRD QUADRANT POINT
- INC HL
- DEC DE
- RLC C
- JR NC,DIAG0603
- INC H
- INC H
- INC D
- INC D
- BIT 7,H
- JR NZ,DIAG0603
- *
- IN A,(KBDATA) CLEAR KEYBOARD
- IN A,(TPDATA) CLEAR TOUCHPANEL
- *
- DIAG0604 EQU *
- IN A,(SYSSTAT)
- BIT 3,A TEST FOR KYBD READY
- JR NZ,DIAG0605 YES - PROCESS
- BIT 4,A TEST TOUCHPANEL READY
- JR Z,DIAG0604 NO - CHECK AGAIN
- * * * * * * * * * * * * * * * * * *
- *
- * 'TOUCHPANEL 'PROCESSOR
- *
- * * * * * * * * * * * * * * * * * * *
- IN A,(TPDATA) INPUT DATA
- * RLCA ROTATE A
- RRCA
- RRCA
- RRCA
- XOR 0E1H
- LD B,A SAVE DATA
- AND 0E0H SAVE UPPER BITS
- LD L,A LOWER BITS OF HL
- LD A,B GET ROTATED DATA
- AND 01H SAVE LOWER BIT
- LD C,A SAVE X8
- * /--- BLOCK DIAG 00 000 82/04/13 13.34
- LD A,B ROTATED DATA
- RLCA ROTATE TWICE TO
- RLCA ADJUST UPPER BITS
- AND 78H SAVE Y BITS
- OR C ADD X8
- SET 7,A
- LD H,A UPPER BITS OF HL
- LD D,02H SET PASS COUNTER
- *
- DIAG0610 EQU *
- LD B,20H SET WORD COUNTER
- *
- DIAG0611 EQU *
- LD A,(HL)
- XOR 0FFH
- LD (HL),A
- INC HL
- DJNZ DIAG0611
- LD B,20H
- INC H
- INC H
- *
- DIAG0612 EQU *
- DEC HL
- LD A,(HL)
- XOR 0FFH
- LD (HL),A
- DJNZ DIAG0612
- INC H
- INC H
- DEC D
- JR NZ,DIAG0610
- SET 0,A
- OUT (MISCTL),A SOUND BEEPER
- JP DIAG0604 GO BACK TO STATUS ROUTINE
- * * * * * * * * * * * * * * * * * *
- *
- * 'KEYBOARD 'PROCESSOR
- *
- * * * * * * * * * * * * * * * * * *
- DIAG0605 EQU *
- LD D,02H SET COUNTER
- IN A,(KBDATA) COMPARE WITH SHIFT-STOP CODE
- CP 3AH
- JP Z,DIAG07
- *
- LD HL,0C1B0H HL TO CENTER OF BOTTOM LINE
- LD B,03H SET BIT COUNTER
- RLCA THROW AWAY BIT SEVEN
- LD C,A
- *
- DIAG0606 EQU *
- LD A,C
- RLCA ROTATE DATA
- LD C,A AND SAVE
- LD A,03H ZERO PATTERN
- JR NC,DIAG0607 WRITE PATTERN
- LD A,7FH ONE PATTERN
- *
- DIAG0607 EQU *
- LD (HL),A STORE PATTERN
- INC HL IN FOUR CONSECUTIVE
- LD (HL),A LOCATIONS
- INC HL
- LD (HL),A
- INC HL
- LD (HL),A
- XOR A ADD TWO SPACES
- INC HL BETWEEN CHARACTERS
- LD (HL),A
- INC HL
- LD (HL),A
- INC HL
- DJNZ DIAG0606
- DEC D
- JP Z,DIAG0604 GOT TO STATUS LOOP
- LD B,05H SET BIT COUNTER
- XOR A CLEAR A
- JR DIAG0607 WRITE GAP BETWEEN BYTES AND DO BYTE 2
- * * * * * * * * * * * * * * * * * * * *
- *
- * 'END OF 'DIAGNOSTICS PROGRAM
- *
- * * * * * * * * * * * * * * * * * * * *
- DIAG07 EQU *
- IN A,(MNTSW)
- * /--- BLOCK DIAG 00 000 82/04/29 10.42
- BIT 2,A TEST FOR REPEAT BIT
- JP NZ,DIAG
- JP COMSET
- *
- END BEGIN
plato/source/plaopl/aist2r.txt ยท Last modified: 2023/08/05 18:54 by Site Administrator