-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoinflip.asm
More file actions
69 lines (53 loc) · 1013 Bytes
/
coinflip.asm
File metadata and controls
69 lines (53 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
; ------------------------------------------------------------------
; This program runs in MikeOS
; ------------------------------------------------------------------
BITS 16
%INCLUDE "mikedev.inc"
ORG 32768
start:
call .draw_background
mov ax, .command_list
mov bx, .msg1
mov cx, .msg2
call os_list_dialog
jc near .exit
sub ax, 1
push ax
call .get_random
cmp cl, [esp]
je near .win
jmp near .lose
.get_random:
mov ax, 0
mov bx, 1
call os_get_random
.exit:
call os_clear_screen
ret
.draw_background:
mov ax, .title_msg
mov bx, .footer_msg
mov cx, 00100000b
call os_draw_background
ret
.win:
mov ax, .win_msg
mov bx, 0
mov cx, 0
mov dx, 0
call os_dialog_box
jmp start
.lose:
mov ax, .lose_msg
mov bx, 0
mov cx, 0
mov dx, 0
call os_dialog_box
jmp start
.command_list db 'Heads,Tails', 0
.title_msg db 'Coinflip', 0
.msg1 db 'Choose a side', 0
.msg2 db '', 0
.win_msg db 'You won!', 0
.lose_msg db 'You lost.', 0
.footer_msg db 'Coinflip', 0