1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 19:29:37 +00:00
cc65/libsrc/cbm/closedir.s
uz 08b4ed1035 Added the POSIX functions opendir() and closedir().
git-svn-id: svn://svn.cc65.org/cc65/trunk@5666 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-05-30 19:37:57 +00:00

54 lines
701 B
ArmAsm

;
; Ullrich von Bassewitz, 2012-05-30
;
; Based on C code by Groepaz
;
; int __fastcall__ closedir(DIR *dir);
;
.include "dir.inc"
.include "zeropage.inc"
.import _close, _free
.proc _closedir
sta ptr1
stx ptr1+1
; Load dir->fd
ldy #DIR::fd+1
lda (ptr1),y
tax
dey
lda (ptr1),y
; Close the file
jsr _close
; Save the error code
pha
txa
pha
; Free the memory block
lda ptr1
ldx ptr1+1
jsr _free
; Return the error code from close()
pla
tax
pla
rts
.endproc