mirror of
https://github.com/cc65/cc65.git
synced 2024-11-05 08:05:51 +00:00
08b4ed1035
git-svn-id: svn://svn.cc65.org/cc65/trunk@5666 b7a2c559-68d2-44c3-8de9-860c34a00d81
54 lines
701 B
ArmAsm
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
|
|
|