some work towards I/O stack modularization
This commit is contained in:
1 parent
966658eae0
commit
6fa2c5b570
56 files changed
+357
-69
No files matched your search
@@ -0,0 +1,71 @@
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmer's Reference Guide - page 289
|
||||
// - [CM64] Compute's Mapping the Commodore 64 - page 230/231
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): none
|
||||
//
|
||||
|
||||
|
||||
OPEN:
|
||||
|
||||
// Reset status
|
||||
jsr kernalstatus_reset
|
||||
|
||||
// Check if the logical file number is unique
|
||||
ldy LDTND
|
||||
!:
|
||||
beq !+
|
||||
dey
|
||||
lda LAT, y
|
||||
cmp LA
|
||||
bne open_not_yet_open
|
||||
jmp kernalerror_FILE_ALREADY_OPEN
|
||||
|
||||
open_not_yet_open:
|
||||
cpy #$00
|
||||
jmp !-
|
||||
!:
|
||||
// Check if we have space in tables
|
||||
|
||||
ldy LDTND
|
||||
cpy #$0A
|
||||
bcc open_has_space
|
||||
!:
|
||||
// Table is full
|
||||
jmp kernalerror_TOO_MANY_OPEN_FILES
|
||||
|
||||
open_has_space:
|
||||
|
||||
// Update the tables
|
||||
|
||||
// LAT / FAT / SAT support implemented according to
|
||||
// 'Compute's Mapping the Commodore 64', page 52
|
||||
|
||||
lda LA
|
||||
sta LAT, y
|
||||
lda FA
|
||||
sta FAT, y
|
||||
lda SA
|
||||
sta SAT, y
|
||||
|
||||
iny
|
||||
sty LDTND
|
||||
|
||||
// Check for command to send
|
||||
lda FNLEN
|
||||
beq open_done_success
|
||||
|
||||
// Check for IEC device
|
||||
lda FA
|
||||
jsr iec_check_devnum_oc
|
||||
bcc_far open_iec
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
open_done_success:
|
||||
|
||||
clc
|
||||
rts
|
||||
Reference in new issue
Block a user