Attempted line ending fix
This commit is contained in:
parent
1e3d46da03
commit
bc9ce5bb8b
File diff suppressed because one or more lines are too long
|
@ -1 +1,198 @@
|
|||
* bgdata
tr on
*-------------------------------
* Indexed by PIECE ID#:
space = 0
floor = 1
spikes = 2
posts = 3
gate = 4
dpressplate = 5 ;down
pressplate = 6 ;up
panelwif = 7 ;w/floor
pillarbottom = 8
pillartop = 9
flask = 10
loose = 11
panelwof = 12 ;w/o floor
mirror = 13
rubble = 14
upressplate = 15
exit = 16
exit2 = 17
slicer = 18
torch = 19
block = 20
bones = 21
sword = 22
window = 23
window2 = 24
archbot = 25
archtop1 = 26
archtop2 = 27
archtop3 = 28
archtop4 = 29
*-------------------------------
* A & B sections have l.l. of (X = BlockLeft, Y = BlockBot-3)
* C & D sections have l.l. of (X = BlockLeft, Y = BlockBot)
* All x & y offsets are relative to these values
* (Front pieces are relative to A)
*-------------------------------
* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
* 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
maska hex 00,03,03,03,03,03,03,03,03,00,03,03,00,03,03,03
hex 03,00,00,03,00,03,00,03,00,03,00,00,00,00
piecea hex 00,01,05,07,0a,01,01,0a,10,00,01,00,00,14,20,4b
hex 01,00,00,01,00,97,00,01,00,a7,a9,aa,ac,ad
pieceay hex 00,00,00,00,00,01,00,00,00,00,00,00,00,00,00,00
dfb 00,00,00,00,00,00,00,00,00,00,00,-4,-4,-4
maskb hex 00,04,04,04,04,04,04,00,04,00,04,00,00,04,04,04
hex 00,04,04,04,04,04,04,00,04,04,00,00,00,00
pieceb hex 00,02,06,08,0b,1b,02,9e,1a,1c,02,00,9e,4a,21,1b
hex 4d,4e,02,51,84,98,02,91,92,02,00,00,00,00
pieceby dfb 00,00,00,00,00,01,00,03,00,03,00,00,03,00,00,-1
dfb 00,00,00,-1,02,00,00,00,00,00,00,00,00,00
bstripe hex 00,47,47,00,00,47,47,00,00,00,47,47,00,00,47,47
hex 00,00,47,00,00,00,47,00,00,47,00,00,00,00
* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
* 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
piecec hex 00,00,00,09,0c,00,00,9f,00,1d,00,00,9f,00,00,00
hex 4f,50,00,00,85,00,00,93,94,00,00,00,00,00
pieced hex 00,15,15,15,15,18,19,16,15,00,15,00,17,15,2e,4c
hex 15,15,15,15,86,15,15,15,15,15,ab,00,00,00
fronti hex 00,00,00,45,46,00,00,46,48,49,87,00,46,0f,13,00
hex 00,00,00,00,83,00,00,00,00,a8,00,ae,ae,ae
fronty dfb 00,00,00,-1,00,00,00,00,-1,03,-3,00,00,-1,00,00
dfb 00,00,00,00,00,00,00,00,00,-1,0,-36,-36,-36
frontx hex 00,00,00,01,03,00,00,03,01,01,02,00,03,01,00,00
hex 00,00,00,00,00,00,00,00,00,01,00,00,00,00
*-------------------------------
* special pieces
gatebotSTA = $43
gatebotORA = $44
gateB1 = $37
gatecmask = $0d
gate8c hex 2f,30,31,32,33,34,35,36
gate8b hex 3e,3d,3c,3b,3a,39,38,37
*-------------------------------
* Climbup masking
CUmask = $11
CUpiece = $12
CUpost = $0e
*-------------------------------
* Exit
stairs = $6b
door = $6c
doormask = $6d
toprepair = $6e
archtop3sp = $a1
*-------------------------------
* Spike animation frames
* 0 1 2 3 4 5 6 7 8 9 10 11
spikea hex 00,22,24,26,28,2a,28,24,22,00
spikeb hex 00,23,25,27,29,2b,29,25,23,00
spikeExt = 5 ;
spikeRet = 9 ;must match MOVEDATA
*-------------------------------
* Slicer animation frames
* 0 1 2 3 4 5 6 7 8 9 10 11
slicerseq dfb 04,03,01,02,05,04,04
slicerExt = 2
slicerRet = 6 ;must match MOVEDATA
slicertop hex 00,58,5a,5c,5e
slicerbot hex 57,59,5b,5d,5f
slicerbot2 hex 8e,8f,90,5d,5f ;smeared
slicergap dfb 00,38,46,53,55
slicerfrnt hex 65,66,67,68,69
*-------------------------------
* Loose floor
* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
looseb = $1b
loosea hex 01,1e,01,1f,1f,01,01,01,1f,1f,1f
looseby dfb 00,01,00,-1,-1,00,00,00,-1,-1,-1
loosed hex 15,2c,15,2d,2d,15,15,15,2d,2d,2d
Ffalling = 10 ;1st "falling" frame
;must match MOVEDATA
*-------------------------------
specialflask = $95
swordgleam1 = $b3
swordgleam0 = $99
*-------------------------------
* panels
panelb0 = $9e
panelc0 = $9f
numpans = 3
panelb hex 9e,9a,81
panelc hex 9f,9b,82
archpanel = $a1
*-------------------------------
* back wall panels for space & floor
numbpans = 3
spaceb hex 00,a3,a5,a6
spaceby dfb 0,-20,-20,0
floorb hex 02,a2,a4,a4
floorby dfb 00,00,00,00
*-------------------------------
* solid blocks
numblox = 2
blockb hex 84,6f
blockc hex 85,85
blockd hex 86,86
blockfr hex 83,83
*-------------------------------
* moveparams
gmaxval = 47*4
gminval = 0
*-------------------------------
eof
|
||||
* bgdata
|
||||
tr on
|
||||
*-------------------------------
|
||||
* Indexed by PIECE ID#:
|
||||
|
||||
space = 0
|
||||
floor = 1
|
||||
spikes = 2
|
||||
posts = 3
|
||||
gate = 4
|
||||
dpressplate = 5 ;down
|
||||
pressplate = 6 ;up
|
||||
panelwif = 7 ;w/floor
|
||||
pillarbottom = 8
|
||||
pillartop = 9
|
||||
flask = 10
|
||||
loose = 11
|
||||
panelwof = 12 ;w/o floor
|
||||
mirror = 13
|
||||
rubble = 14
|
||||
upressplate = 15
|
||||
exit = 16
|
||||
exit2 = 17
|
||||
slicer = 18
|
||||
torch = 19
|
||||
block = 20
|
||||
bones = 21
|
||||
sword = 22
|
||||
window = 23
|
||||
window2 = 24
|
||||
archbot = 25
|
||||
archtop1 = 26
|
||||
archtop2 = 27
|
||||
archtop3 = 28
|
||||
archtop4 = 29
|
||||
|
||||
*-------------------------------
|
||||
* A & B sections have l.l. of (X = BlockLeft, Y = BlockBot-3)
|
||||
* C & D sections have l.l. of (X = BlockLeft, Y = BlockBot)
|
||||
* All x & y offsets are relative to these values
|
||||
* (Front pieces are relative to A)
|
||||
|
||||
*-------------------------------
|
||||
* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
* 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
||||
|
||||
maska hex 00,03,03,03,03,03,03,03,03,00,03,03,00,03,03,03
|
||||
hex 03,00,00,03,00,03,00,03,00,03,00,00,00,00
|
||||
|
||||
piecea hex 00,01,05,07,0a,01,01,0a,10,00,01,00,00,14,20,4b
|
||||
hex 01,00,00,01,00,97,00,01,00,a7,a9,aa,ac,ad
|
||||
|
||||
pieceay hex 00,00,00,00,00,01,00,00,00,00,00,00,00,00,00,00
|
||||
dfb 00,00,00,00,00,00,00,00,00,00,00,-4,-4,-4
|
||||
|
||||
maskb hex 00,04,04,04,04,04,04,00,04,00,04,00,00,04,04,04
|
||||
hex 00,04,04,04,04,04,04,00,04,04,00,00,00,00
|
||||
|
||||
pieceb hex 00,02,06,08,0b,1b,02,9e,1a,1c,02,00,9e,4a,21,1b
|
||||
hex 4d,4e,02,51,84,98,02,91,92,02,00,00,00,00
|
||||
|
||||
pieceby dfb 00,00,00,00,00,01,00,03,00,03,00,00,03,00,00,-1
|
||||
dfb 00,00,00,-1,02,00,00,00,00,00,00,00,00,00
|
||||
|
||||
bstripe hex 00,47,47,00,00,47,47,00,00,00,47,47,00,00,47,47
|
||||
hex 00,00,47,00,00,00,47,00,00,47,00,00,00,00
|
||||
|
||||
* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
* 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
||||
|
||||
piecec hex 00,00,00,09,0c,00,00,9f,00,1d,00,00,9f,00,00,00
|
||||
hex 4f,50,00,00,85,00,00,93,94,00,00,00,00,00
|
||||
|
||||
pieced hex 00,15,15,15,15,18,19,16,15,00,15,00,17,15,2e,4c
|
||||
hex 15,15,15,15,86,15,15,15,15,15,ab,00,00,00
|
||||
|
||||
fronti hex 00,00,00,45,46,00,00,46,48,49,87,00,46,0f,13,00
|
||||
hex 00,00,00,00,83,00,00,00,00,a8,00,ae,ae,ae
|
||||
|
||||
fronty dfb 00,00,00,-1,00,00,00,00,-1,03,-3,00,00,-1,00,00
|
||||
dfb 00,00,00,00,00,00,00,00,00,-1,0,-36,-36,-36
|
||||
|
||||
frontx hex 00,00,00,01,03,00,00,03,01,01,02,00,03,01,00,00
|
||||
hex 00,00,00,00,00,00,00,00,00,01,00,00,00,00
|
||||
|
||||
*-------------------------------
|
||||
* special pieces
|
||||
|
||||
gatebotSTA = $43
|
||||
gatebotORA = $44
|
||||
gateB1 = $37
|
||||
gatecmask = $0d
|
||||
|
||||
gate8c hex 2f,30,31,32,33,34,35,36
|
||||
gate8b hex 3e,3d,3c,3b,3a,39,38,37
|
||||
|
||||
*-------------------------------
|
||||
* Climbup masking
|
||||
|
||||
CUmask = $11
|
||||
CUpiece = $12
|
||||
CUpost = $0e
|
||||
|
||||
*-------------------------------
|
||||
* Exit
|
||||
|
||||
stairs = $6b
|
||||
door = $6c
|
||||
doormask = $6d
|
||||
toprepair = $6e
|
||||
|
||||
archtop3sp = $a1
|
||||
|
||||
*-------------------------------
|
||||
* Spike animation frames
|
||||
* 0 1 2 3 4 5 6 7 8 9 10 11
|
||||
|
||||
spikea hex 00,22,24,26,28,2a,28,24,22,00
|
||||
spikeb hex 00,23,25,27,29,2b,29,25,23,00
|
||||
|
||||
spikeExt = 5 ;
|
||||
spikeRet = 9 ;must match MOVEDATA
|
||||
|
||||
*-------------------------------
|
||||
* Slicer animation frames
|
||||
* 0 1 2 3 4 5 6 7 8 9 10 11
|
||||
|
||||
slicerseq dfb 04,03,01,02,05,04,04
|
||||
|
||||
slicerExt = 2
|
||||
slicerRet = 6 ;must match MOVEDATA
|
||||
|
||||
slicertop hex 00,58,5a,5c,5e
|
||||
slicerbot hex 57,59,5b,5d,5f
|
||||
slicerbot2 hex 8e,8f,90,5d,5f ;smeared
|
||||
slicergap dfb 00,38,46,53,55
|
||||
slicerfrnt hex 65,66,67,68,69
|
||||
|
||||
*-------------------------------
|
||||
* Loose floor
|
||||
* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
|
||||
looseb = $1b
|
||||
|
||||
loosea hex 01,1e,01,1f,1f,01,01,01,1f,1f,1f
|
||||
looseby dfb 00,01,00,-1,-1,00,00,00,-1,-1,-1
|
||||
loosed hex 15,2c,15,2d,2d,15,15,15,2d,2d,2d
|
||||
|
||||
Ffalling = 10 ;1st "falling" frame
|
||||
;must match MOVEDATA
|
||||
|
||||
*-------------------------------
|
||||
specialflask = $95
|
||||
|
||||
swordgleam1 = $b3
|
||||
swordgleam0 = $99
|
||||
|
||||
*-------------------------------
|
||||
* panels
|
||||
|
||||
panelb0 = $9e
|
||||
panelc0 = $9f
|
||||
numpans = 3
|
||||
|
||||
panelb hex 9e,9a,81
|
||||
panelc hex 9f,9b,82
|
||||
|
||||
archpanel = $a1
|
||||
|
||||
*-------------------------------
|
||||
* back wall panels for space & floor
|
||||
|
||||
numbpans = 3
|
||||
|
||||
spaceb hex 00,a3,a5,a6
|
||||
spaceby dfb 0,-20,-20,0
|
||||
|
||||
floorb hex 02,a2,a4,a4
|
||||
floorby dfb 00,00,00,00
|
||||
|
||||
*-------------------------------
|
||||
* solid blocks
|
||||
|
||||
numblox = 2
|
||||
|
||||
blockb hex 84,6f
|
||||
blockc hex 85,85
|
||||
blockd hex 86,86
|
||||
blockfr hex 83,83
|
||||
|
||||
*-------------------------------
|
||||
* moveparams
|
||||
|
||||
gmaxval = 47*4
|
||||
gminval = 0
|
||||
|
||||
*-------------------------------
|
||||
eof
|
||||
|
|
|
@ -1 +1,234 @@
|
|||
* boot
org = $800
lst off
*-------------------------------
* $800 TS (0,0) boot sector
SLOT = $2b
sector = $50
text = $fb2f
home = $fc58
vtab = $FB5B
cout = $FDF0
normal = $fe84
pr0 = $fe93
in0 = $fe89
*-------------------------------
org org
hex 01
entry lda #$60
sta entry
lda #$ff
sta $4fb
sta $3f3
sta $3f4
sta $c000 ;80store off
sta $c002 ;RAMRD main
sta $c004 ;RAMWRT main
sta $c00c ;80col off
sta $c00e ;Altcharset off
sta $c081 ;write RAM, read ROM (2nd 4k bank)
jsr text
jsr home
jsr normal
jsr pr0
jsr in0
ldx SLOT
txa
lsr
lsr
lsr
lsr
ora #$c0
sta :rdsect+2
lda #$0f
sta sector
:0 ldy sector
lda skewtbl,y
sta $3d
lda sectaddr,y
beq :1
sta $27
:rdsect jsr $005c
:1 dec sector
bne :0
lda SLOT
jmp $900
skewtbl hex 00,0d,0b,09,07,05,03,01
hex 0e,0c,0a,08,06,04,02,0f
sectaddr hex 00,09,00,00,00,00,00,00
hex 30,31,32,33,34,00,00,00
*===============================
* boot stage 2
rw18 = $d000
slot = $fd
track = $fe
lastrack = $ff
dum $00
dest ds 2
source ds 2
endsourc ds 2
dend
*-------------------------------
ds $900-*
stage2 stx slot
jsr check128k ;check for 128K memory
jsr moverw18 ;& move RW18 to D000
lda #0
sta lastrack
sta $3f3
sta $3f4 ;zero reset vector
jsr rw18
hex 07,a9 ;Bbund ID byte
jsr rw18
hex 00,01,00 ;drive 1 on
jsr rw18 ;seek track 1
hex 02,00,01
* load & run stage 3 boot
* from drive 1
jsr rw18
hex c3,ee
jmp $ee00
*-------------------------------------------------
* Check for AUX memory routine
CHECKER lda #$EE
sta $C005
sta $C003
sta $0800
lda $0C00
cmp #$EE
bne :0
asl $0C00
lda $0800
cmp $0C00
beq :1
:0 clc
:1 sta $C004
sta $C002
rts
CHECKEND = *-CHECKER
*-------------------------------------------------
*
* Check to make sure //c or //e
* with 128k
*
*-------------------------------
check128k
sta $c081
lda $FBB3 ;Apple // family ID byte
cmp #6
bne NOT128K ;Must be e/c/GS
bit $C017
bmi NOT128K
ldx #CHECKEND
:0 lda CHECKER,X
sta $180,X
dex
bpl :0
jsr $180
bcs NOT128K
rts
*-------------------------------
* Turn off drive and display message
NOT128K ldx SLOT
lda $C088,X
jsr text
jsr home
lda #8
jsr vtab
ldy #0
:0 lda MEMTEXT,Y
beq *
jsr cout
cmp #$8D
bne :1
lda #4
sta $24
:1 iny
bne :0
MEMTEXT hex 8D
asc "REQUIRES A //C OR //E WITH 128K"
hex 00
*-------------------------------
* Move RW18
* d0 < 30.40
*-------------------------------
moverw18
bit $c08b
bit $c08b ;rd/wrt RAM, 1st 4k bank
lda #$d0
ldx #$30
ldy #$40
* a < x.y
* 20 < 40.60 means 2000 < 4000.5fffm
* WARNING: If x >= y, routine will wipe out 64k
movemem sta dest+1
stx source+1
sty endsourc+1
ldy #0
sty dest
sty source
sty endsourc
:loop lda (source),y
sta (dest),y
iny
bne :loop
inc source+1
inc dest+1
lda source+1
cmp endsourc+1
bne :loop
rts
*-------------------------------
sav boot
|
||||
* boot
|
||||
org = $800
|
||||
lst off
|
||||
*-------------------------------
|
||||
* $800 TS (0,0) boot sector
|
||||
|
||||
SLOT = $2b
|
||||
sector = $50
|
||||
|
||||
text = $fb2f
|
||||
home = $fc58
|
||||
vtab = $FB5B
|
||||
cout = $FDF0
|
||||
normal = $fe84
|
||||
pr0 = $fe93
|
||||
in0 = $fe89
|
||||
|
||||
*-------------------------------
|
||||
org org
|
||||
|
||||
hex 01
|
||||
|
||||
entry lda #$60
|
||||
sta entry
|
||||
|
||||
lda #$ff
|
||||
sta $4fb
|
||||
sta $3f3
|
||||
sta $3f4
|
||||
sta $c000 ;80store off
|
||||
sta $c002 ;RAMRD main
|
||||
sta $c004 ;RAMWRT main
|
||||
sta $c00c ;80col off
|
||||
sta $c00e ;Altcharset off
|
||||
sta $c081 ;write RAM, read ROM (2nd 4k bank)
|
||||
jsr text
|
||||
jsr home
|
||||
jsr normal
|
||||
jsr pr0
|
||||
jsr in0
|
||||
|
||||
ldx SLOT
|
||||
txa
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
ora #$c0
|
||||
sta :rdsect+2
|
||||
lda #$0f
|
||||
sta sector
|
||||
|
||||
:0 ldy sector
|
||||
lda skewtbl,y
|
||||
sta $3d
|
||||
lda sectaddr,y
|
||||
beq :1
|
||||
sta $27
|
||||
:rdsect jsr $005c
|
||||
:1 dec sector
|
||||
bne :0
|
||||
|
||||
lda SLOT
|
||||
jmp $900
|
||||
|
||||
skewtbl hex 00,0d,0b,09,07,05,03,01
|
||||
hex 0e,0c,0a,08,06,04,02,0f
|
||||
|
||||
sectaddr hex 00,09,00,00,00,00,00,00
|
||||
hex 30,31,32,33,34,00,00,00
|
||||
|
||||
*===============================
|
||||
* boot stage 2
|
||||
|
||||
rw18 = $d000
|
||||
|
||||
slot = $fd
|
||||
track = $fe
|
||||
lastrack = $ff
|
||||
|
||||
dum $00
|
||||
|
||||
dest ds 2
|
||||
source ds 2
|
||||
endsourc ds 2
|
||||
|
||||
dend
|
||||
*-------------------------------
|
||||
ds $900-*
|
||||
|
||||
stage2 stx slot
|
||||
|
||||
jsr check128k ;check for 128K memory
|
||||
|
||||
jsr moverw18 ;& move RW18 to D000
|
||||
|
||||
lda #0
|
||||
sta lastrack
|
||||
sta $3f3
|
||||
sta $3f4 ;zero reset vector
|
||||
|
||||
jsr rw18
|
||||
hex 07,a9 ;Bbund ID byte
|
||||
|
||||
jsr rw18
|
||||
hex 00,01,00 ;drive 1 on
|
||||
|
||||
jsr rw18 ;seek track 1
|
||||
hex 02,00,01
|
||||
|
||||
* load & run stage 3 boot
|
||||
* from drive 1
|
||||
|
||||
jsr rw18
|
||||
hex c3,ee
|
||||
|
||||
jmp $ee00
|
||||
|
||||
*-------------------------------------------------
|
||||
* Check for AUX memory routine
|
||||
|
||||
CHECKER lda #$EE
|
||||
sta $C005
|
||||
sta $C003
|
||||
sta $0800
|
||||
lda $0C00
|
||||
cmp #$EE
|
||||
bne :0
|
||||
asl $0C00
|
||||
lda $0800
|
||||
cmp $0C00
|
||||
beq :1
|
||||
:0 clc
|
||||
:1 sta $C004
|
||||
sta $C002
|
||||
rts
|
||||
|
||||
CHECKEND = *-CHECKER
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Check to make sure //c or //e
|
||||
* with 128k
|
||||
*
|
||||
*-------------------------------
|
||||
check128k
|
||||
sta $c081
|
||||
|
||||
lda $FBB3 ;Apple // family ID byte
|
||||
cmp #6
|
||||
bne NOT128K ;Must be e/c/GS
|
||||
|
||||
bit $C017
|
||||
bmi NOT128K
|
||||
|
||||
ldx #CHECKEND
|
||||
:0 lda CHECKER,X
|
||||
sta $180,X
|
||||
dex
|
||||
bpl :0
|
||||
|
||||
jsr $180
|
||||
bcs NOT128K
|
||||
|
||||
rts
|
||||
|
||||
*-------------------------------
|
||||
* Turn off drive and display message
|
||||
|
||||
NOT128K ldx SLOT
|
||||
lda $C088,X
|
||||
|
||||
jsr text
|
||||
jsr home
|
||||
lda #8
|
||||
jsr vtab
|
||||
|
||||
ldy #0
|
||||
:0 lda MEMTEXT,Y
|
||||
beq *
|
||||
jsr cout
|
||||
cmp #$8D
|
||||
bne :1
|
||||
lda #4
|
||||
sta $24
|
||||
:1 iny
|
||||
bne :0
|
||||
|
||||
MEMTEXT hex 8D
|
||||
asc "REQUIRES A //C OR //E WITH 128K"
|
||||
hex 00
|
||||
|
||||
*-------------------------------
|
||||
* Move RW18
|
||||
* d0 < 30.40
|
||||
*-------------------------------
|
||||
moverw18
|
||||
bit $c08b
|
||||
bit $c08b ;rd/wrt RAM, 1st 4k bank
|
||||
|
||||
lda #$d0
|
||||
ldx #$30
|
||||
ldy #$40
|
||||
|
||||
* a < x.y
|
||||
* 20 < 40.60 means 2000 < 4000.5fffm
|
||||
* WARNING: If x >= y, routine will wipe out 64k
|
||||
|
||||
movemem sta dest+1
|
||||
stx source+1
|
||||
sty endsourc+1
|
||||
|
||||
ldy #0
|
||||
sty dest
|
||||
sty source
|
||||
sty endsourc
|
||||
|
||||
:loop lda (source),y
|
||||
sta (dest),y
|
||||
|
||||
iny
|
||||
bne :loop
|
||||
|
||||
inc source+1
|
||||
inc dest+1
|
||||
|
||||
lda source+1
|
||||
cmp endsourc+1
|
||||
bne :loop
|
||||
|
||||
rts
|
||||
|
||||
*-------------------------------
|
||||
sav boot
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1,70 @@
|
|||
tr on
* hrparams
hrtables = $e000
hrparams = $00
*-------------------------------
dum hrtables
YLO ds $c0
YHI ds $c0
SHIFT0 ds $80
SHIFT1 ds $80
SHIFT2 ds $80
SHIFT3 ds $80
SHIFT4 ds $80
SHIFT5 ds $80
SHIFT6 ds $80
CARRY0 ds $80
CARRY1 ds $80
CARRY2 ds $80
CARRY3 ds $80
CARRY4 ds $80
CARRY5 ds $80
CARRY6 ds $80
MIRROR ds $80
MASKTAB ds $80
SHIFTL ds 7
SHIFTH ds 7
CARRYL ds 7
CARRYH ds 7
AMASKS ds 7
BMASKS ds 7
OPCODE ds 6
endtabs dend
*-------------------------------
dum hrparams
PAGE ds 1
XCO ds 1
YCO ds 1
OFFSET ds 1
IMAGE ds 2
OPACITY ds 1
TABLE ds 2
PEELBUF ds 2
PEELIMG ds 2
PEELXCO ds 1
PEELYCO ds 1
TOPCUT ds 1
LEFTCUT ds 1
RIGHTCUT ds 1
BANK ds 1
BOTCUT ds 1
dend
height = IMAGE
width = IMAGE+1
color = OPACITY
lst off
|
||||
tr on
|
||||
* hrparams
|
||||
|
||||
hrtables = $e000
|
||||
hrparams = $00
|
||||
*-------------------------------
|
||||
dum hrtables
|
||||
|
||||
YLO ds $c0
|
||||
YHI ds $c0
|
||||
|
||||
SHIFT0 ds $80
|
||||
SHIFT1 ds $80
|
||||
SHIFT2 ds $80
|
||||
SHIFT3 ds $80
|
||||
SHIFT4 ds $80
|
||||
SHIFT5 ds $80
|
||||
SHIFT6 ds $80
|
||||
|
||||
CARRY0 ds $80
|
||||
CARRY1 ds $80
|
||||
CARRY2 ds $80
|
||||
CARRY3 ds $80
|
||||
CARRY4 ds $80
|
||||
CARRY5 ds $80
|
||||
CARRY6 ds $80
|
||||
|
||||
MIRROR ds $80
|
||||
MASKTAB ds $80
|
||||
|
||||
SHIFTL ds 7
|
||||
SHIFTH ds 7
|
||||
CARRYL ds 7
|
||||
CARRYH ds 7
|
||||
AMASKS ds 7
|
||||
BMASKS ds 7
|
||||
|
||||
OPCODE ds 6
|
||||
|
||||
endtabs dend
|
||||
|
||||
*-------------------------------
|
||||
dum hrparams
|
||||
|
||||
PAGE ds 1
|
||||
XCO ds 1
|
||||
YCO ds 1
|
||||
OFFSET ds 1
|
||||
IMAGE ds 2
|
||||
OPACITY ds 1
|
||||
TABLE ds 2
|
||||
|
||||
PEELBUF ds 2
|
||||
PEELIMG ds 2
|
||||
PEELXCO ds 1
|
||||
PEELYCO ds 1
|
||||
|
||||
TOPCUT ds 1
|
||||
LEFTCUT ds 1
|
||||
RIGHTCUT ds 1
|
||||
BANK ds 1
|
||||
BOTCUT ds 1
|
||||
|
||||
dend
|
||||
|
||||
height = IMAGE
|
||||
width = IMAGE+1
|
||||
color = OPACITY
|
||||
|
||||
lst off
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1,59 @@
|
|||
tr on
lst off
* movedata
*-------------------------------
* objnames
space = 0
floor = 1
spikes = 2
posts = 3
gate = 4
dpressplate = 5 ;down
pressplate = 6 ;up
panelwif = 7 ;w/floor
pillarbottom = 8
pillartop = 9
flask = 10
loose = 11
panelwof = 12 ;w/o floor
mirror = 13
rubble = 14
upressplate = 15
exit = 16
exit2 = 17
slicer = 18
torch = 19
block = 20
bones = 21
sword = 22
window = 23
window2 = 24
archbot = 25
archtop1 = 26
archtop2 = 27
archtop3 = 28
archtop4 = 29
*-------------------------------
* misc. values from BGDATA
torchLast = 17
bubbLast = 8
spikeExt = 5
spikeRet = 9
slicerExt = 2
slicerRet = 6
Ffalling = 10 ;1st "falling" frame
*-------------------------------
* moveparams
gmaxval = 47*4
gminval = 0
lst off
|
||||
tr on
|
||||
lst off
|
||||
|
||||
* movedata
|
||||
*-------------------------------
|
||||
* objnames
|
||||
|
||||
space = 0
|
||||
floor = 1
|
||||
spikes = 2
|
||||
posts = 3
|
||||
gate = 4
|
||||
dpressplate = 5 ;down
|
||||
pressplate = 6 ;up
|
||||
panelwif = 7 ;w/floor
|
||||
pillarbottom = 8
|
||||
pillartop = 9
|
||||
flask = 10
|
||||
loose = 11
|
||||
panelwof = 12 ;w/o floor
|
||||
mirror = 13
|
||||
rubble = 14
|
||||
upressplate = 15
|
||||
exit = 16
|
||||
exit2 = 17
|
||||
slicer = 18
|
||||
torch = 19
|
||||
block = 20
|
||||
bones = 21
|
||||
sword = 22
|
||||
window = 23
|
||||
window2 = 24
|
||||
archbot = 25
|
||||
archtop1 = 26
|
||||
archtop2 = 27
|
||||
archtop3 = 28
|
||||
archtop4 = 29
|
||||
|
||||
*-------------------------------
|
||||
* misc. values from BGDATA
|
||||
|
||||
torchLast = 17
|
||||
bubbLast = 8
|
||||
|
||||
spikeExt = 5
|
||||
spikeRet = 9
|
||||
|
||||
slicerExt = 2
|
||||
slicerRet = 6
|
||||
|
||||
Ffalling = 10 ;1st "falling" frame
|
||||
|
||||
*-------------------------------
|
||||
* moveparams
|
||||
|
||||
gmaxval = 47*4
|
||||
gminval = 0
|
||||
|
||||
lst off
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1 +1,132 @@
|
|||
tr on
lst off
* seqdata
fcheckmark = %01000000
fcentermark = %00011111
* Sequence table entry points
startrun = 1
stand = 2
standjump = 3
runjump = 4
turn = 5
runturn = 6
stepfall = 7
jumphangMed = 8
hang = 9
climbup = 10
hangdrop = 11
freefall = 12
runstop = 13
jumpup = 14
fallhang = 15
jumpbackhang = 16
softland = 17
jumpfall = 18
stepfall2 = 19
medland = 20
rjumpfall = 21
hardland = 22
hangfall = 23
jumphangLong = 24
hangstraight = 25
rdiveroll = 26
sdiveroll = 27
highjump = 28
stepfwd1 = 29
;stepfwd 1 thru 14 = 29 thru 42
turnrun = 43
testfoot = 44
bumpfall = 45
hardbump = 46
bump = 47
superhijump = 48
standup = 49
stoop = 50
impale = 51
crush = 52
deadfall = 53
halve = 54
engarde = 55
advance = 56
retreat = 57
strike = 58
flee = 59
turnengarde = 60
strikeblock = 61
readyblock = 62
landengarde = 63
bumpengfwd = 64
bumpengback = 65
blocktostrike = 66
strikeadv = 67
climbdown = 68
blockedstrike = 69
climbstairs = 70
dropdead = 71
stepback = 72
climbfail = 73
stabbed = 74
faststrike = 75
strikeret = 76
alertstand = 77
drinkpotion = 78
crawl = 79
alertturn = 80
fightfall = 81
efightfall = 82
efightfallfwd = 83
running = 84
stabkill = 85
fastadvance = 86
goalertstand = 87
arise = 88
turndraw = 89
guardengarde = 90
pickupsword = 91
resheathe = 92
fastsheathe = 93
Pstand = 94
Vstand = 95
Vapproach = 96
Vstop = 97
Palert = 98
Pback = 99
Vexit = 100
Mclimb = 101
Vraise = 102
Plie = 103
patchfall = 104
Mscurry = 105
Mstop = 106
Mleave = 107
Pembrace = 108
Pwaiting = 109
Pstroke = 110
Prise = 111
Pcrouch = 112
Pslump = 113
Mraise = 114
* Sequence table instruction codes
goto = -1
aboutface = -2
up = -3
down = -4
chx = -5
chy = -6
act = -7
setfall = -8
ifwtless = -9
die = -10
jaru = -11
jard = -12
effect = -13
tap = -14
nextlevel = -15
lst off
|
||||
tr on
|
||||
lst off
|
||||
|
||||
* seqdata
|
||||
|
||||
fcheckmark = %01000000
|
||||
fcentermark = %00011111
|
||||
|
||||
* Sequence table entry points
|
||||
|
||||
startrun = 1
|
||||
stand = 2
|
||||
standjump = 3
|
||||
runjump = 4
|
||||
turn = 5
|
||||
runturn = 6
|
||||
stepfall = 7
|
||||
jumphangMed = 8
|
||||
hang = 9
|
||||
climbup = 10
|
||||
hangdrop = 11
|
||||
freefall = 12
|
||||
runstop = 13
|
||||
jumpup = 14
|
||||
fallhang = 15
|
||||
jumpbackhang = 16
|
||||
softland = 17
|
||||
jumpfall = 18
|
||||
stepfall2 = 19
|
||||
medland = 20
|
||||
rjumpfall = 21
|
||||
hardland = 22
|
||||
hangfall = 23
|
||||
jumphangLong = 24
|
||||
hangstraight = 25
|
||||
rdiveroll = 26
|
||||
sdiveroll = 27
|
||||
highjump = 28
|
||||
stepfwd1 = 29
|
||||
;stepfwd 1 thru 14 = 29 thru 42
|
||||
turnrun = 43
|
||||
testfoot = 44
|
||||
bumpfall = 45
|
||||
hardbump = 46
|
||||
bump = 47
|
||||
superhijump = 48
|
||||
standup = 49
|
||||
stoop = 50
|
||||
impale = 51
|
||||
crush = 52
|
||||
deadfall = 53
|
||||
halve = 54
|
||||
engarde = 55
|
||||
advance = 56
|
||||
retreat = 57
|
||||
strike = 58
|
||||
flee = 59
|
||||
turnengarde = 60
|
||||
strikeblock = 61
|
||||
readyblock = 62
|
||||
landengarde = 63
|
||||
bumpengfwd = 64
|
||||
bumpengback = 65
|
||||
blocktostrike = 66
|
||||
strikeadv = 67
|
||||
climbdown = 68
|
||||
blockedstrike = 69
|
||||
climbstairs = 70
|
||||
dropdead = 71
|
||||
stepback = 72
|
||||
climbfail = 73
|
||||
stabbed = 74
|
||||
faststrike = 75
|
||||
strikeret = 76
|
||||
alertstand = 77
|
||||
drinkpotion = 78
|
||||
crawl = 79
|
||||
alertturn = 80
|
||||
fightfall = 81
|
||||
efightfall = 82
|
||||
efightfallfwd = 83
|
||||
running = 84
|
||||
stabkill = 85
|
||||
fastadvance = 86
|
||||
goalertstand = 87
|
||||
arise = 88
|
||||
turndraw = 89
|
||||
guardengarde = 90
|
||||
pickupsword = 91
|
||||
resheathe = 92
|
||||
fastsheathe = 93
|
||||
Pstand = 94
|
||||
Vstand = 95
|
||||
Vapproach = 96
|
||||
Vstop = 97
|
||||
Palert = 98
|
||||
Pback = 99
|
||||
Vexit = 100
|
||||
Mclimb = 101
|
||||
Vraise = 102
|
||||
Plie = 103
|
||||
patchfall = 104
|
||||
Mscurry = 105
|
||||
Mstop = 106
|
||||
Mleave = 107
|
||||
Pembrace = 108
|
||||
Pwaiting = 109
|
||||
Pstroke = 110
|
||||
Prise = 111
|
||||
Pcrouch = 112
|
||||
Pslump = 113
|
||||
Mraise = 114
|
||||
|
||||
* Sequence table instruction codes
|
||||
|
||||
goto = -1
|
||||
aboutface = -2
|
||||
up = -3
|
||||
down = -4
|
||||
chx = -5
|
||||
chy = -6
|
||||
act = -7
|
||||
setfall = -8
|
||||
ifwtless = -9
|
||||
die = -10
|
||||
jaru = -11
|
||||
jard = -12
|
||||
effect = -13
|
||||
tap = -14
|
||||
nextlevel = -15
|
||||
|
||||
lst off
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1 +1,360 @@
|
|||
* sound
org = $ea00
lst off
*-------------------------------
*
* S O U N D
*
*-------------------------------
org org
jmp PLAYBACK
*-------------------------------
savex ds 1
spkr = $c030
*-------------------------------
put soundnames
put gameeq
put eq
*-------------------------------
*
* L O O K U P
*
* Sound routine lookup table
*
*-------------------------------
lookup
:0 dw DoPlateDown
:1 dw DoPlateUp
:2 dw DoGateDown
:3 dw DoSpecialKey1
:4 dw DoSpecialKey2
:5 dw DoSplat
:6 dw DoMirrorCrack
:7 dw DoLooseCrash
:8 dw DoGotKey
:9 dw DoFootstep
:10 dw DoRaisingExit
:11 dw DoRaisingGate
:12 dw DoLowerGate
:13 dw DoSmackWall
:14 dw DoImpaled
:15 dw DoGateSlam
:16 dw DoFlashMsg
:17 dw DoSwordClash1
:18 dw DoSwordClash2
:19 dw DoJawsClash
endlook
maxaddr = endlook-lookup
*-------------------------------
*
* Z E R O S O U N D
*
* Zero sound table
*
*-------------------------------
ZEROSOUND
lda #0 ;# sounds in table
sta soundtable
rts
*-------------------------------
*
* A D D S O U N D
*
* Add sound to sound table
* (preserve registers)
*
* In: A = sound #
*
*-------------------------------
ADDSOUND
stx savex
ldx soundtable
cpx #maxsfx
bcs :rts ;sound table full
inx
sta soundtable,x
stx soundtable ;# sounds in table
:rts ldx savex
rts
*-------------------------------
*
* P L A Y B A C K
*
* Playback all sounds listed in sound table
*
*-------------------------------
PLAYBACK
lda soundon
beq :rts ;sound switched off?
ldx soundtable
beq :rts ;sound table empty?
:loop lda soundtable,x
stx savex
jsr makesound ;make sound #A
;(may destroy registers)
ldx savex
dex
bne :loop
:rts rts
*-------------------------------
*
* M A K E S O U N D
*
* In: A = sound # (0-127)
*
*-------------------------------
makesound
asl
cmp #maxaddr
bcs :rts ;don't exceed lookup table
tax
lda lookup,x
sta :sm+1
lda lookup+1,x
sta :sm+2
:sm jmp $ffff ;self-modifying code
:rts rts
*-------------------------------
*
* S O U N D R O U T I N E S
*
*-------------------------------
* Kid steps on pressplate
DoPlateDown
ldy #70
ldx #0
lda #4
jmp tone
*-------------------------------
* Pressplate pops back up
DoPlateUp
ldy #90
ldx #0
lda #4
jmp tone
*-------------------------------
* Gate hits stone floor with an ominous CLANG
DoGateDown
ldy #70
ldx #0
lda #4
jmp tone
*-------------------------------
* Jaws clash
DoJawsClash
ldy #10
ldx #0
lda #50
jmp tone
*-------------------------------
* Acknowledge special keypress
SK1Pitch = 15
SK1Dur = 50
SK2Pitch = 40
SK2Dur = 50
DoSpecialKey1
DoSwordClash1
DoSwordClash2
ldy #SK1Pitch
ldx #>SK1Pitch
lda #SK1Dur
jmp tone
DoSpecialKey2
ldy #SK2Pitch
ldx #>SK2Pitch
lda #SK2Dur
jmp tone
*-------------------------------
* Splat
SplatPitch = 1000
SplatDur = 3
DoSplat
ldy #SplatPitch
ldx #>SplatPitch
lda #SplatDur
jmp tone
*-------------------------------
* Mirror Crack
DoMirrorCrack
jmp DoSplat
rts
*-------------------------------
* Loose Floor Crash
DoLooseCrash
jmp DoSplat
*-------------------------------
* Flash message
]HiPitch = 100
]HiDur = 25
]LoPitch = 500
]LoDur = 15
DoGotKey
DoFlashMsg
lda #2
:loop pha
ldy #]LoPitch
ldx #>]LoPitch
lda #]LoDur
jsr tone
ldy #]HiPitch
ldx #>]HiPitch
lda #]HiDur
jsr tone
pla
sec
sbc #1
bne :loop
rts
*-------------------------------
* Footstep
DoFootstep
ldy #35
ldx #0
lda #3
jmp tone
*-------------------------------
* Raising Exit
DoRaisingExit
ldy #40
ldx #0
lda #6
jmp tone
*-------------------------------
* Raising Gate
DoRaisingGate
ldy #20
ldx #0
lda #2
jmp tone
*-------------------------------
* Lowering Gate
DoLowerGate
ldy #7
ldx #0
lda #8
jmp tone
*-------------------------------
* Smack Wall
SWPitch = 1000
SWDur = 3
DoSmackWall
ldy #SWPitch
ldx #>SWPitch
lda #SWDur
jmp tone
]rts rts
*-------------------------------
* Impaled
DoImpaled
jmp DoSmackWall
*-------------------------------
* Gate Slam
DoGateSlam
jmp DoSmackWall
*-------------------------------
*
* T O N E
*
* In: y-x = pitch lo-hi
* a = duration
*
*-------------------------------
tone
sty :pitch
stx :pitch+1
:outloop bit spkr
ldx #0
:midloop ldy #0
:inloop iny
cpy :pitch
bcc :inloop
inx
cpx :pitch+1
bcc :midloop
sec
sbc #1
bne :outloop
rts
:pitch ds 2
*-------------------------------
lst
eof ds 1
usr $a9,20,$e00,*-org
lst off
|
||||
* sound
|
||||
org = $ea00
|
||||
lst off
|
||||
*-------------------------------
|
||||
*
|
||||
* S O U N D
|
||||
*
|
||||
*-------------------------------
|
||||
org org
|
||||
|
||||
jmp PLAYBACK
|
||||
|
||||
*-------------------------------
|
||||
savex ds 1
|
||||
|
||||
spkr = $c030
|
||||
|
||||
*-------------------------------
|
||||
put soundnames
|
||||
put gameeq
|
||||
put eq
|
||||
|
||||
*-------------------------------
|
||||
*
|
||||
* L O O K U P
|
||||
*
|
||||
* Sound routine lookup table
|
||||
*
|
||||
*-------------------------------
|
||||
lookup
|
||||
|
||||
:0 dw DoPlateDown
|
||||
:1 dw DoPlateUp
|
||||
:2 dw DoGateDown
|
||||
:3 dw DoSpecialKey1
|
||||
:4 dw DoSpecialKey2
|
||||
:5 dw DoSplat
|
||||
:6 dw DoMirrorCrack
|
||||
:7 dw DoLooseCrash
|
||||
:8 dw DoGotKey
|
||||
:9 dw DoFootstep
|
||||
:10 dw DoRaisingExit
|
||||
:11 dw DoRaisingGate
|
||||
:12 dw DoLowerGate
|
||||
:13 dw DoSmackWall
|
||||
:14 dw DoImpaled
|
||||
:15 dw DoGateSlam
|
||||
:16 dw DoFlashMsg
|
||||
:17 dw DoSwordClash1
|
||||
:18 dw DoSwordClash2
|
||||
:19 dw DoJawsClash
|
||||
|
||||
endlook
|
||||
|
||||
maxaddr = endlook-lookup
|
||||
|
||||
*-------------------------------
|
||||
*
|
||||
* Z E R O S O U N D
|
||||
*
|
||||
* Zero sound table
|
||||
*
|
||||
*-------------------------------
|
||||
ZEROSOUND
|
||||
lda #0 ;# sounds in table
|
||||
sta soundtable
|
||||
rts
|
||||
|
||||
*-------------------------------
|
||||
*
|
||||
* A D D S O U N D
|
||||
*
|
||||
* Add sound to sound table
|
||||
* (preserve registers)
|
||||
*
|
||||
* In: A = sound #
|
||||
*
|
||||
*-------------------------------
|
||||
ADDSOUND
|
||||
stx savex
|
||||
|
||||
ldx soundtable
|
||||
cpx #maxsfx
|
||||
bcs :rts ;sound table full
|
||||
|
||||
inx
|
||||
sta soundtable,x
|
||||
stx soundtable ;# sounds in table
|
||||
|
||||
:rts ldx savex
|
||||
rts
|
||||
|
||||
*-------------------------------
|
||||
*
|
||||
* P L A Y B A C K
|
||||
*
|
||||
* Playback all sounds listed in sound table
|
||||
*
|
||||
*-------------------------------
|
||||
PLAYBACK
|
||||
lda soundon
|
||||
beq :rts ;sound switched off?
|
||||
|
||||
ldx soundtable
|
||||
beq :rts ;sound table empty?
|
||||
|
||||
:loop lda soundtable,x
|
||||
|
||||
stx savex
|
||||
|
||||
jsr makesound ;make sound #A
|
||||
;(may destroy registers)
|
||||
ldx savex
|
||||
|
||||
dex
|
||||
bne :loop
|
||||
|
||||
:rts rts
|
||||
|
||||
*-------------------------------
|
||||
*
|
||||
* M A K E S O U N D
|
||||
*
|
||||
* In: A = sound # (0-127)
|
||||
*
|
||||
*-------------------------------
|
||||
makesound
|
||||
asl
|
||||
cmp #maxaddr
|
||||
bcs :rts ;don't exceed lookup table
|
||||
|
||||
tax
|
||||
lda lookup,x
|
||||
sta :sm+1
|
||||
lda lookup+1,x
|
||||
sta :sm+2
|
||||
|
||||
:sm jmp $ffff ;self-modifying code
|
||||
|
||||
:rts rts
|
||||
|
||||
*-------------------------------
|
||||
*
|
||||
* S O U N D R O U T I N E S
|
||||
*
|
||||
*-------------------------------
|
||||
* Kid steps on pressplate
|
||||
|
||||
DoPlateDown
|
||||
ldy #70
|
||||
ldx #0
|
||||
lda #4
|
||||
jmp tone
|
||||
|
||||
*-------------------------------
|
||||
* Pressplate pops back up
|
||||
|
||||
DoPlateUp
|
||||
ldy #90
|
||||
ldx #0
|
||||
lda #4
|
||||
jmp tone
|
||||
|
||||
*-------------------------------
|
||||
* Gate hits stone floor with an ominous CLANG
|
||||
|
||||
DoGateDown
|
||||
ldy #70
|
||||
ldx #0
|
||||
lda #4
|
||||
jmp tone
|
||||
|
||||
*-------------------------------
|
||||
* Jaws clash
|
||||
|
||||
DoJawsClash
|
||||
ldy #10
|
||||
ldx #0
|
||||
lda #50
|
||||
jmp tone
|
||||
|
||||
*-------------------------------
|
||||
* Acknowledge special keypress
|
||||
|
||||
SK1Pitch = 15
|
||||
SK1Dur = 50
|
||||
|
||||
SK2Pitch = 40
|
||||
SK2Dur = 50
|
||||
|
||||
DoSpecialKey1
|
||||
DoSwordClash1
|
||||
DoSwordClash2
|
||||
ldy #SK1Pitch
|
||||
ldx #>SK1Pitch
|
||||
lda #SK1Dur
|
||||
jmp tone
|
||||
|
||||
DoSpecialKey2
|
||||
ldy #SK2Pitch
|
||||
ldx #>SK2Pitch
|
||||
lda #SK2Dur
|
||||
jmp tone
|
||||
|
||||
*-------------------------------
|
||||
* Splat
|
||||
|
||||
SplatPitch = 1000
|
||||
SplatDur = 3
|
||||
|
||||
DoSplat
|
||||
ldy #SplatPitch
|
||||
ldx #>SplatPitch
|
||||
lda #SplatDur
|
||||
jmp tone
|
||||
|
||||
*-------------------------------
|
||||
* Mirror Crack
|
||||
|
||||
DoMirrorCrack
|
||||
jmp DoSplat
|
||||
rts
|
||||
|
||||
*-------------------------------
|
||||
* Loose Floor Crash
|
||||
|
||||
DoLooseCrash
|
||||
jmp DoSplat
|
||||
|
||||
*-------------------------------
|
||||
* Flash message
|
||||
|
||||
]HiPitch = 100
|
||||
]HiDur = 25
|
||||
]LoPitch = 500
|
||||
]LoDur = 15
|
||||
|
||||
DoGotKey
|
||||
DoFlashMsg
|
||||
lda #2
|
||||
:loop pha
|
||||
|
||||
ldy #]LoPitch
|
||||
ldx #>]LoPitch
|
||||
lda #]LoDur
|
||||
jsr tone
|
||||
|
||||
ldy #]HiPitch
|
||||
ldx #>]HiPitch
|
||||
lda #]HiDur
|
||||
jsr tone
|
||||
|
||||
pla
|
||||
sec
|
||||
sbc #1
|
||||
bne :loop
|
||||
|
||||
rts
|
||||
|
||||
*-------------------------------
|
||||
* Footstep
|
||||
|
||||
DoFootstep
|
||||
ldy #35
|
||||
ldx #0
|
||||
lda #3
|
||||
jmp tone
|
||||
|
||||
*-------------------------------
|
||||
* Raising Exit
|
||||
|
||||
DoRaisingExit
|
||||
ldy #40
|
||||
ldx #0
|
||||
lda #6
|
||||
jmp tone
|
||||
|
||||
*-------------------------------
|
||||
* Raising Gate
|
||||
|
||||
DoRaisingGate
|
||||
ldy #20
|
||||
ldx #0
|
||||
lda #2
|
||||
jmp tone
|
||||
|
||||
*-------------------------------
|
||||
* Lowering Gate
|
||||
|
||||
DoLowerGate
|
||||
ldy #7
|
||||
ldx #0
|
||||
lda #8
|
||||
jmp tone
|
||||
|
||||
*-------------------------------
|
||||
* Smack Wall
|
||||
|
||||
SWPitch = 1000
|
||||
SWDur = 3
|
||||
|
||||
DoSmackWall
|
||||
ldy #SWPitch
|
||||
ldx #>SWPitch
|
||||
lda #SWDur
|
||||
jmp tone
|
||||
|
||||
]rts rts
|
||||
|
||||
*-------------------------------
|
||||
* Impaled
|
||||
|
||||
DoImpaled
|
||||
jmp DoSmackWall
|
||||
|
||||
*-------------------------------
|
||||
* Gate Slam
|
||||
|
||||
DoGateSlam
|
||||
jmp DoSmackWall
|
||||
|
||||
|
||||
*-------------------------------
|
||||
*
|
||||
* T O N E
|
||||
*
|
||||
* In: y-x = pitch lo-hi
|
||||
* a = duration
|
||||
*
|
||||
*-------------------------------
|
||||
tone
|
||||
sty :pitch
|
||||
stx :pitch+1
|
||||
|
||||
:outloop bit spkr
|
||||
|
||||
ldx #0
|
||||
:midloop ldy #0
|
||||
|
||||
:inloop iny
|
||||
cpy :pitch
|
||||
bcc :inloop
|
||||
|
||||
inx
|
||||
cpx :pitch+1
|
||||
bcc :midloop
|
||||
|
||||
sec
|
||||
sbc #1
|
||||
bne :outloop
|
||||
|
||||
rts
|
||||
|
||||
:pitch ds 2
|
||||
|
||||
*-------------------------------
|
||||
lst
|
||||
eof ds 1
|
||||
usr $a9,20,$e00,*-org
|
||||
lst off
|
||||
|
|
|
@ -1 +1,56 @@
|
|||
tr on
lst off
* sound names
PlateDown = 0
PlateUp = 1
GateDown = 2
SpecialKey1 = 3
SpecialKey2 = 4
Splat = 5
MirrorCrack = 6
LooseCrash = 7
GotKey = 8
Footstep = 9
RaisingExit = 10
RaisingGate = 11
LoweringGate = 12
SmackWall = 13
Impaled = 14
GateSlam = 15
FlashMsg = 16
SwordClash1 = 17
SwordClash2 = 18
JawsClash = 19
*-------------------------------
* game music
s_Accid = 1
s_Heroic = 2
s_Danger = 3
s_Sword = 4
s_Rejoin = 5
s_Shadow = 6
s_Vict = 7
s_Stairs = 8
s_Upstairs = 9
s_Jaffar = 10
s_Potion = 11
s_ShortPot = 12
s_Timer = 13
s_Tragic = 14
s_Embrace = 15
s_Heartbeat = 16
* title music
s_Princess = 7
s_Squeek = 8
s_Vizier = 9
s_Buildup = 10
s_Magic = 11
s_StTimer = 12
lst off
|
||||
tr on
|
||||
lst off
|
||||
|
||||
* sound names
|
||||
|
||||
PlateDown = 0
|
||||
PlateUp = 1
|
||||
GateDown = 2
|
||||
SpecialKey1 = 3
|
||||
SpecialKey2 = 4
|
||||
Splat = 5
|
||||
MirrorCrack = 6
|
||||
LooseCrash = 7
|
||||
GotKey = 8
|
||||
Footstep = 9
|
||||
RaisingExit = 10
|
||||
RaisingGate = 11
|
||||
LoweringGate = 12
|
||||
SmackWall = 13
|
||||
Impaled = 14
|
||||
GateSlam = 15
|
||||
FlashMsg = 16
|
||||
SwordClash1 = 17
|
||||
SwordClash2 = 18
|
||||
JawsClash = 19
|
||||
|
||||
*-------------------------------
|
||||
* game music
|
||||
|
||||
s_Accid = 1
|
||||
s_Heroic = 2
|
||||
s_Danger = 3
|
||||
s_Sword = 4
|
||||
s_Rejoin = 5
|
||||
s_Shadow = 6
|
||||
s_Vict = 7
|
||||
s_Stairs = 8
|
||||
s_Upstairs = 9
|
||||
s_Jaffar = 10
|
||||
s_Potion = 11
|
||||
s_ShortPot = 12
|
||||
s_Timer = 13
|
||||
s_Tragic = 14
|
||||
s_Embrace = 15
|
||||
s_Heartbeat = 16
|
||||
|
||||
* title music
|
||||
|
||||
s_Princess = 7
|
||||
s_Squeek = 8
|
||||
s_Vizier = 9
|
||||
s_Buildup = 10
|
||||
s_Magic = 11
|
||||
s_StTimer = 12
|
||||
|
||||
lst off
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1,200 @@
|
|||
* tables
org = $e00
tr on
lst off
*-------------------------------
*
* PRINCE OF PERSIA
* Copyright 1989 Jordan Mechner
*
*-------------------------------
dum org
ByteTable ds $100
OffsetTable ds $100
BlockTable ds $100
PixelTable ds $100
Mult10 ds $10
Mult7 ds $10
Mult30 ds $40
BlockEdge ds 20
BlockTop ds 5
BlockBot ds 5
FloorY ds 5
BlockAy ds 5
dend
*-------------------------------
org org
*-------------------------------
ScrnLeft = 58
ScrnTop = 0
ScrnBot = 191
VertDist = 10 ;from bottom of block to center plane
BlockHeight = 63
DHeight = 3 ;floorpiece thickness
Blox1 = BlockHeight
Blox2 = 2*BlockHeight
Blox3 = 3*BlockHeight
Blox4 = 4*BlockHeight
*-------------------------------
* ByteTable
*
* Index: Real screen X-coord (0-255)
* Yields: Byte # (0-36)
*-------------------------------
ds ByteTable-*
]byte = 0
lup 36
db ]byte,]byte,]byte,]byte,]byte,]byte,]byte
]byte = ]byte+1
--^
db 36,36,36,36
*-------------------------------
* OffsetTable
*
* Index: Same as ByteTable
* Yields: Offset (0-6)
*-------------------------------
ds OffsetTable-*
lup 36
db 0,1,2,3,4,5,6
--^
db 0,1,2,3
*-------------------------------
* BlockTable
*
* Index: Screen X-coord (0 to 255)
* Yields: Block # (-5 to 14)
*-------------------------------
ds BlockTable-*
]byte = -5
db ]byte,]byte
lup 18
]byte = ]byte+1
db ]byte,]byte,]byte,]byte,]byte,]byte,]byte
db ]byte,]byte,]byte,]byte,]byte,]byte,]byte
--^
]byte = ]byte+1
db ]byte,]byte
*-------------------------------
* PixelTable
*
* Index: Same as BlockTable
* Yields: Pixel # within block (0 to 13)
*-------------------------------
ds PixelTable-*
db 12,13
lup 18
db 0,1,2,3,4,5,6,7,8,9,10,11,12,13
--^
db 0,1
*-------------------------------
* Mult10
*-------------------------------
ds Mult10-*
]byte = 0
lup 16
db ]byte
]byte = ]byte+10
--^
*-------------------------------
* Mult7
*-------------------------------
ds Mult7-*
]byte = 0
lup 16
db ]byte
]byte = ]byte+7
--^
*-------------------------------
* Mult30
*-------------------------------
ds Mult30-*
]word = 0
lup 32
dw ]word
]word = ]word+30
--^
*-------------------------------
* BlockEdge
*
* Index: Block X (-5 to 14) + 5
* Yields: Screen X-coord of left edge of block
*-------------------------------
ds BlockEdge-*
]byte = -12
lup 20
db ]byte
]byte = ]byte+14
--^
*-------------------------------
* BlockTop, BlockBot, FloorY
*
* Index: Block Y (-1 to 3) + 1
ds BlockTop-*
db ScrnBot+1-Blox4
db ScrnBot+1-Blox3
db ScrnBot+1-Blox2
db ScrnBot+1-Blox1
db ScrnBot+1
*-------------------------------
ds BlockBot-*
db ScrnBot-Blox3
db ScrnBot-Blox2
db ScrnBot-Blox1
db ScrnBot
db ScrnBot+Blox1
*-------------------------------
ds FloorY-*
db ScrnBot-Blox3-VertDist
db ScrnBot-Blox2-VertDist
db ScrnBot-Blox1-VertDist
db ScrnBot-VertDist
db ScrnBot+Blox1-VertDist
*-------------------------------
ds BlockAy-*
db ScrnBot-Blox3-DHeight
db ScrnBot-Blox2-DHeight
db ScrnBot-Blox1-DHeight
db ScrnBot-DHeight
db ScrnBot+Blox1-DHeight
*-------------------------------
lst
eof ds 1
usr $a9,3,$000,*-org
lst off
|
||||
* tables
|
||||
org = $e00
|
||||
tr on
|
||||
lst off
|
||||
*-------------------------------
|
||||
*
|
||||
* PRINCE OF PERSIA
|
||||
* Copyright 1989 Jordan Mechner
|
||||
*
|
||||
*-------------------------------
|
||||
dum org
|
||||
|
||||
ByteTable ds $100
|
||||
OffsetTable ds $100
|
||||
BlockTable ds $100
|
||||
PixelTable ds $100
|
||||
Mult10 ds $10
|
||||
Mult7 ds $10
|
||||
Mult30 ds $40
|
||||
|
||||
BlockEdge ds 20
|
||||
BlockTop ds 5
|
||||
BlockBot ds 5
|
||||
FloorY ds 5
|
||||
BlockAy ds 5
|
||||
|
||||
dend
|
||||
*-------------------------------
|
||||
org org
|
||||
*-------------------------------
|
||||
ScrnLeft = 58
|
||||
ScrnTop = 0
|
||||
ScrnBot = 191
|
||||
|
||||
VertDist = 10 ;from bottom of block to center plane
|
||||
BlockHeight = 63
|
||||
DHeight = 3 ;floorpiece thickness
|
||||
|
||||
Blox1 = BlockHeight
|
||||
Blox2 = 2*BlockHeight
|
||||
Blox3 = 3*BlockHeight
|
||||
Blox4 = 4*BlockHeight
|
||||
|
||||
*-------------------------------
|
||||
* ByteTable
|
||||
*
|
||||
* Index: Real screen X-coord (0-255)
|
||||
* Yields: Byte # (0-36)
|
||||
*-------------------------------
|
||||
|
||||
ds ByteTable-*
|
||||
|
||||
]byte = 0
|
||||
lup 36
|
||||
db ]byte,]byte,]byte,]byte,]byte,]byte,]byte
|
||||
]byte = ]byte+1
|
||||
--^
|
||||
db 36,36,36,36
|
||||
|
||||
*-------------------------------
|
||||
* OffsetTable
|
||||
*
|
||||
* Index: Same as ByteTable
|
||||
* Yields: Offset (0-6)
|
||||
*-------------------------------
|
||||
ds OffsetTable-*
|
||||
|
||||
lup 36
|
||||
db 0,1,2,3,4,5,6
|
||||
--^
|
||||
db 0,1,2,3
|
||||
|
||||
*-------------------------------
|
||||
* BlockTable
|
||||
*
|
||||
* Index: Screen X-coord (0 to 255)
|
||||
* Yields: Block # (-5 to 14)
|
||||
*-------------------------------
|
||||
ds BlockTable-*
|
||||
|
||||
]byte = -5
|
||||
db ]byte,]byte
|
||||
|
||||
lup 18
|
||||
]byte = ]byte+1
|
||||
db ]byte,]byte,]byte,]byte,]byte,]byte,]byte
|
||||
db ]byte,]byte,]byte,]byte,]byte,]byte,]byte
|
||||
--^
|
||||
|
||||
]byte = ]byte+1
|
||||
db ]byte,]byte
|
||||
|
||||
*-------------------------------
|
||||
* PixelTable
|
||||
*
|
||||
* Index: Same as BlockTable
|
||||
* Yields: Pixel # within block (0 to 13)
|
||||
*-------------------------------
|
||||
ds PixelTable-*
|
||||
|
||||
db 12,13
|
||||
|
||||
lup 18
|
||||
db 0,1,2,3,4,5,6,7,8,9,10,11,12,13
|
||||
--^
|
||||
|
||||
db 0,1
|
||||
|
||||
*-------------------------------
|
||||
* Mult10
|
||||
*-------------------------------
|
||||
ds Mult10-*
|
||||
|
||||
]byte = 0
|
||||
lup 16
|
||||
db ]byte
|
||||
]byte = ]byte+10
|
||||
--^
|
||||
|
||||
*-------------------------------
|
||||
* Mult7
|
||||
*-------------------------------
|
||||
ds Mult7-*
|
||||
|
||||
]byte = 0
|
||||
lup 16
|
||||
db ]byte
|
||||
]byte = ]byte+7
|
||||
--^
|
||||
|
||||
*-------------------------------
|
||||
* Mult30
|
||||
*-------------------------------
|
||||
ds Mult30-*
|
||||
|
||||
]word = 0
|
||||
lup 32
|
||||
dw ]word
|
||||
]word = ]word+30
|
||||
--^
|
||||
|
||||
*-------------------------------
|
||||
* BlockEdge
|
||||
*
|
||||
* Index: Block X (-5 to 14) + 5
|
||||
* Yields: Screen X-coord of left edge of block
|
||||
*-------------------------------
|
||||
ds BlockEdge-*
|
||||
|
||||
]byte = -12
|
||||
lup 20
|
||||
db ]byte
|
||||
]byte = ]byte+14
|
||||
--^
|
||||
|
||||
*-------------------------------
|
||||
* BlockTop, BlockBot, FloorY
|
||||
*
|
||||
* Index: Block Y (-1 to 3) + 1
|
||||
|
||||
ds BlockTop-*
|
||||
|
||||
db ScrnBot+1-Blox4
|
||||
db ScrnBot+1-Blox3
|
||||
db ScrnBot+1-Blox2
|
||||
db ScrnBot+1-Blox1
|
||||
db ScrnBot+1
|
||||
|
||||
*-------------------------------
|
||||
ds BlockBot-*
|
||||
|
||||
db ScrnBot-Blox3
|
||||
db ScrnBot-Blox2
|
||||
db ScrnBot-Blox1
|
||||
db ScrnBot
|
||||
db ScrnBot+Blox1
|
||||
|
||||
*-------------------------------
|
||||
ds FloorY-*
|
||||
|
||||
db ScrnBot-Blox3-VertDist
|
||||
db ScrnBot-Blox2-VertDist
|
||||
db ScrnBot-Blox1-VertDist
|
||||
db ScrnBot-VertDist
|
||||
db ScrnBot+Blox1-VertDist
|
||||
|
||||
*-------------------------------
|
||||
ds BlockAy-*
|
||||
|
||||
db ScrnBot-Blox3-DHeight
|
||||
db ScrnBot-Blox2-DHeight
|
||||
db ScrnBot-Blox1-DHeight
|
||||
db ScrnBot-DHeight
|
||||
db ScrnBot+Blox1-DHeight
|
||||
|
||||
*-------------------------------
|
||||
lst
|
||||
eof ds 1
|
||||
usr $a9,3,$000,*-org
|
||||
lst off
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1,14 @@
|
|||
* version
org = $dfd8
lst off
org org
*-------------------------------
TextLine asc "Prince of Persia 1.0 9/7/89"
lst
asc "@"
*-------------------------------
usr $a9,19,$11d8,*-org
lst off
|
||||
* version
|
||||
org = $dfd8
|
||||
lst off
|
||||
|
||||
org org
|
||||
|
||||
*-------------------------------
|
||||
|
||||
TextLine asc "Prince of Persia 1.0 9/7/89"
|
||||
lst
|
||||
asc "@"
|
||||
*-------------------------------
|
||||
usr $a9,19,$11d8,*-org
|
||||
lst off
|
||||
|
|
|
@ -1 +1,174 @@
|
|||
lst off
*------------------------------------------------- rotcube
mainYoffset = 46 ;(192-60)/2
botYoffset = 72
mainXoffset = 68 ;(280-144)/2
color = $E4
page = $E6
dum 0
index ds 1
ysave ds 1
yadd ds 1
yoffset ds 1
dend
*-------------------------------------------------
rotcube jsr $f3e2 ;hgr
jsr $f3d8 ;hgr2
lda #1
sta yadd
sta yoffset
* Draw on page not showing:
mainloop lda page
eor #$60
sta page
ldx #$7F
jsr draw
* If not a //c, then wait for vbl
lda $FBC0
beq :is2c
lda $C019
bpl *-3
lda $C019
bmi *-3
:is2c
* Now display that page
bit $C054
lda page
cmp #$20
beq *+5
bit $C055
* Now erase old image from last page
eor #$60
sta :smc0+2
sta :smc1+2
ldx #$20
lda #0
:loop tay
:smc0 sta $2000,y
:smc1 sta $2080,y
iny
bpl :smc0
inc :smc0+2
inc :smc1+2
dex
bne :loop
inc index
jmp mainloop
*-------------------------------------------------
draw stx color
ldy #12-1
:drawloop lda drawlist,y
sty ysave
pha
and #15
jsr getpoint
tax
tya
ldy #0
jsr $f457 ;plot
pla
lsr
lsr
lsr
lsr
jsr getpoint
ldx #0
jsr $f53a ;lineto
ldy ysave
dey
bpl :drawloop
lda yoffset
clc
adc yadd
bne :not0
inc yadd ;make +1
inc yadd
:not0 cmp #191-48-botYoffset
bcc :0
dec yadd ;make -1
dec yadd
:0 sta yoffset
rts
*-------------------------------------------------
*
* given a = point number, return a = xcoor, y = ycoor
*
getpoint tay
* Get index into tables
asl ;*16
asl
asl
asl
adc index
and #$3F
tax
tya
and #4 ;bottom?
cmp #4
* Compute ycoor
lda ydata,x
bcc :not_bot
adc #botYoffset-1
:not_bot adc yoffset
tay
* Compute xcoor
lda xdata,x
adc #mainXoffset
rts
*-------------------------------------------------
drawlist hex 01122330 ;draw top
hex 45566774 ;draw bottom
hex 04152637 ;draw connecting lines
xdata hex 908F8E8C8A87837F7A757069635C564F
hex 484039332C261F1A15100C0805030100
hex 0000010305080C10151A1F262C333940
hex 474F565C636970757A7F83878A8C8E8F
ydata hex 181A1C1E21232527282A2B2D2E2E2F2F
hex 2F2F2F2E2E2D2B2A28272523211E1C1A
hex 181513110E0C0A080705040201010000
hex 000000010102040507080A0C0E111315
*-------------------------------------------------
|
||||
lst off
|
||||
|
||||
*------------------------------------------------- rotcube
|
||||
|
||||
mainYoffset = 46 ;(192-60)/2
|
||||
botYoffset = 72
|
||||
mainXoffset = 68 ;(280-144)/2
|
||||
|
||||
color = $E4
|
||||
page = $E6
|
||||
|
||||
dum 0
|
||||
index ds 1
|
||||
ysave ds 1
|
||||
yadd ds 1
|
||||
yoffset ds 1
|
||||
dend
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
rotcube jsr $f3e2 ;hgr
|
||||
jsr $f3d8 ;hgr2
|
||||
|
||||
lda #1
|
||||
sta yadd
|
||||
|
||||
sta yoffset
|
||||
|
||||
* Draw on page not showing:
|
||||
|
||||
mainloop lda page
|
||||
eor #$60
|
||||
sta page
|
||||
ldx #$7F
|
||||
jsr draw
|
||||
|
||||
* If not a //c, then wait for vbl
|
||||
|
||||
lda $FBC0
|
||||
beq :is2c
|
||||
lda $C019
|
||||
bpl *-3
|
||||
lda $C019
|
||||
bmi *-3
|
||||
:is2c
|
||||
|
||||
* Now display that page
|
||||
|
||||
bit $C054
|
||||
lda page
|
||||
cmp #$20
|
||||
beq *+5
|
||||
bit $C055
|
||||
|
||||
* Now erase old image from last page
|
||||
|
||||
eor #$60
|
||||
sta :smc0+2
|
||||
sta :smc1+2
|
||||
ldx #$20
|
||||
lda #0
|
||||
:loop tay
|
||||
:smc0 sta $2000,y
|
||||
:smc1 sta $2080,y
|
||||
iny
|
||||
bpl :smc0
|
||||
inc :smc0+2
|
||||
inc :smc1+2
|
||||
dex
|
||||
bne :loop
|
||||
|
||||
inc index
|
||||
jmp mainloop
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
draw stx color
|
||||
|
||||
ldy #12-1
|
||||
:drawloop lda drawlist,y
|
||||
sty ysave
|
||||
|
||||
pha
|
||||
and #15
|
||||
jsr getpoint
|
||||
|
||||
tax
|
||||
tya
|
||||
ldy #0
|
||||
jsr $f457 ;plot
|
||||
|
||||
pla
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
jsr getpoint
|
||||
ldx #0
|
||||
jsr $f53a ;lineto
|
||||
|
||||
ldy ysave
|
||||
dey
|
||||
bpl :drawloop
|
||||
|
||||
lda yoffset
|
||||
clc
|
||||
adc yadd
|
||||
bne :not0
|
||||
|
||||
inc yadd ;make +1
|
||||
inc yadd
|
||||
|
||||
:not0 cmp #191-48-botYoffset
|
||||
bcc :0
|
||||
|
||||
dec yadd ;make -1
|
||||
dec yadd
|
||||
|
||||
:0 sta yoffset
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* given a = point number, return a = xcoor, y = ycoor
|
||||
*
|
||||
|
||||
getpoint tay
|
||||
|
||||
* Get index into tables
|
||||
|
||||
asl ;*16
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
adc index
|
||||
and #$3F
|
||||
tax
|
||||
tya
|
||||
|
||||
and #4 ;bottom?
|
||||
cmp #4
|
||||
|
||||
* Compute ycoor
|
||||
|
||||
lda ydata,x
|
||||
bcc :not_bot
|
||||
adc #botYoffset-1
|
||||
|
||||
:not_bot adc yoffset
|
||||
tay
|
||||
|
||||
* Compute xcoor
|
||||
|
||||
lda xdata,x
|
||||
adc #mainXoffset
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
drawlist hex 01122330 ;draw top
|
||||
hex 45566774 ;draw bottom
|
||||
hex 04152637 ;draw connecting lines
|
||||
|
||||
xdata hex 908F8E8C8A87837F7A757069635C564F
|
||||
hex 484039332C261F1A15100C0805030100
|
||||
hex 0000010305080C10151A1F262C333940
|
||||
hex 474F565C636970757A7F83878A8C8E8F
|
||||
|
||||
ydata hex 181A1C1E21232527282A2B2D2E2E2F2F
|
||||
hex 2F2F2F2E2E2D2B2A28272523211E1C1A
|
||||
hex 181513110E0C0A080705040201010000
|
||||
hex 000000010102040507080A0C0E111315
|
||||
|
||||
*-------------------------------------------------
|
||||
|
|
|
@ -1 +1,371 @@
|
|||
lst off
org $c00
*-------------------------------------------------
dum 0
curpage ds 1
xsave ds 1
ysave ds 1
asave ds 1
temp ds 1
tmplo ds 1
tmphi ds 1
level ds 1
isGS? ds 1
dend
framebase = $1000
*------------------------------------------------- show
*
* put on the show!
*
show bit $C010
lda #0
sta isGS?
bit $C081
sec
jsr $fe1f ;GS?
bcs :notGS
inc isGS?
* Use special show frame routine for //GS that
* writes directly to bank $E0, since page two
* text is not properly shadowed to that bank.
ldx #$4C ;jmp
ldy #GSshowframe
lda #>GSshowframe
stx showframe
sty showframe+1
sta showframe+2
* Make our lookup tables up in ramcard area
:notGS bit $C083
bit $C083
jsr MAKEfade_tbls
jsr lgr
:again
ldx #0
:fadein stx level
lda #0
jsr showframe
ldx level
inx
cpx #15
bcc :fadein
* Here we go...
lda #0
:floop pha
ldx #15
jsr showframe
pla
clc
adc #1
cmp #23
bcc :floop
ldx #15
:fadeout stx level
lda #22
jsr showframe
ldx level
dex
bpl :fadeout
bit $C000
bpl *-3
bit $C010
jmp :again
*------------------------------------------------- lgr
*
* Clear and display lo-resolution screen
*
lgr sta $C000 ;turn off 55.54 select
sta $C00C ;40 columns
bit $C052 ;full screen
bit $C055 ;show page two
bit $C056 ;lores
bit $C050 ;graphics on
lda #4 ;use page one next
sta curpage
ldy #0
sty tmplo
sta tmphi
tya
ldx #8
:0 sta (tmplo),y
iny
bne :0
inc tmphi
dex
bne :0
rts
*------------------------------------------------- loget
*
* Enter with a:frame number
* x:fade level
*
showframe asl
asl
adc #>framebase
sta :src+2 ;hi byte
txa
ora #>fade_table
sta :fademod+2
lda curpage
sta :dst+2
eor #4!8
sta curpage
lda #4
sta temp
ldx #0
:loop
:src ldy $1100,x
:fademod lda fade_table+$F00,y
:dst sta $0400,x
inx
bne :loop
inc :src+2 ;hibyte
inc :dst+2 ; " "
dec temp
bne :loop
]waitvbl jsr waitvbl
bit $C055
lda curpage
cmp #4
beq *+5
bit $C054
rts
GSshowframe asl
asl
adc #>framebase
sta :src+2 ;hi byte
txa
ora #>fade_table
sta :fademod+2
lda curpage
sta :dst+2
eor #4!8
sta curpage
lda #4
sta temp
ldx #0
:loop
:src ldy $1100,x
:fademod lda fade_table+$F00,y
:dst stal $E00400,x
inx
bne :loop
inc :src+2 ;hibyte
inc :dst+2 ; " "
dec temp
bne :loop
beq ]waitvbl
*------------------------------------------------- waitvbl
*
* Wait for a few vbl's to go by!
*
waitvbl ldx #6
:0 bit $C019
bpl :0
:1 bit $C019
bmi :1
dex
bne :0
rts
*------------------------------------------------- MAKEfade_tbls
*
* Make 16 lookup tables each containing 256 bytes
* for the 16 levels of fade-in.
*
MAKEfade_tbls dum 0
:curtmp ds 2 ;ptr into current tmp_scale table
:curfade ds 2 ;ptr into current page of fade table
:temp ds 1
:ysave ds 1
dend
jsr MAKEtmp_scale
ldy #tmp_scale
lda #>tmp_scale
sty :curtmp
sta :curtmp+1
ldy #fade_table
lda #>fade_table
sty :curfade
sta :curfade+1
* byte loop
ldy #0
:bloop tya
and #$0F
jsr :convert
sta :temp
tya
lsr
lsr
lsr
lsr
jsr :convert
asl
asl
asl
asl
ora :temp
sta (:curfade),y
iny
bne :bloop
* next fade table
inc :curfade+1
* next tmp table
clc
lda :curtmp
adc #16
sta :curtmp
bcc :bloop
rts
* given a=0-15, in lores unsequential grey scale,
* convert it back to sequential, lookup new value
* in tmp_scale table and then convert back to
* lores unsequential.
:convert sty :ysave
* Convert lores color back to sequential 00-0F
tax
lda :unlores,x
* Scale it
tay
lda (:curtmp),y
* Convert back to unsequential lores color
tax
lda isGS?
beq :notGS
lda :loresGS,x
bra :isGS
:notGS lda :lores2e,x
:isGS ldy :ysave
rts
:unlores hex 000301070405020a
hex 06080b0c090e0d0f
:loresGS hex 0002060104050803
hex 090c070a0b0e0d0f
:lores2e hex 00000000
hex 02020202
hex 06060606
hex 07070707
*------------------------------------------------- MAKEtmp_scale
*
* Make lookup table that contains values
* for 0-15 multiplied by 1/16... 16/16.
*
MAKEtmp_scale dum 0
:color ds 1
:scale ds 1
dend
lda #1 ;start with 1/16th
sta :scale
:sloop ldy #0
:cloop sty :color
lda #0
ldx :scale
:mloop clc
adc :color
dex
bne :mloop
lsr
lsr
lsr
lsr
:smc sta tmp_scale,y
iny
cpy #16
bne :cloop
inc :scale
lda :smc+1
clc
adc #16
sta :smc+1
bcc :sloop
rts
*-------------------------------------------------
dum $D000
fade_table ds $1000
tmp_scale ds $100
dend
*------------------------------------------------- EOF
|
||||
lst off
|
||||
|
||||
org $c00
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
dum 0
|
||||
curpage ds 1
|
||||
xsave ds 1
|
||||
ysave ds 1
|
||||
asave ds 1
|
||||
temp ds 1
|
||||
tmplo ds 1
|
||||
tmphi ds 1
|
||||
level ds 1
|
||||
isGS? ds 1
|
||||
dend
|
||||
|
||||
framebase = $1000
|
||||
|
||||
*------------------------------------------------- show
|
||||
*
|
||||
* put on the show!
|
||||
*
|
||||
|
||||
show bit $C010
|
||||
|
||||
lda #0
|
||||
sta isGS?
|
||||
|
||||
bit $C081
|
||||
sec
|
||||
jsr $fe1f ;GS?
|
||||
bcs :notGS
|
||||
|
||||
inc isGS?
|
||||
|
||||
* Use special show frame routine for //GS that
|
||||
* writes directly to bank $E0, since page two
|
||||
* text is not properly shadowed to that bank.
|
||||
|
||||
ldx #$4C ;jmp
|
||||
ldy #GSshowframe
|
||||
lda #>GSshowframe
|
||||
stx showframe
|
||||
sty showframe+1
|
||||
sta showframe+2
|
||||
|
||||
* Make our lookup tables up in ramcard area
|
||||
|
||||
:notGS bit $C083
|
||||
bit $C083
|
||||
|
||||
jsr MAKEfade_tbls
|
||||
|
||||
jsr lgr
|
||||
|
||||
:again
|
||||
|
||||
ldx #0
|
||||
:fadein stx level
|
||||
lda #0
|
||||
jsr showframe
|
||||
ldx level
|
||||
inx
|
||||
cpx #15
|
||||
bcc :fadein
|
||||
|
||||
* Here we go...
|
||||
|
||||
lda #0
|
||||
:floop pha
|
||||
ldx #15
|
||||
jsr showframe
|
||||
pla
|
||||
clc
|
||||
adc #1
|
||||
cmp #23
|
||||
bcc :floop
|
||||
|
||||
ldx #15
|
||||
:fadeout stx level
|
||||
lda #22
|
||||
jsr showframe
|
||||
ldx level
|
||||
dex
|
||||
bpl :fadeout
|
||||
|
||||
bit $C000
|
||||
bpl *-3
|
||||
bit $C010
|
||||
|
||||
jmp :again
|
||||
|
||||
*------------------------------------------------- lgr
|
||||
*
|
||||
* Clear and display lo-resolution screen
|
||||
*
|
||||
|
||||
lgr sta $C000 ;turn off 55.54 select
|
||||
sta $C00C ;40 columns
|
||||
bit $C052 ;full screen
|
||||
bit $C055 ;show page two
|
||||
bit $C056 ;lores
|
||||
bit $C050 ;graphics on
|
||||
|
||||
lda #4 ;use page one next
|
||||
sta curpage
|
||||
|
||||
ldy #0
|
||||
sty tmplo
|
||||
sta tmphi
|
||||
|
||||
tya
|
||||
ldx #8
|
||||
|
||||
:0 sta (tmplo),y
|
||||
iny
|
||||
bne :0
|
||||
|
||||
inc tmphi
|
||||
dex
|
||||
bne :0
|
||||
|
||||
rts
|
||||
|
||||
*------------------------------------------------- loget
|
||||
*
|
||||
* Enter with a:frame number
|
||||
* x:fade level
|
||||
*
|
||||
|
||||
showframe asl
|
||||
asl
|
||||
adc #>framebase
|
||||
sta :src+2 ;hi byte
|
||||
|
||||
txa
|
||||
ora #>fade_table
|
||||
sta :fademod+2
|
||||
|
||||
lda curpage
|
||||
sta :dst+2
|
||||
eor #4!8
|
||||
sta curpage
|
||||
|
||||
lda #4
|
||||
sta temp
|
||||
|
||||
ldx #0
|
||||
:loop
|
||||
:src ldy $1100,x
|
||||
:fademod lda fade_table+$F00,y
|
||||
:dst sta $0400,x
|
||||
inx
|
||||
bne :loop
|
||||
|
||||
inc :src+2 ;hibyte
|
||||
inc :dst+2 ; " "
|
||||
|
||||
dec temp
|
||||
bne :loop
|
||||
|
||||
]waitvbl jsr waitvbl
|
||||
|
||||
bit $C055
|
||||
lda curpage
|
||||
cmp #4
|
||||
beq *+5
|
||||
bit $C054
|
||||
|
||||
rts
|
||||
|
||||
GSshowframe asl
|
||||
asl
|
||||
adc #>framebase
|
||||
sta :src+2 ;hi byte
|
||||
|
||||
txa
|
||||
ora #>fade_table
|
||||
sta :fademod+2
|
||||
|
||||
lda curpage
|
||||
sta :dst+2
|
||||
eor #4!8
|
||||
sta curpage
|
||||
|
||||
lda #4
|
||||
sta temp
|
||||
|
||||
ldx #0
|
||||
:loop
|
||||
:src ldy $1100,x
|
||||
:fademod lda fade_table+$F00,y
|
||||
:dst stal $E00400,x
|
||||
inx
|
||||
bne :loop
|
||||
|
||||
inc :src+2 ;hibyte
|
||||
inc :dst+2 ; " "
|
||||
|
||||
dec temp
|
||||
bne :loop
|
||||
beq ]waitvbl
|
||||
|
||||
*------------------------------------------------- waitvbl
|
||||
*
|
||||
* Wait for a few vbl's to go by!
|
||||
*
|
||||
|
||||
waitvbl ldx #6
|
||||
:0 bit $C019
|
||||
bpl :0
|
||||
:1 bit $C019
|
||||
bmi :1
|
||||
dex
|
||||
bne :0
|
||||
rts
|
||||
|
||||
*------------------------------------------------- MAKEfade_tbls
|
||||
*
|
||||
* Make 16 lookup tables each containing 256 bytes
|
||||
* for the 16 levels of fade-in.
|
||||
*
|
||||
|
||||
MAKEfade_tbls dum 0
|
||||
:curtmp ds 2 ;ptr into current tmp_scale table
|
||||
:curfade ds 2 ;ptr into current page of fade table
|
||||
:temp ds 1
|
||||
:ysave ds 1
|
||||
dend
|
||||
|
||||
jsr MAKEtmp_scale
|
||||
|
||||
ldy #tmp_scale
|
||||
lda #>tmp_scale
|
||||
sty :curtmp
|
||||
sta :curtmp+1
|
||||
|
||||
ldy #fade_table
|
||||
lda #>fade_table
|
||||
sty :curfade
|
||||
sta :curfade+1
|
||||
|
||||
* byte loop
|
||||
|
||||
ldy #0
|
||||
|
||||
:bloop tya
|
||||
and #$0F
|
||||
jsr :convert
|
||||
sta :temp
|
||||
|
||||
tya
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
jsr :convert
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
ora :temp
|
||||
|
||||
sta (:curfade),y
|
||||
|
||||
iny
|
||||
bne :bloop
|
||||
|
||||
* next fade table
|
||||
|
||||
inc :curfade+1
|
||||
|
||||
* next tmp table
|
||||
|
||||
clc
|
||||
lda :curtmp
|
||||
adc #16
|
||||
sta :curtmp
|
||||
bcc :bloop
|
||||
|
||||
rts
|
||||
|
||||
* given a=0-15, in lores unsequential grey scale,
|
||||
* convert it back to sequential, lookup new value
|
||||
* in tmp_scale table and then convert back to
|
||||
* lores unsequential.
|
||||
|
||||
:convert sty :ysave
|
||||
|
||||
* Convert lores color back to sequential 00-0F
|
||||
|
||||
tax
|
||||
lda :unlores,x
|
||||
|
||||
* Scale it
|
||||
|
||||
tay
|
||||
lda (:curtmp),y
|
||||
|
||||
* Convert back to unsequential lores color
|
||||
|
||||
tax
|
||||
lda isGS?
|
||||
beq :notGS
|
||||
lda :loresGS,x
|
||||
bra :isGS
|
||||
|
||||
:notGS lda :lores2e,x
|
||||
|
||||
:isGS ldy :ysave
|
||||
rts
|
||||
|
||||
:unlores hex 000301070405020a
|
||||
hex 06080b0c090e0d0f
|
||||
|
||||
:loresGS hex 0002060104050803
|
||||
hex 090c070a0b0e0d0f
|
||||
|
||||
:lores2e hex 00000000
|
||||
hex 02020202
|
||||
hex 06060606
|
||||
hex 07070707
|
||||
|
||||
*------------------------------------------------- MAKEtmp_scale
|
||||
*
|
||||
* Make lookup table that contains values
|
||||
* for 0-15 multiplied by 1/16... 16/16.
|
||||
*
|
||||
|
||||
MAKEtmp_scale dum 0
|
||||
:color ds 1
|
||||
:scale ds 1
|
||||
dend
|
||||
|
||||
lda #1 ;start with 1/16th
|
||||
sta :scale
|
||||
|
||||
:sloop ldy #0
|
||||
:cloop sty :color
|
||||
lda #0
|
||||
ldx :scale
|
||||
:mloop clc
|
||||
adc :color
|
||||
dex
|
||||
bne :mloop
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
:smc sta tmp_scale,y
|
||||
iny
|
||||
cpy #16
|
||||
bne :cloop
|
||||
inc :scale
|
||||
lda :smc+1
|
||||
clc
|
||||
adc #16
|
||||
sta :smc+1
|
||||
bcc :sloop
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
dum $D000
|
||||
fade_table ds $1000
|
||||
tmp_scale ds $100
|
||||
dend
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1 +1,211 @@
|
|||
* purple.main
lst off
* The job of this routine is to set $DA to $01
* ( in aux-zpage!!! )
slot = $FD
*-------------------------------------------------
*
* HLS APPLE COPY PROTECTION
* COPYRIGHT (C) 1987 HLS DUPLICATION
*
* HLS 408-773-1500
*
* Modified by Roland Gustafsson 8/25/89
* for Prince of Persia copy protection.
*
*-------------------------------------------------
* ZERO PAGE
OBJSCT = $07 ;PHYSICAL SECTOR #
HDRC = $40
HDRS = HDRC+1
HDRT = HDRC+2
HDRV = HDRC+3 HEADER SECTOR
LSRETRY = HDRC+4 ;NIB READ RETRIES
PRETRY = HDRC+5 ;OBJSCT RETRIES
NPTR = HDRC+6
NPTRH = HDRC+7
MEM1 = HDRC+8
MEM2 = HDRC+9
zpage = HDRC
zpagelen = 13
*-------------------------------------------------
*
* Here is the code that ends up at $6321.
* Assemble it and run "make.purple.hex" which
* reverses the code and puts it in a text file.
*
*-------------------------------------------------
org $2000
da len6321
dum $6254
zpagebuf ds zpagelen
dend
org $6321
strt6321 jsr swapzpage
lda #10
sta LSRETRY
ldx slot
lda $C089,X
lda $C08E,X
lda #:NIBS ; !!!!! LOW BYTE
sta NPTR
lda #>:NIBS ; !!!!! HIGH BYTE
sta NPTRH
:AGAIN lda #$80
sta PRETRY
:M1 dec PRETRY
beq :LSFAIL
jsr RADR16
bcs :LSFAIL
lda HDRS
cmp #OBJSCT
bne :M1
ldy #0
:M2 lda $C08C,X
bpl :M2
dey
beq :LSFAIL
cmp #$D5
bne :M2
ldy #0
:M3 lda $C08C,X
bpl :M3
dey
beq :LSFAIL
cmp #$E7
bne :M3
:M4 lda $C08C,X
bpl :M4
cmp #$E7
bne :LSFAIL
:M5 lda $C08C,X
bpl :M5
cmp #$E7
bne :LSFAIL
lda $C08D,X
ldy #$10
bit $6 ;3 US. ( FOR //C)
:M6 lda $C08C,X
bpl :M6
dey
beq :LSFAIL
cmp #$EE
bne :M6
* NOW AT 1/2 NIBBLES
ldy #7
:M7 lda $C08C,X * READ DISK DATA
bpl :M7
cmp (NPTR),Y * COMPARE AGAINST TABLE
bne :LSFAIL
dey
bpl :M7
bmi :GOOD
:LSFAIL jmp :LSFAIL1
* A O K
:GOOD jsr swapzpage
lda #0
sta $C009-zpagelen,x
rol
sta $DA-zpagelen,x
sta $C008-zpagelen,x
clc
rts
* FAILED
:LSFAIL1 dec LSRETRY
beq :ERROR
jmp :AGAIN
:NIBS db $FC,$EE,$EE,$FC
db $E7,$EE,$FC,$E7
* Note that drive motor is still on
:ERROR
swapzpage ldx #0
:0 ldy zpagebuf,x
lda zpage,x
sty zpage,x
sta zpagebuf,x
inx
cpx #zpagelen
bne :0
rts
*-------------------------------------------------
*
* Read address mark
*
RADR16 ldy #$FD ;READ ADR HDR
sty MEM1
:RA1 iny
bne :RA2
inc MEM1
beq :RAEXIT
:RA2 lda $C08C,X
bpl :RA2
:RA3 cmp #$D5
bne :RA1
nop
:RA4 lda $C08C,X
bpl :RA4
cmp #$AA
bne :RA3
ldy #3
:RA5 lda $C08C,X
bpl :RA5
cmp #$96
bne :RA3
lda #0
:RA6 sta MEM2
:RA7 lda $C08C,X
bpl :RA7
rol
sta MEM1
:RA8 lda $C08C,X
bpl :RA8
and MEM1
sta HDRC,Y
eor MEM2
dey
bpl :RA6
tay
nop
clc
rts
:RAEXIT sec
rts
len6321 = *-strt6321
org
*------------------------------------------------- EOF
sav purple.main
|
||||
* purple.main
|
||||
|
||||
lst off
|
||||
|
||||
* The job of this routine is to set $DA to $01
|
||||
* ( in aux-zpage!!! )
|
||||
|
||||
slot = $FD
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* HLS APPLE COPY PROTECTION
|
||||
* COPYRIGHT (C) 1987 HLS DUPLICATION
|
||||
*
|
||||
* HLS 408-773-1500
|
||||
*
|
||||
* Modified by Roland Gustafsson 8/25/89
|
||||
* for Prince of Persia copy protection.
|
||||
*
|
||||
*-------------------------------------------------
|
||||
|
||||
* ZERO PAGE
|
||||
|
||||
OBJSCT = $07 ;PHYSICAL SECTOR #
|
||||
|
||||
HDRC = $40
|
||||
HDRS = HDRC+1
|
||||
HDRT = HDRC+2
|
||||
HDRV = HDRC+3 HEADER SECTOR
|
||||
LSRETRY = HDRC+4 ;NIB READ RETRIES
|
||||
PRETRY = HDRC+5 ;OBJSCT RETRIES
|
||||
NPTR = HDRC+6
|
||||
NPTRH = HDRC+7
|
||||
MEM1 = HDRC+8
|
||||
MEM2 = HDRC+9
|
||||
|
||||
zpage = HDRC
|
||||
zpagelen = 13
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Here is the code that ends up at $6321.
|
||||
* Assemble it and run "make.purple.hex" which
|
||||
* reverses the code and puts it in a text file.
|
||||
*
|
||||
*-------------------------------------------------
|
||||
|
||||
org $2000
|
||||
|
||||
da len6321
|
||||
|
||||
dum $6254
|
||||
zpagebuf ds zpagelen
|
||||
dend
|
||||
|
||||
org $6321
|
||||
|
||||
strt6321 jsr swapzpage
|
||||
lda #10
|
||||
sta LSRETRY
|
||||
ldx slot
|
||||
lda $C089,X
|
||||
lda $C08E,X
|
||||
lda #:NIBS ; !!!!! LOW BYTE
|
||||
sta NPTR
|
||||
lda #>:NIBS ; !!!!! HIGH BYTE
|
||||
sta NPTRH
|
||||
:AGAIN lda #$80
|
||||
sta PRETRY
|
||||
:M1 dec PRETRY
|
||||
beq :LSFAIL
|
||||
jsr RADR16
|
||||
bcs :LSFAIL
|
||||
lda HDRS
|
||||
cmp #OBJSCT
|
||||
bne :M1
|
||||
|
||||
ldy #0
|
||||
:M2 lda $C08C,X
|
||||
bpl :M2
|
||||
dey
|
||||
beq :LSFAIL
|
||||
cmp #$D5
|
||||
bne :M2
|
||||
ldy #0
|
||||
|
||||
:M3 lda $C08C,X
|
||||
bpl :M3
|
||||
dey
|
||||
beq :LSFAIL
|
||||
cmp #$E7
|
||||
bne :M3
|
||||
|
||||
:M4 lda $C08C,X
|
||||
bpl :M4
|
||||
cmp #$E7
|
||||
bne :LSFAIL
|
||||
|
||||
:M5 lda $C08C,X
|
||||
bpl :M5
|
||||
cmp #$E7
|
||||
bne :LSFAIL
|
||||
|
||||
lda $C08D,X
|
||||
ldy #$10
|
||||
bit $6 ;3 US. ( FOR //C)
|
||||
:M6 lda $C08C,X
|
||||
bpl :M6
|
||||
dey
|
||||
beq :LSFAIL
|
||||
cmp #$EE
|
||||
bne :M6
|
||||
|
||||
* NOW AT 1/2 NIBBLES
|
||||
|
||||
ldy #7
|
||||
:M7 lda $C08C,X * READ DISK DATA
|
||||
bpl :M7
|
||||
cmp (NPTR),Y * COMPARE AGAINST TABLE
|
||||
bne :LSFAIL
|
||||
dey
|
||||
bpl :M7
|
||||
bmi :GOOD
|
||||
:LSFAIL jmp :LSFAIL1
|
||||
|
||||
* A O K
|
||||
|
||||
:GOOD jsr swapzpage
|
||||
lda #0
|
||||
sta $C009-zpagelen,x
|
||||
rol
|
||||
sta $DA-zpagelen,x
|
||||
sta $C008-zpagelen,x
|
||||
clc
|
||||
rts
|
||||
|
||||
* FAILED
|
||||
|
||||
:LSFAIL1 dec LSRETRY
|
||||
beq :ERROR
|
||||
jmp :AGAIN
|
||||
|
||||
:NIBS db $FC,$EE,$EE,$FC
|
||||
db $E7,$EE,$FC,$E7
|
||||
|
||||
* Note that drive motor is still on
|
||||
|
||||
:ERROR
|
||||
swapzpage ldx #0
|
||||
:0 ldy zpagebuf,x
|
||||
lda zpage,x
|
||||
sty zpage,x
|
||||
sta zpagebuf,x
|
||||
inx
|
||||
cpx #zpagelen
|
||||
bne :0
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Read address mark
|
||||
*
|
||||
|
||||
RADR16 ldy #$FD ;READ ADR HDR
|
||||
sty MEM1
|
||||
:RA1 iny
|
||||
bne :RA2
|
||||
inc MEM1
|
||||
beq :RAEXIT
|
||||
:RA2 lda $C08C,X
|
||||
bpl :RA2
|
||||
:RA3 cmp #$D5
|
||||
bne :RA1
|
||||
nop
|
||||
:RA4 lda $C08C,X
|
||||
bpl :RA4
|
||||
cmp #$AA
|
||||
bne :RA3
|
||||
ldy #3
|
||||
:RA5 lda $C08C,X
|
||||
bpl :RA5
|
||||
cmp #$96
|
||||
bne :RA3
|
||||
lda #0
|
||||
:RA6 sta MEM2
|
||||
:RA7 lda $C08C,X
|
||||
bpl :RA7
|
||||
rol
|
||||
sta MEM1
|
||||
:RA8 lda $C08C,X
|
||||
bpl :RA8
|
||||
and MEM1
|
||||
sta HDRC,Y
|
||||
eor MEM2
|
||||
dey
|
||||
bpl :RA6
|
||||
tay
|
||||
nop
|
||||
clc
|
||||
rts
|
||||
|
||||
:RAEXIT sec
|
||||
rts
|
||||
|
||||
len6321 = *-strt6321
|
||||
|
||||
org
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
||||
sav purple.main
|
||||
|
|
|
@ -1 +1,63 @@
|
|||
* purple (put this file!!!)
* This code sets $DA in aux mem to 1
* if signature is found on track zero.
PURPrun = $6321
PURPLE
ldy #PURPrun
lda #>PURPrun
jsr PURPsub
jsr PURPjmp
* Note: first byte of next junk must be $60 (rts)
*-------------------------------------------------
PURPcode
hex 60386018EAA8E7108849450040994825
hex FB10C08CBD48852AFB10C08CBD498500
hex A9E7D096C9FB10C08CBD03A0F2D0AAC9
hex FB10C08CBDEAF0D0D5C9FB10C08CBD3D
hex F048E604D0C84884FDA060F1D00DE0E8
hex 62549D409440B56254BC00A2E7FCEEE7
hex FCEEEEFC63384C0BF044C66018BFFB9D
hex CD952ABFFC9D00A963BE2063AF4C0330
hex F4108805D046D1FB10C08CBD07A0F4D0
hex EEC914F088FB10C08CBD062410A0C08D
hex BD23D0E7C9FB10C08CBD2CD0E7C9FB10
hex C08CBDF4D0E7C939F088FB10C08CBD00
hex A0F4D0D5C947F088FB10C08CBD00A0F1
hex D007C941A557B063D0205CF045C64585
hex 80A9478563A94685B6A9C08EBDC089BD
hex FDA644850AA963BE20
*-------------------------------------------------
PURPlen = *-PURPcode
* Routine to decode code
hex 20
PURPsub
sty 4
sta 5
ldy #0
ldx #PURPlen
:0 dex
lda PURPcode,x
sta (4),y
iny
bne :0
rts
hex 2c
PURPjmp jmp (4)
*------------------------------------------------- EOF
|
||||
* purple (put this file!!!)
|
||||
|
||||
* This code sets $DA in aux mem to 1
|
||||
* if signature is found on track zero.
|
||||
|
||||
PURPrun = $6321
|
||||
|
||||
PURPLE
|
||||
ldy #PURPrun
|
||||
lda #>PURPrun
|
||||
|
||||
jsr PURPsub
|
||||
jsr PURPjmp
|
||||
|
||||
* Note: first byte of next junk must be $60 (rts)
|
||||
*-------------------------------------------------
|
||||
|
||||
PURPcode
|
||||
hex 60386018EAA8E7108849450040994825
|
||||
hex FB10C08CBD48852AFB10C08CBD498500
|
||||
hex A9E7D096C9FB10C08CBD03A0F2D0AAC9
|
||||
hex FB10C08CBDEAF0D0D5C9FB10C08CBD3D
|
||||
hex F048E604D0C84884FDA060F1D00DE0E8
|
||||
hex 62549D409440B56254BC00A2E7FCEEE7
|
||||
hex FCEEEEFC63384C0BF044C66018BFFB9D
|
||||
hex CD952ABFFC9D00A963BE2063AF4C0330
|
||||
hex F4108805D046D1FB10C08CBD07A0F4D0
|
||||
hex EEC914F088FB10C08CBD062410A0C08D
|
||||
hex BD23D0E7C9FB10C08CBD2CD0E7C9FB10
|
||||
hex C08CBDF4D0E7C939F088FB10C08CBD00
|
||||
hex A0F4D0D5C947F088FB10C08CBD00A0F1
|
||||
hex D007C941A557B063D0205CF045C64585
|
||||
hex 80A9478563A94685B6A9C08EBDC089BD
|
||||
hex FDA644850AA963BE20
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
PURPlen = *-PURPcode
|
||||
|
||||
* Routine to decode code
|
||||
|
||||
hex 20
|
||||
|
||||
PURPsub
|
||||
sty 4
|
||||
sta 5
|
||||
|
||||
ldy #0
|
||||
|
||||
ldx #PURPlen
|
||||
:0 dex
|
||||
lda PURPcode,x
|
||||
sta (4),y
|
||||
iny
|
||||
bne :0
|
||||
|
||||
rts
|
||||
|
||||
hex 2c
|
||||
|
||||
PURPjmp jmp (4)
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
|
|
@ -1 +1,90 @@
|
|||
* Ryellow1 (put this file!!!)
* This code sets the high bit of $7C in aux mem
* if signature is found on track zero.
* NOTE: make sure the x register has a number
* greater than 4 when calling YELLOW.
YELLrun = $AAAA
YELLOW
:0 sec
rol
clc
rol
dex
bne :0
sta 4
jsr YELLsub
jmp YELLnothing
*-------------------------------------------------
YELLcode
hex 27A26A0C5717236A8AAD0603AA8A3401
hex 03A02F9E0C5717246A03012F9D03E92F
hex 9C032A2F9F6C9F5AF68AF8011AFD0F9B
hex 63AD7A5B0AAA17266ABA51225AED637F
hex 7A5E0AAA17266ABA51225A93634D7A5E
hex 17266ABA51634D7A8617266ABA51634D
hex 7A8917276A0ABA8EAC17266ABA51225A
hex BE63447A5E0AAD17266ABA517B9C7AAF
hex 22BA5E9AA9E696018AAD06374215DCF1
hex B2CA6C9E5AA1E66100564444564D4456
hex 4D8AAD06374215CA0A572E92627AAE4C
hex 925A9717266ABA51637F7A5A4017266A
hex BA5163007A580AA917266ABA51633C7A
hex 4D03AA2F9317266ABA51802F9217266A
hex BA518F92339AAAEF9322BA4D0240B2CA
hex 92CA03AE27620E6F555AFC03AA27670E
hex 0F55276F0E9247620E5A9F1AACE3554C
hex 553AAEC3546C5567670E3AA907670E63
hex A61AAB02928A440113B3068A5601076F
hex 0EB28A5A01138F068A560144670E7A6A
hex 8A5601B20F5583A980AF5700172A6A0C
hex 57CA08B8607A579243AB7A5CCA08AA16
hex 0E0E1F9A3E9A370E0E424A8B7A5BCAAB
hex 9A828E8AB4B7B6B6B6B6B6DA868C88B5
hex B4B7B6B6B6B6B655A9
*-------------------------------------------------
YELLlen = *-YELLcode
* Routine to decode code
hex 20 ;jsr
YELLsub sta 5
ldy #0
:0 lda YELLcode,y
eor 4
sta (4),y
inc 5
lda YELLcode+256,y
eor 4
sta (4),y
dec 5
iny
bne :0
lda 4
eor #$4C!$AA ;jmp instruction
sta 3
jmp 3
*-------------------------------------------------
hex a9 ;lda #imm
YELLnothing ldy #0
inc 5
:0 tya
:1 sta (4),y
iny
bne :1
rts
*------------------------------------------------- EOF
|
||||
* Ryellow1 (put this file!!!)
|
||||
|
||||
* This code sets the high bit of $7C in aux mem
|
||||
* if signature is found on track zero.
|
||||
|
||||
* NOTE: make sure the x register has a number
|
||||
* greater than 4 when calling YELLOW.
|
||||
|
||||
YELLrun = $AAAA
|
||||
|
||||
YELLOW
|
||||
:0 sec
|
||||
rol
|
||||
clc
|
||||
rol
|
||||
dex
|
||||
bne :0
|
||||
sta 4
|
||||
|
||||
jsr YELLsub
|
||||
jmp YELLnothing
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
YELLcode
|
||||
hex 27A26A0C5717236A8AAD0603AA8A3401
|
||||
hex 03A02F9E0C5717246A03012F9D03E92F
|
||||
hex 9C032A2F9F6C9F5AF68AF8011AFD0F9B
|
||||
hex 63AD7A5B0AAA17266ABA51225AED637F
|
||||
hex 7A5E0AAA17266ABA51225A93634D7A5E
|
||||
hex 17266ABA51634D7A8617266ABA51634D
|
||||
hex 7A8917276A0ABA8EAC17266ABA51225A
|
||||
hex BE63447A5E0AAD17266ABA517B9C7AAF
|
||||
hex 22BA5E9AA9E696018AAD06374215DCF1
|
||||
hex B2CA6C9E5AA1E66100564444564D4456
|
||||
hex 4D8AAD06374215CA0A572E92627AAE4C
|
||||
hex 925A9717266ABA51637F7A5A4017266A
|
||||
hex BA5163007A580AA917266ABA51633C7A
|
||||
hex 4D03AA2F9317266ABA51802F9217266A
|
||||
hex BA518F92339AAAEF9322BA4D0240B2CA
|
||||
hex 92CA03AE27620E6F555AFC03AA27670E
|
||||
hex 0F55276F0E9247620E5A9F1AACE3554C
|
||||
hex 553AAEC3546C5567670E3AA907670E63
|
||||
hex A61AAB02928A440113B3068A5601076F
|
||||
hex 0EB28A5A01138F068A560144670E7A6A
|
||||
hex 8A5601B20F5583A980AF5700172A6A0C
|
||||
hex 57CA08B8607A579243AB7A5CCA08AA16
|
||||
hex 0E0E1F9A3E9A370E0E424A8B7A5BCAAB
|
||||
hex 9A828E8AB4B7B6B6B6B6B6DA868C88B5
|
||||
hex B4B7B6B6B6B6B655A9
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
YELLlen = *-YELLcode
|
||||
|
||||
* Routine to decode code
|
||||
|
||||
hex 20 ;jsr
|
||||
|
||||
YELLsub sta 5
|
||||
ldy #0
|
||||
:0 lda YELLcode,y
|
||||
eor 4
|
||||
sta (4),y
|
||||
inc 5
|
||||
lda YELLcode+256,y
|
||||
eor 4
|
||||
sta (4),y
|
||||
dec 5
|
||||
iny
|
||||
bne :0
|
||||
lda 4
|
||||
eor #$4C!$AA ;jmp instruction
|
||||
sta 3
|
||||
jmp 3
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
hex a9 ;lda #imm
|
||||
|
||||
YELLnothing ldy #0
|
||||
inc 5
|
||||
:0 tya
|
||||
:1 sta (4),y
|
||||
iny
|
||||
bne :1
|
||||
rts
|
||||
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
|
|
@ -1 +1,139 @@
|
|||
lst off
org $300
*
* loresshow:0C00.0FFF ($400)
* framedata:1000.6BFF ($5C00)
*
* buffer18 :6C00.7DFF ($1200 one track)
* rw18.d000:7E00.82FF ($500 moved to aux ramcard)
*
BbundID = $AD
loresshow = $c00
buffer18 = $6c00
rw18 = $d000
rw18temp = $7e00
slot = $FD
track = $FE
lastrack = $FF
startrack = 12 ;last 6 sectors here
* 13,14,15,16,17 (5 full tracks here)
errcode = 0
start jsr $e74c ;get slot#
txa
asl
asl
asl
asl
sta $C009 ;aux zpage, ramcard
sta slot
bit $C083
bit $C083
* Move rw18 to its home
ldx #>rw18temp
ldy #>rw18
lda #5
jsr movedata
* Now we can use rw18
jsr rw18
db 7,BbundID
jsr rw18
db 0,5,1 ;drive on
jsr rw18 ;seek to startrack
db 2,1,startrack
* handle special track with
jsr rw18
db 3 ;read in original data
db >buffer18
lda #1
bcs :error
* update last 6 sectors
ldx #>loresshow
ldy #>buffer18+$C00
lda #6
jsr movedata
* write it back out
jsr rw18
db 5 ;writesequ
db >buffer18
lda #2
bcs :error
* write out rest of data...
lda #>loresshow+$600
:wloop sta :buf
inc track
jsr rw18
db 5 ;writesequ
:buf db $11
lda #2
bcs :error
lda :buf
adc #$12
cmp #>loresshow+$600+{5*$1200}
bne :wloop
lda #0
:error pha
jsr rw18
db 1 ;drive off
pla
sta $C008
bit $C081
sta errcode
rts
*------------------------------------------------- movedata
*
* Move data: x:source, y:dest, a:length
*
movedata stx :src+2
sty :dst+2
tax
ldy #0
:loop
:src lda $1100,y
:dst sta $1100,y
iny
bne :loop
inc :src+2
inc :dst+2
dex
bne :loop
rts
*------------------------------------------------- EOF
|
||||
lst off
|
||||
|
||||
org $300
|
||||
|
||||
*
|
||||
* loresshow:0C00.0FFF ($400)
|
||||
* framedata:1000.6BFF ($5C00)
|
||||
*
|
||||
* buffer18 :6C00.7DFF ($1200 one track)
|
||||
* rw18.d000:7E00.82FF ($500 moved to aux ramcard)
|
||||
*
|
||||
|
||||
BbundID = $AD
|
||||
|
||||
loresshow = $c00
|
||||
buffer18 = $6c00
|
||||
|
||||
rw18 = $d000
|
||||
rw18temp = $7e00
|
||||
|
||||
slot = $FD
|
||||
track = $FE
|
||||
lastrack = $FF
|
||||
|
||||
startrack = 12 ;last 6 sectors here
|
||||
|
||||
* 13,14,15,16,17 (5 full tracks here)
|
||||
|
||||
errcode = 0
|
||||
|
||||
start jsr $e74c ;get slot#
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
|
||||
sta $C009 ;aux zpage, ramcard
|
||||
sta slot
|
||||
|
||||
bit $C083
|
||||
bit $C083
|
||||
|
||||
* Move rw18 to its home
|
||||
|
||||
ldx #>rw18temp
|
||||
ldy #>rw18
|
||||
lda #5
|
||||
jsr movedata
|
||||
|
||||
* Now we can use rw18
|
||||
|
||||
jsr rw18
|
||||
db 7,BbundID
|
||||
|
||||
jsr rw18
|
||||
db 0,5,1 ;drive on
|
||||
|
||||
jsr rw18 ;seek to startrack
|
||||
db 2,1,startrack
|
||||
|
||||
* handle special track with
|
||||
|
||||
jsr rw18
|
||||
db 3 ;read in original data
|
||||
db >buffer18
|
||||
lda #1
|
||||
bcs :error
|
||||
|
||||
* update last 6 sectors
|
||||
|
||||
ldx #>loresshow
|
||||
ldy #>buffer18+$C00
|
||||
lda #6
|
||||
jsr movedata
|
||||
|
||||
* write it back out
|
||||
|
||||
jsr rw18
|
||||
db 5 ;writesequ
|
||||
db >buffer18
|
||||
lda #2
|
||||
bcs :error
|
||||
|
||||
* write out rest of data...
|
||||
|
||||
lda #>loresshow+$600
|
||||
:wloop sta :buf
|
||||
|
||||
inc track
|
||||
|
||||
jsr rw18
|
||||
db 5 ;writesequ
|
||||
:buf db $11
|
||||
lda #2
|
||||
bcs :error
|
||||
|
||||
lda :buf
|
||||
adc #$12
|
||||
cmp #>loresshow+$600+{5*$1200}
|
||||
bne :wloop
|
||||
|
||||
lda #0
|
||||
|
||||
:error pha
|
||||
jsr rw18
|
||||
db 1 ;drive off
|
||||
pla
|
||||
|
||||
sta $C008
|
||||
bit $C081
|
||||
sta errcode
|
||||
rts
|
||||
|
||||
*------------------------------------------------- movedata
|
||||
*
|
||||
* Move data: x:source, y:dest, a:length
|
||||
*
|
||||
|
||||
movedata stx :src+2
|
||||
sty :dst+2
|
||||
tax
|
||||
|
||||
ldy #0
|
||||
:loop
|
||||
:src lda $1100,y
|
||||
:dst sta $1100,y
|
||||
iny
|
||||
bne :loop
|
||||
|
||||
inc :src+2
|
||||
inc :dst+2
|
||||
|
||||
dex
|
||||
bne :loop
|
||||
|
||||
rts
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
|
|
@ -1 +1,291 @@
|
|||
* yellow.main
lst off
* The job of this routine is to
* set the high-bit of $7C in aux zpage.
* (It does it by rotating in a carry set)
slot = $fd
lastrack = $ff
*-------------------------------------------------
*
* HLS APPLE COPY PROTECTION
* COPYRIGHT (C) 1987 HLS DUPLICATION
*
* Modified by Roland Gustafsson 8/25/89
* for Prince of Persia copy protection.
*
*-------------------------------------------------
OBJSCT = $07 ;PHYSICAL SECTOR #
* ZERO PAGE
HDRC = $30
HDRS = HDRC+1
HDRT = HDRC+2
HDRV = HDRC+3 HEADER SECTOR
LSRETRY = HDRC+4 ;NIB READ RETRIES
PRETRY = HDRC+5 ;OBJSCT RETRIES
NPTR = HDRC+6
NPTRH = HDRC+7
MEM1 = HDRC+8
MEM2 = HDRC+9
zpage = HDRC
zpagelen = 33 ;arbitrarily long (only needs 10)
*-------------------------------------------------
* Jordan says: use $A400-ABFF
* Roland says: OK
orgCHECK = $AAAA ;must be highbyte=lowbyte
org $2000
da lenCHECK
dum $A4A4
zpagebuf ds zpagelen
was27 ds 3 ;should be 1 !!!
was2A ds 5 ; ditto
was26 ds 7 ; ditto again
dend
org orgCHECK
*-------------------------------------------------
start sta $C008 ;switch to main zpage
ldx slot
lda $C089,x ;drive on
jsr swapzpage
* First seek track zero
lda #0
jsr SEEK
* Now check signature
lda #10
sta LSRETRY
ldx slot
lda $C08E,X
lda #>:NIBS
sta NPTRH
lda #:NIBS
sta NPTR
:AGAIN lda #$80
sta PRETRY
:M1 dec PRETRY
beq :LSFAIL
jsr RADR16
bcs :LSFAIL
lda HDRS
cmp #OBJSCT
bne :M1
ldy #0
:M2 lda $C08C,X
bpl :M2
dey
beq :LSFAIL
cmp #$D5
bne :M2
ldy #0
:M3 lda $C08C,X
bpl :M3
dey
beq :LSFAIL
cmp #$E7
bne :M3
:M4 lda $C08C,X
bpl :M4
cmp #$E7
bne :LSFAIL
:M5 lda $C08C,X
bpl :M5
cmp #$E7
bne :LSFAIL
lda $C08D,X
ldy #$10
bit $6 ;3 US. ( FOR //C)
:M6 lda $C08C,X
bpl :M6
dey
beq :LSFAIL
cmp #$EE
bne :M6
* NOW AT 1/2 NIBBLES
ldy #7
:M7 lda $C08C,X * READ DISK DATA
bpl :M7
cmp (NPTR),Y * COMPARE AGAINST TABLE
bne :LSFAIL
dey
bpl :M7
bmi :GOOD
:LSFAIL jmp :LSFAIL1
* A O K
:GOOD jsr swapzpage
sta $C009-zpagelen,x
ror $7C-zpagelen,x
clc
rts
* FAILED
:LSFAIL1 dec LSRETRY
beq :ERROR
jmp :AGAIN
:NIBS db $FC,$EE,$EE,$FC
db $E7,$EE,$FC,$E7
:ERROR jsr swapzpage
sta $C009-zpagelen,x
rts
*-------------------------------------------------
*
* Read address mark
*
RADR16 ldy #$FD
sty MEM1
:RA1 iny
bne :RA2
inc MEM1
beq :RAEXIT
:RA2 lda $C08C,X
bpl :RA2
:RA3 cmp #$D5
bne :RA1
nop
:RA4 lda $C08C,X
bpl :RA4
cmp #$AA
bne :RA3
ldy #3
:RA5 lda $C08C,X
bpl :RA5
cmp #$96
bne :RA3
lda #0
:RA6 sta MEM2
:RA7 lda $C08C,X
bpl :RA7
rol
sta MEM1
:RA8 lda $C08C,X
bpl :RA8
and MEM1
sta HDRC,Y
eor MEM2
dey
bpl :RA6
tay
nop
clc
rts
:RAEXIT sec
rts
*-------------------------------------------------
*
* SEEK, a - track
*
SEEK4 lda #4
SEEK sta was2A
cmp lastrack
beq :RTS0
lda #0
sta was26
:MOVEHEAD lda lastrack
sta was27
sec
sbc was2A
beq :ISTHERE
bcs :T0
eor #$FF
inc lastrack
bcc :T1
:T0 adc #$FE
dec lastrack
:T1 cmp was26
bcc :T2
lda was26
:T2 cmp #$C
bcs :T3
tay
:T3 sec
jsr :CHKPOS
lda ONTBL,Y
jsr :MSWAIT
lda was27
clc
jsr :CHKPOS2
lda OFFTBL,Y
jsr :MSWAIT
inc was26
bne :MOVEHEAD
:ISTHERE jsr :MSWAIT
clc
:CHKPOS lda lastrack
:CHKPOS2 and #3
rol
ora slot
tax
lda $C080,X
ldx slot
:RTS0 rts
:MSWAIT ldx #$12
:T21 dex
bne :T21
sec
sbc #1
bne :MSWAIT
rts
*-------------------------------------------------
swapzpage ldx #0
:0 ldy zpagebuf,x
lda zpage,x
sty zpage,x
sta zpagebuf,x
inx
cpx #zpagelen
bne :0
rts
*-------------------------------------------------
ONTBL db $01,$30,$28,$24,$20,$1E,$1D,$1C,$1C,$1C,$1C,$1C
OFFTBL db $70,$2C,$26,$22,$1F,$1E,$1D,$1C,$1C,$1C,$1C,$1C,$FF,$03
*-------------------------------------------------
lenCHECK = *-orgCHECK
org
*------------------------------------------------- EOF
sav yellow.main
|
||||
* yellow.main
|
||||
lst off
|
||||
|
||||
* The job of this routine is to
|
||||
* set the high-bit of $7C in aux zpage.
|
||||
* (It does it by rotating in a carry set)
|
||||
|
||||
slot = $fd
|
||||
lastrack = $ff
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* HLS APPLE COPY PROTECTION
|
||||
* COPYRIGHT (C) 1987 HLS DUPLICATION
|
||||
*
|
||||
* Modified by Roland Gustafsson 8/25/89
|
||||
* for Prince of Persia copy protection.
|
||||
*
|
||||
*-------------------------------------------------
|
||||
|
||||
OBJSCT = $07 ;PHYSICAL SECTOR #
|
||||
|
||||
* ZERO PAGE
|
||||
|
||||
HDRC = $30
|
||||
HDRS = HDRC+1
|
||||
HDRT = HDRC+2
|
||||
HDRV = HDRC+3 HEADER SECTOR
|
||||
LSRETRY = HDRC+4 ;NIB READ RETRIES
|
||||
PRETRY = HDRC+5 ;OBJSCT RETRIES
|
||||
NPTR = HDRC+6
|
||||
NPTRH = HDRC+7
|
||||
MEM1 = HDRC+8
|
||||
MEM2 = HDRC+9
|
||||
|
||||
zpage = HDRC
|
||||
zpagelen = 33 ;arbitrarily long (only needs 10)
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
* Jordan says: use $A400-ABFF
|
||||
* Roland says: OK
|
||||
|
||||
orgCHECK = $AAAA ;must be highbyte=lowbyte
|
||||
|
||||
org $2000
|
||||
|
||||
da lenCHECK
|
||||
|
||||
dum $A4A4
|
||||
zpagebuf ds zpagelen
|
||||
was27 ds 3 ;should be 1 !!!
|
||||
was2A ds 5 ; ditto
|
||||
was26 ds 7 ; ditto again
|
||||
dend
|
||||
|
||||
org orgCHECK
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
start sta $C008 ;switch to main zpage
|
||||
|
||||
ldx slot
|
||||
lda $C089,x ;drive on
|
||||
|
||||
jsr swapzpage
|
||||
|
||||
* First seek track zero
|
||||
|
||||
lda #0
|
||||
jsr SEEK
|
||||
|
||||
* Now check signature
|
||||
|
||||
lda #10
|
||||
sta LSRETRY
|
||||
ldx slot
|
||||
lda $C08E,X
|
||||
lda #>:NIBS
|
||||
sta NPTRH
|
||||
lda #:NIBS
|
||||
sta NPTR
|
||||
|
||||
:AGAIN lda #$80
|
||||
sta PRETRY
|
||||
:M1 dec PRETRY
|
||||
beq :LSFAIL
|
||||
jsr RADR16
|
||||
bcs :LSFAIL
|
||||
lda HDRS
|
||||
cmp #OBJSCT
|
||||
bne :M1
|
||||
|
||||
ldy #0
|
||||
:M2 lda $C08C,X
|
||||
bpl :M2
|
||||
dey
|
||||
beq :LSFAIL
|
||||
cmp #$D5
|
||||
bne :M2
|
||||
ldy #0
|
||||
|
||||
:M3 lda $C08C,X
|
||||
bpl :M3
|
||||
dey
|
||||
beq :LSFAIL
|
||||
cmp #$E7
|
||||
bne :M3
|
||||
|
||||
:M4 lda $C08C,X
|
||||
bpl :M4
|
||||
cmp #$E7
|
||||
bne :LSFAIL
|
||||
|
||||
:M5 lda $C08C,X
|
||||
bpl :M5
|
||||
cmp #$E7
|
||||
bne :LSFAIL
|
||||
|
||||
lda $C08D,X
|
||||
ldy #$10
|
||||
bit $6 ;3 US. ( FOR //C)
|
||||
:M6 lda $C08C,X
|
||||
bpl :M6
|
||||
dey
|
||||
beq :LSFAIL
|
||||
cmp #$EE
|
||||
bne :M6
|
||||
|
||||
* NOW AT 1/2 NIBBLES
|
||||
|
||||
ldy #7
|
||||
:M7 lda $C08C,X * READ DISK DATA
|
||||
bpl :M7
|
||||
cmp (NPTR),Y * COMPARE AGAINST TABLE
|
||||
bne :LSFAIL
|
||||
dey
|
||||
bpl :M7
|
||||
bmi :GOOD
|
||||
:LSFAIL jmp :LSFAIL1
|
||||
|
||||
* A O K
|
||||
|
||||
:GOOD jsr swapzpage
|
||||
sta $C009-zpagelen,x
|
||||
ror $7C-zpagelen,x
|
||||
clc
|
||||
rts
|
||||
|
||||
* FAILED
|
||||
|
||||
:LSFAIL1 dec LSRETRY
|
||||
beq :ERROR
|
||||
jmp :AGAIN
|
||||
|
||||
:NIBS db $FC,$EE,$EE,$FC
|
||||
db $E7,$EE,$FC,$E7
|
||||
|
||||
:ERROR jsr swapzpage
|
||||
sta $C009-zpagelen,x
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Read address mark
|
||||
*
|
||||
|
||||
RADR16 ldy #$FD
|
||||
sty MEM1
|
||||
:RA1 iny
|
||||
bne :RA2
|
||||
inc MEM1
|
||||
beq :RAEXIT
|
||||
:RA2 lda $C08C,X
|
||||
bpl :RA2
|
||||
:RA3 cmp #$D5
|
||||
bne :RA1
|
||||
nop
|
||||
:RA4 lda $C08C,X
|
||||
bpl :RA4
|
||||
cmp #$AA
|
||||
bne :RA3
|
||||
ldy #3
|
||||
:RA5 lda $C08C,X
|
||||
bpl :RA5
|
||||
cmp #$96
|
||||
bne :RA3
|
||||
lda #0
|
||||
:RA6 sta MEM2
|
||||
:RA7 lda $C08C,X
|
||||
bpl :RA7
|
||||
rol
|
||||
sta MEM1
|
||||
:RA8 lda $C08C,X
|
||||
bpl :RA8
|
||||
and MEM1
|
||||
sta HDRC,Y
|
||||
eor MEM2
|
||||
dey
|
||||
bpl :RA6
|
||||
tay
|
||||
nop
|
||||
clc
|
||||
rts
|
||||
|
||||
:RAEXIT sec
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* SEEK, a - track
|
||||
*
|
||||
|
||||
SEEK4 lda #4
|
||||
SEEK sta was2A
|
||||
cmp lastrack
|
||||
beq :RTS0
|
||||
lda #0
|
||||
sta was26
|
||||
:MOVEHEAD lda lastrack
|
||||
sta was27
|
||||
sec
|
||||
sbc was2A
|
||||
beq :ISTHERE
|
||||
bcs :T0
|
||||
eor #$FF
|
||||
inc lastrack
|
||||
bcc :T1
|
||||
:T0 adc #$FE
|
||||
dec lastrack
|
||||
:T1 cmp was26
|
||||
bcc :T2
|
||||
lda was26
|
||||
:T2 cmp #$C
|
||||
bcs :T3
|
||||
tay
|
||||
:T3 sec
|
||||
jsr :CHKPOS
|
||||
lda ONTBL,Y
|
||||
jsr :MSWAIT
|
||||
lda was27
|
||||
clc
|
||||
jsr :CHKPOS2
|
||||
lda OFFTBL,Y
|
||||
jsr :MSWAIT
|
||||
inc was26
|
||||
bne :MOVEHEAD
|
||||
:ISTHERE jsr :MSWAIT
|
||||
clc
|
||||
:CHKPOS lda lastrack
|
||||
:CHKPOS2 and #3
|
||||
rol
|
||||
ora slot
|
||||
tax
|
||||
lda $C080,X
|
||||
ldx slot
|
||||
:RTS0 rts
|
||||
|
||||
:MSWAIT ldx #$12
|
||||
:T21 dex
|
||||
bne :T21
|
||||
sec
|
||||
sbc #1
|
||||
bne :MSWAIT
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
swapzpage ldx #0
|
||||
:0 ldy zpagebuf,x
|
||||
lda zpage,x
|
||||
sty zpage,x
|
||||
sta zpagebuf,x
|
||||
inx
|
||||
cpx #zpagelen
|
||||
bne :0
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
ONTBL db $01,$30,$28,$24,$20,$1E,$1D,$1C,$1C,$1C,$1C,$1C
|
||||
OFFTBL db $70,$2C,$26,$22,$1F,$1E,$1D,$1C,$1C,$1C,$1C,$1C,$FF,$03
|
||||
|
||||
*-------------------------------------------------
|
||||
lenCHECK = *-orgCHECK
|
||||
|
||||
org
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
||||
sav yellow.main
|
||||
|
|
|
@ -1 +1,190 @@
|
|||
lst off
org = $1000
org org
*-------------------------------------------------
*
* 08/01/85
* 07/02/87 mod for 3.5
*
* Demo using the 18 sector routines.
*
* Loads in a double hires picture
* from tracks 2,3,4 and 5.
*
* by Roland Gustafsson
*
temp0 = $3A
temp1 = $3B
RW18temp = $2100
RW18 = $D000
slot = $FD
track = $FE
*-------------------------------------------------
*
* Move to actual run address
*
start ldy #0
:0 lda $2000,y
sta org,y
iny
bne :0
jmp :1
* Tell RW18 which slot to use
:1 lda $43
sta slot
jsr check64k
* Turn on the disk drive (It is
* already on, but this call is
* necessary to initialize the
* RW18 routine)
LOOP jsr RW18
hex 000100
* Clear hires page
jsr hgr
* Now seek to track two since that
* is where the data starts.
jsr RW18
hex 020002
* Display double hires page one
sta $C050
sta $C052
sta $C054
sta $C057
sta $C00D
sta $C05E
sta $C001
* Load in the picture
bit $C055
jsr LOADBANK
bit $C054
jsr LOADBANK
sta $C000
* Turn off the drive
jsr RW18
hex 01
* Wait for keypress
waitkey lda $C000
bpl waitkey
sta $C010
bmi LOOP
*-------------------------------------------------
*
* Load in two tracks
*
* The C in C3 and C4 means
* bit7:sound speaker on error
* bit6:auto inc track
*
* Read sequence
*
LOADBANK jsr RW18
hex C320
* Read group
jsr RW18
hex 84
hex 32333435363738393A
hex 3B3C3D3E0000000000
* ^^^^^^^^
* Note that the last five sectors
* are ignored.
*
* Read last page by itself to
* test RW18.35.
jsr RW18
hex C4
hex 000000000000000000
hex 000000003F00000000
rts
*-------------------------------------------------
*
* Clear double hires page
*
hgr sta $C005
jsr :0
sta $C004
:0 ldy #0
ldx #$20
sty temp0
stx temp1
tya
:1 sta (temp0),y
iny
bne :1
inc temp1
dex
bne :1
rts
*-------------------------------------------------
*
* Check for 64k and move RW18 to its home.
*
check64k bit $C08B
bit $C08B
ldy #0
:0 sty $E000
cpy $E000
bne NOT64K
iny
bne :0
* Move RW18 to $D000
ldx #5
:1 lda RW18temp,y
:2 sta RW18,y
iny
bne :1
inc :1+2
inc :2+2
dex
bne :1
rts
NOT64K sta $C081
ldy #0
:0 lda :errtext,y
beq *
sta $628,y
iny
bne :0
:errtext ASC "REQUIRES 64K MEMORY",00
*------------------------------------------------- EOF
sav demoboot
|
||||
lst off
|
||||
|
||||
org = $1000
|
||||
org org
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* 08/01/85
|
||||
* 07/02/87 mod for 3.5
|
||||
*
|
||||
* Demo using the 18 sector routines.
|
||||
*
|
||||
* Loads in a double hires picture
|
||||
* from tracks 2,3,4 and 5.
|
||||
*
|
||||
* by Roland Gustafsson
|
||||
*
|
||||
|
||||
temp0 = $3A
|
||||
temp1 = $3B
|
||||
|
||||
RW18temp = $2100
|
||||
RW18 = $D000
|
||||
|
||||
slot = $FD
|
||||
track = $FE
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Move to actual run address
|
||||
*
|
||||
|
||||
start ldy #0
|
||||
:0 lda $2000,y
|
||||
sta org,y
|
||||
iny
|
||||
bne :0
|
||||
jmp :1
|
||||
|
||||
* Tell RW18 which slot to use
|
||||
|
||||
:1 lda $43
|
||||
sta slot
|
||||
|
||||
jsr check64k
|
||||
|
||||
* Turn on the disk drive (It is
|
||||
* already on, but this call is
|
||||
* necessary to initialize the
|
||||
* RW18 routine)
|
||||
|
||||
LOOP jsr RW18
|
||||
hex 000100
|
||||
|
||||
* Clear hires page
|
||||
|
||||
jsr hgr
|
||||
|
||||
* Now seek to track two since that
|
||||
* is where the data starts.
|
||||
|
||||
jsr RW18
|
||||
hex 020002
|
||||
|
||||
* Display double hires page one
|
||||
|
||||
sta $C050
|
||||
sta $C052
|
||||
sta $C054
|
||||
sta $C057
|
||||
sta $C00D
|
||||
sta $C05E
|
||||
sta $C001
|
||||
|
||||
* Load in the picture
|
||||
|
||||
bit $C055
|
||||
jsr LOADBANK
|
||||
bit $C054
|
||||
jsr LOADBANK
|
||||
sta $C000
|
||||
|
||||
* Turn off the drive
|
||||
|
||||
jsr RW18
|
||||
hex 01
|
||||
|
||||
* Wait for keypress
|
||||
|
||||
waitkey lda $C000
|
||||
bpl waitkey
|
||||
sta $C010
|
||||
bmi LOOP
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Load in two tracks
|
||||
*
|
||||
* The C in C3 and C4 means
|
||||
* bit7:sound speaker on error
|
||||
* bit6:auto inc track
|
||||
*
|
||||
* Read sequence
|
||||
*
|
||||
|
||||
LOADBANK jsr RW18
|
||||
hex C320
|
||||
|
||||
* Read group
|
||||
|
||||
jsr RW18
|
||||
hex 84
|
||||
hex 32333435363738393A
|
||||
hex 3B3C3D3E0000000000
|
||||
* ^^^^^^^^
|
||||
* Note that the last five sectors
|
||||
* are ignored.
|
||||
*
|
||||
* Read last page by itself to
|
||||
* test RW18.35.
|
||||
|
||||
jsr RW18
|
||||
hex C4
|
||||
hex 000000000000000000
|
||||
hex 000000003F00000000
|
||||
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Clear double hires page
|
||||
*
|
||||
|
||||
hgr sta $C005
|
||||
jsr :0
|
||||
sta $C004
|
||||
|
||||
:0 ldy #0
|
||||
ldx #$20
|
||||
sty temp0
|
||||
stx temp1
|
||||
tya
|
||||
:1 sta (temp0),y
|
||||
iny
|
||||
bne :1
|
||||
inc temp1
|
||||
dex
|
||||
bne :1
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Check for 64k and move RW18 to its home.
|
||||
*
|
||||
|
||||
check64k bit $C08B
|
||||
bit $C08B
|
||||
ldy #0
|
||||
:0 sty $E000
|
||||
cpy $E000
|
||||
bne NOT64K
|
||||
iny
|
||||
bne :0
|
||||
|
||||
* Move RW18 to $D000
|
||||
|
||||
ldx #5
|
||||
:1 lda RW18temp,y
|
||||
:2 sta RW18,y
|
||||
iny
|
||||
bne :1
|
||||
inc :1+2
|
||||
inc :2+2
|
||||
dex
|
||||
bne :1
|
||||
rts
|
||||
|
||||
NOT64K sta $C081
|
||||
ldy #0
|
||||
:0 lda :errtext,y
|
||||
beq *
|
||||
sta $628,y
|
||||
iny
|
||||
bne :0
|
||||
|
||||
:errtext ASC "REQUIRES 64K MEMORY",00
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
||||
sav demoboot
|
||||
|
|
|
@ -1 +1,306 @@
|
|||
lst off
org $E00
errcode = 0
get8bit = $E74C
buffer = $1000 ;7 tracks long
bufferend = buffer+$7E00
rw18 = $D000 ;both versions!
slot = $FD
track = $FE
lastrack = $FF
*-------------------------------------------------
*
* CALL RT - moves rw18 routines to their homes in aux mem
*
* CALL RT+3,<5.25" slot>,<BbundID>,<start track>,<end track>
* ,<3.5" slot>,<block offset>
*
jmp move
* Get DEST information:
start jsr get8bit
stx slot525
jsr get8bit
stx BbundID
jsr get8bit
stx track
jsr get8bit
inx
stx ENDtrack
* SOURCE information
jsr get8bit
stx slot35
jsr $DEBE ;get16bit
jsr $DD67
jsr $E752
sty Boffset
sta Boffset+1
* From now on we are using aux zpage and $D000
lda track
sta $C009
sta track
jsr recal525
loop lda track
pha
jsr read35
bcs :plarts
pla
sta track
jsr write525
bcs :rts
lda track
eor ENDtrack
bne loop
pha
:plarts pla
:rts lda #0
rol
sta $C008 ;back to main mem
sta errcode
bit $C081
rts
ENDtrack db $11
*------------------------------------------------- write525
*
* Write up to 7 tracks from 5.25" floppy.
*
write525 jsr prep525
* Drive on, delay 1 second
jsr rw18
db 0,1,10
* Write until buffer is empty or END track reached
lda #>buffer
:loop sta :writebuf
jsr rw18
db $45 ;auto-inc, writesequ
:writebuf db $11
bcs :error
lda :writebuf
jsr buffend?
bcc :loop
clc
:error php
jsr rw18
db 1 ;drive off
plp
rts
*------------------------------------------------- buffend?
*
* Have we reached the end of buffer, or ENDtrack?
* Enter: a - last buffer address
*
* Exit: cs - no more buffer, or ENDtrack reached
* cc - keep going, a=new buffer address
*
buffend? clc
adc #$12
cmp #>bufferend
bcs :rts
ldy track
cpy ENDtrack
:rts rts
*------------------------------------------------- prep525
*
* Prepare to use 5.25" RW18 routine
*
* Normal RW18 routine is in second bank of $D000
prep525 bit $C08B
bit $C08B
* Set slot of 5.25" drive
lda #$11
slot525 = *-1
asl
asl
asl
asl
sta slot
tax
* Turn off all phases
lda $C080,x
lda $C082,x
lda $C084,x
lda $C086,x
* Set Broderbund ID byte
jsr rw18
db 7
BbundID db $11
rts
*------------------------------------------------- recal525
*
* Recalibrate 5.25" floppy drive
*
recal525 jsr prep525
lda #$A0
sta lastrack
* Drive on
jsr rw18
db 0,1,3 ;.3 second delay
* Seek to track zero
lda track
pha
jsr rw18
db 2,0,0
pla
sta track
sta :track
* Now seek first track
jsr rw18
db 2,0
:track db $11
jsr rw18
db 1 ;drive off
rts
*------------------------------------------------- read35
*
* Read up to 7 tracks to 3.5" disk.
*
read35 jsr prep35
* Write until no more buffer, or ENDtrack is reached
lda #>buffer
:loop sta :readbuf
jsr rw18
db $43 ;auto-inc, writesequ
:readbuf db $11
bcs :error
lda :readbuf
jsr buffend?
bcc :loop
clc
:error rts
*------------------------------------------------- prep35
*
* Prepare to use 3.5" RW18 routine
*
* 3.5" RW18 routine is in first bank of $D000
prep35 bit $C083
bit $C083
* Set slot of 3.5" drive
lda #$11
slot35 = *-1
asl
asl
asl
asl
sta slot
tax
* Set offset into 3.5" disk
jsr rw18
db 8
Boffset da $1111
rts
*------------------------------------------------- move
*
* Move the RW18 routines to their respective homes.
*
* $1000 - 3.5" rw18 routine
* $2000 - 5.25" rw18 routine
*
move ldx #$83
lda #$10
jsr :0
ldx #$8B
lda #$20
:0 sta :source+2
lda #$D0
sta :dest+2
lda $C000,x
lda $C000,x
sta $C009 ;aux $D000
ldx #$10
ldy #0
:source lda $1000,y
:dest sta $D000,y
iny
bne :source
inc :source+2
inc :dest+2
dex
bne :source
sta $C008
bit $C081
rts
*------------------------------------------------- EOF
|
||||
lst off
|
||||
|
||||
org $E00
|
||||
|
||||
errcode = 0
|
||||
get8bit = $E74C
|
||||
|
||||
buffer = $1000 ;7 tracks long
|
||||
bufferend = buffer+$7E00
|
||||
|
||||
rw18 = $D000 ;both versions!
|
||||
|
||||
slot = $FD
|
||||
track = $FE
|
||||
lastrack = $FF
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* CALL RT - moves rw18 routines to their homes in aux mem
|
||||
*
|
||||
* CALL RT+3,<5.25" slot>,<BbundID>,<start track>,<end track>
|
||||
* ,<3.5" slot>,<block offset>
|
||||
*
|
||||
|
||||
jmp move
|
||||
|
||||
* Get DEST information:
|
||||
|
||||
start jsr get8bit
|
||||
stx slot525
|
||||
jsr get8bit
|
||||
stx BbundID
|
||||
jsr get8bit
|
||||
stx track
|
||||
jsr get8bit
|
||||
inx
|
||||
stx ENDtrack
|
||||
|
||||
* SOURCE information
|
||||
|
||||
jsr get8bit
|
||||
stx slot35
|
||||
jsr $DEBE ;get16bit
|
||||
jsr $DD67
|
||||
jsr $E752
|
||||
sty Boffset
|
||||
sta Boffset+1
|
||||
|
||||
* From now on we are using aux zpage and $D000
|
||||
|
||||
lda track
|
||||
sta $C009
|
||||
sta track
|
||||
|
||||
jsr recal525
|
||||
|
||||
loop lda track
|
||||
|
||||
pha
|
||||
jsr read35
|
||||
bcs :plarts
|
||||
pla
|
||||
|
||||
sta track
|
||||
jsr write525
|
||||
bcs :rts
|
||||
|
||||
lda track
|
||||
eor ENDtrack
|
||||
bne loop
|
||||
|
||||
pha
|
||||
|
||||
:plarts pla
|
||||
:rts lda #0
|
||||
rol
|
||||
sta $C008 ;back to main mem
|
||||
sta errcode
|
||||
bit $C081
|
||||
rts
|
||||
|
||||
ENDtrack db $11
|
||||
|
||||
*------------------------------------------------- write525
|
||||
*
|
||||
* Write up to 7 tracks from 5.25" floppy.
|
||||
*
|
||||
|
||||
write525 jsr prep525
|
||||
|
||||
* Drive on, delay 1 second
|
||||
|
||||
jsr rw18
|
||||
db 0,1,10
|
||||
|
||||
* Write until buffer is empty or END track reached
|
||||
|
||||
lda #>buffer
|
||||
|
||||
:loop sta :writebuf
|
||||
|
||||
jsr rw18
|
||||
db $45 ;auto-inc, writesequ
|
||||
:writebuf db $11
|
||||
bcs :error
|
||||
|
||||
lda :writebuf
|
||||
jsr buffend?
|
||||
bcc :loop
|
||||
clc
|
||||
|
||||
:error php
|
||||
jsr rw18
|
||||
db 1 ;drive off
|
||||
plp
|
||||
rts
|
||||
|
||||
*------------------------------------------------- buffend?
|
||||
*
|
||||
* Have we reached the end of buffer, or ENDtrack?
|
||||
* Enter: a - last buffer address
|
||||
*
|
||||
* Exit: cs - no more buffer, or ENDtrack reached
|
||||
* cc - keep going, a=new buffer address
|
||||
*
|
||||
|
||||
buffend? clc
|
||||
adc #$12
|
||||
cmp #>bufferend
|
||||
bcs :rts
|
||||
|
||||
ldy track
|
||||
cpy ENDtrack
|
||||
|
||||
:rts rts
|
||||
|
||||
*------------------------------------------------- prep525
|
||||
*
|
||||
* Prepare to use 5.25" RW18 routine
|
||||
*
|
||||
|
||||
* Normal RW18 routine is in second bank of $D000
|
||||
|
||||
prep525 bit $C08B
|
||||
bit $C08B
|
||||
|
||||
* Set slot of 5.25" drive
|
||||
|
||||
lda #$11
|
||||
slot525 = *-1
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta slot
|
||||
tax
|
||||
|
||||
* Turn off all phases
|
||||
|
||||
lda $C080,x
|
||||
lda $C082,x
|
||||
lda $C084,x
|
||||
lda $C086,x
|
||||
|
||||
* Set Broderbund ID byte
|
||||
|
||||
jsr rw18
|
||||
db 7
|
||||
BbundID db $11
|
||||
|
||||
rts
|
||||
|
||||
*------------------------------------------------- recal525
|
||||
*
|
||||
* Recalibrate 5.25" floppy drive
|
||||
*
|
||||
|
||||
recal525 jsr prep525
|
||||
|
||||
lda #$A0
|
||||
sta lastrack
|
||||
|
||||
* Drive on
|
||||
|
||||
jsr rw18
|
||||
db 0,1,3 ;.3 second delay
|
||||
|
||||
* Seek to track zero
|
||||
|
||||
lda track
|
||||
pha
|
||||
|
||||
jsr rw18
|
||||
db 2,0,0
|
||||
|
||||
pla
|
||||
sta track
|
||||
sta :track
|
||||
|
||||
* Now seek first track
|
||||
|
||||
jsr rw18
|
||||
db 2,0
|
||||
:track db $11
|
||||
|
||||
jsr rw18
|
||||
db 1 ;drive off
|
||||
|
||||
rts
|
||||
|
||||
*------------------------------------------------- read35
|
||||
*
|
||||
* Read up to 7 tracks to 3.5" disk.
|
||||
*
|
||||
|
||||
read35 jsr prep35
|
||||
|
||||
* Write until no more buffer, or ENDtrack is reached
|
||||
|
||||
lda #>buffer
|
||||
|
||||
:loop sta :readbuf
|
||||
|
||||
jsr rw18
|
||||
db $43 ;auto-inc, writesequ
|
||||
:readbuf db $11
|
||||
bcs :error
|
||||
|
||||
lda :readbuf
|
||||
jsr buffend?
|
||||
bcc :loop
|
||||
clc
|
||||
|
||||
:error rts
|
||||
|
||||
*------------------------------------------------- prep35
|
||||
*
|
||||
* Prepare to use 3.5" RW18 routine
|
||||
*
|
||||
|
||||
* 3.5" RW18 routine is in first bank of $D000
|
||||
|
||||
prep35 bit $C083
|
||||
bit $C083
|
||||
|
||||
* Set slot of 3.5" drive
|
||||
|
||||
lda #$11
|
||||
slot35 = *-1
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta slot
|
||||
tax
|
||||
|
||||
* Set offset into 3.5" disk
|
||||
|
||||
jsr rw18
|
||||
db 8
|
||||
Boffset da $1111
|
||||
|
||||
rts
|
||||
|
||||
*------------------------------------------------- move
|
||||
*
|
||||
* Move the RW18 routines to their respective homes.
|
||||
*
|
||||
* $1000 - 3.5" rw18 routine
|
||||
* $2000 - 5.25" rw18 routine
|
||||
*
|
||||
|
||||
move ldx #$83
|
||||
lda #$10
|
||||
jsr :0
|
||||
ldx #$8B
|
||||
lda #$20
|
||||
|
||||
:0 sta :source+2
|
||||
lda #$D0
|
||||
sta :dest+2
|
||||
|
||||
lda $C000,x
|
||||
lda $C000,x
|
||||
|
||||
sta $C009 ;aux $D000
|
||||
|
||||
ldx #$10
|
||||
ldy #0
|
||||
:source lda $1000,y
|
||||
:dest sta $D000,y
|
||||
iny
|
||||
bne :source
|
||||
|
||||
inc :source+2
|
||||
inc :dest+2
|
||||
|
||||
dex
|
||||
bne :source
|
||||
|
||||
sta $C008
|
||||
bit $C081
|
||||
|
||||
rts
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
|
|
@ -1 +1,303 @@
|
|||
lst off
org $E00
errcode = 0
get8bit = $E74C
buffer = $1000 ;7 tracks long
bufferend = buffer+$7E00
rw18 = $D000 ;both versions!
slot = $FD
track = $FE
lastrack = $FF
*-------------------------------------------------
*
* CALL RT - moves rw18 routines to their homes in aux mem
*
* CALL RT+3,<5.25" slot>,<BbundID>,<start track>,<end track>
* ,<3.5" slot>,<block offset>
*
jmp move
* Get source information:
start jsr get8bit
stx slot525
jsr get8bit
stx BbundID
jsr get8bit
stx track
jsr get8bit
inx
stx ENDtrack
* Destination information
jsr get8bit
stx slot35
jsr $DEBE ;get16bit
jsr $DD67
jsr $E752
sty Boffset
sta Boffset+1
* From now on we are using aux zpage and $D000
lda track
sta $C009
sta track
jsr recal525
loop lda track
pha
jsr read525
bcs :plarts
pla
sta track
jsr write35
bcs :rts
lda track
eor ENDtrack
bne loop
pha
:plarts pla
:rts lda #0
rol
sta $C008 ;back to main mem
sta errcode
bit $C081
rts
ENDtrack db $11
*------------------------------------------------- read525
*
* Read up to 7 tracks from 5.25" floppy.
*
read525 jsr prep525
* Drive on, delay .5 seconds
jsr rw18
db 0,1,5
* Read until buffer is full
lda #>buffer
:loop sta :readbuf
jsr rw18
db $43 ;auto-inc, readsequ
:readbuf db $11
bcs :error
lda :readbuf
jsr buffend?
bcc :loop
clc
:error php
jsr rw18
db 1 ;drive off
plp
rts
*------------------------------------------------- buffend?
*
* Have we reached the end of buffer, or ENDtrack?
* Enter: a - last buffer address
*
* Exit: cs - no more buffer, or ENDtrack reached
* cc - keep going, a=new buffer address
*
buffend? clc
adc #$12
cmp #>bufferend
bcs :rts
ldy track
cpy ENDtrack
:rts rts
*------------------------------------------------- prep525
*
* Prepare to use 5.25" RW18 routine
*
* Normal RW18 routine is in second bank of $D000
prep525 bit $C08B
bit $C08B
* Set slot of 5.25" drive
lda #$11
slot525 = *-1
asl
asl
asl
asl
sta slot
tax
* Turn off all phases
lda $C080,x
lda $C082,x
lda $C084,x
lda $C086,x
* Set Broderbund ID byte
jsr rw18
db 7
BbundID db $11
rts
*------------------------------------------------- recal525
*
* Recalibrate 5.25" floppy drive
*
recal525 jsr prep525
lda #$A0
sta lastrack
* Drive on
jsr rw18
db 0,1,3 ;.3 second delay
* Seek to track zero
lda track
pha
jsr rw18
db 2,0,0
pla
sta track
sta :track
* Now seek first track
jsr rw18
db 2,0
:track db $11
rts
*------------------------------------------------- write35
*
* Write up to 7 tracks to 3.5" disk.
*
write35 jsr prep35
* Write until no more buffer, or ENDtrack is reached
lda #>buffer
:loop sta :writebuf
jsr rw18
db $45 ;auto-inc, writesequ
:writebuf db $11
bcs :error
lda :writebuf
jsr buffend?
bcc :loop
clc
:error rts
*------------------------------------------------- prep35
*
* Prepare to use 3.5" RW18 routine
*
* 3.5" RW18 routine is in first bank of $D000
prep35 bit $C083
bit $C083
* Set slot of 3.5" drive
lda #$11
slot35 = *-1
asl
asl
asl
asl
sta slot
tax
* Set offset into 3.5" disk
jsr rw18
db 8
Boffset da $1111
rts
*------------------------------------------------- move
*
* Move the RW18 routines to their respective homes.
*
* $1000 - 3.5" rw18 routine
* $2000 - 5.25" rw18 routine
*
move ldx #$83
lda #$10
jsr :0
ldx #$8B
lda #$20
:0 sta :source+2
lda #$D0
sta :dest+2
lda $C000,x
lda $C000,x
sta $C009 ;aux $D000
ldx #$10
ldy #0
:source lda $1000,y
:dest sta $D000,y
iny
bne :source
inc :source+2
inc :dest+2
dex
bne :source
sta $C008
bit $C081
rts
*------------------------------------------------- EOF
|
||||
lst off
|
||||
|
||||
org $E00
|
||||
|
||||
errcode = 0
|
||||
get8bit = $E74C
|
||||
|
||||
buffer = $1000 ;7 tracks long
|
||||
bufferend = buffer+$7E00
|
||||
|
||||
rw18 = $D000 ;both versions!
|
||||
|
||||
slot = $FD
|
||||
track = $FE
|
||||
lastrack = $FF
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* CALL RT - moves rw18 routines to their homes in aux mem
|
||||
*
|
||||
* CALL RT+3,<5.25" slot>,<BbundID>,<start track>,<end track>
|
||||
* ,<3.5" slot>,<block offset>
|
||||
*
|
||||
|
||||
jmp move
|
||||
|
||||
* Get source information:
|
||||
|
||||
start jsr get8bit
|
||||
stx slot525
|
||||
jsr get8bit
|
||||
stx BbundID
|
||||
jsr get8bit
|
||||
stx track
|
||||
jsr get8bit
|
||||
inx
|
||||
stx ENDtrack
|
||||
|
||||
* Destination information
|
||||
|
||||
jsr get8bit
|
||||
stx slot35
|
||||
jsr $DEBE ;get16bit
|
||||
jsr $DD67
|
||||
jsr $E752
|
||||
sty Boffset
|
||||
sta Boffset+1
|
||||
|
||||
* From now on we are using aux zpage and $D000
|
||||
|
||||
lda track
|
||||
sta $C009
|
||||
sta track
|
||||
|
||||
jsr recal525
|
||||
|
||||
loop lda track
|
||||
|
||||
pha
|
||||
jsr read525
|
||||
bcs :plarts
|
||||
pla
|
||||
|
||||
sta track
|
||||
jsr write35
|
||||
bcs :rts
|
||||
|
||||
lda track
|
||||
eor ENDtrack
|
||||
bne loop
|
||||
|
||||
pha
|
||||
|
||||
:plarts pla
|
||||
:rts lda #0
|
||||
rol
|
||||
sta $C008 ;back to main mem
|
||||
sta errcode
|
||||
bit $C081
|
||||
rts
|
||||
|
||||
ENDtrack db $11
|
||||
|
||||
*------------------------------------------------- read525
|
||||
*
|
||||
* Read up to 7 tracks from 5.25" floppy.
|
||||
*
|
||||
|
||||
read525 jsr prep525
|
||||
|
||||
* Drive on, delay .5 seconds
|
||||
|
||||
jsr rw18
|
||||
db 0,1,5
|
||||
|
||||
* Read until buffer is full
|
||||
|
||||
lda #>buffer
|
||||
|
||||
:loop sta :readbuf
|
||||
|
||||
jsr rw18
|
||||
db $43 ;auto-inc, readsequ
|
||||
:readbuf db $11
|
||||
bcs :error
|
||||
|
||||
lda :readbuf
|
||||
jsr buffend?
|
||||
bcc :loop
|
||||
clc
|
||||
|
||||
:error php
|
||||
jsr rw18
|
||||
db 1 ;drive off
|
||||
plp
|
||||
rts
|
||||
|
||||
*------------------------------------------------- buffend?
|
||||
*
|
||||
* Have we reached the end of buffer, or ENDtrack?
|
||||
* Enter: a - last buffer address
|
||||
*
|
||||
* Exit: cs - no more buffer, or ENDtrack reached
|
||||
* cc - keep going, a=new buffer address
|
||||
*
|
||||
|
||||
buffend? clc
|
||||
adc #$12
|
||||
cmp #>bufferend
|
||||
bcs :rts
|
||||
|
||||
ldy track
|
||||
cpy ENDtrack
|
||||
|
||||
:rts rts
|
||||
|
||||
*------------------------------------------------- prep525
|
||||
*
|
||||
* Prepare to use 5.25" RW18 routine
|
||||
*
|
||||
|
||||
* Normal RW18 routine is in second bank of $D000
|
||||
|
||||
prep525 bit $C08B
|
||||
bit $C08B
|
||||
|
||||
* Set slot of 5.25" drive
|
||||
|
||||
lda #$11
|
||||
slot525 = *-1
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta slot
|
||||
tax
|
||||
|
||||
* Turn off all phases
|
||||
|
||||
lda $C080,x
|
||||
lda $C082,x
|
||||
lda $C084,x
|
||||
lda $C086,x
|
||||
|
||||
* Set Broderbund ID byte
|
||||
|
||||
jsr rw18
|
||||
db 7
|
||||
BbundID db $11
|
||||
|
||||
rts
|
||||
|
||||
*------------------------------------------------- recal525
|
||||
*
|
||||
* Recalibrate 5.25" floppy drive
|
||||
*
|
||||
|
||||
recal525 jsr prep525
|
||||
|
||||
lda #$A0
|
||||
sta lastrack
|
||||
|
||||
* Drive on
|
||||
|
||||
jsr rw18
|
||||
db 0,1,3 ;.3 second delay
|
||||
|
||||
* Seek to track zero
|
||||
|
||||
lda track
|
||||
pha
|
||||
|
||||
jsr rw18
|
||||
db 2,0,0
|
||||
|
||||
pla
|
||||
sta track
|
||||
sta :track
|
||||
|
||||
* Now seek first track
|
||||
|
||||
jsr rw18
|
||||
db 2,0
|
||||
:track db $11
|
||||
|
||||
rts
|
||||
|
||||
*------------------------------------------------- write35
|
||||
*
|
||||
* Write up to 7 tracks to 3.5" disk.
|
||||
*
|
||||
|
||||
write35 jsr prep35
|
||||
|
||||
* Write until no more buffer, or ENDtrack is reached
|
||||
|
||||
lda #>buffer
|
||||
|
||||
:loop sta :writebuf
|
||||
|
||||
jsr rw18
|
||||
db $45 ;auto-inc, writesequ
|
||||
:writebuf db $11
|
||||
bcs :error
|
||||
|
||||
lda :writebuf
|
||||
jsr buffend?
|
||||
bcc :loop
|
||||
clc
|
||||
|
||||
:error rts
|
||||
|
||||
*------------------------------------------------- prep35
|
||||
*
|
||||
* Prepare to use 3.5" RW18 routine
|
||||
*
|
||||
|
||||
* 3.5" RW18 routine is in first bank of $D000
|
||||
|
||||
prep35 bit $C083
|
||||
bit $C083
|
||||
|
||||
* Set slot of 3.5" drive
|
||||
|
||||
lda #$11
|
||||
slot35 = *-1
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta slot
|
||||
tax
|
||||
|
||||
* Set offset into 3.5" disk
|
||||
|
||||
jsr rw18
|
||||
db 8
|
||||
Boffset da $1111
|
||||
|
||||
rts
|
||||
|
||||
*------------------------------------------------- move
|
||||
*
|
||||
* Move the RW18 routines to their respective homes.
|
||||
*
|
||||
* $1000 - 3.5" rw18 routine
|
||||
* $2000 - 5.25" rw18 routine
|
||||
*
|
||||
|
||||
move ldx #$83
|
||||
lda #$10
|
||||
jsr :0
|
||||
ldx #$8B
|
||||
lda #$20
|
||||
|
||||
:0 sta :source+2
|
||||
lda #$D0
|
||||
sta :dest+2
|
||||
|
||||
lda $C000,x
|
||||
lda $C000,x
|
||||
|
||||
sta $C009 ;aux $D000
|
||||
|
||||
ldx #$10
|
||||
ldy #0
|
||||
:source lda $1000,y
|
||||
:dest sta $D000,y
|
||||
iny
|
||||
bne :source
|
||||
|
||||
inc :source+2
|
||||
inc :dest+2
|
||||
|
||||
dex
|
||||
bne :source
|
||||
|
||||
sta $C008
|
||||
bit $C081
|
||||
|
||||
rts
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
|
|
@ -1 +1,210 @@
|
|||
lst off
org $2000
*-------------------------------------------------
*
* 06/28/89 Prince of Persia boot code
* for rw18 3.5" version
*
* Last mod: 09/05/89
*
rw18 = $D000
slot = $FD
*-------------------------------------------------
*
* Tell RW18 which slot to use
*
start bit RW18temp
ldx #$FF
txs
lda $43 ;ProDOS boot drive
sta slot
* Clear screen, etc...
jsr init
* Check system for 128k of RAM
jsr check128k
* Determine if we are running on a GS
* and do GS specific stuff also...
jsr setGSflag
* Move rw18 to its home
jsr moverw18
* Start loading the game
jsr rw18
db 7,$A9 ;Bbund ID=$A9 for side one
jsr rw18 ;"seek" track one
db 2,0,1
jsr rw18 ;read in $EE00-FFFF
hex C3EE
jmp $EE00
*-------------------------------------------------
text = $fb2f
home = $fc58
vtab = $FB5B
cout = $FDF0
normal = $fe84
pr0 = $fe93
in0 = $fe89
init ldx #$ff
stx $4fb
stx $3f3
stx $3f4
stx $c000 ;80store off
stx $c002 ;RAMRD main
stx $c004 ;RAMWRT main
stx $c00c ;80col off
stx $c00e ;Altcharset off
stx $c081 ;write RAM, read ROM (2nd 4k bank)
jsr text
jsr home
jsr normal
jsr pr0
jsr in0
rts
*-------------------------------------------------
*
* Check to make sure //c or //e
* with 128k
*
check128k sta $C081
lda $FBB3 ;Apple // family ID byte
cmp #6
bne NOT128K ;Must be e/c/GS
bit $C017
bmi NOT128K
ldx #CHECKEND
:0 lda CHECKER,X
sta $180,X
dex
bpl :0
jsr $180
bcs NOT128K
rts
NOT128K jsr text
jsr home
lda #8
jsr vtab
ldy #0
:0 lda MEMTEXT,Y
beq *
jsr cout
cmp #$8D
bne :1
lda #4
sta $24
:1 iny
bne :0
MEMTEXT hex 8D
asc "REQUIRES A //C OR //E WITH 128K"
hex 00
*-------------------------------------------------
* Check for AUX memory routine
CHECKER lda #$EE
sta $C005
sta $C003
sta $0800
lda $0C00
cmp #$EE
bne :0
asl $0C00
lda $0800
cmp $0C00
beq :1
:0 clc
:1 sta $C004
sta $C002
rts
CHECKEND = *-CHECKER
*------------------------------------------------- setGSflag
*
* Set the GS? flag in rw18
*
setGSflag sta $C081
sec
jsr $FE1F
lda #$FF
adc #0
sta GS?
bpl :notGS
* Set background color to black, text to white
lda #$F0
sta $C022
* Set border color to black
lda $C034
and #$F0
sta $C034
:notGS rts
*------------------------------------------------- moverw18
*
* Move RW18 to it's final home in $D000
*
moverw18 bit $C08B
bit $C08B
ldy #0
:0 lda RW18temp,y
:1 sta $D000,y
iny
bne :0
inc :0+2
inc :1+2
bne :0
rts
*-------------------------------------------------
sav popboot35
*------------------------------------------------- EOF
dum *
RW18temp ds 3
GS? ds 1
dend
*-------------------------------------------------
lst off
|
||||
lst off
|
||||
|
||||
org $2000
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* 06/28/89 Prince of Persia boot code
|
||||
* for rw18 3.5" version
|
||||
*
|
||||
* Last mod: 09/05/89
|
||||
*
|
||||
|
||||
rw18 = $D000
|
||||
|
||||
slot = $FD
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Tell RW18 which slot to use
|
||||
*
|
||||
|
||||
start bit RW18temp
|
||||
|
||||
ldx #$FF
|
||||
txs
|
||||
|
||||
lda $43 ;ProDOS boot drive
|
||||
sta slot
|
||||
|
||||
* Clear screen, etc...
|
||||
|
||||
jsr init
|
||||
|
||||
* Check system for 128k of RAM
|
||||
|
||||
jsr check128k
|
||||
|
||||
* Determine if we are running on a GS
|
||||
* and do GS specific stuff also...
|
||||
|
||||
jsr setGSflag
|
||||
|
||||
* Move rw18 to its home
|
||||
|
||||
jsr moverw18
|
||||
|
||||
* Start loading the game
|
||||
|
||||
jsr rw18
|
||||
db 7,$A9 ;Bbund ID=$A9 for side one
|
||||
|
||||
jsr rw18 ;"seek" track one
|
||||
db 2,0,1
|
||||
|
||||
jsr rw18 ;read in $EE00-FFFF
|
||||
hex C3EE
|
||||
|
||||
jmp $EE00
|
||||
|
||||
*-------------------------------------------------
|
||||
text = $fb2f
|
||||
home = $fc58
|
||||
vtab = $FB5B
|
||||
cout = $FDF0
|
||||
normal = $fe84
|
||||
pr0 = $fe93
|
||||
in0 = $fe89
|
||||
|
||||
init ldx #$ff
|
||||
stx $4fb
|
||||
stx $3f3
|
||||
stx $3f4
|
||||
stx $c000 ;80store off
|
||||
stx $c002 ;RAMRD main
|
||||
stx $c004 ;RAMWRT main
|
||||
stx $c00c ;80col off
|
||||
stx $c00e ;Altcharset off
|
||||
stx $c081 ;write RAM, read ROM (2nd 4k bank)
|
||||
jsr text
|
||||
jsr home
|
||||
jsr normal
|
||||
jsr pr0
|
||||
jsr in0
|
||||
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Check to make sure //c or //e
|
||||
* with 128k
|
||||
*
|
||||
|
||||
check128k sta $C081
|
||||
|
||||
lda $FBB3 ;Apple // family ID byte
|
||||
cmp #6
|
||||
bne NOT128K ;Must be e/c/GS
|
||||
|
||||
bit $C017
|
||||
bmi NOT128K
|
||||
|
||||
ldx #CHECKEND
|
||||
:0 lda CHECKER,X
|
||||
sta $180,X
|
||||
dex
|
||||
bpl :0
|
||||
|
||||
jsr $180
|
||||
bcs NOT128K
|
||||
|
||||
rts
|
||||
|
||||
NOT128K jsr text
|
||||
jsr home
|
||||
lda #8
|
||||
jsr vtab
|
||||
|
||||
ldy #0
|
||||
:0 lda MEMTEXT,Y
|
||||
beq *
|
||||
jsr cout
|
||||
cmp #$8D
|
||||
bne :1
|
||||
lda #4
|
||||
sta $24
|
||||
:1 iny
|
||||
bne :0
|
||||
|
||||
MEMTEXT hex 8D
|
||||
asc "REQUIRES A //C OR //E WITH 128K"
|
||||
hex 00
|
||||
|
||||
*-------------------------------------------------
|
||||
* Check for AUX memory routine
|
||||
|
||||
CHECKER lda #$EE
|
||||
sta $C005
|
||||
sta $C003
|
||||
sta $0800
|
||||
lda $0C00
|
||||
cmp #$EE
|
||||
bne :0
|
||||
asl $0C00
|
||||
lda $0800
|
||||
cmp $0C00
|
||||
beq :1
|
||||
:0 clc
|
||||
:1 sta $C004
|
||||
sta $C002
|
||||
rts
|
||||
|
||||
CHECKEND = *-CHECKER
|
||||
|
||||
*------------------------------------------------- setGSflag
|
||||
*
|
||||
* Set the GS? flag in rw18
|
||||
*
|
||||
|
||||
setGSflag sta $C081
|
||||
sec
|
||||
jsr $FE1F
|
||||
lda #$FF
|
||||
adc #0
|
||||
sta GS?
|
||||
bpl :notGS
|
||||
|
||||
* Set background color to black, text to white
|
||||
|
||||
lda #$F0
|
||||
sta $C022
|
||||
|
||||
* Set border color to black
|
||||
|
||||
lda $C034
|
||||
and #$F0
|
||||
sta $C034
|
||||
|
||||
:notGS rts
|
||||
|
||||
*------------------------------------------------- moverw18
|
||||
*
|
||||
* Move RW18 to it's final home in $D000
|
||||
*
|
||||
|
||||
moverw18 bit $C08B
|
||||
bit $C08B
|
||||
|
||||
ldy #0
|
||||
:0 lda RW18temp,y
|
||||
:1 sta $D000,y
|
||||
iny
|
||||
bne :0
|
||||
|
||||
inc :0+2
|
||||
inc :1+2
|
||||
bne :0
|
||||
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
sav popboot35
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
dum *
|
||||
RW18temp ds 3
|
||||
GS? ds 1
|
||||
dend
|
||||
*-------------------------------------------------
|
||||
lst off
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1,174 @@
|
|||
lst off
*------------------------------------------------- rotcube
mainYoffset = 46 ;(192-60)/2
botYoffset = 72
mainXoffset = 68 ;(280-144)/2
color = $E4
page = $E6
dum 0
index ds 1
ysave ds 1
yadd ds 1
yoffset ds 1
dend
*-------------------------------------------------
rotcube jsr $f3e2 ;hgr
jsr $f3d8 ;hgr2
lda #1
sta yadd
sta yoffset
* Draw on page not showing:
mainloop lda page
eor #$60
sta page
ldx #$7F
jsr draw
* If not a //c, then wait for vbl
lda $FBC0
beq :is2c
lda $C019
bpl *-3
lda $C019
bmi *-3
:is2c
* Now display that page
bit $C054
lda page
cmp #$20
beq *+5
bit $C055
* Now erase old image from last page
eor #$60
sta :smc0+2
sta :smc1+2
ldx #$20
lda #0
:loop tay
:smc0 sta $2000,y
:smc1 sta $2080,y
iny
bpl :smc0
inc :smc0+2
inc :smc1+2
dex
bne :loop
inc index
jmp mainloop
*-------------------------------------------------
draw stx color
ldy #12-1
:drawloop lda drawlist,y
sty ysave
pha
and #15
jsr getpoint
tax
tya
ldy #0
jsr $f457 ;plot
pla
lsr
lsr
lsr
lsr
jsr getpoint
ldx #0
jsr $f53a ;lineto
ldy ysave
dey
bpl :drawloop
lda yoffset
clc
adc yadd
bne :not0
inc yadd ;make +1
inc yadd
:not0 cmp #191-48-botYoffset
bcc :0
dec yadd ;make -1
dec yadd
:0 sta yoffset
rts
*-------------------------------------------------
*
* given a = point number, return a = xcoor, y = ycoor
*
getpoint tay
* Get index into tables
asl ;*16
asl
asl
asl
adc index
and #$3F
tax
tya
and #4 ;bottom?
cmp #4
* Compute ycoor
lda ydata,x
bcc :not_bot
adc #botYoffset-1
:not_bot adc yoffset
tay
* Compute xcoor
lda xdata,x
adc #mainXoffset
rts
*-------------------------------------------------
drawlist hex 01122330 ;draw top
hex 45566774 ;draw bottom
hex 04152637 ;draw connecting lines
xdata hex 908F8E8C8A87837F7A757069635C564F
hex 484039332C261F1A15100C0805030100
hex 0000010305080C10151A1F262C333940
hex 474F565C636970757A7F83878A8C8E8F
ydata hex 181A1C1E21232527282A2B2D2E2E2F2F
hex 2F2F2F2E2E2D2B2A28272523211E1C1A
hex 181513110E0C0A080705040201010000
hex 000000010102040507080A0C0E111315
*-------------------------------------------------
|
||||
lst off
|
||||
|
||||
*------------------------------------------------- rotcube
|
||||
|
||||
mainYoffset = 46 ;(192-60)/2
|
||||
botYoffset = 72
|
||||
mainXoffset = 68 ;(280-144)/2
|
||||
|
||||
color = $E4
|
||||
page = $E6
|
||||
|
||||
dum 0
|
||||
index ds 1
|
||||
ysave ds 1
|
||||
yadd ds 1
|
||||
yoffset ds 1
|
||||
dend
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
rotcube jsr $f3e2 ;hgr
|
||||
jsr $f3d8 ;hgr2
|
||||
|
||||
lda #1
|
||||
sta yadd
|
||||
|
||||
sta yoffset
|
||||
|
||||
* Draw on page not showing:
|
||||
|
||||
mainloop lda page
|
||||
eor #$60
|
||||
sta page
|
||||
ldx #$7F
|
||||
jsr draw
|
||||
|
||||
* If not a //c, then wait for vbl
|
||||
|
||||
lda $FBC0
|
||||
beq :is2c
|
||||
lda $C019
|
||||
bpl *-3
|
||||
lda $C019
|
||||
bmi *-3
|
||||
:is2c
|
||||
|
||||
* Now display that page
|
||||
|
||||
bit $C054
|
||||
lda page
|
||||
cmp #$20
|
||||
beq *+5
|
||||
bit $C055
|
||||
|
||||
* Now erase old image from last page
|
||||
|
||||
eor #$60
|
||||
sta :smc0+2
|
||||
sta :smc1+2
|
||||
ldx #$20
|
||||
lda #0
|
||||
:loop tay
|
||||
:smc0 sta $2000,y
|
||||
:smc1 sta $2080,y
|
||||
iny
|
||||
bpl :smc0
|
||||
inc :smc0+2
|
||||
inc :smc1+2
|
||||
dex
|
||||
bne :loop
|
||||
|
||||
inc index
|
||||
jmp mainloop
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
draw stx color
|
||||
|
||||
ldy #12-1
|
||||
:drawloop lda drawlist,y
|
||||
sty ysave
|
||||
|
||||
pha
|
||||
and #15
|
||||
jsr getpoint
|
||||
|
||||
tax
|
||||
tya
|
||||
ldy #0
|
||||
jsr $f457 ;plot
|
||||
|
||||
pla
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
jsr getpoint
|
||||
ldx #0
|
||||
jsr $f53a ;lineto
|
||||
|
||||
ldy ysave
|
||||
dey
|
||||
bpl :drawloop
|
||||
|
||||
lda yoffset
|
||||
clc
|
||||
adc yadd
|
||||
bne :not0
|
||||
|
||||
inc yadd ;make +1
|
||||
inc yadd
|
||||
|
||||
:not0 cmp #191-48-botYoffset
|
||||
bcc :0
|
||||
|
||||
dec yadd ;make -1
|
||||
dec yadd
|
||||
|
||||
:0 sta yoffset
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* given a = point number, return a = xcoor, y = ycoor
|
||||
*
|
||||
|
||||
getpoint tay
|
||||
|
||||
* Get index into tables
|
||||
|
||||
asl ;*16
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
adc index
|
||||
and #$3F
|
||||
tax
|
||||
tya
|
||||
|
||||
and #4 ;bottom?
|
||||
cmp #4
|
||||
|
||||
* Compute ycoor
|
||||
|
||||
lda ydata,x
|
||||
bcc :not_bot
|
||||
adc #botYoffset-1
|
||||
|
||||
:not_bot adc yoffset
|
||||
tay
|
||||
|
||||
* Compute xcoor
|
||||
|
||||
lda xdata,x
|
||||
adc #mainXoffset
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
drawlist hex 01122330 ;draw top
|
||||
hex 45566774 ;draw bottom
|
||||
hex 04152637 ;draw connecting lines
|
||||
|
||||
xdata hex 908F8E8C8A87837F7A757069635C564F
|
||||
hex 484039332C261F1A15100C0805030100
|
||||
hex 0000010305080C10151A1F262C333940
|
||||
hex 474F565C636970757A7F83878A8C8E8F
|
||||
|
||||
ydata hex 181A1C1E21232527282A2B2D2E2E2F2F
|
||||
hex 2F2F2F2E2E2D2B2A28272523211E1C1A
|
||||
hex 181513110E0C0A080705040201010000
|
||||
hex 000000010102040507080A0C0E111315
|
||||
|
||||
*-------------------------------------------------
|
||||
|
|
|
@ -1 +1,371 @@
|
|||
lst off
org $c00
*-------------------------------------------------
dum 0
curpage ds 1
xsave ds 1
ysave ds 1
asave ds 1
temp ds 1
tmplo ds 1
tmphi ds 1
level ds 1
isGS? ds 1
dend
framebase = $1000
*------------------------------------------------- show
*
* put on the show!
*
show bit $C010
lda #0
sta isGS?
bit $C081
sec
jsr $fe1f ;GS?
bcs :notGS
inc isGS?
* Use special show frame routine for //GS that
* writes directly to bank $E0, since page two
* text is not properly shadowed to that bank.
ldx #$4C ;jmp
ldy #GSshowframe
lda #>GSshowframe
stx showframe
sty showframe+1
sta showframe+2
* Make our lookup tables up in ramcard area
:notGS bit $C083
bit $C083
jsr MAKEfade_tbls
jsr lgr
:again
ldx #0
:fadein stx level
lda #0
jsr showframe
ldx level
inx
cpx #15
bcc :fadein
* Here we go...
lda #0
:floop pha
ldx #15
jsr showframe
pla
clc
adc #1
cmp #23
bcc :floop
ldx #15
:fadeout stx level
lda #22
jsr showframe
ldx level
dex
bpl :fadeout
bit $C000
bpl *-3
bit $C010
jmp :again
*------------------------------------------------- lgr
*
* Clear and display lo-resolution screen
*
lgr sta $C000 ;turn off 55.54 select
sta $C00C ;40 columns
bit $C052 ;full screen
bit $C055 ;show page two
bit $C056 ;lores
bit $C050 ;graphics on
lda #4 ;use page one next
sta curpage
ldy #0
sty tmplo
sta tmphi
tya
ldx #8
:0 sta (tmplo),y
iny
bne :0
inc tmphi
dex
bne :0
rts
*------------------------------------------------- loget
*
* Enter with a:frame number
* x:fade level
*
showframe asl
asl
adc #>framebase
sta :src+2 ;hi byte
txa
ora #>fade_table
sta :fademod+2
lda curpage
sta :dst+2
eor #4!8
sta curpage
lda #4
sta temp
ldx #0
:loop
:src ldy $1100,x
:fademod lda fade_table+$F00,y
:dst sta $0400,x
inx
bne :loop
inc :src+2 ;hibyte
inc :dst+2 ; " "
dec temp
bne :loop
]waitvbl jsr waitvbl
bit $C055
lda curpage
cmp #4
beq *+5
bit $C054
rts
GSshowframe asl
asl
adc #>framebase
sta :src+2 ;hi byte
txa
ora #>fade_table
sta :fademod+2
lda curpage
sta :dst+2
eor #4!8
sta curpage
lda #4
sta temp
ldx #0
:loop
:src ldy $1100,x
:fademod lda fade_table+$F00,y
:dst stal $E00400,x
inx
bne :loop
inc :src+2 ;hibyte
inc :dst+2 ; " "
dec temp
bne :loop
beq ]waitvbl
*------------------------------------------------- waitvbl
*
* Wait for a few vbl's to go by!
*
waitvbl ldx #6
:0 bit $C019
bpl :0
:1 bit $C019
bmi :1
dex
bne :0
rts
*------------------------------------------------- MAKEfade_tbls
*
* Make 16 lookup tables each containing 256 bytes
* for the 16 levels of fade-in.
*
MAKEfade_tbls dum 0
:curtmp ds 2 ;ptr into current tmp_scale table
:curfade ds 2 ;ptr into current page of fade table
:temp ds 1
:ysave ds 1
dend
jsr MAKEtmp_scale
ldy #tmp_scale
lda #>tmp_scale
sty :curtmp
sta :curtmp+1
ldy #fade_table
lda #>fade_table
sty :curfade
sta :curfade+1
* byte loop
ldy #0
:bloop tya
and #$0F
jsr :convert
sta :temp
tya
lsr
lsr
lsr
lsr
jsr :convert
asl
asl
asl
asl
ora :temp
sta (:curfade),y
iny
bne :bloop
* next fade table
inc :curfade+1
* next tmp table
clc
lda :curtmp
adc #16
sta :curtmp
bcc :bloop
rts
* given a=0-15, in lores unsequential grey scale,
* convert it back to sequential, lookup new value
* in tmp_scale table and then convert back to
* lores unsequential.
:convert sty :ysave
* Convert lores color back to sequential 00-0F
tax
lda :unlores,x
* Scale it
tay
lda (:curtmp),y
* Convert back to unsequential lores color
tax
lda isGS?
beq :notGS
lda :loresGS,x
bra :isGS
:notGS lda :lores2e,x
:isGS ldy :ysave
rts
:unlores hex 000301070405020a
hex 06080b0c090e0d0f
:loresGS hex 0002060104050803
hex 090c070a0b0e0d0f
:lores2e hex 00000000
hex 02020202
hex 06060606
hex 07070707
*------------------------------------------------- MAKEtmp_scale
*
* Make lookup table that contains values
* for 0-15 multiplied by 1/16... 16/16.
*
MAKEtmp_scale dum 0
:color ds 1
:scale ds 1
dend
lda #1 ;start with 1/16th
sta :scale
:sloop ldy #0
:cloop sty :color
lda #0
ldx :scale
:mloop clc
adc :color
dex
bne :mloop
lsr
lsr
lsr
lsr
:smc sta tmp_scale,y
iny
cpy #16
bne :cloop
inc :scale
lda :smc+1
clc
adc #16
sta :smc+1
bcc :sloop
rts
*-------------------------------------------------
dum $D000
fade_table ds $1000
tmp_scale ds $100
dend
*------------------------------------------------- EOF
|
||||
lst off
|
||||
|
||||
org $c00
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
dum 0
|
||||
curpage ds 1
|
||||
xsave ds 1
|
||||
ysave ds 1
|
||||
asave ds 1
|
||||
temp ds 1
|
||||
tmplo ds 1
|
||||
tmphi ds 1
|
||||
level ds 1
|
||||
isGS? ds 1
|
||||
dend
|
||||
|
||||
framebase = $1000
|
||||
|
||||
*------------------------------------------------- show
|
||||
*
|
||||
* put on the show!
|
||||
*
|
||||
|
||||
show bit $C010
|
||||
|
||||
lda #0
|
||||
sta isGS?
|
||||
|
||||
bit $C081
|
||||
sec
|
||||
jsr $fe1f ;GS?
|
||||
bcs :notGS
|
||||
|
||||
inc isGS?
|
||||
|
||||
* Use special show frame routine for //GS that
|
||||
* writes directly to bank $E0, since page two
|
||||
* text is not properly shadowed to that bank.
|
||||
|
||||
ldx #$4C ;jmp
|
||||
ldy #GSshowframe
|
||||
lda #>GSshowframe
|
||||
stx showframe
|
||||
sty showframe+1
|
||||
sta showframe+2
|
||||
|
||||
* Make our lookup tables up in ramcard area
|
||||
|
||||
:notGS bit $C083
|
||||
bit $C083
|
||||
|
||||
jsr MAKEfade_tbls
|
||||
|
||||
jsr lgr
|
||||
|
||||
:again
|
||||
|
||||
ldx #0
|
||||
:fadein stx level
|
||||
lda #0
|
||||
jsr showframe
|
||||
ldx level
|
||||
inx
|
||||
cpx #15
|
||||
bcc :fadein
|
||||
|
||||
* Here we go...
|
||||
|
||||
lda #0
|
||||
:floop pha
|
||||
ldx #15
|
||||
jsr showframe
|
||||
pla
|
||||
clc
|
||||
adc #1
|
||||
cmp #23
|
||||
bcc :floop
|
||||
|
||||
ldx #15
|
||||
:fadeout stx level
|
||||
lda #22
|
||||
jsr showframe
|
||||
ldx level
|
||||
dex
|
||||
bpl :fadeout
|
||||
|
||||
bit $C000
|
||||
bpl *-3
|
||||
bit $C010
|
||||
|
||||
jmp :again
|
||||
|
||||
*------------------------------------------------- lgr
|
||||
*
|
||||
* Clear and display lo-resolution screen
|
||||
*
|
||||
|
||||
lgr sta $C000 ;turn off 55.54 select
|
||||
sta $C00C ;40 columns
|
||||
bit $C052 ;full screen
|
||||
bit $C055 ;show page two
|
||||
bit $C056 ;lores
|
||||
bit $C050 ;graphics on
|
||||
|
||||
lda #4 ;use page one next
|
||||
sta curpage
|
||||
|
||||
ldy #0
|
||||
sty tmplo
|
||||
sta tmphi
|
||||
|
||||
tya
|
||||
ldx #8
|
||||
|
||||
:0 sta (tmplo),y
|
||||
iny
|
||||
bne :0
|
||||
|
||||
inc tmphi
|
||||
dex
|
||||
bne :0
|
||||
|
||||
rts
|
||||
|
||||
*------------------------------------------------- loget
|
||||
*
|
||||
* Enter with a:frame number
|
||||
* x:fade level
|
||||
*
|
||||
|
||||
showframe asl
|
||||
asl
|
||||
adc #>framebase
|
||||
sta :src+2 ;hi byte
|
||||
|
||||
txa
|
||||
ora #>fade_table
|
||||
sta :fademod+2
|
||||
|
||||
lda curpage
|
||||
sta :dst+2
|
||||
eor #4!8
|
||||
sta curpage
|
||||
|
||||
lda #4
|
||||
sta temp
|
||||
|
||||
ldx #0
|
||||
:loop
|
||||
:src ldy $1100,x
|
||||
:fademod lda fade_table+$F00,y
|
||||
:dst sta $0400,x
|
||||
inx
|
||||
bne :loop
|
||||
|
||||
inc :src+2 ;hibyte
|
||||
inc :dst+2 ; " "
|
||||
|
||||
dec temp
|
||||
bne :loop
|
||||
|
||||
]waitvbl jsr waitvbl
|
||||
|
||||
bit $C055
|
||||
lda curpage
|
||||
cmp #4
|
||||
beq *+5
|
||||
bit $C054
|
||||
|
||||
rts
|
||||
|
||||
GSshowframe asl
|
||||
asl
|
||||
adc #>framebase
|
||||
sta :src+2 ;hi byte
|
||||
|
||||
txa
|
||||
ora #>fade_table
|
||||
sta :fademod+2
|
||||
|
||||
lda curpage
|
||||
sta :dst+2
|
||||
eor #4!8
|
||||
sta curpage
|
||||
|
||||
lda #4
|
||||
sta temp
|
||||
|
||||
ldx #0
|
||||
:loop
|
||||
:src ldy $1100,x
|
||||
:fademod lda fade_table+$F00,y
|
||||
:dst stal $E00400,x
|
||||
inx
|
||||
bne :loop
|
||||
|
||||
inc :src+2 ;hibyte
|
||||
inc :dst+2 ; " "
|
||||
|
||||
dec temp
|
||||
bne :loop
|
||||
beq ]waitvbl
|
||||
|
||||
*------------------------------------------------- waitvbl
|
||||
*
|
||||
* Wait for a few vbl's to go by!
|
||||
*
|
||||
|
||||
waitvbl ldx #6
|
||||
:0 bit $C019
|
||||
bpl :0
|
||||
:1 bit $C019
|
||||
bmi :1
|
||||
dex
|
||||
bne :0
|
||||
rts
|
||||
|
||||
*------------------------------------------------- MAKEfade_tbls
|
||||
*
|
||||
* Make 16 lookup tables each containing 256 bytes
|
||||
* for the 16 levels of fade-in.
|
||||
*
|
||||
|
||||
MAKEfade_tbls dum 0
|
||||
:curtmp ds 2 ;ptr into current tmp_scale table
|
||||
:curfade ds 2 ;ptr into current page of fade table
|
||||
:temp ds 1
|
||||
:ysave ds 1
|
||||
dend
|
||||
|
||||
jsr MAKEtmp_scale
|
||||
|
||||
ldy #tmp_scale
|
||||
lda #>tmp_scale
|
||||
sty :curtmp
|
||||
sta :curtmp+1
|
||||
|
||||
ldy #fade_table
|
||||
lda #>fade_table
|
||||
sty :curfade
|
||||
sta :curfade+1
|
||||
|
||||
* byte loop
|
||||
|
||||
ldy #0
|
||||
|
||||
:bloop tya
|
||||
and #$0F
|
||||
jsr :convert
|
||||
sta :temp
|
||||
|
||||
tya
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
jsr :convert
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
ora :temp
|
||||
|
||||
sta (:curfade),y
|
||||
|
||||
iny
|
||||
bne :bloop
|
||||
|
||||
* next fade table
|
||||
|
||||
inc :curfade+1
|
||||
|
||||
* next tmp table
|
||||
|
||||
clc
|
||||
lda :curtmp
|
||||
adc #16
|
||||
sta :curtmp
|
||||
bcc :bloop
|
||||
|
||||
rts
|
||||
|
||||
* given a=0-15, in lores unsequential grey scale,
|
||||
* convert it back to sequential, lookup new value
|
||||
* in tmp_scale table and then convert back to
|
||||
* lores unsequential.
|
||||
|
||||
:convert sty :ysave
|
||||
|
||||
* Convert lores color back to sequential 00-0F
|
||||
|
||||
tax
|
||||
lda :unlores,x
|
||||
|
||||
* Scale it
|
||||
|
||||
tay
|
||||
lda (:curtmp),y
|
||||
|
||||
* Convert back to unsequential lores color
|
||||
|
||||
tax
|
||||
lda isGS?
|
||||
beq :notGS
|
||||
lda :loresGS,x
|
||||
bra :isGS
|
||||
|
||||
:notGS lda :lores2e,x
|
||||
|
||||
:isGS ldy :ysave
|
||||
rts
|
||||
|
||||
:unlores hex 000301070405020a
|
||||
hex 06080b0c090e0d0f
|
||||
|
||||
:loresGS hex 0002060104050803
|
||||
hex 090c070a0b0e0d0f
|
||||
|
||||
:lores2e hex 00000000
|
||||
hex 02020202
|
||||
hex 06060606
|
||||
hex 07070707
|
||||
|
||||
*------------------------------------------------- MAKEtmp_scale
|
||||
*
|
||||
* Make lookup table that contains values
|
||||
* for 0-15 multiplied by 1/16... 16/16.
|
||||
*
|
||||
|
||||
MAKEtmp_scale dum 0
|
||||
:color ds 1
|
||||
:scale ds 1
|
||||
dend
|
||||
|
||||
lda #1 ;start with 1/16th
|
||||
sta :scale
|
||||
|
||||
:sloop ldy #0
|
||||
:cloop sty :color
|
||||
lda #0
|
||||
ldx :scale
|
||||
:mloop clc
|
||||
adc :color
|
||||
dex
|
||||
bne :mloop
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
:smc sta tmp_scale,y
|
||||
iny
|
||||
cpy #16
|
||||
bne :cloop
|
||||
inc :scale
|
||||
lda :smc+1
|
||||
clc
|
||||
adc #16
|
||||
sta :smc+1
|
||||
bcc :sloop
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
dum $D000
|
||||
fade_table ds $1000
|
||||
tmp_scale ds $100
|
||||
dend
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1 +1,211 @@
|
|||
* purple.main
lst off
* The job of this routine is to set $DA to $01
* ( in aux-zpage!!! )
slot = $FD
*-------------------------------------------------
*
* HLS APPLE COPY PROTECTION
* COPYRIGHT (C) 1987 HLS DUPLICATION
*
* HLS 408-773-1500
*
* Modified by Roland Gustafsson 8/25/89
* for Prince of Persia copy protection.
*
*-------------------------------------------------
* ZERO PAGE
OBJSCT = $07 ;PHYSICAL SECTOR #
HDRC = $40
HDRS = HDRC+1
HDRT = HDRC+2
HDRV = HDRC+3 HEADER SECTOR
LSRETRY = HDRC+4 ;NIB READ RETRIES
PRETRY = HDRC+5 ;OBJSCT RETRIES
NPTR = HDRC+6
NPTRH = HDRC+7
MEM1 = HDRC+8
MEM2 = HDRC+9
zpage = HDRC
zpagelen = 13
*-------------------------------------------------
*
* Here is the code that ends up at $6321.
* Assemble it and run "make.purple.hex" which
* reverses the code and puts it in a text file.
*
*-------------------------------------------------
org $2000
da len6321
dum $6254
zpagebuf ds zpagelen
dend
org $6321
strt6321 jsr swapzpage
lda #10
sta LSRETRY
ldx slot
lda $C089,X
lda $C08E,X
lda #:NIBS ; !!!!! LOW BYTE
sta NPTR
lda #>:NIBS ; !!!!! HIGH BYTE
sta NPTRH
:AGAIN lda #$80
sta PRETRY
:M1 dec PRETRY
beq :LSFAIL
jsr RADR16
bcs :LSFAIL
lda HDRS
cmp #OBJSCT
bne :M1
ldy #0
:M2 lda $C08C,X
bpl :M2
dey
beq :LSFAIL
cmp #$D5
bne :M2
ldy #0
:M3 lda $C08C,X
bpl :M3
dey
beq :LSFAIL
cmp #$E7
bne :M3
:M4 lda $C08C,X
bpl :M4
cmp #$E7
bne :LSFAIL
:M5 lda $C08C,X
bpl :M5
cmp #$E7
bne :LSFAIL
lda $C08D,X
ldy #$10
bit $6 ;3 US. ( FOR //C)
:M6 lda $C08C,X
bpl :M6
dey
beq :LSFAIL
cmp #$EE
bne :M6
* NOW AT 1/2 NIBBLES
ldy #7
:M7 lda $C08C,X * READ DISK DATA
bpl :M7
cmp (NPTR),Y * COMPARE AGAINST TABLE
bne :LSFAIL
dey
bpl :M7
bmi :GOOD
:LSFAIL jmp :LSFAIL1
* A O K
:GOOD jsr swapzpage
lda #0
sta $C009-zpagelen,x
rol
sta $DA-zpagelen,x
sta $C008-zpagelen,x
clc
rts
* FAILED
:LSFAIL1 dec LSRETRY
beq :ERROR
jmp :AGAIN
:NIBS db $FC,$EE,$EE,$FC
db $E7,$EE,$FC,$E7
* Note that drive motor is still on
:ERROR
swapzpage ldx #0
:0 ldy zpagebuf,x
lda zpage,x
sty zpage,x
sta zpagebuf,x
inx
cpx #zpagelen
bne :0
rts
*-------------------------------------------------
*
* Read address mark
*
RADR16 ldy #$FD ;READ ADR HDR
sty MEM1
:RA1 iny
bne :RA2
inc MEM1
beq :RAEXIT
:RA2 lda $C08C,X
bpl :RA2
:RA3 cmp #$D5
bne :RA1
nop
:RA4 lda $C08C,X
bpl :RA4
cmp #$AA
bne :RA3
ldy #3
:RA5 lda $C08C,X
bpl :RA5
cmp #$96
bne :RA3
lda #0
:RA6 sta MEM2
:RA7 lda $C08C,X
bpl :RA7
rol
sta MEM1
:RA8 lda $C08C,X
bpl :RA8
and MEM1
sta HDRC,Y
eor MEM2
dey
bpl :RA6
tay
nop
clc
rts
:RAEXIT sec
rts
len6321 = *-strt6321
org
*------------------------------------------------- EOF
sav purple.main
|
||||
* purple.main
|
||||
|
||||
lst off
|
||||
|
||||
* The job of this routine is to set $DA to $01
|
||||
* ( in aux-zpage!!! )
|
||||
|
||||
slot = $FD
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* HLS APPLE COPY PROTECTION
|
||||
* COPYRIGHT (C) 1987 HLS DUPLICATION
|
||||
*
|
||||
* HLS 408-773-1500
|
||||
*
|
||||
* Modified by Roland Gustafsson 8/25/89
|
||||
* for Prince of Persia copy protection.
|
||||
*
|
||||
*-------------------------------------------------
|
||||
|
||||
* ZERO PAGE
|
||||
|
||||
OBJSCT = $07 ;PHYSICAL SECTOR #
|
||||
|
||||
HDRC = $40
|
||||
HDRS = HDRC+1
|
||||
HDRT = HDRC+2
|
||||
HDRV = HDRC+3 HEADER SECTOR
|
||||
LSRETRY = HDRC+4 ;NIB READ RETRIES
|
||||
PRETRY = HDRC+5 ;OBJSCT RETRIES
|
||||
NPTR = HDRC+6
|
||||
NPTRH = HDRC+7
|
||||
MEM1 = HDRC+8
|
||||
MEM2 = HDRC+9
|
||||
|
||||
zpage = HDRC
|
||||
zpagelen = 13
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Here is the code that ends up at $6321.
|
||||
* Assemble it and run "make.purple.hex" which
|
||||
* reverses the code and puts it in a text file.
|
||||
*
|
||||
*-------------------------------------------------
|
||||
|
||||
org $2000
|
||||
|
||||
da len6321
|
||||
|
||||
dum $6254
|
||||
zpagebuf ds zpagelen
|
||||
dend
|
||||
|
||||
org $6321
|
||||
|
||||
strt6321 jsr swapzpage
|
||||
lda #10
|
||||
sta LSRETRY
|
||||
ldx slot
|
||||
lda $C089,X
|
||||
lda $C08E,X
|
||||
lda #:NIBS ; !!!!! LOW BYTE
|
||||
sta NPTR
|
||||
lda #>:NIBS ; !!!!! HIGH BYTE
|
||||
sta NPTRH
|
||||
:AGAIN lda #$80
|
||||
sta PRETRY
|
||||
:M1 dec PRETRY
|
||||
beq :LSFAIL
|
||||
jsr RADR16
|
||||
bcs :LSFAIL
|
||||
lda HDRS
|
||||
cmp #OBJSCT
|
||||
bne :M1
|
||||
|
||||
ldy #0
|
||||
:M2 lda $C08C,X
|
||||
bpl :M2
|
||||
dey
|
||||
beq :LSFAIL
|
||||
cmp #$D5
|
||||
bne :M2
|
||||
ldy #0
|
||||
|
||||
:M3 lda $C08C,X
|
||||
bpl :M3
|
||||
dey
|
||||
beq :LSFAIL
|
||||
cmp #$E7
|
||||
bne :M3
|
||||
|
||||
:M4 lda $C08C,X
|
||||
bpl :M4
|
||||
cmp #$E7
|
||||
bne :LSFAIL
|
||||
|
||||
:M5 lda $C08C,X
|
||||
bpl :M5
|
||||
cmp #$E7
|
||||
bne :LSFAIL
|
||||
|
||||
lda $C08D,X
|
||||
ldy #$10
|
||||
bit $6 ;3 US. ( FOR //C)
|
||||
:M6 lda $C08C,X
|
||||
bpl :M6
|
||||
dey
|
||||
beq :LSFAIL
|
||||
cmp #$EE
|
||||
bne :M6
|
||||
|
||||
* NOW AT 1/2 NIBBLES
|
||||
|
||||
ldy #7
|
||||
:M7 lda $C08C,X * READ DISK DATA
|
||||
bpl :M7
|
||||
cmp (NPTR),Y * COMPARE AGAINST TABLE
|
||||
bne :LSFAIL
|
||||
dey
|
||||
bpl :M7
|
||||
bmi :GOOD
|
||||
:LSFAIL jmp :LSFAIL1
|
||||
|
||||
* A O K
|
||||
|
||||
:GOOD jsr swapzpage
|
||||
lda #0
|
||||
sta $C009-zpagelen,x
|
||||
rol
|
||||
sta $DA-zpagelen,x
|
||||
sta $C008-zpagelen,x
|
||||
clc
|
||||
rts
|
||||
|
||||
* FAILED
|
||||
|
||||
:LSFAIL1 dec LSRETRY
|
||||
beq :ERROR
|
||||
jmp :AGAIN
|
||||
|
||||
:NIBS db $FC,$EE,$EE,$FC
|
||||
db $E7,$EE,$FC,$E7
|
||||
|
||||
* Note that drive motor is still on
|
||||
|
||||
:ERROR
|
||||
swapzpage ldx #0
|
||||
:0 ldy zpagebuf,x
|
||||
lda zpage,x
|
||||
sty zpage,x
|
||||
sta zpagebuf,x
|
||||
inx
|
||||
cpx #zpagelen
|
||||
bne :0
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Read address mark
|
||||
*
|
||||
|
||||
RADR16 ldy #$FD ;READ ADR HDR
|
||||
sty MEM1
|
||||
:RA1 iny
|
||||
bne :RA2
|
||||
inc MEM1
|
||||
beq :RAEXIT
|
||||
:RA2 lda $C08C,X
|
||||
bpl :RA2
|
||||
:RA3 cmp #$D5
|
||||
bne :RA1
|
||||
nop
|
||||
:RA4 lda $C08C,X
|
||||
bpl :RA4
|
||||
cmp #$AA
|
||||
bne :RA3
|
||||
ldy #3
|
||||
:RA5 lda $C08C,X
|
||||
bpl :RA5
|
||||
cmp #$96
|
||||
bne :RA3
|
||||
lda #0
|
||||
:RA6 sta MEM2
|
||||
:RA7 lda $C08C,X
|
||||
bpl :RA7
|
||||
rol
|
||||
sta MEM1
|
||||
:RA8 lda $C08C,X
|
||||
bpl :RA8
|
||||
and MEM1
|
||||
sta HDRC,Y
|
||||
eor MEM2
|
||||
dey
|
||||
bpl :RA6
|
||||
tay
|
||||
nop
|
||||
clc
|
||||
rts
|
||||
|
||||
:RAEXIT sec
|
||||
rts
|
||||
|
||||
len6321 = *-strt6321
|
||||
|
||||
org
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
||||
sav purple.main
|
||||
|
|
|
@ -1 +1,90 @@
|
|||
* Ryellow1 (put this file!!!)
* This code sets the high bit of $7C in aux mem
* if signature is found on track zero.
* NOTE: make sure the x register has a number
* greater than 4 when calling YELLOW.
YELLrun = $AAAA
YELLOW
:0 sec
rol
clc
rol
dex
bne :0
sta 4
jsr YELLsub
jmp YELLnothing
*-------------------------------------------------
YELLcode
hex 27A26A0C5717236A8AAD0603AA8A3401
hex 03A02F9E0C5717246A03012F9D03E92F
hex 9C032A2F9F6C9F5AF68AF8011AFD0F9B
hex 63AD7A5B0AAA17266ABA51225AED637F
hex 7A5E0AAA17266ABA51225A93634D7A5E
hex 17266ABA51634D7A8617266ABA51634D
hex 7A8917276A0ABA8EAC17266ABA51225A
hex BE63447A5E0AAD17266ABA517B9C7AAF
hex 22BA5E9AA9E696018AAD06374215DCF1
hex B2CA6C9E5AA1E66100564444564D4456
hex 4D8AAD06374215CA0A572E92627AAE4C
hex 925A9717266ABA51637F7A5A4017266A
hex BA5163007A580AA917266ABA51633C7A
hex 4D03AA2F9317266ABA51802F9217266A
hex BA518F92339AAAEF9322BA4D0240B2CA
hex 92CA03AE27620E6F555AFC03AA27670E
hex 0F55276F0E9247620E5A9F1AACE3554C
hex 553AAEC3546C5567670E3AA907670E63
hex A61AAB02928A440113B3068A5601076F
hex 0EB28A5A01138F068A560144670E7A6A
hex 8A5601B20F5583A980AF5700172A6A0C
hex 57CA08B8607A579243AB7A5CCA08AA16
hex 0E0E1F9A3E9A370E0E424A8B7A5BCAAB
hex 9A828E8AB4B7B6B6B6B6B6DA868C88B5
hex B4B7B6B6B6B6B655A9
*-------------------------------------------------
YELLlen = *-YELLcode
* Routine to decode code
hex 20 ;jsr
YELLsub sta 5
ldy #0
:0 lda YELLcode,y
eor 4
sta (4),y
inc 5
lda YELLcode+256,y
eor 4
sta (4),y
dec 5
iny
bne :0
lda 4
eor #$4C!$AA ;jmp instruction
sta 3
jmp 3
*-------------------------------------------------
hex a9 ;lda #imm
YELLnothing ldy #0
inc 5
:0 tya
:1 sta (4),y
iny
bne :1
rts
*------------------------------------------------- EOF
|
||||
* Ryellow1 (put this file!!!)
|
||||
|
||||
* This code sets the high bit of $7C in aux mem
|
||||
* if signature is found on track zero.
|
||||
|
||||
* NOTE: make sure the x register has a number
|
||||
* greater than 4 when calling YELLOW.
|
||||
|
||||
YELLrun = $AAAA
|
||||
|
||||
YELLOW
|
||||
:0 sec
|
||||
rol
|
||||
clc
|
||||
rol
|
||||
dex
|
||||
bne :0
|
||||
sta 4
|
||||
|
||||
jsr YELLsub
|
||||
jmp YELLnothing
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
YELLcode
|
||||
hex 27A26A0C5717236A8AAD0603AA8A3401
|
||||
hex 03A02F9E0C5717246A03012F9D03E92F
|
||||
hex 9C032A2F9F6C9F5AF68AF8011AFD0F9B
|
||||
hex 63AD7A5B0AAA17266ABA51225AED637F
|
||||
hex 7A5E0AAA17266ABA51225A93634D7A5E
|
||||
hex 17266ABA51634D7A8617266ABA51634D
|
||||
hex 7A8917276A0ABA8EAC17266ABA51225A
|
||||
hex BE63447A5E0AAD17266ABA517B9C7AAF
|
||||
hex 22BA5E9AA9E696018AAD06374215DCF1
|
||||
hex B2CA6C9E5AA1E66100564444564D4456
|
||||
hex 4D8AAD06374215CA0A572E92627AAE4C
|
||||
hex 925A9717266ABA51637F7A5A4017266A
|
||||
hex BA5163007A580AA917266ABA51633C7A
|
||||
hex 4D03AA2F9317266ABA51802F9217266A
|
||||
hex BA518F92339AAAEF9322BA4D0240B2CA
|
||||
hex 92CA03AE27620E6F555AFC03AA27670E
|
||||
hex 0F55276F0E9247620E5A9F1AACE3554C
|
||||
hex 553AAEC3546C5567670E3AA907670E63
|
||||
hex A61AAB02928A440113B3068A5601076F
|
||||
hex 0EB28A5A01138F068A560144670E7A6A
|
||||
hex 8A5601B20F5583A980AF5700172A6A0C
|
||||
hex 57CA08B8607A579243AB7A5CCA08AA16
|
||||
hex 0E0E1F9A3E9A370E0E424A8B7A5BCAAB
|
||||
hex 9A828E8AB4B7B6B6B6B6B6DA868C88B5
|
||||
hex B4B7B6B6B6B6B655A9
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
YELLlen = *-YELLcode
|
||||
|
||||
* Routine to decode code
|
||||
|
||||
hex 20 ;jsr
|
||||
|
||||
YELLsub sta 5
|
||||
ldy #0
|
||||
:0 lda YELLcode,y
|
||||
eor 4
|
||||
sta (4),y
|
||||
inc 5
|
||||
lda YELLcode+256,y
|
||||
eor 4
|
||||
sta (4),y
|
||||
dec 5
|
||||
iny
|
||||
bne :0
|
||||
lda 4
|
||||
eor #$4C!$AA ;jmp instruction
|
||||
sta 3
|
||||
jmp 3
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
hex a9 ;lda #imm
|
||||
|
||||
YELLnothing ldy #0
|
||||
inc 5
|
||||
:0 tya
|
||||
:1 sta (4),y
|
||||
iny
|
||||
bne :1
|
||||
rts
|
||||
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
|
|
@ -1 +1,139 @@
|
|||
lst off
org $300
*
* loresshow:0C00.0FFF ($400)
* framedata:1000.6BFF ($5C00)
*
* buffer18 :6C00.7DFF ($1200 one track)
* rw18.d000:7E00.82FF ($500 moved to aux ramcard)
*
BbundID = $AD
loresshow = $c00
buffer18 = $6c00
rw18 = $d000
rw18temp = $7e00
slot = $FD
track = $FE
lastrack = $FF
startrack = 12 ;last 6 sectors here
* 13,14,15,16,17 (5 full tracks here)
errcode = 0
start jsr $e74c ;get slot#
txa
asl
asl
asl
asl
sta $C009 ;aux zpage, ramcard
sta slot
bit $C083
bit $C083
* Move rw18 to its home
ldx #>rw18temp
ldy #>rw18
lda #5
jsr movedata
* Now we can use rw18
jsr rw18
db 7,BbundID
jsr rw18
db 0,5,1 ;drive on
jsr rw18 ;seek to startrack
db 2,1,startrack
* handle special track with
jsr rw18
db 3 ;read in original data
db >buffer18
lda #1
bcs :error
* update last 6 sectors
ldx #>loresshow
ldy #>buffer18+$C00
lda #6
jsr movedata
* write it back out
jsr rw18
db 5 ;writesequ
db >buffer18
lda #2
bcs :error
* write out rest of data...
lda #>loresshow+$600
:wloop sta :buf
inc track
jsr rw18
db 5 ;writesequ
:buf db $11
lda #2
bcs :error
lda :buf
adc #$12
cmp #>loresshow+$600+{5*$1200}
bne :wloop
lda #0
:error pha
jsr rw18
db 1 ;drive off
pla
sta $C008
bit $C081
sta errcode
rts
*------------------------------------------------- movedata
*
* Move data: x:source, y:dest, a:length
*
movedata stx :src+2
sty :dst+2
tax
ldy #0
:loop
:src lda $1100,y
:dst sta $1100,y
iny
bne :loop
inc :src+2
inc :dst+2
dex
bne :loop
rts
*------------------------------------------------- EOF
|
||||
lst off
|
||||
|
||||
org $300
|
||||
|
||||
*
|
||||
* loresshow:0C00.0FFF ($400)
|
||||
* framedata:1000.6BFF ($5C00)
|
||||
*
|
||||
* buffer18 :6C00.7DFF ($1200 one track)
|
||||
* rw18.d000:7E00.82FF ($500 moved to aux ramcard)
|
||||
*
|
||||
|
||||
BbundID = $AD
|
||||
|
||||
loresshow = $c00
|
||||
buffer18 = $6c00
|
||||
|
||||
rw18 = $d000
|
||||
rw18temp = $7e00
|
||||
|
||||
slot = $FD
|
||||
track = $FE
|
||||
lastrack = $FF
|
||||
|
||||
startrack = 12 ;last 6 sectors here
|
||||
|
||||
* 13,14,15,16,17 (5 full tracks here)
|
||||
|
||||
errcode = 0
|
||||
|
||||
start jsr $e74c ;get slot#
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
|
||||
sta $C009 ;aux zpage, ramcard
|
||||
sta slot
|
||||
|
||||
bit $C083
|
||||
bit $C083
|
||||
|
||||
* Move rw18 to its home
|
||||
|
||||
ldx #>rw18temp
|
||||
ldy #>rw18
|
||||
lda #5
|
||||
jsr movedata
|
||||
|
||||
* Now we can use rw18
|
||||
|
||||
jsr rw18
|
||||
db 7,BbundID
|
||||
|
||||
jsr rw18
|
||||
db 0,5,1 ;drive on
|
||||
|
||||
jsr rw18 ;seek to startrack
|
||||
db 2,1,startrack
|
||||
|
||||
* handle special track with
|
||||
|
||||
jsr rw18
|
||||
db 3 ;read in original data
|
||||
db >buffer18
|
||||
lda #1
|
||||
bcs :error
|
||||
|
||||
* update last 6 sectors
|
||||
|
||||
ldx #>loresshow
|
||||
ldy #>buffer18+$C00
|
||||
lda #6
|
||||
jsr movedata
|
||||
|
||||
* write it back out
|
||||
|
||||
jsr rw18
|
||||
db 5 ;writesequ
|
||||
db >buffer18
|
||||
lda #2
|
||||
bcs :error
|
||||
|
||||
* write out rest of data...
|
||||
|
||||
lda #>loresshow+$600
|
||||
:wloop sta :buf
|
||||
|
||||
inc track
|
||||
|
||||
jsr rw18
|
||||
db 5 ;writesequ
|
||||
:buf db $11
|
||||
lda #2
|
||||
bcs :error
|
||||
|
||||
lda :buf
|
||||
adc #$12
|
||||
cmp #>loresshow+$600+{5*$1200}
|
||||
bne :wloop
|
||||
|
||||
lda #0
|
||||
|
||||
:error pha
|
||||
jsr rw18
|
||||
db 1 ;drive off
|
||||
pla
|
||||
|
||||
sta $C008
|
||||
bit $C081
|
||||
sta errcode
|
||||
rts
|
||||
|
||||
*------------------------------------------------- movedata
|
||||
*
|
||||
* Move data: x:source, y:dest, a:length
|
||||
*
|
||||
|
||||
movedata stx :src+2
|
||||
sty :dst+2
|
||||
tax
|
||||
|
||||
ldy #0
|
||||
:loop
|
||||
:src lda $1100,y
|
||||
:dst sta $1100,y
|
||||
iny
|
||||
bne :loop
|
||||
|
||||
inc :src+2
|
||||
inc :dst+2
|
||||
|
||||
dex
|
||||
bne :loop
|
||||
|
||||
rts
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
|
|
@ -1 +1,291 @@
|
|||
* yellow.main
lst off
* The job of this routine is to
* set the high-bit of $7C in aux zpage.
* (It does it by rotating in a carry set)
slot = $fd
lastrack = $ff
*-------------------------------------------------
*
* HLS APPLE COPY PROTECTION
* COPYRIGHT (C) 1987 HLS DUPLICATION
*
* Modified by Roland Gustafsson 8/25/89
* for Prince of Persia copy protection.
*
*-------------------------------------------------
OBJSCT = $07 ;PHYSICAL SECTOR #
* ZERO PAGE
HDRC = $30
HDRS = HDRC+1
HDRT = HDRC+2
HDRV = HDRC+3 HEADER SECTOR
LSRETRY = HDRC+4 ;NIB READ RETRIES
PRETRY = HDRC+5 ;OBJSCT RETRIES
NPTR = HDRC+6
NPTRH = HDRC+7
MEM1 = HDRC+8
MEM2 = HDRC+9
zpage = HDRC
zpagelen = 33 ;arbitrarily long (only needs 10)
*-------------------------------------------------
* Jordan says: use $A400-ABFF
* Roland says: OK
orgCHECK = $AAAA ;must be highbyte=lowbyte
org $2000
da lenCHECK
dum $A4A4
zpagebuf ds zpagelen
was27 ds 3 ;should be 1 !!!
was2A ds 5 ; ditto
was26 ds 7 ; ditto again
dend
org orgCHECK
*-------------------------------------------------
start sta $C008 ;switch to main zpage
ldx slot
lda $C089,x ;drive on
jsr swapzpage
* First seek track zero
lda #0
jsr SEEK
* Now check signature
lda #10
sta LSRETRY
ldx slot
lda $C08E,X
lda #>:NIBS
sta NPTRH
lda #:NIBS
sta NPTR
:AGAIN lda #$80
sta PRETRY
:M1 dec PRETRY
beq :LSFAIL
jsr RADR16
bcs :LSFAIL
lda HDRS
cmp #OBJSCT
bne :M1
ldy #0
:M2 lda $C08C,X
bpl :M2
dey
beq :LSFAIL
cmp #$D5
bne :M2
ldy #0
:M3 lda $C08C,X
bpl :M3
dey
beq :LSFAIL
cmp #$E7
bne :M3
:M4 lda $C08C,X
bpl :M4
cmp #$E7
bne :LSFAIL
:M5 lda $C08C,X
bpl :M5
cmp #$E7
bne :LSFAIL
lda $C08D,X
ldy #$10
bit $6 ;3 US. ( FOR //C)
:M6 lda $C08C,X
bpl :M6
dey
beq :LSFAIL
cmp #$EE
bne :M6
* NOW AT 1/2 NIBBLES
ldy #7
:M7 lda $C08C,X * READ DISK DATA
bpl :M7
cmp (NPTR),Y * COMPARE AGAINST TABLE
bne :LSFAIL
dey
bpl :M7
bmi :GOOD
:LSFAIL jmp :LSFAIL1
* A O K
:GOOD jsr swapzpage
sta $C009-zpagelen,x
ror $7C-zpagelen,x
clc
rts
* FAILED
:LSFAIL1 dec LSRETRY
beq :ERROR
jmp :AGAIN
:NIBS db $FC,$EE,$EE,$FC
db $E7,$EE,$FC,$E7
:ERROR jsr swapzpage
sta $C009-zpagelen,x
rts
*-------------------------------------------------
*
* Read address mark
*
RADR16 ldy #$FD
sty MEM1
:RA1 iny
bne :RA2
inc MEM1
beq :RAEXIT
:RA2 lda $C08C,X
bpl :RA2
:RA3 cmp #$D5
bne :RA1
nop
:RA4 lda $C08C,X
bpl :RA4
cmp #$AA
bne :RA3
ldy #3
:RA5 lda $C08C,X
bpl :RA5
cmp #$96
bne :RA3
lda #0
:RA6 sta MEM2
:RA7 lda $C08C,X
bpl :RA7
rol
sta MEM1
:RA8 lda $C08C,X
bpl :RA8
and MEM1
sta HDRC,Y
eor MEM2
dey
bpl :RA6
tay
nop
clc
rts
:RAEXIT sec
rts
*-------------------------------------------------
*
* SEEK, a - track
*
SEEK4 lda #4
SEEK sta was2A
cmp lastrack
beq :RTS0
lda #0
sta was26
:MOVEHEAD lda lastrack
sta was27
sec
sbc was2A
beq :ISTHERE
bcs :T0
eor #$FF
inc lastrack
bcc :T1
:T0 adc #$FE
dec lastrack
:T1 cmp was26
bcc :T2
lda was26
:T2 cmp #$C
bcs :T3
tay
:T3 sec
jsr :CHKPOS
lda ONTBL,Y
jsr :MSWAIT
lda was27
clc
jsr :CHKPOS2
lda OFFTBL,Y
jsr :MSWAIT
inc was26
bne :MOVEHEAD
:ISTHERE jsr :MSWAIT
clc
:CHKPOS lda lastrack
:CHKPOS2 and #3
rol
ora slot
tax
lda $C080,X
ldx slot
:RTS0 rts
:MSWAIT ldx #$12
:T21 dex
bne :T21
sec
sbc #1
bne :MSWAIT
rts
*-------------------------------------------------
swapzpage ldx #0
:0 ldy zpagebuf,x
lda zpage,x
sty zpage,x
sta zpagebuf,x
inx
cpx #zpagelen
bne :0
rts
*-------------------------------------------------
ONTBL db $01,$30,$28,$24,$20,$1E,$1D,$1C,$1C,$1C,$1C,$1C
OFFTBL db $70,$2C,$26,$22,$1F,$1E,$1D,$1C,$1C,$1C,$1C,$1C,$FF,$03
*-------------------------------------------------
lenCHECK = *-orgCHECK
org
*------------------------------------------------- EOF
sav yellow.main
|
||||
* yellow.main
|
||||
lst off
|
||||
|
||||
* The job of this routine is to
|
||||
* set the high-bit of $7C in aux zpage.
|
||||
* (It does it by rotating in a carry set)
|
||||
|
||||
slot = $fd
|
||||
lastrack = $ff
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* HLS APPLE COPY PROTECTION
|
||||
* COPYRIGHT (C) 1987 HLS DUPLICATION
|
||||
*
|
||||
* Modified by Roland Gustafsson 8/25/89
|
||||
* for Prince of Persia copy protection.
|
||||
*
|
||||
*-------------------------------------------------
|
||||
|
||||
OBJSCT = $07 ;PHYSICAL SECTOR #
|
||||
|
||||
* ZERO PAGE
|
||||
|
||||
HDRC = $30
|
||||
HDRS = HDRC+1
|
||||
HDRT = HDRC+2
|
||||
HDRV = HDRC+3 HEADER SECTOR
|
||||
LSRETRY = HDRC+4 ;NIB READ RETRIES
|
||||
PRETRY = HDRC+5 ;OBJSCT RETRIES
|
||||
NPTR = HDRC+6
|
||||
NPTRH = HDRC+7
|
||||
MEM1 = HDRC+8
|
||||
MEM2 = HDRC+9
|
||||
|
||||
zpage = HDRC
|
||||
zpagelen = 33 ;arbitrarily long (only needs 10)
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
* Jordan says: use $A400-ABFF
|
||||
* Roland says: OK
|
||||
|
||||
orgCHECK = $AAAA ;must be highbyte=lowbyte
|
||||
|
||||
org $2000
|
||||
|
||||
da lenCHECK
|
||||
|
||||
dum $A4A4
|
||||
zpagebuf ds zpagelen
|
||||
was27 ds 3 ;should be 1 !!!
|
||||
was2A ds 5 ; ditto
|
||||
was26 ds 7 ; ditto again
|
||||
dend
|
||||
|
||||
org orgCHECK
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
start sta $C008 ;switch to main zpage
|
||||
|
||||
ldx slot
|
||||
lda $C089,x ;drive on
|
||||
|
||||
jsr swapzpage
|
||||
|
||||
* First seek track zero
|
||||
|
||||
lda #0
|
||||
jsr SEEK
|
||||
|
||||
* Now check signature
|
||||
|
||||
lda #10
|
||||
sta LSRETRY
|
||||
ldx slot
|
||||
lda $C08E,X
|
||||
lda #>:NIBS
|
||||
sta NPTRH
|
||||
lda #:NIBS
|
||||
sta NPTR
|
||||
|
||||
:AGAIN lda #$80
|
||||
sta PRETRY
|
||||
:M1 dec PRETRY
|
||||
beq :LSFAIL
|
||||
jsr RADR16
|
||||
bcs :LSFAIL
|
||||
lda HDRS
|
||||
cmp #OBJSCT
|
||||
bne :M1
|
||||
|
||||
ldy #0
|
||||
:M2 lda $C08C,X
|
||||
bpl :M2
|
||||
dey
|
||||
beq :LSFAIL
|
||||
cmp #$D5
|
||||
bne :M2
|
||||
ldy #0
|
||||
|
||||
:M3 lda $C08C,X
|
||||
bpl :M3
|
||||
dey
|
||||
beq :LSFAIL
|
||||
cmp #$E7
|
||||
bne :M3
|
||||
|
||||
:M4 lda $C08C,X
|
||||
bpl :M4
|
||||
cmp #$E7
|
||||
bne :LSFAIL
|
||||
|
||||
:M5 lda $C08C,X
|
||||
bpl :M5
|
||||
cmp #$E7
|
||||
bne :LSFAIL
|
||||
|
||||
lda $C08D,X
|
||||
ldy #$10
|
||||
bit $6 ;3 US. ( FOR //C)
|
||||
:M6 lda $C08C,X
|
||||
bpl :M6
|
||||
dey
|
||||
beq :LSFAIL
|
||||
cmp #$EE
|
||||
bne :M6
|
||||
|
||||
* NOW AT 1/2 NIBBLES
|
||||
|
||||
ldy #7
|
||||
:M7 lda $C08C,X * READ DISK DATA
|
||||
bpl :M7
|
||||
cmp (NPTR),Y * COMPARE AGAINST TABLE
|
||||
bne :LSFAIL
|
||||
dey
|
||||
bpl :M7
|
||||
bmi :GOOD
|
||||
:LSFAIL jmp :LSFAIL1
|
||||
|
||||
* A O K
|
||||
|
||||
:GOOD jsr swapzpage
|
||||
sta $C009-zpagelen,x
|
||||
ror $7C-zpagelen,x
|
||||
clc
|
||||
rts
|
||||
|
||||
* FAILED
|
||||
|
||||
:LSFAIL1 dec LSRETRY
|
||||
beq :ERROR
|
||||
jmp :AGAIN
|
||||
|
||||
:NIBS db $FC,$EE,$EE,$FC
|
||||
db $E7,$EE,$FC,$E7
|
||||
|
||||
:ERROR jsr swapzpage
|
||||
sta $C009-zpagelen,x
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* Read address mark
|
||||
*
|
||||
|
||||
RADR16 ldy #$FD
|
||||
sty MEM1
|
||||
:RA1 iny
|
||||
bne :RA2
|
||||
inc MEM1
|
||||
beq :RAEXIT
|
||||
:RA2 lda $C08C,X
|
||||
bpl :RA2
|
||||
:RA3 cmp #$D5
|
||||
bne :RA1
|
||||
nop
|
||||
:RA4 lda $C08C,X
|
||||
bpl :RA4
|
||||
cmp #$AA
|
||||
bne :RA3
|
||||
ldy #3
|
||||
:RA5 lda $C08C,X
|
||||
bpl :RA5
|
||||
cmp #$96
|
||||
bne :RA3
|
||||
lda #0
|
||||
:RA6 sta MEM2
|
||||
:RA7 lda $C08C,X
|
||||
bpl :RA7
|
||||
rol
|
||||
sta MEM1
|
||||
:RA8 lda $C08C,X
|
||||
bpl :RA8
|
||||
and MEM1
|
||||
sta HDRC,Y
|
||||
eor MEM2
|
||||
dey
|
||||
bpl :RA6
|
||||
tay
|
||||
nop
|
||||
clc
|
||||
rts
|
||||
|
||||
:RAEXIT sec
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
*
|
||||
* SEEK, a - track
|
||||
*
|
||||
|
||||
SEEK4 lda #4
|
||||
SEEK sta was2A
|
||||
cmp lastrack
|
||||
beq :RTS0
|
||||
lda #0
|
||||
sta was26
|
||||
:MOVEHEAD lda lastrack
|
||||
sta was27
|
||||
sec
|
||||
sbc was2A
|
||||
beq :ISTHERE
|
||||
bcs :T0
|
||||
eor #$FF
|
||||
inc lastrack
|
||||
bcc :T1
|
||||
:T0 adc #$FE
|
||||
dec lastrack
|
||||
:T1 cmp was26
|
||||
bcc :T2
|
||||
lda was26
|
||||
:T2 cmp #$C
|
||||
bcs :T3
|
||||
tay
|
||||
:T3 sec
|
||||
jsr :CHKPOS
|
||||
lda ONTBL,Y
|
||||
jsr :MSWAIT
|
||||
lda was27
|
||||
clc
|
||||
jsr :CHKPOS2
|
||||
lda OFFTBL,Y
|
||||
jsr :MSWAIT
|
||||
inc was26
|
||||
bne :MOVEHEAD
|
||||
:ISTHERE jsr :MSWAIT
|
||||
clc
|
||||
:CHKPOS lda lastrack
|
||||
:CHKPOS2 and #3
|
||||
rol
|
||||
ora slot
|
||||
tax
|
||||
lda $C080,X
|
||||
ldx slot
|
||||
:RTS0 rts
|
||||
|
||||
:MSWAIT ldx #$12
|
||||
:T21 dex
|
||||
bne :T21
|
||||
sec
|
||||
sbc #1
|
||||
bne :MSWAIT
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
swapzpage ldx #0
|
||||
:0 ldy zpagebuf,x
|
||||
lda zpage,x
|
||||
sty zpage,x
|
||||
sta zpagebuf,x
|
||||
inx
|
||||
cpx #zpagelen
|
||||
bne :0
|
||||
rts
|
||||
|
||||
*-------------------------------------------------
|
||||
|
||||
ONTBL db $01,$30,$28,$24,$20,$1E,$1D,$1C,$1C,$1C,$1C,$1C
|
||||
OFFTBL db $70,$2C,$26,$22,$1F,$1E,$1D,$1C,$1C,$1C,$1C,$1C,$FF,$03
|
||||
|
||||
*-------------------------------------------------
|
||||
lenCHECK = *-orgCHECK
|
||||
|
||||
org
|
||||
|
||||
*------------------------------------------------- EOF
|
||||
|
||||
sav yellow.main
|
||||
|
|
Loading…
Reference in New Issue