Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #dyn 0x800000
- #define CARD 0x4020
- #define TOTAL 0x4021
- #define D 0x4022
- #define REG1 0x40F1
- #define REG2 0x40F2
- #define LASTRESULT 0x800D
- #org @play
- setvar TOTAL 0
- call @getcard
- call @getcard
- :card_loop
- msgbox @wantacard
- callstd 5
- if (LASTRESULT == 0) {
- jump :card_loop_end
- }
- call @getcard
- jump :card_loop
- :card_loop_end
- closemsg
- end
- #org @getcard
- call @drawcard
- ' TOTAL += CARD
- copyvar REG2 TOTAL
- copyvar REG1 CARD
- call @add
- copyvar TOTAL REG2
- '
- if (TOTAL > 21) {
- if (CARD == 11) {
- subtractvar TOTAL 10
- } else {
- jump @lost
- }
- }
- call @echototal
- return
- #org @echototal
- storevar 0 TOTAL
- msgbox @total
- callstd 6
- return
- #org @drawcard
- random 12
- copyvar CARD LASTRESULT
- addvar CARD 1
- if (CARD == 1) {
- msgbox @as
- callstd 6
- addvar CARD 10
- return
- }
- if (CARD <= 10) {
- storevar 0 CARD
- msgbox @num
- callstd 6
- return
- }
- if (CARD == 11) {
- msgbox @jota
- callstd 6
- setvar CARD 10
- return
- }
- if (CARD == 12) {
- msgbox @reina
- callstd 6
- setvar CARD 10
- return
- }
- if (CARD == 13) {
- msgbox @rei
- callstd 6
- setvar CARD 10
- return
- }
- msgbox @fail
- callstd 6
- end
- #org @lost
- storevar 0 TOTAL
- msgbox @yalost
- callstd 6
- end
- ' Is there a better way to do arithmetic?
- ' There has to be...
- #org @add
- while (REG1 != 0) {
- addvar REG2 1
- subtractvar REG1 1
- }
- return
- #org @sub
- while (REG1 != 0) {
- subtractvar REG2 1
- subtractvar REG1 1
- }
- return
- #org @fail
- = FATAL ERROR\nCRASH AND BURN!\lFAIL!
- #org @as
- = Un AS!
- #org @num
- = Un \v\h02!
- #org @jota
- = Una jota!
- #org @reina
- = Una reina!
- #org @rei
- = Un rey!
- #org @total
- = Total: \v\h02.
- #org @wantacard
- = Quieres una carta?
- #org @yalost
- = Te has pasado, chico.\nSuman \v\h02.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement