comparison runtime_32.S @ 550:96489fb27dbf

Apart from the Z80 core, BlastEm now supports 32-bit x86
author Michael Pavone <pavone@retrodev.com>
date Wed, 19 Feb 2014 00:22:27 -0800
parents
children 5a6ff0d76032
comparison
equal deleted inserted replaced
549:32da1e0d5e55 550:96489fb27dbf
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