Improvements by Oliver Schmidt

git-svn-id: svn://svn.cc65.org/cc65/trunk@3074 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2004-06-03 15:05:41 +00:00
parent 8c4b3599a2
commit 9a1bab361f
20 changed files with 201 additions and 78 deletions

View File

@@ -14,13 +14,13 @@
%.o: %.s %.o: %.s
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
%.emd: %.o ../runtime/zeropage.o %.emd: %.o ../runtime/zeropage.o rom.o
@$(LD) -t module -o $@ $^ @$(LD) -t module -o $@ $^
%.joy: %.o ../runtime/zeropage.o %.joy: %.o ../runtime/zeropage.o rom.o
@$(LD) -t module -o $@ $^ @$(LD) -t module -o $@ $^
%.tgi: %.o ../runtime/zeropage.o %.tgi: %.o ../runtime/zeropage.o rom.o
@$(LD) -t module -o $@ $^ @$(LD) -t module -o $@ $^
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
@@ -45,8 +45,15 @@ OBJS= _scrsize.o \
mainargs.o \ mainargs.o \
oserrlist.o \ oserrlist.o \
randomize.o \ randomize.o \
rbascalc.o \
rcout.o \
read.o \ read.o \
revers.o \ revers.o \
rhome.o \
rom.o \
rpread.o \
rrdkey.o \
rsetwnd.o \
systime.o \ systime.o \
sysuname.o \ sysuname.o \
tgi_mode_table.o\ tgi_mode_table.o\

View File

@@ -6,13 +6,10 @@
.export screensize .export screensize
.include "apple2.inc"
.proc screensize .proc screensize
ldx WNDWDTH ldx #40
ldy WNDBTM ldy #24
rts rts
.endproc .endproc

View File

@@ -14,6 +14,32 @@
.macpack generic .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. ; Header. Includes jump table and constants.

View File

@@ -24,6 +24,13 @@ CLRTOP = $F836
SETCOL = $F864 SETCOL = $F864
SCRN = $F871 SCRN = $F871
SETGR = $FB40 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. ; Header. Includes jump table and constants.

View File

@@ -20,6 +20,11 @@
OFFS = 10 OFFS = 10
; ------------------------------------------------------------------------
; ROM entry points
PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Header. Includes jump table ; Header. Includes jump table

View File

@@ -2,10 +2,7 @@
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Zero page stuff ; Zero page stuff
WNDLFT := $20 ; Left edge of text window
WNDWDTH := $21 ; Right 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 CH := $24 ; Cursor horizontal position
CV := $25 ; Cursor vertical position CV := $25 ; Cursor vertical position
BASL := $28 ; Text base address BASL := $28 ; Text base address
@@ -24,7 +21,7 @@ MLI := $BF00 ; ProDOS Machine Language Interface
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Hardware ; Hardware
; Keyboard entries ; Keyboard input
KBD := $C000 ; Read keyboard KBD := $C000 ; Read keyboard
KBDSTRB := $C010 ; Clear keyboard strobe KBDSTRB := $C010 ; Clear keyboard strobe
@@ -43,48 +40,3 @@ HISCR := $C055 ; Page 2
; Game controller ; Game controller
BUTN0 := $C061 ; Open-Apple Key BUTN0 := $C061 ; Open-Apple Key
BUTN1 := $C062 ; Closed-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.

View File

@@ -4,7 +4,6 @@
;; void clrscr (void); ;; void clrscr (void);
.export _clrscr .export _clrscr
.import HOME
.include "apple2.inc" _clrscr := HOME
_clrscr = HOME

View File

