-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apple2: Rewrite readdir() and closedir() to assembly
- Loading branch information
1 parent
700c01f
commit f663ee4
Showing
5 changed files
with
202 additions
and
197 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
; | ||
; Colin Leroy-Mira <[email protected]>, 2024 | ||
; | ||
; int __fastcall__ closedir (DIR *dir) | ||
; | ||
|
||
.export _closedir, closedir_ptr1 | ||
|
||
.import _close | ||
.import _free | ||
.import pushax, popax, pushptr1, swapstk | ||
|
||
.importzp ptr1 | ||
|
||
.include "apple2.inc" | ||
.include "dir.inc" | ||
.include "errno.inc" | ||
.include "fcntl.inc" | ||
.include "zeropage.inc" | ||
|
||
_closedir: | ||
sta ptr1 | ||
stx ptr1+1 | ||
closedir_ptr1: | ||
; Close fd | ||
jsr pushptr1 ; Backup ptr1 | ||
ldy #$00 | ||
lda (ptr1),y ; Get fd | ||
ldx #$00 | ||
jsr _close | ||
jsr swapstk ; Store result, pop ptr1 | ||
|
||
; Free dir structure | ||
jsr _free | ||
jmp popax ; Return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.