Listing of file='SRCBLD.BAS;01' on disk='vmedia/chip_114-sector.ccvf'
10 REM SRCBLD - DISASSEMBLES MEMORY AND BUILDS TEXT EDITOR 20 REM SOURCE FILE. REQUIRES O.RND OPCODE FILE AND L.RND 30 REM 8080 INSTR. LENGTH FILE. NAME OF FILE INDICATES 40 REM START AND END LOCATIONS. 50 CLEAR 100 60 A= 1 70 REM IF TABLES IN MEMORY THEN SKIP TO ADDRESS INPUT ******** 80 IF CHR$ (PEEK (40960))+ CHR$ (PEEK (40961))+ CHR$ (PEEK (40962))= "NOP"THEN GOTO 120 90 PLOT 27,4:PRINT "LOA O.RND,A000":PLOT 27,27 100 PLOT 27,4:PRINT "LOA L.RND,A800":PLOT 27,27 110 REM INPUT START (S) AND END (E) ADDRESSES **************** 120 INPUT " INPUT HEX START ADDRESS ";S$ 130 GOSUB 590 140 IF ER= ATHEN PRINT " DOES NOT COMPUTE -";:GOTO 120 150 S= INT (VL+ .4) 160 INPUT " INPUT HEX END ADDRESS ";S$ 170 GOSUB 590 180 IF ER= ATHEN PRINT " DOES NOT COMPUTE -";:GOTO 160 190 E= INT (VL+ .4) 200 REM MOVE END OF BASIC BACK TO MAKE ROOM FOR TABLES ******* 210 A1= PEEK (32940):POKE 32940,255 220 A2= PEEK (32941):POKE 32941,159 230 Z= 43264:REM A900 HEX 240 REM START ASM SOURCE WITH ORG STATEMENT ****************** 250 POKE Z,9:Z= Z+ 1:REM START LINE WITH TAB 260 POKE Z,ASC ("O"):POKE Z+ 1,ASC ("R"):POKE Z+ 2,ASC ("G"):POKE Z+ 3,9::Z= Z+ 4 270 PRINT :PRINT "START: ";:X= INT (S/ 256):GOSUB 690:R$= CHR$ (X1)+ CHR$ (X2) 280 X= S- 256* X:GOSUB 690:R$= R$+ CHR$ (X1)+ CHR$ (X2) 290 FOR I= 1TO 4:POKE Z,ASC (MID$ (R$,I,1)):Z= Z+ 1:NEXT I:POKE Z,ASC ("H"):Z= Z+ 1 300 POKE Z,13:POKE Z+ 1,10:Z= Z+ 2:REM END ORG STATEMENT 310 PRINT "":PRINT 320 PRINT TAB( 33);"ORG";TAB( 41);R$;"H" 330 REM MAIN LOOP ******************************************** 340 FOR P= STO E 350 O= PEEK (P) 360 L= PEEK (40960+ 8* 256+ O) 370 PRINT TAB( 5);:X= INT (P/ 256):GOSUB 690:X= P- INT (P/ 256)* 256:GOSUB 690:REM LOCATION 380 PRINT TAB( 12);:X= O:GOSUB 690:IF L= ATHEN GOTO 410:REM HEX CODE 390 X= PEEK (P+ A):GOSUB 690:IF L= 2THEN GOTO 410 400 X= PEEK (P+ 2):GOSUB 690 410 PRINT TAB( 33);:GOSUB 520:IF L= ATHEN GOTO 440:REM MEMNONIC 420 IF L= 3THEN X= PEEK (P+ 2):GOSUB 690:POKE Z,X1:POKE Z+ 1,X2:Z= Z+ 2 430 X= PEEK (P+ A):GOSUB 690:POKE Z,X1:POKE Z+ 1,X2:POKE Z+ 2,ASC ("H"):Z= Z+ 3:PRINT "H"; 440 POKE Z,13:POKE Z+ 1,10:Z= Z+ 2:REM END OF LINE 450 PRINT " " 460 P= P+ L- A 470 NEXT P 480 REM END OF MAIN LOOP ************************************* 490 REM SKIP OVER SUBROUTINES TO END PROGRAM ***************** 500 GOTO 750 510 REM SUBROUTINE POKES TAB, MEMNONIC, PRINTS SAME ************ 520 POKE Z,9:Z= Z+ 1:REM START LINE 530 FOR I= 40960+ O* 8TO I+ 7 540 POKE Z,PEEK (I):Z= Z+ 1 550 IF PEEK (I)= 9THEN PRINT TAB( 41);:GOTO 570 560 PRINT CHR$ (PEEK (I)); 570 NEXT I:RETURN 580 REM SUBROUTINE CONVERTS HEX S$ TO DEC. VL **************** 590 ER= 0:VL= 0 600 S$= RIGHT$ ("0000"+ S$,4) 610 FOR I= ATO 4 620 V= ASC (MID$ (S$,I,A)) 630 IF V> 47AND V< 58THEN D= V- 48:GOTO 660 640 IF V> 64AND V< 71THEN D= V- 55:GOTO 660 650 ER= A:RETURN 660 VL= VL+ D* 16^ (4- I) 670 NEXT I:RETURN 680 REM SUBROUTINE PRINTS 2 HEX DIGITS FROM DEC. X *********** 690 X0= INT (X/ 16):IF X0< 10THEN X1= X0+ 48:GOTO 710 700 X1= X0+ 55 710 IF X- X0* 16< 10THEN X2= X- X0* 16+ 48:GOTO 730 720 X2= X- X0* 16+ 55 730 PRINT CHR$ (X1);CHR$ (X2);:RETURN 740 REM INSERT END STATEMENT, CREATE SRC FILE, END PROGRAM *** 750 POKE Z,9:REM END STATEMENT 760 POKE Z+ 1,ASC ("E"):POKE Z+ 2,ASC ("N"):POKE Z+ 3,ASC ("D") 770 POKE Z+ 4,13:POKE Z+ 5,10 780 Z= Z+ 6:REM UPDATE RAM POINTER 790 PRINT TAB( 33);"END" 800 PRINT " CODE FROM ";:X= INT (S/ 256):GOSUB 690:R$= CHR$ (X1)+ CHR$ (X2):X= S- 256* X:GOSUB 690:R$= R$+ CHR$ (X1)+ CHR$ (X2) 810 PRINT " TO ";:X= INT (E/ 256):GOSUB 690:T$= CHR$ (X1)+ CHR$ (X2):X= E- 256* X:GOSUB 690:T$= T$+ CHR$ (X1)+ CHR$ (X2) 820 PRINT ", SOURCE FROM A900 TO ";:X= INT (Z/ 256):GOSUB 690:X= Z- 256* X:GOSUB 690 830 W= Z- 43264:PRINT " LENGTH ";:X= INT (W/ 256):GOSUB 690:E$= CHR$ (X1)+ CHR$ (X2):X= W- X* 256:GOSUB 690:E$= E$+ CHR$ (X1)+ CHR$ (X2) 840 PRINT "" 850 PRINT :PLOT 27,4:PRINT "SAV A";R$;".SRC A900 ";E$;", ";T$:PLOT 27,27 860 POKE 32940,A1:POKE 32941,A2 870 END