Mercurial > repos > blastem
annotate runtime_win.S @ 884:252dfd29831d
Selecting a second game from the menu now works
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 13 Nov 2015 22:56:59 -0800 |
parents | 80a67be1770b |
children |
rev | line source |
---|---|
741
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 invalid_msg: |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 .asciz "Invalid instruction at %X\n" |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 .global _m68k_invalid |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 _m68k_invalid: |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 push %ecx |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 push invalid_msg |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 xor %eax, %eax |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 call _printf |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 push $1 |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 call _exit |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 .global _bcd_add |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 _bcd_add: |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 xchg %eax, %edi |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 mov %cl, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 mov %al, %ah |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 and $0xF, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 and $0xF, %ah |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 and $0xF0, %cl |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 and $0xF0, %al |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 add %ah, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 cmp $10, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 jb no_adjust |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
28 add $6, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
29 no_adjust: |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
30 add %ch, %al |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
31 add %al, %cl |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
32 mov $0, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 jc def_adjust |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
34 cmp $0xA0, %cl |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
35 jb no_adjust_h |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 def_adjust: |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
37 add $0x60, %cl |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
38 mov $1, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
39 no_adjust_h: |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
41 mov %edi, %eax |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
42 ret |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 .global _bcd_sub |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
45 _bcd_sub: |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 xchg %eax, %edi |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
48 mov %cl, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
49 mov %al, %ah |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
50 and $0xF, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
51 and $0xF, %ah |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
52 and $0xF0, %cl |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
53 and $0xF0, %al |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
54 sub %ah, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
55 cmp $10, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
56 jb no_adjusts |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
57 sub $6, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
58 no_adjusts: |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
59 add %ch, %cl |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
60 sub %al, %cl |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
61 mov $0, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
62 jc def_adjusts |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
63 cmp $0xA0, %cl |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
64 jb no_adjust_hs |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
65 def_adjusts: |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
66 sub $0x60, %cl |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
67 mov $1, %ch |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
68 no_adjust_hs: |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
69 |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
70 mov %edi, %eax |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
71 ret |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
72 |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
73 |
80a67be1770b
Initial work on Windows port
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
74 |