more Kernal reorganization

This commit is contained in:
FeralChild64 committed 2019-10-15 17:55:56 +02:00
1 parent 076a839f1a
commit 8829ec8090
20 files changed
+2

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 281
// - [CM64] Compute's Mapping the Commodore 64 - page 230
//
// CPU registers that has to be preserved (see [RG64]): .Y
//
clall_real:
// Store .Y register
phy_trash_a
// Original routine probably just sets LDTND to 0, but this is not really safe,
// so we actually close all the channels; at least IDE64 does the same for
// it's channels, see CLALL description in the IDE64 User's Guide
!:
ldy LDTND
beq !+
dey
lda LAT, y
jsr JCLOSE
jmp !-
!:
// Restore .Y register
ply_trash_a
// 'C64 Programmers Reference Guide', page 281, claims it calls CLRCHN too
jsr CLRCHN
// Not sure whether original Kernal does so, but it seems sane to also clear possible errors
jmp kernalstatus_reset