You are on page 1of 2

elite dialog routine for romancing saga 2

hell yes! :D

;; Store 0x40 zeroes to $7FA492 (clear out the memory we need!)


$C0/CC2E: A2 00 00 LDX #$0000 ;; load X from $0000 (start count
at zero)
$C0/CC31: C2 20 REP #$20 ;; set to 16 bit accumulator mode
$C0/CC33: 9E 92 A4 STZ $A492,X [$7F:A492] ;; store zero to memory
$C0/CC36: E8 INX ;; increment X
$C0/CC37: E8 INX ;; increment X (increment the
count by 2)
$C0/CC38: E0 40 00 CPX #$0040 ;; compare x with $0040
$C0/CC3B: D0 F6 BNE $F6 [$CC33] ;; branch to $CC33 if result is
not equal ($F6 is a relative address)
(stop when count hits 0x40)

$C0/CC3D: E2 20 SEP #$20 ;; set to 8 bit accumulator mode


$C0/CC3F: A6 B4 LDX $B4 [$00:13B4] ;; Load X from $B4 (since X is the
offset of where it reads...
so too must be $B4, therefore
its used to tell what letter to load)
$C0/CC41: A0 00 00 LDY #$0000 ;; set Y to #$0000

$C0/CC44: BF 00 00 D4 LDA $D40000,X [$D4:0370] ;; load accumulator from $D40000+X


(read the left half)
$C0/CC48: EB XBA ;; swap low and high bytes of
accumulator
$C0/CC49: BF 08 00 D4 LDA $D40008,X [$D4:0378] ;; load accumulator from $D40008+X
(read the right half)

$C0/CC4D: C2 20 REP #$20 ;; set to 16 bit accumulator mode


$C0/CC4F: 85 B1 STA $B1 [$00:13B1] ;; store accumulator to $B1 (make
a copy of what we just read)
$C0/CC51: 4A LSR A ;; shift bits in accumulator 'A'
right by 1 (also has the effect of
dividing the number by 2)
;; store A to memory (lower plane)
$C0/CC52: E2 20 SEP #$20 ;; set to 8 bit accumulator mode
$C0/CC54: 99 B4 A4 STA $A4B4,Y [$7F:A4B4] ;; store A to $7FA4B4 (its just
memory) (store low byte of A)
$C0/CC57: EB XBA ;; swap low and high bytes of
accumulator
$C0/CC58: 99 94 A4 STA $A494,Y [$7F:A494] ;; store A to $7FA594 (store what
used to be the high byte of A)
$C0/CC5B: EB XBA ;; swap low and high bytes of
accumulator (back to normal)

;; this "adds" the original bits to the shifted set of bits


;; most likely this adds a shadow effect
$C0/CC5C: C2 20 REP #$20 ;; set to 16 bit accumulator mode
$C0/CC5E: 05 B1 ORA $B1 [$00:13B1] ;; OR accumulator with memory at
$B1
$C0/CC60: 4A LSR A ;; Shift Right
accumulator/memory..(divide A by 2)
$C0/CC61: 05 B1 ORA $B1 [$00:13B1] ;; OR accumulator with memory at
$B1

;; again, store A to memory (upper plane)


$C0/CC63: E2 20 SEP #$20 ;; set to 8 bit accumulator mode
$C0/CC65: 99 B5 A4 STA $A4B5,Y [$7F:A4B5] ;; store Y to $A4B5
$C0/CC68: EB XBA ;; exchange a & b
$C0/CC69: 99 95 A4 STA $A495,Y [$7F:A495] ;; store Y to $A4B5

$C0/CC6C: C8 INY ;; y++


$C0/CC6D: C8 INY ;; y++ (add 2 to y to go to next
row,
because each line is 2
bytes..1 per plane)
$C0/CC6E: E8 INX ;; x++ (increment the reading
position)
$C0/CC6F: C0 10 00 CPY #$0010 ;; compare Y with $0010 (the tile
is 0x10 bytes)
$C0/CC72: D0 0A BNE $0A [$CC7E] ;; branch to $cc7e if Y <> 0x10
(loop back if all bytes
havent been copied)

;; if Y = 0x10 then (if its got through the first row of tiles)
;; X = X + 0x78 (move reading position to next row)
$C0/CC74: C2 20 REP #$20 ;; set to 16 bit accumulator mode
$C0/CC76: 8A TXA ;; transfer X to accumulator
$C0/CC77: 18 CLC ;; Clear the carry flag (always
done with addition)
$C0/CC78: 69 78 00 ADC #$0078 ;; Add with carry: A = A + 0x0078
(A is being used as a temp variable)
$C0/CC7B: AA TAX ;; transfer accumulator to X
$C0/CC7C: E2 20 SEP #$20 ;; set to 8 bit accumulator mode

$C0/CC7E: C0 1E 00 CPY #$001E ;; Compare Y with #$001E (check if


the entire letter is done)
$C0/CC81: D0 C1 BNE $C1 [$CC44] ;; branch to $CC44 if Y <> 0x1E
(go back to top of loop if not)

;; if Y = 0x1E then (if the letter was completely copied)


$C0/CC83: A2 00 00 LDX #$0000 ;; Load X from #$0000
$C0/CC86: A0 00 00 LDY #$0000 ;; Load Y from #$0000

;; copy the higher plane onto the lower plane (this just changes the color)
$C0/CC89: BD 94 A4 LDA $A494,X [$7F:A494] ;; Load A from $7FA494+X
$C0/CC8C: 19 93 A4 ORA $A493,Y [$7F:A493] ;; OR A with $7FA493+Y
$C0/CC8F: 99 93 A4 STA $A493,Y [$7F:A493] ;; Store A to $A493+Y
$C0/CC92: BD 94 A4 LDA $A494,X [$7F:A494] ;; Load A from $7FA494+X
$C0/CC95: 19 97 A4 ORA $A497,Y [$7F:A497] ;; OR A with $7FA497+Y
$C0/CC98: 99 97 A4 STA $A497,Y [$7F:A497] ;; Store A to $7FA497+Y
$C0/CC9B: E8 INX ;; x++
$C0/CC9C: E8 INX ;; x++
$C0/CC9D: C8 INY ;; y++
$C0/CC9E: C8 INY ;; y++
$C0/CC9F: E0 3A 00 CPX #$003A ;; compare X with #$003A
$C0/CCA2: D0 E5 BNE $E5 [$CC89] ;; branch to $CC89 if X <> 0x3A
(go back to top of loop)

;; we're done!
$C0/CCA4: 60 RTS ;; return from subroutine (end of
routine)

You might also like