annotate runtime_win.S @ 1021:4a92889e2889 v0.4.0

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