mirror of
https://github.com/cc65/cc65.git
synced 2025-02-02 00:35:32 +00:00
Improvements by Oliver Schmidt
git-svn-id: svn://svn.cc65.org/cc65/trunk@3074 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
8c4b3599a2
commit
9a1bab361f
@ -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\
|
||||
|
@ -6,13 +6,10 @@
|
||||
|
||||
.export screensize
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
.proc screensize
|
||||
|
||||
ldx WNDWDTH
|
||||
ldy WNDBTM
|
||||
ldx #40
|
||||
ldy #24
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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.
|
||||
|
@ -4,7 +4,6 @@
|
||||
;; void clrscr (void);
|
||||
|
||||
.export _clrscr
|
||||
.import HOME
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
_clrscr = HOME
|
||||
_clrscr := HOME
|
||||
|
@ -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
|
||||
|
10
libsrc/apple2/rbascalc.s
Normal file
10
libsrc/apple2/rbascalc.s
Normal 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
10
libsrc/apple2/rcout.s
Normal file
@ -0,0 +1,10 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2004-06-03
|
||||
;
|
||||
; Rom COUT routine
|
||||
;
|
||||
|
||||
.export COUT
|
||||
|
||||
COUT := $FDED ; Vector to user output routine
|
||||
|
@ -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
|
||||
|
10
libsrc/apple2/rhome.s
Normal file
10
libsrc/apple2/rhome.s
Normal 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
53
libsrc/apple2/rom.s
Normal 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
10
libsrc/apple2/rpread.s
Normal 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
10
libsrc/apple2/rrdkey.s
Normal 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
10
libsrc/apple2/rsetwnd.s
Normal 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
|
||||
|
@ -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
|
||||
|
@ -26,7 +26,8 @@
|
||||
#--------------------------------------------------------------------------
|
||||
# Object files
|
||||
|
||||
OBJS= chline.o \
|
||||
OBJS= _scrsize.o \
|
||||
chline.o \
|
||||
cputc.o \
|
||||
cvline.o \
|
||||
textframe.o
|
||||
|
18
libsrc/apple2enh/_scrsize.s
Normal file
18
libsrc/apple2enh/_scrsize.s
Normal 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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user