Modified read and write for writing up to 255 bytes
This commit is contained in:
@@ -15,9 +15,9 @@
|
||||
140IF S=0 GOTO 100
|
||||
150GOTO 20
|
||||
999END
|
||||
1000REM Converts the value of N into a hex-string and stores the result in N$
|
||||
1000REM Converts the value of N into a hex-string and stores the result in H$
|
||||
1010H$=""
|
||||
1020FOR I = 3 TO 0 STEP -1
|
||||
1020FOR I=3 TO 0 STEP -1
|
||||
1030A=15:IF I=3 THEN A=7
|
||||
1040T=(N AND (A*(16^I))) / (16^I)
|
||||
1050IF T<10 THEN H$=H$+CHR$(T+48):GOTO 1070
|
||||
@@ -25,12 +25,74 @@
|
||||
1070NEXT I
|
||||
1080H$=H$+"H"
|
||||
1090RETURN
|
||||
1100REM Converts a hex-string into integer. Expects the value in H$ and stores in N
|
||||
1110N=0
|
||||
1120FOR I=0 TO 3
|
||||
1130T$=MID$ (H$,LEN H$ - I,1)
|
||||
1140IF ASC(T$) > 57 THEN N=N+(ASC(T$)-55)*(16^I):GOTO 1160
|
||||
1150N=N+(ASC(T$)-48)*(16^I)
|
||||
1160NEXT I
|
||||
1170RETURN
|
||||
2000REM Loads a memory area from file
|
||||
2010S=2000
|
||||
2020CLS
|
||||
2030PRINT "LOAD FROM FILE"
|
||||
2040INPUT "Start address: ";H$
|
||||
2050GOSUB 1100
|
||||
2060A=N
|
||||
2070INPUT "End address: ";H$
|
||||
2080GOSUB 1100
|
||||
2090B=N
|
||||
2100INPUT "Filename: ";H$
|
||||
2110WAIT:PRINT "Press PLAY on Tape"
|
||||
2120WAIT0:PRINT "Loading ";H$
|
||||
2130DIM V(B-A)
|
||||
2140OPEN "CAS:"+H$ FOR INPUT
|
||||
2150INPUT#1,V
|
||||
2160CLOSE
|
||||
2170FOR I=A TO B
|
||||
2180POKE I,V
|
||||
2190NEXT I
|
||||
2999RETURN
|
||||
3000REM Saves a memory area to disk
|
||||
3010S=3000
|
||||
3020CLS
|
||||
3030PRINT "SAVE TO FILE"
|
||||
3040INPUT "Start address: ";H$
|
||||
3050GOSUB 1100
|
||||
3060A=N
|
||||
3070INPUT "End address: ";H$
|
||||
3080GOSUB 1100
|
||||
3090B=N
|
||||
3100INPUT "Filename: ";H$
|
||||
3110WAIT:PRINT "Press RECORD on Tape"
|
||||
3120WAIT0:PRINT "Saving ";H$
|
||||
3130DIM V(B-A)
|
||||
3140FOR I=1 TO B-A
|
||||
3150V(I)=PEEK(A+I-1)
|
||||
3160NEXT I
|
||||
3170OPEN "CAS:"+H$ FOR OUTPUT
|
||||
3180PRINT#1,V
|
||||
3190CLOSE
|
||||
3999RETURN
|
||||
4000REM Compares a memory area with the file on disk
|
||||
4010S=4000
|
||||
4020CLS
|
||||
4030PRINT "VERIFY FILE"
|
||||
4040INPUT "Start address: ";H$
|
||||
4050GOSUB 1100
|
||||
4060A=N
|
||||
4070INPUT "End address: ";H$
|
||||
4080GOSUB 1100
|
||||
4090B=N
|
||||
4100INPUT "Filename: ";H$
|
||||
4110WAIT:PRINT "Press PLAY on Tape"
|
||||
4120WAIT0:PRINT "Loading ";H$
|
||||
4130DIM V(B-A)
|
||||
4140OPEN "CAS:"+H$ FOR INPUT
|
||||
4150INPUT#1,V
|
||||
4160CLOSE
|
||||
4170FOR I=1 TO B-A
|
||||
4180IF V(I) <> PEEK(A+I-1) THEN PRINT "Error at address ";A;" Expected ";PEEK(A+I-1);" GOT ";V(I):BREAK
|
||||
4190NEXT I
|
||||
4999RETURN
|
||||
|
||||
Reference in New Issue
Block a user