1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00

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:
ol.sc 2010-02-14 23:12:54 +00:00
parent d4592d1a7c
commit d1aad57b98
21 changed files with 109 additions and 7 deletions

9
asminc/c16.inc Normal file
View File

@ -0,0 +1,9 @@
;
; C16 generic definitions.
;
; ---------------------------------------------------------------------------
; Zero page, Commodore stuff
DEVNUM := $AE ; Device number

View File

@ -9,8 +9,9 @@
;-----------------------------------------------------------------------------
; Zeropage stuff
ExecReg = $0000
IndReg = $0001
ExecReg = $00
IndReg = $01
DEVNUM = $9F
; ---------------------------------------------------------------------------
; Screen size

View File

@ -7,10 +7,11 @@
; ---------------------------------------------------------------------------
; Zeropage registers
; Zeropage stuff
ExecReg = $00
IndReg = $01
DEVNUM = $9F
; ---------------------------------------------------------------------------
; Screen size

9
asminc/pet.inc Normal file
View File

@ -0,0 +1,9 @@
;
; PET generic definitions.
;
; ---------------------------------------------------------------------------
; Zero page, Commodore stuff
DEVNUM := $D4 ; Device number

View File

@ -53,6 +53,7 @@ OBJS = _scrsize.o \
crt0.o \
color.o \
cputc.o \
devnum.o \
fast.o \
get_tv.o \
joy_stddrv.o \

7
libsrc/c128/devnum.s Normal file
View File

@ -0,0 +1,7 @@
;
; Oliver Schmidt, 2010-02-14
;
.include "c128.inc"
.exportzp devnum := DEVNUM

View File

@ -49,6 +49,7 @@ OBJS = _scrsize.o \
conio.o \
cputc.o \
crt0.o \
devnum.o \
get_tv.o \
joy_stddrv.o \
kbhit.o \

7
libsrc/c16/devnum.s Normal file
View File

@ -0,0 +1,7 @@
;
; Oliver Schmidt, 2010-02-14
;
.include "c16.inc"
.exportzp devnum := DEVNUM

View File

@ -53,6 +53,7 @@ OBJS = _scrsize.o \
color.o \
conio.o \
cputc.o \
devnum.o \
get_ostype.o \
get_tv.o \
joy_stddrv.o \

7
libsrc/c64/devnum.s Normal file
View File

@ -0,0 +1,7 @@
;
; Oliver Schmidt, 2010-02-14
;
.include "c64.inc"
.exportzp devnum := DEVNUM

View File

@ -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

View File

@ -56,6 +56,7 @@ OBJS = _scrsize.o \
color.o \
cputc.o \
crt0.o \
devnum.o \
extzp.o \
kbhit.o \
kclose.o \

7
libsrc/cbm510/devnum.s Normal file
View File

@ -0,0 +1,7 @@
;
; Oliver Schmidt, 2010-02-14
;
.include "cbm510.inc"
.exportzp devnum := DEVNUM

View File

@ -47,6 +47,7 @@ OBJS = _scrsize.o \
cputc.o \
crt0.o \
crtc.o \
devnum.o \
extzp.o \
get_tv.o \
kbhit.o \

7
libsrc/cbm610/devnum.s Normal file
View File

@ -0,0 +1,7 @@
;
; Oliver Schmidt, 2010-02-14
;
.include "cbm610.inc"
.exportzp devnum := DEVNUM

View File

@ -47,6 +47,7 @@ OBJS = _scrsize.o \
conio.o \
cputc.o \
crt0.o \
devnum.o \
get_tv.o \
kbhit.o \
kbsout.o \

7
libsrc/pet/devnum.s Normal file
View File

@ -0,0 +1,7 @@
;
; Oliver Schmidt, 2010-02-14
;
.include "pet.inc"
.exportzp devnum := DEVNUM

View File

@ -49,6 +49,7 @@ OBJS = _scrsize.o \
conio.o \
cputc.o \
crt0.o \
devnum.o \
get_tv.o \
joy_stddrv.o \
kacptr.o \

7
libsrc/plus4/devnum.s Normal file
View File

@ -0,0 +1,7 @@
;
; Oliver Schmidt, 2010-02-14
;
.include "plus4.inc"
.exportzp devnum := DEVNUM

View File

@ -46,6 +46,7 @@ OBJS = _scrsize.o \
color.o \
conio.o \
cputc.o \
devnum.o \
get_tv.o \
joy_stddrv.o \
kbhit.o \

7
libsrc/vic20/devnum.s Normal file
View File

@ -0,0 +1,7 @@
;
; Oliver Schmidt, 2010-02-14
;
.include "vic20.inc"
.exportzp devnum := DEVNUM