ProDOS 8 requires an page-aligned 1kB IO-buffer for every open file. The implementation using posix_memalign() is universally correct but quite expensive. There I added support for overriding this implementation with maybe limited (i.e. to one open file) but cheaper custom implementations.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4142 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -78,6 +78,7 @@ S_OBJS= _scrsize.o \
|
|||||||
gotoy.o \
|
gotoy.o \
|
||||||
home.o \
|
home.o \
|
||||||
initcwd.o \
|
initcwd.o \
|
||||||
|
iobuf.o \
|
||||||
joy_stddrv.o \
|
joy_stddrv.o \
|
||||||
kbhit.o \
|
kbhit.o \
|
||||||
mainargs.o \
|
mainargs.o \
|
||||||
|
|||||||
15
libsrc/apple2/iobuf.s
Normal file
15
libsrc/apple2/iobuf.s
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
;
|
||||||
|
; Oliver Schmidt, 10.9.2009
|
||||||
|
;
|
||||||
|
; Default ProDOS 8 I/O buffer management
|
||||||
|
;
|
||||||
|
|
||||||
|
.export iobuf_alloc, iobuf_free
|
||||||
|
.export iobuf_init, iobuf_done
|
||||||
|
.import iobuf_nop
|
||||||
|
.import _posix_memalign, _free
|
||||||
|
|
||||||
|
iobuf_alloc := _posix_memalign
|
||||||
|
iobuf_free := _free
|
||||||
|
iobuf_init := iobuf_nop
|
||||||
|
iobuf_done := iobuf_nop
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.import __dos_type
|
.import __dos_type
|
||||||
|
.import iobuf_init, iobuf_done
|
||||||
|
.export iobuf_nop
|
||||||
|
|
||||||
.include "mli.inc"
|
.include "mli.inc"
|
||||||
|
|
||||||
@@ -24,12 +26,16 @@ callmli:
|
|||||||
beq oserr
|
beq oserr
|
||||||
|
|
||||||
; Call MLI and return
|
; Call MLI and return
|
||||||
|
jsr iobuf_init
|
||||||
jsr ENTRY
|
jsr ENTRY
|
||||||
call: .byte $00
|
call: .byte $00
|
||||||
.addr mliparam
|
.addr mliparam
|
||||||
rts
|
jmp iobuf_done
|
||||||
|
|
||||||
; Load oserror code and return
|
; Load oserror code and return
|
||||||
oserr: lda #$01 ; "Invalid MLI function code number"
|
oserr: lda #$01 ; "Invalid MLI function code number"
|
||||||
sec
|
sec
|
||||||
rts
|
; Fall through
|
||||||
|
|
||||||
|
iobuf_nop:
|
||||||
|
rts
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
.import pushname, popname
|
.import pushname, popname
|
||||||
.import errnoexit, oserrexit
|
.import errnoexit, oserrexit
|
||||||
.import _posix_memalign, _free
|
.import iobuf_alloc, iobuf_free
|
||||||
.import addysp, incsp4, incaxy, pushax, popax
|
.import addysp, incsp4, incaxy, pushax, popax
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
@@ -70,7 +70,7 @@ found: tya
|
|||||||
ldx #>$0100
|
ldx #>$0100
|
||||||
jsr pushax ; Preserves A
|
jsr pushax ; Preserves A
|
||||||
ldx #>$0400
|
ldx #>$0400
|
||||||
jsr _posix_memalign
|
jsr iobuf_alloc
|
||||||
tay ; Save errno code
|
tay ; Save errno code
|
||||||
|
|
||||||
; Restore fdtab slot
|
; Restore fdtab slot
|
||||||
@@ -206,7 +206,7 @@ freebuffer:
|
|||||||
; Free I/O buffer
|
; Free I/O buffer
|
||||||
lda #$00
|
lda #$00
|
||||||
ldx fdtab + FD::BUFFER+1,y
|
ldx fdtab + FD::BUFFER+1,y
|
||||||
jmp _free
|
jmp iobuf_free
|
||||||
|
|
||||||
closeallfiles:
|
closeallfiles:
|
||||||
; All open files
|
; All open files
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ S_OBJS= _scrsize.o \
|
|||||||
gotoy.o \
|
gotoy.o \
|
||||||
home.o \
|
home.o \
|
||||||
initcwd.o \
|
initcwd.o \
|
||||||
|
iobuf.o \
|
||||||
joy_stddrv.o \
|
joy_stddrv.o \
|
||||||
kbhit.o \
|
kbhit.o \
|
||||||
mainargs.o \
|
mainargs.o \
|
||||||
|
|||||||
Reference in New Issue
Block a user