Advertisement
PikalaxALT

DeadinskyKicksAPuppy.asm

Nov 24th, 2015
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CompareTwoDiceRolls:
  2.     push de
  3.     call .RollDice
  4.     pop de
  5.     push bc
  6.     call .RollDice
  7.     ld a, c
  8.     pop bc
  9.     cp c
  10.     ret
  11.  
  12. .RollDice
  13. .loop
  14.     call Random
  15.     cp e
  16.     jr nc, .loop
  17.     cp 3
  18.     jr c, .skip
  19.     inc c
  20. .skip
  21.     dec d
  22.     jr nz, .loop
  23.     ret
  24.  
  25. DeadinskyVsPuppyRolloff:
  26.     lb de, 5, 6
  27.     call CompareTwoDiceRolls
  28.     jr c, .DeadinskyWins
  29.     jr nz, .PuppiesWin
  30. ; Tie
  31.     ld a, 4
  32.     jr .proceed
  33. .DeadinskyWins
  34.     xor a
  35.     jr .proceed
  36. .PuppiesWin
  37.     ld a, 2
  38. .proceed
  39.     ld c, a
  40.     ld b, 0
  41.     ld a, [wPuppyKickingText]
  42.     sla a
  43.     ld e, a
  44.     ld d, 0
  45.     ld hl, PuppyResultTexts
  46.     add hl, de
  47.     add hl, de
  48.     add hl, de
  49.     add hl, bc
  50.     ld a, [hli]
  51.     ld h, [hl]
  52.     ld l, a
  53.     jp PrintText
  54.  
  55. PuppyResultTexts:
  56. INCLUDE "data/result_text.asm"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement