00000000: 50 52 4F 47 52 41 4D 20 50 43 43 45 58 4D 50 28 |PROGRAM PCCEXMP(|
00000010: 43 4F 4D 4D 41 4E 44 20 43 48 41 4E 4E 45 4C 20 |COMMAND CHANNEL |
00000020: 45 58 41 4D 50 4C 45 2C 31 30 2F 31 34 2F 38 32 |EXAMPLE,10/14/82|
00000030: 29 3B 0D 0D 43 4F 4E 53 54 20 44 49 53 4B 55 4E |);..CONST DISKUN|
00000040: 49 54 3D 38 3B 0D 20 20 20 20 20 20 43 4D 44 43 |IT=8;. CMDC|
00000050: 48 41 4E 3D 31 35 3B 0D 0D 56 41 52 20 53 49 5A |HAN=15;..VAR SIZ|
00000060: 45 2C 20 44 52 49 56 45 2C 20 45 52 52 4F 52 4E |E, DRIVE, ERRORN|
00000070: 55 4D 42 45 52 3A 20 49 4E 54 45 47 45 52 3B 0D |UMBER: INTEGER;.|
00000080: 20 20 20 20 46 49 4C 45 4E 41 4D 45 2C 20 52 45 | FILENAME, RE|
00000090: 4D 41 49 4E 44 45 52 3A 20 53 54 52 49 4E 47 3B |MAINDER: STRING;|
000000A0: 0D 20 20 20 20 43 4F 4D 4D 41 4E 44 49 4E 2C 20 |. COMMANDIN, |
000000B0: 43 4F 4D 4D 41 4E 44 4F 55 54 3A 20 54 45 58 54 |COMMANDOUT: TEXT|
000000C0: 3B 0D 0D 42 45 47 49 4E 0D 20 20 52 45 53 45 54 |;..BEGIN. RESET|
000000D0: 28 43 4F 4D 4D 41 4E 44 49 4E 2C 44 49 53 4B 55 |(COMMANDIN,DISKU|
000000E0: 4E 49 54 2C 43 4D 44 43 48 41 4E 29 3B 0D 20 20 |NIT,CMDCHAN);. |
000000F0: 52 45 57 52 49 54 45 28 43 4F 4D 4D 41 4E 44 4F |REWRITE(COMMANDO|
00000100: 55 54 2C 44 49 53 4B 55 4E 49 54 2C 43 4D 44 43 |UT,DISKUNIT,CMDC|
00000110: 48 41 4E 29 3B 0D 20 20 52 45 50 45 41 54 0D 20 |HAN);. REPEAT. |
00000120: 20 20 20 57 52 49 54 45 28 27 4E 41 4D 45 20 4F | WRITE('NAME O|
00000130: 46 20 46 49 4C 45 20 54 4F 20 53 43 52 41 54 43 |F FILE TO SCRATC|
00000140: 48 3F 20 27 29 3B 0D 20 20 20 20 52 45 41 44 28 |H? ');. READ(|
00000150: 46 49 4C 45 4E 41 4D 45 29 3B 0D 20 20 20 20 57 |FILENAME);. W|
00000160: 52 49 54 45 4C 4E 3B 0D 20 20 20 20 53 49 5A 45 |RITELN;. SIZE|
00000170: 3A 3D 4C 45 4E 47 54 48 28 46 49 4C 45 4E 41 4D |:=LENGTH(FILENAM|
00000180: 45 29 0D 20 20 55 4E 54 49 4C 20 28 53 49 5A 45 |E). UNTIL (SIZE|
00000190: 3E 30 29 20 41 4E 44 20 28 53 49 5A 45 3C 31 37 |>0) AND (SIZE<17|
000001A0: 29 3B 0D 20 20 49 46 20 28 53 49 5A 45 3C 33 29 |);. IF (SIZE<3)|
000001B0: 20 4F 52 20 28 43 4F 50 59 28 46 49 4C 45 4E 41 | OR (COPY(FILENA|
000001C0: 4D 45 2C 32 2C 31 29 3C 3E 27 3A 27 29 0D 20 20 |ME,2,1)<>':'). |
000001D0: 20 20 20 20 54 48 45 4E 20 42 45 47 49 4E 0D 20 | THEN BEGIN. |
000001E0: 20 20 20 20 20 20 20 20 20 20 20 20 57 52 49 54 | WRIT|
000001F0: 45 28 27 44 52 49 56 45 3F 20 27 29 3B 0D 20 20 |E('DRIVE? ');. |
00000200: 20 20 20 20 20 20 20 20 20 20 20 52 45 41 44 28 | READ(|
00000210: 44 52 49 56 45 29 3B 0D 20 20 20 20 20 20 20 20 |DRIVE);. |
00000220: 20 20 20 20 20 57 52 49 54 45 4C 4E 3B 0D 20 20 | WRITELN;. |
00000230: 20 20 20 20 20 20 20 20 20 20 20 57 52 49 54 45 | WRITE|
00000240: 4C 4E 28 43 4F 4D 4D 41 4E 44 4F 55 54 2C 27 53 |LN(COMMANDOUT,'S|
00000250: 27 2C 44 52 49 56 45 2C 27 3A 27 2C 46 49 4C 45 |',DRIVE,':',FILE|
00000260: 4E 41 4D 45 29 0D 20 20 20 20 20 20 20 20 20 20 |NAME). |
00000270: 20 45 4E 44 0D 20 20 20 20 45 4C 53 45 20 57 52 | END. ELSE WR|
00000280: 49 54 45 4C 4E 28 43 4F 4D 4D 41 4E 44 4F 55 54 |ITELN(COMMANDOUT|
00000290: 2C 27 53 27 2C 46 49 4C 45 4E 41 4D 45 29 3B 0D |,'S',FILENAME);.|
000002A0: 20 20 52 45 41 44 28 43 4F 4D 4D 41 4E 44 49 4E | READ(COMMANDIN|
000002B0: 2C 45 52 52 4F 52 4E 55 4D 42 45 52 2C 52 45 4D |,ERRORNUMBER,REM|
000002C0: 41 49 4E 44 45 52 29 3B 0D 20 20 49 46 20 45 52 |AINDER);. IF ER|
000002D0: 52 4F 52 4E 55 4D 42 45 52 3D 31 0D 20 20 20 20 |RORNUMBER=1. |
000002E0: 20 20 54 48 45 4E 20 57 52 49 54 45 4C 4E 28 43 | THEN WRITELN(C|
000002F0: 4F 50 59 28 52 45 4D 41 49 4E 44 45 52 2C 50 4F |OPY(REMAINDER,PO|
00000300: 53 28 27 2C 27 2C 52 45 4D 41 49 4E 44 45 52 29 |S(',',REMAINDER)|
00000310: 2B 31 2C 32 29 2C 0D 20 20 20 20 20 20 20 20 20 |+1,2),. |
00000320: 20 20 20 20 20 20 20 20 20 20 27 20 46 49 4C 45 | ' FILE|
00000330: 53 20 44 45 4C 45 54 45 44 27 29 0D 20 20 20 20 |S DELETED'). |
00000340: 45 4C 53 45 20 57 52 49 54 45 4C 4E 28 27 45 52 |ELSE WRITELN('ER|
00000350: 52 4F 52 20 27 2C 45 52 52 4F 52 4E 55 4D 42 45 |ROR ',ERRORNUMBE|
00000360: 52 2C 27 20 48 41 53 20 4F 43 43 55 52 52 45 44 |R,' HAS OCCURRED|
00000370: 27 29 0D 45 4E 44 2E 0D 03 00 00 00 4E 4E 00 2C |').END......NN.,|
PROGRAM PCCEXMP(COMMAND CHANNEL EXAMPLE,
10/14/82);..CONST DISKUNIT=8;. CMDC
HAN=15;..VAR SIZE, DRIVE, ERRORNUMBER: I
NTEGER;. FILENAME, REMAINDER: STRING;
. COMMANDIN, COMMANDOUT: TEXT;..BEGIN
. RESET(COMMANDIN,DISKUNIT,CMDCHAN);.
REWRITE(COMMANDOUT,DISKUNIT,CMDCHAN);.
REPEAT. WRITE('NAME OF FILE TO SCRATC
H? ');. READ(FILENAME);. WRITELN;.
SIZE:=LENGTH(FILENAME). UNTIL (SIZE
>0) AND (SIZE<17);. IF (SIZE<3) OR (COP
Y(FILENAME,2,1)<>':'). THEN BEGIN.
WRITE('DRIVE? ');.
READ(DRIVE);. WRITELN;.
WRITELN(COMMANDOUT,'S',DRIVE,
':',FILENAME). END. ELSE WR
ITELN(COMMANDOUT,'S',FILENAME);. READ(C
OMMANDIN,ERRORNUMBER,REMAINDER);. IF ER
RORNUMBER=1. THEN WRITELN(COPY(REMA
INDER,POS(',',REMAINDER)+1,2),.
' FILES DELETED'). ELSE WRI
TELN('ERROR ',ERRORNUMBER,' HAS OCCURRED
').END......NN.,
×
C64 Image
> CLICK IMAGE PREVIEW FOR FULL MODAL