This commit is contained in:
Kat
2020-02-04 19:40:33 -05:00
parent f95512e089
commit c1628dcb0e
3 changed files with 41 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
rm ../working.sfc rm ../working.sfc
cp ../alttp.sfc ../working.sfc cp ../alttp.sfc ../working.sfc
./xkas LTTP_RND_GeneralBugfixes.asm ../working.sfc ./xkas LTTP_RND_GeneralBugfixes.asm ../working.sfc

View File

@@ -18,6 +18,7 @@ OnDrawHud:
JSL.l DrawChallengeTimer ; this has to come before NewDrawHud because the timer overwrites the compass counter JSL.l DrawChallengeTimer ; this has to come before NewDrawHud because the timer overwrites the compass counter
JSL.l NewDrawHud JSL.l NewDrawHud
JSL.l SwapSpriteIfNecissary JSL.l SwapSpriteIfNecissary
JSL.l PollService
JML.l ReturnFromOnDrawHud JML.l ReturnFromOnDrawHud
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;OnDungeonEntrance: ;OnDungeonEntrance:

View File

@@ -11,24 +11,25 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Status Codes ; Status Codes
; #$00 - Idle ; #$00 - Idle
; #$01 - Local Read/Write ; #$01 - Ready to Read
; #$02 - Ready for External Read/Write ; #$FF - Busy
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Block Commands ; Block Commands
!SCM_WAIT = "#$00" !SCM_WAIT = "#$00"
!SCM_SEEN = "#$01" !SCM_SEEN = "#$01"
!SCM_GET = "#$02" !SCM_GET = "#$02"
!SCM_PROMPT = "#$03" !SCM_GIVE = "#$03"
!SCM_AREACHG = "#$04" !SCM_PROMPT = "#$04"
!SCM_DUNGEON = "#$05" !SCM_AREACHG = "#$05"
!SCM_DEATH = "#$06" !SCM_DUNGEON = "#$06"
!SCM_SAVEQUIT = "#$07" !SCM_DEATH = "#$07"
!SCM_FCREATE = "#$08" !SCM_SAVEQUIT = "#$08"
!SCM_FLOAD = "#$09" !SCM_FCREATE = "#$09"
!SCM_FCDELETE = "#$0A" !SCM_FLOAD = "#$0A"
!SCM_SPAWN = "#$0B" !SCM_FCDELETE = "#$0B"
!SCM_PAUSE = "#$0C" !SCM_SPAWN = "#$0C"
!SCM_PAUSE = "#$0D"
!SCM_STALL = "#$7E" !SCM_STALL = "#$7E"
!SCM_RESUME = "#$7F" !SCM_RESUME = "#$7F"
@@ -41,11 +42,19 @@
!TX_SEQUENCE = "$7EF4A0" !TX_SEQUENCE = "$7EF4A0"
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
PollService: PollService:
LDA !RX_STATUS : BEQ + : SEC : RTL : + ; return fail if we don't have the lock PHP
LDA #$01 : STA !RX_STATUS ; mark busy SEP #$20 ; set 8-bit accumulator
LDA !RX_BUFFER+1 : STA !RX_SEQUENCE ; mark this as handled LDA !RX_STATUS : DEC : BEQ + : PLP : SEC : RTL : + ; return fail if there's nothing to read
LDA !RX_BUFFER+2 : STA !RX_SEQUENCE+1 LDA #$FF : STA !RX_STATUS ; stop calls from recursing in
LDA !RX_BUFFER : CMP.b #03 : BNE + LDA !RX_BUFFER : CMP.b !SCM_GIVE : BNE +
PHY : LDA.l !RX_BUFFER+8 : TAY
LDA.l !RX_BUFFER+9 : BNE ++
JSL.l Link_ReceiveItem ; do something else
PLY : BRA .done
++
JSL.l Link_ReceiveItem
PLY : BRA .done
+ : CMP.b !SCM_PROMPT : BNE +
LDA.l !RX_BUFFER+8 : TAX LDA.l !RX_BUFFER+8 : TAX
LDA.l !RX_BUFFER+9 : STA $7E012E, X ; set sound effect, could possibly make this STA not-long LDA.l !RX_BUFFER+9 : STA $7E012E, X ; set sound effect, could possibly make this STA not-long
REP #$30 ; set 16-bit accumulator and index registers REP #$30 ; set 16-bit accumulator and index registers
@@ -54,27 +63,27 @@ PollService:
JSL.l DoToast JSL.l DoToast
SEP #$30 ; set 8-bit accumulator and index registers SEP #$30 ; set 8-bit accumulator and index registers
+ +
.done
LDA #$00 : STA !RX_STATUS ; release lock LDA #$00 : STA !RX_STATUS ; release lock
PLP
CLC ; mark request as successful CLC ; mark request as successful
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
macro ServiceRequest(type) macro ServiceRequest(type)
LDA !TX_STATUS : BEQ + : SEC : RTL : + ; return fail if we don't have the lock LDA !TX_STATUS : BEQ + : SEC : RTL : + ; return fail if we don't have the lock
LDA #$01 : STA !TX_STATUS ; mark busy LDA $1B : STA !TX_BUFFER+8 ; indoor/outdoor
LDA $7B : STA !TX_BUFFER+1 ; world LDA $A0 : STA !TX_BUFFER+9 ; roomid low
LDA $1B : STA !TX_BUFFER+2 ; indoor/outdoor LDA $A1 : STA !TX_BUFFER+10 ; roomid high
LDA $A0 : STA !TX_BUFFER+3 ; roomid low LDA $76 : STA !TX_BUFFER+11 ; object index (type 2 only)
LDA $A1 : STA !TX_BUFFER+4 ; roomid high
LDA $76 : STA !TX_BUFFER+5 ; object index (type 2 only)
LDA <type> : STA !TX_BUFFER ; item get LDA <type> : STA !TX_BUFFER ; item get
LDA #$00 : STA !TX_STATUS ; release lock LDA #$01 : STA !TX_STATUS ; mark ready for reading
CLC ; mark request as successful CLC ; mark request as successful
RTL RTL
endmacro endmacro
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ItemVisualServiceRequest: ItemVisualServiceRequest:
%ServiceRequest(#$01) %ServiceRequest(!SCM_SEEN)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ItemGetServiceRequest: ItemGetServiceRequest:
%ServiceRequest(#$02) %ServiceRequest(!SCM_GET)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------