antoine-source/loderunner/LR.RWTS.S
2024-06-18 21:04:29 +02:00

932 lines
11 KiB
ArmAsm

*
* Lode Runner
* (c) 1983, Broderbund Software
* (s) 2014, Brutal Deluxe Software
*
*---------------------------------------
* RWTS
*---------------------------------------
lst on
la = * ; must be $B600
lst off
LB600 HEX 01A527C909D018A52B4A4A4A4A09C085
HEX 3FA95C853E18ADFE086DFF088DFE08AE
HEX FF083015BD4D08853DCEFF08ADFE0885
HEX 27CEFE08A62B6C3E00EEFE08EEFE0820
HEX 89FE2093FE202FFBA62B6CFD08000D0B
HEX 09070503010E0C0A080604020F002064
HEX A7B008A900A88D5DB69140ADC5B54CD2
HEX A6AD5DB6F008EEBDB5D003EEBEB5A900
HEX 8D5DB64C46A58DBCB520A8A620EAA24C
HEX 7DA2A013B142D014C8C017D0F7A019B1
HEX 4299A4B5C8C01DD0F64CBCA6A2FF8E5D
HEX B6D0F600000000000000000000000000
HEX 00000000000000000000000000000000
HEX 2058FCA9C220EDFDA90120DAFDA9AD20
HEX EDFDA90020DAFD600000000000000000
HEX 0000000000000000000000000000B609
LB700 STX LB7E9
STX LB7F7
LDA #$01
STA LB7F8
STA LB7EA
LDA LB7E0
STA LB7E1
LDA #$02
STA LB7EC
LDA #$04
STA LB7ED
LDY LB7E7
DEY
STY LB7F0+1
LDA #$01
STA LB7F4
TXA
LSR
LSR
LSR
LSR
TAX
LDA #$00
STA $04F8,X
STA $0478,X
JSR LB793
LDX #$FF
TXS
STX LB7EB
NOP
NOP
NOP
JSR SETKBD
JMP $9D84
LDA LB7E7
SEC
SBC LB7F0+1
STA LB7E1
LDA LB7E7
STA LB7F0+1
DEC LB7F0+1
LDA #$02
STA LB7EC
LDA #$04
STA LB7ED
LDA #$02
STA LB7F4
JSR LB793
LDA LB7E7
STA LB600+$FE
CLC
ADC #$09
STA LB7F0+1
LDA #$0A
STA LB7E1
SEC
SBC #$01
STA LB600+$FF
STA LB7ED
JSR LB793
RTS
DB $00
DB $00
DB $00
DB $00
DB $00
DB $00
LB793 LDA LB7E4+1
LDY LB7E4
JSR LB7B5
LDY LB7ED
DEY
BPL LB7A9
LDY #$0F
NOP
NOP
DEC LB7EC
LB7A9 STY LB7ED
DEC LB7F0+1
DEC LB7E1
BNE LB793
RTS
LB7B5 PHP
SEI
JSR LBD00
BCS LB7BF
PLP
CLC
RTS
LB7BF PLP
SEC
RTS
DS 29
* LDA LB558+$64
* STA LB7F0+1
* LDA #$00
* STA LB7F0
* LDA LB5C0+$39
* EOR #$FF
* STA LB7EB
* RTS
*
* LDA #$00
* TAY
*LB7D9 STA ($42),Y
* INY
* BNE LB7D9
* RTS
DB $00
LB7E0 DB $1B
LB7E1 DB $00
DB $0A
DB $1B
LB7E4 DA $B7E8
DB $00
LB7E7 DB $B6
LB7E8 DB $01
LB7E9 DB $70
LB7EA DB $01
LB7EB DB $FF
LB7EC DB $13
LB7ED DB $05
DA LB7FB
LB7F0 DA $9600
DB $00
DB $01
LB7F4 DB $01
DB $00
DB $01
LB7F7 DB $60
LB7F8 DB $01
DB $00
DB $00
LB7FB DB $00
DB $01
DB $EF
DB $D8
DB $00
LB800 LDX #$00
LDY #$02
LB804 DEY
LDA ($3E),Y
LSR
ROL LBC00,X
LSR
ROL LBC00,X
STA LBB00,Y
INX
CPX #$56
BCC LB804
LDX #$00
TYA
BNE LB804
LDX #$55
LB81E LDA LBC00,X
AND #$3F
STA LBC00,X
DEX
BPL LB81E
RTS
LB82A SEC
STX $27
STX $0678
LDA $C08D,X
LDA $C08E,X
BMI LB8B4
LDA LBC00
STA $26
LDA #$FF
STA $C08F,X
ORA $C08C,X
PHA
PLA
NOP
LDY #$04
LB84A PHA
PLA
JSR LB8B9
DEY
BNE LB84A
LDA #$D5
JSR LB8B8
LDA #$AA
JSR LB8B8
LDA #$AD
JSR LB8B8
TYA
LDY #$56
BNE LB869
LB866 LDA LBC00,Y
LB869 EOR LBBFF,Y
TAX
LDA LBA29,X
LDX $27
STA $C08D,X
LDA $C08C,X
DEY
BNE LB866
LDA $26
NOP
LB87E EOR LBB00,Y
TAX
LDA LBA29,X
LDX $0678
STA $C08D,X
LDA $C08C,X
LDA LBB00,Y
INY
BNE LB87E
TAX
LDA LBA29,X
LDX $27
JSR LB8BB
LDA #$DE
JSR LB8B8
LDA #$AA
JSR LB8B8
LDA #$EB
JSR LB8B8
LDA #$FF
JSR LB8B8
LDA $C08E,X
LB8B4 LDA $C08C,X
RTS
LB8B8 CLC
LB8B9 PHA
PLA
LB8BB STA $C08D,X
ORA $C08C,X
RTS
LB8C2 LDY #$00
LB8C4 LDX #$56
LB8C6 DEX
BMI LB8C4
LDA LBB00,Y
LSR LBC00,X
ROL
LSR LBC00,X
ROL
STA ($3E),Y
INY
CPY $26
BNE LB8C6
RTS
LB8DC LDY #$20
LB8DE DEY
BEQ LB942
LB8E1 LDA $C08C,X
BPL LB8E1
LB8E6 EOR #$D5
BNE LB8DE
NOP
LB8EB LDA $C08C,X
BPL LB8EB
CMP #$AA
BNE LB8E6
LDY #$56
LB8F6 LDA $C08C,X
BPL LB8F6
CMP #$AD
BNE LB8E6
LDA #$00
LB901 DEY
STY $26
LB904 LDY $C08C,X
BPL LB904
EOR LBA00,Y
LDY $26
STA LBC00,Y
BNE LB901
LB913 STY $26
LB915 LDY $C08C,X
BPL LB915
EOR LBA00,Y
LDY $26
STA LBB00,Y
INY
BNE LB913
LB925 LDY $C08C,X
BPL LB925
CMP LBA00,Y
BNE LB942
LB92F LDA $C08C,X
BPL LB92F
CMP #$DE
BNE LB942
NOP
LB939 LDA $C08C,X
BPL LB939
CMP #$AA
BEQ LB99E
LB942 SEC
RTS
LB944 LDY #$FC
STY $26
LB948 INY
BNE LB94F
INC $26
BEQ LB942
LB94F LDA $C08C,X
BPL LB94F
LB954 CMP #$D5
BNE LB948
NOP
LB959 LDA $C08C,X
BPL LB959
CMP #$AA
BNE LB954
LDY #$03
LB964 LDA $C08C,X
BPL LB964
CMP #$96
BNE LB954
LDA #$00
LB96F STA $27
LB971 LDA $C08C,X
BPL LB971
ROL
STA $26
LB979 LDA $C08C,X
BPL LB979
AND $26
STA |$002C,Y
EOR $27
DEY
BPL LB96F
TAY
BIT $B7
LB98B LDA $C08C,X
BPL LB98B
CMP #$DE
BNE LB942
NOP
LB995 LDA $C08C,X
BPL LB995
CMP #$AA
BIT $A4
LB99E CLC
RTS
LB9A0 STX $2B
STA $2A
CMP $0478
BEQ LB9FC
LDA #$00
STA $26
LB9AD LDA $0478
STA $27
SEC
SBC $2A
BEQ LB9EA
BCS LB9C0
EOR #$FF
INC $0478
BCC LB9C5
LB9C0 ADC #$FE
DEC $0478
LB9C5 CMP $26
BCC LB9CB
LDA $26
LB9CB CMP #$0C
BCS LB9D0
TAY
LB9D0 SEC
JSR LB9EE
LDA LBA11,Y
JSR LBA00
LDA $27
CLC
JSR LB9F1
LDA LBA1D,Y
JSR LBA00
INC $26
BNE LB9AD
LB9EA JSR LBA00
CLC
LB9EE LDA $0478
LB9F1 AND #$03
ROL
ORA $2B
TAX
LDA $C080,X
LDX $2B
LB9FC RTS
TAX
LDY #$A0
LBA00 LDX #$11
LBA02 DEX
BNE LBA02
INC $46
BNE LBA0B
INC $47
LBA0B SEC
SBC #$01
BNE LBA00
RTS
LBA11 HEX 01302824201E1D1C1C1C1C1C
LBA1D HEX 702C26221F1E1D1C1C1C1C1C
LBA29 HEX 96979A9B9D9E9FA6A7ABACADAEAFB2B3
HEX B4B5B6B7B9BABBBCBDBEBFCBCDCECFD3
HEX D6D7D9DADBDCDDDEDFE5E6E7E9EAEBEC
HEX EDEEEFF2F3F4F5F6F7F9FAFBFCFDFEFF
HEX B3B3A0E0B3C3C5B3A0E0B3C3C5B3A0E0
HEX B3B3C5AAA082B3B3C5AAA082C5B3B3AA
HEX 8882C5B3B3AA8882C5C4B3B088
LBA96 HEX 0001989902039C040506A0A1A2A3A4A5
HEX 0708A8A9AA090A0B0C0DB0B10E0F1011
HEX 1213B81415161718191AC0C1C2C3C4C5
HEX C6C7C8C9CA1BCC1C1D1ED0D1D21FD4D5
HEX 2021D822232425262728E0E1E2E3E429
HEX 2A2BE82C2D2E2F303132F0F133343536
HEX 3738F8393A3B3C3D3E3F
LBB00 HEX 00040300000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 000000000000000000000000000000
LBBFF HEX 00
LBC00 HEX 02000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 00000000000000000000000000000000
HEX 000000000000
LBC56 SEC
LDA $C08D,X
LDA $C08E,X
BMI LBCBD
LDA #$FF
STA $C08F,X
CMP $C08C,X
PHA
PLA
LBC69 JSR LBCC3
JSR LBCC3
STA $C08D,X
CMP $C08C,X
NOP
DEY
BNE LBC69
LDA #$D5
JSR LBCD5
LDA #$AA
JSR LBCD5
LDA #$96
JSR LBCD5
LDA $41
JSR LBCC4
LDA $44
JSR LBCC4
LDA $3F
JSR LBCC4
LDA $41
EOR $44
EOR $3F
PHA
LSR
ORA $3E
STA $C08D,X
LDA $C08C,X
PLA
ORA #$AA
JSR LBCD4
LDA #$DE
JSR LBCD5
LDA #$AA
JSR LBCD5
LDA #$EB
JSR LBCD5
CLC
LBCBD LDA $C08E,X
LDA $C08C,X
LBCC3 RTS
LBCC4 PHA
LSR
ORA $3E
STA $C08D,X
CMP $C08C,X
PLA
NOP
NOP
NOP
ORA #$AA
LBCD4 NOP
LBCD5 NOP
PHA
PLA
STA $C08D,X
CMP $C08C,X
RTS
HEX 88A5E891A0948896E891A09488969191
HEX C894D0969191C894D09691A3C8A0A585
HEX A4
LBD00 STY $48
STA $49
LDY #$02
STY $06F8
LDY #$04
STY $04F8
LDX LB7E9
LDA $C08E,X
LDA $C08C,X
LDY #$08
LBD19 LDA $C08C,X
PHA
PLA
PHA
PLA
STX $05F8
CMP $C08C,X
BNE LBD2B
DEY
BNE LBD19
LBD2B PHP
LDA $C089,X
LDY #$06
LBD31 LDA ($48),Y
STA |$0036,Y
INY
CPY #$0A
BNE LBD31
LDY #$03
LDA ($3C),Y
STA $47
LDY #$02
LDA ($48),Y
LDY #$10
CMP ($48),Y
BEQ LBD51
STA ($48),Y
PLP
LDY #$00
PHP
LBD51 ROR
BCC LBD59
LDA $C08A,X
BCS LBD5C
LBD59 LDA $C08B,X
LBD5C ROR $35
PLP
PHP
BNE LBD6D
LDY #$07
LBD64 JSR LBA00
DEY
BNE LBD64
LDX $05F8
LBD6D LDY #$04
LDA ($48),Y
JSR LBE5A
PLP
BNE LBDAB
NOP
NOP
NOP
NOP
LDA LB7F4
CMP #$01
BEQ LBDAB
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
LBD9E LDY #$12
LBDA0 DEY
BNE LBDA0
INC $46
BNE LBD9E
INC $47
BNE LBD9E
LBDAB LDY #$0C
LDA ($48),Y
BEQ LBE0B
CMP #$04
BEQ LBE0D
ROR
PHP
BCS LBDBC
JSR LB800
LBDBC LDY #$30
STY $0578
LBDC1 LDX $05F8
JSR LB944
BCC LBDED
LBDC9 DEC $0578
BPL LBDC1
LBDCE LDA $0478
PHA
LDA #$60
JSR LBE95
DEC $06F8
BEQ LBE04
LDA #$04
STA $04F8
LDA #$00
JSR LBE5A
PLA
LBDE7 JSR LBE5A
JMP LBDBC
LBDED LDY $2E
CPY $0478
BEQ LBE10
LDA $0478
PHA
TYA
JSR LBE95
PLA
DEC $04F8
BNE LBDE7
BEQ LBDCE
LBE04 PLA
LDA #$40
LBE07 PLP
JMP LBE47+1
LBE0B BEQ LBE46
LBE0D JMP L8E00
LBE10 LDY #$03
LDA ($48),Y
PHA
LDA $2F
LDY #$0E
STA ($48),Y
PLA
BEQ LBE26
CMP $2F
BEQ LBE26
LDA #$20
BNE LBE07
LBE26 LDY #$05
LDA ($48),Y
TAY
LDA LBFB8,Y
CMP $2D
BNE LBDC9
PLP
BCC LBE51
JSR LB8DC
PHP
BCS LBDC9
PLP
LDX #$00
STX $26
JSR LB8C2
LDX $05F8
LBE46 CLC
LBE47 BIT $38
LDY #$0D
STA ($48),Y
LDA $C088,X
RTS
LBE51 JSR LB82A
BCC LBE46
LDA #$10
BCS LBE47+1
LBE5A PHA
LDY #$01
LDA ($3C),Y
ROR
PLA
BCC LBE6B
ASL
JSR LBE6B
LSR $0478
RTS
LBE6B STA $2A
JSR LBE8E
LDA $0478,Y
BIT $35
BMI LBE7A
LDA $04F8,Y
LBE7A STA $0478
LDA $2A
BIT $35
BMI LBE88
STA $04F8,Y
BPL LBE8B
LBE88 STA $0478,Y
LBE8B JMP LB9A0
LBE8E TXA
LSR
LSR
LSR
LSR
TAY
RTS
LBE95 PHA
LDY #$02
LDA ($48),Y
ROR
ROR $35
JSR LBE8E
PLA
ASL
BIT $35
BMI LBEAB
STA $04F8,Y
BPL LBEAE
LBEAB STA $0478,Y
LBEAE RTS
LBEAF LDY #$03
LDA ($48),Y
STA $41
LDA #$AA
STA $3E
LDY #$56
LDA #$00
STA $44
LBEBF STA LBBFF,Y
DEY
BNE LBEBF
LBEC5 STA LBB00,Y
DEY
BNE LBEC5
LDA #$00
JSR LBE95
LDA #$28
STA $45
LBED4 LDA $44
JSR LBE5A
JSR LBF0D
LDA #$08
BCS LBF04
LDA #$30
STA $0578
LBEE5 SEC
DEC $0578
BEQ LBF04
JSR LB944
BCS LBEE5
LDA $2D
BNE LBEE5
JSR LB8DC
BCS LBEE5
INC $44
LDA $44
CMP #$23
BCC LBED4
CLC
BCC LBF09
LBF04 LDY #$0D
STA ($48),Y
SEC
LBF09 LDA $C088,X
RTS
LBF0D LDA #$00
STA $3F
LDY #$80
BNE LBF17
LBF15 LDY $45
LBF17 JSR LBC56
BCS LBF87
JSR LB82A
BCS LBF87
INC $3F
LDA $3F
CMP #$10
BCC LBF15
LDY #$0F
STY $3F
LDA #$30
STA $0578
LBF32 STA LBFA8,Y
DEY
BPL LBF32
LDY $45
LBF3A JSR LBF87
JSR LBF87
JSR LBF87
PHA
PLA
NOP
DEY
BNE LBF3A
JSR LB944
BCS LBF71
LDA $2D
BEQ LBF67
LDA #$10
CMP $45
LDA $45
SBC #$01
STA $45
CMP #$05
BCS LBF71
SEC
RTS
LBF62 JSR LB944
BCS LBF6C
LBF67 JSR LB8DC
BCC LBF88
LBF6C DEC $0578
BNE LBF62
LBF71 JSR LB944
BCS LBF81
LDA $2D
CMP #$0F
BNE LBF81
JSR LB8DC
BCC LBF0D
LBF81 DEC $0578
BNE LBF71
SEC
LBF87 RTS
LBF88 LDY $2D
LDA LBFA8,Y
BMI LBF6C
LDA #$FF
STA LBFA8,Y
DEC $3F
BPL LBF62
LDA $44
BNE LBFA6
LDA $45
CMP #$10
BCC LBF87
DEC $45
DEC $45
LBFA6 CLC
RTS
LBFA8 HEX FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
LBFB8 HEX 000D0B09070503010E0C0A080604020F
ds \
* HEX 20DCABA9108DF0B3A9238DEFB3604C44
* HEX B70000008D63AA8D70AA8D71AA60205B
* HEX A78CB7AA60207EAEAE9BB39A2016A3BA
* HEX 8E9BB3A9094C85B3