10 ' This web page was last updated 24-Jan-1999
10 WIDTH 255
20 DEFINT A-Z
30 DEFSNG S
40 PRINT "QD 8080 Assembler  -  Version 1(7) 24-Jan-1999  Copr. 1985, 1999 Frank Durda IV"
50 PRINT "Use for non-commercial purposes granted.  All other rights reserved."
60 PRINT "Software is provided ''AS IS'', and has no warranty of any kind."
70 OPS=78
80 TAB$=CHR$(9)
90 PRI$="+-*/^()"
100 DIM OPC$(78),OB%(78),OPHDL%(78),REG%(8)
110 DIM ST$(20),PL$(20),PREF(7),PREG(7),PRER(7)
120 FOR A=1 TO 7
130 READ PREF(A),PREG(A),PRER(A)
140 NEXT A
150 FOR A=1 TO OPS
160 READ OPC$(A),OB%(A),OPHDL%(A)
170 NEXT A
180 DIM SYMBOLS$(200),SV%(200),ST%(200)
190 REG$="ABCDEHLM"              'Register fields
200 REG%(1)=7 : REG%(2)=0 : REG%(3)=1 : REG%(4)=2 : REG%(5)=3 : REG%(6)=4
210 REG%(7)=5 : REG%(8)=6
220 LINE INPUT "Source Filename  (/SRC is assumed) >";X$
230 ALABEL$=""
240 IF X$="" THEN 220
250 GOSUB 540 : SOURCE$=X$ : X%=INSTR(X$,"/")
260 Y%=INSTR(X$,":") : IF X%>0 THEN 290
270 IF Y%=0 THEN SOURCE$=SOURCE$+"/SRC" : GOTO 290
280 SOURCE$=MID$(X$,1,Y%-1)+"/SRC"+MID$(X$,Y%,2)
290 IF X%=0 THEN IF Y%=0 THEN DX$=X$+"/CMD" : GOTO 320 ELSE DX$=MID$(X$,1,Y%-1)+"/CMD"+MID$(X$,Y%,2) : GOTO 320
300 DX$=MID$(X$,1,X%)+"CMD"
310 IF Y%>0 THEN DX$=DX$+MID$(X$,Y%,2)
320 PRINT "Object Filename  (Press <Enter> for ";DX$;") >";
330 LINE INPUT OBJECT$
340 IF OBJECT$="" THEN OBJECT$=DX$
350 X$=OBJECT$ : GOSUB 540 : IF INSTR(X$,"/SRC")>0 THEN PRINT "Invalid Object Filename - Extension is /SRC" : GOTO 320
360 IF INSTR(1,OBJECT$,":0")=0 AND INSTR(1,SOURCE$,":0")=0 THEN 420
370 PRINT "Remove the SYSTEM disk from Drive 0 and insert the PROGRAM disk."
380 PRINT "Press <Enter> when you are ready."
390 A$=INKEY$ : IF A$="" THEN 390
400 IF A$<>CHR$(13) THEN 390
410 DRIVE%=1
420 ON ERROR GOTO 480
430 OPEN "o",2,OBJECT$
440 PASS=1
450 LINE INPUT "Do you want to output the listing to the printer?";X$
460 IF X$="" THEN 470 ELSE IF MID$(X$,1,1)="Y" OR MID$(X$,1,1)="y" THEN LP%=-1
470 GOTO 490
480 PRINT "[2] Can't Open Object File, Error Was: ";ERRS$ : RESUME 320
490 ON ERROR GOTO 520
500 OPEN "I",1,SOURCE$
510 GOTO 580
520 PRINT "[1] Can't Open Source File, Error Was: ";ERRS$
530 LINE INPUT "Source Filename>";SOURCE$ : IF SOURCE$="" THEN 530 ELSE RESUME 500
540 FOR X%=1 TO LEN(X$)
550 X1%=ASC(MID$(X$,X%,1))
560 IF X1%>96 AND X1%<123 THEN MID$(X$,X%,1)=CHR$(X1%-32)
570 NEXT X% : RETURN
580 ON ERROR GOTO 950
590 PRINT "Pass";PASS : CL=0
600 IF EOF(1) THEN LNE$="":EC%=8:L1$="END":ET$="[3] End Statement Missing, No Start Address":GOTO 2720
610 LINE INPUT #1,LNE$
620 IF (PEEK(&H6A+10) AND 1)=0 THEN 640 ' KFLAG$ position ok in TRSDOS 6.1/6.2
630 PRINT "<Break>   Aborting Assembly" : CLOSE : GOTO 3360
640 CL%=CL%+1:SW%=0:AL%=0:PTR%=1:EC%=0:C$=""
650 IF LNE$="" THEN L1$="" : GOTO 2720
660 X1=INSTR(LNE$,TAB$):IF X1>0 THEN LNE$=MID$(LNE$,1,X1-1)+STRING$(9-(X1 MOD 9),32)+MID$(LNE$,X1+1,240):GOTO 660
670 LNL%=LEN(LNE$)
680 GOSUB 3100:IF L1$="" THEN 810
690 'handle label
700 SW%=-1
710 IF T$<>":" THEN EC=LST%:ET$="[4] Missing Colon, Space in Label-Name or Instruction in Wrong Field":GOTO 2720
720 IF LEN(L1$)>8 THEN EC%=9:ET$="[5] Label Too Long":GOTO 2720
730 X3%=SV%(0):IF X3%=0 THEN 780
740 FOR X4%=1 TO X3%:IF SYMBOLS$(X4%)<>L1$ THEN NEXT X4%:GOTO 780
750 IF ST%(X4%)=1 OR SV%(X4%)=PC THEN 790
760 EC%=1:IF PASS=1 THEN ET$="[6] Label Already Used":GOTO 2720
770 ET$="[7] Phase Error Detected":GOTO 2720
780 X4%=SV%(0)+1:SV%(0)=X4%:SYMBOLS$(X4%)=L1$:SV%(X4%)=PC:ST%(X4%)=0
790 AL%=X4%
800 PTR%=PTR%+1
810 GOSUB 3080:IF R% THEN 2720
820 SW%=-1:GOSUB 3100
830 IF T$=":" THEN EC%=PTR%:ET$="[8] Label in Wrong Field":GOTO 2720
840 IF L1$="ORG" OR L1$="PSECT" THEN 1810
850 IF L1$="END" THEN 1870
860 IF L1$="EQU" THEN 1950
870 IF L1$="DEFW" OR L1$="DW" OR L1$="WORD" THEN 1510
880 IF L1$="DEFB" OR L1$="DB" OR L1$="BYTE" THEN 1440
890 IF L1$="ASCII" OR L1$="TEXT" THEN 2190
900 'Handle opcode
910 IF L1$<"DAA" THEN OP%=1 ELSE IF L1$<"LDA" THEN OP%=20 ELSE IF L1$<"RNC" THEN OP%=39 ELSE OP%=58
920 FOR OP%=OP% TO OPS%:IF OPC$(OP%)<>L1$ THEN NEXT OP%:GOTO 940
930 ON OPHDL%(OP) GOTO 1030,1160,1260,1420,1600,1720,2000,1120,2140
940 EC%=LST%:ET$="[9] Unknown Opcode":GOTO 2720
950 IF ERR>50 THEN PRINT "[10] Assembly Aborting, ";ERRS$ : GOTO 3360
960 PRINT : PRINT "Internal Error Detected - Assembler Snapshot Follows:" : PRINT
970 PRINT "ER/";ERR;"EL/";ERL;"ES/";ERRS$
980 PRINT "SP/";TOP;"PT/";PTR%;"LX/";LEX$;" SU/";SUM;"LS/";LST%
990 PRINT "Write down the above information and report it to your"
1000 PRINT "instructor as soon as possible."
1010 CLOSE : GOTO 3360
1020 'Handle MOV ADD ADC SUB SBB INR DCR ANA XRA ORA CMP DCR/1 INR/1
1030 OP$=L1$ : GOSUB 3080
1040 IF R% THEN 2710
1050 GOSUB 3100
1060 B%=INSTR(REG$,L1$)
1070 IF B%=0 THEN 2700
1080 IF OP$="DCR" OR OP$="INR" THEN C$=CHR$(OB%(OP)+(8*REG%(B%)))
    ELSE C$=CHR$(OB%(OP)+REG%(B%))
