home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel Volume 2 #1
/
carousel.iso
/
comdore
/
64utils
/
mlx
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
1988-12-29
|
4KB
|
101 lines
100 POKE 56,50:CLR:DIM IN$,I,J,A,B,A$,B$,A(7),N$
110 C4=48:C6=16:C7=7:Z2=2:Z4=254:Z5=255:Z6=256:Z7=127
120 FA=PEEK(45)+Z6*PEEK(46):BS=PEEK(55)+Z6*PEEK(56):H$="0123456789ABCDEF"
130 R$=CHR$(13):L$="[157]":S$=" ":D$=CHR$(20):Z$=CHR$(0):T$=""
140 SD=54272:FOR I=SD TO SD+23:POKE I,0:NEXT:POKE SD+24,15:POKE 788,52
150 PRINT"[147]"CHR$(142)CHR$(8):POKE 53280,15:POKE 53281,15
160 PRINT T$" [164][164][164][164][164][164][164][164] "SPC(28)" [146] MLX II "SPC(28)" "
170 PRINT" COMPUTE!'S MACHINE LANGUAGE EDITOR"
180 PRINT"[144]STARTING ADDRESS[151]";:GOSUB300:SA=AD:GOSUB1040:IF F THEN180
190 PRINT"[144] ENDING ADDRESS[151]";:GOSUB300:EA=AD:GOSUB1030:IF F THEN190
200 INPUT"[144]CLEAR WORKSPACE [Y/N][151]";A$:IF LEFT$(A$,1)<>"Y"THEN220
210 PRINT"WORKING...";:FORI=BS TO BS+EA-SA+7:POKE I,0:NEXT:PRINT"DONE"
220 PRINTTAB(10)"[144] MLX COMMAND MENU [151]":PRINT T$"E[146]NTER DATA"
230 PRINT T$"D[146]ISPLAY DATA":PRINT T$"L[146]OAD DATA"
240 PRINT T$"S[146]AVE FILE":PRINT T$"Q[146]UIT[144]"
250 GET A$:IF A$=N$ THEN250
260 A=0:FOR I=1 TO 5:IF A$=MID$("EDLSQ",I,1)THEN A=I:I=5
270 NEXT:ON A GOTO420,610,690,700,280:GOSUB1060:GOTO250
280 PRINT" QUIT ":INPUT"[151]ARE YOU SURE [Y/N]";A$:IF LEFT$(A$,1)<>"Y"THEN220
290 POKE SD+24,0:END
300 IN$=N$:AD=0:INPUTIN$:IFLEN(IN$)<>4THENRETURN
310 B$=IN$:GOSUB320:AD=A:B$=MID$(IN$,3):GOSUB320:AD=AD*256+A:RETURN
320 A=0:FOR J=1 TO 2:A$=MID$(B$,J,1):B=ASC(A$)-C4+(A$>"@")*C7:A=A*C6+B
330 IF B<0 OR B>15 THEN AD=0:A=-1:J=2
340 NEXT:RETURN
350 B=INT(A/C6):PRINT MID$(H$,B+1,1);:B=A-B*C6:PRINT MID$(H$,B+1,1);:RETURN
360 A=INT(AD/Z6):GOSUB350:A=AD-A*Z6:GOSUB350:PRINT":";
370 CK=INT(AD/Z6):CK=AD-Z4*CK+Z5*(CK>Z7):GOTO390
380 CK=CK*Z2+Z5*(CK>Z7)+A
390 CK=CK+Z5*(CK>Z5):RETURN
400 PRINT"STARTING AT[151]";:GOSUB300:IF IN$<>N$ THEN GOSUB1030:IF F THEN400
410 RETURN
420 PRINT" ENTER DATA ":GOSUB400:IF IN$=N$ THEN220
430 OPEN3,3:PRINT
440 POKE198,0:GOSUB360:IF F THEN PRINT IN$:PRINT"[145]";
450 FOR I=0 TO 24 STEP 3:B$=S$:FOR J=1 TO 2:IF F THEN B$=MID$(IN$,I+J,1)
460 PRINT""B$L$;:IF I<24THEN PRINT"[146]";
470 GET A$:IF A$=N$ THEN470
480 IF(A$>"/"ANDA$<":")OR(A$>"@"ANDA$<"G")THEN540
490 IF A$=R$ AND((I=0)AND(J=1)OR F)THEN PRINT B$;:J=2:NEXT:I=24:GOTO550
500 IF A$="" THEN PRINT B$:J=2:NEXT:I=24:NEXT:F=0:GOTO440
510 IF(A$="")ANDF THENPRINT B$L$;:GOTO540
520 IF A$<>L$ AND A$<>D$ OR((I=0)AND(J=1))THEN GOSUB1060:GOTO470
530 A$=L$+S$+L$:PRINT B$L$;:J=2-J:IF J THEN PRINT L$;:I=I-3
540 PRINT A$;:NEXT J:PRINT S$;
550 NEXT I:PRINT:PRINT"[145]";:INPUT#3,IN$:IF IN$=N$ THEN CLOSE3:GOTO220
560 FOR I=1 TO 25 STEP3:B$=MID$(IN$,I):GOSUB320:IF I<25 THEN GOSUB380:A(I/3)=A
570 NEXT:IF A<>CK THEN GOSUB1060:PRINT"[144] ERROR: REENTER LINE [151]":F=1:GOTO440
580 GOSUB1080:B=BS+AD-SA:FOR I=0 TO 7:POKE B+I,A(I):NEXT
590 AD=AD+8:IF AD>EA THEN CLOSE3:PRINT"** END OF ENTRY **[144]":GOTO700
600 F=0:GOTO440
610 PRINT"[147] DISPLAY DATA ":GOSUB400:IF IN$=N$ THEN220
620 PRINT"PRESS: SPACE[146] TO PAUSE, RETURN[146] TO BREAK[151]"
630 GOSUB360:B=BS+AD-SA:FORI=BTO B+7:A=PEEK(I):GOSUB350:GOSUB380:PRINT S$;
640 NEXT:PRINT"";:A=CK:GOSUB350:PRINT
650 F=1:AD=AD+8:IF AD>EA THENPRINT"** END OF DATA **":GOTO220
660 GET A$:IF A$=R$ THEN GOSUB1080:GOTO220
670 IF A$=S$ THEN F=F+1:GOSUB1080
680 ONFGOTO630,660,630
690 PRINT" LOAD DATA ":OP=1:GOTO710
700 PRINT" SAVE FILE ":OP=0
710 IN$=N$:INPUT"FILENAME[151]";IN$:IF IN$=N$ THEN220
720 F=0:PRINT"[144]T[146]APE OR D[146]ISK: [151]";
730 GET A$:IF A$="T"THEN PRINT"T":GOTO880
740 IF A$<>"D"THEN730
750 PRINT"D":OPEN15,8,15,"I0:":B=EA-SA:IN$="0:"+IN$:IF OP THEN810
760 OPEN 1,8,8,IN$+",P,W":GOSUB860:IF A THEN220
770 AH=INT(SA/256):AL=SA-(AH*256):PRINT#1,CHR$(AL);CHR$(AH);
780 FOR I=0 TO B:PRINT#1,CHR$(PEEK(BS+I));:IF ST THEN800
790 NEXT:CLOSE1:CLOSE15:GOTO940
800 GOSUB1060:PRINT"[144]ERROR DURING SAVE:[151]":GOSUB860:GOTO220
810 OPEN 1,8,8,IN$+",P,R":GOSUB860:IF A THEN220
820 GET#1,A$,B$:AD=ASC(A$+Z$)+256*ASC(B$+Z$):IF AD<>SA THEN F=1:GOTO850
830 FOR I=0 TO B:GET#1,A$:POKE BS+I,ASC(A$+Z$):IF ST AND(I<>B)THEN F=2:AD=I:I=B
840 NEXT:IF ST<>64 THEN F=3
850 CLOSE1:CLOSE15:ON ABS(F>0)+1 GOTO960,970
860 INPUT#15,A,A$:IF A THEN CLOSE1:CLOSE15:GOSUB1060:PRINT"ERROR: "A$
870 RETURN
880 POKE183,PEEK(FA+2):POKE187,PEEK(FA+3):POKE188,PEEK(FA+4):IFOP=0THEN920
890 SYS 63466:IF(PEEK(783)AND1)THEN GOSUB1060:PRINT" FILE NOT FOUND ":GOTO690
900 AD=PEEK(829)+256*PEEK(830):IF AD<>SA THEN F=1:GOTO970
910 A=PEEK(831)+256*PEEK(832)-1:F=F-2*(A<EA)-3*(A>EA):AD=A-AD:GOTO930
920 A=SA:B=EA+1:GOSUB1010:POKE780,3:SYS 63338
930 A=BS:B=BS+(EA-SA)+1:GOSUB1010:ON OP GOTO950:SYS 63591
940 GOSUB1080:PRINT"** SAVE COMPLETED **":GOTO220
950 POKE147,0:SYS 63562:IF ST<>64 THEN970
960 GOSUB1080:PRINT"** LOAD COMPLETED **":GOTO220
970 GOSUB1060:PRINT"[144]ERROR DURING LOAD:[151]":ON F GOSUB980,990,1000:GOTO220
980 PRINT"INCORRECT STARTING ADDRESS (";:GOSUB360:PRINT")":RETURN
990 PRINT"LOAD ENDED AT ";:AD=SA+AD:GOSUB360:PRINT D$:RETURN
1000 PRINT"TRUNCATED AT ENDING ADDRESS":RETURN
1010 AH=INT(A/256):AL=A-(AH*256):POKE193,AL:POKE194,AH
1020 AH=INT(B/256):AL=B-(AH*256):POKE174,AL:POKE175,AH:RETURN
1030 IF AD<SA OR AD>EA THEN1050
1040 IF(AD>511 AND AD<40960)OR(AD>49151 AND AD<53248)THEN GOSUB1080:F=0:RETURN
1050 GOSUB1060:PRINT" INVALID ADDRESS [144]":F=1:RETURN
1060 POKE SD+5,31:POKE SD+6,208:POKE SD,240:POKE SD+1,4:POKE SD+4,33
1070 FOR S=1 TO 100:NEXT:GOTO1090
1080 POKE SD+5,8:POKE SD+6,240:POKE SD,0:POKE SD+1,90:POKE SD+4,17
1090 FOR S=1 TO 100:NEXT:POKE SD+4,0:POKE SD,0:POKE SD+1,0:RETURN