Compucolor.org – Virtual Media

Listing of file='MONITR.BAS;01' on disk='vmedia/ncc_4_11-sector.ccvf'

100 REM  MONITER(PHASE 2) BY PATRICK LEABO & E.SWANK
200 DA= 40863:AD= 32940:GOSUB 3600:CLEAR 200
500 TM= 40864:POKE 33289,200
600 DA= TM:AD= 33283:GOSUB 3600
700 RESTORE 800:FOR N= 0TO 7:READ RE$(N):NEXT
800 DATA PSW,A,C,B,E,D,L,H
900 DIM A$(15):FOR X= 0TO 15
1000 READ A$(X):NEXT
1100 DATA 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
1200 DIM C$(255)
1300 FOR X= 0TO 255:READ C$(X):NEXT
1400 PRINT TAB( 28);"
M E N U"
1500 PRINT "
1. DUMP       2. DISASM       3. DISPLAY REG  4. ALTER REG

5. ADD BREAK  6. MODIFY BYTE  7. JMP TO PGM
"
1600 INPUT "CHOICE- ";CH:PRINT
1700 ON CHGOTO 17400,5400,2200,2600,4100,4500,1800,1400,5300
1800 REM JUMP TO PRGM
1900 INPUT "JUMP ADR = ";AD$
2000 DA= VAL (AD$):IF RIGHT$ (AD$,1)= "H"THEN GOSUB 3200
2100 AD= 40913:GOSUB 3600:X= CALL (7)
2200 AD= TM+ 11:FOR N= 1TO 7STEP 2:REM DISP REG
2300 P1= PEEK (AD+ N):P2= PEEK (AD+ N- 1):PLOT 6,3:PRINT RE$(N);TAB( 3);RE$(N- 1);TAB( 8);:PLOT 6,2
2400 PRINT P1;TAB( 12)P2TAB( 18):L= P1:GOSUB 15600:L= P2:GOSUB 15600:H= 256* P1+ P2:PRINT TAB( 24)H
2500 NEXT :PRINT "BREAK POINT =";:H= PEEK (TM+ 19)+ 256* PEEK (TM+ 20):GOSUB 16300:PRINT "  ";H:GOTO 1400
2600 REM ALTERREG
2700 AD= TM+ 11:FOR N= 0TO 7:PRINT "REG ";RE$(N);"=";PEEK (AD+ N);TAB( 15);:GOSUB 3900:PRINT "";H$;
2800 INPUT "  NEW=";AD$
2900 DA= VAL (AD$):IF RIGHT$ (AD$,1)= "H"THEN GOSUB 3200
3000 IF AD$< > "0" AND  AD$< > "" THEN POKE AD+ N,DA
3100 NEXT :GOTO 1400
3200 REM HEX/DEC
3300 DA= 0:LL= LEN (AD$)- 2:FOR E= 0TO LL
3400 NM$= MID$ (AD$,E+ 1,1):NM= VAL (NM$):IF (NM$< > "0")AND (NM= 0)THEN NM= ASC (NM$)- 55
3500 DA= DA+ NM* 16^ (LL- E):NEXT :DA= INT (DA+ .5):RETURN
3600 REM 2BYTPOKER
3700 X1= INT (DA/ 256):X2= DA- 256* X1
3800 POKE AD,X2:POKE AD+ 1,X1:RETURN
3900 REM HEX PEEKER
4000 NM= PEEK (AD+ N):H$= A$(INT (NM/ 16))+ A$(NM- INT (NM/ 16)* 16):RETURN
4100 REM BRKPT
4200 RA= PEEK (TM+ 19)+ 256* PEEK (TM+ 20):O1= PEEK (TM+ 21):POKE RA,O1:O1= PEEK (TM+ 22):POKE RA+ 1,O1:O1= PEEK (TM+ 23):POKE RA+ 2,O1
4300 PRINT "ADR FOR BREAK - ";:GOSUB 5000:O1= PEEK (DA):POKE TM+ 21,O1:O1= PEEK (DA+ 1):POKE TM+ 22,O1:O1= PEEK (DA+ 2):POKE TM+ 23,O1
4400 AD= 40883:GOSUB 3600:AD= 195:POKE DA,AD:AD= DA+ 1:DA= 40915:GOSUB 3600:GOTO 1400
4500 REM STRBYT
4600 PRINT "STORE BYTE--";:GOSUB 5000:AD= DA
4700 PRINT "";AD;TAB( 7);:H= AD:GOSUB 16300:PRINT "H ";PEEK (AD);TAB( 18):L= PEEK (AD):GOSUB 15600:PRINT "H  ";
4800 INPUT "DATA BYTE = ";AD$:IF (LEN (AD$)= 1)AND (AD$= "0")THEN 1400
4900 GOSUB 5100:POKE AD,DA:AD= AD+ 1:GOTO 4700
5000 INPUT "ADDR = ";AD$
5100 DA= VAL (AD$):IF RIGHT$ (AD$,1)= "H"THEN GOSUB 3200
5200 RETURN
5300 INPUT "STRING=";AB$:PLOT 12:PRINT AB$:PRINT AB$:GOTO 1400
5400 REM  DIS
5500 PRINT "DISASSEMBLER"
5600 PRINT :INPUT "TRACE ON (0 OR 1)";TR:PRINT
5700 PRINT "START ";:GOSUB 5000:AD= DA
5800 OUT 8,247:POKE 33278,255:GOSUB 20300
5900 H= AD
6000 OUT 8,255:IF PEEK (33278)= 32THEN 1400
6100 OUT 8,247
6200 PLOT 19:PRINT H;TAB( 7);:PLOT 18
6300 GOSUB 16500
6400 PRINT TAB( 13);
6500 D= PEEK (AD)
6600 N= VAL (LEFT$ (C$(D),1))
6700 C$= MID$ (C$(D),ABS (N> 0)+ 1,8)
6800 ON N+ 1GOSUB 7700,8400,10200
6900 PRINT TAB( 50);"";:FOR XC= 1TO CD+ 1:PRINT RIGHT$ (STR$ (XC- 1),1);:NEXT :PRINT :REM 
7000 AD= AD+ 1
7100 IF TR= 0THEN 7500
7200 IF D= 195THEN AD= H:GOTO 7500
7300 IF D= 205THEN RA(CD)= AD:AD= H:CD= CD+ 1:GOTO 7500
7400 IF (D= 201)AND (CD> 0)THEN CD= CD- 1:AD= RA(CD)
7500 GOTO 5900
7600 REM 1 BYTE
7700 L= D
7800 GOSUB 15700
7900 PRINT TAB( 23);
8000 PRINT C$;
8100 PRINT TAB( 33);:PRINT " (";D;" )";
8200 RETURN
8300 REM 2 BYTE
8400 L= D
8500 GOSUB 15700
8600 PRINT TAB( 16);
8700 AD= AD+ 1
8800 DA= PEEK (AD)
8900 L= DA
9000 GOSUB 15700
9100 PRINT TAB( 23);
9200 GOSUB 17300
9300 PRINT " ";
9400 L= DA
9500 GOSUB 15700
9600 PLOT 19
9700 PRINT TAB( 33);
9800 PRINT " (";D;",";L;" )";
9900 PLOT 18
10000 RETURN
10100 REM 3 BYTE
10200 L= D
10300 GOSUB 15700
10400 PRINT TAB( 16);
10500 AD= AD+ 1
10600 L1= PEEK (AD)
10700 L= L1
10800 GOSUB 15700
10900 PRINT TAB( 19);
11000 AD= AD+ 1
11100 H1= PEEK (AD)
11200 L= H1
11300 GOSUB 15700
11400 PRINT TAB( 23);
11500 GOSUB 17300
11600 H= L1+ 256* H1
11700 GOSUB 16500
11800 PLOT 20
11900 PRINT TAB( 33);
12000 PRINT " (";D;",";H;
12100 PRINT " )";
12200 PLOT 18
12300 RETURN
12400 DATA NOP,2LXI.B,STAX.B,INX.B,INR.B,DCR.B,1MVI.B,RLC
12500 DATA ?,DAD.B,LDAX.B,DCX.B,INR.C,DCR.C,1MVI.C,RRC
12600 DATA ?,2LXI.D,STAX.D,INX.D,INR.D,DCR.D,1MVI.D,RAL
12700 DATA ?,DAD.D,LDAX.D,DCX.D,INR.E,DCR.E,1MVI.E,RAR
12800 DATA ?,2LXI.H,2SHLD,INX.H,INR.H,DCR.H,1MVI.H,DAA
12900 DATA ?,DAD.H,2LHLD,DCX.H,INR.L,DCR.L,1MVI.L,CMA
13000 DATA ?,2LXI.SP,2STA,INX.SP,INR.M,DCR.M,1MVI.M,STC
13100 DATA ?,DAD.SP,2LDA,DCX.SP,INR.A,DCR.A,1MVI.A,CMC
13200 DATA MOV.B<B,MOV.B<C,MOV.B<D,MOV.B<E,MOV.B<H,MOV.B<L,MOV.B<M,MOV.B<A
13300 DATA MOV.C<B,MOV.C<C,MOV.C<D,MOV.C<E,MOV.C<H,MOV.C<L,MOV.C<M,MOV.C<A
13400 DATA MOV.D<B,MOV.D<C,MOV.D<D,MOV.D<E,MOV.D<H,MOV.D<L,MOV.D<M,MOV.D<A
13500 DATA MOV.E<B,MOV.E<C,MOV.E<D,MOV.E<E,MOV.E<H,MOV.E<L,MOV.E<M,MOV.E<A
13600 DATA MOV.H<B,MOV.H<C,MOV.H<D,MOV.H<E,MOV.H<H,MOV.H<L,MOV.H<M,MOV.H<A
13700 DATA MOV.L<B,MOV.L<C,MOV.L<D,MOV.L<E,MOV.L<H,MOV.L<L,MOV.L<M,MOV.L<A
13800 DATA MOV.M<B,MOV.M<C,MOV.M<D,MOV.M<E,MOV.M<H,MOV.M<L,HALT,MOV.M<A
13900 DATA MOV.A<B,MOV.A<C,MOV.A<D,MOV.A<E,MOV.A<H,MOV.A<L,MOV.A<M,MOV.A<A
14000 DATA ADD.B,ADD.C,ADD.D,ADD.E,ADD.H,ADD.L,ADD.M,ADD.A
14100 DATA ADC.B,ADC.C,ADC.D,ADC.E,ADC.H,ADC.L,ADC.M,ADC.A
14200 DATA SUB.B,SUB.C,SUB.D,SUB.E,SUB.H,SUB.L,SUB.M,SUB.A
14300 DATA SBB.B,SBB.C,SBB.D,SBB.E,SBB.H,SBB.L,SBB.M,SBB.A
14400 DATA ANA.B,ANA.C,ANA.D,ANA.E,ANA.H,ANA.L,ANA.M,ANA.A
14500 DATA XRA.B,XRA.C,XRA.D,XRA.E,XRA.H,XRA.L,XRA.M,XRA.A
14600 DATA ORA.B,ORA.C,ORA.D,ORA.E,ORA.H,ORA.L,ORA.M,ORA.A
14700 DATA CMP.B,CMP.C,CMP.D,CMP.E,CMP.H,CMP.L,CMP.M,CMP.A
14800 DATA RNX,POP.B,2JNZ,2JMP,2CNZ,PUSH.B,1ADI,RST.0
14900 DATA RZ,RET,2JZ,?,2CZ,2CALL,1ACI,1RST.1
15000 DATA RNC,POP.D,2JNC,1OUT,2CNC,PUSH.D,1SUI,RST.2
15100 DATA RC,?,2JC,1IN,2CC,?,1SBI,RST.3
15200 DATA RPO,POP.H,2JPO,XTHL,2CPO,PUSH.H,1ANI,RST.4
15300 DATA RPE,PCHL,2JPE,XCHG,2CPE,?,1XRI,RST.5
15400 DATA RP,POP.PSW,2JP,DI,2CP,PUSH.PSW,1ORI,RST.6
15500 DATA RM,SPHL,2JM,EI,2CM,?,1CPI,RST.7
15600 REM PR L 2 HEX DIG
15700 D1= INT (L/ 16)
15800 D2= L- 16* D1
15900 PLOT 23
16000 PRINT A$(D1);A$(D2);
16100 PLOT 18
16200 RETURN
16300 REM PR H 4 HEX DIG
16400 H= INT (H+ .5)
16500 D1= INT (H/ 4096)
16600 D2= INT ((H- 4096* D1)/ 256)
16700 D3= INT ((H- 4096* D1- 256* D2)/ 16)
16800 D4= INT (H- 4096* D1- 256* D2- 16* D3)
16900 PLOT 22
17000 PRINT A$(D1);A$(D2);A$(D3);A$(D4);
17100 PLOT 18:RETURN
17200 REM ? OP
17300 PRINT C$;" ";:RETURN
17400 REM DECDMP
17500 LN= 0:PLOT 15,29,27,11
17600 LE$(0)= "":LE$(1)= " ":LE$(2)= "  ":REM 
17700 INPUT "HEX OR DEC FORMAT (0 OR 1) ? ";FM$:FM= VAL (FM$):IF FM> 2THEN 17700
17800 PRINT "INPT START ";:GOSUB 5000:SA= DA
17900 FM= FM* 2+ 7
18000 PRINT :IF AD$= "0" OR  AD$= ""THEN SA= 1024* 40
18100 OUT 8,247:POKE 33278,255:GOSUB 20300
18200 HR$= " ADDR     0   1   2   3   4   5   6   7":IF FM= 9THEN HR$= HR$+ "   8   9"
18300 HR$= HR$+ "      ASCII":PRINT HR$
18400 OUT 8,255:IF PEEK (33278)= 32THEN 1400
18500 OUT 8,247
18600 PRINT "";SA,
18700 FOR N= SATO SA+ FM
18800 SP= PEEK (N):SP$= STR$ (SP)
18900 LE= 4- LEN (SP$)
19000 PRINT LE$(LE);SP$;:GOTO 19600
19100 FOR Z= SATO SA+ FM:SP= PEEK (Z)
19200 IF ((SP> 127)OR (SP< 32))THEN PRINT "";CHR$ (100);:GOTO 19500
19300 IF SP> 95THEN PRINT "";CHR$ (SP);:GOTO 19500
19400 IF SP< = 95THEN PRINT "";CHR$ (SP);
19500 NEXT :PRINT :RETURN
19600 NEXT :PRINT "   ";:GOSUB 19100
19700 H= SA:PRINT "   ";:GOSUB 16300:PRINT "H  ";:FOR N= SATO SA+ FM:
19800 L= PEEK (N):GOSUB 15600:PRINT "  ";
19900 NEXT :PRINT ""
20000 SA= SA+ FM+ 1:AS$= ""
20100 LN= LN+ 1:IF LN> 14THEN LN= 0:PRINT :PRINT HR$
20200 GOTO 18400
20300 PLOT 10:PRINT "HOLD DOWN SPACE BAR TO STOP":PLOT 10,10:RETURN