1090 GOSUB 3080:IF R%=0 THEN EC%=LST%:ET$="[11] Too Many Operands":GOTO 2720
1100 GOTO 2720
1110 'Handle LDAX/STAX
1120 GOSUB 3080 : IF R THEN 2710 ELSE GOSUB 3100
1130 IF L1$="B" THEN B=0 ELSE IF L1$="D" THEN B=1 ELSE 2690
1140 C$=CHR$(OB(OP)+(B*16)) : GOTO 1090
1150 'Handle MOV
1160 GOSUB 3080 : IF R% THEN 2710 ELSE GOSUB 3100
1170 B%=INSTR(REG$,L1$) : IF B%=0 THEN 2700
1180 IF MID$(LNE$,PTR%-1,1)="," THEN 1220
1190 GOSUB 3080 : IF R% THEN 2710
1200 IF MID$(LNE$,PTR%,1)<>"," THEN 2690
1210 PTR%=PTR%+1
1220 GOSUB 3080 : IF R% THEN 2710
1230 GOSUB 3100 : C%=INSTR(REG$,L1$) : IF C%=0 THEN 2700
1240 C$=CHR$(OB%(OP)+REG%(C%)+(8*REG%(B%))) : GOTO 1090
1250 'Handle DAD DCX INX PUSH POP
1260 OP$=L1$ : GOSUB 3080
1270 IF R% THEN 2710
1280 GOSUB 3100
1290 IF L1$="B" THEN B%=0 ELSE IF L1$="D" THEN B%=1 ELSE
      IF L1$="H" THEN B%=2 ELSE 1380
