
 1000  *SAVE POTTS TEXT COPIER
 1010  *--------------------------------
 1020         .OR $300
 1025         .TF TEXT.TRANSFER.OBJ
 1030  *--------------------------------
 1040  MY.BUFFER  .EQ $2000
 1050  *--------------------------------
 1060  BUFFER     .EQ $E0,E1    POINT TO FILE BUFFER
 1070  RESULT     .EQ $E2       FILE MANAGER RETURN CODE
 1080  *--------------------------------
 1090  FM.SETUP   .EQ $3DC      INITIALIZE Y & A
 1100  FM.ENTRY   .EQ $3D6      FILE MANAGER ENTRY POINT
 1110  FM.BLK     .EQ $B5BB     FILE MANAGER PARM LIST
 1120  *--------------------------------
 1130  *   SET UP JUMP VECTORS
 1140         JMP INITIALIZE.AND.READ
 1150         JMP FIND.END.AND.WRITE
 1160  *--------------------------------
 1170  INITIALIZE.AND.READ
 1180  *--------------------------------
 1190  INITIALIZE.THE.BUFFER
 1200         LDA #MY.BUFFER
 1210         STA BUFFER        LSB
 1220         LDA /MY.BUFFER
 1230         STA BUFFER+1      MSB
 1240         LDY #0
 1250  .1     LDA #0            CLEAR BUFFER UP TO $95FF
 1260  .2     STA (BUFFER),Y
 1270         INY               NEXT BYTE IN THIS PAGE
 1280         BNE .2            ...STILL IN THE PAGE
 1290         INC BUFFER+1      NEXT PAGE
 1300         LDA BUFFER+1
 1310         CMP #$96          AT END OF STORAGE?
 1320         BNE .1            ...NO, KEEP CLEARING
 1330         LDA /MY.BUFFER    RESET BUFFER POINTER
 1340         STA BUFFER+1
 1350  *--------------------------------
 1360  READ.THE.FILE
 1370         LDX #9            10 BYTES
 1380  .1     LDA RD.BLK,X
 1390         STA FM.BLK,X
 1400         DEX
 1410         BPL .1
 1420         JSR FM.SETUP
 1430         JSR FM.ENTRY
 1440         LDA FM.BLK+10     GET RETURN CODE
 1450         STA RESULT        SAVE FOR APPLESOFT PEEK
 1460         RTS               RETURN TO APPLESOFT
 1470  *--------------------------------
 1480  FIND.END.AND.WRITE
 1490  *--------------------------------
 1500  FIND.END.OF.BUFFER
 1510         LDY #0            SEARCH FOR 00 BYTE
 1520  .1     LDA (BUFFER),Y
 1530         BEQ .2            ...FOUND END
 1540         INY
 1550         BNE .1            ...NEXT BYTE IN SAME PAGE
 1560         INC BUFFER+1      NEXT PAGE
 1570         BNE .1            ...ALWAYS
 1580  .2     STY BUFFER        LSB OF EOF BYTE
 1590  *--------------------------------
 1600  WRITE.FILE
 1610         LDX #9            10 BYTES
 1620  .1     LDA WR.BLK,X
 1630         STA FM.BLK,X
 1640         DEX
 1650         BPL .1
 1660         LDA BUFFER        LSB
 1670         STA FM.BLK+6      LSB OF FILE LENGTH
 1680         SEC
 1690         LDA BUFFER+1
 1700         SBC /MY.BUFFER
 1710         STA FM.BLK+7      MSB OF FILE LENGTH
 1720         JSR FM.SETUP
 1730         LDX #1            IF NO FILE, ALLOCATE ONE
 1740         JSR FM.ENTRY      WRITE THE FILE
 1750         LDA FM.BLK+10     RETURN CODE
 1760         STA RESULT        SAVE FOR APPLESOFT PEEK
 1770         RTS               RETURN TO APPLESOFT
 1780  *--------------------------------
 1790  RD.BLK .HS 03.02.0000.0000
 1800         .DA $9600-MY.BUFFER,MY.BUFFER
 1810  WR.BLK .HS 04.02.0000.0000
 1820         .DA $9600-MY.BUFFER,MY.BUFFER
 1830  *--------------------------------

