2 ; Oliver Schmidt, 15.09.2009
4 ; ProDOS 8 I/O buffer management for memory between
5 ; location $0800 and the cc65 program start address
9 .export iobuf_alloc, iobuf_free
10 .import __STARTUP_RUN__
11 .import incsp2, popptr1
13 .include "zeropage.inc"
15 .include "../filedes.inc"
20 ; Convert end address highbyte to table index
27 ; Mark all remaining table entries as used
35 bne :-- ; Branch always
37 ; ------------------------------------------------------------------------
42 ; Get and save "memptr"
46 ; Search table for free entry
56 ; Mark table entry as used
60 ; Convert table index to address hibyte
67 ; Store address in "memptr"
76 ; Convert address hibyte to table index
83 ; Mark table entry as free
89 ; ------------------------------------------------------------------------