ASC1RAM IDENT IGT,#4000 CHIP TITLE INTERACTIVE GRAPHICS ORG #4000 ******************** * * EQUATE STATEMENTS * ************************************** * PANEL SWITCHES RSF.PANL EQU #00 PANLSWCH EQU #11 FOR BREADBOARD AND IST * INTERRUPT CONTROL COMCHAN EQU 1 CLA CHANNEL NUMBER COMCON EQU 2 CLA CONTROL FUNCTION COMSTA EQU 3 CLA STATUS FUNCTION * ASCII COMMUNICATIONS COMDATA EQU #E2 SERIAL CHANNEL DATA COMSTAT EQU #E3 SERIAL CHANNEL STATUS * TOUCH PANEL * KEYBOARD KEYCHAN EQU 2 KEYBOARD CHANNEL NUMBER KEYDAT EQU 2 KEYBOARD DATA KYBDCON EQU 0 KEYBOARD CONTROL FUNCTION * TOUCH PANEL TPCHAN EQU 3 TOUCH PANEL CHANNEL NUMBER TOUCHD EQU 0 TOUCH PANEL DATA TPCONT EQU 0 TOUCH PANEL CONTROL TOUCHS EQU 1 TOUCH PANEL STATUS TPDIS EQU 0 DISABLE TOUCH PANEL INTERRUPT TPEN EQU 1 ENABLE TOUCH PANEL INTERRUPT * VIDEO DISPLAY * VIDEO DISPLAY DISCHAN EQU 4 DISPLAY CHANNEL NUMBER DISDATA EQU 3 DISPLAY DATA DISCON1 EQU 6 DISPLAY CONTROL 1 FUNCTION DISCON2 EQU 7 DISPLAY CONTROL 2 FUNCTION YCOORD EQU 5 DISPLAY Y COORDINATE DATA XCOORD EQU 4 DISPLAY X COORDINATE DATA XYREAD EQU 2 DISPLAY READ XY BIT 9 FUNCTION YREAD EQU 1 DISPLAY READ Y REGISTER FUNCTION XREAD EQU 0 DISPLAY X REGISTER FUNCTION * EXTERNAL DEVICES IDCHAN EQU 5 ID CODE CHANNEL EXTCH5 EQU 5 EXTERNAL CHANNEL 5 EXTCH6 EQU 6 EXTERNAL CHANNEL 6 EXTCH7 EQU 7 EXTERNAL CHANNEL 7 EXTDATA EQU 0 INPUT/OUTPUT DATA FUNCTION EXTCNTL EQU 1 EXTERNAL CONTROL OUTPUT FUNCTION EXTSTAT EQU 3 EXTERNAL IN STATUS IDLSBS EQU 0 INPUT LOWER BITS OF ID CODE. IDMSBS EQU 1 INPUT UPPER BITS OF ID CODE. SLDATA0 EQU 0 OUTPUT LOWER BITS OF SLIDE DATA. SLDATA1 EQU 1 OUTPUT UPPER BITS OF SLIDE DATA. OPCHAN EQU 0 OPERATORS PANEL CHANNEL NUMBER OPDATA EQU 0 OPERATORS PANEL OUTPUT DATA *********************** M.SBTYPE EQU #22E6 M.CONFIG EQU #22E7 M.M0 EQU #22E8 M.VERS EQU #22EA M.TYPE EQU #22EB M.CLOCK EQU #22EC M.EXTPA EQU #22EE M.MARGIN EQU #22F0 M.JOBS EQU #22F2 M.CCR EQU #22F4 M.MODE EQU #22F6 M.DIR EQU #22F8 M.KSW EQU #22FA M.ENAB EQU #22FC M.SELECT EQU #22FE * M0ADR EQU #0096 LOCATION OF M0 CHAR. SET ADR. M1ADR EQU #0098 LOCATION OF M1 CHAR. SET ADR. MODE5A EQU #2300 MODE6A EQU #2302 MODE7A EQU #2304 * MEM2 EQU #2306 MEM3 EQU #2308 MEM4 EQU #230A MEM5 EQU #230C MEM6 EQU #230E MEM7 EQU #2310 * SUPER EQU #009A SUB EQU #009D SELECTM0 EQU #00A0 SELECTM1 EQU #00A3 SELECTMM EQU #00A6 HORZ EQU #00A9 VERTICAL EQU #00AC FORWARD EQU #00AF REVERSE EQU #00B2 SIZE.1 EQU #00B5 SIZE.2 EQU #00B8 BKSPACE EQU #00BB RETURN EQU #00BE TAB EQU #00C1 LINEFEED EQU #00C4 VERTAB EQU #00C7 FORMFEED EQU #00CA * D.CNTL2 EQU #2050 SIZE EQU #2051 FWD.REV EQU #2052 HOR EQU #2053 VER EQU #2054 X.PLOT EQU #2055 Y.PLOT EQU #2057 CHAR.GEN EQU #2059 XREG EQU #205B YREG EQU #205D XSAVE EQU #205F YSAVE EQU #2061 MEMSEL EQU #2063 M.ORG EQU #2065 * * M.HALT EQU #2314 M.STATUS EQU #2316 MODE EQU #2318 SC.OC EQU #2319 * A.INIT JMP ASTART R.DOT JMP POINT2 PLOT POINT R.LINE JMP LINE1 DRAW LINE R.CHARS JMP #0049 R.BLOCK JMP BLOCK BLOCK WRITE/ERASE R.INPX JMP INPX READ DISPLAY X COORD R.INPY JMP INPY READ DISPLAY Y COORD R.OUTX JMP #0055 R.OUTY JMP #0058 R.XMIT JMP XMIT TRANSMIT DATA TO HLP R.MODE JMP #005E R.STEPX JMP STEPX STEPS X AXIS COORD R.STEPY JMP STEPY STEPS Y AXIS COORD R.WE JMP POINT3 W/E CURRENT POSITION R.DIR JMP DIR SET DIRECTION OF XY STEP R.INPUT JMP INPUT DIRECTS DEVICE INPUT R.SSF JMP SSF.X SELECT SPECIAL FUNCTION R.CCR JMP #0073 R.EXTOUT JMP RESTORE R.EXEC JMP EXEC R.GJOB JMP GJOB R.XJOB JMP PPROC R.RETURN JMP RESTORE RESTORE, ENABLE, RETURN JMP RESTORE EXPANSION SERINP JMP SERCHN KBINP JMP KEYINP TPIN JMP TOUCHINP R.INIT JMP PSTART PLATO INITIALIZE * * * *STRAP DB #E8 NO ECHO, 'FRYE/'PEDERSON STRAP DB #22 #22 300 BAUD;#62 1200 BAUD DB #38 * * * * * * *@* * * * * * * SERIAL CHANNEL INTERRUPT PROCESSOR * SERCHN EQU $ IN COMSTAT INPUT SERIAL CHAN. STATUS RAL AND TEST, IS CHAN. READY JC EXT.PR * RAR TEST FOR RAR INTERRUPT PENDING JNC EXT.PR * RAR RAR TEST FOR CHAR. RDY JNC SERCHN1 NOT CHARACTER READY * 'CHARACTER 'READY IN COMDATA INPUT SERIAL DATA MOV C,A LDA MODE ANI #80 MVI A,#7F JNZ SERCHN0 ANA C ASCII, MASK FOR 7 BITS MOV C,A SERCHN0 EQU $ LXI H,RXBUF LOAD RECEIVE BUFFER ADDR. MVI A,#FF LOAD MASK FOR INDEX CMP M TEST FOR FULL STACK JZ R.RETURN BUFFER FULL INR M INCREMENT DIFFERENCE COUNT INX H STEP TO INPUT INDEX ANA M MASK FOR LOWER SIX BITS. INR M INCREMENT INDEX. INX H STEP TO START INX H OF STACK STORE AREA. MOV E,A ADD INDEX MVI D,00 TO START DAD D OF STORE AREA. MOV M,C STORE SERIAL CHANNEL DATA. LDA M.JOBS INR A STA M.JOBS JMP R.RETURN * * SERCHN1 EQU $ RAL TEST FOR CHAR. REQ. JNC R.RETURN NO CHARACTER REQ. * 'CHARACTER 'REQUEST LXI H,TXBUF LOAD ADDR. OF XMIT BUFFER XRA A TEST FOR EMPTY ORA M BUFFER. JZ SERCHN2 NO DATA DCR M DECREMENT DIFF. COUNT INX H STEP TO INX H OUT INDEX MVI A,7 LOAD MASK FOR INDEX ANA M MASK FOR INDEX BITS INR M INCREMENT INDEX INX H STEP TO STORE AREA. MOV E,A ADD INDEX TO MVI D,00 START OF DAD D STORE AREA. MOV A,M LOAD DATA TO TRANSMIT OUT COMDATA OUTPUT DATA SERCHN2 EQU $ LDA SC.OC TURN OFF CHAR.REQ.INT. OUT COMSTAT JMP R.RETURN RETURN TO PROCESSING * * LOAD ALL REGISTERS FROM STACK TO RESTORE * RESTORE EQU $ POP H RESTORE REGISTERS POP D POP B POP PSW EI ENABLE SYSTEM INTERRUPT RET * * KEYBOARD INTERRUPT * * * * * * * * * * * * * * * * * * * * * * * * * KEYINP IN KEYCHAN*32+KEYDAT CMA INPUT CHARACTER FROM KEY BOARD ANI #7F MVI H,#40 LOAD OP CODE AND CATAGORY BITS MOV L,A B05,LOAD DATA CALL FIFO.ST B05,STORE FOR USER/PLATO MVI A,#01 B05 OUT KEYCHAN*32+KYBDCON B05,ENABLE KYBD INT. JMP RESTORE * * * * * * * * * * * * * * * * * * * * * * * * * * TOUCH PANEL INTERRUPT * * * * * * * * * * * * * * * * * * * * * * * * * TOUCHINP IN TPCHAN*32+TOUCHD MVI H,#41 LOAD OP CODE AND CATAGORY BITS MOV L,A LOAD DATA CALL FIFO.ST STORE FOR USER/PLATO. JMP RESTORE * * * * * * * * * * * * * * * * * * * * * * * * * * EXTERNAL INTERRUPT PROCESSOR. * * * * * * * * * * * * * * * * * * * * * * * * * EXT.PR EQU $ * LHLD M.EXTPA MOV A,L ORA H JNZ EXT.PR2 JUMP TO USER IF ZERO * CALL EXT.IN INPUT DEVICE DATA MOV L,A AND LOAD UP FOR MVI H,#82 FIFO INSERT CALL FIFO.ST FOR TRANSFER. JMP RESTORE RETURN TO PREVIOUS PROCESSING. EXT.PR2 EQU $ PCHL JUMP TO USER IF ZERO * PSTART EQU $ MVI A,#0F STA PMC.FLG SET PLATO MASTER CLEAR FLAG CALL PLATO0 INITIALIZE PLATO JMP STRT.3 * * INITIALIZE TERMINAL ROUTINE * ASTART EQU $ LXI H,G.BEGIN HL _ BEGIN OF SCRATCH AREA LXI D,G.END DE _ END OF SCRATCH AREA STRT.1 MVI M,00 CLEAR SCRATCH AREA INX H MOV A,L CMP E JC STRT.1 MOV A,H CMP D JC STRT.1 LXI H,#180 SHLD CLOCK CALL ASCII SET UP ASCII OPERATIONS LHLD STRAP TEST BIT 1 MOV A,L ANI 01 ON/OVERSTRIKE JNZ STRT.2A OFF/NORMAL MVI L,07 SET OVERSTRIKE JMP STRT.2B STRT.2A EQU $ MVI L,03 SET NORMAL WRITE * * STRT.2B EQU $ CALL R.MODE VIA R.MODE XRA A STA M.KSW LXI H,#00 POSITION X CALL R.OUTX AND Y TO (0,511) CALL LF.2 Y=PAGE TOP - HEIGHT * STRT.3 EQU * LXI H,0000 SHLD M.EXTPA ZERO OUT EXT PROCESSOR LXI H,0000 SHLD EXT.OUT SET UP OUTPUT AND IN ROUTINE LXI H,#D300 SHLD EXT.OUT+2 LXI H,#C900 SHLD EXT.OUT+4 LXI H,#EBDB SHLD EXT.IN MVI A,#C9 STA EXT.IN+2 LDA SC.OC OUTPUT SERIAL CHANNEL OUT COMSTAT CONTROL WORD IN COMCHAN*32+COMSTA XRA A TURN OFF PLATO CHAN. OUT COMCHAN*32+COMCON INR A AND TURN ON KEYBOARD,SER.CHAN. OUT KEYCHAN*32+KYBDCON OUT EXTCH5*32+EXTCNTL EI ENABLE SYSTEM INTERRUPTS. * IDLE EQU $ CALL EXEC JMP IDLE EXEC EQU * LDA MODE RLC JNC IDLE0 LDA EREG ANI #04 CNZ TIMOUT IDLE0 EQU $ LXI H,RXBUF LOAD RECEIVE BUFF. ADDR. XRA A CLEAR A REGISTER. ORA M INCLUSIVE OR A WITH DIFF. JZ IDLE2 NO DATA, CONTINUE LDA M.JOBS DCR A STA M.JOBS DCR M IS DATA, DEC. DIFF. COUNT INX H UNLOAD DATA; STEP TO OUT. INX H MVI A,#FF MASK OUT INDEX W/ BUFFR.LN ANA M INR M INCREMENT OUT INDEX. INX H BEGIN OF STORE FOR JOBSTK MOV E,A PLUS OUTPUT INDEX MVI D,00 DAD D MOV C,M UNLOAD DATA INTO C LXI H,KBDATA CLEAR KB DATA FLAG MVI M,00 LDA MODE ANI #80 JZ IDLE1 CALL ERRCHK JC EXEC MVI A,#7F ANA C MOV C,A CALL PPROC PROCESS PLATO MODE DATA JMP EXEC IDLE1 EQU $ CALL TESTMODE PROCESS DATA * IDLE2 EQU $ LDA TXBUF ORA A TEST XMIT BUFFR. FOR DATA JZ IDLE3 NO DATA, CONTINUE LXI H,KBDATA CLEAR KB DATA FLAG MVI M,00 IN COMSTAT INPUT STATUS WORD RAR RAR JNC IDLE3 CHAR. REQ. LOW LDA SC.OC ENABLE CHAR REQ INR A OUT COMSTAT JMP EXEC * IDLE3 EQU $ LXI H,RXBUF LOAD RECEIVE BUFF. ADDR. XRA A CLEAR A REGISTER. ORA M INCLUSIVE OR A WITH DIFF. JNZ EXEC CALL INDATA CHECK KB/TP INPUT BUFFER MOV E,L BUFFER AND SAVE IN DE MOV D,H DAD H TEST FOR NO DATA FLAG JC IDLE14 NO DATA, CONTINUE XCHG NONSHIFTED FOR P.XMIT LDA MODE ANI #80 IF PLATO OPERATION JZ IDLE3.A IDLE3.A, NOT PLATO OP. CALL P.XMIT RET IDLE3.A EQU $ XCHG SHIFTED FOR ASCII TESTS MVI A,07 ANA H TEST FOR KEY BOARD DATA JZ IDLE4 KEYBOARD DATA XRA A STA KBDATA CLEAR KB DATA FLAG MVI A,06 TEST FOR TOUCH PANEL DATA ANA H CPI 02 JZ GIN.TP GO HANDLE TOUCH PANEL DATA JMP IDLE14 NOT KB DATA, NOT TP DATA IDLE4 EQU $ LXI H,KBDATA SET KB DATA FLAG MVI M,01 CALL KBCON CONVERT KB TO ASCII ANA A CLEAR CARRY RAL IF UPPER BIT SET,SPEC.CODE JNC IDLE8 OTHERWISE,CONT. PROCESSING * BC HAS INDEX INTO SPTBL MOV C,A MOV B,D LXI H,SPTBL DAD B MOV E,M INX H MOV D,M XCHG PCHL JUMP TO SPECIAL CODE * IDLE8 EQU $ JZ IDLE9 LDA G.TTYFLG IF TELETYPE FLAG SET ORA A CHECK FOR BIT 7 SET. JZ IDLE9 MOV A,C ANI #40 JZ IDLE9 MOV A,C PUT DATA IN A REG ANI #5F TURN OFF BIT 6 OF 8 MOV C,A * IDLE9 EQU $ LDA G.CTLFLG TEST FOR CONTROL ORA A KEY AS PREVIOUS KEY JZ IDLE12 NO CONTROL KEY XRA A CLEAR CONTROL FLAG STA G.CTLFLG MOV A,C CPI #31 JZ OFFLINE CPI #30 JZ ONLINE CPI #3D CHECK FOR EXCEPTIONS TO JZ UNSCALE CTL KEY SEQUENCES. CPI #39 JZ SCALE CPI #32 JZ CURSON CPI #33 JNZ IDLE10 * CURSOFF EQU $ LDA ECURSOR MOV B,A CALL DISCURS STA G.SUPCUR SUPPRESS CURSOR JMP EXEC * CURSON EQU $ XRA A DO NOT SUPPRESS CURSOR STA G.SUPCUR JMP EXEC * OFFLINE EQU $ LXI H,LOC.RMT SET OFFLINE CONDITION MVI M,1 JMP EXEC * ONLINE EQU $ LXI H,LOC.RMT SELECT ONLINE CONDITION MVI M,00 JMP EXEC * SCALE EQU $ XRA A CTL 3D STA SCALEFG WILL SCALE TO 511 X 511 LXI H,#0070 SHLD BIAS BIAS IS 112 JMP EXEC * UNSCALE EQU $ LXI H,SCALEFG CTL 39 MVI M,01 ACCEPTS COORDS. AS IS LXI H,0000 SHLD BIAS BIAS IS 0 JMP EXEC * IDLE10 EQU $ MVI A,#20 TEST FOR SHIFTED ANA C KEY INPUT. JNZ IDLE11 NOT SHIFTED MVI A,#10 ELSE TOGGLE XRA C BIT FOUR OF MOV C,A KEY INPUT. * IDLE11 EQU $ MVI A,#1F LOAD MASK AND ANA C MASK CONTROL CODE MOV C,A XRA A CLEAR CONTROL FLAG STA G.CTLFLG * IDLE12 EQU $ LDA MODE CPI #08 TEST FOR GIN MODE JNZ IDLE12.A CALL GIN.A GIN MODE, GIN.A JMP IDLE14 SKIP TO IDLE14 IDLE12.A EQU $ LDA LOC.RMT LOAD LOCAL/REMOTE FLAG ORA A CZ XMIT.1 STORE DATA FOR TRANSMIT * LDA BYPASS LOAD AND TEST FOR BYPASS ORA A JZ IDLE13 BYPASS NOT ON MOV A,C PUT DATA IN C REG. CPI #20 IF DATA IS CTL CODE, JNC IDLE14 KEY NOT CTL CODE * IDLE13 EQU $ LHLD STRAP TEST FOR ECHO OPTION MOV A,L ANI #80 JNZ IDLE14 NO ECHO CALL TESTMODE PROCESS ASCII OP. DATA * IDLE14 EQU $ LXI H,KBDATA CLEAR KB DATA FLAG MVI M,00 LDA MODE IF ALPHA, BLINK CURSOR CPI #08 JZ IDLE15 CPI #03 RNZ IDLE15 EQU $ LHLD CLOCK TEST BLINK COUNT DCX H SHLD CLOCK MOV A,L ORA H JNZ EXEC LXI H,#180 SHLD CLOCK LDA WEFLAG CHECK FOR W/E CURSOR ORA A JZ BLINK MVI B,04 CALL DISCURS ERASE CURSOR XRA A CLEAR W/E FLAG_WRITE STA WEFLAG RET GJOB EQU * MVI C,0 LDA EREG ANI #04 CNZ TIMOUT LXI H,RXBUF XRA A ORA M RZ RETURN IF NO JOBS RECEIVED LDA M.JOBS DCR A STA M.JOBS DCR M INX H INX H MVI A,#FF ANA M INR M INX H MOV E,A MVI D,00 DAD D MOV C,M LXI H,KBDATA MVI M,0 CALL ERRCHK RC RETURN IF ERROR MVI A,#7F ANA C MOV C,A RET * BLINK EQU $ MVI B,6 CALL DISCURS WRITE CURSOR MVI A,1 SET W/E FLAG_WRITE STA WEFLAG JMP EXEC * ERRCHK EQU $ MVI A,#06 CMP C JNZ E001 NOT ACK JUMP LDA EREG ORI #80 STA EREG STC RET E001 LDA EREG RAR JNC E100 NOT STATE 0 JUMP MOV A,C ORA A JPO E006 P ERROR JUMP LDA EREG RAL JNC E006 E002 EQU $ MOV A,C ANI #7F SUI #20 JM E003 STA MREG STA NREG MVI A,#02 STA EREG E003 LDA EREG ANI #0F STA EREG STC RET E006 LDA EREG ANI #0F STA EREG RET E100 EQU * RAR JNC E200 NOT STATE 1 JUMP MOV A,C ORA A JPE E104 NOT P ERROR JUMP XRA A ORI #04 STA EREG E101 MVI C,#95 NAK E102 CALL XMIT.1 JC E102 LDA MREG ADI #20 MOV C,A E103 CALL XMIT.1 JC E103 XRA A STA CLK.1 STA CLK.2 STC RET E104 LDA EREG ANI #80 JZ E105 NO ACK FLAG JUMP MOV A,C ORA A RAL RRC SUI #20 STA NREG JMP E003 E105 LDA MREG MOV B,A LDA NREG CMP B JNZ E107 N^=M JUMP INR A MVI B,#60 CMP B JNZ E106 XRA A E106 STA NREG STA MREG LDA EREG ANI #BF STA EREG JMP E109 E107 INR A MVI C,#60 CMP C JNZ E108 XRA A E108 STA NREG LDA EREG ORI #40 STA EREG E109 LDA E.CNTR DCR A JZ E110 STA E.CNTR LDA EREG RLC RLC RET E110 MOV B,C MVI A,#14 STA E.CNTR MVI C,#06 ACK E111 CALL XMIT.1 JC E111 LDA MREG ADI #20 MOV C,A E113 CALL XMIT.1 JC E113 MOV C,B LDA EREG RLC RLC RET E200 MOV A,C ORA A JPO E202 LDA EREG RLC JC E002 E201 STC RET E202 LDA EREG ANI #0F JMP E201 * P.XMIT EQU $ MOV E,L SAVE DATA BITS IN E MOV D,H SAVE NON-SHIFTED H IN D DAD H FOR TEST OF DATA TYPE MVI A,#07 ANA H JNZ PX007 NOT KBDATA JP PX007 CALL KBCON MVI A,#17 CMP C JNZ PX002 MVI A,#01 STA SH.SUP PX001 CALL XMIT.1 JC PX001 RET PX002 LDA SH.SUP ORA A JNZ PX004 SH.SUP SET JUMP PX003 CALL XMIT.1 JC PX003 RET PX004 MVI A,#11 CMP C JNZ PX005 XRA A STA SH.SUP CALL ASCII RET PX005 XRA A STA SH.SUP PX006 CALL XMIT.1 JC PX006 RET PX007 EQU $ PUSH D MVI C,#1B PX008 CALL XMIT.1 JC PX008 POP D MVI A,#3F ANA E ADI #40 MOV C,A PUSH D PX010 EQU $ CALL XMIT.1 JC PX010 POP D MVI A,#C0 ANA E RLC RLC MOV E,A MVI A,#03 ANA D RLC RLC ORA E ADI #40 MOV C,A PX012 CALL XMIT.1 JC PX012 RET TIMOUT EQU * LDA CLK.1 ADI #01 STA CLK.1 RNC LDA CLK.2 INR A STA CLK.2 SUI #20 RNZ XRA A STA CLK.1 STA CLK.2 MVI C,#95 TO01 CALL XMIT.1 JC TO01 LDA MREG ADI #20 MOV C,A TO03 CALL XMIT.1 JC TO03 RET * * TRANSMIT BUFFER STORE XMIT EQU $ CALL P.XMIT RET * XMIT.1 EQU $ LXI H,TXBUF TEST FOR MVI A,07 FULL BUFFER. CMP M JC XMIT.3 FULL, ENABLE CREQ INR M BUFFER NOT FULL,INCR. DIFF INX H STEP TO INPUT INDEX ANA M PICK UP INPUT INDEX. INR M INX H STEP TO STORE AREA. INX H MOV E,A ADD INPUT INDEX. MVI D,00 DAD D LDA MODE ANI #80 MOV A,C * JZ XMIT.2 IF ASCII OP. SKIP PARITY ORA A JPE XMIT.2 PLATO SO EVEN PARITY CHK. XRI #80 XMIT.2 EQU $ MOV M,A STORE DATA IN TXBUF XMIT.3 EQU $ LDA SC.OC SET CREQ ENABE INR A OUT COMSTAT RET TESTMODE EQU $ LDA MODE LOAD MODE. ANI #0F MASK OFF MODE BITS RLC MOV E,A MVI D,0 LHLD SELECT.M LOAD BASE ADDR. JUMP TABLE DAD D MOV E,M INX H MOV D,M XCHG * JMPHL EQU $ PCHL * SELECT.P EQU $ DW POINT DW GRAPH DW MEMORY MODE 2 DW CHARACT DW ABLOCK DW MODE5 DW MODE6 DW MODE7 DW TEMP * SELECT.A EQU $ DW POINT DW GRAPH DW TEMP DW ALPHMODE DW ABLOCK DW TEMP DW TEMP DW TEMP DW GIN * COMMODE EQU $ LDA CMODE LOAD COMMAND MODE ANI #07 MASK OFF UNWANTED BITS RLC MOV E,A MVI D,00 LXI H,SELECT.C LOAD BASE ADDR. JUMP TABLE DAD D MOV E,M INX H MOV D,M XCHG PCHL * SELECT.C EQU $ DW LDC DW SSF DW ECHO DW LDA DW EXT DW COLOR * SPTBL EQU $ DW G.CTL CONTROL DW G.RESET RESET DW G.TTY DW G.BREAK DW G.PAGE PAGE DW G.ERASE 'B'S WITH ERASE ALWAYS DW G.RUBOUT * * * FOLLOWING ARE EXCEPTIONS TO NORMAL ASCII CHAR. SET * * G.CTL EQU $ MVI A,01 SET CONTROL FLAG STA G.CTLFLG JMP EXEC * * G.RESET EQU $ LDA MODE IF IN ALPHA, ERASE CURSOR CPI 03 JNZ G.RES.1 LDA ECURSOR ERASE CURSOR MOV B,A CALL DISCURS G.RES.1 EQU $ CALL SIZE1 CALL AFF.1 JMP EXEC * G.PAGE EQU $ CALL AFF SAME AS ESC FF SEQ. JMP EXEC * G.TTY EQU $ LDA G.TTYFLG XRI 01 CHANGE 'C'A'P'S STA G.TTYFLG JMP EXEC * G.ERASE EQU $ CALL BS LDA D.CNTL2 STA D.CNTL2P LDA M.MODE STA M.MODEP MVI L,02 CALL R.MODE MVI C,#00 CALL CHARGEN LDA D.CNTL2P STA D.CNTL2 LDA M.MODEP STA M.MODE MVI C,#08 JMP IDLE12 * G.BREAK EQU * G.RUBOUT EQU * JMP EXEC * KBCON EQU $ MVI D,00 DE-KEYBOARD DATA LHLD KBAADR HL-KB CONVERSION TABLE DAD D BASE ADDR. + KEY CODE MOV A,M MOV C,A IF VALID, RETURN IN C CPI #FF RNZ POP H OTHERWISE, POP STACK JMP EXEC * ISTASC EQU $ DB #30,#31,#32,#33 DB #34,#35,#36,#37 DB #38,#39,#26,#60 DB #0A,#5E,#2B,#2D DB #13,#04,#07,#08 DB #7B,#0B,#0D,#1A DB #02,#12,#01,#03 DB #7D,#0C,#FF,#FF DB #3C,#3E,#5B,#5D DB #24,#25,#5F,#7C DB #2A,#28,#40,#27 DB #1C,#5C,#23,#7E DB #17,#05,#14,#19 DB #7F,#09,#1E,#18 DB #0E,#1D,#11,#16 DB #00,#0F,#FF,#FF DB #20,#61,#62,#63 DB #64,#65,#66,#67 DB #68,#69,#6A,#6B DB #6C,#6D,#6E,#6F DB #70,#71,#72,#73 DB #74,#75,#76,#77 DB #78,#79,#7A,#3D DB #3B,#2F,#2E,#2C DB #1F,#41,#42,#43 DB #44,#45,#46,#47 DB #48,#49,#4A,#4B DB #4C,#4D,#4E,#4F DB #50,#51,#52,#53 DB #54,#55,#56,#57 DB #58,#59,#5A,#29 DB #3A,#3F,#21,#22 ********** * KEYBOARD TO ASCII CONVERSION TABLE ********** IGTASC EQU $ DB #30,#31,#32,#33 DB #34,#35,#36,#37 DB #38,#39,#40,#5C DB #09,#5E,#2B,#2D DB #7D,#1B,#FF,#85 1X DB #82,#FF,#0D,#0A DB #08,#86,#83,#80 DB #84,#FF,#FF,#FF DB #3C,#3E,#5B,#5D 2X DB #24,#25,#5F,#27 DB #2A,#28,#60,#7C DB #09,#7E,#23,#26 DB #7B,#1B,#FF,#85 3X DB #82,#FF,#0D,#0A DB #08,#86,#83,#80 DB #81,#FF,#FF,#FF DB #20,#61,#62,#63 DB #64,#65,#66,#67 DB #68,#69,#6A,#6B DB #6C,#6D,#6E,#6F DB #70,#71,#72,#73 DB #74,#75,#76,#77 DB #78,#79,#7A,#3D DB #3B,#2F,#2E,#2C DB #20,#41,#42,#43 DB #44,#45,#46,#47 DB #48,#49,#4A,#4B DB #4C,#4D,#4E,#4F DB #50,#51,#52,#53 DB #54,#55,#56,#57 DB #58,#59,#5A,#29 DB #3A,#3F,#21,#22 * PPROC EQU $ MOV A,C ANA A RZ LDA CMODE TEST FOR COMMAND MODES ANI #80 JZ PPROC.1 CALL COMMODE COMMAND MODE PROCESSOR RET PPROC.1 EQU $ LDA MODE ANI #40 IF THIS BIT SET, JZ PPROC.2 NOT COMMAND OR DATA MODES CALL TESTMODE RET PPROC.2 EQU $ CALL ESCCTL RET * ESCADR.P EQU $ DB #03 DW ASCII DB #11 DW DC1 DB #12 DW DC2 DB #13 DW DC3 DB #14 DW DC4 DB #1B DW ESC DB #0C DW BULKER DB #40 DW SUPER DB #41 DW SUB DB #42 DW SELECTM0 DB #43 DW SELECTM1 DB #44 DW SELECTMM DB #45 DW SELECTMM DB #46 DW SELECTMM DB #47 DW SELECTMM DB #48 DW SELECTMM DB #49 DW SELECTMM DB #4A DW HORZ DB #4B DW VERTICAL DB #4C DW FORWARD DB #4D DW REVERSE DB #4E DW SIZE.1 DB #4F DW SIZE.2 DB #32 DW LCOORD DB #51 DW SSPECF DB #52 DW LEXT DB #53 DW LDM2 DB #54 DW MODE567 DB #55 DW MODE567 DB #56 DW MODE567 DB #57 DW LADDR DB #59 DW LECHO DB #5A DW LMARG DB #3D DW STCOL DB #FF * CTLADR.P EQU $ DB #08 DW BKSPACE DB #0D DW RETURN DB #09 DW TAB DB #0A DW LINEFEED DB #0B DW VERTAB DB #0C DW FORMFEED DB #19 DW EM.1 DB #1B DW ESC DB #1C DW FS.1 DB #1D DW GS.1 DB #1F DW US DB #FF * TEMP EQU $ RET * ASCII EQU $ MVI A,#B5 SET INITIAL TERMINAL STAT. STA TSTAT MVI A,#03 SELECT ASCII MODE 3 STA MODE STA WEFLAG SET W/E FLAG LXI H,IGTASC SELECT IGT ASCII KEYBOARD SHLD KBAADR LXI H,SELECT.A SELECT ASCII MODE TABLE SHLD SELECT.M LXI H,CTLADR.A SELECT ASCII CTL CODE TBL SHLD CTLADR LXI H,ESCADR.A SELECT ASCII ESC SEQ TBL SHLD ESCADR CALL SIZE1 LXI H,#0070 SHLD BIAS MVI A,4 STA ECURSOR MVI A,6 STA WCURSOR XRA A STA SCALEFG CALL BULKER ERASE SCREEN LXI H,#00 POSITION X TO 00 CALL R.OUTX CALL LF.2 POSITION Y TO 512 - HEIGHT RET * BULKER EQU $ LDA M.MODE RLC ORI 01 MOV L,A CALL R.MODE RET LDM2 EQU $ MVI A,#C2 SELECT LOAD MEMORY STA MODE MODE 2,PLATO OP. XRA A CLEAR NUMBER OF INPUTS STA NINPUT TO GETXY ROUTINE RET * LCOORD EQU $ MVI A,#80 SELECT COMMAND LOAD STA CMODE COORDINATE XRA A STA NINPUT RET * LMARG EQU $ CALL R.INPX LDA M.CCR ANI 01 JZ LMARG.1 HORIZONTAL, HL HAS X CALL R.INPY LMARG.1 EQU $ SHLD M.MARGIN SET MARGIN RET * SSPECF EQU $ MVI A,#81 STA CMODE SPECIAL FUNCTION XRA A STA NBYTES RET * LECHO EQU $ MVI A,#82 STA CMODE ECHO XRA A STA NBYTES RET * LADDR EQU $ MVI A,#83 STA CMODE ADDRESS XRA A STA NBYTES RET * LEXT EQU $ MVI A,#84 STA CMODE EXTERNAL DEVICE XRA A STA NBYTES RET * STCOL EQU * MVI A,#85 STA CMODE COLOR XRA A STA NBYTES RET COLOR EQU * LXI H,NBYTES INR M MVI A,02 CMP M RNZ XRA A STA CMODE RET * LDC EQU $ LOAD COORDINATE PROCESSOR CALL ESCCTL CHECK FOR COMMAND CHANGE CALL GETXY GET COORDINATES CALL OUTCOORD RET * * * * * * * * * * * * * * * * * * * * * * * * * * ECHO COMMAND * 70H-TESTS MEMORY CONFIGURATION OF TERMINAL * RESPONDS WITH'; 72H- 4K * 73H- 20K * 76H- 8K * 77H- 24K * 71H-SUBTYPE (3) * 72H-LOADFILE (SWITCH - USUALLY 3) * 73H-CONFIG (0) * 7BH-SOUND AUDIBLE AUDIBLE ALERT * 7CH-ID SERIAL NUMBER * 7DH-SEND USER FLAG * OTHERS LOOP BACK * * * * * * * * * * * * * * * * * * * * * * * * * ECHO EQU $ CALL ESCCTL CHECK FOR COMMAND CHANGE CALL GET3 GET NEXT 3 BYTES MOV A,E ANI #7F CPI #7C TEST FOR ID CODE RESPONSE JNZ LDE1 NOT ID REQUEST MVI A,#20 ALWAYS HAVE EXT ANI #20 TEST FOR ID SWITCHES MVI A,#7C RELOAD ECHO CODE. JZ ECHO.ST NO ID SWITCHES, SEND BACK ECHO CODE MVI C,00 IN IDCHAN*32+IDLSBS ADD LOWER 8 BITS IF ID CALL LDE3 SET ID CODE IN ECHO RESPONSE MVI C,#20 IN IDCHAN*32+IDMSBS LOAD UPPER BITS OF ID CODE. CALL LDE3 SET ID CODE IN ECHO RESPONSE. RET * LDE3 EQU $ MOV B,A SAVE ID CODE. ANI #0F MASK OFF LOWER 4 BITS ORA C ADD ID RESPONSE NUMBER PUSH B SAVE ID CODE AND RESPONSE CALL ECHO.ST STORE CODE FOR TRANSMIT POP B RETRIEVE ID CODE MOV A,B RRC POSITION UPPER RRC FOUR BITS RRC OF ID CODE FOR RRC ECHO RESPONSE. ANI #0F MASK OFF UNWANTED BITS. ORA C ADD RESPONSE ORI #10 NUMBER FOR 'P'L'A'T'O JMP ECHO.ST STORE CODE FOR TRANSMIT * LDE1 EQU $ CPI #7B TEST FOR AUDIBLE ALERT JNZ LDE1.A IN TPCHAN*32+TOUCHD SOUND TONE AND RETURN RET LDE1.A EQU $ CPI #70 TEST FOR TERMINAL TYPE JNZ LDE1.B LDA M.TYPE LOAD TERMINAL TYPE JMP ECHO.ST LDE1.B EQU * CPI #71 TEST FOR SUB TYPE JNZ LDE1.C MVI A,3 JMP ECHO.ST LDE1.C EQU * CPI #72 TEST FOR LOADFILE JNZ LDE1.D IN RSF.PANL*32+PANLSWCH ANI #0E0 RLC RLC RLC JMP ECHO.ST LDE1.D EQU * CPI #73 TEST FOR CONFIG JNZ LDE2 MVI A,0 JMP ECHO.ST LDE2 EQU $ CPI #7D TEST FOR SENDING JNZ ECHO.ST LHLD MEMREG MOV A,M ANI #7F * ECHO.ST EQU $ ORI #80 INCLUDE ECHO CODE MOV L,A AND STORE MVI H,00 IN TRANSMIT FIFO. CALL P.XMIT RET ************************************************************************ * * LOAD MEMORY ADDRESS THIS INSTRUCTION LOADS THE MEMORY * ADDRESS REGISTER WITH BITS 01-15. THIS INSTRUCTION * SPECIFIES THE FIRST STORAGE ADDRESS TO BE USED UPON ENTRY * INTO A MODE 2 OPERATION. * ************************************************************************ LDA EQU $ CALL ESCCTL CHECK FOR COMMAND CHANGE CALL GET3 GET NEXT 3 BYTES XRA A CLEAR THE STA BC.REG BLOCK CHECK REGISTER. MVI A,#82 STA MODE SELECT LOAD MEM. DATA MODE MOV A,L ANI #3F RLC ADD D MOV H,A MOV L,E CALL CHKRG CHECK ADDRESS RANGE SHLD MEMREG STORE ADDRESS INTO MEMORY REGISTE RET * CHKRG EQU $ MEMREG RANGE CHK MOV A,H CPI #22 JC POPRET JNZ CHKRG.1 MOV A,L CPI #EA JC POPRET CHKRG.1 EQU $ MOV A,H CPI #7F JZ CHKRG.2 JNC POPRET RET CHKRG.2 EQU * MOV A,L CPI #FF JZ POPRET RET * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * SSF (SELECT SPECIAL FUNCTION) * * THIS INSTRUCTION ESTABLISHES SPECIAL FUNCTIONS WITHIN THE * TERMINAL AND SELECTS THE VARIOUS OUTPUT DEVICES. BITS 11 THRU * 15 SPECIFY THE DEVICE OR SPECIAL FUNCTIONS AND BITS 01 * THRU 10 SPECIFY CONTROL FUNCTIONS. * * FUNCTION TYPE (BITS 11 THRU 15) * 00 SELECT SLIDE PROJECTOR * 01 SET INTERRUPT MASK * 02 SERIAL CHANNEL DATA * 04-1F PARALLEL CHANNEL DATA/CONTROL * * FUNCTION OPERATIONS (BITS 01 THRU 10) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * TEST FOR EXISTENCE OF EXTERNAL INTERFACE. * SSF EQU $ CALL ESCCTL CHECK FOR COMMAND CHANGE CALL GET3 GET NEXT 3 BYTES MVI A,#3F LOAD LOWER ANA L 15 BITS INTO RLC HL REGISTER ORA D FOR PROCESSING. MOV H,A MOV L,E * SSF.X EQU $ MOV A,H LOAD UPPER BITS RRC RRC ANI #1F * * TEST FUNCTION TYPE * * CPI 02 TEST FOR INTERRUPT MASK RZ RETURN IF TRY FOR SERIAL CPI 01 JZ SSF.3 SET INTERRUPT MASK * MOV E,A SAVE ADDRESS BITS XRA A TEST FOR SLIDE PROJECTOR ORA E ADDRESS JZ SSF.1 MVI A,02 AND TEST ANA H FOR INPUT OR OUTPUT. MVI A,#E0 LOAD UPPER ADDRESS BITS JNZ SSF.2 GO TO INPUT * * SELECT EXTERNAL DEVICE * ORA E LOAD DEVICE ADDRESS STA EXT.OUT+4 AND STORE FOR OUTPUT MVI A,01 TEST FOR ANA H OUTPUT BYPASS RNZ * MOV A,L LOAD SLIDE DATA CALL EXT.OUT RET * * SLIDE PROJECTOR * SSF.1 EQU $ MOV A,L LOAD DATA OUT EXTCH7*32+SLDATA0 OUTPUT SLIDE PROJECTOR DATA. MVI A,03 LOAD LAMP AND SHUTTER BITS ANA H FOR SLIDE PROJECTOR. OUT EXTCH7*32+SLDATA1 OUTPUT SLIDE PROJECTOR DATA. RET * * INPUT FROM EXTERNAL DEVICE. * * SSF.2 EQU $ ORA E LOAD DEVICE ADDRESS STA EXT.IN+1 AND STORE IN INSTRUCTION. MVI A,01 ANA H TEST FOR RNZ DATA BYPASS. CALL EXT.IN INPUT DEVICE DATA. MOV L,A AND LOAD UP FOR LDA M.KSW LOAD USER/PLATO FLAG CPI 03 RZ RETURN IF USER SELECTED MVI H,#82 FOR TRANSMIT TO PLATO. CALL P.XMIT HL - TRANSMIT FOR P.XMIT RET * SSF.3 EQU $ MOV A,L ANI #20 JZ SSF.5 IN TPCHAN*32+TOUCHS INPUT T.P.STATUS RAR TEST FOR CHAR. READY JNC SSF.5 CHAR.NOT RDY,ENABLE IN TPCHAN*32+TOUCHD DUMMY INPUT TO CLEAR SSF.5 EQU $ MOV A,L JMP ENAB * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * EXT (LOAD EXTERNAL DEVICE) * * THIS INSTRUCTION PASSES DATA TO THE DEVICE SELECTED BY THE * SSF INSTRUCTION. ALL 19 BITS OF THE INSTRUCTION ARE PASSED * IN THE FOLLOWING MANNER. * * OUTPUT DATA FUNC. 1 BITS 01-08 * OUTPUT DATA FUNC. 2 BITS 09-16 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * TEST FOR EXISTANCE OF EXTERNAL INTERFACE. * EXT EQU $ * CALL ESCCTL CALL GET3 DAD H ROTATE UPPER 9 BITS LEFT. MOV A,L LOAD BITS 10 THRU 16 ORA D ADD BIT 09 CALL EXT.OUT EXT AND OUTPUT TO DEVICE. MOV A,E LOAD MIDDLE BITS OF EXT JMP EXT.OUT AND OUTPUT TO DEVICE. STATEX PUSH A LDA EXT.OUT+4 LOAD DEVICE ADDRESS ANI #1E IS SERIAL DATA/CONTROL CPI #02 IF YES, LOOP JNZ EXT.2 OTHERWISE,CONTINUE EXT.1 IN EXTCH7*32+EXTSTAT LOOP UNTIL CHARACTER ANI #02 REQUEST IS UP JZ EXT.1 EXT.2 POP PSW RET ************************************************************************ * * MODE 0 IS THE POINT PLOTTING MODE. EACH MODE 0 DATA WORD * SPECIFIES THE ADDRESS OF A POINT ON THE DISPLAY TO BE WRITTEN * OR ERASED. BIT 02 OF THE LDM INSTRUCTION DETERMINES WHETHER IT * IS A WRITE OR ERASE OPERATION * ************************************************************************ STA COMMAND+1 MVI A,#30 STA COMMAND+2 LXI H,COMMAND * POINT2 CALL OUTCOORD GO OUTPUT COORDINATES TO DISPLAY * POINT3 EQU $ LDA M.MODE LOAD MODE WRITE ERASE BITS RLC ANI #06 OUT DISCHAN*32+DISCON2 SET WRITE ERASE BITS MVI A,#A0 OUT DISCHAN*32+DISCON1 VECT/Y SHORT/X POS XRA A OUT DISCHAN*32+DISDATA MVI A,#F8 OUT DISCHAN*32+DISCON1 VECTOR/INHIBIT/Y SHORT/ X NE XRA A OUT DISCHAN*32+DISDATA DECREMENT X AXIS RET ************************************************************************ * * MODE 1 IS THE VECTOR DRAWING MODE. EACH MODE 1 DATA WORD * SPECIFIES THE TERMINATING COORDINATES OF A LINE,THE ORGIN OF * WHICH IS CONTAINED IN THE X AND Y REGISTER. THE TERMINAL POINT * OF A GIVEN LINE IS ALSO THE ORIGIN OF THE NEXT LINE. LINE * ORIGINS CAN BE RELOCATED BY THE LDC INSTRUCTION WITHOUT * EXITING FROM MODE 1 * ************************************************************************ LINE EQU $ CALL ASSEMBLE LOAD X AND Y COORDINATES. * LINE1 EQU $ MVI B,01 LOAD MASK MOV A,H LOAD UPPER BIT OF X ANA B AND MASK UNWANTED BITS MOV H,A MOV A,D LOAD UPPER BIT OD Y ANA B AND MASK UNWANTED BITS. MOV D,A SHLD XEND STORE X END POINT XCHG SHLD YEND STORE Y END POINT ************************************************************************ * * VECTOR GENERATOR SUBROUTINE * ************************************************************************ * * THE ALGORITHM IMPLEMENTED FOR THE VECTOR GENERATOR IS THE * UNIT INCREMENT DIGITAL DIFFERENTIAL ANALYZER. THE DDA * GENERATES POINTS THAT ARE SPACED ONE UNIT APART ALONG THE * AXIS OF GREATER DELTA. THE SPACING IN THE OTHER DIRECTION * IS MERELY THE SLOPE. IN EQUATION FORM THE ABOVE CAN BE STATED A * * Y(0)=Y(I)+1/2 X(0)=X(I) * Y(N)=Y(N-1)+DELTA Y/DELTA X X(N)=X(N-1)+1 * * OR * * X(0)=X(I)+1/2 Y(0)=Y(I) * X(N)=X(N-1)+DELTA X/DELTA Y Y(N)=Y(N-1)+1 * * TO PREVENT THE GENERATED LINE FROM BEING BIASED TO LIE * ON ONE SIDE OF THE IDEAL LINE THE POINTS ARE ROUNDED TO THE * NEAREST INTEGER. ROUNDING IS EQUIVALENT TO ADDING 1/2 TO THE * INITIAL VALUE * ************************************************************************ * * PARAMETER LOCATIONS UPON ENTRY * * LOCATION USEAGE * * XREG X BEGINNING POINT * XEND X ENDING POINT * YREG Y BEGINNING POINT * YEND Y ENDING POINT * * PARAMETER LOCATIONS UPON EXIT * * XDELTA XEND-XREG OR XREG-XEND * YDELTA YEND-YREG OR YREG-YEND * SLOPE XDELTA/YDELTA OR YDELTA/XDELTA * VECFLAG FLAG * * BITS 1-3 UNUSED * BIT 4 X SIGN (1 NEG 0 PO * BIT 5 Y SIGN (1 NEG 0 PO * BIT 6 LARGEST DELTA (1=X * BIT 7-8 UNUSED * ************************************************************************ * * WRITE OR ERASE FIRST POINT OF VECTOR * MVI C,#80 SET VECTOR MODE. * LDA M.MODE LOAD MODE WRITE ERASE BITS RLC ANI #06 OUT DISCHAN*32+DISCON2 SET WRITE/ERASE BITS LHLD XREG LOAD CURRENT X COORDINATE CALL CALDELX LHLD YREG LOAD CURRENT Y COORDINATE CALL CALDELY ************************************************************************ * * DETERMINE IF 45 DEGREE ANGLE AND IF DELTA X GREATER DELTA Y * ************************************************************************ MOV A,L ORA H TEST FOR ZERO JZ VECTOR6 VECTOR4A CALL COMPHL XCHG LHLD XDELTA LOAD DELTA X DAD D DELTA Y MINUS DELTA X JC VECTOR5 JUMP IF CARRY * * DELTA Y GREATER THAN DELTA X * LHLD YDELTA LOAD DELTA Y CALL COMPHL XCHG LHLD XDELTA LOAD DELTA X MOV A,C LOAD OUTPUT FUNCTION FOR VECTOR JMP VECTOR7 JUMP TO OUTPUT FUNCTION * * DELTA Y IS EQUAL TO OR LESS THAN DELTA X * VECTOR5 MOV A,L ORA H TEST FOR ZERO JZ VECTOR8 JUMP IF ANGLE IS 45 DEGREES * VECTOR6 LHLD XDELTA LOAD DELTA X CALL COMPHL XCHG PLACE DIVISOR INTO REGISTER PAIR LHLD YDELTA LOAD DELTA Y MOV A,C LOAD FLAG ADI #20 SET BIT TO INDICATE Y SHORT AXIS * VECTOR7 OUT DISCHAN*32+DISCON1 OUTPUT CONTROL 1 FUNCTION STA VECFLAG ************************************************************************ * * FRACTIONAL DIVIDE ROUTINE * ************************************************************************ * * DIVIDEND REGISTER PAIR HL * DIVISOR REGISTER PAIR DE * QUOTIENT REGISTER PAIR BC * ************************************************************************ DIV0 LXI B,#0040 SET COUNTER TO TEM PLACE ACCURACY DIV1 DAD H SHIFT DIVIDEND LEFT ONE PLACE SHLD SAVE SAVE DIVIDEND VALUE DAD D SUBTRACT DIVISOR FROM DIVIDEND JC DIV2 JUMP IF CARRY SET * LHLD SAVE RESTORE DIDIDEND TO ORIGINAL VALUE * * THIS CODE SHIFTS QUOTIENT INTO REISTER PAIR BC * DIV2 EQU $ MOV A,C RAL MOV C,A MOV A,B RAL MOV B,A * JNC DIV1 REPEAT IF NOT COMPLETE. * * LEFT JUSTIFY FRACTIONAL QUOTIENT * MOV L,C TRANSFER REG PAIR BC TO REG PAIR HL MOV H,B * DAD H SHIFT REG PAIR HL LEFT SIX PLACES DAD H DAD H DAD H DAD H DAD H * XCHG SAVE FRACTIONAL ANSWER JMP CALPT1 GO TO CALCULATE POINTS ************************************************************************ * * INITIALIZE FOR A 45 DEGREE ANGLE * ************************************************************************ VECTOR8 MOV A,C LOAD FUNCTION CODE OUT DISCHAN*32+DISCON1 OUTPUT STA VECFLAG LXI D,#FFFF SET SLOPE TO ALL ONES. ************************************************************************ * * THIS ROUTINE CALCULATES INCREMENTAL MOVEMENTS AND * OUTPUTS THEM TO THE DISPLAY * ************************************************************************ * * REGISTER PAIR HL FRACTIONAL PARTIAL SUM * REGISTER PAIR DE SLOPE * REGISTER PAIR BC LOOP COUNT * ************************************************************************ * * INITIALIZE LOOP COUNT INTO REGISTER PAIR BC * CALPT1 LDA VECFLAG LHLD XDELTA ANI #20 TEST FOR LARGEST DELTA. JNZ CALPT2 DELTA X IS LONG AXIS. * LHLD YDELTA CALPT2 EQU $ MOV C,L MOV B,H LXI H,#8000 LOAD ROUNDING FACTOR INTO PARTIAL MOV A,C TEST FOR LOWER 8 BITS LENGTH EQUA ANA A JZ CALPT5A ************************************************************************ * * INCREMENTAL CALCULATION LOOP * ************************************************************************ * CALPT5 DAD D SHORT AXIS PLUS SLOPE RAR SHIFT CARRY INTO A REGISTER OUT DISCHAN*32+DISDATA DCR C DECREMENT LOOP COUNT (LOWER 8 BIT JNZ CALPT5 JUMP IF NOT COMPLETE * CALPT5A EQU $ DCR B DECREMENT UPPER BITS JP CALPT5 RETUN IF NOT COMPLETE. * * PLACE X AND Y END COORDINATES INTO X AND Y REGISTERS * WHICH BECOMES THE BEGGINNING POINT OF THE NEXT VECTOR * CALPT6 EQU $ LHLD YEND XCHG LHLD XEND * JMP POINT2 DISPLAY LAST POINT ************************************************************************ * * MODE 2 IS THE LOAD TERMINAL MEMORY MODE. EACH MODE 2 DATA * WORD CONTAINS A 16 BIT WORD TO BE STORED IN THE MEMORY * LOCATION SPECIFIED BY THE CONTENTS OF THE MEMORY ADDRESS * REGISTER. AFTER THE DATA HAS BEEN STORED, THE MEMORY ADDRESS * REGISTER IS INCREMENTED BY ONE, THUS DATA CAN BE STORED * SEQUENTIALLY IN MEMORY BY TRANSMITTING ONLY MODE 2 DATA WORDS. * THE CONTENTS OF THE MEMORY ADDRESS REGISTER CAN BE CHANGED AT * ANY TIME WITH THE LDA INSTRUCTION * WHEN DISPLAYED ON THE DISPLAY THE DATA APPEARS AS A VERTICAL * COLUMN WITH BIT 01 AT THE BOTTOM AND BIT 16 AT THE TOP. * ************************************************************************ * * ASSEMBLE 16 BIT MODE 2 DATA WORD AND STORE IN CHAR MEMORY * MEMORY EQU $ CALL ESCCTL CHECK FOR COMMAND CHANGE CALL GET3 GET NEXT 3 BYTES DAD H ROTATE LEFT MOV A,L FROM ORA D SAVE IN MOV D,A DE REGISTER PAIR. MOV B,H SAVE BLOCK CHECK BITS. * * STORE DATA WORD INTO CHARACTER MEMORY * MEMORY1 LHLD MEMREG LOAD CHARACTER MEMORY ADDRESS REG CALL CHKRG * * MOV M,E STORE LOWER BYTE INTO MEMORY INX H INCREMENT MEMORY ADDRESS REGISTER MOV M,D STORE UPPER BYTE INTO MEMORY INX H INCREMENT MEMORY ADDRESS REGISTER SHLD MEMREG STORE MEMORY ADDRESS RET * MEMORY2 EQU $ LXI H,BC.REG LOAD ADDRESS OF BLOCK CHECK REGISTER MOV A,E LOAD LOWER BYTE OF DATA CALL BLK.CHK DO BLOCK CHECK ROUTINE. * MOV A,D LOAD UPPER BYTE OF DATA * THIS ROUTINE CALCULATES THE BLOCK CHECK AND TEST RESULTS. * IF RESULTS ARE INCORRECT, A UNSOLICITED STATUS IS TRANSMITTED, * TELLING THE PLATO SYSTEM TO RETRANSMIT THE BLOCK OF DATA. BLK.CHK EQU $ XRA M DO EXCLUSIVE OR RLC AND ROTATE RESULTS. MOV M,A STORE RESULTS AS NEW CHECK VALUE. ORA M TEST BLOCK CHECK RESULT MOV A,B LOAD BLOCK CHECK BITS RAR AND TEST FOR BLOCK CHECK THIS BYTE. MOV B,A SAVE BLOCK CHECK BITS. RNC NO CHECK, GET NEXT BYTE. RZ BLOCK CHECK CORRECT. MOV M,00 LXI H,#0385 LOAD UNSOLICITED STATUS CALL P.XMIT RET ************************************************************************ * * MODE 3 - CHARACTER MODE ONLINE ENTRY * IF NOT ESC OR CTL CODE BUILD * COMMAND - CODE/ESC/#30 * CHARACT EQU $ CALL ESCCTL MOV A,C STA COMMAND MVI A,#1B STA COMMAND+1 MVI A,#30 STA COMMAND+2 LXI H,COMMAND CALL R.CHARS RET ************************************************************************ * * MODE 4 IS BLOCK ERASE EACH PAIR OF DATA WORDS SPECIFIES * THE CORNERS OF AN AREA TO BE ERASED. THE AREA ERASED IS THAT * ENCLOSED BY THE ABSOLUTE VALUE OF X2-X1 AND Y2-Y1. * * * X1,Y1 * * **************************************** * * * * * * * * * * * * * * AREA ERASED * * * * * * * * * * * * * **************************************** * * X2,Y2 * ************************************************************************ BLOCK EQU $ MVI C,04 LOAD TRANSFER COUNT. LXI D,BLOCKX LOAD DESTINATION ADDRESS. * BLOC1 EQU $ MOV A,M LOAD X/Y DATA STAX D AND STORE FOR PROCESSING, INX H INCREMENT SOURCE ADDRESS INX D INCREMENT DESTINATION ADDRESS. MOV A,M LOAD UPPER BITS ANI 01 MASK FOR BIT 9 OF COORDINATE. STAX D AND STORE. INX H INCREMENT TO INX D NEXT ADDRESS. DCR C DECREMENT COUNT JZ MODE4A PROCESS DTAT IF COUNT ZERO JMP BLOC1 ELSE GET NEXT BYTE. ************************************************************************ * * CALCULATE ABSOLUTE DELTA X AND Y * ************************************************************************ * * PARAMETER LOCATIONS UPON ENTRY * * BLOCKX X1 COORDINATE * BLOCKY Y1 COORDINATE * XEND X2 COORDINATE * YEND Y2 COORDINATE * ************************************************************************ MODE4A MVI C,#00 CLEAR DIRECTION FLAGS LHLD BLOCKX CALL CALDELX CALCULATE DELTA X LHLD BLOCKY CALL CALDELY CALCULATE DELTA Y MOV A,C STA BLOCKF SAVE DIRECTION FLAGS * * TEST FOR POSITIVE DELTA Y * ANI #10 MASK OFF X DIRECTION BIT LHLD BLOCKY LOAD Y1 COORDINATE JNZ YSTART * NEGY LHLD YEND LOAD Y2 COORDINATE * * SET Y STARTING ADDRESS * YSTART MOV A,L OUT DISCHAN*32+YCOORD OUTPUT Y START ADDRESS IN DISCHAN*32+XYREAD GET X REGISTER BIT 9 ANI #01 MOV L,A SAVE X REGISTER BIT 9 MOV A,H RLC ORA L ADD X REGISTER BIT 9 ADI #04 ADD ENABLE LOAD COORDINATE BIT OUT DISCHAN*32+DISCON1 * * SET WRITE/ERASE BITS * LDA M.MODE LOAD MODE WRITE ERASE BITS RLC ANI #06 OUT DISCHAN*32+DISCON2 * LHLD YDELTA LOAD NUMBER OF LINES INX H XCHG LHLD XDELTA INX H SHLD XSAVE SAVE COORDIMATE. * * TEST FOR POSITIVE DELTA X * LDA BLOCKF ANI #08 MASK OFF Y DIRECTION BIT LHLD BLOCKX LOAD X1 COORDINATE JZ NEGX1 * NEGX LHLD XEND LOAD X2 COORDINATE NEGX1 MOV A,H ANI #01 MASK IF WRAP AROUND MOV B,A MOV C,L ************************************************************************ * * BLOCK WRITE/ERASE INCREMENTAL LOOP * ************************************************************************ * * REGISTER PAIR BC BASELINE ADDRESS FOR X * REGISTER PAIR HL NUMBER OF POINTS PER LINE * REGISTER PAIR DE NUMBER OF LINES PER BLOCK * ************************************************************************ * * RESET X BASELINE ADDRESS FOR NEXT LINE * XSTART MOV A,C OUT DISCHAN*32+XCOORD OUTPUT BASELINE ADDRESS LOWER 8 IN DISCHAN*32+XYREAD GET Y REGISTER BIT 9 ANI #02 SAVE Y REGISTER BIT 9 ADD B ADI #A4 VEC/XPOS/YPOS/YSHORT/ENABLE OUT DISCHAN*32+DISCON1 LHLD XSAVE LOAD NUMBER OF POINTS PER LINE * * PUSH B SAVE BC ON STACK LXI B,#FFF8 AND LOAD -8 * BLKER.1 EQU $ MOV A,C TEST FOR GREATER THAN ANA L EIGHT FOR FAST ERASE. JZ BLKER.3 LESS THAN, TEST UPPER BIT. XRA A CLEAR A REGISTER * BLKER.2 EQU $ OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA BLOCK ERASE/WRITE OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA DAD B SUBTRACT EIGHT FROM COUNT. CMP L AND TEST FOR ZERO JNZ BLKER.1 NOT ZERO, DO AGAIN. * BLKER.3 EQU $ CMP H AND TEST UPPER BIT OF COUNT. JNZ BLKER.2 NOT ZERO, OUTPUT ANOTHER EIGHT. * POP B RESTORE BC REGISTERS CMP L AND TEST FOR ZERO COUNT. JZ BLOCK2 COMPLETED, TEST Y AXIS. BLOCK1 OUT DISCHAN*32+DISDATA DCR L JNZ BLOCK1 JUMP IF LINE NOT COMPLETE * * * TEST FOR COMPLETION OF BLOCK * BLOCK2 EQU $ DCX D DECREMENT THE LINE COUNT MOV A,E AND TEST FOR ORA D LAST LINE COMPLETED. JZ BLOCK4 COMPLETED, END BLOCK WRITE/EREASE. * * INCREMENT Y AXIS BY ONE * BLOCK3 EQU $ MVI A,#D0 VEC/INHIBIT/XSHORT/YNEG OUT DISCHAN*32+DISCON1 XRA A CLEAR A REGISTER OUT DISCHAN*32+DISDATA INCREMENT Y AXIS JMP XSTART * BLOCK4 EQU $ LHLD BLOCKY LOAD Y1 COORDINATE LXI D,#FFF1 SET TO MINUS 15 DAD D Y1 MINUS 15 CALL OUTY OUTPUT Y COORDINATE. LHLD BLOCKX LOAD X COORDINATE JMP OUTX OUTPUT X COORDINATE. * * * * * * * * * * * * * * * * * * * * * * * * * * THESE MODES ARE RESERVED FOR USE BY THE USER. USING 7ODE 2, * THE USER MAY LOAD A ROUTINE INTO THAT AREA OF MEMORY ALLOCATED * FOR HIS USE.THE ADDRESS OF THAT ROUTINE IS LOADED UNDER * MODE 5 ,6, OR 7 TAG. * BY USING THE LDM INSTRUCTION, THE USER CAN CALL THAT ROUTINE. * THE USER MUST EXIT THE ROUTINE WITH A RETURN INSTRUCTION * TO INSURE THAT CONTROL IS PASSED CORRECTLY TO THE * RESIDENT FIRMWARE. * * * * * * * * * * * * * * * * * * * * * * * * * * MODE5 EQU * CALL ESCCTL LHLD MODE5A JMP MODESEL SELECT MODE WITH HL JUMP. * MODE6 EQU * CALL ESCCTL LHLD MODE6A JMP MODESEL SELECT MODE WITH HL JUMP. * MODE7 EQU * CALL ESCCTL LHLD MODE7A * MODESEL EQU $ SHLD MODEADR SAVE ABSOLUTE MODE ADDRESS CALL GET3 GET NEXT 3 BYTES DAD H AND SHOFT MOV C,H IT INTO MOV A,L REGISTERS ORA D C, D, AND E. MOV D,A LHLD MODEADR RETURN ABSOLUTE MODE ADDRESS PCHL MODE567 EQU * MOV A,C SBI #4F MOV C,A LDA MODE UPDATE MODE ANI #C0 ORA C STA MODE MOV A,C ADD A ADD A MOV C,A LDA M.MODE UPDATE M.MODE ANI #E3 ORA C STA M.MODE XRA A STA NBYTES RET * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * S U B R O U T I N E S * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * SIZE ONE CHARACTER GENERATOR * * THIS ROUTINE OUTPUTS TWO BYTES OF A 8 X 16 CHARACTER * TO THE DISPLAY. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * TWICE XRA A SET ZERO FLAG CHAR.S1 EQU $ LDAX D LOAD BYTE OF CHARACTER DATA INX D INCREMENT CHARACTER ADDRESS OUT DISCHAN*32+DISDATA OUTPUT BYTE RAR OUT DISCHAN*32+DISDATA OUTPUT RAR OUT DISCHAN*32+DISDATA CHARACTER RAR OUT DISCHAN*32+DISDATA DATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RZ RETURN AFTER SECOND PASS JMP TWICE * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * SIZE TWO CHARACTER GENERATOR * * THIS ROUTINE OUTPUTS TWO BYTES OF A 16 X 32 CHARACTER * TO THE DISPLAY. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * TWICE1 XRA A SET ZERO FLAG CHAR.S2 EQU $ LDAX D LOAD CHARACTER DATA BYTE INX D INCREMENT DATA ADDRESS OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA OUT DISCHAN*32+DISDATA JNZ TWICE1 CHECK FOR SECOND PASS MOV A,B LOAD COLUMN COUNT RAR AND TEST FOR RC DCX D DECREMENT THE DATA DCX D POINTER RET * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * DISPLAY TAB ROUTINE. * * THIS ROUTINE SET THE X AND Y REGISTERS TO TAB FOR * THE NEXT CHARACTER POSITION. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * DISP.TAB EQU $ LHLD XREG LOAD CURRENT X XCHG AND SAVE IN DE LHLD X.PLOT LOAD X CHARACTER PLOT DAD D ADD TO CURRENT X CALL OUTX OUTPUT X COORDINATE. LHLD YREG LOAD CURREMT Y XCHG AND SAVE IN DE LHLD Y.PLOT LOAD Y CHARACTER PLOT DAD D ADD TO CURRENT Y JMP OUTY OUTPUT Y COORDINATE. * * * * * * * * * * * * * * * * * * * * * * * * * * INPUT X COORDINATE TO HL REGISTER PAIR. * * * * * * * * * * * * * * * * * * * * * * * * * INPX EQU $ IN DISCHAN*32+XREAD INPUT LOWER BITS OF X MOV L,A AND SAVE IN L REGISTER. IN DISCHAN*32+XYREAD NPUT UPPER BIT ANI 01 MASK MOV H,A AND SAVE IN H REGISTER. RET RETURN TO CALLER. * * * * * * * * * * * * * * * * * * * * * * * * * * INPUT Y COORDINATE TO HL REGISTER PAIR. * * * * * * * * * * * * * * * * * * * * * * * * * INPY EQU $ IN DISCHAN*32+YREAD INPUT LOWER BITS OF Y MOV L,A AND SAVE IN L REGISTER. IN DISCHAN*32+XYREAD NPUT UPPER BIT ANI 02 MASK RRC MOV H,A AND SAVE IN H REGISTER. RET RETURN TO CALLER. * * * * * * * * * * * * * * * * * * * * * * * * * * SUBROUTINE TO STEP Y AXIS. * * * * * * * * * * * * * * * * * * * * * * * * * STEPY EQU $ CALL INPY INPUT CURRENT Y COORDINATE. * LDA M.DIR LOAD STEP DIRECTION BIT ANI 01 AND MASK INX H INCREMENT COORDINATE JZ OUTY AND OUTPUT. * DCX H ELSE DECREMENT DCX H COORDINATE JMP OUTY AND OUTPUT * * * * * * * * * * * * * * * * * * * * * * * * * * SUBROUTINE TO STEP X AXIS * * * * * * * * * * * * * * * * * * * * * * * * * STEPX EQU $ CALL INPX INPUT CURRENT X COORDINATE. * LDA M.DIR LOAD STEP DIRECTION BIT ANI 02 AND MASK INX H INCREMENT COORDINATE JZ OUTX AND OUTPUT. * DCX H ELSE DECREMENT DCX H COORDINATE JMP OUTX AND OUTPUT * * * * * * * * * * * * * * * * * * * * * * * * * * SUBROUTINE TO OUTPUT X COORDINATE TO THE DISPLAY. * * * * * * * * * * * * * * * * * * * * * * * * * OUTX EQU $ MVI A,01 CHOP OFF UNWANTED ANA H BITS THAT WILL MOV H,A SCREW THINGS UP. SHLD XREG STORE NEW X COORDINATE. MOV A,L LOAD LOWER 8 BITS OUT DISCHAN*32+XCOORD ND OUTPUT TO DISPLAY. IN DISCHAN*32+XYREAD PUT UPPER BITS OF X AND Y ANI 02 MASK Y ORA H INCLUDE NEW X BIT ORI 04 SET LOAD ENABLE OUT DISCHAN*32+DISCON1 OUTPUT UPPER BITS OF X AND Y. RET RETURN TO CALLER * * * * * * * * * * * * * * * * * * * * * * * * * * SUBROUTINE TO OUTPUT Y COORDINATE TO THE DISPLAY. * * * * * * * * * * * * * * * * * * * * * * * * * OUTY EQU $ MVI A,01 CHOP OFF UNWANTED ANA H BITS THAT WILL MOV H,A SCREW THINGS UP. SHLD YREG STORE NEW Y COORDINATE. MOV A,L LOAD LOWER 8 BITS OUT DISCHAN*32+YCOORD ND OUTPUT TO DISPLAY. IN DISCHAN*32+XYREAD NPUT CURRENT UPPER BITS ANI 01 MASK X COORDINATE BIT RRC SHIFT IN ORA H NEW Y BIT RLC ORI 04 SET LOAD ENABLE BIT OUT DISCHAN*32+DISCON1 OUTPUT NEW UPPER BITS RET RETURN TO CALLER. * * * * * * * * * * * * * * * * * * * * * * * * * * OUTPUT X AND Y COORDINATES . * Y COORDINATE DE REGISTER PAIR * X COORDINATE HL REGISTER PAIR * * * * * * * * * * * * * * * * * * * * * * * * * OUTCOORD EQU $ CALL OUTX SET X COORDINATE. XCHG JMP OUTY SET Y COORDINATE. * * * * * * * * * * * * * * * * * * * * * * * * * * USED TO CALL A ROUTINE WITH CONTENTS OF HL REGISTERS. * * * * * * * * * * * * * * * * * * * * * * * * * INDIRECT EQU $ PCHL * NOOP EQU $ RET * * * * * * * * * * * * * * * * * * * * * * * * * * STORE DIRECTION BITS FOR COORDINATE STEP ROUTINES. * * * * * * * * * * * * * * * * * * * * * * * * * DIR EQU $ SHLD M.DIR STORE STEP DIRECTION BITS RET * * * * * * * * * * * * * * * * * * * * * * * * * * INPUT DATA TO USER INSTEAD OF TRANSMITING. * * * * * * * * * * * * * * * * * * * * * * * * * INPUT EQU $ LXI H,US.FIFO LOAD USER FIFO ADDRESS JMP FIFO.RD AND GET DATA. INDATA EQU $ LXI H,IN.BUF LOAD KB/TP INPUT BUFFER JMP FIFO.RD * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ENAB EQU $ STA M.ENAB STORE INTERRUPT MASK RLC RLC RLC TO OUTPUT OUT TPCHAN*32+TPCONT TOUCH PANEL. * RLC AND ROTATE TO RLC EXTERNAL BIT. ANI 01 ORI 01 ALWAYS ENABLE EXT CHANNEL OUT EXTCH5*32+EXTCNTL ABLE EXTERNAL DEVICE. RET * GET3 EQU $ MVI A,#3F ANA C MOV C,A LDA NBYTES CPI #02 JNZ GET3.1 MOV A,C STA COMMAND STORE HIGH 6 BITS XRA A STA NBYTES STA CMODE CALL ASSEMBLE RET GET3.1 EQU $ CPI #01 JNZ GET3.2 MOV A,C STA COMMAND+1 STORE MIDDLE 6 BITS JMP GET3.R GET3.2 EQU $ MOV A,C STA COMMAND+2 STORE LOWER 6 BITS GET3.R EQU $ LXI H,NBYTES INR M POP H RET ASSEMBLE EQU $ LDA COMMAND+2 LOAD LOWER 6 BITS OF INPUT MOV E,A LDA COMMAND+1 RRC RRC MOV C,A ANI #C0 MASK ALL BITS BUT Y COORDINATE ADD E MOV E,A STORE LOWER 8 BITS Y COORDINATE MOV A,C ANI #01 MOV D,A STORE BIT 9 OF Y COORDINATE MOV A,C RRC ANI #07 MOV L,A STORE LOWER 3 BITS OF X COORDINAT LDA COMMAND LOAD UPPER BITS OF INPUT. RLC RLC RLC MOV C,A ANI #F8 ADD L MOV L,A STORE LOWER 8 BITS X COORD MOV A,C ANI #01 MOV H,A STORE BIT 9 OF X COORD RET * * * * * * * * * * * * * * * * * * * * * * * * * * THIS ROUTINE LOADS THE FIRST-IN-FIRST OUT BUFFER. * * * * * * * * * * * * * * * * * * * * * * * * FIFO.ST EQU $ MVI A,#C0 MASK CATAGORY BITS ANA H FOR DATA XCHG SAVE DATA INDE REGISTERS. * RLC ROTATE CATAGORY BITS RLC MOV B,A AND SAVE IN B REGISTER. * MVI A,03 MASK OFF ANA D FLAG MOV D,A BITS. LDA M.KSW LOAD USER/PLATO FLAG. ANA B TEST TO DETERMINE USER OR TRANSMIT B LXI H,IN.BUF LOAD ADDRESS OF KB/TP INB JZ FIFOS.1 AND STORE FOR TRANSMIT. * LXI H,US.FIFO LOAD ADDRESS OF USER BUFFER, BIT SET. * FIFOS.1 EQU $ MVI A,07 AND TEST FOR CMP M FULL BUFFRR. RZ BUFFER FULL, RETURN TO CALLER. * INR M NOT FULL, ADD ONE TO DIFF. COUNTER. INX H INCREMENT TO INPUT POINTER. ANA M MASK LOWER BITS, RLC AND SET FOR TWO BYTE ADDRESSING. INR M ADD ONE TO INPOINTER. MVI B,00 LOAD BC REGISTERS MOV C,A WITH INPUT INDEX. INX H INCREMENT TO START OF INX H BUFFER STORE AREA. DAD B ADD INDEX TO BASE ADDRESS. MOV M,E STORE LOWER BITS. INX H MOV M,D STORE UPPER BITS. RET RETURN TO CALLER. * * * READ DATA FROM TRANSMIT BUFFER. * FIFO.RD EQU $ XRA A CLEAR A, AND CMP M TEST FOR DATA IN FIFO. LXI D,#8000 LOAD NO DATA CODE XCHG RZ RETURN IF NO DATA. XCHG DCR M SUBTRACT ONE FOOM DIFF.COUNT INX H INCREMENT TO INX H OUTPUT POINTER. MVI A,07 MASK POINTER ANA M TO LOWER BITS RLC AND SET FOR TWO BYTE ADDRESSING. INR M INCREMENT POINTER MVI D,00 LOAD DE WITH MOV E,A INDEX TO BUFFER. INX H INCREMENT TO START OF STORE AREA. DAD D ADD INDEX TO START OF BUFFER MOV E,M LOAD LOWER BITS INX H INCREMENT ADDRESS MOV D,M LOAD UPPER BITS. XCHG PLACE IN HL FOR TRANSFER. RET RETURN TO CALLER. * * * * * * * * * * * * * * * * * * * * * * * * * * CALCULATE START AND END POINT DIFFERANCE * * * * * * * * * * * * * * * * * * * * * * * * * CALDELX EQU $ XCHG LHLD XEND LOAD END POINT MVI B,#08 LOAD PLOTTING BIT CALL CALDEL DO CALCULATION. SHLD XDELTA STORE START AND END DIFFERANCE. RET * * CALDELY EQU $ XCHG LHLD YEND LOAD END POINT MVI B,#10 LOAD PLOTTING BIT CALL CALDEL DO CALCULATION. SHLD YDELTA STORE START AND END DIFFERANCE. RET * SAVESTUF EQU $ CALL R.INPX SAVE SCREEN POSITIONING SHLD G.XPOS CALL R.INPY SHLD G.YPOS RET * RESTORES EQU $ LHLD G.XPOS RESTORE SCREEN POSITIONING CALL R.OUTX LHLD G.YPOS CALL R.OUTY RET * XHAIR EQU $ CALL SAVESTUF LDA WIDTH RRC MOV L,A MVI H,00 CALL COMPHL XCHG CALL R.INPX DAD D CALL R.OUTX LDA HEIGHT RRC MOV L,A MVI H,00 CALL COMPHL XCHG CALL R.INPY DAD D CALL R.OUTY MVI C,#61 CALL DISCURSX CALL RESTORES RET * GIN EQU $ COMM LINE ENTRY TO GIN MODE CALL ESCCTL RET * GIN.A EQU $ KEYBOARD ENTRY TO GIN MODE CALL ESCCTL IS ESC SEQ. OR CTL CODE MOV A,C STA GIN.KEY SAVE GIN CHAR. KEY ANI #20 2 TO THE FIFTH SET'/ JNZ GIN.1 MVI B,4 COURSE GRID JMP GIN.2 GIN.1 EQU $ MVI B,1 FINE GRID GIN.2 EQU $ MOV A,B STA DOTS STORE GRID MOVEMENT VALUE MOV A,C CHARACTER CODE IN C ANI #DF CODE MASKED OUT 2 TO 5TH MOV B,A IN REGISTER B. LXI H,MOVTAB BASE OF CURSOR MOVE TABLE GIN.3 EQU $ MOV A,M CPI #FF JZ GIN.XMT NOT A CURSOR MOVE KEY CMP B CHECK FOR CURSOR MOVE KEY JZ MOVCURS INX H INX H INX H JMP GIN.3 MOVCURS EQU $ INX H MATCH FOUND SO JUMP TO MOV E,M CURSOR MOVE ROUTINE. INX H MOV D,M PUSH D SAVE DE ON STACK LDA ECURSOR ERASE CURSOR MOV B,A CALL DISCURS POP H CALL JMPHL RET * GIN.XMT EQU $ LDA LOC.RMT TEST FOR ONLINE ORA A RNZ RETURN, NOT ONLINE LDA GIN.KEY SEND LAST KEY STORED MOV C,A CALL XMIT.1 CALL ENQ.1 TRANSMIT CURSOR POSITION RET * * MOVTAB EQU $ DB #41 DW WEST DB #43 DW SEAST DB #44 DW EAST DB #45 DW NEAST DB #51 DW NWEST DB #57 DW NORTH DB #58 DW SOUTH DB #5A DW SWEST DB #FF * WEST EQU $ CALL MINUSX RET * SEAST EQU $ CALL PLUSX CALL MINUSY RET * EAST EQU $ CALL PLUSX RET * NEAST EQU $ CALL PLUSX CALL PLUSY RET * NWEST EQU $ CALL MINUSX CALL PLUSY RET * NORTH EQU $ CALL PLUSY RET * SOUTH EQU $ CALL MINUSY RET * SWEST EQU $ CALL MINUSX CALL MINUSY RET * MINUSX EQU $ LDA DOTS MOV L,A MVI H,00 CALL COMPHL PUSH H CALL R.INPX POP D DAD D CALL R.OUTX RET * MINUSY EQU $ LDA DOTS MOV L,A MVI H,00 CALL COMPHL PUSH H CALL R.INPY POP D DAD D CALL R.OUTY RET * PLUSX EQU $ LDA DOTS MOV L,A MVI H,00 PUSH H CALL R.INPX POP D DAD D CALL R.OUTX RET * PLUSY EQU $ LDA DOTS MOV L,A MVI H,00 PUSH H CALL R.INPY POP D DAD D CALL R.OUTY RET * * GIN.TP EQU $ PUSH D SAVE DATA ON STACK LDA ECURSOR ERASE CURSOR MOV B,A CALL DISCURS POP D RESTORE DATA PUSH D SAVE DATA AGAIN CALL GIN.TP1 GET Y COORD. CALL R.OUTY POP D DE _ DATA MOV A,E RRC RRC RRC RRC MOV E,A L HAS X TOUCH PANEL VAL. CALL GIN.TP1 GET X COORD CALL R.OUTX JMP IDLE14 * GIN.TP1 EQU $ MVI A,#0F MASK WITH LOWER 4 BITS ANA E MOV L,A MVI H,00 HL _ TOUCH PANEL VALUE DAD H MULTIPLY BY 32 DAD H DAD H DAD H DAD H LXI D,#0010 ADD 16 DAD D RET ********** * POINT PLOT MODE- GET X AND Y COORDINATES * AND CALL R.DOT TO OUTPUT POINT ********** * POINT EQU $ CALL ESCCTL CALL GETXY CALL R.DOT RET * ********** * BLOCK W/E MODE ********** * ABLOCK EQU $ CALL ESCCTL CHECK FOR ESC/CTL CODES CALL GETXY GET AN X AND Y COORD. LDA BTWICE SECOND SET COORDS ORA A JNZ XY2 SHLD X1 NO FIRST SET XCHG SHLD Y1 INR A STA BTWICE SET BTWICE TO TRUE*D RET * XY2 EQU $ SHLD X2 SECOND SET XCHG SHLD Y2 XRA A STA BTWICE TURN BTWICE OFF LXI H,X1 HL HAS ADDR. OF XY BUFF. CALL R.BLOCK RET * * GETXY EQU $ MOV A,C RESTORE DATA LXI H,NINPUT INCR. NUMBER OF INPUTS INR M OF CURRENT NO. INPUTS ANI #60 IF CHAR AND 60H=20H,HI Y CPI #20 JNZ LOYCHK OTHERWISE, CHECK FOR LO Y MVI A,#1F HIGH=(CHAR-32)*32. ANA C MOV L,A MVI H,0 DAD H DAD H DAD H DAD H DAD H HL=HIGH LDA NINPUT IF THIS INPUT IS FIRST CPI 1 IN SEQ. IT IS HIGH Y BYTE. JZ HIYBYTE SHLD HIX OTHERWISE, IT IS HIGH X POP PSW POP AND RET TO IDLE RET * HIYBYTE SHLD HIY POP PSW POP AND RET TO IDLE RET LOYCHK EQU $ CPI #60 IF CHAR AND 60H=60H, LO Y JNZ LOXCHK OTHERWISE,CHECK FOR LOW X MOV A,C ANI #1F LOY=(CHAR-32) STA LOY POP PSW POP AND RET TO IDLE RET * LOXCHK CPI #40 IF CHAR AND 60H=40H,LO X JNZ ERR ERR RETURN TO IDLE DEFAULT MOV A,C ANI #1F LOX=(CHAR-32) STA LOX LHLD HIX ORA L MOV L,A XCHG DE HAS X COORDINATE LXI H,NINPUT SET INPUTS BACK TO 0 MVI M,0 LDA LOY LHLD HIY ORA L MOV L,A XCHG DE HAS Y COORDINATE * HL HAS X COORDINATE XRA A CLEAR COMMAND MODE FLAG STA CMODE LDA SCALEFG LOAD SCALE/NO SCALE FLAG RAR RC IF SET, COORDS. AS IS..RET CALL DIVIDE OTHERWISE SCALE XCHG BY FACTOR OF 2 CALL DIVIDE TO MAP INTO 511X511 XCHG PUSH H SAVE X COORD. LHLD BIAS BIAS Y COORD. DAD D XCHG DE HAS BIASED Y COORD. POP H RET * ERR EQU $ POP PSW RET * G.LINE1 EQU $ SHLD XEND STORE X END POINT XCHG SHLD YEND STORE Y END POINT * ********** * VECTOR GENERATOR SUBROUTINE ********** * * 'THE ALGORITHM IMPLEMENTED FOR THE VECT. GEN. IS THE * UNIT INCREMENT DIGITAL DIFFERENTIAL ANALYZER. 'THE 'D'D'A * GENERATES POINTS THAT ARE SPACED ONE UNIT APART ALONG THE * AXIS OF GREATER DELTA. THE SPACING IN THE OTHER DIRECTION * IS MERELY THE SLOPE. 'I EQUA. FORM THE ABOVE CAN BE STATED * * Y(0)=Y(I)+1/2 X(0)=X(I) * Y(N)=Y(N-1)+DY/DX X(N)=X(N-1)+1 * OR * * X(0)=X(I)+1/2 Y(0)=Y(I) * X(N)=X(N-1)+DX/DY Y(N)=Y(N-1)+1 * * TO PREVENT THE GENERATED LINE FROM BEING BIASED TO LIE * ON ONE SIDE OF THE IDEAL LINE THE PTS. ARE ROUNDED TO THE * NEAREST INTEGER. 'ROUNDING IS SAME AS ADDING 1/2 TO THE * INITIAL VALUE. * * * PARAMETER LOCATIONS UPON ENTRY * * LOCATION USEAGE * * XREG X BEGINNING POINT * XEND X ENDING POINT * YREG Y BEGINNING POINT * YEND Y ENDING POINT * * PARAMETER LOCATIONS UPON EXIT * * XDELTA XEND-XREG / XREG-XEND * YDELTA YEND-YREG / YREG-YEND * SLOPE DX/DY OR DY/DX * VECFLAG FLAG * * * BITS 1-3 UNUSED * BIT 4 X SIGN * BIT 5 Y SIGN * BIT 6 BIG 'D * BIT 7-8 UNUSED * ********** * * WRITE OR ERASE FIRST POINT OF VECTOR * MVI C,#80 SET VECTOR MODE. * LDA M.MODE LOAD MODE WRITE ERASE BITS RLC ANI #06 OUT DISCHAN*32+DISCON2 SET WRITE/ERASE BITS LHLD XREG LOAD CURRENT X COORDINATE * * CALCULATE DELTA X * XCHG LHLD XEND LOAD END POINT MVI B,#08 LOAD PLOTTING BIT CALL CALDEL DO CALCULATION SHLD XDELTA STORE DIFFERANCE LHLD YREG LOAD CURRENT Y COORDINATE * * CALCULATE DELTA Y * XCHG LHLD YEND LOAD END POINT MVI B,#10 LOAD PLOTTING BIT CALL CALDEL DO CALCULATION SHLD YDELTA STORE DIFFERANCE * ***************************************** * * DETERMINE IF 45 DEGREE ANGLE AND IF DELTA X GREATER DELTA Y * ********************************************** MOV A,L ORA H TEST FOR ZERO JZ VECT6 VECT4A CALL COMPHL XCHG LHLD XDELTA LOAD DELTA X DAD D DELTA Y MINUS DELTA X JC VECT5 JUMP IF CARRY * * DELTA Y GREATER THAN DELTA X * LHLD YDELTA LOAD DELTA Y CALL COMPHL XCHG LHLD XDELTA LOAD DELTA X MOV A,C LOAD OUTPUT FUNCTION JMP VECT7 JUMP TO OUT FUNCTION * * DELTA Y IS EQUAL TO OR LESS THAN DELTA X * VECT5 MOV A,L ORA H TEST FOR ZERO JZ VECT8 JUMP IF ANGLE IS 45 * VECT6 LHLD XDELTA LOAD DELTA X CALL COMPHL XCHG PLACE DIVISOR LHLD YDELTA LOAD DELTA Y MOV A,C LOAD FLAG ADI #20 SET BIT TO INDICATE Y SHORT AXIS * VECT7 OUT DISCHAN*32+DISCON1 OUTPUT CONTROL 1 STA VECFLAG * ****************************************** * * FRACTIONAL DIVIDE ROUTINE * ************************************** * * DIVIDEND REGISTER PAIR HL * DIVIDEND REGISTER PAIR HL * * DIVISOR REGISTER PAIR DE * QUOTIENT REGISTER PAIR BC * ************************************* ADIV0 LXI B,#0040 SET COUNT TO 10 DIGIT ACC. ADIV1 DAD H SHIFT DIVIDEND LEFT ONCE SHLD SAVE SAVE DIVIDEND VALUE DAD D DIVIDEND-DIVISOR JC ADIV2 JUMP IF CARRY SET * LHLD SAVE RESTORE DIVIDEND * * THIS CODE SHIFTS QUOTIENT INTO REISTER PAIR BC * ADIV2 EQU $ MOV A,C RAL MOV C,A MOV A,B RAL MOV B,A * JNC ADIV1 REPEAT IF NOT COMPLETE * * LEFT JUSTIFY FRACTIONAL QUOTIENT * MOV L,C TRANSFER BC TO HL MOV H,B * DAD H SHIFT HL LEFT SIX PLACES DAD H DAD H DAD H DAD H DAD H * XCHG SAVE FRACTIONAL ANSWER JMP ACALPT1 GO TO CALCULATE POINTS * * DIVIDE 16 BIT VALUE IN HL BY 2 DIVIDE EQU $ MOV A,H ORA L RZ MOV A,H ANI #7F RAR MOV H,A MOV A,L RAR MOV L,A RET * ******************** * * INITIALIZE FOR A 45 DEGREE ANGLE * ********************* VECT8 MOV A,C LOAD FUNCTION CODE OUT DISCHAN*32+DISCON1 OUTPUT STA VECFLAG LXI D,#FFFF SET SLOPE TO ALL ONES. * ******************** * * THIS ROUTINE CALCULATES INCREMENTAL MOVEMENTS AND * OUTPUTS THEM TO THE DISPLAY * ********************* * * REGISTER PAIR HL FRACTIONAL PARTIAL SUM * REGISTER PAIR DE SLOPE * REGISTER PAIR BC LOOP COUNT * ********************* * * INITIALIZE LOOP COUNT INTO REGISTER PAIR BC * ACALPT1 LDA VECFLAG LHLD XDELTA ANI #20 TEST FOR LARGEST DELTA JNZ ACALPT2 DELTA X IS LONG AXIS * LHLD YDELTA ACALPT2 EQU $ MOV C,L MOV B,H LXI H,#8000 PARTIAL SUM RNDG FACT WRITSEG EQU $ PUSH PSW STORE ON STACK FOR LOOP W.SEG1 EQU $ POP PSW POP VALUE FROM STACK LDA VECFLAG OUTPUT TO DISPLAY OUT DISCHAN*32+DISCON1 LDA WSEGLEN LOAD UP WRITE SEG. LENGTH PUSH PSW STORE UNTO STACK MOV A,C CHECK FOR VECTOR END CPI 0 JZ W.ENDCK * * W.SEG2 EQU $ POP PSW LOOP ON WRITING A SEGMENT DCR A PUSH PSW JZ ERASEG WRITE SEGMENT DONE,ERASE DAD D SEGMENT NOT COMPLETE, RAR OUTPUT A POINT OUT DISCHAN*32+DISDATA DCR C CHECK FOR VECTOR END JNZ W.SEG2 NOT COMPLETE, CONT. WRITE W.ENDCK EQU $ DCR C SET C REGISTER TO FF COUNT DCR B JP W.SEG2 POP PSW JMP LASTPT VECTOR DONE,OUTPUT LAST PT * ERASEG EQU $ POP PSW POP OFF WSEGLEN LDA VECFLAG OUTPUT TO DISPLAY ORI #40 WITH INHIBIT BIT SET OUT DISCHAN*32+DISCON1 LDA ESEGLEN ERASE SEGMENT LENGTH COUNT PUSH PSW STORE UNTO STACK MOV A,C CHECK FOR VECTOR END CPI 0 JZ E.ENDCK E.SEG EQU $ POP PSW LOOP ON ERASING A SEGMENT DCR A PUSH PSW JZ W.SEG1 ERASE SEGMENT LENGTH DONE DAD D SEGMENT NOT COMPLETE RAR OUTPUT A POINT OUT DISCHAN*32+DISDATA DCR C CHECK FOR VECTOR END JNZ E.SEG NOT COMPLETE, CONT. WRITE E.ENDCK EQU $ DCR C SET C REGISTER TO FF COUNT DCR B JP E.SEG POP PSW * * PLACE X AND Y END COORDINATES INTO X AND Y REGS. * WHICH BECOME THE BEGINNING PT. OF NEXT VECTOR * LASTPT EQU $ VECTOR COMPLETE, LAST PT. LHLD YEND XCHG LHLD XEND * CALL R.DOT DISPLAY LAST POINT LDA VECFLAG TURN OFF INHIBIT BIT XRI #40 STA VECFLAG RET VECTAB EQU $ DB #3,#3 DOTTED VECTOR COUNTS DB #8,#3 SHORT DASHED VECTOR COUNTS DB #10,#4 LONG DASHED VECTOR COUNTS * ******************** * * SUBROUTINE GRAPH * * THIS SUBROUTINE IS CALLED UPON WHEN IN GRAPH MODE. * X AND Y COORDS. ARE SET UP IN HERE PRIOR TO * CALLING LINE1 OR OUTCOORD. IF IN DARK MODE, * OUTCOORD IS CALLED UPON TO DO BASE POSITION. * OTHERWISE, LINE1 IS CALLED TO DISPLAY A VECTOR. * FOUR INPUTS ARE NOT NECESSARY TO DRAW A VECTOR. * THE USER MAY CHANGE FROM 1 TO 4 BYTES OF THE * COORDINATES. IF A HIGH BYTE IS RECEIVED FIRST * IN A GIVEN SEQUENCE, IT MUST BE A HIGH Y BYTE.A HI * RECEIVED OTHER THAN FIRST IN SEQUENCE IS A HIGH * X BYTE. LOY AND LOX ARE DISTINGUISHABLE EACH * FROM THE OTHER. INPUT OF A LOW X BYTE TRIGGERS * BASE POSITION OR DRAWS A VECTOR. ******************** GRAPH EQU $ CALL ESCCTL CHECK ESC SEQ./CTL CODES CALL GETXY * LDA DARK ANA A IF DARK VECTOR, JZ ALINE BASE POSITION PUSH D SAVE Y COORDINATE CALL R.OUTX AND OUTPUT X COORDINATE POP H RELOAD Y COORDINATE CALL R.OUTY AND OUTPUT XRA A TURN DARK VECTOR OFF STA DARK STA BYPASS CLEAR BYPASS CONDITION RET ALINE EQU $ LDA DASH LOAD FLAG FOR DASHED/SOLID RAR JC G.LINE1 IF SET, USE DASHED VECTOR CALL R.LINE OTHERWISE, USE R.LINE RET * RETURN TO CALLER ************************* * * SUBROUTINE ALPHMODE * * TESTS DATA FOR CTL CODE, ESCAPE, AND DISPLAY CODE * ************************* * CHARGEN EQU $ PUSH B SAVE CHARACTER CODE ON STK LDA ECURSOR ERASE CURSOR MOV B,A CALL DISCURS POP B RESTORE CHAR. CODE TO C LHLD CHBASE CALL JMPHL CALL LINENDCK RET * CHGEN.S1 EQU $ MOV L,C CHARACTER CODE IN HL MVI H,00 MOV D,H CHARACTER CODE-20H IN DE MOV E,L DAD H 'MULTIPLY' CODE BY 8. DAD H DAD H XCHG STORE IN DE DAD H 'MULTIPLY' CODE BY 4 DAD H DAD D INDEX=4(CODE)+8(CODE). JMP OUTCHAR * CHGEN.S2 EQU $ MVI A,#A1 TEST CHARACTER ADD C CODE FOR RUBOUT /CURSOR JC OUTCH.2 MVI H,00 MOV L,C DAD H DAD H DAD H DAD H INDEX=16(CODE) * OUTCHAR EQU $ XCHG LHLD G.MEMSEL ADD INDEX TO BASE ADDRESS DAD D OF CHARACTER CODES. * OUTCH.0 EQU $ XCHG SAVE CHARACTER ADDR. IN DE LDA D.CNTL2 LOAD CTL 2 FOR CHAR. OUT DISCHAN*32+DISCON2 AND OUT ORIENT./WE LHLD XREG LOAD CURRENT X/Y SHLD XSAVE FOR CHARACTER PLOT LHLD YREG SHLD YSAVE LDA WIDTH MOV B,A LOAD B WITH CHAR. WIDTH * OUTCH.1 EQU $ CALL CHGEN.2 OUTPUT 1ST COLUMN OF CODES LHLD XREG INCREMENT X COORDINATE INX H AND OUTPUT. CALL R.OUTX LHLD YSAVE CALL R.OUTY AND OUTPUT. DCR B DECREMENT CHARACTER WIDTH JNZ OUTCH.1 RET * * OUTCH.2 EQU $ LXI H,M0CODE5F LOAD ADDRESS OF RUBOUT ORA A TEST FOR RUB-OUT JZ OUTCH.0 RUBOUT, DISPLAY IT LXI H,M0CODE60 LOAD ADDRESS OF CURSOR DCR A TEST FOR RUB-OUT OR XHAIR ORA A JZ OUTCH.0 CURSOR, DISPLAY IT LXI H,M0CODE61 ELSE, ADDR. OF XHAIR JMP OUTCH.0 AND DISPLAY IT * DISCURS EQU $ LDA MODE CPI 08 JZ DISCURS1 GIN MODE, ALWAYS DISPLAY LDA G.SUPCUR IF SUPPRESS SET, RET ORA A RNZ DISCURS1 EQU $ LDA D.CNTL2 SAVE DISPLAY CONTROL WORD STA D.CNTL2D MOV A,B STA D.CNTL2 LDA MODE TEST FOR GIN MODE CPI 08 JNZ DISCURS2 CALL XHAIR JMP DISCURS3 DISCURS2 EQU $ MVI C,#60 DISPLAY CURSOR DISCURSX EQU $ LHLD CHBASE CALL JMPHL CALL R.INPX LDA WIDTH CMA INR A MOV E,A MVI D,#FF DAD D CALL R.OUTX DISCURS3 EQU $ LDA D.CNTL2D STA D.CNTL2 RET * CHGEN.2 EQU $ LDAX D INX D OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA LDAX D INX D OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA MOV C,A IF SIZE 1 RETURN LDA G.SIZE ORA A RZ MOV A,C RAR OUT DISCHAN*32+DISDATA RAR OUT DISCHAN*32+DISDATA RET * * ESCCTL EQU $ LDA G.ESC IS ESCAPE FLAG, G.ESC, SET& ANA A JZ VALCK NO, CHECK FOR CTL CODE XRA A STA G.ESC YES, CLEAR ESCAPE FG. LHLD ESCADR CALL SEARCH JMP POPRET * VALCK EQU $ MOV A,C IS CURRENT CODE A CTL'/ CPI #20 RNC NO, RETURN TO MODE CALL ACONTROL * POPRET EQU $ POP H POP OFF ADDR. FROM STK RET AND RETURN TO IDLE. * ALPHMODE EQU $ CALL ESCCTL CHECK FOR ESC SEQ./CTL COD CPI #7F RZ RETURN IF RUBOUT DEL CHAR SUI #20 MOV C,A CHARACTER CODE IN C. CALL SCROLLCL CLEAR SCROLL FGS CALL CHARGEN INDEX INTO CHARACTER CODE RET VIA CHARGEN. * ACONTROL EQU $ LHLD CTLADR BEGIN SEARCH FOR MATCH SEARCH MOV A,M IF CODE IN JUMP TABLE FF CPI #FF END OF TABLE REACHED JNZ SEARCH.1 CALL SCROLLCL CLEAR SCROLL FGS. RET SEARCH.1 EQU $ CMP C ELSE, COMPARE HEX ENTRY W/ JZ MATCH CONTROL CODE FOR MATCH INX H NO MATCH,GET NEXT ENTRY INX H AND CONTINUE SEARCHING. INX H JMP SEARCH MATCH EQU $ CPI #0D TEST FOR 'C'R JNZ MATCH.1 NOT A 'C'R STA CRLFFG 'C'R, SO SET CRLF FLAG JMP MATCH.2 MATCH.1 EQU $ CPI #0A TEST IF 'L'F JZ MATCH.2 CALL SCROLLCL MATCH.2 EQU $ INX H MATCH FOUND. GET ADDR. CTL MOV E,M CODE ROUTINE AND DO IT. INX H MOV D,M XCHG LXI D,HOR HOR FLAG FOR PLATO CHAR. CALL JMPHL RET * * * ESCAPE SEQUENCES * * THE FOLLOWING IS A LIST OF ESCAPE SEQUENCES WHICH * WHEN ENTERED FROM KEYBOARD OR RECEIVED FROM HOST, * ILLICIT THE ACTIVITIES DESCRIBED AFTER EACH SEQ. * * CODE SEQUENCE DESCRIPTION * * 1B 07 ESC BEL- CLEAR BYPASS,RING * BELL * 1B 08 ESC BS- BACK SPACE * 1B 0D ESC CR- SET ESCAPE FLAG * 1B 02 ESC STX SELECTS PLATO OP. * 1B 18 ESC CAN- SELECTS BYPASS * *VECTOR ESCAPE SEQUENCES* * 1B 60 ESC REVERSE SLASH SEQUENCE * SETS NORMAL VECTORS * 1B 61 ESC SMALL A SEQUENCE * SETS DOTTED VECTORS * 1B 63 ESC SMALL C SEQUENCE * SETS SHORT DASHED VECT. * 1B 64 ESC SMALL D SEQUENCE * SETS LONG DASHED VECTOR * 1B 11 ESC DC1 SEQUENCE SELECTS * INVERSE VIDEO * 1B 12 ESC DC2 SEQUENCE SELECTS * OVERSTRIKE WRITE. * 1B 13 ESC DC3 SEQUENCE SELECTS * OVERSTRIKE ERASE. * 1B 14 ESC DC4 SEQUENCE SELECTS * CLEAR WRITE * 1B 05 ESC ENQ SEQUENCE- * SELECTS BYPASS, SENDS * TERMINAL STATUS AND 4 * BYTES OF CURRENT X/Y * 1B 0C ESC FF SEQUENCE- * ERASES SCREEN, SELECTS * ALPHA,HOMES,CLEARS BYP. * 1B 1D ESC GS- SET GRAPH MODE, * DARK VECTOR * 1B 09 ESC HTAB- HORIZONTAL TAB * AUTO CRLF IF NEEDED * 1B 0A ESC LF- SET ESCAPE FLAG * 1B 3B ESC ; SEQUENCE -SIZE1 * 1B 3A ESC '; SEQUENCE -SIZE1 * 1B 39 ESC 9 SEQUENCE -SIZE1 * 1B 38 ESC 8 SEQUENCE -SIZE1 * 6 X 14 * SETS APPROPRIATE LINEND * PAGEND,HEIGHT, WIDTH * 1B 37 ESC 7 SEQUENCE -SIZE2 * 8 X 16 * SETS APPROPRIATE LINEND * PAGEND,HEIGHT, WIDTH * 1B 1A ESC SUB SEQUENCE -SELECTS * GIN MODE,BYPASS,CROSS * HAIR CURSOR * 1B 1F ESC US- RESETS TO ALPHA * FROM ALL MODES BUT * GIN,CLEAR BYPASS * 1B 0B ESC VT- VERTICAL TAB ******************** ******************** * ESCAPE SEQUENCE LIST ********************* * ESCADR.A EQU $ DB #07 DW BEL DB #08 DW BS DB #0D DW ESC DB #02 DW PLATO DB #18 DW CAN DB #60 DW VECTNORM DB #61 DW VECTDOT DB #63 DW VECTSDSH DB #64 DW VECTLDSH DB #11 DW DC1 DB #12 DW DC2 DB #13 DW DC3 DB #14 DW DC4 DB #05 DW ENQ DB #0C DW AFF DB #1D DW GS DB #09 DW HTAB DB #0A DW ESC DB #3B DW SIZE1 DB #3A DW SIZE1 DB #39 DW SIZE1 DB #38 DW SIZE1 DB #37 DW SIZE2 DB #1A DW ASUB DB #1F DW US DB #0B DW VT DB #1B DW ESC DB #00 DW ESC DB #FF ******************** * CONTROL CODE SUBROUTINE * * THIS SUBROUTINE EXECUTES CONTROL CODE FUNCTIONS * (I.E.'C'R,'B'S,ETC.) IT WILL BE ENTERED FROM THE KB * AFTER THE CONTROL KEY IS RECEIVED OR FROM THE HOST * WHEN A CTL CODE IS RECEIVED. HEX VALUE RANGE 00-1F * * CODE DESCRIPTION * * 07 BEL-CLEARS BYPASS * 08 BS-BACK SPACE * 0D CR-CARRIAGE RETURN * RESET FROM GRAPH * TO ALPHA MODE, * CLEAR BYPASS * 1B ESC-SET G.ESC, ESCAPE FLAG * 1C FS-CTL FS SELECT * POINT PLOT MODE * 1D GS-SETS GRAPH MODE, * DARK VECTOR * 09 HTAB-HORIZONTAL TAB * AUTO. CR/LF IF NEEDED * 0A LF-LINE FEED; WRAP TO * DISPLAY TOP IF NEEDED, * CLEAR BYPASS * 19 EM-SELECT BLOCK W/E MODE * 1F US-RESETS TERM GRAPH TO * ALPHA; CLEARS BYPASS * 0B VT-VERTICAL TAB * ********************** ********************** * CONTROL CODE JUMP TABLE * ******************** * CTLADR.A EQU $ DB #07 DW BEL DB #08 DW BS DB #0D DW CR DB #1B DW ESC DB #1C DW FS DB #1D DW GS DB #09 DW HTAB DB #0A DW LF DB #19 DW EM DB #1F DW US DB #0B DW VT DB #FF * * BEL EQU $ IN TPCHAN*32+TOUCHD SOUND ALERT MVI A,00 STA BYPASS CLEAR BYPASS RET * BS EQU $ LDA ECURSOR ERASE CURSOR MOV B,A CALL DISCURS XRA A CLEAR BYPASS STA BYPASS BS.1 EQU $ CALL R.INPX LDA WIDTH CMA MOVE X BACK A CHAR. WIDTH INR A MOV E,A MVI D,#FF DAD D MOV A,H ANI #80 JNZ BS.SCK X COORD. NEGATIVE * GO CHECK CHAR. SIZE BS.END EQU $ X COORD. DID NOT BACK OFF CALL R.OUTX SET CURRENT X COORD. RET * BS.SCK EQU $ LDA G.SIZE ORA A JNZ BS.VT X COORD NEG AND SIZE 2 * CHECK IF FFF8 DCX H SUBTRACT 2 FROM X AS SIZE DCX H 1 USES ONLY 510 DOTS. * BS.VT EQU $ MOV A,L LOWER 8 BITS OF X MUST CPI #F8 BE F8 IF SIZE 2,X NEG JNZ BS.END BEFORE 'V'T IS REQUIRED. CALL R.OUTX CALL VT.1 RET * CAN EQU $ LXI H,BYPASS SELECTS BYPASS MVI M,1 RET * CR EQU $ LDA ECURSOR MOV B,A CALL DISCURS XRA A STA BYPASS CLEARS BYPASS. LDA MODE CPI 08 JNZ CR.A LDA GIN.KEY GIN MODE, SEND LAST CHAR. MOV C,A AND RETURN TO GIN XMIT CALL GIN.XMT CALL CR.1 DO CARRIAGE RETURN RET CR.A EQU $ CALL CR.1 DO CARRIAGE RETURN MVI A,03 STA MODE SET ALPHA MODE. LHLD STRAP TEST FOR AUTO. CR/LF MOV A,L ANI #08 RZ RETURN IF NOT SET LDA KBDATA ORA A RZ STA CRLFFG SET SCROLL FLAG CALL LF.1A OTHERWISE, 'L'F CALL SCROLLCK CALL SCROLLCL CLEAR SCROLL FLAG RET * CR.1 EQU $ LXI H,00 SET TO LEFT MARGIN. CALL R.OUTX RET * * DC1 EQU $ MVI L,00 SELECT INVERSE VIDEO CALL R.MODE MVI A,6 CURSOR NEEDS OPPOS. W/E STA ECURSOR BITS OF ALL OTHER WRITE MVI A,4 MODES. STA WCURSOR RET * DC2 EQU $ MVI L,6 SELECT OVERSTRIKE WRITE CALL R.MODE DC2.1 EQU $ MVI A,4 RESET W/E MODES SO CURSOR STA ECURSOR OVERSTRIKE WRITE AND MVI A,6 OVERSTRIKE ERASE STA WCURSOR RET * DC3 EQU $ MVI L,4 SELECT OVERSTRIKE ERASE CALL R.MODE CALL DC2.1 SELECT W/E CURSOR WORDS RET * DC4 EQU $ MVI L,02 CALL R.MODE SELECT CLEAR WRITE CALL DC2.1 SELECT W/E CURSOR WORDS RET * ENQ EQU $ LDA MODE CPI #08 JZ ENQ.1 IF GIN, DON'7T SEND TSTAT LDA TSTAT LOAD TERMINAL STATUS MOV C,A CALL XMIT.1 ENQ.1 EQU $ CALL R.INPX CALL HILO SEND X IN 2 BYTES LHLD BIAS CALL COMPHL PUSH H SAVE -BIAS ON STACK CALL R.INPY POP D DAD D HL _ Y - BIAS CALL HILO SEND Y IN 2 BYTES LDA MODE IF GIN, DO AUTOMATIC CPI #08 TRANSMISSION CHECKS JNZ ENQ.2 LHLD STRAP TEST 'G'I'N TRANSMISSION MOV A,L ANI 06 CPI 04 MOV L,A JZ ENQ.2 SEND NOTHING AUTO. PUSH H SAVE STRAP MVI C,#0D SEND CR CALL XMIT.1 POP H RESTORE STRAP MOV A,L CPI 02 JZ ENQ.2 SEND 'C'R ONLY. MVI C,#04 SEND EOT CALL XMIT.1 * ENQ.2 EQU $ LDA ECURSOR ERASE CURSOR MOV B,A CALL DISCURS MVI A,03 SELECT ALPHA MODE STA MODE STA BYPASS SET BYPASS MVI H,04 LOAD INTERRUPT LDA M.ENAB ANI #D8 MOV L,A DISABLE TOUCH PANEL CALL R.SSF MASK AND OUTPUT. RET * * HILO EQU $ LDA SCALEFG TEST SCALE FLAG ORA A JNZ HILO.1 NOT SCALING, SEND AS IS DAD H OTHERWISE, MULT. BY 2 HILO.1 EQU $ MVI A,#1F ANA L MASK LOWER FIVE BITS PUSH A DAD H SHIFT UPPER DAD H FIVE BITS INTO DAD H H REGISTER. MOV A,H ANI #1F MASK FOR FIVE BITS ORI #20 MOV C,A CALL XMIT.1 TRANSMIT UPPER 5 BITS POP A ORI #20 MOV C,A CALL XMIT.1 RET * ESC EQU $ LXI H,G.ESC MVI M,01 RET * AFF EQU $ PAGE GETS YOU HERE LDA M.MODE RLC ORI 01 MOV L,A CALL R.MODE * AFF.1 EQU $ RESET KEY GETS YOU HERE MVI A,03 SELECT ALPHA MODE STA MODE SELECTS ALPHA. XRA A STA BYPASS CLEARS BYPASS. LXI H,00 CALL R.OUTX MVI H,#FF LDA HEIGHT CMA INR A A HAS -(HEIGHT) MOV L,A LXI D,#200 DAD D CALL R.OUTY RET * FS EQU $ LDA MODE CPI 03 JNZ FS.1 LDA ECURSOR ERASE CURSOR MOV B,A CALL DISCURS FS.1 EQU $ LDA MODE ANI #80 JZ FS.2 ORI #40 SET PLATO DATA MODE FS.2 EQU $ STA MODE SELECT POINT PLOT MODE XRA A CLEAR NUMBER INPUTS STA NINPUT TO GET COORDINATE RET * GS EQU $ LDA MODE CPI 03 JNZ GS.1 LDA ECURSOR ERASE CURSOR MOV B,A CALL DISCURS * * GS.1 EQU $ LDA MODE ANI #80 JZ GS.2 ORI #40 SELECT PLATO DATA MODE GS.2 EQU $ ORI #01 SELECT GRAPH MODE STA MODE STA DARK SETS DARK VECTOR. XRA A CLEAR NUMBER OF INPUTS TO STA NINPUT GET COORDINATE ROUTINE LDA TSTAT UPDATE TERMINAL STATUS ANI #B1 STA TSTAT RET * HTAB EQU $ LDA D.CNTL2 STA D.CNTL2P SAVE DISPLAY CONTROL WORD LDA ECURSOR MOV B,A STA D.CNTL2 MVI C,#60 ERASE CURSOR LHLD CHBASE CALL JMPHL CALL LINENDCK LDA D.CNTL2P RESTORE DISPLAY CONTROL STA D.CNTL2 XRA A CLEAR BYPASS STA BYPASS RET * LF EQU $ LDA ECURSOR MOV B,A CALL DISCURS LXI H,BYPASS CLEAR BYPASS. MVI M,00 CALL LF.1A DO A LINE FEED. LDA KBDATA ORA A JZ LFSCROL LHLD STRAP TEST FOR AUTO. LF/CR MOV A,L ANI #10 CNZ CR.1 AUTO. SO DO 'C'R LFSCROL EQU * CALL SCROLLCK CALL SCROLLCL RET LF.1A EQU $ CALL R.INPY GET CURRENT Y XCHG STORE Y IN DE. LHLD PAGEND CHECK FOR PAGEND MOV A,D ORA A JNZ CHANGEY NOT PG BOTTOM, MOV A,E CHANGE Y ONLY. CMP L JC LF.2 PAGE BOTTOM REACHED, * CHANGEY EQU $ XCHG JUST CHANGE Y COORD JMP LF.3 RET * LF.2 EQU $ LXI H,#200 SET Y TO PAGE TOP- HEIGHT * LF.3 EQU $ LDA HEIGHT CMA INR A A HAS -(HEIGHT). MOV E,A MVI D,#FF DAD D CALL R.OUTY RET * LINENDCK EQU $ CALL R.INPX XCHG CURRENT X IN DE LDA G.SIZE CHECK CHARACTER SIZE ORA A JZ LEND.S1 MOV A,E SIZE 2 SO CHECK X COORD. ORA D IF ZERO, IT HAS WRAPPED JZ PGCHK SO DO CR LF. RET * * LEND.S1 EQU $ SIZE 1, X AT LINEND LHLD LINEND DE HAS CURRENT X MOV A,D CMP H RC JNZ PGCHK IF LINEND DO 'C'R/'L'F MOV A,E RETURN, LINE FEED. CMP L OTHERWISE SIMPLY RETURN. RC RZ LXI H,00 CALL R.OUTX PGCHK EQU $ CALL CR.1 CALL LF.1A LDA G.SUPCUR TEST IF CURSOR ON ORA A CZ SCROLL ON, SO SCROLL CALL SCROLLCL RET * EM EQU $ LDA MODE CPI 03 JNZ EM.1 LDA ECURSOR ERASE CURSOR MOV B,A CALL DISCURS EM.1 EQU $ LDA MODE ANI #80 JZ EM.2 ORI #40 SELECT PLATO DATA MODE EM.2 EQU $ ORI #04 SELECT BLOCK MODE STA MODE XRA A CLEAR TWICE FLAG STA BTWICE STA NINPUT CLEAR NINPUT TO GET COORDS RET * PLATO EQU $ CALL BULKER ERASE SCREEN PLATO0 EQU * MVI A,0 STA M.JOBS MVI A,12 STA M.TYPE MVI A,03 STA M.SBTYPE MVI A,#83 SELECT PLATO COMMAND MODE3 STA MODE LXI H,ISTASC SELECT IST ASCII KEYBOARD SHLD KBAADR LXI H,SELECT.P SELECT PLATO DATAMODE TBL SHLD SELECT.M LXI H,CTLADR.P SELECT PLATO CTL CODE TBL SHLD CTLADR LXI H,ESCADR.P SELECT PLATO ESC SEQ TBL SHLD ESCADR LXI H,#0000 NO GRAPH MODE SCREEN BIAS SHLD BIAS MVI A,01 DO NOT SCALE STA SCALEFG LXI D,00 LXI H,184 CALL OUTCOORD MVI L,#1A CALL R.MODE MVI L,00 CALL R.CCR LXI H,MSG CALL R.CHARS MVI A,#01 STA EREG MVI A,#14 STA E.CNTR MVI A,01 OUT KEYCHAN*32+KYBDCON XRI #09 CALL ENAB * LDA PMC.FLG TEST FOR PLATO ORA A MODE MASTER CLEAR. JNZ PI.3 JUMP IF M.C. MVI C,#06 PI.1 CALL XMIT.1 JC PI.1 MVI C,#20 PI.2 CALL XMIT.1 JC PI.2 LXI H,#0382 SEND MASTER CLEAR CALL P.XMIT STATUS TO PLATO. RET PI.3 XRA A STA PMC.FLG CLEAR MC FLAG MVI C,#95 PI.4 CALL XMIT.1 SEND NAK JC PI.4 NOT SENT, TRY AGAIN LDA MREG ADI #20 ADJUST FOR ASCII MOV C,A PI.5 CALL XMIT.1 SEND M JC PI.5 NOT SENT. LXI H,#0382 SEND MASTER CLEAR CALL P.XMIT STATUS TO PLATO. RET MSG DB #50,#4C,#41,#54 DB #4F,#1B,#30 * SCROLLCK EQU $ LDA G.SUPCUR TEST SUPPRESS CURSOR ORA A RNZ LDA CRLFFG TEST CR/LF SEQUENCE ORA A CNZ SCROLL * SCROLLCL EQU $ XRA A CLEAR SCROLL FLAGS STA CRLFFG RET * SCROLL EQU * LXI H,0000 SET UP X1,Y1,X2,Y2 SHLD X1 FOR ERASING A LINE LHLD LINEND SHLD X2 CALL R.INPY SHLD Y2 XCHG LHLD HEIGHT DCX H DAD D SHLD Y1 LDA D.CNTL2 STA D.CNTL2P LDA M.MODE STA M.MODEP MVI L,00 SET ERASE BITS CALL R.MODE LXI H,X1 CALL R.BLOCK LDA D.CNTL2P STA D.CNTL2 LDA M.MODEP STA M.MODE LDA G.SIZE ORA A RNZ RET IF SIZE 2 CALL R.INPY GET Y COORD. INX H ADD 2 AND OUT INX H NEW Y. CALL R.OUTY RET * * SIZE1 EQU $ LXI H,S1CODE00 SELECT SIZE 1 SHLD G.MEMSEL LXI H,CHGEN.S1 SHLD CHBASE LXI H,LINEND 85 CHARACTERS PER LINE MVI M,#FD INX H MVI M,1 36 LINES PER PAGE LXI H,PAGEND SET LINEND,PAGEND,HEIGHT MVI M,#16 ACCORDINGLY. LXI H,HEIGHT MVI M,#0E LXI H,WIDTH MVI M,06 XRA A SIZE SET TO ZERO STA G.SIZE INDICATES SIZE1. RET * SIZE2 EQU $ LHLD M0ADR LOAD IST CHAR. SET ADDRESS SHLD G.MEMSEL LXI H,CHGEN.S2 SHLD CHBASE LXI H,LINEND 64 CHARACTERS PER LINE MVI M,#FF INX H MVI M,1 32 LINES PER PAGE LXI H,PAGEND SET LINEND, PAGEND, HEIGHT MVI M,0 ACCORDINGLY. LXI H,HEIGHT MVI M,#10 LXI H,WIDTH MVI M,08 MVI A,1 BIT 1 SET IN SIZE STA G.SIZE INDICATES SIZE2. RET * ASUB EQU $ MVI H,04 LOAD INTERRUPT LDA M.ENAB ORI #20 ENABLE MOV L,A TOUCH PANEL CALL R.SSF LDA MODE CPI 03 JNZ ASUB.1 LDA ECURSOR MOV B,A CALL DISCURS ASUB.1 EQU $ MVI A,08 SELECT GIN MODE STA MODE STA BYPASS SET BYPASS CONDITION RET * US EQU $ MVI A,0 STA BYPASS CLEAR BYPASS. MVI A,#BD STA TSTAT LDA MODE CPI #08 RZ ANI #80 JZ US.1 ORI #40 SELECT PLATO DATA MODE US.1 EQU $ ORI #03 SELECT ALPHA MODE STA MODE RET * VECTNORM EQU $ LXI H,DASH MVI M,00 RET * * VECTDOT EQU $ LXI H,DASH MVI M,1 LXI H,VECTAB MOV A,M STA WSEGLEN INX H MOV A,M STA ESEGLEN RET * VECTSDSH EQU $ LXI H,DASH MVI M,1 LXI H,VECTAB+2 MOV A,M STA WSEGLEN INX H MOV A,M STA ESEGLEN RET * VECTLDSH EQU $ LXI H,DASH MVI M,1 LXI H,VECTAB+4 MOV A,M STA WSEGLEN INX H MOV A,M STA ESEGLEN RET * VT EQU $ LDA ECURSOR MOV B,A CALL DISCURS OVERSTRIKE ERASE CURSOR XRA A CLEAR BYPASS STA BYPASS VT.1 EQU $ CALL R.INPY LDA HEIGHT MOV E,A MVI D,0 DAD D LDA G.SIZE IF SIZE 2, WRAPS AUTO. ORA A JNZ VT.2 MOV A,H SIZE 1, CHECK FOR PAGE TOP CPI 2 IF Y DOES NOT EXCEED 512 JC VT.2 DO A SIMPLE 'V'T LHLD PAGEND OTHERWISE,WRAP TO PG END LDA HEIGHT PAGEND MINUS HEIGHT CMA INR A MOV E,A MVI D,#FF DAD D * VT.2 EQU $ CALL R.OUTY LDA WCURSOR MOV B,A CALL DISCURS RET * * COMPLIMENT HL REGISTERS FOR 2'7S COMP. ARITH. * COMPHL EQU $ MOV A,L CMA MOV L,A MOV A,H CMA MOV H,A INX H RET * CALDEL EQU $ MOV A,E TEST STARTING ORA D POINT FOR ZERO. RZ RETURN IF ZERO * XCHG SUBTRACT CALL COMPHL STARTING POINT DAD D FROM END POINT. RC RETURN IF END GREATER * CALL COMPHL SET DELTA POSITIVE MOV A,C LOAD PLOTTING ORA B BIT FOR NEGATIVE MOV C,A DIRECTION. RET EXIT * ******************** * * SIZE 1 CHARACTER CODE SET * ******************** S1CODE00 DB #00,#00,#00,#00 DB #00,#00,#00,#00 DB #00,#00,#00,#00 EXCLAMATION MARK S1CODE01 DB #00,#00,#00,#00 DB #20,#3F,#00,#00 DB #00,#00,#00,#00 DOUBLE QUOTATION MARK S1CODE02 DB #00,#00,#00,#38 DB #00,#00,#00,#38 DB #00,#00,#00,#00 NUMBER SIGN S1CODE03 DB #00,#0A,#80,#3F DB #00,#0A,#80,#3F DB #00,#0A,#00,#00 DOLLAR SIGN S1CODE04 DB #80,#0C,#40,#12 DB #E0,#3F,#40,#12 DB #80,#09,#00,#00 PERCENT SIGN S1CODE05 DB #40,#0C,#80,#0C DB #00,#01,#60,#02 DB #60,#04,#00,#00 AMPER SIGN S1CODE06 DB #C0,#01,#20,#1A DB #20,#26,#C0,#19 DB #20,#02,#00,#00 SINGLE QUOTATION S1CODE07 DB #00,#00,#00,#00 DB #00,#38,#00,#00 DB #00,#00,#00,#00 LEFT PARENTHESIS ( S1CODE08 DB #00,#00,#00,#00 DB #C0,#0F,#20,#10 DB #10,#20,#00,#00 RIGHT PARENTHESIS ) S1CODE09 DB #10,#20,#20,#10 DB #C0,#0F,#00,#00 DB #00,#00,#00,#00 ASTERISK S1CODE0A DB #80,#04,#00,#03 DB #C0,#0C,#00,#03 DB #80,#04,#00,#00 PLUS S1CODE0B DB #00,#01,#00,#01 DB #C0,#07,#00,#01 DB #00,#01,#00,#00 COMMA S1CODE0C DB #00,#00,#68,#00 DB #70,#00,#00,#00 DB #00,#00,#00,#00 MINUS S1CODE0D DB #00,#01,#00,#01 DB #00,#01,#00,#01 DB #00,#01,#00,#00 PERIOD S1CODE0E DB #00,#00,#60,#00 DB #60,#00,#00,#00 DB #00,#00,#00,#00 SLASH S1CODE0F DB #20,#00,#40,#00 DB #80,#00,#00,#01 DB #00,#02,#00,#00 NUMERAL ZERO S1CODE10 DB #C0,#0F,#A0,#10 DB #20,#11,#20,#12 DB #C0,#0F,#00,#00 NUMERAL ONE S1CODE11 DB #00,#00,#20,#08 DB #E0,#1F,#20,#00 DB #00,#00,#00,#00 NUMERAL TWO S1CODE12 DB #60,#08,#A0,#10 DB #20,#11,#20,#12 DB #20,#0C,#00,#00 NUMERAL THREE S1CODE13 DB #40,#08,#20,#10 DB #20,#12,#20,#12 DB #C0,#0D,#00,#00 NUMERAL FOUR S1CODE14 DB #00,#01,#00,#03 DB #00,#05,#00,#09 DB #E0,#1F,#00,#00 NUMERAL FIVE S1CODE15 DB #20,#1E,#20,#12 DB #20,#12,#20,#12 DB #C0,#11,#00,#00 NUMERAL SIX S1CODE16 DB #C0,#07,#20,#0A DB #20,#12,#20,#12 DB #C0,#01,#00,#00 NUMERAL SEVEN S1CODE17 DB #00,#10,#60,#10 DB #80,#11,#00,#16 DB #00,#18,#00,#00 NUMERAL EIGHT S1CODE18 DB #C0,#0D,#20,#12 DB #20,#12,#20,#12 DB #C0,#0D,#00,#00 NUMERAL NINE S1CODE19 DB #00,#0E,#20,#11 DB #20,#11,#40,#11 DB #80,#0F,#00,#00 COLON S1CODE1A DB #00,#00,#60,#06 DB #60,#06,#00,#00 DB #00,#00,#00,#00 SEMICOLON S1CODE1B DB #08,#00,#70,#06 DB #60,#06,#00,#00 DB #00,#00,#00,#00 LESS THAN S1CODE1C DB #00,#01,#80,#02 DB #40,#04,#20,#08 DB #00,#00,#00,#00 EQUAL S1CODE1D DB #80,#02,#80,#02 DB #80,#02,#80,#02 DB #80,#02,#00,#00 GREATER THAN S1CODE1E DB #00,#00,#20,#08 DB #40,#04,#80,#02 DB #00,#01,#00,#00 QUESTION MARK S1CODE1F DB #00,#18,#00,#20 DB #A0,#23,#00,#24 DB #00,#18,#00,#00 COMMERICAL AT S1CODE20 DB #C0,#03,#20,#04 DB #90,#05,#D0,#05 DB #90,#03,#00,#00 CAPITAL A S1CODE21 DB #E0,#0F,#00,#12 DB #00,#22,#00,#12 DB #E0,#0F,#00,#00 CAPITAL B S1CODE22 DB #E0,#3F,#20,#24 DB #20,#24,#20,#24 DB #C0,#1B,#00,#00 CAPITAL C S1CODE23 DB #C0,#1F,#20,#20 DB #20,#20,#20,#20 DB #40,#10,#00,#00 CAPITAL D S1CODE24 DB #E0,#3F,#20,#20 DB #20,#20,#40,#10 DB #80,#0F,#00,#00 CAPITAL E S1CODE25 DB #E0,#3F,#20,#22 DB #20,#22,#20,#22 DB #20,#20,#00,#00 CAPITAL F S1CODE26 DB #E0,#3F,#00,#22 DB #00,#22,#00,#22 DB #00,#20,#00,#00 CAPITAL G S1CODE27 DB #C0,#1F,#20,#20 DB #20,#21,#20,#21 DB #C0,#19,#00,#00 CAPITAL H S1CODE28 DB #E0,#3F,#00,#02 DB #00,#02,#00,#02 DB #E0,#3F,#00,#00 CAPITAL I S1CODE29 DB #20,#20,#20,#20 DB #E0,#3F,#20,#20 DB #20,#20,#00,#00 CAPITAL J S1CODE2A DB #40,#00,#20,#00 DB #20,#20,#C0,#3F DB #00,#20,#00,#00 CAPITAL K S1CODE2B DB #E0,#3F,#00,#03 DB #80,#04,#40,#08 DB #20,#30,#00,#00 CAPITAL L S1CODE2C DB #E0,#3F,#20,#00 DB #20,#00,#20,#00 DB #20,#00,#00,#00 CAPITAL M S1CODE2D DB #E0,#3F,#00,#10 DB #00,#08,#00,#10 DB #E0,#3F,#00,#00 CAPITAL N S1CODE2E DB #E0,#3F,#00,#18 DB #00,#06,#C0,#01 DB #E0,#3F,#00,#00 CAPITAL O S1CODE2F DB #C0,#1F,#20,#20 DB #20,#20,#20,#20 DB #C0,#1F,#00,#00 CAPITAL P S1CODE30 DB #E0,#3F,#00,#22 DB #00,#22,#00,#22 DB #00,#1C,#00,#00 CAPITAL Q S1CODE31 DB #C0,#1F,#20,#20 DB #20,#20,#30,#20 DB #C8,#1F,#00,#00 CAPITAL R S1CODE32 DB #E0,#3F,#00,#23 DB #80,#22,#40,#22 DB #20,#1C,#00,#00 CAPITAL S S1CODE33 DB #40,#1C,#20,#22 DB #20,#22,#20,#22 DB #C0,#11,#00,#00 CAPITAL T S1CODE34 DB #00,#20,#00,#20 DB #E0,#3F,#00,#20 DB #00,#20,#00,#00 CAPITAL U S1CODE35 DB #C0,#3F,#20,#00 DB #20,#00,#20,#00 DB #C0,#3F,#00,#00 CAPITAL V S1CODE36 DB #00,#3C,#80,#03 DB #60,#00,#80,#03 DB #00,#3C,#00,#00 CAPITAL W S1CODE37 DB #E0,#3F,#40,#00 DB #80,#00,#40,#00 DB #E0,#3F,#00,#00 CAPITAL X S1CODE38 DB #60,#30,#80,#09 DB #00,#06,#80,#09 DB #60,#30,#00,#00 CAPITAL Y S1CODE39 DB #00,#38,#00,#04 DB #E0,#07,#00,#04 DB #00,#38,#00,#00 CAPITAL Z S1CODE3A DB #E0,#30,#20,#21 DB #20,#22,#20,#24 DB #60,#38,#00,#00 LEFT CLOSURE [ S1CODE3B DB #00,#00,#00,#00 DB #F0,#3F,#10,#20 DB #10,#20,#00,#00 REVERSE SLASH S1CODE3C DB #00,#04,#00,#02 DB #00,#01,#80,#00 DB #40,#00,#00,#00 RIGHT CLOSURE S1CODE3D DB #10,#20,#10,#20 DB #F0,#3F,#00,#00 DB #00,#00,#00,#00 'HAT S1CODE3E DB #00,#04,#00,#08 DB #00,#10,#00,#08 DB #00,#04,#00,#00 UNDERLINE S1CODE3F DB #08,#00,#08,#00 DB #08,#00,#08,#00 DB #08,#00,#00,#00 SMALL REVERSE SLASH S1CODE40 DB #00,#00,#00,#00 DB #00,#20,#00,#10 DB #00,#00,#00,#00 SMALL LETTER A S1CODE41 DB #C0,#00,#20,#05 DB #20,#05,#20,#05 DB #E0,#03,#00,#00 SMALL LETTER B S1CODE42 DB #E0,#3F,#40,#02 DB #20,#04,#20,#04 DB #C0,#03,#00,#00 SMALL LETTER C S1CODE43 DB #C0,#03,#20,#04 DB #20,#04,#20,#04 DB #40,#02,#00,#00 SMALL LETTER D S1CODE44 DB #C0,#03,#20,#04 DB #20,#04,#20,#04 DB #E0,#3F,#00,#00 SMALL LETTER E S1CODE45 DB #C0,#03,#20,#05 DB #20,#05,#20,#05 DB #20,#03,#00,#00 SMALL LETTER F S1CODE46 DB #20,#04,#E0,#1F DB #20,#24,#00,#20 DB #00,#10,#00,#00 SMALL LETTER G S1CODE47 DB #50,#03,#A8,#04 DB #A8,#04,#A8,#04 DB #10,#0B,#00,#00 SMALL LETTER H S1CODE48 DB #E0,#3F,#00,#02 DB #00,#04,#00,#04 DB #E0,#03,#00,#00 SMALL LETTER I S1CODE49 DB #20,#04,#E0,#27 DB #20,#00,#00,#00 DB #00,#00,#00,#00 SMALL LETTER J S1CODE4A DB #00,#00,#04,#00 DB #04,#04,#F8,#27 DB #00,#00,#00,#00 SMALL LETTER K S1CODE4B DB #E0,#3F,#00,#01 DB #80,#01,#40,#02 DB #20,#04,#00,#00 SMALL LETTER L S1CODE4C DB #00,#00,#00,#00 DB #20,#20,#E0,#3F DB #20,#00,#00,#00 SMALL LETTER M S1CODE4D DB #E0,#07,#00,#04 DB #E0,#03,#00,#04 DB #E0,#07,#00,#00 SMALL LETTER N S1CODE4E DB #E0,#07,#00,#02 DB #00,#04,#00,#04 DB #E0,#03,#00,#00 SMALL LETTER O S1CODE4F DB #C0,#03,#20,#04 DB #20,#04,#20,#04 DB #C0,#03,#00,#00 SMALL LETTER P S1CODE50 DB #FC,#07,#20,#04 DB #20,#04,#20,#04 DB #C0,#03,#00,#00 SMALL LETTER Q S1CODE51 DB #C0,#03,#20,#04 DB #20,#04,#20,#04 DB #FC,#07,#00,#00 SMALL LETTER R S1CODE52 DB #E0,#07,#00,#02 DB #00,#04,#00,#04 DB #00,#02,#00,#00 SMALL LETTER S S1CODE53 DB #40,#02,#20,#05 DB #20,#05,#20,#05 DB #C0,#04,#00,#00 SMALL LETTER T S1CODE54 DB #00,#04,#00,#04 DB #C0,#3F,#20,#04 DB #20,#04,#00,#00 SMALL LETTER U S1CODE55 DB #C0,#07,#20,#00 DB #20,#00,#20,#00 DB #C0,#07,#00,#00 SMALL LETTER V S1CODE56 DB #00,#06,#80,#01 DB #60,#00,#80,#01 DB #00,#06,#00,#00 SMALL LETTER W S1CODE57 DB #C0,#07,#20,#00 DB #C0,#00,#20,#00 DB #C0,#07,#00,#00 SMALL LETTER X S1CODE58 DB #20,#04,#40,#02 DB #80,#01,#40,#02 DB #20,#04,#00,#00 SMALL LETTER Y S1CODE59 DB #04,#07,#88,#00 DB #50,#00,#60,#00 DB #80,#07,#00,#00 SMALL LETTER Z S1CODE5A DB #20,#06,#60,#04 DB #A0,#04,#20,#05 DB #60,#06,#00,#00 LEFT BRACKET [ S1CODE5B DB #00,#00,#00,#01 DB #F0,#1E,#08,#20 DB #08,#20,#00,#00 ELONGATED COLON S1CODE5C DB #00,#00,#E0,#3D DB #E0,#3D,#00,#00 DB #00,#00,#00,#00 RIGHT BRACKET ] S1CODE5D DB #08,#20,#08,#20 DB #F0,#1E,#00,#01 DB #00,#00,#00,#00 APPROXIMATE S1CODE5E DB #00,#10,#00,#20 DB #00,#10,#00,#10 DB #00,#20,#00,#00 RUB OUT S1CODE5F DB #C0,#1F,#C0,#1F DB #C0,#1F,#C0,#1F DB #C0,#1F,#00,#00 CURSOR S1CODE60 DB #01,#00,#01,#00 DB #01,#00,#01,#00 DB #01,#00,#01,#00 CHCURSOR S1CODE61 DB #00,#00,#00,#00 DB #80,#00,#C0,#01 DB #80,#00,#00,#00 M0CODE5F DB #F0,#1F,#F0,#1F RUBOUT DB #F0,#1F,#F0,#1F DB #F0,#1F,#F0,#1F DB #F0,#1F,#F0,#1F M0CODE60 DB #01,#00,#01,#00 CURSOR DB #01,#00,#01,#00 DB #01,#00,#01,#00 DB #01,#00,#01,#00 M0CODE61 DB #00,#00,#00,#00 CHCURSOR DB #00,#00,#00,#01 DB #80,#03,#00,#01 DB #00,#00,#00,#00 LWA EQU * EJECT IST.STK EQU LWA+45 PROCESSOR STACK G.BEGIN EQU LWA+45 ******************** * * TERMINAL VARIABLES AND SCRATCH AREA * ******************** KBAADR EQU LWA+45 KB TO ASCII CONVERT BIAS EQU KBAADR+2 BIAS OF Y COORDINATE BYPASS EQU BIAS+2 BY PASS CONDITION FLAG CHBASE EQU BYPASS+1 CLK.1 EQU CHBASE+2 CLK.2 EQU CLK.1+1 CLOCK EQU CLK.2+1 BLINK CURSOR CLOCK CMODE EQU CLOCK+2 COMMAND MODE CRLFFG EQU CMODE+1 CR/LF FLAG CTLADR EQU CRLFFG+1 CONTROL CODES BASE ADR. DASH EQU CTLADR+2 DASH/SOLID VECTOR FLAG DARK EQU DASH+1 DARK VECTOR FLAG D.CNTL2P EQU DARK+1 TEMP DISPLAY CONTROL WORD D.CNTL2D EQU D.CNTL2P+1 TEMP DISPLAY CONTROL WORD DOTS EQU D.CNTL2D+1 DOT MOVEMENT FOR GIN MODE ECURSOR EQU DOTS+1 ERASE BITS FOR CURSOR ESCADR EQU ECURSOR+1 ESCAPE SEQUENCE BASE ADR. E.CNTR EQU ESCADR+2 EREG EQU E.CNTR+1 ESEGLEN EQU EREG+1 ERASE SEGMENT LENGTH G.CNTL2 EQU ESEGLEN+1 G.CTLFLG EQU G.CNTL2+1 CTL MODE FLAG G.DDIR EQU G.CTLFLG+1 G.ESC EQU G.DDIR+1 G.MEMSEL EQU G.ESC+1 G.MODE EQU G.MEMSEL+2 G.SIZE EQU G.MODE+1 G.SUPCUR EQU G.SIZE+1 G.TTYFLG EQU G.SUPCUR+1 G.XPOS EQU G.TTYFLG+1 G.YPOS EQU G.XPOS+2 GIN.KEY EQU G.YPOS+2 HEIGHT EQU GIN.KEY+1 HIX EQU HEIGHT+1 HIY EQU HIX+2 KBDATA EQU HIY+2 LINEND EQU KBDATA+1 LOC.RMT EQU LINEND+2 LOX EQU LOC.RMT+1 LOY EQU LOX+1 MREG EQU LOY+1 NBYTES EQU MREG+1 NREG EQU NBYTES+1 M.MODEP EQU NREG+1 NINPUT EQU M.MODEP+1 PAGEND EQU NINPUT+1 PAGEFULL EQU PAGEND+2 PMC.FLG EQU PAGEFULL+1 SAVE EQU PMC.FLG+1 SCALEFG EQU SAVE+2 SELECT.M EQU SCALEFG+1 SH.SUP EQU SELECT.M+2 TSTAT EQU SH.SUP+1 BTWICE EQU TSTAT+1 VECFLAG EQU BTWICE+1 WCURSOR EQU VECFLAG+1 WRITE BITS FOR CURSOR WEFLAG EQU WCURSOR+1 WIDTH EQU WEFLAG+1 WSEGLEN EQU WIDTH+1 WRITE SEGMENT LENGTH X1 EQU WSEGLEN+1 Y1 EQU X1+2 X2 EQU Y1+2 Y2 EQU X2+2 * * TRANSMIT BUFFER * TXBUF EQU Y2+2 * * RECEIVE BUFFER * RXBUF EQU TXBUF+11 BC.REG EQU RXBUF+258 * PLATO OPERATIONS CHARACTER FLAGS NOTE ORDER BLOCKX EQU BC.REG+1 BLOCKY EQU BLOCKX+2 XEND EQU BLOCKY+2 YEND EQU XEND+2 XDELTA EQU YEND+2 YDELTA EQU XDELTA+2 BLOCKF EQU YDELTA+2 MEMREG EQU BLOCKF+1 * IN.BUF EQU MEMREG+2 KB/TP INPUT BUFFER * US.FIFO EQU IN.BUF+19 COMMAND EQU US.FIFO+19 * EXTERNAL DEVICE OUTPUT INSTRUCTION EXT.OUT EQU COMMAND+5 * EXTERNAL DEVICE INPUT INSTRUCTION EXT.IN EQU EXT.OUT+6 MODEADR EQU EXT.IN+3 G.END EQU MODEADR+2 END START