1300 C$=CHR$(OB%(OP)+B%*16)
1310 IF OP$<>"LXI" THEN 1090
1320 IF MID$(LNE$,PTR%-1,1)="," THEN 1360
1330 GOSUB 3080 : IF R% THEN 2710
1340 IF MID$(LNE$,PTR%,1)<>"," THEN 2690
1350 PTR%=PTR%+1
1360 GOSUB 3080 : IF R% THEN 2710 ELSE 1630
1370 'Handle SP/PSW/A for stuff
1380 IF OP$="POP" OR OP$="PUSH" THEN IF L1$="PSW" OR L1$="A" THEN B%=3 : GOTO 1300 ELSE 2690
1390 IF L1$="SP" THEN B%=3 : GOTO 1300 ELSE 2690
1400 'Handle RET RNZ RZ RNC RC RPO RPE RP RM PCHL
1410 'Handle XCHG RLC RRC RAL RAR DAA CMA STC CMC XTHL SPHL DI EI NOP HLT
1420 C$=CHR$(OB%(OP)) : GOTO 1090
1430 'Handle DEFB BYTE
1440 C$="" : GOSUB 3080 : IF R% THEN 2710
1450 GOSUB 2230
1460 IF EC%>0 AND PASS%=1 THEN SUM=0:EC%=0
1470 C$=C$+CHR$(SUM MOD 256)
1480 IF MID$(LNE$,PTR%-1,1)=";" THEN 2720 ELSE GOSUB 3080
1490 IF R%=0 THEN PTR%=PTR%+1:GOTO 1450 ELSE 2720
1500 'Handle DEFW WORD
1510 C$="" : GOSUB 3080
1520 IF R% THEN 2710
1530 GOSUB 2230
1540 IF EC%>0 AND PASS%=1 THEN SUM=0:EC%=0
1550 C$=C$+CHR$(SUM MOD 256)+CHR$(INT(SUM/256))
1560 IF MID$(LNE$,PTR%-1,1)=";" THEN 2720 ELSE GOSUB 3080
1570 IF R%=0 THEN PTR%=PTR%+1 : GOTO 1530 ELSE 2720
1580 'Handle LHLD LDA SHLD STA JMP JNZ JZ JNC JC JPO JPE JP JM
1590 'Handle CALL CNZ CZ CNC CC CPO CPE CP CM
1600 GOSUB 3080
1610 IF R% THEN 2710
1620 C$=CHR$(OB%(OP))
1630 GOSUB 2230
1640 IF EC%>0 AND PASS=1 THEN SUM=0 : EC%=0
1650 IF SUM>65535! THEN EC%=LST% : ET$="[12] Expression Result Too Large"
1660 M!=SUM/256
1670 L!=(M!-INT(M!))*256
1680 IF M>255 THEN M=M-256 : GOTO 1680
1690 C$=C$+CHR$(L!)+CHR$(INT(M!))
1700 GOTO 1090
1710 'Handle ADI ACI SUI SBI ANI XRI ORI CPI
1720 GOSUB 3080
1730 IF R% THEN 2710
1740 C$=CHR$(OB%(OP))
1750 GOSUB 2230
1760 IF EC%>0 AND PASS=1 THEN SUM=0 : EC%=0
1770 IF SUM>255 THEN EC%=LST% : ET$="[12] Expression Result Too Large"
1780 IF SUM>255 THEN SUM=SUM-256 : GOTO 1780
1790 C$=C$+CHR$(SUM) : GOTO 1090
1800 'Handle ORG/PSECT
1810 GOSUB 3080 : IF R% THEN 2710
1820 GOSUB 2230
1830 IF EC%>0 THEN 2720
1840 IF PASS=2 THEN GOSUB 3000
1850 SP=SUM:PC=SUM:GOTO 2720
1860 'Handle END
1870 GOSUB 3080 : IF R% THEN 2710
1880 GOSUB 2230
1890 IF EC%>0 THEN 2720
1900 L1$="END":IF PASS=1 THEN 2720
1910 GOSUB 3000 : PRINT #2,CHR$(2);CHR$(2);
1920 PRINT #2,CHR$(SUM MOD 256);CHR$(INT(SUM/256));
1930 GOTO 2720
1940 'Handle EQU
1950 GOSUB 3080 : IF R% THEN 2710
1960 SW%=0 : GOSUB 2230
1970 IF AL%=0 THEN EC%=LST% : ET$="[13] No Label to Assign Equate To" : GOTO 2720
1980 SV%(AL%)=SUM : ST%(AL%)=1 : GOTO 2720
1990 'Handle MVI
2000 GOSUB 3080
2010 IF R% THEN 2710
2020 GOSUB 3100
2030 B%=INSTR(REG$,L1$): IF B=0 THEN 2700
2040 C$=CHR$(OB%(OP)+(8*REG%(B%)))
2050 IF MID$(LNE$,PTR%-1,1)="," THEN 2100
2060 GOSUB 3080
2070 IF R% THEN 2710
2080 IF MID$(LNE$,PTR%,1)<>"," THEN 2690
2090 PTR%=PTR%+1
2100 GOSUB 3080
2110 IF R% THEN 2710
2120 GOSUB 2230
2130 GOTO 1760
2140 GOSUB 3080 : IF R THEN 2710 ELSE GOSUB 2230
2150 IF EC>0 AND PASS=1 THEN SUM=0 : EC=0
2160 IF SUM>7 THEN EC=LST : ET$="[14] Invalid Restart Number" : SUM=SUM MOD 8
2170 C$=CHR$(OB(OP)+(SUM*8)) : GOTO 1090
2180 'Handle strings
2190 GOSUB 3080 : IF R% THEN 2710
2200 X1%=INSTR(PTR%+1,LNE$,T$)
2210 IF X1%=0 THEN ERRC%=LEN(LNE$) : ERRT$="[15] No Closing Delimiter" : GOTO 2720
2220 C$=MID$(LNE$,PTR%+1,X1%-PTR%-1) : GOTO 2720
2230 TOP=1:I=1:SUM=0:EEP=0:ST$(TOP)="(":RANK%=0
2240 GOSUB 2610
2250 WHILE (NXT$<>"")
2260 F%=INSTR(PRI$,NXT$):IF F%>0 THEN F%=PREF(F%) ELSE F%=7
2270 G%=INSTR(PRI$,ST$(TOP%)):IF G%>0 THEN G%=PREG(G%) ELSE G%=8
2280 IF F%>G% THEN 2370
2290 TEMP$=ST$(TOP%):TOP%=TOP%-1
2300 G%=INSTR(PRI$,TEMP$):IF G%>0 THEN G%=PREG(G%) ELSE G%=8
2310 'F=INSTR(PRI$,NXT$):IF F>0 THEN F=PREF(F) ELSE F=7
2320 IF F%>=G% THEN 2380
2330 PL$(I%)=TEMP$:I%=I%+1
2340 R%=INSTR(PRI$,TEMP$):IF R%>0 THEN R%=PRER(R%) ELSE R%=1
2350 RANK%=RANK%+R%:IF RANK%<1 THEN EC%=LST%:ET$="[16] Invalid Expression (1)":RETURN
2360 GOTO 2260
2370 IF TOP%<20 THEN TOP%=TOP%+1:ST$(TOP%)=NXT$:ELSE EC%=LST%:ET$="[17] Expression Too Complex":RETURN
2380 GOSUB 2610
2390 WEND
2400 N%=I%-1
2410 IF N%=0 THEN EC%=LST% : ET$="[18] Missing Expression" : SUM=0 : RETURN
2420 J%=1 : I%=J% : TOP%=J%
2430 NXT$=PL$(J) : X1%=INSTR("+-*/^",NXT$) : IF X1%>0 THEN 2500
2440 IF MID$(NXT$,LEN(NXT$),1)<>"H" THEN 2470
2450 IF LEN(NXT$)>6 THEN EC%=LST%:ET$="[19] Value Too Large":RETURN
2460 NXT$=STR$(VAL("&H"+NXT$))
2470 TOP%=TOP%+1:ST$(TOP%)=NXT$
2480 J%=J%+1
2490 IF J%<=N% THEN 2430 ELSE SUM=VAL(NXT$):RETURN
2500 IF TOP<2 THEN EC%=LST% : ET$="[16] Invalid Expression (2)" : RETURN
2510 P1$=ST$(TOP) : P2$=ST$(TOP-1) : TOP=TOP-2
2520 ON X1% GOTO 2530,2540,2550,2560,2570,2580
2530 Q!=VAL(P2$)+VAL(P1$):GOTO 2590
2540 Q!=ABS(VAL(P2$)-VAL(P1$)):GOTO 2590
2550 Q!=VAL(P2$)*VAL(P1$):GOTO 2590
2560 IF VAL(P1$)=0 THEN EC%=LST%:ET$="[20] Division By Zero":SUM=0:RETURN
2570 Q!=VAL(P2$)/VAL(P1$):GOTO 2590
2580 Q!=VAL(P2$)^VAL(P1$):GOTO 2590
2590 IF Q!<=65535! THEN NXT$=STR$(Q!) ELSE Q!=Q!-65536!:GOTO 2590
2600 TOP=TOP+1 : ST$(TOP)=NXT$ : GOTO 2480
2610 'Pick up a new value
2620 IF EEP THEN NXT$="" : RETURN
2630 GOSUB 3100
2640 IF L1$="" THEN GOSUB 3080 : IF R% OR T$="," THEN NXT$=")" : EEP=-1 : RETURN       ELSE NXT$=T$ : PTR%=PTR%+1 : RETURN
2650 IF L1$="$" OR L1$="." THEN NXT$=STR$(PC) : RETURN
2660 X$=MID$(L1$,1,1) : IF X$<"A" OR X$>"Z" THEN NXT$=L1$ : RETURN
2670 X1%=SV%(0) : FOR X2%=1 TO X1% : IF SYMBOLS$(X2%)=L1$ THEN NXT$=STR$(SV%(X2%)):RETURN ELSE NEXT X2%
2680 EC%=LST% : ET$="[24] "+L1$+" is undefined" : NXT$="0" : RETURN
2690 EC%=LST% : ET$="[21] Syntax Error" : GOTO 2720
2700 EC%=LST% : ET$="[22] Invalid Operand" : GOTO 2720
2710 EC%=LST% : ET$="[23] Missing Operand"
2720 IF PASS=1 AND NOT P1 AND EC%=0 THEN 2840
2730 IF NOT SW% THEN 2780
2740 U$=HEX$(PC)
2750 PRINT STRING$(4-LEN(U$),48);U$;"   ";
2760 IF LP% THEN LPRINT STRING$(4-LEN(U$),48);U$;"   ";
2770 GOSUB 3030
2780 PRINT TAB(16);STR$(CL%); : IF LP% THEN LPRINT TAB(16);STR$(CL%);
2790 PRINT TAB(23);LNE$ : IF LP% THEN LPRINT TAB(23);LNE$
2800 IF EC%=0 THEN 2840
2810 X1%=LEN(ET$):ES%=ES%+1
2820 IF X1%>EC%+17 THEN PRINT TAB(22+EC%);"!----";ET$:IF LP% THEN LPRINT TAB(22+EC%);"!----";ET$:GOTO 2840 ELSE 2840
2830 PRINT ET$;STRING$(21+EC%-X1%,45);"!" : IF LP% THEN LPRINT ET$;STRING$(21+EC%-X1%,45);"!"
2840 PC=PC+LEN(C$)
2850 IF PASS=2 AND LEN(C$)>0 THEN GOSUB 2960
2860 IF L1$<>"END" THEN 600
2870 IF PASS=1 THEN PASS=2 : CLOSE 1 : IF ES>0 THEN PRINT "Errors In Pass 1.  Do you want to run Pass 2 anyway?"; : LINE INPUT T$ : T$=LEFT$(T$,1) : IF T$="Y" OR T$="y" THEN ES=0 : GOTO 500 ELSE 2930 ELSE 500
2880 PRINT:PRINT:PRINT:PRINT "End of Program"
2890 IF LP% THEN LPRINT:LPRINT:LPRINT:LPRINT "End of Program"
2900 IF ES%=0 THEN PRINT "No "; ELSE PRINT ES%;
2910 IF LP% THEN IF ES%=0 THEN LPRINT "No "; ELSE LPRINT ES%;
2920 PRINT "Errors Encountered" : IF LP% THEN LPRINT "Errors Encountered"
2930 IF LP% AND PASS=2 THEN LPRINT CHR$(12);
2940 GOTO 3360
2950 'Build load Block
2960 X1%=LEN(LDB$)+LEN(C$) : IF X1%<252 THEN LDB$=LDB$+C$ : RETURN
2970 X2%=252-LEN(LDB$) : LDB$=LDB$+MID$(C$,1,X2%)
2980 GOSUB 3000 : LDB$=MID$(CODE$,X2%+1,250) : RETURN
2990 'Flush Load Block
3000 X3%=LEN(LDB$) : IF X3%=0 THEN RETURN
3010 PRINT #2,CHR$(1);CHR$((X3%+2) MOD 256);
3020 PRINT #2,CHR$(SP MOD 256);CHR$(INT(SP/256));LDB$;:SP=SP+LEN(LDB$):LDB$="": RETURN
3030 IF LEN(C$)=0 THEN RETURN
3040 FOR X=1 TO LEN(C$)
3050 PRINT MID$(HEX$(256+ASC(MID$(C$,X,1))),2,2);
3060 IF LP% THEN LPRINT MID$(HEX$(256+ASC(MID$(C$,X,1))),2,2);
3070 NEXT X : RETURN
3080 LST%=PTR%
3090 IF PTR%>LNL% THEN R%=-1:RETURN ELSE T$=MID$(LNE$,PTR%,1):PTR%=PTR%+1:
       IF T$=" " THEN 3090 ELSE PTR%=PTR%-1:IF T$=";" THEN R%=1:RETURN
     ELSE R%=0:RETURN
