From 99ecc9a609322267268bbbf7868a5fefa6a4822a Mon Sep 17 00:00:00 2001 From: cuz Date: Thu, 23 Nov 2000 19:05:32 +0000 Subject: [PATCH] Removed initialization code to set the screen size and replaced it by a separate module that contains a module constructor. In some cases, the code was even unnecessary, since the screen size is known in advance. git-svn-id: svn://svn.cc65.org/cc65/trunk@476 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/apple2/Makefile | 20 ++++++++++++++++--- libsrc/{conio => apple2}/_scrsize.s | 6 +++--- libsrc/atari/Makefile | 2 +- libsrc/atari/_scrsize.s | 15 +++++++++++++++ libsrc/atari/conio.s | 20 ------------------- libsrc/atari/crt0.s | 6 ++---- libsrc/c128/Makefile | 20 ++++++++++++------- libsrc/c128/_scrsize.s | 29 ++++++++++++++++++++++++++++ libsrc/c128/conio.s | 5 ----- libsrc/c64/Makefile | 24 ++++++++++++++++------- libsrc/c64/_scrsize.s | 25 ++++++++++++++++++++++++ libsrc/c64/conio.s | 13 ------------- libsrc/c64/crt0.s | 6 +----- libsrc/cbm610/Makefile | 27 ++++++++++++++++++-------- libsrc/cbm610/_scrsize.s | 15 +++++++++++++++ libsrc/cbm610/conio.s | 19 ------------------ libsrc/cbm610/crt0.s | 5 ----- libsrc/conio/Makefile | 17 +++++++--------- libsrc/pet/Makefile | 16 ++++++++++----- libsrc/pet/_scrsize.s | 30 +++++++++++++++++++++++++++++ libsrc/pet/conio.s | 14 -------------- libsrc/pet/crt0.s | 8 ++------ libsrc/plus4/Makefile | 20 ++++++++++++------- libsrc/plus4/_scrsize.s | 25 ++++++++++++++++++++++++ libsrc/plus4/conio.s | 3 --- 25 files changed, 245 insertions(+), 145 deletions(-) rename libsrc/{conio => apple2}/_scrsize.s (69%) create mode 100644 libsrc/atari/_scrsize.s delete mode 100644 libsrc/atari/conio.s create mode 100644 libsrc/c128/_scrsize.s create mode 100644 libsrc/c64/_scrsize.s create mode 100644 libsrc/cbm610/_scrsize.s delete mode 100644 libsrc/cbm610/conio.s create mode 100644 libsrc/pet/_scrsize.s create mode 100644 libsrc/plus4/_scrsize.s diff --git a/libsrc/apple2/Makefile b/libsrc/apple2/Makefile index 17813f44d..e7f847426 100644 --- a/libsrc/apple2/Makefile +++ b/libsrc/apple2/Makefile @@ -13,12 +13,26 @@ C_OBJS = -S_OBJS = break.o clrscr.o cclear.o cgetc.o chline.o color.o \ - cputc.o crt0.o ctype.o \ - cvline.o kbhit.o read.o revers.o where.o write.o +S_OBJS= _scrsize.o \ + break.o \ + cclear.o \ + cgetc.o \ + chline.o \ + clrscr.o \ + color.o \ + cputc.o \ + crt0.o \ + ctype.o \ + cvline.o \ + kbhit.o \ + read.o \ + revers.o \ + where.o \ + write.o all: $(C_OBJS) $(S_OBJS) clean: @rm -f $(C_OBJS:.c=.s) $(C_OBJS) $(S_OBJS) crt0.o + diff --git a/libsrc/conio/_scrsize.s b/libsrc/apple2/_scrsize.s similarity index 69% rename from libsrc/conio/_scrsize.s rename to libsrc/apple2/_scrsize.s index 743a88835..5578c1be1 100644 --- a/libsrc/conio/_scrsize.s +++ b/libsrc/apple2/_scrsize.s @@ -6,10 +6,10 @@ .export xsize, ysize -.bss +.rodata -xsize: .res 1 -ysize: .res 1 +xsize: .byte 40 +ysize: .byte 24 diff --git a/libsrc/atari/Makefile b/libsrc/atari/Makefile index bc8dfd80e..5fd5461be 100644 --- a/libsrc/atari/Makefile +++ b/libsrc/atari/Makefile @@ -16,7 +16,7 @@ ATARIDEFS = -DNUMDRVS=4 C_OBJS = -S_OBJS = crt0.o kbhit.o conio.o clrscr.o cputc.o ctype.o chline.o cvline.o \ +S_OBJS = crt0.o _scrsize.o kbhit.o clrscr.o cputc.o ctype.o chline.o cvline.o \ color.o gotoxy.o cclear.o revers.o readjoy.o break.o where.o write.o \ gotox.o gotoy.o savevec.o rwcommon.o cgetc.o read.o getargs.o close.o \ open.o oserror.o fdtable.o setcolor.o scroll.o mul40.o graphuse.o \ diff --git a/libsrc/atari/_scrsize.s b/libsrc/atari/_scrsize.s new file mode 100644 index 000000000..5578c1be1 --- /dev/null +++ b/libsrc/atari/_scrsize.s @@ -0,0 +1,15 @@ +; +; Ullrich von Bassewitz, 26.10.2000 +; +; Screen size variables +; + + .export xsize, ysize + +.rodata + +xsize: .byte 40 +ysize: .byte 24 + + + diff --git a/libsrc/atari/conio.s b/libsrc/atari/conio.s deleted file mode 100644 index 651d0e511..000000000 --- a/libsrc/atari/conio.s +++ /dev/null @@ -1,20 +0,0 @@ -; -; Christian Groessler -; -; Low level stuff for screen output/console input -; - - .export initconio - .import xsize, ysize, plot - - .include "atari.inc" - -.code - -initconio: - ldx #40 - ldy #24 - stx xsize - sty ysize - rts - diff --git a/libsrc/atari/crt0.s b/libsrc/atari/crt0.s index 3937f0fb0..f311f5d26 100644 --- a/libsrc/atari/crt0.s +++ b/libsrc/atari/crt0.s @@ -15,9 +15,9 @@ RESERVE_MOUSE_MEMORY = 1 ; for P/M .export mouse_pm0 .endif .export _exit - .import getargs, argc, argv + .import getargs, argc, argv .import initlib, donelib - .import initconio, zerobss, pushax + .import zerobss, pushax .import _main,__filetab,getfd .import __CODE_LOAD__, __BSS_LOAD__ .import __graphmode_used @@ -124,8 +124,6 @@ L1: lda sp,x ; Initialize conio stuff - jsr initconio - lda #$FF sta CH diff --git a/libsrc/c128/Makefile b/libsrc/c128/Makefile index 2ae36d881..f54fd107d 100644 --- a/libsrc/c128/Makefile +++ b/libsrc/c128/Makefile @@ -11,13 +11,19 @@ %.o: %.s @$(AS) -g -o $@ $(AFLAGS) $< -C_OBJS = - -S_OBJS = crt0.o conio.o kbhit.o clrscr.o cgetc.o readjoy.o\ - color.o cputc.o break.o - -all: $(C_OBJS) $(S_OBJS) +OBJS = _scrsize.o \ + break.o \ + cgetc.o \ + clrscr.o \ + conio.o \ + crt0.o \ + color.o \ + cputc.o \ + kbhit.o \ + readjoy.o + +all: $(OBJS) clean: - @rm -f $(C_OBJS:.c=.s) $(C_OBJS) $(S_OBJS) crt0.o + @rm -f $(OBJS) diff --git a/libsrc/c128/_scrsize.s b/libsrc/c128/_scrsize.s new file mode 100644 index 000000000..d377be7df --- /dev/null +++ b/libsrc/c128/_scrsize.s @@ -0,0 +1,29 @@ +; +; Ullrich von Bassewitz, 26.10.2000 +; +; Screen size variables +; + + .export xsize, ysize + .constructor initscrsize + + .include "../cbm/cbm.inc" + +.code + +initscrsize: + jsr SCREEN + inx + stx xsize + iny + sty ysize + rts + +.bss + +xsize: .res 1 +ysize: .res 1 + + + + diff --git a/libsrc/c128/conio.s b/libsrc/c128/conio.s index 481b4e7b4..fddbd8632 100644 --- a/libsrc/c128/conio.s +++ b/libsrc/c128/conio.s @@ -18,11 +18,6 @@ keyvec: .res 2 .code initconio: - jsr SCREEN - inx - stx xsize - iny - sty ysize ; Save the old vector diff --git a/libsrc/c64/Makefile b/libsrc/c64/Makefile index 5a69bdfed..528930ac8 100644 --- a/libsrc/c64/Makefile +++ b/libsrc/c64/Makefile @@ -11,13 +11,23 @@ %.o: %.s @$(AS) -g -o $@ $(AFLAGS) $< -C_OBJS = - -S_OBJS = crt0.o read.o write.o kbhit.o conio.o clrscr.o mouse.o\ - cputc.o cgetc.o color.o readjoy.o break.o rs232.o - -all: $(C_OBJS) $(S_OBJS) +OBJS = _scrsize.o \ + break.o \ + crt0.o \ + cgetc.o \ + clrscr.o \ + color.o \ + conio.o \ + cputc.o \ + kbhit.o \ + mouse.o \ + read.o \ + readjoy.o \ + rs232.o \ + write.o + +all: $(OBJS) clean: - @rm -f $(C_OBJS:.c=.s) $(C_OBJS) $(S_OBJS) crt0.o + @rm -f $(OBJS) diff --git a/libsrc/c64/_scrsize.s b/libsrc/c64/_scrsize.s new file mode 100644 index 000000000..749226d36 --- /dev/null +++ b/libsrc/c64/_scrsize.s @@ -0,0 +1,25 @@ +; +; Ullrich von Bassewitz, 26.10.2000 +; +; Screen size variables +; + + .export xsize, ysize + .constructor initscrsize + + .include "../cbm/cbm.inc" + +.code + +initscrsize: + jsr SCREEN + stx xsize + sty ysize + rts + +.bss + +xsize: .res 1 +ysize: .res 1 + + diff --git a/libsrc/c64/conio.s b/libsrc/c64/conio.s index f822c945d..0e3f97947 100644 --- a/libsrc/c64/conio.s +++ b/libsrc/c64/conio.s @@ -4,20 +4,7 @@ ; Low level stuff for screen output/console input ; - .export initconio .exportzp CURS_X, CURS_Y - .import xsize, ysize - .include "../cbm/cbm.inc" .include "c64.inc" -.code - -initconio: - jsr SCREEN - stx xsize - sty ysize - rts - - - diff --git a/libsrc/c64/crt0.s b/libsrc/c64/crt0.s index 3f57be7ae..a6cee8c22 100644 --- a/libsrc/c64/crt0.s +++ b/libsrc/c64/crt0.s @@ -6,7 +6,7 @@ .export _exit .import initlib, donelib - .import initconio, zerobss, push0 + .import zerobss, push0 .import _main .include "c64.inc" @@ -94,10 +94,6 @@ L1: lda sp,x jsr initlib -; Initialize conio stuff - - jsr initconio - ; Pass an empty command line jsr push0 ; argc diff --git a/libsrc/cbm610/Makefile b/libsrc/cbm610/Makefile index 1077641eb..ea51689c8 100644 --- a/libsrc/cbm610/Makefile +++ b/libsrc/cbm610/Makefile @@ -11,14 +11,25 @@ %.o: %.s @$(AS) -g -o $@ $(AFLAGS) $< -C_OBJS = - -S_OBJS = crt0.o kbhit.o conio.o clrscr.o cputc.o cgetc.o\ - color.o break.o banking.o crtc.o pokesys.o\ - kscnkey.o kplot.o kudtim.o kirq.o rs232.o - -all: $(C_OBJS) $(S_OBJS) +OBJS = _scrsize.o \ + banking.o \ + break.o \ + cgetc.o \ + clrscr.o \ + color.o \ + cputc.o \ + crt0.o \ + crtc.o \ + kbhit.o \ + kirq.o \ + kplot.o \ + kscnkey.o \ + kudtim.o \ + pokesys.o \ + rs232.o + +all: $(OBJS) clean: - @rm -f $(C_OBJS:.c=.s) $(C_OBJS) $(S_OBJS) crt0.o + @rm -f $(OBJS) diff --git a/libsrc/cbm610/_scrsize.s b/libsrc/cbm610/_scrsize.s new file mode 100644 index 000000000..f7095af75 --- /dev/null +++ b/libsrc/cbm610/_scrsize.s @@ -0,0 +1,15 @@ +; +; Ullrich von Bassewitz, 26.10.2000 +; +; Screen size variables +; + + .export xsize, ysize + +.rodata + +xsize: .byte 80 +ysize: .byte 25 + + + diff --git a/libsrc/cbm610/conio.s b/libsrc/cbm610/conio.s deleted file mode 100644 index c1c58ef38..000000000 --- a/libsrc/cbm610/conio.s +++ /dev/null @@ -1,19 +0,0 @@ -; -; Ullrich von Bassewitz, 22.09.1998 -; -; Low level stuff for screen output/console input -; - - .export initconio - .import xsize, ysize - - .include "cbm610.inc" - -initconio: - lda #80 - sta xsize - lda #25 - sta ysize - rts - - diff --git a/libsrc/cbm610/crt0.s b/libsrc/cbm610/crt0.s index 3c18b6bf4..d41746e2a 100644 --- a/libsrc/cbm610/crt0.s +++ b/libsrc/cbm610/crt0.s @@ -7,7 +7,6 @@ .export _exit .import initlib, donelib .import push0, _main - .import initconio .import __BSS_RUN__, __BSS_SIZE__ .import irq, nmi .import k_irq, k_nmi, k_plot, k_udtim, k_scnkey @@ -240,10 +239,6 @@ Z4: jsr initlib -; Initialize conio stuff - - jsr initconio - ; Create the (empty) command line for the program jsr push0 ; argc diff --git a/libsrc/conio/Makefile b/libsrc/conio/Makefile index 77152a86f..6b2262371 100644 --- a/libsrc/conio/Makefile +++ b/libsrc/conio/Makefile @@ -11,16 +11,13 @@ %.o: %.s @$(AS) -g -o $@ $(AFLAGS) $< -C_OBJS = +OBJS = _cursor.o \ + cputhex.o \ + cputs.o \ + cursor.o \ + scrsize.o -S_OBJS = _cursor.o \ - _scrsize.o \ - cputhex.o \ - cputs.o \ - cursor.o \ - scrsize.o - -all: $(C_OBJS) $(S_OBJS) +all: $(OBJS) clean: - @rm -f *~ $(C_OBJS:.o=.s) $(C_OBJS) $(S_OBJS) + @rm -f *~ $(OBJS) diff --git a/libsrc/pet/Makefile b/libsrc/pet/Makefile index 2f3d280ff..49a578629 100644 --- a/libsrc/pet/Makefile +++ b/libsrc/pet/Makefile @@ -11,11 +11,17 @@ %.o: %.s @$(AS) -g -o $@ $(AFLAGS) $< -C_OBJS = +OBJS = _scrsize.o \ + break.o \ + cgetc.o \ + clrscr.o \ + color.o \ + conio.o \ + cputc.o \ + crt0.o \ + kbhit.o -S_OBJS = crt0.o kbhit.o conio.o clrscr.o cputc.o cgetc.o break.o color.o - -all: $(C_OBJS) $(S_OBJS) +all: $(OBJS) clean: - @rm -f $(C_OBJS:.c=.s) $(C_OBJS) $(S_OBJS) crt0.o + @rm -f $(OBJS) diff --git a/libsrc/pet/_scrsize.s b/libsrc/pet/_scrsize.s new file mode 100644 index 000000000..09c94182b --- /dev/null +++ b/libsrc/pet/_scrsize.s @@ -0,0 +1,30 @@ +; +; Ullrich von Bassewitz, 26.10.2000 +; +; Screen size variables +; + + + .export xsize, ysize + .constructor initscrsize + + .include "pet.inc" + +.code + +initscrsize: + ldx SCR_LINELEN + inx ; Variable is one less + stx xsize + lda #25 + sta ysize + rts + + +.bss + +xsize: .res 1 +ysize: .res 1 + + + diff --git a/libsrc/pet/conio.s b/libsrc/pet/conio.s index 19e753333..45ae54d74 100644 --- a/libsrc/pet/conio.s +++ b/libsrc/pet/conio.s @@ -4,21 +4,7 @@ ; Low level stuff for screen output/console input ; - .export initconio - .import xsize, ysize .exportzp CURS_X, CURS_Y .include "pet.inc" -.code - -initconio: - ldx SCR_LINELEN - inx ; Variable is one less - stx xsize - lda #25 - sta ysize - rts - - - diff --git a/libsrc/pet/crt0.s b/libsrc/pet/crt0.s index 24ed2691d..5d4ac7332 100644 --- a/libsrc/pet/crt0.s +++ b/libsrc/pet/crt0.s @@ -4,9 +4,9 @@ ; This must be the *first* file on the linker command line ; - .export _exit + .export _exit .import initlib, donelib - .import initconio, zerobss, push0 + .import zerobss, push0 .import _main .include "pet.inc" @@ -89,10 +89,6 @@ L1: lda sp,x jsr initlib -; Initialize conio stuff - - jsr initconio - ; Pass an empty command line jsr push0 ; argc diff --git a/libsrc/plus4/Makefile b/libsrc/plus4/Makefile index 46bc1dd0a..6ab65b686 100644 --- a/libsrc/plus4/Makefile +++ b/libsrc/plus4/Makefile @@ -11,13 +11,19 @@ %.o: %.s @$(AS) -g -o $@ $(AFLAGS) $< -C_OBJS = - -S_OBJS = crt0.o kbhit.o conio.o clrscr.o cputc.o cgetc.o\ - color.o readjoy.o break.o - -all: $(C_OBJS) $(S_OBJS) +OBJS = _scrsize.o \ + break.o \ + cgetc.o \ + clrscr.o \ + color.o \ + conio.o \ + cputc.o \ + crt0.o \ + kbhit.o \ + readjoy.o + +all: $(OBJS) clean: - @rm -f $(C_OBJS:.c=.s) $(C_OBJS) $(S_OBJS) crt0.o + @rm -f $(OBJS) diff --git a/libsrc/plus4/_scrsize.s b/libsrc/plus4/_scrsize.s new file mode 100644 index 000000000..749226d36 --- /dev/null +++ b/libsrc/plus4/_scrsize.s @@ -0,0 +1,25 @@ +; +; Ullrich von Bassewitz, 26.10.2000 +; +; Screen size variables +; + + .export xsize, ysize + .constructor initscrsize + + .include "../cbm/cbm.inc" + +.code + +initscrsize: + jsr SCREEN + stx xsize + sty ysize + rts + +.bss + +xsize: .res 1 +ysize: .res 1 + + diff --git a/libsrc/plus4/conio.s b/libsrc/plus4/conio.s index 11d5307f6..d6f253111 100644 --- a/libsrc/plus4/conio.s +++ b/libsrc/plus4/conio.s @@ -14,9 +14,6 @@ .code initconio: - jsr SCREEN - stx xsize - sty ysize ldy #15 L1: lda fnkeys,y sta FKEY_SPACE,y -- 2.39.5