1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-07 21:10:15 +00:00
cc65/libsrc/cbm/closedir.s

54 lines
701 B
ArmAsm
Raw Normal View History

;
; 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