@@ -10,13 +10,15 @@
.export _gotoxy, cputdirect .export _gotoxy, cputdirect
.export newline, putchar .export newline, putchar
.import popa .import popa, SETWND, BASCALC
.include "apple2.inc" .include "apple2.inc"
initconio: initconio:
lda #$FF ; Normal character display mode lda #$FF ; Normal character display mode
sta INVFLG sta INVFLG
lda #$00
jsr SETWND ; Reset text window to full screen
rts rts
; Plot a character - also used as internal function ; Plot a character - also used as internal function
@@ -45,7 +47,7 @@ cputdirect:
jsr putchar jsr putchar
inc CH ; Bump to next column inc CH ; Bump to next column
lda CH lda CH
cmp WNDWDTH cmp #40
bne return bne return
lda #$00 lda #$00
sta CH sta CH
@@ -63,19 +65,19 @@ newline:
pha pha
inc CV inc CV
lda CV lda CV
cmp WNDBTM cmp #24
bne L2 bne L2
lda #$00 lda #$00
sta CV sta CV
L2: L2:
jsr VTABZ jsr BASCALC
pla pla
sta CH sta CH
rts rts
_gotoxy: _gotoxy:
sta CV ; Store Y sta CV ; Store Y
jsr VTABZ jsr BASCALC
jsr popa ; Get X jsr popa ; Get X
sta CH ; Store X sta CH ; Store X
rts rts

10
libsrc/apple2/rbascalc.s Normal file
View File

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

10
libsrc/apple2/rcout.s Normal file
View File

@@ -0,0 +1,10 @@
;
; Ullrich von Bassewitz, 2004-06-03
;
; Rom COUT routine
;
.export COUT
COUT := $FDED ; Vector to user output routine

View File

@@ -7,11 +7,9 @@
; ;
.export _read .export _read
.import popax, _cputc .import popax, _cputc, RDKEY
.importzp ptr1, ptr2, ptr3 .importzp ptr1, ptr2, ptr3
.include "apple2.inc"
_read: jsr popax ; get count _read: jsr popax ; get count
sta ptr2 sta ptr2
stx ptr2+1 ; save it for later stx ptr2+1 ; save it for later

10
libsrc/apple2/rhome.s Normal file
View File

@@ -0,0 +1,10 @@
;
; Ullrich von Bassewitz, 2004-06-03
;
; Rom HOME routine
;
.export HOME
HOME := $FC58 ; Clear current text screen

53
libsrc/apple2/rom.s Normal file
View File

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

10
libsrc/apple2/rpread.s Normal file
View File

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

10
libsrc/apple2/rrdkey.s Normal file
View File

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

10
libsrc/apple2/rsetwnd.s Normal file
View File

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

View File

@@ -7,13 +7,9 @@
;; ;;
.export _write .export _write
.import popax, COUT
.import popax
.importzp ptr1, ptr2, ptr3 .importzp ptr1, ptr2, ptr3
.include "apple2.inc"
.proc _write .proc _write
sta ptr2 ; Save count for later sta ptr2 ; Save count for later

View File

@@ -26,7 +26,8 @@
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Object files # Object files
OBJS= chline.o \ OBJS= _scrsize.o \
chline.o \
cputc.o \ cputc.o \
cvline.o \ cvline.o \
textframe.o textframe.o

View File

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

View File

@@ -10,7 +10,7 @@
.export _gotoxy, cputdirect .export _gotoxy, cputdirect
.export newline, putchar .export newline, putchar
.import popa .import popa, SETWND, BASCALC
.include "../apple2/apple2.inc" .include "../apple2/apple2.inc"
@@ -19,6 +19,8 @@ initconio:
lda #$FF ; Normal character display mode lda #$FF ; Normal character display mode
sta INVFLG sta INVFLG
sta SETALTCHAR ; Switch in alternate charset sta SETALTCHAR ; Switch in alternate charset
lda #$00
jsr SETWND ; Reset text window to full screen
rts rts
; Plot a character - also used as internal function ; Plot a character - also used as internal function
@@ -82,19 +84,19 @@ newline:
pha pha
inc CV inc CV
lda CV lda CV
cmp WNDBTM cmp #24
bne L2 bne L2
lda #$00 lda #$00
sta CV sta CV
L2: L2:
jsr VTABZ jsr BASCALC
pla pla
sta CH sta CH
rts rts
_gotoxy: _gotoxy:
sta CV ; Store Y sta CV ; Store Y
jsr VTABZ jsr BASCALC
jsr popa ; Get X jsr popa ; Get X
sta CH ; Store X sta CH ; Store X
rts rts