Added some mod files.
authorblitz-research <blitzmunter@gamil.com>
Wed, 22 Jan 2014 23:58:42 +0000 (12:58 +1300)
committerblitz-research <blitzmunter@gamil.com>
Wed, 22 Jan 2014 23:58:42 +0000 (12:58 +1300)
mod/brl.mod/blitz.mod/blitz_ex.linux.x86.s [new file with mode: 0644]
mod/brl.mod/blitz.mod/blitz_ex.macos.x86.s [new file with mode: 0644]
mod/brl.mod/blitz.mod/blitz_ex.win32.x86.s [new file with mode: 0644]
mod/brl.mod/blitz.mod/blitz_ftoi.linux.x86.s [new file with mode: 0644]
mod/brl.mod/blitz.mod/blitz_ftoi.macos.x86.s [new file with mode: 0644]
mod/brl.mod/blitz.mod/blitz_ftoi.win32.x86.s [new file with mode: 0644]

diff --git a/mod/brl.mod/blitz.mod/blitz_ex.linux.x86.s b/mod/brl.mod/blitz.mod/blitz_ex.linux.x86.s
new file mode 100644 (file)
index 0000000..fd09053
--- /dev/null
@@ -0,0 +1,41 @@
+
+       format  ELF
+
+       public  _bbExEnter
+       public  _bbExThrow
+
+       section "code"
+
+       ;0[esp]=ret
+       ;4[esp]=state block
+_bbExEnter:
+       mov             edx,[esp+4]
+       ;
+       mov             [edx+0],ebx
+       mov             [edx+4],esi
+       mov             [edx+8],edi
+       mov             [edx+12],ebp
+       ;
+       mov             ecx,[esp]
+       mov             [edx+16],esp
+       mov             [edx+20],ecx
+       ;
+       xor             eax,eax
+       ret
+
+       ;0[esp]=ret
+       ;4[esp]=state block
+       ;8[esp]=throw value
+_bbExThrow:
+       mov             edx,[esp+4]
+       mov             eax,[esp+8]
+       ;
+       mov             ebp,[edx+12]
+       mov             edi,[edx+8]
+       mov             esi,[edx+4]
+       mov             ebx,[edx+0]
+       ;
+       mov             ecx,[edx+20]
+       mov             esp,[edx+16]
+       add             esp,4
+       jmp             ecx
diff --git a/mod/brl.mod/blitz.mod/blitz_ex.macos.x86.s b/mod/brl.mod/blitz.mod/blitz_ex.macos.x86.s
new file mode 100644 (file)
index 0000000..4ad572c
--- /dev/null
@@ -0,0 +1,50 @@
+
+    .globl  _bbArgp
+       .globl  __bbExEnter
+       .globl  __bbExThrow
+
+       .text
+
+_bbArgp:
+#   ;0[esp]=our ret
+#   ;4[esp]=offset arg
+#      ;0[ebp]=caller oldebp
+#      ;4[ebp]=caller ret
+#      ;8[ebp]=caller first arg!
+       lea             8(%ebp),%eax
+    add     4(%esp),%eax
+       ret
+
+#      ;0[esp]=ret
+#      ;4[esp]=state block
+__bbExEnter:
+       mov             4(%esp),%edx
+#      ;
+       mov             %ebx,(%edx)
+       mov             %esi,4(%edx)
+       mov             %edi,8(%edx)
+       mov             %ebp,12(%edx)
+#      ;
+       mov             (%esp),%ecx
+       mov             %esp,16(%edx)
+       mov             %ecx,20(%edx)
+#      ;
+       xor             %eax,%eax
+       ret
+
+#      ;0[esp]=ret
+#      ;4[esp]=state block
+#      ;8[esp]=throw value
+__bbExThrow:
+       mov             4(%esp),%edx
+       mov             8(%esp),%eax
+#      ;
+       mov             12(%edx),%ebp
+       mov             8(%edx),%edi
+       mov             4(%edx),%esi
+       mov             (%edx),%ebx
+#      ;
+       mov             20(%edx),%ecx
+       mov             16(%edx),%esp
+       add             $4,%esp
+       jmp             %ecx
diff --git a/mod/brl.mod/blitz.mod/blitz_ex.win32.x86.s b/mod/brl.mod/blitz.mod/blitz_ex.win32.x86.s
new file mode 100644 (file)
index 0000000..1c39f75
--- /dev/null
@@ -0,0 +1,43 @@
+
+       format  MS COFF
+
+       public  __bbExEnter
+       public  __bbExThrow
+
+       section "code" code
+
+       ;0[esp]=ret
+       ;4[esp]=state block
+__bbExEnter:
+       mov             edx,[esp+4]
+       ;
+       mov             [edx+0],ebx
+       mov             [edx+4],esi
+       mov             [edx+8],edi
+       mov             [edx+12],ebp
+       ;
+       mov             ecx,[esp]
+       mov             [edx+16],esp
+       mov             [edx+20],ecx
+       ;
+       xor             eax,eax
+       ret
+
+       ;0[esp]=ret
+       ;4[esp]=state block
+       ;8[esp]=throw value
+__bbExThrow:
+       mov             edx,[esp+4]
+       mov             eax,[esp+8]
+       ;
+       mov             ebp,[edx+12]
+       mov             edi,[edx+8]
+       mov             esi,[edx+4]
+       mov             ebx,[edx+0]
+       ;
+       mov             ecx,[edx+20]
+       mov             esp,[edx+16]
+       add             esp,4
+       jmp             ecx
+       
+
diff --git a/mod/brl.mod/blitz.mod/blitz_ftoi.linux.x86.s b/mod/brl.mod/blitz.mod/blitz_ftoi.linux.x86.s
new file mode 100644 (file)
index 0000000..e306852
--- /dev/null
@@ -0,0 +1,30 @@
+
+       format  ELF
+
+       public  bbFloatToInt
+
+       section "code" ;code
+
+       ;0[esp]=ret
+       ;4[esp]=double
+bbFloatToInt:
+       fld             qword [esp+4]
+       sub             esp,12
+       fist    dword [esp]
+       fst             dword [esp+4]
+       fisub   dword [esp]
+       fstp    dword [esp+8]
+       pop             eax
+       pop             ecx
+       pop             edx
+       test    ecx,ecx
+       js              negative
+       add             edx,0x7fffffff
+       sbb             eax,0
+       ret
+negative:
+       xor             ecx,ecx
+       test    edx,edx
+       setg    cl
+       add             eax,ecx
+       ret
diff --git a/mod/brl.mod/blitz.mod/blitz_ftoi.macos.x86.s b/mod/brl.mod/blitz.mod/blitz_ftoi.macos.x86.s
new file mode 100644 (file)
index 0000000..a9e4f5f
--- /dev/null
@@ -0,0 +1,27 @@
+       .globl  _bbFloatToInt
+
+       .text
+
+#      ;0[esp]=ret
+#      ;4[esp]=double
+_bbFloatToInt:
+       fldl    4(%esp)
+       sub     $12,%esp
+       fistl   (%esp)
+       fsts    4(%esp)
+       fisubl  (%esp)
+       fstps   8(%esp)
+       pop     %eax
+       pop     %ecx
+       pop     %edx
+       test    %ecx,%ecx
+       js      negative
+       add     $0x7fffffff,%edx
+       sbb     $0,%eax
+       ret
+negative:
+       xor     %ecx,%ecx
+       test    %edx,%edx
+       setg    %cl
+       add     %ecx,%eax
+       ret
diff --git a/mod/brl.mod/blitz.mod/blitz_ftoi.win32.x86.s b/mod/brl.mod/blitz.mod/blitz_ftoi.win32.x86.s
new file mode 100644 (file)
index 0000000..2e61fb0
--- /dev/null
@@ -0,0 +1,30 @@
+
+       format  MS COFF
+
+       public  _bbFloatToInt
+
+       section "code" code
+
+       ;0[esp]=ret
+       ;4[esp]=double
+_bbFloatToInt:
+       fld             qword [esp+4]
+       sub             esp,12
+       fist    dword [esp]
+       fst             dword [esp+4]
+       fisub   dword [esp]
+       fstp    dword [esp+8]
+       pop             eax
+       pop             ecx
+       pop             edx
+       test    ecx,ecx
+       js              negative
+       add             edx,0x7fffffff
+       sbb             eax,0
+       ret
+negative:
+       xor             ecx,ecx
+       test    edx,edx
+       setg    cl
+       add             eax,ecx
+       ret