BASIC: APPEND fix

Yes! There is an APPEND fix! The following four short test programs illustrate the problem. The run command and a short explanation precededs each code.
1. RUN TEST1,D1
This puts a file called 'JUNK' onto the disk in drive 1 with exactly 255 bytes.

10 REM  TEST1
20 D$ = CHR$(4)
30 PRINT D$;"OPEN JUNK"
40 PRINT D$;"WRITE JUNK"
50 FOR L = 1 TO 8
60 FOR M = 1 TO 29
70 PRINT "A";
80 NEXT M
90 PRINT "A"
100 NEXT L
110 FOR L = 1 TO 5
120 PRINT "A";
130 NEXT L
140 PRINT "A"
150 PRINT D$;"CLOSE"
160 END


2. RUN TEST2
This reads the file 'JUNK' and prints it onto your CRT.

10 REM  TEST2
20 D$ = CHR$(4)
30 PRINT D$;"OPEN JUNK"
40 PRINT D$;"READ JUNK"
50 FOR L = 1 TO 9
60 INPUT ST$
70 PRINT ST$
80 NEXT L
90 PRINT D$;"CLOSE"
100 END


3. RUN TEST3
This attempts to APPEND to the file 'JUNK' the message "THIS IS A TEST".

10 REM  TEST3
20 D$ = CHR$(4)
30 PRINT D$;"APPEND JUNK"
40 PRINT D$;"WRITE JUNK"
50 PRINT "THIS IS A TEST"
60 PRINT D$;"CLOSE"
70 END


4. RUN TEST4
This reads and displays the file 'JUNK' which should now have a last line reading "THIS IS A TEST".

10 REM TEST4
20 D$ = CHR$(4)

30 PRINT D$;"OPEN JUNK"
40 PRINT D$;"READ JUNK"
50 FOR L = 1 TO 10
60 INPUT ST$
70 PRINT ST$
80 NEXT L
90 PRINT D$;"CLOSE"
100 END


If the APPEND does not take, the display reads an END OF DATA.

Apple supplied the following fix answer to software developers in August, and they have been using it since November, 1983.

"early 1983"                after November, 1983
-----------------------     -----------------------
B683:4C 84 BA JMP $BA84     B683:4C B3 B6 JMP $B6B3

$B6B3-B6CE:ALL ZEROS        B6B3:AD BD B5 LDA $B5BD
                           B6B6:8D E6 B5 STA $B5E6
                           B6B9:8D EA B5 STA $B5EA
                           B6BC:AD BE B5 LDA $B5BE
                           B6BF:8D E7 B5 STA $B5E7
                           B6C2:8D EB B5 STA $B5EB
                           B6C5:8D E4 B5 STA $B5E4
                           B6C8:BA       TSX
                           B6C9:8E 9B B3 STX $B39B
                           B6CC:4C 7F B3 JMP $B37F


$BA84-BA93:PATCH            BA84-BA93:ALL ZEROS

The patch put at $BA84 has been moved down to $B6B3, and four extra lines have been added to that patch. Initialize a new diskette after making the above patch and reboot the system. You can then sucessfully run the test programs above.

For those who do not feel comfortable with the above machine language, use the following procedure to make new slave diskettes with the corrected DOS:

1. Boot the system with an initialized diskette. This loads the old DOS into your Apple.
2. Type in the BASIC program below and RUN it. This will change the old DOS in memory to the corrected DOS.
3. SAVE this program just in case you made a typo.

4. Without rebooting the system, run the 4 test programs above to see if APPEND works correctly.
5. Type NEW; insert a blank diskette, and type INIT HELLO. This creates a diskette with the corrected DOS.
6. Use this new diskette whenever initializing other diskettes; the corrected DOS will be carried over.


Use this BASIC program in step 2 above:

10 POKE -18813,76 : POKE -18812,179 : POKE -18811,182
20 FOR I = -18765 TO -18738
30 READ A: POKE I,A: NEXT
40 FOR I = -17788 TO -17773
50 POKE I,0: NEXT
60 PRINT "DONE..."
75 END
80 DATA 173,189,181,141,230,181,141,234,181,173,190,181,141,231,181,141,235,181,141,228,181,186,142,155,179,76,127,179

Published Date: Feb 20, 2012