TITLE COMMAND SUBSYSTEM-MODULE 2 OF SYSTEM MONITOR * Release A ; ******Donated to the Pascal/Z Users Group,July 1980*********** ; COMMAND SUBSYSTEM - MODULE TWO ; ; FILL MEMORY. ; FILL CALL GET2AD PUSH DE PUSH HL CALL CKBLK JR NC,FLL1 LD E,00H JR FLL2 FLL1 CALL DCDAD2 JP C,ERR05 FLL2 LD C,E POP HL POP DE FLL3 LD (HL),C INC HL DEC DE LD A,D OR E JR NZ,FLL3 JP COMPLT ; ; JUMP ROUTINE...TWO ENTRIES ; JUMP LOADS RESTART VECTOR AT [0000H] ; GOTO LOADS RESTART ONTO STACK FOR RETURN ; JUMP CALL GETADD JP C,ERR01 LD HL,RESTRT LD (0001H),HL LD A,0C3H LD (00H),A JR GT1 GOTO CALL GETADD JP C,ERR01 LD HL,RESTRT PUSH HL GT1 CALL HLAD1 JP (HL) ; ; DISPLAY OR LIST MEMORY COMMAND .. Four options. ; 1. combined ASCII and HEX display. ; 2. HEX display ; 3. ASCII diplay. ; 4. Text display. ; LIST LD HL,DMESS1 CALL VIDPRO DSPLAY CALL GETOPT JP C,ERR01 CP SPACE JP Z,DSHEX CP 'C' JP Z,DSCOM CP 'H' JP Z,DSHEX CP 'A' JP Z,DSASC CP 'T' JP Z,DSTXT JP ERR06 ; ; DISPLAY COMBINED ASCII AND HEX ; DSCOM CALL GET2AD DSC1 CALL ESCAPE JP C,DEXIT CALL CRLF CALL OUTHAD CALL OUT3SP CALL OUT3SP PUSH HL PUSH DE CALL OUT8HB PUSH AF INC B POP AF JR Z,DSC3 DSC2 CALL OUT3SP DJNZ DSC2 DSC3 POP DE POP HL CALL OUT8AB JR C,DSC1 JP DCMPLT ; ; DISPLAY HEX ; DSHEX CALL GET2AD DSH1 CALL ESCAPE JP C,DEXIT CALL CRLF CALL OUTHAD CALL OUT3SP CALL OUT8HB JP NC,DCMPLT CALL OUTSPC CALL OUTEXP CALL OUTSPC CALL OUTSPC CALL OUT8HB JP NC,DCMPLT JR DSH1 ; ; DISPLAY ASCII ; DSASC CALL GET2AD DSA1 CALL ESCAPE JP C,DEXIT CALL CRLF CALL OUTHAD CALL OUT3SP CALL OUT8AB JP NC,DCMPLT CALL DS8AB JP NC,DCMPLT CALL DS8AB JP NC,DCMPLT CALL DS8AB JP NC,DCMPLT JR DSA1 DS8AB CALL OUT3SP CALL OUTEXP CALL OUT3SP CALL OUT8AB RET ; DCMPLT CALL CRLFP JP COMPLT ; DEXIT CALL CRLFP JP EXIT ; ; DISPLAY TEXT .. THIS IS A DANGEROUS ROUTINE ; SHOULD ONLY BE USED FOR MEMORY CONTAINING ONLY ; ASCII TEXT. ; DSTXT CALL GET2AD CALL CRLF DST1 LD C,(HL) CALL VIDOUT INC HL CALL ESCAPE JP C,DEXIT DEC DE LD A,E OR D JR NZ,DST1 JP DCMPLT ; ; HEXIDECIMAL ARITHMETIC ; ; HEX CALL GETADD JP C,ERR07 LD A,(IY-06H) CP 2 JP NZ,ERR07 CALL HLAD1 EX DE,HL CALL HLAD2 ADD HL,DE CALL CRLFP LD C,'+' CALL VIDOUT CALL OUTSPC CALL OUTHAD CALL OUT3SP CALL OUTDSH CALL OUTSPC CALL HLAD2 SUB A EX DE,HL SBC HL,DE CALL OUTHAD JP RECOMM ; ; MOVE MEMORY COMMAND ; ; MOVE CALL GET2AD LD B,D LD C,E EX DE,HL CALL HLAD3 EX DE,HL SBC HL,DE JR C,MV1 CALL HLAD1 LDIR JP COMPLT MV1 EX DE,HL ADD HL,BC EX DE,HL CALL HLAD2 DEC DE LDDR JP COMPLT ; ; TEST MEMORY .. THREE OPTIONS. ; 1. [F] GET FIRST BLOCK OF RAM. ; 2. [Q] QUICK TEST A BLOCK OF RAM. ; 3. [C] COMPLETELY TEST A BLOCK OF RAM. ; ; TESTS [Q] AND [C] ARE DISTRUCTINE ; TEST CALL CRLFP CALL GETOPT CP SPACE JP Z,FTEST JP C,ERR01 CP 'F' JP Z,FTEST CP 'Q' JP Z,QTEST CP 'C' JP NZ,ERR06 ; ; COMPLETE TEST ; CALL CRLFP CALL GET2AD SUB A TC1 PUSH AF CALL TLOOP JR C,TC2 POP AF INC A JR NZ,TC1 JP COMPLT TC2 POP AF JP EXIT ;TEST LOOP TLOOP CALL HLAD1 LD B,D LD C,E TL0 PUSH AF CALL ESCAPE JR C,TL1 POP AF LD (HL),A CPI CALL NZ,TERR RET PO JR TL0 TL1 POP AF SCF RET ; ; TEST ERR OUTPUT ; TERR PUSH HL PUSH AF DEC HL PUSH HL LD HL,TMESS1 CALL VIDPRO POP HL CALL OUTHAD CALL OUT3SP POP AF PUSH AF CALL OUTHBT CALL OUTDSH LD A,(HL) CALL OUTHBT POP AF POP HL RET TMESS1 DEFB CR,LF,'RAM ERROR ',EOM ; ; QUICK MEMORY TEST ; QTEST CALL GET2AD LD A,0AAH CALL TLOOP JP C,EXIT LD A,055H CALL TLOOP JP C,EXIT JP COMPLT ; ; FIND FIRST BLOCK OF RAM ; FTEST CALL FMEM JP COMPLT FMEM LD HL,00 LD A,0AAH FT1 LD B,(HL) LD (HL),A CP (HL) JR Z,FT2 INC HL JR FT1 FT2 LD (IY-0CH),L LD (IY-0BH),H FT3 LD (HL),B INC HL LD B,(HL) LD (HL),A CP (HL) JR Z,FT3 DEC HL LD (IY-0AH),L LD (IY-09H),H LD HL,TMESS2 CALL VIDPRO CALL HLAD1 CALL OUTHAD CALL OUTDSH CALL HLAD2 CALL OUTHAD RET ; TMESS2 DEFB CR,LF,'FIRST CONTIGUOUS RAM MEMORY IS ',EOM ; ; PROGRAM PROM ROUTINE ; CROMEMCO BYTE-SAVER ; LOADUP CALL CRLFP CALL GET2AD LD B,D LD C,E EX DE,HL CALL HLAD3 EX DE,HL RET ; PROGRM CALL LOADUP LD A,128 PROM1 PUSH HL PUSH BC PUSH DE LDIR POP DE POP BC POP HL PUSH AF CALL ESCAPE JR C,PROM2 POP AF DEC A JR NZ,PROM1 JP VMOVE0 PROM2 POP AF JP EXIT ; ; LOCK UP THE SYSTEM ; LOCKUP CALL GETADD JP C,ERR05 LKUP LD HL,LMESS2 CALL VIDPRO CALL HLAD1 CALL SKEY CALL VHEX JR C,LKUP RLCA RLCA RLCA RLCA LD B,A CALL SKEY CALL VHEX JR C,LKUP ADD A,B CALL HLAD1 CP L JR NZ,LKUP LD HL,LMESS1 CALL VIDPRO JP RESTRT ; ; ; VERIFY MEMORY ; VMOVE CALL LOADUP VMOVE0 CALL VMOVE1 JP C,EXIT JP COMPLT ; VMOVE1 CALL ESCAPE RET C LD A,(DE) CPI CALL NZ,VERR RET PO INC DE JR VMOVE1 ; VERR PUSH BC PUSH DE PUSH HL PUSH AF DEC HL PUSH HL LD HL,VMESS1 CALL VIDPRO EX DE,HL CALL OUTAB POP HL CALL OUTAB POP AF POP HL POP DE POP BC RET ; OUTAB CALL OUT3SP CALL OUTHAD CALL OUTDSH LD A,(HL) CALL OUTHBT RET ; ; ENTER HEXIDECIMAL OR TEXT ; ENTER CALL GETOPT JP C,ERR01 CP SPACE JP Z,ENHEX CP 'T' JP Z,ENTXT CP 'H' JP Z,ENHEX JP ERR06 ; ENTXT CALL GETADD JP C,ERR03 CALL HLAD1 CALL CRLF ENT1 CALL SKEY CP STX LD (HL),A JP Z,COMPLT CP (HL) JP NZ,ERR10 INC HL LD C,A CALL VIDOUT JR ENT1 ENHEX CALL GETADD JP C,ERR03 CALL HLAD1 ENH1 CALL EHADD JR ENH3 ENH2 LD A,L AND 7 CALL Z,EHADD ENH3 CALL EHBT1 CALL EHBT2 CP SPACE JR NZ,ENH3A INC HL JR ENH2 ENH3A CP 08H ;CK BACK SPACE JR NZ,ENH3B DEC HL JR ENH1 ENH3B CP ESC JP Z,COMM CP CR JP Z,COMM CALL VHEX JR C,ENH1 ADD A,A ADD A,A ADD A,A ADD A,A LD B,A CALL EHBT2 CALL VHEX JR C,ENH1 ADD A,B LD (HL),A CP (HL) JP NZ,ERR10 CALL OUTSPC INC HL JR ENH2 ; EHADD CALL CRLF CALL OUTHAD CALL OUT3SP RET ; EHBT1 LD A,(HL) CALL OUTHBT CALL OUTDSH RET ; EHBT2 CALL SKEY PUSH AF LD C,A CALL VIDOUT POP AF RET ; ; ASSIGN I/O VECTOR BYTE FLAG. ; ASSIGN CALL GETADD JP C,ERR05 CALL HLAD1 LD A,L LD (IY-4DH),A JP COMPLT ; ; INPUT FROM A PORT ; INPUT CALL GETADD JP C,ERR05 CALL HLAD1 EX DE,HL CALL HLAD2 LD A,(IY-06H) CP 1 JP NZ,ERR05 INP1 CALL CRLFP LD C,E LD A,L IN A,(C) CALL OUTHBT CALL SKEY CP SPACE JR Z,INP1 JP COMPLT ; ; OUTPUT TO A PORT ; OUTPUT CALL GETADD JP C,ERR05 CALL HLAD1 EX DE,HL CALL HLAD2 LD A,(IY-06H) CP 2 JP NZ,ERR05 OUT1 LD C,E LD A,L OUT (C),A CALL CRLFP CALL SKEY CP SPACE JR Z,OUT1 JP COMPLT ; ; SEARCH MEMORY FOR A HEX OR ASCII STRING ; SEARCH CALL CRLFP CALL GET2AD LD A,(IX+3) OR A JP Z,ERR08 LD B,D LD C,E EXX CALL HLIX LD A,(HL) CP QUOTE JR NZ,SHEX INC HL CALL SCHSU EX DE,HL SCH0 LD (IY-0CH),0FFH LD A,(DE) EXX SCH1 PUSH AF CALL ESCAPE JR NZ,SCH1A POP AF JP EXIT SCH1A POP AF CPI JP PO,COMPLT JR NZ,SCH1 PUSH HL EX AF,AF' EXX POP HL PUSH BC PUSH DE PUSH HL SCH2 INC DE LD A,(DE) CPI JP PO,SCH3 JR Z,SCH2 POP HL JR SCH3B SCH3 LD A,(IY-0CH) INC A LD (IY-0CH),A AND 07H JR NZ,SCH3A CALL CRLFP SCH3A CALL OUT3SP POP HL DEC HL CALL OUTHAD SCH3B POP DE POP BC EX AF,AF' EXX JR SCH1 SCHSU PUSH HL LD E,(IY-02H) LD D,(IY-01H) SBC HL,DE LD A,(IY-03H) SUB L LD C,A LD B,00H POP HL RET SHEX CALL SCHSU PUSH HL PUSH HL SCH5 LD E,00H SCH6 LD A,(HL) CP SPACE JR Z,SCH7 CP MINUS JR Z,SCH7 CALL VHEX JP C,ERR09 SLA E SLA E SLA E SLA E ADD A,E LD E,A INC HL DEC C JR Z,SCH8 JR SCH6 SCH7 INC HL DEC C SCH8 LD A,E POP DE LD (DE),A INC DE PUSH DE INC B LD A,C OR A JR NZ,SCH5 POP DE LD C,B LD B,00H POP DE JP SCH0 ; ; WRITE TO CASSETTE. DAJEN/TELETEK FORMAT ; WRITE CALL CRLFP CALL GET2AD CALL SWRITE JP COMM ; ; READ FROM CASSETTE. DAJEN/TELETEK FORMAT. ; READ CALL CRLFP CALL GETADD OR A ; ABSOLUTE LOAD JR Z,RE1 DEC A ; BIASED LOAD JR Z,RE2 DEC A JP NZ,ERR03 ; SPECIFIC LOAD JR RE3 RE1 LD HL,00H JR RE2A RE2 CALL HLAD1 RE2A SUB A JR RE4 ; ; SPECIFIC LOAD ; RE3 CALL CALCAD SUB A DEC A ; ABSOLUTE/BIAS LOAD RE4 CALL SREAD JP COMM ; ; COMPLETION VECTOR ; COMPLT LD HL,CMESS1 CMPT1 CALL VIDPRO JP RESTRT EXIT LD HL,CMESS2 JR CMPT1 ; ; Not Available message; jump to restart ; NAVAIL LD HL,NMESS1 CALL VIDPRO JP RECOMM ; ; CPM FILE VECTOR ; CPM LD HL,NMESS2 CALL VIDPRO JP DISK1 ; ; ERROR VECTORS ; ERR01 LD HL,EMAC01 EV1 CALL VIDPRO JP RECOMM ERR02 LD HL,EMAC02 JR EV1 ERR03 LD HL,EMAC03 JR EV1 ERR04 LD HL,EMAC04 JR EV1 ERR05 LD HL,EMAC05 JR EV1 ERR06 LD HL,EMAC06 JR EV1 ERR07 LD HL,EMAC07 JR EV1 ERR08 LD HL,EMAC08 JR EV1 ERR09 LD HL,EMAC09 JR EV1 ERR10 LD HL,EMAC10 JR EV1 ; ; MONITOR TABLES ; CTBLE DEFB 'UCPMDT' VTBLE DEFB 'UMDT' DELCHR DEFB ' .,;:-+*/=' ; ; WORD LIST FOR MACRO-MESSAGES ; WD00 DEFB CR,LF,PROMP,EOM WD01 DEFB 'COMMAND ',EOM WD02 DEFB 'ERROR ',EOM WD03 DEFB '; REENTER ',EOM WD04 DEFB 'ENTER ',EOM WD05 DEFB 'SOURCE/DESINATION ',EOM WD06 DEFB 'ADDRESS ',EOM WD07 DEFB 'NOT AVAILABLE ',EOM WD08 DEFB 'HEXIDECIMAL ',EOM WD09 DEFB 'REVERSED ',EOM WD10 DEFB 'BYTE ',EOM WD11 DEFB 'COMPLETE ',EOM WD12 DEFB 'CP/M FILE ',EOM WD13 DEFB 'ESCAPE ',EOM WD14 DEFB 'OPTION ',EOM WD15 DEFB 'VERIFY ',EOM WD16 DEFB 'SEARCH FIELD ',EOM ; ; MESSAGE MACROS ; SMESS1 DEFB CLEAR,SCROLL DEFB '***SPHINX MONITOR ..Version I.1***',EOM SMESS2 DEFB SCROLL,DIR,CR,LF,PROMP,EOM SMESS3 DEFB STX,3 DEFW SMESS2,WD04,WD01 DEFB EOM CMESS1 DEFB STX,2 DEFW MAC2,WD11 DEFB EOM CMESS2 DEFB STX,2 DEFW MAC2,WD13 DEFB EOM DMESS1 DEFB PAGE,PTGL,SCROLL,EOM NMESS1 DEFB STX,5 DEFW MAC2,WD01,WD07,WD03,WD01 DEFB EOM NMESS2 DEFB STX,2 DEFW MAC2,WD12 DEFB EOM LMESS1 DEFB STX,2 DEFW SMESS1,WD00 DEFB '***UNLOCKED***',EOM LMESS2 DEFB STX,3 DEFW SMESS1,WD00,WD00 DEFB '***LOCKED***',STX,2 DEFW WD00,WD00 DEFB 'TO UNLOCK ' DEFB STX,3 DEFW WD04,WD08,WD10 DEFB 'KEY',EOM VMESS1 DEFB STX,3 DEFW WD00,WD15,WD02 DEFB EOM ; MACRO: CR LF CLEAR LINE MAC2 DEFB LF MAC3 DEFB SCROLL,CR,REPT,40H,SPACE,PAGE,CUP,SCROLL,EOM ; MACRO: ERROR ; REENTER COMMAND MAC1 DEFB STX,3 DEFW WD02,WD03,WD01 DEFB EOM ;COMMAND ERROR ;REENTER COMMAND EMAC01 DEFB STX,3 DEFW MAC2,WD01,MAC1 DEFB EOM ;SOURCE/DESTINATION ERROR ; REENTER COMMAND EMAC02 DEFB STX,3 DEFW MAC2,WD05,MAC1 DEFB EOM ;HEXIDECIMAL ADDRESS ERROR ; REENTER COMMAND EMAC03 DEFB STX,4 DEFW MAC2,WD08,WD06,MAC1 DEFB EOM ;REVERSED ADDRESS ERROR ; REENTER COMMAND EMAC04 DEFB STX,4 DEFW MAC2,WD09,WD06,MAC1 DEFB EOM ;HEXIDECIMAL BYTE ERROR ; REENTER COMMAND EMAC05 DEFB STX,4 DEFW MAC2,WD08,WD10,MAC1 DEFB EOM EMAC06 DEFB STX,3 DEFW MAC2,WD14,MAC1 DEFB EOM EMAC07 DEFB STX,3 DEFW MAC2,WD08,MAC1 DEFB EOM EMAC08 DEFB STX,1 DEFW MAC2 DEFB 'NO ' DEFB STX,2 DEFW WD16,MAC1 DEFB EOM EMAC09 DEFB STX,4 DEFW MAC2,WD16,WD08,MAC1 DEFB EOM EMAC10 DEFB STX,5 DEFW MAC2,WD04,WD10,WD15,MAC1 DEFB EOM