daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Dec 5th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ld a, d
  2.     cp $00 ; is the flag id > 256?
  3.     jr z, .start ; no
  4.     jr c, .read ; yes
  5.     jr .invalid ; some weird state of both yes and no??
  6. .start
  7.     ld a, e
  8.     cp $a2 ; $1a2 flag entries
  9.     jr c, .read
  10. .invalid
  11.     xor a
  12.     ld e, a
  13.     ld d, a
  14. .read
  15.     ld hl, Flags
  16.     add hl, de ; skip three
  17.     add hl, de ; bytes per
  18.     add hl, de ; flag
  19.     ld e, [hl]
  20.     inc hl
  21.     ld d, [hl]
  22.     inc hl
  23.     ld c, [hl] ; flag bit
  24.     ld a, b
  25.     cp $01
  26.     jr c, .reset ; b = 0
  27.     jr z, .set   ; b = 1
  28.     ld a, [de]   ; b > 1
  29.     and c
  30.     ld c, a
  31.     ret
  32. .set
  33.     ld a, [de]
  34.     or c
  35.     ld [de], a
  36.     ret
  37. .reset
  38.     ld a, c
  39.     cpl ; AND all bits except the one in question
  40.     ld c, a
  41.     ld a, [de]
  42.     and c
  43.     ld [de], a
  44.     ret
  45. ; 80462
  46.    
  47. Flags: ; 80462
  48.     dwb $d957, %00000010
  49.     dwb $d957, %00000001
  50.     dwb $d957, %00000100
  51.     dwb $d957, %00001000
  52.     dwb $d957, %10000000
  53.    
  54.     dwb $def5, %01000000
  55.     dwb $def5, %00000001
  56.    
  57.     dwb $df2c, %00000001
  58.    
  59.     dwb $d854, %00000001
  60.     dwb $d854, %10000000
  61.    
  62.     dwb $dc39, %00000001
  63.    
  64.     dwb $d84c, %00000001
  65.     dwb $d84c, %00000010
  66.     dwb $d84c, %00001000
  67.     dwb $d84c, %00010000
  68.     dwb $d84c, %01000000
  69.     dwb $d84c, %10000000
  70.    
  71.     dwb $d84d, %00000100 ; bug catching contest timeup
  72.     dwb $d84d, %00000010
  73.     dwb $d84d, %00000001
  74.     dwb $d84d, %00010000
  75.     dwb $d84d, %00100000
  76.     dwb $d84d, %01000000
  77.     dwb $d84d, %10000000
  78.    
  79.     dwb $dbf5, %00000001
  80.     dwb $dbf5, %00000010
  81.     dwb $dbf5, %00000100 ; downhill (cycling road)
  82.    
  83.     ; johto badges
  84.     dwb $d857, %00000001 ; $1b
  85.     dwb $d857, %00000010 ; $1c
  86.     dwb $d857, %00000100 ; $1d
  87.     dwb $d857, %00001000 ; $1e
  88.     dwb $d857, %00010000 ; $1f
  89.     dwb $d857, %00100000 ; $20
  90.     dwb $d857, %01000000 ; $21
  91.     dwb $d857, %10000000 ; $22
  92.    
  93.     ; kanto badges
  94.     dwb $d858, %00000001 ; $23
  95.     dwb $d858, %00000010 ; $24
  96.     dwb $d858, %00000100 ; $25
  97.     dwb $d858, %00001000 ; $26
  98.     dwb $d858, %00010000 ; $27
  99.     dwb $d858, %00100000 ; $28
  100.     dwb $d858, %01000000 ; $29
  101.     dwb $d858, %10000000 ; $2a
  102.    
  103.     dwb $def3, %00000001
  104.     dwb $def3, %00000010
  105.     dwb $def3, %00000100
  106.     dwb $def3, %00001000
  107.     dwb $def3, %00010000
  108.     dwb $def3, %00100000
  109.     dwb $def3, %01000000
  110.     dwb $def3, %10000000
  111.    
  112.     dwb $dca5, %00000001
  113.     dwb $dca5, %00000010
  114.     dwb $dca5, %00000100
  115.     dwb $dca5, %00001000
  116.     dwb $dca5, %00010000
  117.     dwb $dca5, %00100000
  118.     dwb $dca5, %01000000
  119.     dwb $dca5, %10000000
  120.    
  121.     dwb $dca6, %00000001
  122.     dwb $dca6, %00000010
  123.     dwb $dca6, %00000100
  124.     dwb $dca6, %00001000
  125.     dwb $dca6, %00010000
  126.     dwb $dca6, %00100000
  127.     dwb $dca6, %01000000
  128.     dwb $dca6, %10000000
  129.    
  130.     dwb $dca7, %00000001
  131.     dwb $dca7, %00000100
  132.     dwb $dca7, %00001000
  133.     dwb $dca7, %00010000
  134.     dwb $dca7, %00100000
  135.     dwb $dca7, %01000000
  136.     dwb $dca7, %10000000
  137.    
  138.     dwb $dca8, %00000001
  139.     dwb $dca8, %00000010
  140.     dwb $dca8, %00000100
  141.     dwb $dca8, %00010000
  142.    
  143.     dwb $dc9d, %00000001
  144.     dwb $d84d, %00001000
  145.    
  146.     dwb $dc1e, %00000001
  147.     dwb $dc1e, %00000010
  148.     dwb $dc1e, %00000100
  149.     dwb $dc1e, %00001000
  150.     dwb $dc1e, %00010000
  151.     dwb $dc1e, %00100000
  152.     dwb $dc1e, %01000000
  153.     dwb $dc1e, %10000000
  154.    
  155.     dwb $dc1f, %00000001
  156.     dwb $dc1f, %00000010
  157.     dwb $dc1f, %00000100
  158.     dwb $dc1f, %00001000
  159.     dwb $dc1f, %00010000
  160.     dwb $dc1f, %00100000
  161.     dwb $dc1f, %01000000
  162.     dwb $dc1f, %10000000
  163.    
  164.     dwb $dc20, %00000001
  165.     dwb $dc20, %00000010
  166.    
  167.     dwb $cfbc, %10000000
  168.     dwb $d472, %00000001 ; 0 if boy, 1 if girl
  169.     dwb $dbf3, %00000100
  170.    
  171.     dwb $dc4c, %00000001
  172.     dwb $dc4c, %00000010
  173.     dwb $dc4c, %00000100
  174.     dwb $dc4c, %00001000
  175.     dwb $dc4c, %00010000
  176.     dwb $dc4c, %00100000
  177.     dwb $dc4c, %01000000
  178.     dwb $dc4c, %10000000
  179.    
  180.     dwb $dc4d, %00000001
  181.     dwb $dc4d, %00000010
  182.     dwb $dc4d, %00000100
  183.     dwb $dc4d, %00001000
  184.     dwb $dc4d, %00010000
  185.     dwb $dc4d, %00100000
  186.     dwb $dc4d, %01000000
  187.     dwb $dc4d, %10000000
  188.    
  189.     dwb $dc4e, %00000001
  190.     dwb $dc4e, %00000010
  191.     dwb $dc4e, %00000100
  192.     dwb $dc4e, %00001000
  193.     dwb $dc4e, %00010000
  194.     dwb $dc4e, %00100000
  195.     dwb $dc4e, %01000000
  196.     dwb $dc4e, %10000000
  197.    
  198.     dwb $dc50, %00000001
  199.     dwb $dc50, %00000010
  200.     dwb $dc50, %00000100
  201.     dwb $dc50, %00001000
  202.     dwb $dc50, %00010000
  203.     dwb $dc50, %00100000
  204.     dwb $dc50, %01000000
  205.     dwb $dc50, %10000000
  206.    
  207.     dwb $dc51, %00000001
  208.     dwb $dc51, %00000010
  209.    
  210.     dwb $dc54, %00000001
  211.     dwb $dc54, %00000010
  212.     dwb $dc54, %00000100
  213.     dwb $dc54, %00001000
  214.     dwb $dc54, %00010000
  215.     dwb $dc54, %00100000
  216.     dwb $dc54, %01000000
  217.     dwb $dc54, %10000000
  218.    
  219.     dwb $dc55, %00000001
  220.     dwb $dc55, %00000010
  221.     dwb $dc55, %00000100
  222.     dwb $dc55, %00001000
  223.     dwb $dc55, %00010000
  224.     dwb $dc55, %00100000
  225.     dwb $dc55, %01000000
  226.     dwb $dc55, %10000000
  227.    
  228.     dwb $dc56, %00000001
  229.     dwb $dc56, %00000010
  230.     dwb $dc56, %00000100
  231.     dwb $dc56, %00001000
  232.     dwb $dc56, %00010000
  233.     dwb $dc56, %00100000
  234.     dwb $dc56, %01000000
  235.     dwb $dc56, %10000000
  236.    
  237.     dwb $d45b, %00000100
  238.     dwb $dc20, %00000100
  239.     dwb $dc20, %00001000 ; $a2
  240. ; 80648
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top