]> git.sur5r.net Git - cc65/commitdiff
Initialize _curunit from the zeropage value DEVNUM (aka First Address) in a construct...
authorol.sc <ol.sc@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 14 Feb 2010 23:12:54 +0000 (23:12 +0000)
committerol.sc <ol.sc@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 14 Feb 2010 23:12:54 +0000 (23:12 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@4588 b7a2c559-68d2-44c3-8de9-860c34a00d81

21 files changed:
asminc/c16.inc [new file with mode: 0644]
asminc/cbm510.inc
asminc/cbm610.inc
asminc/pet.inc [new file with mode: 0644]
libsrc/c128/Makefile
libsrc/c128/devnum.s [new file with mode: 0644]
libsrc/c16/Makefile
libsrc/c16/devnum.s [new file with mode: 0644]
libsrc/c64/Makefile
libsrc/c64/devnum.s [new file with mode: 0644]
libsrc/cbm/filevars.s
libsrc/cbm510/Makefile
libsrc/cbm510/devnum.s [new file with mode: 0644]
libsrc/cbm610/Makefile
libsrc/cbm610/devnum.s [new file with mode: 0644]
libsrc/pet/Makefile
libsrc/pet/devnum.s [new file with mode: 0644]
libsrc/plus4/Makefile
libsrc/plus4/devnum.s [new file with mode: 0644]
libsrc/vic20/Makefile
libsrc/vic20/devnum.s [new file with mode: 0644]

diff --git a/asminc/c16.inc b/asminc/c16.inc
new file mode 100644 (file)
index 0000000..9372e72
--- /dev/null
@@ -0,0 +1,9 @@
+;
+; C16 generic definitions.
+;
+
+
+; ---------------------------------------------------------------------------
+; Zero page, Commodore stuff
+
+DEVNUM                 := $AE          ; Device number
index 0aad95f49beac01b12a6934085566bc4731ba536..e98ed4a143eb263f1d4e048866c5b8d798d3b833 100644 (file)
@@ -9,8 +9,9 @@
 ;-----------------------------------------------------------------------------
 ; Zeropage stuff
 
-ExecReg                = $0000
-IndReg         = $0001
+ExecReg                = $00
+IndReg         = $01
+DEVNUM         = $9F
 
 ; ---------------------------------------------------------------------------
 ; Screen size
index ea85cd50d0a172f9e7ec4f1f992bfb449d20debe..62d0c6a42eaef1dfc52658139a723c01d79ba0d4 100644 (file)
@@ -7,10 +7,11 @@
 
 
 ; ---------------------------------------------------------------------------
-; Zeropage registers
+; Zeropage stuff
 
 ExecReg                = $00
 IndReg         = $01
+DEVNUM         = $9F
 
 ; ---------------------------------------------------------------------------
 ; Screen size
diff --git a/asminc/pet.inc b/asminc/pet.inc
new file mode 100644 (file)
index 0000000..524e835
--- /dev/null
@@ -0,0 +1,9 @@
+;
+; PET generic definitions.
+;
+
+
+; ---------------------------------------------------------------------------
+; Zero page, Commodore stuff
+
+DEVNUM                 := $D4          ; Device number
index 248c36fd29a013d289fa0e90e19179c498d412ca..a5c4dde828177b736e80743eb7f1901435b5cff5 100644 (file)
@@ -53,6 +53,7 @@ OBJS =        _scrsize.o              \
        crt0.o                  \
                color.o                 \
        cputc.o                 \
+               devnum.o                \
        fast.o                  \
         get_tv.o               \
        joy_stddrv.o            \
diff --git a/libsrc/c128/devnum.s b/libsrc/c128/devnum.s
new file mode 100644 (file)
index 0000000..72007a5
--- /dev/null
@@ -0,0 +1,7 @@
+;
+; Oliver Schmidt, 2010-02-14
+;
+
+       .include        "c128.inc"
+
+       .exportzp       devnum := DEVNUM
index 6aa5275ddbd5099614c4fc369b2bce0c7d25c9ec..06bea22f92b542650967bf4827e3d09e5732250a 100644 (file)
@@ -49,6 +49,7 @@ OBJS =        _scrsize.o      \
        conio.o         \
        cputc.o         \
        crt0.o          \
+       devnum.o        \
         get_tv.o        \
        joy_stddrv.o    \
        kbhit.o         \
diff --git a/libsrc/c16/devnum.s b/libsrc/c16/devnum.s
new file mode 100644 (file)
index 0000000..105c9bd
--- /dev/null
@@ -0,0 +1,7 @@
+;
+; Oliver Schmidt, 2010-02-14
+;
+
+       .include        "c16.inc"
+
+       .exportzp       devnum := DEVNUM
index 0b3eddeea810c15a63f7eb44b1374b2e196d0b4c..073bdcb330de545d5a92d96714470d95b708144c 100644 (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            \
diff --git a/libsrc/c64/devnum.s b/libsrc/c64/devnum.s
new file mode 100644 (file)
index 0000000..e7b5f94
--- /dev/null
@@ -0,0 +1,7 @@
+;
+; Oliver Schmidt, 2010-02-14
+;
+
+       .include        "c64.inc"
+
+       .exportzp       devnum := DEVNUM
index 54f247d4cb035288a5c0e4f92e3c96cebe0b92cf..3b6bdb750a023dbb3901bca9f7a8d48dac89f648 100644 (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
index 0eadda41b620aa1be5ff20e721afce29d8213c22..e92683dce005c5732dc3ec172a28ab26a0c9f269 100644 (file)
@@ -56,6 +56,7 @@ OBJS =        _scrsize.o      \
                color.o         \
        cputc.o         \
                crt0.o          \
+               devnum.o        \
         extzp.o         \
                kbhit.o         \
         kclose.o        \
diff --git a/libsrc/cbm510/devnum.s b/libsrc/cbm510/devnum.s
new file mode 100644 (file)
index 0000000..0c6bf21
--- /dev/null
@@ -0,0 +1,7 @@
+;
+; Oliver Schmidt, 2010-02-14
+;
+
+       .include        "cbm510.inc"
+
+       .exportzp       devnum := DEVNUM
index ac0293ed6fff53bdaf16a30106dac3acdcaa0784..1eea7f31f206e65a8dba2e5ac84d22dc6a5ddd0e 100644 (file)
@@ -47,6 +47,7 @@ OBJS =        _scrsize.o      \
                cputc.o         \
                crt0.o          \
                crtc.o          \
+               devnum.o        \
         extzp.o         \
         get_tv.o        \
                kbhit.o         \
diff --git a/libsrc/cbm610/devnum.s b/libsrc/cbm610/devnum.s
new file mode 100644 (file)
index 0000000..75fa4cd
--- /dev/null
@@ -0,0 +1,7 @@
+;
+; Oliver Schmidt, 2010-02-14
+;
+
+       .include        "cbm610.inc"
+
+       .exportzp       devnum := DEVNUM
index 911f9b3ab38078afaf69a5f8d090eea929d3c0ee..b44c383b0922b89fd2bc888f24486e3b22a945a6 100644 (file)
@@ -47,6 +47,7 @@ OBJS =        _scrsize.o      \
        conio.o         \
        cputc.o         \
        crt0.o          \
+       devnum.o        \
        get_tv.o        \
        kbhit.o         \
         kbsout.o        \
diff --git a/libsrc/pet/devnum.s b/libsrc/pet/devnum.s
new file mode 100644 (file)
index 0000000..82d6b6b
--- /dev/null
@@ -0,0 +1,7 @@
+;
+; Oliver Schmidt, 2010-02-14
+;
+
+       .include        "pet.inc"
+
+       .exportzp       devnum := DEVNUM
index b3a3c4eee8eb4d8b8c688bf0c199394b0eefccb2..51ef6ef80d9e08987f4eefb62134d25b84d2785e 100644 (file)
@@ -49,6 +49,7 @@ OBJS =        _scrsize.o      \
                conio.o         \
                cputc.o         \
                crt0.o          \
+               devnum.o        \
         get_tv.o        \
        joy_stddrv.o    \
         kacptr.o        \
diff --git a/libsrc/plus4/devnum.s b/libsrc/plus4/devnum.s
new file mode 100644 (file)
index 0000000..d369476
--- /dev/null
@@ -0,0 +1,7 @@
+;
+; Oliver Schmidt, 2010-02-14
+;
+
+       .include        "plus4.inc"
+
+       .exportzp       devnum := DEVNUM
index 67433999f884b5c418ec2186940fb95e7b9992f8..50fb0152b07734bea6559d712ebc4659edabc2a6 100644 (file)
@@ -46,6 +46,7 @@ OBJS =        _scrsize.o      \
        color.o         \
        conio.o         \
        cputc.o         \
+       devnum.o        \
        get_tv.o        \
        joy_stddrv.o    \
        kbhit.o         \
diff --git a/libsrc/vic20/devnum.s b/libsrc/vic20/devnum.s
new file mode 100644 (file)
index 0000000..23a9c38
--- /dev/null
@@ -0,0 +1,7 @@
+;
+; Oliver Schmidt, 2010-02-14
+;
+
+       .include        "vic20.inc"
+
+       .exportzp       devnum := DEVNUM