
 1000  *SAVE S.INIT BUFFERS (S-C)
 1010  *--------------------------------
 1020  *   REPLACEMENT FOR DOS 3.3 CODE
 1030  *      (SAVES 11 BYTES, NO CHANGE IN FUNCTION)
 1040  *--------------------------------
 1050  PNTR              .EQ $40,41
 1060  HIMEM             .EQ $4C,4D
 1070  FP.STRINGS        .EQ $6F,70
 1080  FP.HIMEM          .EQ $73,74
 1090  PP                .EQ $CA,CB
 1100  *--------------------------------
 1110  BUF.START         .EQ $9D00
 1120  NO.FILES          .EQ $AA57
 1130  TEMP              .EQ $AA63
 1140  ACTIVE.BASIC.FLAG .EQ $AAB6
 1150  *--------------------------------
 1160         .OR $A7D4
 1170         .TA $08D4
 1180  *--------------------------------
 1190  INIT.FILE.BUFFERS
 1200         LDA NO.FILES      DO (NO.FILES) TIMES
 1210         STA TEMP          USE TEMP FOR COUNTER
 1220         LDA BUF.START     POINT TO FIRST BUFFER
 1230         LDX BUF.START+1
 1240  *--------------------------------
 1250  .1     STA PNTR
 1260         STX PNTR+1
 1270         LDY #0            Store zero over 1st char of
 1280         TYA               filename to mark it as a
 1290         STA (PNTR),Y      free buffer.
 1300  *---FILL IN 3 PNTRS--------------
 1310         SEC               COMPUTE LOW BYTE OF POINTERS
 1320         LDA PNTR  
 1330         SBC #$2D
 1340         LDY #$1E          ...FMW ADDR
 1350         STA (PNTR),Y
 1360         LDY #$20          ...TSL ADDR
 1370         STA (PNTR),Y
 1380         LDY #$22          ...DATA ADDR 
 1390         STA (PNTR),Y
 1400         PHA
 1410         LDA PNTR+1        COMPUTE HIGH BYTE OF FMW ADDR
 1420         SBC #0
 1430         LDY #$1F          ...FMW ADDR
 1440         STA (PNTR),Y
 1450         SBC #1
 1460         LDY #$21          ...TSL ADDR
 1470         STA (PNTR),Y
 1480         SBC #1
 1490         LDY #$23          ...DATA ADDR
 1500         STA (PNTR),Y
 1510  *---IS THAT THE LAST BUFFER?-----
 1520         INY               POINT AT FWD LINK LO-BYTE
 1530         TAX          SAVE HI BYTE OF DATA ADDR
 1540         DEC TEMP
 1550         BEQ .2       ...NO MORE BUFFERS
 1560  *---BUILD LINK TO NEXT BUFFER----
 1570         PLA          GET LO BYTE
 1580         SBC #$26     ADDR OF FILENAME IN NEXT BUFFER
 1590         STA (PNTR),Y      ...LO BYTE
 1600         PHA               SAVE ON STACK
 1610         TXA               GET HI BYTE
 1620         SBC #0
 1630         INY               ...HI BYTE
 1640         STA (PNTR),Y
 1650         TAX               SAVE IN X
 1660         PLA               GET LO BYTE AGAIN
 1670         BCS .1            ...ALWAYS
 1680  *---SET FORWARD PNTR = 0000------
 1690  .2     LDA #0
 1700         STA (PNTR),Y
 1710         INY
 1720         STA (PNTR),Y
 1730  *---SET HIMEM AND EMPTY BLOCK----
 1740         LDA ACTIVE.BASIC.FLAG
 1750         BEQ .3            INTEGER BASIC
 1760         STX FP.HIMEM+1    APPLESOFT
 1770         STX FP.STRINGS+1  
 1780         PLA
 1790         STA FP.HIMEM  
 1800         STA FP.STRINGS  
 1810         RTS
 1820  .3     STX HIMEM+1  
 1830         STX PP+1  
 1840         PLA
 1850         STA HIMEM  
 1860         STA PP  
 1870         RTS
 1880  *--------------------------------

