comparison runtime_win.S @ 741:80a67be1770b

Initial work on Windows port
author Michael Pavone <pavone@retrodev.com>
date Tue, 01 Apr 2014 19:43:58 -0700
parents
children
comparison
equal deleted inserted replaced
589:2dde38c1744f 741:80a67be1770b
1
2
3 invalid_msg:
4 .asciz "Invalid instruction at %X\n"
5
6 .global _m68k_invalid
7 _m68k_invalid:
8 push %ecx
9 push invalid_msg
10 xor %eax, %eax
11 call _printf
12 push $1
13 call _exit
14
15 .global _bcd_add
16 _bcd_add:
17 xchg %eax, %edi
18
19 mov %cl, %ch
20 mov %al, %ah
21 and $0xF, %ch
22 and $0xF, %ah
23 and $0xF0, %cl
24 and $0xF0, %al
25 add %ah, %ch
26 cmp $10, %ch
27 jb no_adjust
28 add $6, %ch
29 no_adjust:
30 add %ch, %al
31 add %al, %cl
32 mov $0, %ch
33 jc def_adjust
34 cmp $0xA0, %cl
35 jb no_adjust_h
36 def_adjust:
37 add $0x60, %cl
38 mov $1, %ch
39 no_adjust_h:
40
41 mov %edi, %eax
42 ret
43
44 .global _bcd_sub
45 _bcd_sub:
46 xchg %eax, %edi
47
48 mov %cl, %ch
49 mov %al, %ah
50 and $0xF, %ch
51 and $0xF, %ah
52 and $0xF0, %cl
53 and $0xF0, %al
54 sub %ah, %ch
55 cmp $10, %ch
56 jb no_adjusts
57 sub $6, %ch
58 no_adjusts:
59 add %ch, %cl
60 sub %al, %cl
61 mov $0, %ch
62 jc def_adjusts
63 cmp $0xA0, %cl
64 jb no_adjust_hs
65 def_adjusts:
66 sub $0x60, %cl
67 mov $1, %ch
68 no_adjust_hs:
69
70 mov %edi, %eax
71 ret
72
73
74