From 9a1bab361fdae80349619720f7498172ee6750a0 Mon Sep 17 00:00:00 2001 From: cuz Date: Thu, 3 Jun 2004 15:05:41 +0000 Subject: [PATCH] Improvements by Oliver Schmidt git-svn-id: svn://svn.cc65.org/cc65/trunk@3074 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/apple2/Makefile | 13 ++++++-- libsrc/apple2/_scrsize.s | 7 ++--- libsrc/apple2/apple2-280-192-6.s | 26 ++++++++++++++++ libsrc/apple2/apple2-40-40-16.s | 7 +++++ libsrc/apple2/apple2-stdjoy.s | 5 +++ libsrc/apple2/apple2.inc | 50 +----------------------------- libsrc/apple2/clrscr.s | 5 ++- libsrc/apple2/cputc.s | 12 +++++--- libsrc/apple2/rbascalc.s | 10 ++++++ libsrc/apple2/rcout.s | 10 ++++++ libsrc/apple2/read.s | 4 +-- libsrc/apple2/rhome.s | 10 ++++++ libsrc/apple2/rom.s | 53 ++++++++++++++++++++++++++++++++ libsrc/apple2/rpread.s | 10 ++++++ libsrc/apple2/rrdkey.s | 10 ++++++ libsrc/apple2/rsetwnd.s | 10 ++++++ libsrc/apple2/write.s | 6 +--- libsrc/apple2enh/Makefile | 3 +- libsrc/apple2enh/_scrsize.s | 18 +++++++++++ libsrc/apple2enh/cputc.s | 10 +++--- 20 files changed, 201 insertions(+), 78 deletions(-) create mode 100644 libsrc/apple2/rbascalc.s create mode 100644 libsrc/apple2/rcout.s create mode 100644 libsrc/apple2/rhome.s create mode 100644 libsrc/apple2/rom.s create mode 100644 libsrc/apple2/rpread.s create mode 100644 libsrc/apple2/rrdkey.s create mode 100644 libsrc/apple2/rsetwnd.s create mode 100644 libsrc/apple2enh/_scrsize.s diff --git a/libsrc/apple2/Makefile b/libsrc/apple2/Makefile index f39485b76..381872ed7 100644 --- a/libsrc/apple2/Makefile +++ b/libsrc/apple2/Makefile @@ -14,13 +14,13 @@ %.o: %.s @$(AS) -g -o $@ $(AFLAGS) $< -%.emd: %.o ../runtime/zeropage.o +%.emd: %.o ../runtime/zeropage.o rom.o @$(LD) -t module -o $@ $^ -%.joy: %.o ../runtime/zeropage.o +%.joy: %.o ../runtime/zeropage.o rom.o @$(LD) -t module -o $@ $^ -%.tgi: %.o ../runtime/zeropage.o +%.tgi: %.o ../runtime/zeropage.o rom.o @$(LD) -t module -o $@ $^ #-------------------------------------------------------------------------- @@ -45,8 +45,15 @@ OBJS= _scrsize.o \ mainargs.o \ oserrlist.o \ randomize.o \ + rbascalc.o \ + rcout.o \ read.o \ revers.o \ + rhome.o \ + rom.o \ + rpread.o \ + rrdkey.o \ + rsetwnd.o \ systime.o \ sysuname.o \ tgi_mode_table.o\ diff --git a/libsrc/apple2/_scrsize.s b/libsrc/apple2/_scrsize.s index a0be374b9..269f12a27 100644 --- a/libsrc/apple2/_scrsize.s +++ b/libsrc/apple2/_scrsize.s @@ -6,13 +6,10 @@ .export screensize - .include "apple2.inc" - .proc screensize - ldx WNDWDTH - ldy WNDBTM + ldx #40 + ldy #24 rts .endproc - diff --git a/libsrc/apple2/apple2-280-192-6.s b/libsrc/apple2/apple2-280-192-6.s index 498a1554b..2a7ddf17e 100644 --- a/libsrc/apple2/apple2-280-192-6.s +++ b/libsrc/apple2/apple2-280-192-6.s @@ -14,6 +14,32 @@ .macpack generic +; ------------------------------------------------------------------------ +; ROM entry points + +TEXT := $F399 ; Return to text screen +HGR := $F3E2 ; Initialize and clear hi-res page 1. +HCLR := $F3F2 ; Clear the current hi-res screen to black. +HPOSN := $F411 ; Positions the hi-res cursor without + ; plotting a point. + ; Enter with (A) = Y-coordinate, and + ; (Y,X) = X-coordinate. +HPLOT := $F457 ; Calls HPOSN and tries to plot a dot at + ; the cursor's position. If you are + ; trying to plot a non-white color at + ; a complementary color position, no + ; dot will be plotted. +HLIN := $F53A ; Draws a line from the last plotted + ; point or line destination to: + ; (X,A) = X-coordinate, and + ; (Y) = Y-coordinate. +DRAW := $F601 ; Draws a shape. Enter with (Y,X) = the + ; address of the shape table, and (A) = + ; the rotation factor. Uses the current + ; color. +SETHCOL := $F6EC ; Set the hi-res color to (X), where (X) + ; must be between 0 and 7. + ; ------------------------------------------------------------------------ ; Header. Includes jump table and constants. diff --git a/libsrc/apple2/apple2-40-40-16.s b/libsrc/apple2/apple2-40-40-16.s index e66b65638..1c50b84c7 100644 --- a/libsrc/apple2/apple2-40-40-16.s +++ b/libsrc/apple2/apple2-40-40-16.s @@ -24,6 +24,13 @@ CLRTOP = $F836 SETCOL = $F864 SCRN = $F871 SETGR = $FB40 +VTABZ = $FC24 + +; ------------------------------------------------------------------------ +; ROM entry points + +COUT := $FDED ; Vector to user output routine +TEXT := $F399 ; Return to text screen ; ------------------------------------------------------------------------ ; Header. Includes jump table and constants. diff --git a/libsrc/apple2/apple2-stdjoy.s b/libsrc/apple2/apple2-stdjoy.s index 1ab031a9a..b42876a69 100644 --- a/libsrc/apple2/apple2-stdjoy.s +++ b/libsrc/apple2/apple2-stdjoy.s @@ -20,6 +20,11 @@ OFFS = 10 +; ------------------------------------------------------------------------ +; ROM entry points + +PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y + ; ------------------------------------------------------------------------ ; Header. Includes jump table diff --git a/libsrc/apple2/apple2.inc b/libsrc/apple2/apple2.inc index 984ed98e8..4ec8c17d2 100644 --- a/libsrc/apple2/apple2.inc +++ b/libsrc/apple2/apple2.inc @@ -2,10 +2,7 @@ ;----------------------------------------------------------------------------- ; Zero page stuff -WNDLFT := $20 ; Left edge of text window WNDWDTH := $21 ; Right edge of text window -WNDTOP := $22 ; Top of text window -WNDBTM := $23 ; Bottom+1 of text window CH := $24 ; Cursor horizontal position CV := $25 ; Cursor vertical position BASL := $28 ; Text base address @@ -24,7 +21,7 @@ MLI := $BF00 ; ProDOS Machine Language Interface ;----------------------------------------------------------------------------- ; Hardware -; Keyboard entries +; Keyboard input KBD := $C000 ; Read keyboard KBDSTRB := $C010 ; Clear keyboard strobe @@ -43,48 +40,3 @@ HISCR := $C055 ; Page 2 ; Game controller BUTN0 := $C061 ; Open-Apple Key BUTN1 := $C062 ; Closed-Apple Key - -;----------------------------------------------------------------------------- -; ROM routines - -PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y -RDKEY := $FD0C ; Display prompt and read key from user input routine - -; Text output and helpers -VTABZ := $FC24 ; Calculate screen address for row in accumulator -HOME := $FC58 ; Clear current text screen -COUT := $FDED ; Vector to user output routine - -; Graphics entry points, by cbmnut (applenut??) cbmnut@hushmail.com -TEXT := $F399 ; Return to text screen -HGR2 := $F3D8 ; Initialize and clear hi-res page 2. -HGR := $F3E2 ; Initialize and clear hi-res page 1. -HCLR := $F3F2 ; Clear the current hi-res screen to black. -BKGND := $F3F6 ; Clear the current hi-res screen to the - ; last plotted color (from ($1C). -HPOSN := $F411 ; Positions the hi-res cursor without - ; plotting a point. - ; Enter with (A) = Y-coordinate, and - ; (Y,X) = X-coordinate. -HPLOT := $F457 ; Calls HPOSN and tries to plot a dot at - ; the cursor's position. If you are - ; trying to plot a non-white color at - ; a complementary color position, no - ; dot will be plotted. -HLIN := $F53A ; Draws a line from the last plotted - ; point or line destination to: - ; (X,A) = X-coordinate, and - ; (Y) = Y-coordinate. -HFIND := $F5CB ; Converts the hi-res coursor's position - ; back to X- and Y-coordinates; stores - ; X-coordinate at $E0,E1 and Y-coordinate - ; at $E2. -DRAW := $F601 ; Draws a shape. Enter with (Y,X) = the - ; address of the shape table, and (A) = - ; the rotation factor. Uses the current - ; color. -XDRAW := $F65D ; Draws a shape by inverting the existing - ; color of the dots the shape draws over. - ; Same entry parameters as DRAW. -SETHCOL := $F6EC ; Set the hi-res color to (X), where (X) - ; must be between 0 and 7. diff --git a/libsrc/apple2/clrscr.s b/libsrc/apple2/clrscr.s index c1a299386..b31f4cf76 100644 --- a/libsrc/apple2/clrscr.s +++ b/libsrc/apple2/clrscr.s @@ -4,7 +4,6 @@ ;; void clrscr (void); .export _clrscr + .import HOME - .include "apple2.inc" - -_clrscr = HOME \ No newline at end of file +_clrscr := HOME diff --git a/libsrc/apple2/cputc.s b/libsrc/apple2/cputc.s index 963f6d4d3..3e70a8fcb 100644 --- a/libsrc/apple2/cputc.s +++ b/libsrc/apple2/cputc.s @@ -10,13 +10,15 @@ .export _gotoxy, cputdirect .export newline, putchar - .import popa + .import popa, SETWND, BASCALC .include "apple2.inc" initconio: lda #$FF ; Normal character display mode sta INVFLG + lda #$00 + jsr SETWND ; Reset text window to full screen rts ; Plot a character - also used as internal function @@ -45,7 +47,7 @@ cputdirect: jsr putchar inc CH ; Bump to next column lda CH - cmp WNDWDTH + cmp #40 bne return lda #$00 sta CH @@ -63,19 +65,19 @@ newline: pha inc CV lda CV - cmp WNDBTM + cmp #24 bne L2 lda #$00 sta CV L2: - jsr VTABZ + jsr BASCALC pla sta CH rts _gotoxy: sta CV ; Store Y - jsr VTABZ + jsr BASCALC jsr popa ; Get X sta CH ; Store X rts diff --git a/libsrc/apple2/rbascalc.s b/libsrc/apple2/rbascalc.s new file mode 100644 index 000000000..ffe66f094 --- /dev/null +++ b/libsrc/apple2/rbascalc.s @@ -0,0 +1,10 @@ +; +; Ullrich von Bassewitz, 2004-06-03 +; +; Rom BASCALC routine +; + + .export BASCALC + +BASCALC := $FBC1 ; Calculate screen base address for row in accumulator + diff --git a/libsrc/apple2/rcout.s b/libsrc/apple2/rcout.s new file mode 100644 index 000000000..1b8cce749 --- /dev/null +++ b/libsrc/apple2/rcout.s @@ -0,0 +1,10 @@ +; +; Ullrich von Bassewitz, 2004-06-03 +; +; Rom COUT routine +; + + .export COUT + +COUT := $FDED ; Vector to user output routine + diff --git a/libsrc/apple2/read.s b/libsrc/apple2/read.s index 6e6ddf507..cfabdb132 100644 --- a/libsrc/apple2/read.s +++ b/libsrc/apple2/read.s @@ -7,11 +7,9 @@ ; .export _read - .import popax, _cputc + .import popax, _cputc, RDKEY .importzp ptr1, ptr2, ptr3 - .include "apple2.inc" - _read: jsr popax ; get count sta ptr2 stx ptr2+1 ; save it for later diff --git a/libsrc/apple2/rhome.s b/libsrc/apple2/rhome.s new file mode 100644 index 000000000..b32f41a41 --- /dev/null +++ b/libsrc/apple2/rhome.s @@ -0,0 +1,10 @@ +; +; Ullrich von Bassewitz, 2004-06-03 +; +; Rom HOME routine +; + + .export HOME + +HOME := $FC58 ; Clear current text screen + diff --git a/libsrc/apple2/rom.s b/libsrc/apple2/rom.s new file mode 100644 index 000000000..6d5ea5d70 --- /dev/null +++ b/libsrc/apple2/rom.s @@ -0,0 +1,53 @@ +; +; Oliver Schmidt, 30.05.2004 +; +; Apple2 ROM routines +; + + .export TEXT + .export HGR2 + .export HGR + .export HCLR + .export BKGND + .export HPOSN + .export HPLOT + .export HLIN + .export HFIND + .export DRAW + .export XDRAW + .export SETHCOL + +; Graphics entry points, by cbmnut (applenut??) cbmnut@hushmail.com +TEXT := $F399 ; Return to text screen +HGR2 := $F3D8 ; Initialize and clear hi-res page 2. +HGR := $F3E2 ; Initialize and clear hi-res page 1. +HCLR := $F3F2 ; Clear the current hi-res screen to black. +BKGND := $F3F6 ; Clear the current hi-res screen to the + ; last plotted color (from ($1C). +HPOSN := $F411 ; Positions the hi-res cursor without + ; plotting a point. + ; Enter with (A) = Y-coordinate, and + ; (Y,X) = X-coordinate. +HPLOT := $F457 ; Calls HPOSN and tries to plot a dot at + ; the cursor's position. If you are + ; trying to plot a non-white color at + ; a complementary color position, no + ; dot will be plotted. +HLIN := $F53A ; Draws a line from the last plotted + ; point or line destination to: + ; (X,A) = X-coordinate, and + ; (Y) = Y-coordinate. +HFIND := $F5CB ; Converts the hi-res coursor's position + ; back to X- and Y-coordinates; stores + ; X-coordinate at $E0,E1 and Y-coordinate + ; at $E2. +DRAW := $F601 ; Draws a shape. Enter with (Y,X) = the + ; address of the shape table, and (A) = + ; the rotation factor. Uses the current + ; color. +XDRAW := $F65D ; Draws a shape by inverting the existing + ; color of the dots the shape draws over. + ; Same entry parameters as DRAW. +SETHCOL := $F6EC ; Set the hi-res color to (X), where (X) + ; must be between 0 and 7. + diff --git a/libsrc/apple2/rpread.s b/libsrc/apple2/rpread.s new file mode 100644 index 000000000..66514c2f5 --- /dev/null +++ b/libsrc/apple2/rpread.s @@ -0,0 +1,10 @@ +; +; Ullrich von Bassewitz, 2004-06-03 +; +; Rom PREAD routine +; + + .export PREAD + +PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y + diff --git a/libsrc/apple2/rrdkey.s b/libsrc/apple2/rrdkey.s new file mode 100644 index 000000000..096bb759f --- /dev/null +++ b/libsrc/apple2/rrdkey.s @@ -0,0 +1,10 @@ +; +; Ullrich von Bassewitz, 2004-06-03 +; +; Rom RDKEY routine +; + + .export RDKEY + +RDKEY := $FD0C ; Display prompt and read key from user input routine + diff --git a/libsrc/apple2/rsetwnd.s b/libsrc/apple2/rsetwnd.s new file mode 100644 index 000000000..78bc2c447 --- /dev/null +++ b/libsrc/apple2/rsetwnd.s @@ -0,0 +1,10 @@ +; +; Ullrich von Bassewitz, 2004-06-03 +; +; Rom SETWND routine +; + + .export SETWND + +SETWND := $FB4B ; Set window to max width and start row in accumulator + diff --git a/libsrc/apple2/write.s b/libsrc/apple2/write.s index 7618bdc56..3fa482031 100644 --- a/libsrc/apple2/write.s +++ b/libsrc/apple2/write.s @@ -7,13 +7,9 @@ ;; .export _write - - .import popax - + .import popax, COUT .importzp ptr1, ptr2, ptr3 - .include "apple2.inc" - .proc _write sta ptr2 ; Save count for later diff --git a/libsrc/apple2enh/Makefile b/libsrc/apple2enh/Makefile index 9296ba2eb..689e31aa6 100644 --- a/libsrc/apple2enh/Makefile +++ b/libsrc/apple2enh/Makefile @@ -26,7 +26,8 @@ #-------------------------------------------------------------------------- # Object files -OBJS= chline.o \ +OBJS= _scrsize.o \ + chline.o \ cputc.o \ cvline.o \ textframe.o diff --git a/libsrc/apple2enh/_scrsize.s b/libsrc/apple2enh/_scrsize.s new file mode 100644 index 000000000..d3e580807 --- /dev/null +++ b/libsrc/apple2enh/_scrsize.s @@ -0,0 +1,18 @@ +; +; Ullrich von Bassewitz, 26.10.2000 +; +; Screen size variables +; + + .export screensize + + .include "../apple2/apple2.inc" + +.proc screensize + + ldx WNDWDTH + ldy #24 + rts + +.endproc + diff --git a/libsrc/apple2enh/cputc.s b/libsrc/apple2enh/cputc.s index a88bf4b6d..5cfdc3a14 100644 --- a/libsrc/apple2enh/cputc.s +++ b/libsrc/apple2enh/cputc.s @@ -10,7 +10,7 @@ .export _gotoxy, cputdirect .export newline, putchar - .import popa + .import popa, SETWND, BASCALC .include "../apple2/apple2.inc" @@ -19,6 +19,8 @@ initconio: lda #$FF ; Normal character display mode sta INVFLG sta SETALTCHAR ; Switch in alternate charset + lda #$00 + jsr SETWND ; Reset text window to full screen rts ; Plot a character - also used as internal function @@ -82,19 +84,19 @@ newline: pha inc CV lda CV - cmp WNDBTM + cmp #24 bne L2 lda #$00 sta CV L2: - jsr VTABZ + jsr BASCALC pla sta CH rts _gotoxy: sta CV ; Store Y - jsr VTABZ + jsr BASCALC jsr popa ; Get X sta CH ; Store X rts -- 2.39.5