Initialize _curunit from the zeropage value DEVNUM (aka First Address) in a constructor with a very high priority to be called before DEVNUM gets overwritten by other constructors.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4588 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -4,15 +4,33 @@
|
||||
; Variables used for CBM file I/O
|
||||
;
|
||||
|
||||
.export __curunit
|
||||
.export __filetype
|
||||
.export __curunit
|
||||
.constructor initcurunit, 30
|
||||
.importzp devnum
|
||||
|
||||
|
||||
.data
|
||||
|
||||
__curunit:
|
||||
.byte 8 ; Default is disk
|
||||
|
||||
__filetype:
|
||||
.byte 'u' ; Create user files by default
|
||||
|
||||
|
||||
.bss
|
||||
|
||||
__curunit:
|
||||
.res 1
|
||||
|
||||
|
||||
.segment "INIT"
|
||||
|
||||
.proc initcurunit
|
||||
|
||||
lda devnum
|
||||
bne @L0
|
||||
lda #8 ; Default is disk
|
||||
sta devnum
|
||||
@L0: sta __curunit
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
Reference in New Issue
Block a user