]> 4ch.mooo.com Git - 16.git/commitdiff
c_utils.asm compiles in watcom but i do not know if it works...
authorsparky4 <sparky4@cock.li>
Thu, 19 Nov 2015 20:10:07 +0000 (14:10 -0600)
committersparky4 <sparky4@cock.li>
Thu, 19 Nov 2015 20:10:07 +0000 (14:10 -0600)
src/lib/modex/demos/c/c_utils.asm

index 429253b12a49353e4ad71deaffa6b99b6bf7c28a..fd4ba6fde3a06f72facdb534dfd059ec85ce9da2 100755 (executable)
 \r
        ; macros to PUSH and POP multiple registers\r
 \r
-PUSHx MACRO R1, R2, R3, R4, R5, R6, R7, R8\r
-       IFNB <R1>\r
-               push    R1                              ; Save R1\r
-               PUSHx   R2, R3, R4, R5, R6, R7, R8\r
-       ENDIF\r
-ENDM\r
-\r
-POPx MACRO R1, R2, R3, R4, R5, R6, R7, R8\r
-       IFNB <R1>\r
-               pop             R1                              ; Restore R1\r
-               POPx    R2, R3, R4, R5, R6, R7, R8\r
-       ENDIF\r
-ENDM\r
+; PUSHx MACRO R1, R2, R3, R4;, R5, R6, R7, R8\r
+;      IFNB <R1>\r
+;              push    R1                              ; Save R1\r
+;              PUSHx   R2, R3, R4;, R5, R6, R7, R8\r
+;      ENDIF\r
+ENDM\r
+;\r
+; POPx MACRO R1, R2, R3, R4;, R5, R6, R7, R8\r
+;      IFNB <R1>\r
+;              pop             R1                              ; Restore R1\r
+;              POPx    R2, R3, R4;, R5, R6, R7, R8\r
+;      ENDIF\r
+ENDM\r
 \r
        ; Macro to Clear a Register to 0\r
 \r
@@ -90,7 +90,11 @@ DP_Stack     ENDS
 \r
 DOS_PRINT       PROC    FAR\r
 \r
-       PUSHx   BP, DS, SI, DI          ; Preserve Important Registers\r
+       ;PUSHx  BP, DS, SI, DI          ; Preserve Important Registers\r
+       push bp\r
+       push ds\r
+       push si\r
+       push di\r
        mov             BP, SP                          ; Set up Stack Frame\r
 \r
        lds     DX, [BP].DP_Text        ; Get Addr of Text$ descriptor\r
@@ -129,7 +133,11 @@ DOS_PRINT   PROC    FAR
        int             21h                                     ; Call DOS to do it\r
 \r
        cld                                                     ; Reset Direction Flag\r
-       POPx    DI, SI, DS, BP          ; Restore Saved Registers\r
+       ;POPx   DI, SI, DS, BP          ; Restore Saved Registers\r
+       pop di\r
+       pop si\r
+       pop ds\r
+       pop bp\r
        ret             4                                       ; Exit & Clean Up Stack\r
 \r
 DOS_PRINT       ENDP\r
@@ -147,7 +155,11 @@ DOS_PRINT   ENDP
 \r
 DOS_PRINTS      PROC    FAR\r
 \r
-       PUSHx   BP, DS, SI, DI          ; Preserve Important Registers\r
+       ;PUSHx  BP, DS, SI, DI          ; Preserve Important Registers\r
+       push bp\r
+       push ds\r
+       push si\r
+       push di\r
        mov             BP, SP                          ; Set up Stack Frame\r
 \r
        lds     DX, [BP].DP_Text        ; Get Addr of Text$ descriptor\r
@@ -176,7 +188,11 @@ DOS_PRINTS  PROC    FAR
 \r
 @DPS_Exit:\r
        cld                                                     ; Reset Direction Flag\r
-       POPx    DI, SI, DS, BP          ; Restore Saved Registers\r
+       ;POPx   DI, SI, DS, BP          ; Restore Saved Registers\r
+       pop di\r
+       pop si\r
+       pop ds\r
+       pop bp\r
        ret             2                                       ; Exit & Clean Up Stack\r
 \r
 DOS_PRINTS      ENDP\r
