From: cuz Date: Fri, 26 Aug 2005 12:09:43 +0000 (+0000) Subject: Changes from Oliver: Use posix_memalign instead of _aligned_malloc X-Git-Tag: V2.12.0~255 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6871cc6c5786fdb2ecd6fb6d56717b2eae56b625;p=cc65 Changes from Oliver: Use posix_memalign instead of _aligned_malloc git-svn-id: svn://svn.cc65.org/cc65/trunk@3589 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/apple2/open.s b/libsrc/apple2/open.s index d27be5e8b..635b91e90 100644 --- a/libsrc/apple2/open.s +++ b/libsrc/apple2/open.s @@ -12,8 +12,8 @@ .import pushname, popname .import errnoexit, oserrexit - .import __aligned_malloc, _free - .import addysp, incsp4, pushax, popax + .import _posix_memalign, _free + .import addysp, incsp4, incaxy, pushax, popax .include "zeropage.inc" .include "errno.inc" @@ -48,12 +48,11 @@ _open: cpy #MAX_FDS * .sizeof(FD) bcc :- - ; Load errno codes - lda #ENOMEM ^ EMFILE -enomem: eor #ENOMEM + ; Load errno code + lda #EMFILE ; Cleanup stack - jsr incsp4 ; Preserves A +errno: jsr incsp4 ; Preserves A ; Return errno jmp errnoexit @@ -63,24 +62,24 @@ found: tya pha ; Alloc I/O buffer + lda #<(fdtab + FD::BUFFER) + ldx #>(fdtab + FD::BUFFER) + jsr incaxy + jsr pushax lda #$00 - ldx #>$0400 - jsr pushax ; Preserves A ldx #>$0100 - jsr __aligned_malloc + jsr pushax ; Preserves A + ldx #>$0400 + jsr _posix_memalign + tay ; Save errno code ; Restore fdtab slot pla - tay - - ; Get and check I/O buffer high byte - txa - beq enomem - - ; Set I/O buffer high byte (low byte remains zero) - sta fdtab + FD::BUFFER+1,y + sta tmp2 ; Save fdtab slot - sty tmp2 ; Save fdtab slot + ; Check for error + tya ; Restore errno code + bne errno ; Get and save flags jsr popax