X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmodex%2Fdemos%2Fc%2Fc_utils.asm;h=011820134d532a9d394870f84b4c4a2427ce1a11;hb=0f83b9814824e86433e9ded412db5a7b9cb1efb5;hp=429253b12a49353e4ad71deaffa6b99b6bf7c28a;hpb=6a889c698de8964d2a9e27c8dd93ca5355fb71ef;p=16.git diff --git a/src/lib/modex/demos/c/c_utils.asm b/src/lib/modex/demos/c/c_utils.asm index 429253b1..01182013 100755 --- a/src/lib/modex/demos/c/c_utils.asm +++ b/src/lib/modex/demos/c/c_utils.asm @@ -11,19 +11,19 @@ ; macros to PUSH and POP multiple registers -PUSHx MACRO R1, R2, R3, R4, R5, R6, R7, R8 - IFNB - push R1 ; Save R1 - PUSHx R2, R3, R4, R5, R6, R7, R8 - ENDIF -ENDM - -POPx MACRO R1, R2, R3, R4, R5, R6, R7, R8 - IFNB - pop R1 ; Restore R1 - POPx R2, R3, R4, R5, R6, R7, R8 - ENDIF -ENDM +; PUSHx MACRO R1, R2, R3, R4;, R5, R6, R7, R8 +; IFNB +; push R1 ; Save R1 +; PUSHx R2, R3, R4;, R5, R6, R7, R8 +; ENDIF +; ENDM +; +; POPx MACRO R1, R2, R3, R4;, R5, R6, R7, R8 +; IFNB +; pop R1 ; Restore R1 +; POPx R2, R3, R4;, R5, R6, R7, R8 +; ENDIF +; ENDM ; Macro to Clear a Register to 0 @@ -58,6 +58,8 @@ ENDM s EQU SHORT ?x4 EQU ?x3 EQU + ?x2 EQU + ?x1 EQU .Data @@ -82,7 +84,10 @@ CR_LF DB 13, 10 ; the CRLF data PUBLIC DOS_PRINT DP_Stack STRUC - DW ?x2 ; DI, SI, DS, BP + DW ?x1 ; DI, SI, DS, BP + DW ?x1 ; DI, SI, DS, BP + DW ?x1 ; DI, SI, DS, BP + DW ?x1 ; DI, SI, DS, BP DD ? ; Caller DP_Text DD ? ; Far Address of Text to print DP_Stack ENDS @@ -90,7 +95,11 @@ DP_Stack ENDS DOS_PRINT PROC FAR - PUSHx BP, DS, SI, DI ; Preserve Important Registers + ;PUSHx BP, DS, SI, DI ; Preserve Important Registers + push bp + push ds + push si + push di mov BP, SP ; Set up Stack Frame lds DX, [BP].DP_Text ; Get Addr of Text$ descriptor @@ -129,7 +138,11 @@ DOS_PRINT PROC FAR int 21h ; Call DOS to do it cld ; Reset Direction Flag - POPx DI, SI, DS, BP ; Restore Saved Registers + ;POPx DI, SI, DS, BP ; Restore Saved Registers + pop di + pop si + pop ds + pop bp ret 4 ; Exit & Clean Up Stack DOS_PRINT ENDP @@ -147,7 +160,11 @@ DOS_PRINT ENDP DOS_PRINTS PROC FAR - PUSHx BP, DS, SI, DI ; Preserve Important Registers + ;PUSHx BP, DS, SI, DI ; Preserve Important Registers + push bp + push ds + push si + push di mov BP, SP ; Set up Stack Frame lds DX, [BP].DP_Text ; Get Addr of Text$ descriptor @@ -176,7 +193,11 @@ DOS_PRINTS PROC FAR @DPS_Exit: cld ; Reset Direction Flag - POPx DI, SI, DS, BP ; Restore Saved Registers + ;POPx DI, SI, DS, BP ; Restore Saved Registers + pop di + pop si + pop ds + pop bp ret 2 ; Exit & Clean Up Stack DOS_PRINTS ENDP @@ -192,7 +213,10 @@ DOS_PRINTS ENDP PUBLIC SET_VIDEO_MODE SVM_Stack STRUC - DW ?x2 ; DI, SI, DS, BP + DW ?x1 ; DI, SI, DS, BP + DW ?x1 ; DI, SI, DS, BP + DW ?x1 ; DI, SI, DS, BP + DW ?x1 ; DI, SI, DS, BP DD ? ; Caller SVM_Mode DB ?,? ; Desired Video Mode SVM_Stack ENDS @@ -200,7 +224,11 @@ SVM_Stack ENDS SET_VIDEO_MODE PROC FAR - PUSHx BP, DS, SI, DI ; Preserve Important Registers + ;PUSHx BP, DS, SI, DI ; Preserve Important Registers + push bp + push ds + push si + push di mov BP, SP ; Set up Stack Frame CLR AH ; Function 0 @@ -209,7 +237,11 @@ SET_VIDEO_MODE PROC FAR int 10H ; Change Video Modes @SVM_Exit: - POPx DI, SI, DS, BP ; Restore Saved Registers + ;POPx DI, SI, DS, BP ; Restore Saved Registers + pop di + pop si + pop ds + pop bp ret 2 ; Exit & Clean Up Stack SET_VIDEO_MODE ENDP @@ -226,7 +258,11 @@ SET_VIDEO_MODE ENDP SCAN_KEYBOARD PROC FAR - PUSHx BP, DS, SI, DI ; Preserve Important Registers + ;PUSHx BP, DS, SI, DI ; Preserve Important Registers + push bp + push ds + push si + push di mov AH, 01H ; Function #1 INT 16H ; Call Keyboard Driver @@ -246,7 +282,11 @@ SCAN_KEYBOARD PROC FAR @SK_Exit: cld ; Reset Direction Flag - POPx DI, SI, DS, BP ; Restore Saved Registers + ;POPx DI, SI, DS, BP ; Restore Saved Registers + pop di + pop si + pop ds + pop bp ret ; Exit & Clean Up Stack SCAN_KEYBOARD ENDP @@ -345,7 +385,9 @@ ISQ_Stack ENDS INT_SQR PROC FAR - PUSHx BP, DI ; Save BP + ;PUSHx BP, DI ; Save BP + push bp + push di mov BP, SP ; Set up Stack Frame xor AX, AX ; {xor eax,eax} @@ -375,9 +417,18 @@ INT_SQR PROC FAR add ax, [BP].ISQ_Round ; {add eax,$00008000} ; {*round* result in hi word: ie. +0.5} - shr ax, 8 ; {shr eax,16} {to ax (result)} - - POPx DI, BP ; Restore Registers + shr ax, 1 ; {shr eax,16} {to ax (result)} + shr ax, 1 ; {shr eax,16} {to ax (result)} + shr ax, 1 ; {shr eax,16} {to ax (result)} + shr ax, 1 ; {shr eax,16} {to ax (result)} + shr ax, 1 ; {shr eax,16} {to ax (result)} + shr ax, 1 ; {shr eax,16} {to ax (result)} + shr ax, 1 ; {shr eax,16} {to ax (result)} + shr ax, 1 ; {shr eax,16} {to ax (result)} + + ;POPx DI, BP ; Restore Registers + pop di + pop bp ret 4 ; Exit INT_SQR ENDP