3100 L1$="" : LST%=PTR%
3110 IF PTR%>LNL% THEN RETURN ELSE T$=MID$(LNE$,PTR%,1)
3120 IF T$=" " THEN RETURN
3130 PTR%=PTR%+1:X5%=ASC(T$)
3140 IF (X5%>64 AND X5%<91) OR (X5%>47 AND X5%<58) THEN L1$=L1$+T$:GOTO 3110
3150 IF (X5%>96 AND X5%<123) THEN L1$=L1$+CHR$(X5%-32):GOTO 3110
3160 IF X5%=36 OR X5%=46 OR X5%=37 THEN L1$=L1$+T$:GOTO 3110
3170 PTR%=PTR%-1:RETURN
3180 DATA 1,2,-1,1,2,-1,3,4,-1,3,4,-1,6,5,-1,9,0,-255,0,-255,-255
3190 DATA "ACI",&HCE,6,"ADC",&H88,1,"ADD",&H80,1,"ADI",&HC6,6
3200 DATA "ANA",&HA0,1,"ANI",&HE6,6,"CALL",&HCD,5,"CC",&HDC,5
3210 DATA "CM",&HFC,5,"CMA",&H2F,4,"CMC",&H3F,4,"CMP",&HB8,1
3220 DATA "CNC",&HD4,5,"CNZ",&HC4,5,"CP",&HF4,5,"CPE",&HEC,5
3230 DATA "CPI",&HFE,6,"CPO",&HE4,5,"CZ",&HCC,5,"DAA",&H27,4,"DAD",&H09,3
3240 DATA "DCR",&H05,1,"DCX",&H0B,3,"DI",&HF3,4,"EI",&HFB,4
3250 DATA "HLT",&H76,4,"IN",&HDB,6,"INR",&H04,1,"INX",&H03,3
3260 DATA "JC",&HDA,5,"JM",&HFA,5,"JMP",&HC3,5,"JNC",&HD2,5,"JNZ",&HC2,5
3270 DATA "JP",&HF2,5,"JPE",&HEA,5,"JPO",&HE2,5,"JZ",&HCA,5
3280 DATA "LDA",&H3A,5,"LDAX",&H0A,8,"LHLD",&H2A,5,"LXI",&H01,3,"MOV",&H40,2
3290 DATA "MVI",&H06,7,"NOP",&H00,4,"ORA",&HB0,1,"ORI",&HF6,6,"OUT",&HD3,6
3300 DATA "PCHL",&HE9,4,"POP",&HC1,3,"PUSH",&HC5,3,"RAL",&H17,4,"RAR",&H1F,4
3310 DATA "RC",&HD8,4,"RET",&HC9,4,"RLC",&H07,4,"RM",&HF8,4,"RNC",&HD0,4
3320 DATA "RNZ",&HC0,4,"RP",&HF0,4,"RPE",&HE8,4,"RPO",&HE0,4,"RRC",&H0F,4
3330 DATA "RST",&HC7,9,"RZ",&HC8,4,"SBB",&H98,1,"SBI",&HDE,6,"SHLD",&H22,5
3340 DATA "SPHL",&HF9,4,"STA",&H32,5,"STAX",&H02,8,"STC",&H37,4,"SUB",&H90,1
3350 DATA "SUI",&HD6,6,"XCHG",&HEB,4,"XRA",&HA8,1,"XRI",&HEE,6,"XTHL",&HE3,4
3360 IF DRIVE%<>1 THEN 3410
3370 PRINT "Remove the PROGRAM disk from Drive 0 and insert the SYSTEM disk."
3380 PRINT "Press <Enter> when you are ready."
3390 A$=INKEY$ : IF A$="" THEN 3390
3400 IF A$<>CHR$(13) THEN 3390
3410 END

