%.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 $@ $^
#--------------------------------------------------------------------------
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\
.export screensize
- .include "apple2.inc"
-
.proc screensize
- ldx WNDWDTH
- ldy WNDBTM
+ ldx #40
+ ldy #24
rts
.endproc
-
.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.
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.
OFFS = 10
+; ------------------------------------------------------------------------
+; ROM entry points
+
+PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y
+
; ------------------------------------------------------------------------
; Header. Includes jump table
;-----------------------------------------------------------------------------
; 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
;-----------------------------------------------------------------------------
; Hardware
-; Keyboard entries
+; Keyboard input
KBD := $C000 ; Read keyboard
KBDSTRB := $C010 ; Clear keyboard strobe
; 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.
;; void clrscr (void);
.export _clrscr
+ .import HOME
- .include "apple2.inc"
-
-_clrscr = HOME
\ No newline at end of file
+_clrscr := HOME
.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
jsr putchar
inc CH ; Bump to next column
lda CH
- cmp WNDWDTH
+ cmp #40
bne return
lda #$00
sta CH
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
--- /dev/null
+;
+; Ullrich von Bassewitz, 2004-06-03
+;
+; Rom BASCALC routine
+;
+
+ .export BASCALC
+
+BASCALC := $FBC1 ; Calculate screen base address for row in accumulator
+
--- /dev/null
+;
+; Ullrich von Bassewitz, 2004-06-03
+;
+; Rom COUT routine
+;
+
+ .export COUT
+
+COUT := $FDED ; Vector to user output routine
+
;
.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
--- /dev/null
+;
+; Ullrich von Bassewitz, 2004-06-03
+;
+; Rom HOME routine
+;
+
+ .export HOME
+
+HOME := $FC58 ; Clear current text screen
+
--- /dev/null
+;
+; 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.
+
--- /dev/null
+;
+; Ullrich von Bassewitz, 2004-06-03
+;
+; Rom PREAD routine
+;
+
+ .export PREAD
+
+PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y
+
--- /dev/null
+;
+; Ullrich von Bassewitz, 2004-06-03
+;
+; Rom RDKEY routine
+;
+
+ .export RDKEY
+
+RDKEY := $FD0C ; Display prompt and read key from user input routine
+
--- /dev/null
+;
+; Ullrich von Bassewitz, 2004-06-03
+;
+; Rom SETWND routine
+;
+
+ .export SETWND
+
+SETWND := $FB4B ; Set window to max width and start row in accumulator
+
;;
.export _write
-
- .import popax
-
+ .import popax, COUT
.importzp ptr1, ptr2, ptr3
- .include "apple2.inc"
-
.proc _write
sta ptr2 ; Save count for later
#--------------------------------------------------------------------------
# Object files
-OBJS= chline.o \
+OBJS= _scrsize.o \
+ chline.o \
cputc.o \
cvline.o \
textframe.o
--- /dev/null
+;
+; Ullrich von Bassewitz, 26.10.2000
+;
+; Screen size variables
+;
+
+ .export screensize
+
+ .include "../apple2/apple2.inc"
+
+.proc screensize
+
+ ldx WNDWDTH
+ ldy #24
+ rts
+
+.endproc
+
.export _gotoxy, cputdirect
.export newline, putchar
- .import popa
+ .import popa, SETWND, BASCALC
.include "../apple2/apple2.inc"
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
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