@@ -200,7 +216,11 @@ SVM_Stack  ENDS
 \r
 SET_VIDEO_MODE PROC    FAR\r
 \r
-       PUSHx   BP, DS, SI, DI          ; Preserve Important Registers\r
+       ;PUSHx  BP, DS, SI, DI          ; Preserve Important Registers\r
+       push bp\r
+       push ds\r
+       push si\r
+       push di\r
        mov             BP, SP                          ; Set up Stack Frame\r
 \r
        CLR             AH                                      ; Function 0\r
@@ -209,7 +229,11 @@ SET_VIDEO_MODE     PROC    FAR
        int             10H                                     ; Change Video Modes\r
 \r
 @SVM_Exit:\r
-       POPx    DI, SI, DS, BP          ; Restore Saved Registers\r
+       ;POPx   DI, SI, DS, BP          ; Restore Saved Registers\r
+       pop di\r
+       pop si\r
+       pop ds\r
+       pop bp\r
        ret             2                                       ; Exit & Clean Up Stack\r
 \r
 SET_VIDEO_MODE ENDP\r
@@ -226,7 +250,11 @@ SET_VIDEO_MODE     ENDP
 \r
 SCAN_KEYBOARD  PROC    FAR\r
 \r
-       PUSHx   BP, DS, SI, DI          ; Preserve Important Registers\r
+       ;PUSHx  BP, DS, SI, DI          ; Preserve Important Registers\r
+       push bp\r
+       push ds\r
+       push si\r
+       push di\r
 \r
        mov             AH, 01H                         ; Function #1\r
        INT             16H                                     ; Call Keyboard Driver\r
@@ -246,7 +274,11 @@ SCAN_KEYBOARD      PROC    FAR
 \r
 @SK_Exit:\r
        cld                                                     ; Reset Direction Flag\r
-       POPx    DI, SI, DS, BP          ; Restore Saved Registers\r
+       ;POPx   DI, SI, DS, BP          ; Restore Saved Registers\r
+       pop di\r
+       pop si\r
+       pop ds\r
+       pop bp\r
        ret                                                     ; Exit & Clean Up Stack\r
 \r
 SCAN_KEYBOARD  ENDP\r
@@ -345,7 +377,9 @@ ISQ_Stack   ENDS
 \r
 INT_SQR                PROC    FAR\r
 \r
-    PUSHx   BP, DI                             ; Save BP\r
+    ;PUSHx   BP, DI                            ; Save BP\r
+       push bp\r
+       push di\r
     mov     BP, SP                             ; Set up Stack Frame\r
 \r
        xor     AX, AX                          ; {xor eax,eax}\r
@@ -375,9 +409,18 @@ INT_SQR            PROC    FAR
 \r
        add     ax, [BP].ISQ_Round      ; {add eax,$00008000}\r
                                                                ; {*round* result in hi word: ie. +0.5}\r
-       shr     ax, 8                           ; {shr eax,16}  {to ax (result)}\r
-\r
-       POPx    DI, BP                          ; Restore Registers\r
+       shr     ax, 1                           ; {shr eax,16}  {to ax (result)}\r
+       shr     ax, 1                           ; {shr eax,16}  {to ax (result)}\r
+       shr     ax, 1                           ; {shr eax,16}  {to ax (result)}\r
+       shr     ax, 1                           ; {shr eax,16}  {to ax (result)}\r
+       shr     ax, 1                           ; {shr eax,16}  {to ax (result)}\r
+       shr     ax, 1                           ; {shr eax,16}  {to ax (result)}\r
+       shr     ax, 1                           ; {shr eax,16}  {to ax (result)}\r
+       shr     ax, 1                           ; {shr eax,16}  {to ax (result)}\r
+\r
+       ;POPx   DI, BP                          ; Restore Registers\r
+       pop di\r
+       pop bp\r
        ret             4                                       ; Exit\r
 \r
 INT_SQR                ENDP\r