Users browsing this thread: 2 Guest(s)
Newbie Still Doesn't Understand Code

#2
Posts: 110
Threads: 4
Thanks Received: 4
Thanks Given: 1
Joined: Jan 2012
Reputation: 4
Status
None
That code is part of the code that shows spell+MP cost (enabled by pressing Y), which blanks out partially learned spells as well as unlearned ones. It likely is redundant but wouldn't save much space, as the blanking code is needed regardless. If you'll notice above it, there's a check for whether MP display is enabled or not, and it branches elsewhere if it isn't. That code actually displays learn %.

Code:
Draw text in spell slot of Magic menu
C3/4FC4: A5E6     LDA $E6        ; BG1 write row
C3/4FC6: 1A       INC A          ; Go 1 row down
C3/4FC7: 209F80   JSR $809F      ; Compute map ptr
C3/4FCA: C220     REP #$20       ; 16-bit A
C3/4FCC: 8A       TXA            ; ...
C3/4FCD: 8F899E7E STA $7E9E89    ; Set position
C3/4FD1: E220     SEP #$20       ; 8-bit A
C3/4FD3: A59E     LDA $9E        ; Show MP in list?
C3/4FD5: F067     BEQ $503E      ; Branch if not
C3/4FD7: 20EC50   JSR $50EC      ; Spell
C3/4FDA: 204D51   JSR $514D      ; Handle graying
C3/4FDD: 20EC50   JSR $50EC      ; Spell
C3/4FE0: C9FF     CMP #$FF       ; None?
C3/4FE2: F036     BEQ $501A      ; Blank if so
C3/4FE4: 20A250   JSR $50A2      ; Spell mastery
C3/4FE7: C9FF     CMP #$FF       ; Fully learned?
C3/4FE9: D02F     BNE $501A      ; Blank if not

Fork: Draw spell plus percentage
C3/503E: 20EC50   JSR $50EC      ; Spell
C3/5041: C9FF     CMP #$FF       ; None?
C3/5043: F0D5     BEQ $501A      ; Blank if so
C3/5045: 20A250   JSR $50A2      ; Spell mastery
C3/5048: C900     CMP #$00       ; Zero?
C3/504A: F0CE     BEQ $501A      ; Blank if so
C3/504C: 20EC50   JSR $50EC      ; Spell
C3/504F: 206784   JSR $8467      ; Load name
C3/5052: A2929E   LDX #$9E92     ; 7E/9E92
C3/5055: 8E8121   STX $2181      ; Set WRAM LBs
C3/5058: 20EC50   JSR $50EC      ; Spell
C3/505B: 20A250   JSR $50A2      ; Spell mastery
C3/505E: C9FF     CMP #$FF       ; Fully learned?
C3/5060: F026     BEQ $5088      ; Branch if so
C3/5062: 48       PHA            ; Save mastery
C3/5063: 20B951   JSR $51B9      ; Disable spell
C3/5066: A92C     LDA #$2C       ; Palette 3
C3/5068: 8529     STA $29        ; Color: Bluish
C3/506A: A9C7     LDA #$C7       ; Char: "…"
C3/506C: 8D8021   STA $2180      ; Add to string
C3/506F: 68       PLA            ; Spell mastery
C3/5070: 20E004   JSR $04E0      ; Turn into text
C3/5073: A5F8     LDA $F8        ; Tens digit
C3/5075: 8D8021   STA $2180      ; Add to string
C3/5078: A5F9     LDA $F9        ; Ones digit
C3/507A: 8D8021   STA $2180      ; Add to string
C3/507D: A9CD     LDA #$CD       ; Char: "%"
C3/507F: 8D8021   STA $2180      ; Add to string
C3/5082: 9C8021   STZ $2180      ; End string
C3/5085: 4CD97F   JMP $7FD9      ; Draw string
  Find
Quote  
[-] The following 1 user says Thank You to dn for this post:
  • Turbotastic (09-21-2016)



Messages In This Thread
RE: Newbie Still Doesn't Understand Code - by dn - 09-21-2016, 12:06 PM

Forum Jump:

Users browsing this thread: 2 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite