Compucolor.org – Virtual Media

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

0 A0= PEEK (32981)+ 35
1 POKE  33282,195:REM  JMP
2 POKE  33283,0:POKE  33284,A0
3 POKE  32941,A0- 1
5 CLEAR  200:A0= PEEK  (33284):B1= INT (A0/ 16):B0= A0- 16* B1:IF  B1> 9 THEN  B1= B1+ 7
6 IF  B0> 9 THEN  B0= B0+ 7
7 CX= 256* A0:B1= B1+ 48:B0= B0+ 48:A0$= CHR$ (B1)+ CHR$ (B0)
10 IF  (PEEK (CX)< > 243) OR  (PEEK (CX+ 2)< >  33) THEN  PLOT  27,4:PRINT "LOAD PR0042.PRG;1 "+ A0$+ "00":PLOT  27,27
11 DIM  R$(16),D$(16),R0$(7),R2$(7),R3$(7),R4$(7),R5$(7),ST(10),R6$(7),AD(7),SQ(4),S(9),S$(4)
12 INPUT  "ENTER # OF LINES/PAGE <80> ";LM:IF  LM< 10 THEN  LM= 80
13 INPUT  "ENTER CHRS/LN <80> ";CL: IF  CL< 5 THEN  CL= 80
14 INPUT  "SCREEN OR PRINTER ";Q$:PS= 14:IF  LEFT$ (Q$,1)= "S" THEN  PS= 0:GOTO  16
15 PG= 1:INPUT  "ENTER BAUD RATE <110,150,300,1200,2400,4800 OR <9600> ";BR:B= 7:IF  BR= 110 THEN  B= 1
16 IF  BR= 150 THEN  B= 2
17 IF  BR= 300 THEN  B= 3
18 IF  BR= 1200 THEN  B= 4
19 IF  BR= 2400 THEN  B= 5
20 IF  BR= 4800 THEN  B= 6
21 PLOT  27,18,B
23 INPUT  "TITLE ";TI$:INPUT  "ENTER START ADDRESS <DECIMAL> ";SA:PC= SA:IF  PC > 2^ 16 GOTO  22
24 IF  PC< 0 THEN  22
25 IF  CL> 255 THEN  CL= 255
26 Q$= ""
30 H1$= "          CMD           !SZAPC! A ! B ! C ! D ! E ! H ! L !"
31 H1$= H1$+ "DATA SP ADR!MEM  MADR"
40 H2$= "------------------------+-----+---+---+---+---+---+---+---+-----------+---------"
50 LN= 1
60 DATA  "B","C","D","E","H","L","M","A","B  ","D  ","H  ","SP ","PSW"
65 RESTORE  60 : FOR  I= 0 TO  12: READ  R$(I):NEXT
66 DATA  123,122,125,124,127,126,128,129
67 RESTORE  66:A0= 256* PEEK (33284):FOR  I= 0 TO  7:READ  A1:AD(I)= A1+ A0:NEXT
68 AREG= AD(7):SLO= A0+ 67:SHI= SLO+ 1
69 S0= 0:S1= 28:S2= 45:HREG= AD(4):LREG= AD(5):XEI= A0+ 97
70 DATA  "     ","   ","        ","     ","     ","   ","   ","   ","   ","   ","   ","   "
71 DATA  "     ","     ","   ","     "
72 DATA  8,11,20,23,27,36,39,44,51,58,61,74,77,82,91,94,97,100,103,107,0
74 RESTORE  72:A2= PEEK (33284)
75 READ  A1:IF  A1< > 0 THEN  POKE  A0+ A1,A2:GOTO  75
76 DATA  64,1,4,128,16
77 RESTORE  76:FOR  I= 0 TO  4:READ  SQ(I):NEXT
80 DATA  "ADD","ADC","SUB","SBB","AND","XRA","ORA","CMP"
82 RESTORE  80:FOR  I= 0 TO  7:READ  R2$(I):NEXT
85 DATA  "ADI","ACI","SUI","SBI","ANI","XRI","ORI","CPI"
87 RESTORE  85:FOR  I= 0 TO  7:READ  R3$(I):NEXT
89 DATA  "RLC","RRC","RAL","RAR","DAA","CMA","STC","CMC"
90 RESTORE  89:FOR  I= 0 TO  7:READ  R0$(I):NEXT
91 DATA  "RNZ","RZ ","RNC","RC ","RPO","RPE","RP ","RM "
92 FOR  I= 0 TO  7:READ  R4$(I):NEXT
93 DATA  "JNZ","JZ ","JNC","JC ","JPO","JPE","JP ","JM "
94 FOR  I= 0 TO  7:READ  R5$(I):NEXT
95 DATA  "CNZ","CZ ","CNC","CC ","CPO","CPE","CP ","CM "
96 RESTORE  95:FOR  I= 0 TO  7:READ  R6$(I):NEXT
100 IF  LN> 1 THEN  GOTO  140
110 FA= PEEK (33265):FB= PEEK (33289):POKE  33265,PS:POKE  33289,CL
115 IF  PG> 1 THEN  PLOT  12
120 PRINT "PAGE ";PG:PRINT TI$:PRINT "START ADDRESS = ";SA
130 PRINT :PRINT :PRINT H1$:PRINT H2$:POKE  33265,FA:POKE 33289,FB:PG= PG+ 1
140 CM= PEEK (PC):PL= PC:REM  FETCH
150 RESTORE  70:FOR  I= 0 TO  15:READ  D$(I):NEXT :GOSUB  770
160 GOSUB  600
200 O3= INT (CM/ 64):OT= CM- 64* O3:O2= INT (OT/ 8):O1= INT (OT- O2* 8)
210 ON  O3+ 1 GOTO  1000,1100,1200,1300
300 D$(2)= "*** UDF <<":D$(3)= "   "
400 FA= PEEK (33265):FB= PEEK (33289):POKE  33265,PS:POKE  33289,80
410 FOR  I= 0 TO  15:PRINT D$(I);:IF  I= 15 GOTO  430
415 IF  I< 3 OR  I= 12 OR  I= 14 THEN  PRINT " ";:GOTO  430
420 PRINT "!";
430 NEXT
440 PRINT :L2= L2+ 1:LN= LN+ 1:IF  LN+ 9> LM THEN  LN= 1:L2= 0
445 IF  L2= 5 THEN  PRINT H2$:LN= LN+ 1:L2= 0
460 POKE  33265,FA:POKE  33289,FB:IF  CM= 118 THEN  END
490 GOTO  100
500 POKE  A0+ 69,CM:X= CALL (X):POKE  33282,195:POKE  33283,S2:POKE  33284,A2:RETURN
600 POKE  33283,S2
601 PC= PC+ 1:IF  PC> 65535 THEN  PC= 0:REM  TEST ******
602 IF  PC< 0 THEN  PC= 65535
603 Z= PEEK (PC):RETURN :REM  END TEST ***
650 XB= PEEK (SLO)+ 256* PEEK (SHI):X= PEEK (XB)+ 256* PEEK (XB+ 1):XA= CALL (PC):POKE  33283,S2
655 RETURN
700 A$= R$(A):IF  A< 6 THEN  D$(6+ A)= RIGHT$ ("   "+ STR$ (PEEK (AD(A))),3):RETURN :REM  SINGLE REGS B-L
702 IF  A= 7 THEN  D$(5)= RIGHT$ ("   "+ STR$ (PEEK (AREG)),3):GOTO  720:REM  SINGLE AREG
703 MEMADR= AD(5):MEM= PEEK (MEMADDR)+ 256* PEEK (MEMADDR + 1)
704 D$(14)= RIGHT$ ("   "+ STR$ (PEEK (MEM)),3):REM  MEM DATA & ADDRESS
705 D$(15)= RIGHT$ ("     "+ STR$ (MEM),5):RETURN
707 S$= R$(S):RETURN
710 TA= A:IF  TA< 5 THEN  A= TA:GOSUB  700:A= TA+ 1:GOSUB  700:A$= R$(8+ TA/ 2):RETURN :DOUBLE REG B- H
712 IF  TA= 6 THEN  A$= "PSW":A= 7:GOTO  702:REM  PSW
714 SX= PEEK (SLO)+ 256* PEEK (SHI):D$(13)= RIGHT$ ("     "+ STR$ (SX),5):REM  STACK
715 SY= SX+ 1:IF  SY> 65535 THEN  SX= 0
716 SY= SX+ 1:IF  SY> 65535 THEN  SY= 0
717 D$(12)= RIGHT$ ("     "+ STR$ (PEEK (SX)+ 256* PEEK (SY)),5):RETURN
718 A$= "PSW":GOTO  702:REM  PSW
720 SX= PEEK (AD(6)):FOR  I= 0 TO  8 STEP  2:S(I)= 1:S(I+ 1)= 0:S$(I/ 2)= "0":REM  STATUS
722 IF  (SQ(I/ 2) AND  SX) > 0 THEN  S(I)= 0:S(I+ 1)= 1:S$(I/ 2)= "1"
724 NEXT
726 D$(4)= S$(3)+ S$(0)+ S$(4)+ S$(2)+ S$(1):RETURN
730 D$(14)= RIGHT$ ("   "+ STR$ (PEEK (Y)),3):D$(15)= RIGHT$ ("     "+ STR$ (Y),5):RETURN :REM  DIRECT DATA
740 D$(3)= RIGHT$ ("     "+ STR$ (Y),5):RETURN :REM  IMED DATA
750 D$(14)= RIGHT$ ("     "+ STR$ (PEEK (Y)+ 256* PEEK (Y+ 1)),5)
755 D$(15)= "   ":RETURN  :REM  2BYTE MEM
770 D$(0)= RIGHT$ ("     "+ STR$ (PC),5)
774 D$(1)= RIGHT$ ("   "+ STR$ (CM),3):RETURN  :REM  CMD &PC
800 POKE  33283,S1:GOTO  650:REM  POP D
900 POKE  33283,S0:GOTO  650: REM PUSH D
1000 ON  O1+ 1 GOTO  2000,2100,2200,2300,2400,2500,2600,2700
1010 GOTO  300
1100 IF  O2= 6 AND  O1 =  6 THEN  D$(2)= "HLT     ":PC= PL:GOTO  400
1110 X= 0:GOSUB  500
1120 A= O2:S= O1:GOSUB  700:GOSUB  707 :D$(2)= "MOV "+ A$+ ","+ S$+ " ":GOTO  400
1200 X= 0:GOSUB  500
1205 A= 7:S= O1:GOSUB  700:GOSUB  707
1210 IF  O2= 7 THEN  D$(5)= "   "
1220 D$(2)= R2$(O2)+ " "+ S$+ "   ":GOTO  400
1300 ON  O1+ 1 GOTO  3000,3100,3200,3300,3400,3500,3600,3700
1310 GOTO  300
2000 IF  O2> 0 THEN  300
2010 D$(2)= "NOP     ":GOTO  400
2100 IF  O2= 2* INT (O2/ 2) GOTO  2160
2110 X= 0:GOSUB  500:A= 4 :GOSUB  710:GOSUB  720:S= 8+ O2/ 2:GOSUB  707
2120 D$(2)= "DAD "+ S$+ " ":GOTO  400
2160 Y= Z:GOSUB  600:Y= Y+ 256* Z:GOSUB  600:A= O2
2165 X= Y:GOSUB  500:IF  A< 6 THEN  GOSUB  710:GOTO  2167
2166 GOSUB  714:A$= "SP "
2167 GOSUB  740:D$(2)= "LXI "+ A$+ ",":GOTO  400
2200 ON  O2+ 1 GOTO  2210,2220,2210,2220,2250,2260,2270,2280
2205 GOTO  300
2210 Y= PEEK (AD(O2+ 1))+ 256* PEEK (AD(O2)):X= 0:GOSUB  500:GOSUB  730:S= O2/ 2+ 8:GOSUB  707
2211 A= 7:GOSUB  700
2212 D$(2)= "STAX ":A$= S$:S$= "":GOTO  2240
2220 Y= PEEK (AD(O2))+ 256* PEEK (AD(O2- 1)):X= 0:GOSUB  500:GOSUB  730
2221 A= 7:GOSUB  700
2222 S= O2/ 2+ 8:GOSUB  707:D$(2)= "LDAX ":A$= S$:S$= ""
2240 D$(2)= D$(2)+ A$+ S$:GOTO  400
2250 D$(2)= "SHLD ":S$= " "
2255 Y= Z:GOSUB  600:Y= Y+ Z* 256:GOSUB  600:GOSUB  740:A$= "  ":X= Y:GOSUB  500:GOSUB  750:GOTO  2240
2260 D$(2)= "LHLD ":S$= "  "
2265 Y= Z:GOSUB  600:Y= Y+ Z* 256:GOSUB  600:X= Y:GOSUB  500:GOSUB  740:A= 4:GOSUB  710:A$= " ":GOTO  2240
2270 D$(2)= "STA ":S$= "    ":A$= ""
2275 Y= Z:GOSUB  600:Y= Y+ Z* 256:GOSUB  600:X= Y:GOSUB  500:GOSUB  740:GOTO  2240
2280 D$(2)= "LDA ":S$= " "
2285 Y= Z:GOSUB  600:Y= Y+ Z* 256:GOSUB  600:X= Y:GOSUB  500:GOSUB  740:A= 7:GOSUB  700:A$= "   ":GOTO  2240
2300 IF  O2= 2* INT (O2/ 2) GOTO  2350
2310 D$(2)= "DCX ":A= O2- 1
2315 S$= " ":X= 0:GOSUB  500:IF  A< 6 THEN  GOSUB  710:GOTO  2240
2317 A$= "SP ":GOSUB  714:GOTO  2240
2350 D$(2)= "INX ":A= O2:GOTO  2315
2400 D$(2)= "INR ":A= O2
2410 X= 0:GOSUB  500:GOSUB  700:GOSUB  720:D$(2)= D$(2)+ A$+ "   ":GOTO  400
2500 D$(2)= "DCR ":A= O2:GOTO  2410
2600 D$(2)= "MVI ":A= O2:S$= ",  "
2610 Y= Z:GOSUB  600:X= Y:GOSUB  500:GOSUB  700:GOSUB  740:D$(2)= D$(2)+ A$+ ",  ":GOTO  400
2700 D$(2)= R0$(O2)+ "     "
2710 X= 0:GOSUB  500:IF  O2> 5 THEN  GOSUB  720:GOTO  400
2715 A= 7:GOSUB  700:GOTO  400
3000 D$(2)= R4$(O2):RF= 0:IF  S(O2)= 1 THEN  RF= 1
3001 S$= "   ":GOTO  3122
3100 ON  O2+ 1 GOTO  3110,3120,3110,300,3110,3150,3110,3170
3105 GOTO  300
3110 D$(2)= "POP ":S$= " "
3112 A= O2:X= 0:GOSUB  500:GOSUB  714:GOSUB  710:D$(2)= D$(2)+ A$+ S$:GOTO  400
3120 D$(2)= "RET":RF= 1
3122 IF  RF= 1 THEN  GOSUB  800: PC= X:GOSUB  714
3125 D$(2)= D$(2)+ "     ":GOTO  400
3150 D$(2)= "PCHL    ":PC= PEEK (LREG)+ 256* PEEK (HREG):GOTO  400
3170 D$(2)= "SPHL    ":S= 19:X= 0:GOSUB  500:GOSUB  714:GOTO  400
3200 D$(2)= R5$(O2):JF= 0:IF  S(O2)= 1THEN  JF= 1:GOTO  3315
3210 GOTO  3315
3300 ON  O2+ 1 GOTO  3310,300,3330,3340,3350,3360,3370,3380
3305 GOTO  300
3310 D$(2)= "JMP":JF= 1
3315 A= 21:Y= Z:GOSUB  600:Y= Y+ Z* 256:GOSUB  600: GOSUB  740:D$(2)= D$(2)+ "     ":IF  JF= 1 THEN  PC= Y
3317 GOTO  400
3330 D$(2)= "OUT"
3331 IF  (Z> 96 AND  Z< 101) OR  Z= 103 OR  Z= 106 OR  Z= 119 OR  Z= 122 OR  Z= 126 OR  Z= 127 OR (Z> 110 AND  Z< 117) THEN  CM= 0
3332 X= Z:GOSUB  600:GOSUB  500:A= 7:GOSUB  700:Y= X:GOSUB  740:D$(2)= D$(2)+ "     ":GOTO  400
3340 D$(2)= "IN ":GOTO  3332
3350 D$(2)= "XTHL    ":X= 0:GOSUB  500:A= 4:GOSUB  710:GOSUB  714:GOTO  400
3360 D$(2)= "XCHG    ":X= 0:GOSUB  500:A= 2:GOSUB  710:A= 4:GOSUB  710:GOTO  400
3370 D$(2)= "DI"
3372 POKE  XEI,CM:CM= 0:X= 0:GOSUB  500:D$(2)= D$(2)+ "      ":GOTO  400
3380 D$(2)= "EI":GOTO  3372
3400 D$(2)= R6$(O2)+ "     ":CF= 0:IF  S(O2)= 1 THEN  CF= 1
3402 GOTO  3522
3500 ON  O2+ 1 GOTO  3510,3520,3510,300,3510,300,3510,300
3501 GOTO  300
3502 Y= Z:GOSUB  600:Y= Y+ 256* Z:GOSUB  600:S= 8+ (O2- 8)/ 2:A= 21:S= 18:GOSUB  700:IF  CF= 1 THEN  PC= Y
3504 D$(2)= D$(2)+ "    ":GOTO  400
3505 GOTO  300
3510 D$(2)= "PUSH ":S$= "":GOTO  3112
3512 Y= Z:GOSUB  600:Y= Y+ 256* Z:GOSUB  600:GOSUB  740:IF  CF= 1 THEN  PC= Y
3514 D$(2)= D$(2)+ "    ":GOTO  400
3520 D$(2)= "CALL    ":CF= 1
3522 Y= Z:GOSUB  600:Y= Y+ 256* Z:GOSUB  600:GOSUB  740:IF  CF= 1 THEN  GOSUB  900: PC= Y:GOSUB  714
3525 GOTO  400
3600 D$(2)= R3$(O2)+ "     ":A= 7
3610 Y= Z:GOSUB  600:X= Y:GOSUB  500:GOSUB  700:GOSUB  740:D$(2)= D$(2):GOTO  400
3700 D$(2)= "RST "+ STR$ (O2)+ "  ":P2= O2* 8
3710 GOSUB  900:PC= P2:GOTO  400
4000 POKE  CX,0:POKE  CX+ 2,0:GOTO  1