From 6871cc6c5786fdb2ecd6fb6d56717b2eae56b625 Mon Sep 17 00:00:00 2001 From: cuz Date: Fri, 26 Aug 2005 12:09:43 +0000 Subject: [PATCH] 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 --- libsrc/apple2/open.s | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) 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 -- 2.39.5