-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
721efaa
commit 97022fb
Showing
12 changed files
with
803 additions
and
33 deletions.
There are no files selected for viewing
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 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,38 @@ | ||
; Copyright 2024 LLVM-MOS Project | ||
; Licensed under the Apache License, Version 2.0 with LLVM Exceptions. | ||
; See https://github.com/llvm-mos/llvm-mos-sdk/blob/main/LICENSE for license | ||
; information. | ||
|
||
; Originally from cc65. Modified from original version. | ||
|
||
; | ||
; Christian Groessler, May-2000 | ||
; | ||
; int __fastcall__ close(int fd); | ||
; | ||
|
||
.include "atari.inc" | ||
.include "errno.inc" | ||
|
||
.globl close | ||
|
||
close: | ||
jsr fdtoiocb_down ; get iocb index into X and decr. usage count | ||
bmi inverr | ||
bne ok ; not last one -> don't close yet | ||
lda #CLOSE | ||
sta ICCOM,x | ||
jsr CIOV | ||
bmi closerr | ||
ok: ldx #0 | ||
stx __oserror ; clear system specific error code | ||
txa | ||
rts | ||
|
||
inverr: lda #<EINVAL | ||
jmp __directerrno | ||
|
||
closerr: | ||
tya | ||
jmp __mappederrno | ||
|
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,27 @@ | ||
; Copyright 2024 LLVM-MOS Project | ||
; Licensed under the Apache License, Version 2.0 with LLVM Exceptions. | ||
; See https://github.com/llvm-mos/llvm-mos-sdk/blob/main/LICENSE for license | ||
; information. | ||
|
||
; Originally from cc65. Modified from original version. | ||
|
||
; Christian Groessler, Oct-2000 | ||
; | ||
; offsets and defines for fdtable (internal use only) | ||
; | ||
|
||
MAX_FD_INDEX = 12 ; max. # of open fds | ||
MAX_FD_VAL = 8 ; we have 8 IOCBs | ||
|
||
ft_entrylen = 4 ; length of table entry (it's not sufficient to change here! | ||
; the code sometimes does two bit shifts to multiply/divide by | ||
; this length) | ||
|
||
ft_usa = 0 ; usage counter | ||
ft_iocb = 1 ; iocb index (0,$10,$20,etc.), $ff for empty entry | ||
ft_dev = 2 ; device of open iocb (0 - device not remembered, eg. filename specified) | ||
ft_flag = 3 ; flags | ||
; lower 3 bits: device number (for R: and D:) | ||
; bit 3 - seeking supported by DOS/disk combination | ||
; bit 4 - indicates a fd opened by the program as apposed to the | ||
; inherited ones from program start (fd 0 to fd 2) |
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,34 @@ | ||
; Copyright 2024 LLVM-MOS Project | ||
; Licensed under the Apache License, Version 2.0 with LLVM Exceptions. | ||
; See https://github.com/llvm-mos/llvm-mos-sdk/blob/main/LICENSE for license | ||
; information. | ||
|
||
; Originally from cc65. Modified from original version. | ||
|
||
; | ||
; Christian Groessler, Oct-2000 | ||
; Daniel Serpell, Dec-2009 | ||
; | ||
; the fdtable itself is defined here | ||
; | ||
|
||
.include "fd.inc" | ||
|
||
.globl fd_table,fd_index | ||
|
||
.data | ||
|
||
fd_index: ; fd number is index into this table, entry's value specifies the fd_table entry | ||
.byte 0,0,0 ; at start, three first files are stdin/stdout/stderr. | ||
.space MAX_FD_INDEX-3,$ff | ||
|
||
fd_table: ; each entry represents an open iocb | ||
.byte 3,0,'E',0 ; system console, app starts with opened iocb #0 for E: | ||
.byte 0,$ff,0,0 | ||
.byte 0,$ff,0,0 | ||
.byte 0,$ff,0,0 | ||
.byte 0,$ff,0,0 | ||
.byte 0,$ff,0,0 | ||
.byte 0,$ff,0,0 | ||
.byte 0,$ff,0,0 | ||
|
Oops, something went wrong.