]> git.sur5r.net Git - cc65/commitdiff
ProDOS 8 requires an page-aligned 1kB IO-buffer for every open file. The implementati...
authorol.sc <ol.sc@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 10 Sep 2009 09:59:26 +0000 (09:59 +0000)
committerol.sc <ol.sc@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 10 Sep 2009 09:59:26 +0000 (09:59 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@4142 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/apple2/Makefile
libsrc/apple2/iobuf.s [new file with mode: 0644]
libsrc/apple2/mli.s
libsrc/apple2/open.s
libsrc/apple2enh/Makefile

index b4e449f05a6042ef514d7a82ac5028cd51e21278..70ab08df128a34c91401d569a03a09ce679805d5 100644 (file)
@@ -78,6 +78,7 @@ S_OBJS=       _scrsize.o      \
        gotoy.o         \
         home.o          \
        initcwd.o       \
+       iobuf.o         \
         joy_stddrv.o    \
        kbhit.o         \
         mainargs.o      \
diff --git a/libsrc/apple2/iobuf.s b/libsrc/apple2/iobuf.s
new file mode 100644 (file)
index 0000000..fc412c2
--- /dev/null
@@ -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
index b5c2ad433d6ec6f2614650d766a659fa8b76f404..48e09e7188c3eaa3982b7731cff29195fb66075d 100644 (file)
@@ -5,6 +5,8 @@
 ;
 
         .import         __dos_type
+        .import         iobuf_init, iobuf_done
+        .export         iobuf_nop
 
         .include        "mli.inc"
 
@@ -24,12 +26,16 @@ callmli:
         beq     oserr
 
         ; Call MLI and return
+        jsr     iobuf_init
         jsr     ENTRY
 call:   .byte   $00
         .addr   mliparam
-        rts
+        jmp     iobuf_done
 
         ; Load oserror code and return
 oserr:  lda     #$01           ; "Invalid MLI function code number"
         sec
-        rts
\ No newline at end of file
+        ; Fall through
+
+iobuf_nop:
+        rts
index 635b91e90f50d344129e53d8ba24e7fd4f50af10..aef0f56e8d1be05b6bbc9f7c3757bd340cae22e8 100644 (file)
@@ -12,7 +12,7 @@
 
         .import                pushname, popname
         .import        errnoexit, oserrexit
-        .import                _posix_memalign, _free
+        .import                iobuf_alloc, iobuf_free
         .import        addysp, incsp4, incaxy, pushax, popax
 
         .include       "zeropage.inc"
@@ -70,7 +70,7 @@ found:  tya
         ldx    #>$0100
         jsr    pushax          ; Preserves A
         ldx    #>$0400
-        jsr    _posix_memalign
+        jsr    iobuf_alloc
        tay                     ; Save errno code
 
         ; Restore fdtab slot
@@ -206,7 +206,7 @@ freebuffer:
         ; Free I/O buffer
         lda    #$00
         ldx    fdtab + FD::BUFFER+1,y
-        jmp    _free
+        jmp    iobuf_free
 
 closeallfiles:
         ; All open files
index d030d24367dda4f14bcdfb27ee9eec10040cb94e..88e88c6b737bbabba15384328c273d829d8d1ae5 100644 (file)
@@ -78,6 +78,7 @@ S_OBJS=       _scrsize.o      \
        gotoy.o         \
         home.o          \
        initcwd.o       \
+       iobuf.o         \
         joy_stddrv.o    \
        kbhit.o         \
         mainargs.o      \