antoine-source/ultima2/UPDATE.S

222 lines
4.0 KiB
ArmAsm
Raw Normal View History

*
* Ultima II: The Revenge of the Enchanteress
*
* (c) 1982, Sierra On-Line
* (s) 2020, John Disam
*
TYP BIN
ORG $0240
MX %11
LST OFF
*----------------------------
L0240 LDA $10
CMP #$FF
BNE L0249
JMP L02D7
L0249 SEC
LDA $01
SBC #$05
STA $03
SEC
LDA $00
SBC #$09
STA $02
LDA #$00
STA $05
STA $04
TAY
TAX
L025F CLC
LDA $04
ADC $02
CMP #$40
BCS L0270
LDA $05
ADC $03
CMP #$40
BCC L0275
L0270 LDA $10
JMP L0291
L0275 STA $07
LDA #$00
LSR $07
ROR
LSR $07
ROR
ADC $04
ADC $02
STA $06
CLC
LDA $07
ADC #$10
STA $07
LDA ($06),Y
LSR
AND #$FE
L0291 CMP $4C00,X
BNE L02A0
CMP #$00
BEQ L02A0
CMP #$2E
BEQ L02A0
ORA #$80
L02A0 STA $4B00,X
INX
INC $04
LDA $04
CMP #$14
BNE L025F
STY $04
INC $05
LDA $05
CMP #$0A
BNE L025F
LDA $4B6D
STA $12
LDA $4B59
STA $13
LDA $4B81
STA $14
LDA $4B6C
STA $16
LDA $4B6E
STA $15
LDA $11
STA $4B6D
JMP L035E
L02D7 SEC
LDA $01
SBC #$05
AND #$3F
STA $03
SEC
LDA $00
SBC #$09
AND #$3F
STA $02
LDA #$00
STA $05
STA $04
TAY
TAX
L02F1 CLC
LDA $04
ADC $02
AND #$3F
STA $17
CLC
LDA $05
ADC $03
AND #$3F
STA $07
LDA #$00
LSR $07
ROR
LSR $07
ROR
ADC $17
STA $06
CLC
LDA $07
ADC #$10
STA $07
LDA ($06),Y
LSR
AND #$FE
CMP $4C00,X
BNE L032A
CMP #$00
BEQ L032A
CMP #$2E
BEQ L032A
ORA #$80
L032A STA $4B00,X
INX
INC $04
LDA $04
CMP #$14
BNE L02F1
STY $04
INC $05
LDA $05
CMP #$0A
BNE L02F1
LDA $4B6D
STA $12
LDA $4B59
STA $13
LDA $4B81
STA $14
LDA $4B6C
STA $16
LDA $4B6E
STA $15
LDA $11
STA $4B6D
L035E LDX #$00
STX $0C
L0362 LDY $0C
LDA $472C,Y
STA L0399+1
STA L03A5+1
LDA $47EC,Y
STA L0399+2
STA L03A5+2
TYA
AND #$0F
LSR
ORA #$08
STA L0394+2
STA L039F+2
LDA #$00
STA $0D
ROR
STA L0394+1
ADC #$01
STA L039F+1
L038F LDY $4B00,X
BMI L03A8
L0394 LDA $FFFF,Y
LDY $0D
L0399 STA $FFFF,Y
LDY $4B00,X
L039F LDA $FFFF,Y
LDY $0D
INY
L03A5 STA $FFFF,Y
L03A8 INX
LDA $0D
CLC
ADC #$02
STA $0D
CMP #$28
BNE L038F
INC $0C
LDA $0C
CMP #$A0
BEQ L03C7
AND #$0F
BEQ L0362
TXA
SBC #$13
TAX
JMP L0362
L03C7 LDX #$00
L03C9 LDA $4B00,X
AND #$7F
STA $4C00,X
INX
CPX #$F0
BNE L03C9
RTS
HEX A0
HEX D3