mirror of
https://github.com/zellyn/goapple2.git
synced 2024-12-14 13:29:05 +00:00
Working on programmer's aid #1 sources
This commit is contained in:
parent
d42a92879b
commit
0624e4538b
624
source/progaid/hires.asm
Normal file
624
source/progaid/hires.asm
Normal file
@ -0,0 +1,624 @@
|
||||
**************************
|
||||
* *
|
||||
* APPLE-II HI-RESOLUTION *
|
||||
* GRAPHICS SUBROUTINES *
|
||||
* *
|
||||
* BY WOZ 9/13/77 *
|
||||
* *
|
||||
* ALL RIGHTS RESERVED *
|
||||
* *
|
||||
**************************
|
||||
|
||||
* HI-RES EQUATES
|
||||
SHAPEL EQU $1A POINTER TO
|
||||
SHAPEH EQU $1B SHAPE LIST
|
||||
HCOLOR1 EQU $1C RUNNING COLOR MASK
|
||||
COUNTH EQU $1D
|
||||
HBASL EQU $26 BASE ADR FOR CURRENT
|
||||
HBASH EQU $27 HI-RES PLOT LINE. A
|
||||
HMASK EQU $30
|
||||
A1L EQU $3C MONITOR A1.
|
||||
A1H EQU $3D
|
||||
A2L EQU $3E MONITOR A2.
|
||||
A2H EQU $3F
|
||||
LOMEML EQU $4A BASIC 'START OF VARS'.
|
||||
MOMEMH EQU $4B
|
||||
DXL EQU $50 DELTA-X FOR HLIN, SHAPE.
|
||||
DXH EQU $51
|
||||
SHAPEX EQU $51 SHAPE TEMP.
|
||||
DY EQU $52 DELTA-Y FOR HLIN, SHAPE.
|
||||
QDRNT EQU $53 ROT QUADRANT (SHAPE).
|
||||
EL EQU $54 ERROR FOR HLIN.
|
||||
EH EQU $55
|
||||
PPL EQU $CA BASIC START OF PROG PTR.
|
||||
PPH EQU $CB
|
||||
PVL EQU $CC BASIC END OF VARS PTR.
|
||||
PVH EQU $CD
|
||||
ACL EQU $CE BASIC ACC.
|
||||
ACH EQU $CF
|
||||
X0L EQU $320 PRIOR X-COORD SAVE
|
||||
X0H EQU $321 AFTER HLIN OR HPLOT.
|
||||
Y0 EQU $322 HLIN, HPLOT Y-COORD SAVE.
|
||||
BXSAV EQU $323 X-REG SAVE FOR BASIC.
|
||||
HCOLOR EQU $324 COLOR FOR HPLOT, HPOSN
|
||||
HNDX EQU $325 HORIZ OFFSET SAVE.
|
||||
HPAG EQU $326 HI-RES PAGE ($20 NORMAL)
|
||||
SCALE EQU $327 SCALE FOR SHAPE, MOVE.
|
||||
SHAPXL EQU $328 START OF
|
||||
SHAPXH EQU $329 SHAPE TABLE.
|
||||
COLLSN EQU $32A COLLISION COUNT.
|
||||
HIRES EQU $C057 SWITCH TO HI-RES VIDEO
|
||||
MIXSET EQU $C053 SELECT TEXT/GRAPHICS MIX
|
||||
TXTCLR EQU $C050 SELECT GRAPHICS MODE.
|
||||
MEMFUL EQU $E36B BASIC MEM FULL ERROR.
|
||||
RNGERR EQU $EE68 BASIC RANGE ERROR.
|
||||
ACADR EQU $F11E 2-BYTE TAPE READ SETUP.
|
||||
RD2BIT EQU $FCFA TWO-EDGE TAPE SENSE.
|
||||
READ EQU $FEFD TAPE READ (A1.A2).
|
||||
READX1 EQU $FF02 READ WITHOUT HEADER.
|
||||
|
||||
* HIGH RESOLUTION GRAPHICS INITS
|
||||
*
|
||||
* ROM VERSION $D000 TO $D3FF
|
||||
*
|
||||
ORG $D000
|
||||
OBJ $A000
|
||||
SETHRL LDA #$20 INIT FOR $2000-3FFF
|
||||
STA HPAG HI-RES SCREEN MEMORY.
|
||||
LDA HIRES SET HIRES DISPLAY MODE
|
||||
LDA MIXSET WITH TEXT AT BOTTOM.
|
||||
LDA TXTCLR SET GRAPHICS DISPLAY MODE
|
||||
HCLR LDA #$0
|
||||
BKGND0 STA HCOLOR1 SET FOR BLACK BKGND.
|
||||
BKGND LDA HPAG
|
||||
STA SHAPEH INIT HI-RES SCREEN MEM
|
||||
LDY #$0 FOR CURRENT PAGE, NORMALLY
|
||||
STY SHAPEL $2000-3FFF OR $4000-5FFF
|
||||
BKGND1 LDA HCOLOR1
|
||||
STA (SHAPEL),Y
|
||||
JSR CSHFT2 (SHAPEL,H) WILL SPECIFY
|
||||
INY 32 SEPARATE PAGES.
|
||||
BNE BKGND1 THROUGHOUT THE INIT.
|
||||
INC SHAPEH
|
||||
LDA SHAPEH
|
||||
AND #$1F TEST FOR DONE.
|
||||
BNE BKGND1
|
||||
RTS
|
||||
|
||||
* HI-RES GRAPHICS POSITION AND PLOT SUBRS
|
||||
HPOSN STA Y0 ENTER WITH Y IN A-REG,
|
||||
STX X0L XL IN X-REG,
|
||||
STY X0H AND XH IN Y-REG.
|
||||
PHA
|
||||
AND #$C0
|
||||
STA HBASL FOR Y-COORD = 00ABCDEF.
|
||||
LSR ;CALCULATES BASE ADDRESS
|
||||
LSR ;IN HBASL, HBASH FOR
|
||||
ORA HBASL ACCESSING SCREEN MEM
|
||||
STA HBASL VIA (HBASL),Y ADDRESSING MODE
|
||||
PLA
|
||||
STA HBASH
|
||||
ASL ;CALCULATES
|
||||
ASL ;HBASH = PPPFGHCD
|
||||
ASL ;HBASL = EABAB000
|
||||
ROL HBASH
|
||||
ASL ;WHERE PPP=001 FOR $2000-3FFF
|
||||
ROL HBASH SCREEN MEM RANGE AND
|
||||
ASL ; PPP=010 FOR $4000-7FFF
|
||||
ROR HBASL (GIVEN Y-COORD=ABCDEFGH)
|
||||
LDA HBASH
|
||||
AND #$1F
|
||||
ORA HPAG
|
||||
STA HBASH
|
||||
TXA DIVIDE X0 BY 7 FOR
|
||||
CPY $#0 INDEX FROM BASE ADR
|
||||
BEQ HPOSN2 (QUOTIENT) AND BIT
|
||||
LDY #$23 WITHIN SCREEN MEM BYTE
|
||||
ADC #$4 (MASK SPEC'D BY REMAINDER)
|
||||
HPOSN1 INY
|
||||
HPOSN2 SBC #$7 SUBTRACT OUT SEVENS
|
||||
BCS HPOSN1
|
||||
STY HNDX WORKS FOR X0 FROM
|
||||
TAX 0 TO 279, LOW-ORDER
|
||||
LDA MSKTBL-249,X BYTE IN X-REG,
|
||||
STA HMASK HIGH IN Y-REG ON ENTRY
|
||||
TYA
|
||||
LSR ; IF ON ODD BYTE (CARRY SET)
|
||||
LDA HCOLOR THEN ROTATE HCOLOR ONE
|
||||
HPOSN3 STA HCOLOR1 BIT FOR 180 DEGREE SHIFT
|
||||
BCS CSHFT2 PRIOR TO COPYING TO HCOLOR1.
|
||||
RTS
|
||||
HPLOT JSR HPOSN
|
||||
HPLOT1 LDA HCOLOR1 CALC BIT POSN IN HBASL,H
|
||||
EOR (HBASL),Y HNDX, AND HMASK FROM
|
||||
AND HMASK Y-COORD IN A-REG,
|
||||
EOR (HBASL),Y X-COORD IN X,Y-REGS.
|
||||
STA (HBASL),Y FOR ANY 'L' BITS OF HMASK
|
||||
RTS SUBSTITUTE CORRESPONDING
|
||||
* BIT OF HCOLOR1.
|
||||
|
||||
* HI-RES GRAPHICS L,R,U,D SUBRS
|
||||
LFTRT BPL RIGHT USE SIGN FOR LFT/RT SELECT
|
||||
LEFT LDA HMASK
|
||||
LSR ; SHIFT LOW-ORDER
|
||||
BCS LEFT1 7 BITS OF HMASK
|
||||
EOR #$C0 ONE BIT TO LSB.
|
||||
LR1 STA HMASK
|
||||
RTS
|
||||
LEFT1 DEY DECR HORIZ INDEX.
|
||||
BPL LEFT2
|
||||
LDY #$27 WRAP AROUND SCREEN.
|
||||
LEFT2 LDA #$C0 NEW HMASK, RIGHTMOST
|
||||
NEWNDX STA HMASK DOT OF BYTE.
|
||||
STY HNDX UPDATE HORIZ INDEX.
|
||||
CSHIFT LDA HCOLOR1
|
||||
CSHFT2 ASL ; ROTATE LOW-ORDER
|
||||
CMP #$C0 7 BITS OF HCOLOR1
|
||||
BPL RTS1 ONE BIT POSN.
|
||||
LDA HCOLOR1
|
||||
EOR #$7F ZXYXYXYX -> ZYXYXYXY
|
||||
STA HCOLOR1
|
||||
RTS1 RTS
|
||||
RIGHT LDA HMASK
|
||||
ASL ; SHIFT LOW-ORDER
|
||||
EOR #$80 7 BITS OF HMASK
|
||||
BMI LR1 ONE BIT TO MSB.
|
||||
LDA #$81
|
||||
INY NEXT BYTE.
|
||||
CPY #$28
|
||||
BCC NEWNDX
|
||||
LDY #$0 WRAP AROUND SCREEN IF >279
|
||||
BCS NEWNDX ALWAYS TAKEN.
|
||||
|
||||
* L,R,U,D, SUBROUTINES.
|
||||
LRUDX1 CLC NO 90 DEG ROT (X-OR).
|
||||
LRUDX2 LDA SHAPEX
|
||||
AND #$4 IF B2=0 THEN NO PLOT.
|
||||
BEQ LRUD4
|
||||
LDA #$7F FOR EX-OR INTO SCREEN MEM
|
||||
AND HMASK
|
||||
AND (HBASL),Y SCREEN BIT SET?
|
||||
BNE LRUD3
|
||||
INC COLLSN
|
||||
LDA #$7F
|
||||
AND HMASK
|
||||
BPL LRUD3 ALWAYS TAKEN.
|
||||
LRUD1 CLC NO 90 DEG ROT.
|
||||
LRUD2 LDA SHAPEX
|
||||
AND #$4 IF B2=0 THEN NO PLOT.
|
||||
BEQ LRUD4
|
||||
LDA (HBASL),Y
|
||||
EOR HCOLOR1 SET HI-RES SCREEN BIT
|
||||
AND HMASK TO CORRESPONDING HCOLOR1
|
||||
BNE LRUD3 IF BIT OF SCREEN CHANGES
|
||||
INC COLLSN THEN INCR COLLSN DETECT
|
||||
LRUD3 EOR (HBASL),Y
|
||||
STA (HBASL),Y
|
||||
LRUD4 LDA SHAPEX ADD GDRNT TO
|
||||
ADC QDRNT SPECIFIED VECTOR
|
||||
AND #$3 AND MOVE LFT, RT,
|
||||
EQ3 EQU *-1 UP, OR DWN BASED
|
||||
CMP #$2 ON SIGN AND CARRY.
|
||||
ROR
|
||||
LRUD BCS LFTRT
|
||||
UPDWN BMI DOWN4 SIGN FOR UP/DWN SELECT
|
||||
UP CLC
|
||||
LDA HBASH CALC BASE ADDRESS
|
||||
BIT EQ1C (ADR OF LEFTMOST BYTE)
|
||||
BNE UP4 FOR NEXT LINE UP
|
||||
ASL HBASL IN (HBASL, HBASH)
|
||||
BCS UP2 WITH 192-LINE WRAPAROUND
|
||||
BIT EQ3
|
||||
BEQ UP1
|
||||
ADC #$1F **** BIT MAP ****
|
||||
SEC
|
||||
BCS UP3 FOR ROW = ABCDEFGH
|
||||
UP1 ADC #$23
|
||||
PHA
|
||||
LDA HBASL HBASL = EABAB000
|
||||
ADC #$B0 HBASH = PPPFGHCD
|
||||
BCS UP5
|
||||
ADC #$F0 WHERE PPP=001 FOR PRIMARY
|
||||
UP5 STA HBASL HI-RES PAGE ($2000-$3FFF)
|
||||
PLA
|
||||
BCS UP3
|
||||
UP2 ADC #$1F
|
||||
UP3 ROR HBASL
|
||||
UP4 ADC #$FC
|
||||
UPDWN1 STA HBASH
|
||||
RTS
|
||||
DOWN CLC
|
||||
DOWN4 LDA HBASH
|
||||
ADC #$4 CALC BASE ADR FOR NEXT LINE
|
||||
EQ4 EQU *-1 DOWN TO (HBASL,HBASH)
|
||||
BIT EQ1C
|
||||
BNE UPDWN1
|
||||
ASL HBASL WITH 192-LINE WRAPAROUND
|
||||
BCC DOWN1
|
||||
ADC #$E0
|
||||
CLC
|
||||
BIT EQ4
|
||||
BEQ DOWN2
|
||||
LDA HBASL
|
||||
ADC #$50
|
||||
EOR #$F0
|
||||
BEQ DOWN3
|
||||
EOR #$F0
|
||||
DOWN3 STA HBASL
|
||||
LDA HPAG
|
||||
BCC DOWN2
|
||||
DOWN1 ADC #$E0
|
||||
DOWN2 ROR HBASL
|
||||
BCC UPDWN1
|
||||
|
||||
* HI-RES GRAPHICS LINE DRAW SUBRS
|
||||
HLINRL PHA
|
||||
LDA #$0 SET (X0L,X0H) AND
|
||||
STA X0L Y0 TO ZERO FOR
|
||||
STA X0H REL LINE DRAW
|
||||
STA Y0 (DX, DY).
|
||||
PLA
|
||||
HLIN PHA ON ENTRY
|
||||
SEC XL: A-REG
|
||||
SBC X0L XH: X-REG
|
||||
PHA Y: Y-REG
|
||||
TXA
|
||||
SBC X0H
|
||||
STA QDRNT CALC ABS(X-X0)
|
||||
BCS HLIN2 IN (DXL,DXH)
|
||||
PLA
|
||||
EOR #$FF X DIR TO SIGN BIT
|
||||
ADC #$1 OF QDRNT.
|
||||
PHA 0=RIGHT (DX POS)
|
||||
LDA #$0 1=LEFT (DX NEG)
|
||||
SBC QDRNT
|
||||
HLIN2 STA SHAPEX
|
||||
STA EH INIT (EL,EH) TO
|
||||
PLA ABS(X-X0)
|
||||
STA DXL
|
||||
STA EL
|
||||
PLA
|
||||
STA X0L
|
||||
STX X0H
|
||||
TYA
|
||||
CLC
|
||||
SBC Y0 CALC -ABS(Y-0)-1
|
||||
BCC HLIN3 IN DY.
|
||||
EOR #$FF
|
||||
ADC #$FE
|
||||
HLIN3 STA DY ROTATE Y DIR INTO
|
||||
STY Y0 QDRNT SIGN BIT
|
||||
ROR QDRNT (0=UP, 1=DOWN)
|
||||
SEC
|
||||
SBC DXL INIT (COUNTL, COUNTH).
|
||||
TAX TO -(DELTX+DELTY+1)
|
||||
LDA #$FF
|
||||
SBC DXH
|
||||
STA COUNTH
|
||||
LDY HNDX HORIZ INDEX
|
||||
BCS MOVEX2 ALWAYS TAKEN.
|
||||
MOVEX ASL ; MOVE IN X-DIR. USE
|
||||
JSR LFTRT GDRNT B6 FOR LFT/RT SELECT
|
||||
SEC
|
||||
MOVEX2 LDA EL ASSUME CARRY SET.
|
||||
ADC DY (EL,EH)-DELTY TO (EL,EH)
|
||||
STA EL NOTE: DY IS (-DELTY)-1
|
||||
LDA EH CARRY CLR IF (EL,EH)
|
||||
SBC #$0 GOES NEG.
|
||||
HCOUNT STA EH
|
||||
LDA (HBASL),Y SCREEN BYTE.
|
||||
EOR HCOLOR1 PLOT DOT OF HCOLOR1.
|
||||
AND HMASK CURRENT BIT MASK.
|
||||
EOR (HBASL),Y
|
||||
STA (HBASL),Y
|
||||
INX DONE (DELTX+DELTY)
|
||||
BNE HLIN4 DOTS?
|
||||
INC COUNTH
|
||||
BEQ RTS2 YES, RETURN.
|
||||
HLIN4 LDA QDRNT FOR DIRECTION TEST
|
||||
BCS MOVEX IF CAR SET, (EL, EH) POS
|
||||
JSR UPDWN IF CLR, NEG, MOVE YDIR
|
||||
CLC
|
||||
LDA EL (EL,EH)+DELTX
|
||||
ADC DXL TO (EL,EH).
|
||||
STA EL
|
||||
LDA EH CAR SET IF (EL,EH) GOES POS
|
||||
ADC DXH
|
||||
BVC HCOUNT ALWAYS TAKEN
|
||||
MSKTBL HEX 81 LEFTMOST BIT OF BYTE.
|
||||
HEX 82,84,88
|
||||
HEX 90,A0
|
||||
HEX C0 RIGHTMOST BIT OF BYTE.
|
||||
EQ1C HEX 1C
|
||||
COS HEX FF,FE,FA,F4,EC,E1,D4,C5,B4
|
||||
HEX A1,8D,78,61,49,31,18,FF
|
||||
|
||||
* HI-RES GRAPHICS COORDINATE RESTORE SUBR
|
||||
HFIND LDA HBASL
|
||||
ASL ; CONVERTS BASE ADR
|
||||
LDA HBASH TO Y-COORD
|
||||
AND #$3
|
||||
ROL ; FOR HBASL = EABAB000
|
||||
ORA HBASL HBASH = PPPFGHCD
|
||||
ASL
|
||||
ASL ; GENERATE
|
||||
ASL ; Y-COORD = ABCDEFGH
|
||||
STA Y0
|
||||
LDA HBASH (PPP=SCREEN PAGE,
|
||||
LSR ; NORMALLY 001 FOR
|
||||
LSR ; $2000-$3FFF
|
||||
AND #$7 HI-RES SCREEN)
|
||||
ORA Y0
|
||||
STA Y0 CONVERTS HNDX (INDEX
|
||||
LDA HNDX FROM BASE ADR)
|
||||
ASL ; AND HMASK (BIT
|
||||
ADC HNDX MASK) TO X-COORD
|
||||
ASL ; IN (X0L, X0H)
|
||||
TAX (RANGE $0-$133)
|
||||
DEX
|
||||
LDA HMASK
|
||||
AND #$7F
|
||||
HFIND1 INX
|
||||
LSR
|
||||
BNE HFIND1
|
||||
STA X0H
|
||||
TXA
|
||||
CLC CALC HNDX*7+
|
||||
ADC HNDX LOG (BASE 2) HMASK.
|
||||
BCC HFIND2
|
||||
INC X0H
|
||||
HFIND2 STA X0L
|
||||
RTS2 RTS
|
||||
|
||||
* HI-RES GRAPHICS SHAPE DRAW SUBR
|
||||
*
|
||||
* SHAPE DRAW
|
||||
* R = 0 TO 63
|
||||
* SCALE FACTOR USED (1=NORMAL)
|
||||
*
|
||||
DRAW STX SHAPEL DRAW DEFINITION
|
||||
STY SHAPEH POINTER
|
||||
DRAW1 TAX
|
||||
LSR ; ROT ($0=$3F)
|
||||
LSR
|
||||
LSR ; GRDNT 0=UP, 1=RT,
|
||||
LSR ; 2=DWN, 3=LFT.
|
||||
STA QDRNT
|
||||
TXA
|
||||
AND #$F
|
||||
TAX
|
||||
LDY COS,X SAVE COS AND SIN
|
||||
STY DXL VALS IN DXL AND DY.
|
||||
EOR #$F
|
||||
TAX
|
||||
LDY COS+1,X
|
||||
INY
|
||||
STY DY
|
||||
DRAW2 LDY HNDX BYTE INDEX FROM
|
||||
LDX #$0 HI-RES BASE ADR.
|
||||
STX COLLSN CLEAR COLLISION COUNT.
|
||||
LDA (SHAPEL,X) 1ST SHAPE DEF BYTE.
|
||||
DRAW3 STA SHAPEX
|
||||
LDX #$80
|
||||
STX EL EL,EH FOR FRACTIONAL
|
||||
STX EH L,R,U,D VECTORS.
|
||||
LDX SCALE SCALE FACTOR.
|
||||
DRAW4 LDA EL
|
||||
SEC IF FRAC COS OVFL
|
||||
ADC DXL THEN MOVE IN
|
||||
STA EL SPECIFIED VECTOR
|
||||
BCC DRAW5 DIRECTION.
|
||||
JSR LRUD1
|
||||
CLC
|
||||
DRAW5 LDA EH IF FRAC SIN OVFL
|
||||
ADC DY THEN MOVE IN
|
||||
STA EH SPECIFIED VECTOR
|
||||
BCC DRAW6 DIRECTION
|
||||
JSR LRUD2
|
||||
DRAW6 DEX LOOP ON SCALE
|
||||
BNE DRAW4 FACTOR.
|
||||
LDA SHAPEX
|
||||
LSR ; NEXT 3-BIT VECTOR
|
||||
LSR ; OF SHAPE DEF.
|
||||
LSR
|
||||
BNE DRAW3 NOT DONE THIS BYTE.
|
||||
INC SHAPEL
|
||||
BNE DRAW7 NEXT BYTE OF
|
||||
INC SHAPEH SHAPE DEFINITION.
|
||||
DRAW7 LDA (SHAPEL,X)
|
||||
BNE DRAW3 DONE IF ZERO.
|
||||
RTS
|
||||
|
||||
* HI-RES GRAPHICS SHAPE EX-OR SUBR
|
||||
*
|
||||
* EX-OR SHAPE INTO SCREEN.
|
||||
*
|
||||
* ROT = 0 TO 3 (QUADRANT ONLY)
|
||||
* SCALE IS USED
|
||||
*
|
||||
XDRAW STX SHAPEL SHAPE DEFINITION
|
||||
STY SHAPEH POINTER.
|
||||
XDRAW1 TAX
|
||||
LSR ; ROT ($0-$3F)
|
||||
LSR
|
||||
LSR ; GDRNT 0=UP, 1=RT,
|
||||
LSR ; 2=DWN, 3=LFT.
|
||||
STA QDRNT
|
||||
TXA
|
||||
AND #$F
|
||||
TAX
|
||||
LDY COS,X SAVE COS AND SIN
|
||||
STY DXL VALS IN DXL AND DY,
|
||||
EOR #$F
|
||||
TAX
|
||||
LDY COS+1,X
|
||||
INY
|
||||
STY DY
|
||||
XDRAW2 LDY HNDX INDEX FROM HI-RES
|
||||
LDX #$0 BASE ADR.
|
||||
STX COLLSN CLEAR COLLISION DETECT
|
||||
LDA (SHAPEL,X) 1ST SHAPE DEF BYTE.
|
||||
XDRAW3 STA SHAPEX
|
||||
LDX #$80
|
||||
STX EL EL,EH FOR FRACTIONAL
|
||||
STX EH L,R,U,D, VECTORS.
|
||||
LDX SCALE SCALE FACTOR.
|
||||
XDRAW4 LDA EL
|
||||
SEC IF FRAC COS OVFL
|
||||
ADC DXL THEN MOVE IN
|
||||
STA EL SPECIFIED VECTOR
|
||||
BCC XDRAW5 DIRECTION
|
||||
JSR LRUDX1
|
||||
CLC
|
||||
XDRAW5 LDA EH IF FRAC SIN OVFL
|
||||
ADC DY THEN MOVE IN
|
||||
STA EH SPECIFIED VECTOR
|
||||
BCC XDRAW6 DIRECTION +90 DEG.
|
||||
JSR LRUD2
|
||||
XDRAW6 DEX LOOP ON SCALE
|
||||
BNE XDRAW4 FACTOR.
|
||||
LDA SHAPEX
|
||||
LSR ; NEXT 3-BIT VECTOR
|
||||
LSR ; OF SHAPE DEF.
|
||||
LSR
|
||||
BNE XDRAW3
|
||||
INC SHAPEL
|
||||
BNE XDRAW7 NEXT BYTE OF
|
||||
INC SHAPEH SHAPE DEF.
|
||||
XDRAW7 LDA (SHAPEL,X)
|
||||
BNE XDRAW3 DONE IF ZERO.
|
||||
RTS
|
||||
|
||||
* ENTRY POINTS FROM APPLE-II BASIC
|
||||
BPOSN JSR PCOLR POSN CALL, COLR FROM BASIC
|
||||
STA HCOLOR
|
||||
JSR GETY0 Y0 FROM BASIC.
|
||||
PHA
|
||||
JSR GETX0 X0 FROM BASIC.
|
||||
PLA
|
||||
JSR HPOSN
|
||||
LDX BXSAV
|
||||
RTS
|
||||
BPLOT JSR BPOSN PLOT CALL (BASIC).
|
||||
JMP HPLOT1
|
||||
BXDRW1 LDA HNDX
|
||||
LSR ; SET HCOLOR1 FROM
|
||||
JSR PCOLR BASIC VAR COLR.
|
||||
JSR HPOSN3
|
||||
BLINE JSR GETX0 LINE CALL, GET X0 FROM BASIC
|
||||
TXA
|
||||
PHA
|
||||
TYA
|
||||
TAX
|
||||
JSR GETY0 Y0 FROM BASIC
|
||||
TAY
|
||||
PLA
|
||||
JSR HLIN
|
||||
LDX BXSAV
|
||||
RTS
|
||||
BGND JSR PCOLR BACKGROUND CALL
|
||||
JMP BKGND0
|
||||
|
||||
* DRAW ROUTINES
|
||||
BDRAW1 JSR BPOSN
|
||||
BDRAW JSR BDRAWX DRAW CALL FROM BASIC.
|
||||
JSR DRAW
|
||||
LDX BXSAV
|
||||
RTS
|
||||
BXDRW1 JSR BPOSN
|
||||
BXDRAW JSR BDRAWX EX-OR DRAW
|
||||
JSR XDRAW FROM BASIC.
|
||||
LDX BXSAV
|
||||
RTS
|
||||
BDRAWX STX BXSAV SAVE FOR BASIC.
|
||||
LDY #$32
|
||||
JSR PBYTE SCALE FROM BASIC.
|
||||
STA SCALE
|
||||
LDY #$28
|
||||
JSR PBYTE ROT FROM BASIC.
|
||||
PHA SAVE ON STACK.
|
||||
LDA SHAPXL
|
||||
STA SHAPEL START OF
|
||||
LDA SHAPXH SHAPE TABLE.
|
||||
STA SHAPEH
|
||||
LDY #$20
|
||||
JSR PBYTE SHAPE FROM BASIC.
|
||||
BEQ RERR1
|
||||
LDX #$0
|
||||
CMP (SHAPEL,X) > NUM OF SHAPES?
|
||||
BEQ BDRWX1
|
||||
BCS RERR1 YES, RANGE ERR.
|
||||
BDRWX1 ASL
|
||||
BCC BDRWX2
|
||||
INC SHAPEH
|
||||
CLC
|
||||
TAY SHAPE NO. * 2.
|
||||
LDA (SHAPEL),Y
|
||||
ADC SHAPEL
|
||||
TAX ADD 2-BYTE INDEX
|
||||
INY TO SHAPE TABLE
|
||||
LDA (SHAPEL),Y START ADR
|
||||
ADC SHAPXH (X LOW, Y HI).
|
||||
TAY
|
||||
PLA ROT FROM STACK.
|
||||
RTS
|
||||
|
||||
* BASIC PARAM FETCH SUBR'S
|
||||
PCOLR LDY #$16
|
||||
PBYTE LDA (LOMEML),Y
|
||||
BNE RERR1 GET BASIC PARAM.
|
||||
DEY (ERR IF >255)
|
||||
LDA (LOMEML),Y
|
||||
RTSB RTS
|
||||
GETX0 STX BXSAV SAVE FOR BASIC.
|
||||
LDY #$5
|
||||
LDA (LOMEML),Y X0 LOW-ORDER BYTE.
|
||||
TAX
|
||||
INY
|
||||
LDA (LOMEML),Y HI-ORDER BYTE.
|
||||
TAY
|
||||
CPX #$18
|
||||
SBC #$1 RANGE ERR IF >279
|
||||
BCC RTSB
|
||||
RERR1 JMP RNGERR
|
||||
GETY0 LDY #$D OFFSET TO Y0 FROM LOMEM
|
||||
JSR PBYTE GET BASIC PARAM Y0.
|
||||
CMP #$C0 (ERR IF >191)
|
||||
BCS RERR1
|
||||
RTS
|
||||
|
||||
* SHAPE TAPE LOAD SUBROUTINE
|
||||
SHLOAD STX BXSAV SAVE FOR BASIC.
|
||||
JSR ACADR READ 2-BYTE LENGTH INTO
|
||||
JSR READ BASIC ACC
|
||||
LDA #$00 ;START OF SHAPE TABLE IS $0800
|
||||
STA A1L
|
||||
STA SHAPXL
|
||||
CLC
|
||||
ADC ACL
|
||||
TAY
|
||||
LDA #$08 ;HIGH BYTE OF SHAPE TABLE POINTER.
|
||||
STA A1H
|
||||
STA SHAPXH
|
||||
ADC ACH
|
||||
BCS MFULL1 NOT ENOUGH MEMORY.
|
||||
CPY PPL
|
||||
PHA
|
||||
SBC PPH
|
||||
PLA
|
||||
BCS MFULL1
|
||||
STY A2L
|
||||
STA A2H
|
||||
INY
|
||||
BNE SHLOD1
|
||||
ADC #$1
|
||||
SHLOD1 STY LOMEML
|
||||
STA MOMEMH
|
||||
STY PVL
|
||||
STA PVH
|
||||
JSR RD2BIT
|
||||
LDA #$3 .5 SECOND HEADER.
|
||||
JSR READX1
|
||||
LDX BXSAV
|
||||
RTS
|
||||
MFULL1 JMP MEMFUL
|
145
source/progaid/hires.tbl
Normal file
145
source/progaid/hires.tbl
Normal file
@ -0,0 +1,145 @@
|
||||
* HI-RES EQUATES (DIRECTLY FROM LISTING)
|
||||
|
||||
SHAPEL EQU $1A POINTER TO
|
||||
SHAPEH EQU $1B SHAPE LIST
|
||||
HCOLOR1 EQU $1C RUNNING COLOR MASK
|
||||
COUNTH EQU $1D
|
||||
HBASL EQU $26 BASE ADR FOR CURRENT
|
||||
HBASH EQU $27 HI-RES PLOT LINE. A
|
||||
HMASK EQU $30
|
||||
A1L EQU $3C MONITOR A1.
|
||||
A1H EQU $3D
|
||||
A2L EQU $3E MONITOR A2.
|
||||
A2H EQU $3F
|
||||
LOMEML EQU $4A BASIC 'START OF VARS'.
|
||||
MOMEMH EQU $4B
|
||||
DXL EQU $50 DELTA-X FOR HLIN, SHAPE.
|
||||
DXH EQU $51
|
||||
SHAPEX EQU $51 SHAPE TEMP.
|
||||
DY EQU $52 DELTA-Y FOR HLIN, SHAPE.
|
||||
QDRNT EQU $53 ROT QUADRANT (SHAPE).
|
||||
EL EQU $54 ERROR FOR HLIN.
|
||||
EH EQU $55
|
||||
PPL EQU $CA BASIC START OF PROG PTR.
|
||||
PPH EQU $CB
|
||||
PVL EQU $CC BASIC END OF VARS PTR.
|
||||
PVH EQU $CD
|
||||
ACL EQU $CE BASIC ACC.
|
||||
ACH EQU $CF
|
||||
X0L EQU $320 PRIOR X-COORD SAVE
|
||||
X0H EQU $321 AFTER HLIN OR HPLOT.
|
||||
Y0 EQU $322 HLIN, HPLOT Y-COORD SAVE.
|
||||
BXSAV EQU $323 X-REG SAVE FOR BASIC.
|
||||
HCOLOR EQU $324 COLOR FOR HPLOT, HPOSN
|
||||
HNDX EQU $325 HORIZ OFFSET SAVE.
|
||||
HPAG EQU $326 HI-RES PAGE ($20 NORMAL)
|
||||
SCALE EQU $327 SCALE FOR SHAPE, MOVE.
|
||||
SHAPXL EQU $328 START OF
|
||||
SHAPXH EQU $329 SHAPE TABLE.
|
||||
COLLSN EQU $32A COLLISION COUNT.
|
||||
HIRES EQU $C057 SWITCH TO HI-RES VIDEO
|
||||
MIXSET EQU $C053 SELECT TEXT/GRAPHICS MIX
|
||||
TXTCLR EQU $C050 SELECT GRAPHICS MODE.
|
||||
MEMFUL EQU $E36B BASIC MEM FULL ERROR.
|
||||
RNGERR EQU $EE68 BASIC RANGE ERROR.
|
||||
ACADR EQU $F11E 2-BYTE TAPE READ SETUP.
|
||||
RD2BIT EQU $FCFA TWO-EDGE TAPE SENSE.
|
||||
READ EQU $FEFD TAPE READ (A1.A2).
|
||||
READX1 EQU $FF02 READ WITHOUT HEADER.
|
||||
|
||||
* LABELS
|
||||
|
||||
SETHRL = $D000
|
||||
HCLR = $D00E
|
||||
BKGND0 = $D010
|
||||
BKGND = $D012
|
||||
BKGND1 = $D01B
|
||||
HPOSN = $D02E
|
||||
HPOSN1 = $D062
|
||||
HPOSN2 = $D063
|
||||
HPOSN3 = $D075
|
||||
HPLOT = $D07A
|
||||
HPLOT1 = $D07D
|
||||
LFTRT = $D088
|
||||
LEFT = $D08A
|
||||
LR1 = $D091
|
||||
LEFT1 = $D094
|
||||
LEFT2 = $D099
|
||||
NEWNDX = $D09B
|
||||
CSHIFT = $D0A0
|
||||
CSHFT2 = $D0A2
|
||||
RTS1 = $D0AD
|
||||
RIGHT = $D0AE
|
||||
LRUDX1 = $D0C0
|
||||
LRUDX2 = $D0C1
|
||||
LRUD1 = $D0D8
|
||||
LRUD2 = $D0D9
|
||||
LRUD3 = $D0EA
|
||||
LRUD4 = $D0EE
|
||||
LRUD = $D0F7
|
||||
UPDWN = $D0F9
|
||||
UP = $D0FB
|
||||
UP1 = $D111
|
||||
UP5 = $D11C
|
||||
UP2 = $D121
|
||||
UP3 = $D123
|
||||
UP4 = $D125
|
||||
UPDWN1 = $D127
|
||||
DOWN = $D12A
|
||||
DOWN4 = $D12B
|
||||
DOWN3 = $D14A
|
||||
DOWN1 = $D151
|
||||
DOWN2 = $D153
|
||||
HLINRL = $D157
|
||||
HLIN = $D164
|
||||
HLIN2 = $D17C
|
||||
HLIN3 = $D197
|
||||
MOVEX = $D1AD
|
||||
MOVEX2 = $D1B2
|
||||
HCOUNT = $D1BC
|
||||
HLIN4 = $D1CF
|
||||
MSKTBL = $D1E3
|
||||
EQ1C = $D1EA
|
||||
COS = $D1EB
|
||||
HFIND = $D1FC
|
||||
HFIND1 = $D226
|
||||
HFIND2 = $D237
|
||||
RTS2 = $D23A
|
||||
DRAW = $D23B
|
||||
DRAW1 = $D23F
|
||||
DRAW2 = $D258
|
||||
DRAW3 = $D262
|
||||
DRAW4 = $D26D
|
||||
DRAW5 = $D27A
|
||||
DRAW6 = $D285
|
||||
DRAW7 = $D295
|
||||
XDRAW = $D29A
|
||||
XDRAW1 = $D29E
|
||||
XDRAW2 = $D2B7
|
||||
XDRAW3 = $D2C1
|
||||
XDRAW4 = $D2CC
|
||||
XDRAW5 = $D2D9
|
||||
XDRAW6 = $D2E4
|
||||
XDRAW7 = $D2F4
|
||||
BPOSN = $D2F9
|
||||
BPLOT = $D30E
|
||||
BLIN1 = $D314
|
||||
BXDRW1 = $D314
|
||||
BLINE = $D31E
|
||||
BGND = $D331
|
||||
BDRAW1 = $D337
|
||||
BDRAW = $D33A
|
||||
bxdrw1 = $D344
|
||||
BXDRAW = $D347
|
||||
BDRAWX = $D351
|
||||
BDRWX1 = $D37B
|
||||
BDRWX2 = $D381
|
||||
PCOLR = $D390
|
||||
PBYTE = $D392
|
||||
RTSB = $D399
|
||||
GETX0 = $D39A
|
||||
RERR1 = $D3AC
|
||||
GETY0 = $D3AF
|
||||
SHLOAD = $D3B9
|
||||
SHLOD1 = $D3E9
|
||||
MFULL1 = $D3FD
|
46
source/progaid/info.org
Normal file
46
source/progaid/info.org
Normal file
@ -0,0 +1,46 @@
|
||||
* Integer basic ROM D0 and D8 contents:
|
||||
|
||||
Information on contents of INTBASIC file, version changes, etc:
|
||||
http://apple2history.org/history/ah15/
|
||||
|
||||
Information on programmer's aid, and INTBASIC file, including the fact
|
||||
that the D8 area was filled (uselessly) with the D8 part of the
|
||||
FPBASIC file: http://apple2history.org/history/ah03/
|
||||
|
||||
Bitmap scan PDF:
|
||||
ftp://ftp.apple.asimov.net/pub/apple_II/documentation/programming/6502assembly/Apple%20II%20Programmer's%20Aid%201_alt.pdf
|
||||
OCR'd (badly) PDF:
|
||||
http://www.classiccmp.org/cini/pdf/Apple/Apple%20Programmers%20Aid%20Book.pdf
|
||||
|
||||
* Layout
|
||||
|
||||
| hires | High-Resolution Graphics | $D000-$D3FF | Gap from $D340-D38F? |
|
||||
| renumapp | Renumber | $D400-$D4BB | |
|
||||
| | Append | $D4BC-$D4D4 | |
|
||||
| | | $D4D5-$D4DB | |
|
||||
| relocate | Relocate | $D4DC-$D52D | |
|
||||
| | | $D52E-$D534 | |
|
||||
| verify | Tape Verify (BASIC) | $D535-$D553 | |
|
||||
| | Tape Verify (6502 Code & Data) | $D554-$D5AA | |
|
||||
| | | $D5AB-$D5BB | |
|
||||
| ramtest | RAM Test | $D5BC-$D691 | |
|
||||
| | | $D692-$D716 | |
|
||||
| music | Music | $D717-$D7F8 | |
|
||||
|
||||
** script generator
|
||||
|
||||
parts = [
|
||||
('hires', 0xD000, 0xD3FF),
|
||||
('renumapp', 0xD400, 0xD4D4),
|
||||
('relocate', 0xD4DC, 0xD52D),
|
||||
('verify', 0xD535, 0xD5AA),
|
||||
('ramtest', 0xD5BC, 0xD691),
|
||||
('music', 0xD717, 0xD7F8),
|
||||
]
|
||||
|
||||
for name, start, end in parts:
|
||||
tail = 0x10000 - start
|
||||
length = end - start + 1
|
||||
print 'tail -c %d ../../apple2.orig.rom | head -c %d > %s.rom' % (tail, length, name)
|
||||
|
||||
|
99
source/progaid/music.asm
Normal file
99
source/progaid/music.asm
Normal file
@ -0,0 +1,99 @@
|
||||
|
||||
|
||||
********************************
|
||||
*
|
||||
* MUSIC SUBROUTINE
|
||||
*
|
||||
* GARY J. SHANNON
|
||||
*
|
||||
********************************
|
||||
ORG $D717
|
||||
*
|
||||
* ZERO PAGE WORK AREAS
|
||||
* PARAMETER PASSING AREAS
|
||||
*
|
||||
DOWNTIME EQU $0
|
||||
UPTIME EQU $1
|
||||
LENGTH EQU $2
|
||||
VOICE EQU $2FD
|
||||
LONG EQU $2FE
|
||||
NOTE EQU $2FF
|
||||
SPEAKER EQU $C030
|
||||
ENTRY JMP LOOKUP
|
||||
|
||||
PLAY LDY UPTIME
|
||||
LDA SPEAKER
|
||||
PLAY2 INC LENGTH
|
||||
BNE PATH1
|
||||
INC LENGTH+1
|
||||
BNE PATH2
|
||||
RTS
|
||||
PATH1 NOP
|
||||
JMP PATH2
|
||||
PATH2 DEY
|
||||
BEQ DOWN
|
||||
JMP PATH3
|
||||
PATH3 BNE PLAY2
|
||||
DOWN LDY DOWNTIME
|
||||
LDA SPEAKER
|
||||
PLAY3 INC LENGTH
|
||||
BNE PATH4
|
||||
INC LENGTH+1
|
||||
BNE PATH5
|
||||
RTS
|
||||
PATH4 NOP
|
||||
JMP PATH5
|
||||
PATH5 DEY
|
||||
BEQ PLAY
|
||||
JMP PATH6
|
||||
PATH6 BNE PLAY3
|
||||
LOOKUP LDA NOTE
|
||||
ASL
|
||||
TAY
|
||||
LDA NOTES,Y
|
||||
STA DOWNTIME
|
||||
LDA VOICE
|
||||
SHIFT LSR
|
||||
BEQ DONE
|
||||
LSR DOWNTIME
|
||||
BNE SHIFT
|
||||
DONE LDA NOTES,Y
|
||||
SEC
|
||||
SBC DOWNTIME
|
||||
STA UPTIME
|
||||
INY
|
||||
LDA NOTES,Y
|
||||
ADC DOWNTIME
|
||||
STA DOWNTIME
|
||||
LDA #$0
|
||||
SEC
|
||||
SBC LONG
|
||||
STA LENGTH+1
|
||||
LDA #$0
|
||||
STA LENGTH
|
||||
LDA UPTIME
|
||||
BNE PLAY
|
||||
REST NOP
|
||||
NOP
|
||||
JMP REST2
|
||||
REST2 INC LENGTH
|
||||
BNE REST3
|
||||
INC LENGTH+1
|
||||
BNE REST4
|
||||
RTS
|
||||
REST3 NOP
|
||||
JMP REST4
|
||||
REST4 BNE REST
|
||||
NOTES HEX 00,00,F6,F6,E8,E8,DB,DB
|
||||
HEX CF,CF,C3,C3,B8,B8,AE,AE
|
||||
HEX A4,A4,9B,9B,92,92,8A,8A
|
||||
HEX 82,82,7B,7B,74,74,6D,6E
|
||||
HEX 67,68,61,62,5C,5C,57,57
|
||||
HEX 52,52,4D,4E,49,49,45,45
|
||||
HEX 41,41,3D,3E,3A,3A,36,37
|
||||
HEX 33,34,30,31,2E,2E,2B,2C
|
||||
HEX 29,29,26,27,24,25,22,23
|
||||
HEX 20,21,1E,1F,1D,1D,1B,1C
|
||||
HEX 1A,1A,18,19,17,17,15,16
|
||||
HEX 14,15,13,14,12,12,11,11
|
||||
HEX 10,10,0F,10,0E,0F
|
31
source/progaid/music.tbl
Normal file
31
source/progaid/music.tbl
Normal file
@ -0,0 +1,31 @@
|
||||
* EQUATES
|
||||
|
||||
DOWNTIME EQU $0
|
||||
UPTIME EQU $1
|
||||
LENGTH EQU $2
|
||||
VOICE EQU $2FD
|
||||
LONG EQU $2FE
|
||||
NOTE EQU $2FF
|
||||
SPEAKER EQU $C030
|
||||
|
||||
* LABELS
|
||||
|
||||
ENTRY = $D717
|
||||
PLAY = $D71A
|
||||
PLAY2 = $D71F
|
||||
PATH1 = $D728
|
||||
PATH2 = $D72C
|
||||
PATH3 = $D732
|
||||
DOWN = $D734
|
||||
PLAY3 = $D739
|
||||
PATH4 = $D742
|
||||
PATH5 = $D746
|
||||
PATH6 = $D74C
|
||||
LOOKUP = $D74E
|
||||
SHIFT = $D75B
|
||||
DONE = $D762
|
||||
REST = $D782
|
||||
REST2 = $D787
|
||||
REST3 = $D790
|
||||
REST4 = $D794
|
||||
NOTES = $D796
|
142
source/progaid/ramtest.asm
Normal file
142
source/progaid/ramtest.asm
Normal file
@ -0,0 +1,142 @@
|
||||
***************************
|
||||
* *
|
||||
* RAMTEST: *
|
||||
* *
|
||||
* BY WOZ *
|
||||
* 6/77 *
|
||||
* *
|
||||
* COPYRIGHT 1987 BY: *
|
||||
* APPLE COMPUTER INC *
|
||||
* *
|
||||
***************************
|
||||
|
||||
*
|
||||
* EQUATES
|
||||
*
|
||||
DATA EQU $0 TEST DATA $00 OR $FF
|
||||
NDATA EQU $1 INVERSE TEST DATA.
|
||||
TESTD EQU $2 GALLOP DATA.
|
||||
R3L EQU $6 AUX ADR POINTER.
|
||||
R3H EQU $7
|
||||
R4L EQU $8 AUX ADR POINTER.
|
||||
R4H EQU $9
|
||||
R5L EQU $A AUX ADR POINTER.
|
||||
R5H EQU $B
|
||||
R6L EQU $C GALLOP BIT MASK.
|
||||
R6H EQU $D ($0001 TO 2^N)
|
||||
YSAV EQU $34 MONITOR SCAN INDEX.
|
||||
A1H EQU $3D BEGIN TEST BLOCK ADR.
|
||||
A2L EQU $3E LEN (PAGES) FROM MON.
|
||||
SETCTLY EQU $D5B0 ;SET UP CNTRL-Y LOCATION
|
||||
PRBYTE EQU $FDDA BYTE PRINT SUBR.
|
||||
COUT EQU $FDED CHAR OUT SUBR.
|
||||
PRERR EQU $FF2D PRINTS 'ERR-BELL'
|
||||
BELL EQU $FF3A
|
||||
|
||||
*
|
||||
* RAMTEST:
|
||||
*
|
||||
ORG $D5BC
|
||||
OBJ $A5BC
|
||||
SETUP LDA #$C3
|
||||
LDY #$D5
|
||||
JMP SETCTLY
|
||||
RAMTST LDA #$0
|
||||
JSR TEST
|
||||
LDA #$FF
|
||||
JSR TEST
|
||||
JMP BELL
|
||||
TEST STA DATA
|
||||
EOR #$FF
|
||||
STA NDATA
|
||||
LDA A1H
|
||||
STA R3H
|
||||
STA R4H
|
||||
STA R5H
|
||||
LDY #$0
|
||||
STY R3L
|
||||
STY R4L
|
||||
STY R5L
|
||||
LDX A2L
|
||||
LDA DATA
|
||||
TEST01 STA (R4L),Y
|
||||
INY
|
||||
BNE TEST01
|
||||
INC R4H
|
||||
DEX
|
||||
BNE TEST01
|
||||
LDX A2L
|
||||
TEST02 LDA (R3L),Y
|
||||
CMP DATA
|
||||
BEQ TEST03
|
||||
PHA
|
||||
LDA R3H
|
||||
JSR PRBYTE
|
||||
TYA
|
||||
JSR PRBYSP
|
||||
LDA DATA
|
||||
JSR PRBYSP
|
||||
PLA
|
||||
JSR $D692 !!! Diverges - PRBYCR in listing. d692 is right after listing
|
||||
TEST03 INY
|
||||
BNE TEST02
|
||||
INC R3H
|
||||
DEX
|
||||
BNE TEST02
|
||||
LDX A2L
|
||||
TEST04 LDA NDATA
|
||||
STA (R5L),Y
|
||||
STY R6H
|
||||
STY R6L
|
||||
INC R6L
|
||||
TEST05 LDA NDATA
|
||||
JSR TEST6
|
||||
LDA DATA
|
||||
JSR TEST6
|
||||
ASL R6L
|
||||
ROL R6H
|
||||
LDA R6H
|
||||
CMP A2L
|
||||
BCC TEST05
|
||||
LDA DATA
|
||||
STA (R5L),Y
|
||||
INC R5L
|
||||
BNE TEST04
|
||||
INC R5H
|
||||
DEX
|
||||
BNE TEST04
|
||||
RTS1 RTS
|
||||
TEST6 STA TESTD
|
||||
LDA R5L
|
||||
EOR R6L
|
||||
STA R4L
|
||||
LDA R5H
|
||||
EOR R6H
|
||||
STA R4H
|
||||
LDA TESTD
|
||||
STA (R4L),Y
|
||||
LDA (R5L),Y
|
||||
CMP NDATA
|
||||
BEQ RTS1
|
||||
PHA
|
||||
LDA R5H
|
||||
JSR PRBYTE
|
||||
LDA R5L
|
||||
JSR PRBYSP
|
||||
LDA NDATA
|
||||
STA (R5L),Y
|
||||
JSR PRBYSP
|
||||
PLA
|
||||
JMP $02CB --- diverges. JSR PRBYSP in listing
|
||||
LDA R4H
|
||||
JSR PRBYTE
|
||||
LDA R4L
|
||||
JSR PRBYSP
|
||||
LDA TESTD
|
||||
PRBYCR JSR PRBYSP
|
||||
JSR PRERR
|
||||
LDA #$8D
|
||||
JMP COUT
|
||||
PRBYSP JSR PRBYTE
|
||||
LDA #$A0
|
||||
JMP COUT
|
34
source/progaid/ramtest.tbl
Normal file
34
source/progaid/ramtest.tbl
Normal file
@ -0,0 +1,34 @@
|
||||
* EQUATES
|
||||
DATA EQU $0 TEST DATA $00 OR $FF
|
||||
NDATA EQU $1 INVERSE TEST DATA.
|
||||
TESTD EQU $2 GALLOP DATA.
|
||||
R3L EQU $6 AUX ADR POINTER.
|
||||
R3H EQU $7
|
||||
R4L EQU $8 AUX ADR POINTER.
|
||||
R4H EQU $9
|
||||
R5L EQU $A AUX ADR POINTER.
|
||||
R5H EQU $B
|
||||
R6L EQU $C GALLOP BIT MASK.
|
||||
R6H EQU $D ($0001 TO 2^N)
|
||||
YSAV EQU $34 MONITOR SCAN INDEX.
|
||||
A1H EQU $3D BEGIN TEST BLOCK ADR.
|
||||
A2L EQU $3E LEN (PAGES) FROM MON.
|
||||
SETCTLY EQU $D5B0 ;SET UP CNTRL-Y LOCATION
|
||||
PRBYTE EQU $FDDA BYTE PRINT SUBR.
|
||||
COUT EQU $FDED CHAR OUT SUBR.
|
||||
PRERR EQU $FF2D PRINTS 'ERR-BELL'
|
||||
BELL EQU $FF3A
|
||||
|
||||
* LABELS
|
||||
SETUP = $D5BC
|
||||
RAMTST = $D5C3
|
||||
TEST = $D5D0
|
||||
TEST01 = $D5EA
|
||||
TEST02 = $D5F6
|
||||
TEST03 = $D60F
|
||||
TEST04 = $D619
|
||||
TEST05 = $D623
|
||||
RTS1 = $D644
|
||||
TEST6 = $D645
|
||||
PRBYCR = $D67F
|
||||
PRBYSP = $D68A
|
92
source/progaid/relocate.asm
Normal file
92
source/progaid/relocate.asm
Normal file
@ -0,0 +1,92 @@
|
||||
****************************
|
||||
* *
|
||||
* 6502 RELOCATION *
|
||||
* SUBROUTINE *
|
||||
* *
|
||||
* 1. DEFINE BLOCKS *
|
||||
* *A4<A1.A2 ^Y *
|
||||
* (^Y IS CTRL-Y) *
|
||||
* *
|
||||
* 2. FIRST SEGMENT *
|
||||
* *A4<A1.A2 ^Y *
|
||||
* (IF CODE) *
|
||||
* *
|
||||
* *A4<A1.A2M *
|
||||
* (IF MOVE) *
|
||||
* *
|
||||
* 3. SUBSEQUENT SEGMENTS *
|
||||
* *.A2 ^Y OR *.A2M *
|
||||
* *
|
||||
* WOZ 11-10-77 *
|
||||
* APPLE COMPUTER INC. *
|
||||
* *
|
||||
****************************
|
||||
|
||||
*
|
||||
* RELOCATION SUBROUTINE EQUATES
|
||||
*
|
||||
R1L EQU $02 SWEET 16 REG 1.
|
||||
INST EQU $0B 3-BYTE INST FIELD.
|
||||
LENGTH EQU $2F LENGTH CODE
|
||||
YSAV EQU $34 CMND BUF POINTER
|
||||
A1L EQU $3C APPLE-II MON PARAM AREA.
|
||||
A4L EQU $42 APPLE-II MON PARAM REG 4
|
||||
IN EQU $0200
|
||||
SW16 EQU $F689 ;SWEET 16 ENTRY
|
||||
INSDS2 EQU $F88E ;DISASSEMBLER ENTRY
|
||||
NXTA4 EQU $FCB4 POINTER INCR SUBR
|
||||
FRMBEG EQU $01 SOURCE BLOCK BEGIN
|
||||
FRMEND EQU $02 SOURCE BLOCK END
|
||||
TOBEG EQU $04 DEST BLOCK BEGIN
|
||||
ADR EQU $06 ADR PART OF INST.
|
||||
|
||||
*
|
||||
* 6502 RELOCATION SUBROUTINE
|
||||
*
|
||||
ORG $D4DC
|
||||
OBJ $A4DC
|
||||
RELOC LDY YSAV
|
||||
LDA IN,Y
|
||||
CMP #$AA
|
||||
BNE RELOC2
|
||||
INC YSAV
|
||||
LDX #$07
|
||||
INIT LDA A1L,X
|
||||
STA R1L,X
|
||||
DEX
|
||||
BPL INIT
|
||||
RTS
|
||||
RELOC2 LDY #$02
|
||||
GETINS LDA (A1L),Y
|
||||
STA INST,Y
|
||||
DEY
|
||||
BPL GETINS
|
||||
JSR INSDS2
|
||||
LDX LENGTH
|
||||
DEX
|
||||
BNE XLATE
|
||||
LDA INST
|
||||
AND #$0D
|
||||
BEQ STINST
|
||||
AND #$08
|
||||
BNE STINST
|
||||
STA INST+2
|
||||
XLATE JSR SW16
|
||||
LD FRMEND
|
||||
CPR ADR
|
||||
BNC SW16RT
|
||||
LD ADR
|
||||
SUB FRMBEG
|
||||
BNC SW16RT
|
||||
ADD TOBEG
|
||||
ST ADR
|
||||
SW16RT RTN
|
||||
STINST LDX #$00
|
||||
STINS2 LDA INST,X
|
||||
STA (A4L),Y
|
||||
INX
|
||||
JSR NXTA4
|
||||
DEC LENGTH
|
||||
BPL STINS2
|
||||
BCC RELOC2
|
||||
RTS
|
27
source/progaid/relocate.tbl
Normal file
27
source/progaid/relocate.tbl
Normal file
@ -0,0 +1,27 @@
|
||||
* EQUATES
|
||||
|
||||
R1L EQU $02 SWEET 16 REG 1.
|
||||
INST EQU $0B 3-BYTE INST FIELD.
|
||||
LENGTH EQU $2F LENGTH CODE
|
||||
YSAV EQU $34 CMND BUF POINTER
|
||||
A1L EQU $3C APPLE-II MON PARAM AREA.
|
||||
A4L EQU $42 APPLE-II MON PARAM REG 4
|
||||
IN EQU $0200
|
||||
SW16 EQU $F689 ;SWEET 16 ENTRY
|
||||
INSDS2 EQU $F88E ;DISASSEMBLER ENTRY
|
||||
NXTA4 EQU $FCB4 POINTER INCR SUBR
|
||||
FRMBEG EQU $01 SOURCE BLOCK BEGIN
|
||||
FRMEND EQU $02 SOURCE BLOCK END
|
||||
TOBEG EQU $04 DEST BLOCK BEGIN
|
||||
ADR EQU $06 ADR PART OF INST.
|
||||
|
||||
* LABELS
|
||||
|
||||
RELOC = $D4DC
|
||||
INIT = $D4E9
|
||||
RELOC2 = $D4F1
|
||||
GETINS = $D4F3
|
||||
XLATE = $D50F
|
||||
SW16RT = $D51C
|
||||
STINST = $D51D
|
||||
STINS2 = $D51F
|
80
source/progaid/renumapp.asm
Normal file
80
source/progaid/renumapp.asm
Normal file
@ -0,0 +1,80 @@
|
||||
**************************************************
|
||||
* *
|
||||
* APPLE-][ BASIC RENUMBER / APPEND SUBROUTINES *
|
||||
* *
|
||||
* VERSION TWO *
|
||||
* RENUMBER *
|
||||
* >CLR *
|
||||
* >START= *
|
||||
* >STEP= *
|
||||
* >CALL -10531 *
|
||||
* *
|
||||
* OPTIONAL *
|
||||
* >FROM= *
|
||||
* >TO= *
|
||||
* >CALL -10521 *
|
||||
* *
|
||||
* USE RENX ENTRY *
|
||||
* FOR RENUMBER ALL *
|
||||
* *
|
||||
* WOZ APRIL 12, 1978 *
|
||||
* APPLE COMPUTER INC. *
|
||||
**************************************************
|
||||
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
ROL EQU $0 LOW-ORDER SW16 R0 BYTE.
|
||||
ROH EQU $1 HI-ORDER.
|
||||
ONE EQU $01
|
||||
R11L EQU $16 LOW-ORDER SW16 R11 BYTE.
|
||||
R11H EQU $17 HI-ORDER.
|
||||
HIMEM EQU $4C BASIC HIMEM POINTER.
|
||||
PPL EQU $CA BASIC PROG POINTER.
|
||||
PVL EQU $CC BASIC VAR POINTER.
|
||||
MEMFULL EQU $E36B BASIC MEM FULL ERROR.
|
||||
PRDEC EQU $E51B BASIC DECIMAL PRINT SUBR.
|
||||
RANGERR EQU $EE68 BASIC RANGE ERROR.
|
||||
LOAD EQU $F0DF BASIC LOAD SUBR.
|
||||
SW16 EQU $F689 SWEET 16 ENTRY.
|
||||
CROUT EQU $FD8E CAR RET SUBR.
|
||||
COUT EQU $FDED CHAR OUT SUBR.
|
||||
|
||||
*
|
||||
* SWEET 16 EQUATES
|
||||
*
|
||||
ACC EQU $0 SWEET 16 ACCUMULATOR.
|
||||
NEWLOW EQU $1 NEW INITIAL LNO.
|
||||
NEWINCR EQU $2 NEW LNO INCR.
|
||||
LNLOW EQU $3 LOW LNO OF RENUM RANGE.
|
||||
LNHI EQU $4 HI LNO OF RENUM RANGE.
|
||||
TBLSTRT EQU $5 LNO TABLE START.
|
||||
TBLNDX1 EQU $6 PASS 1 LNO TBL INDEX.
|
||||
TBLIM EQU $7 LNO TABLE LIMIT.
|
||||
SCR8 EQU $8 SCRATCH REG.
|
||||
HMEM EQU $8 HIMEM (END OF PRGM).
|
||||
SCR9 EQU $9 SCRATCH REG.
|
||||
PRGNDX EQU $9 PASS 1 PROG INDEX.
|
||||
PRGNDX1 EQU $A ALSO PROG INDEX.
|
||||
NEWLN EQU $B NEXT "NEW LNO".
|
||||
NEWLN1 EQU $C PRIOR "NEW LNO" ASSIGN.
|
||||
TBLND EQU $6 PASS 2 LNO TABLE END.
|
||||
PRGNDX2 EQU $7 PASS 2 PROG INDEX.
|
||||
CHR0 EQU $9 ASCII "0".
|
||||
CHRA EQU $A ASCII "A".
|
||||
MODE EQU $C CONST/LNO MODE.
|
||||
TBLNDX2 EQU $B LNO TBL IDX FOR UPDATE.
|
||||
OLDLN EQU $D OLD LNO FOR UPDATE.
|
||||
STRCON EQU $B BASIC STR CON TOKEN.
|
||||
REM EQU $C BASIC REM TOKEN
|
||||
R13 EQU $D SWEET 16 REG 13 (CPR REG).
|
||||
THEN EQU $D BASIC THEN TOKEN
|
||||
LIST EQU $D BASIC LIST TOKEN
|
||||
DEL EQU $D
|
||||
SCRC EQU $C SCRATCH REG FOR APPEND.
|
||||
|
||||
*
|
||||
* APPLE-11 BASIC RENUMBER SUBROUTINE - PASS 1
|
||||
ORG $D400
|
||||
OBJ $A400
|
74
source/progaid/renumapp.tbl
Normal file
74
source/progaid/renumapp.tbl
Normal file
@ -0,0 +1,74 @@
|
||||
* EQUATES
|
||||
|
||||
ROL EQU $0 LOW-ORDER SW16 R0 BYTE.
|
||||
ROH EQU $1 HI-ORDER.
|
||||
ONE EQU $01
|
||||
R11L EQU $16 LOW-ORDER SW16 R11 BYTE.
|
||||
R11H EQU $17 HI-ORDER.
|
||||
HIMEM EQU $4C BASIC HIMEM POINTER.
|
||||
PPL EQU $CA BASIC PROG POINTER.
|
||||
PVL EQU $CC BASIC VAR POINTER.
|
||||
MEMFULL EQU $E36B BASIC MEM FULL ERROR.
|
||||
PRDEC EQU $E51B BASIC DECIMAL PRINT SUBR.
|
||||
RANGERR EQU $EE68 BASIC RANGE ERROR.
|
||||
LOAD EQU $F0DF BASIC LOAD SUBR.
|
||||
SW16 EQU $F689 SWEET 16 ENTRY.
|
||||
CROUT EQU $FD8E CAR RET SUBR.
|
||||
COUT EQU $FDED CHAR OUT SUBR.
|
||||
|
||||
* SWEET 16 EQUATES
|
||||
|
||||
ACC EQU $0 SWEET 16 ACCUMULATOR.
|
||||
NEWLOW EQU $1 NEW INITIAL LNO.
|
||||
NEWINCR EQU $2 NEW LNO INCR.
|
||||
LNLOW EQU $3 LOW LNO OF RENUM RANGE.
|
||||
LNHI EQU $4 HI LNO OF RENUM RANGE.
|
||||
TBLSTRT EQU $5 LNO TABLE START.
|
||||
TBLNDX1 EQU $6 PASS 1 LNO TBL INDEX.
|
||||
TBLIM EQU $7 LNO TABLE LIMIT.
|
||||
SCR8 EQU $8 SCRATCH REG.
|
||||
HMEM EQU $8 HIMEM (END OF PRGM).
|
||||
SCR9 EQU $9 SCRATCH REG.
|
||||
PRGNDX EQU $9 PASS 1 PROG INDEX.
|
||||
PRGNDX1 EQU $A ALSO PROG INDEX.
|
||||
NEWLN EQU $B NEXT "NEW LNO".
|
||||
NEWLN1 EQU $C PRIOR "NEW LNO" ASSIGN.
|
||||
TBLND EQU $6 PASS 2 LNO TABLE END.
|
||||
PRGNDX2 EQU $7 PASS 2 PROG INDEX.
|
||||
CHR0 EQU $9 ASCII "0".
|
||||
CHRA EQU $A ASCII "A".
|
||||
MODE EQU $C CONST/LNO MODE.
|
||||
TBLNDX2 EQU $B LNO TBL IDX FOR UPDATE.
|
||||
OLDLN EQU $D OLD LNO FOR UPDATE.
|
||||
STRCON EQU $B BASIC STR CON TOKEN.
|
||||
REM EQU $C BASIC REM TOKEN
|
||||
R13 EQU $D SWEET 16 REG 13 (CPR REG).
|
||||
THEN EQU $D BASIC THEN TOKEN
|
||||
LIST EQU $D BASIC LIST TOKEN
|
||||
DEL EQU $D
|
||||
SCRC EQU $C SCRATCH REG FOR APPEND.
|
||||
|
||||
* LABELS
|
||||
|
||||
RENX = $D400
|
||||
RENUM = $D408
|
||||
RNUM3 = $D410
|
||||
PASS1 = $D41C
|
||||
P1A = $D432
|
||||
P1B = $D457
|
||||
RERR = $D45A
|
||||
MERR = $D45E
|
||||
P1C = $D462
|
||||
PASS2 = $D466
|
||||
P2A = $D46C
|
||||
UPDATE = $0472
|
||||
UD2 = $0477
|
||||
UD3 = $D485
|
||||
GOTCON = $D489
|
||||
ITEM = $D49D
|
||||
SKPASC = $D494
|
||||
CHKTOK = $D49A
|
||||
CONTST = $D4B8
|
||||
CONTS2 = $D4B9
|
||||
APPEND = $D4BC
|
||||
DONE = $D4D3
|
93
source/progaid/verify.asm
Normal file
93
source/progaid/verify.asm
Normal file
@ -0,0 +1,93 @@
|
||||
*****************************
|
||||
* *
|
||||
* TAPE VERIFY *
|
||||
* *
|
||||
* JAN 78 *
|
||||
* BY WOZ *
|
||||
* *
|
||||
* *
|
||||
*****************************
|
||||
|
||||
*
|
||||
* TAPE VERIFY EQUATES
|
||||
*
|
||||
CHKSUM EQU $2E
|
||||
A1 EQU $3C
|
||||
HIMEM EQU $4C ;BASIC HIMEM POINTER
|
||||
PP EQU $CA ;BASIC BEGIN OF PROGRAM
|
||||
PRLEN EQU $CE ;BASIC PROGRAM LENGTH
|
||||
XSAVE EQU $D8 ;PRESERVE X-REG FOR BASIC
|
||||
HDRSET EQU $F11E ;SETS TAPE POINTERS TO $CE.CF
|
||||
PRGSET EQU $F12C ;SETS TAPE POINTERS FOR PROGRAM
|
||||
NXTA1 EQU $FCBA ;INCREMENTS (A1) AND COMPARES TO (A2)
|
||||
HEADR EQU $FCC9
|
||||
RDBYTE EQU $FCEC
|
||||
RD2BIT EQU $FCFA
|
||||
RDBIT EQU $FCFD
|
||||
PRA1 EQU $FD92 ;PRINT (A1)-
|
||||
PRBYTE EQU $FDDA
|
||||
COUT EQU $FDED
|
||||
FINISH EQU $FF26 ;CHECK CHECKSUM, RING BELL
|
||||
PRERR EQU $FF2D
|
||||
|
||||
*
|
||||
* TAPE VERIFY ROUTINE
|
||||
*
|
||||
ORG $D535
|
||||
OBJ $A535
|
||||
VFYBSC STX XSAVE
|
||||
SEC
|
||||
LDX #$FF
|
||||
GETLEN LDA HIMEM+1,X
|
||||
SBC PP+1,X
|
||||
STA PRLEN+1,X
|
||||
INX
|
||||
BEQ GETLEN
|
||||
JSR HDRSET
|
||||
JSR TAPEVFY
|
||||
LDX #$01
|
||||
JSR PRGSET
|
||||
JSR TAPEVFY
|
||||
LDX XSAVE
|
||||
RTS
|
||||
*
|
||||
* TAPE VERIFY RAM IMAGE (A1.A2)
|
||||
*
|
||||
TAPEVFY JSR RD2BIT
|
||||
LDA #$16
|
||||
JSR HEADR
|
||||
STA CHKSUM
|
||||
JSR RD2BIT
|
||||
VRFY2 LDY #$24
|
||||
JSR RDBIT
|
||||
BCS VRFY2
|
||||
JSR RDBIT
|
||||
LDY #$3B
|
||||
VRFY3 JSR RDBYTE
|
||||
BEQ EXTDEL
|
||||
VFYLOOP EOR CHKSUM
|
||||
STA CHKSUM
|
||||
JSR NXTA1
|
||||
LDY #$34
|
||||
BCC VRFY3
|
||||
JMP FINISH
|
||||
EXTDEL NOP
|
||||
NOP
|
||||
NOP
|
||||
CMP (A1,X)
|
||||
BEQ VFYLOOP
|
||||
PHA
|
||||
JSR PRERR
|
||||
JSR PRA1
|
||||
LDA (A1),Y
|
||||
JSR PRBYTE
|
||||
LDA #$A0
|
||||
JSR COUT
|
||||
LDA #$A8
|
||||
JSR COUT
|
||||
PLA
|
||||
JSR PRBYTE
|
||||
LDA #$A9
|
||||
JSR COUT
|
||||
LDA #$8D
|
||||
JMP COUT
|
30
source/progaid/verify.tbl
Normal file
30
source/progaid/verify.tbl
Normal file
@ -0,0 +1,30 @@
|
||||
* EQUATES
|
||||
|
||||
CHKSUM EQU $2E
|
||||
A1 EQU $3C
|
||||
HIMEM EQU $4C ;BASIC HIMEM POINTER
|
||||
PP EQU $CA ;BASIC BEGIN OF PROGRAM
|
||||
PRLEN EQU $CE ;BASIC PROGRAM LENGTH
|
||||
XSAVE EQU $D8 ;PRESERVE X-REG FOR BASIC
|
||||
HDRSET EQU $F11E ;SETS TAPE POINTERS TO $CE.CF
|
||||
PRGSET EQU $F12C ;SETS TAPE POINTERS FOR PROGRAM
|
||||
NXTA1 EQU $FCBA ;INCREMENTS (A1) AND COMPARES TO (A2)
|
||||
HEADR EQU $FCC9
|
||||
RDBYTE EQU $FCEC
|
||||
RD2BIT EQU $FCFA
|
||||
RDBIT EQU $FCFD
|
||||
PRA1 EQU $FD92 ;PRINT (A1)-
|
||||
PRBYTE EQU $FDDA
|
||||
COUT EQU $FDED
|
||||
FINISH EQU $FF26 ;CHECK CHECKSUM, RING BELL
|
||||
PRERR EQU $FF2D
|
||||
|
||||
* LABELS
|
||||
|
||||
VFYBSC = $D535
|
||||
GETLEN = $D53A
|
||||
TAPEVFY = $D554
|
||||
VRFY2 = $D561
|
||||
VRFY3 = $D56D
|
||||
VFYLOOP = $D572
|
||||
EXTDEL = $D580
|
Loading…
Reference in New Issue
Block a user