Advertisement
Stranck

isEven function in PokémonYellow

Mar 7th, 2020
1,538
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. EntryPoint:: ;DA7F
  2.     11 AD DE    ld de, wResult
  3.     06 00       ld b, $0
  4.     26 DA       ld h, $DA
  5.     FA 1E D3    ld a, ($1 + wBagItems) ;item 1 quantity
  6.     E6 01       and $1
  7.     28 06       jr z, .even
  8.     ;11 AD DE 06 00 26 DA FA 1E D3 E6 01 28 06
  9.  
  10.     ;DA8D
  11.     2E A0       ld l, $A0 ;HL should point to OddTxt now
  12.     0E 04       ld c, $4
  13.     18 04       jr .done
  14.     ;2E A0 0E 04 18 04
  15.  
  16. .even ;DA93
  17.     2E A4       ld l, $A4  ;HL should point to EvenTxt now
  18.     0E 05       ld c, $5
  19.     ;2E A4 0E 05
  20.  
  21. .done ;DA97
  22.     CD B1 00    call CopyData
  23.     21 A9 DA    ld hl, FullText
  24.     C3 36 3C    jp PrintText
  25.     ;CD B1 00 21 A9 DA C3 36 3C
  26.    
  27.  
  28. OddTxt:: ;DAA0
  29.     AE A3 A3 50     db "odd@"
  30.     ;AE A3 A3 50
  31. EvenTxt:: ;DAA4
  32.     A4 B5 A4 AD 50  db "even@"
  33.     ;A4 B5 A4 AD 50
  34. FullText:: ;DAA9
  35.     00          text "The number is" ;B3 A7 A4 7F AD B4 AC A1 A4 B1 7F A8 B2
  36.     4F          line "@"
  37.     01 AD DE    TX_RAM wResult
  38.     00          text
  39.     58          prompt
  40.     00          db $0
  41.     ;00 B3 A7 A4 7F AD B4 AC A1 A4 B1 7F A8 B2 4F 50 01 AD DE 00 58 00
  42. wResult:: ;DEAD
  43.     ds 5
  44.    
  45. ;11 AD DE 06 00 26 DA FA 1E D3 E6 01 28 06 2E A0 0E 04 18 04 2E A4 0E 05 CD B1 00 21 A9 DA C3 36 3C AE A3 A3 50 A4 B5 A4 AD 50 00 B3 A7 A4 7F AD B4 AC A1 A4 B1 7F A8 B2 4F 50 01 AD DE 00 58 00
  46. ;I'm writing this from my university's PC, where I have no gbz80 compiler and I can't install them. So, yeah, this is compiled by hand :(
  47. ;I did this for memz. Shoutouts to Programmer NULLposting.
Advertisement
RAW Paste Data Copied
Advertisement