]> 4ch.mooo.com Git - 16.git/blobdiff - 16/sod8086/wl_asm.asm
got 8086 port of wolf3d to work and sod to work
[16.git] / 16 / sod8086 / wl_asm.asm
diff --git a/16/sod8086/wl_asm.asm b/16/sod8086/wl_asm.asm
new file mode 100755 (executable)
index 0000000..cca5d69
--- /dev/null
@@ -0,0 +1,69 @@
+; JABHACK.ASM\r
+\r
+.386C\r
+IDEAL\r
+MODEL  MEDIUM\r
+\r
+EXTRN  LDIV@:far\r
+\r
+;============================================================================\r
+\r
+DATASEG\r
+\r
+;============================================================================\r
+\r
+CODESEG\r
+\r
+;      Hacked up Juan Jimenez's code a bit to just return 386/not 386\r
+PROC   _CheckIs386\r
+PUBLIC _CheckIs386\r
+\r
+;hack to never look for a 386, for benchmark comparisons of same code on all CPUs\r
+;      pushf                   ; Save flag registers, we use them here\r
+;      xor     ax,ax           ; Clear AX and...\r
+;      push ax                 ; ...push it onto the stack\r
+;      popf                    ; Pop 0 into flag registers (all bits to 0),\r
+;      pushf                   ; attempting to set bits 12-15 of flags to 0's\r
+;      pop     ax                      ; Recover the save flags\r
+;      and     ax,08000h       ; If bits 12-15 of flags are set to\r
+;      cmp     ax,08000h       ; zero then it's 8088/86 or 80188/186\r
+;      jz      not386\r
+;\r
+;      mov     ax,07000h       ; Try to set flag bits 12-14 to 1's\r
+;      push ax                 ; Push the test value onto the stack\r
+;      popf                    ; Pop it into the flag register\r
+;      pushf                   ; Push it back onto the stack\r
+;      pop     ax                      ; Pop it into AX for check\r
+;      and     ax,07000h       ; if bits 12-14 are cleared then\r
+;      jz      not386          ; the chip is an 80286\r
+;\r
+;      mov     ax,1            ; We now assume it's a 80386 or better\r
+;      popf\r
+;      retf\r
+;end benchmark hack\r
+\r
+not386:\r
+       xor     ax,ax\r
+       popf\r
+       retf\r
+\r
+       ENDP\r
+\r
+\r
+PROC   _jabhack2\r
+PUBLIC _jabhack2\r
+\r
+       push    es\r
+\r
+       mov     ax,seg LDIV@\r
+       mov     es,ax\r
+       mov     ax,9090h                                        ;Two NOP's\r
+       mov     [WORD FAR es:LDIV@],ax          ;Patch over XOR AX,AX\r
+       mov     [WORD FAR es:LDIV@+2],ax        ;and over JMP SHORT COMMON\r
+\r
+       pop     es\r
+       retf\r
+\r
+       ENDP\r
+\r
+       END\r