Skip to content

Instantly share code, notes, and snippets.

@mgcaret
Created June 14, 2022 23:50
Show Gist options
  • Save mgcaret/63731c90acf7391b7ca2be1980fa97b7 to your computer and use it in GitHub Desktop.
Save mgcaret/63731c90acf7391b7ca2be1980fa97b7 to your computer and use it in GitHub Desktop.
Applesoft-based ProDOS file type changer
10 REM By MG
100 GOSUB 900
200 INPUT "Filename? (none to exit): ";F$
210 IF LEN (F$) = 0 THEN END
220 GOSUB 800
230 GOSUB 700
240 CALL 768
250 E = PEEK (778)
260 IF E > 0 THEN PRINT "MLI error: ";E: GOTO 200
270 PRINT "The file type of ";F$;" is "; PEEK (779 + 4)
280 INPUT "Enter new type if desired: ";T$
290 IF LEN (T$) = 0 GOTO 200
300 POKE 779 + 4, VAL (T$)
310 PRINT "Setting file type of ";F$;" to "; PEEK (779 + 4)
320 GOSUB 850
330 GOSUB 700
340 CALL 768
350 E = PEEK (778)
360 IF E > 0 THEN PRINT "MLI error: ";E
370 GOTO 200
700 REM put F$ at $200
710 L = LEN (F$)
720 POKE 512,L
730 FOR X = 1 TO L: POKE 512 + X, ASC ( MID$ (F$,X,1)): NEXT
740 RETURN
800 REM set MLI call for GET_FILE_INFO
810 POKE 771,196: POKE 779,10: POKE 778,0
820 RETURN
850 REM set MLI call for SET_FILE_INFO
860 POKE 771,195: POKE 779,7: POKE 778,0
870 RETURN
900 REM basic MLI call setup
910 RESTORE
920 FOR X = 768 TO 768 + 13: READ V: POKE X,V: NEXT
930 RETURN
1000 DATA 32,0,191,196,11,3,141,10,3,96,0,10,0,2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment