Zitat von
Klebwax
Dann solltest du konsequenterweise auch in Assembler programmieren.
Auch wenn ich eingefleischter Assemblerfreak bin, so manches sieht in einer Hochsprache "geringfügig" eleganter aus:
if (a > b)
oder:
Code:
;------------------------------------------------------
; if A > B ; 32 Bit Signed Compare
IF_INT32_G_VAR MACRO VarA,VarB,ElseAddress
Local not_equal
BANKSEL VarB
movf VarB+3,W ;
BANKSEL VarA
subwf VarA+3,W ;
btfss STATUS,Z ; scip if zero, is equal
BRA not_equal ; else goto not equal
BANKSEL VarB
movf VarB+2,W ; W = Low Byte VarB
BANKSEL VarA
subwf VarA+2,W ; W = VarA-VarB
btfss STATUS,Z ; scip if zero, is equal
BRA not_equal ; else goto not equal
BANKSEL VarB
movf VarB+1,W
BANKSEL VarA
subwf VarA+1,W
btfss STATUS,Z ; scip if zero, is equal
BRA not_equal ; else goto not equal
BANKSEL VarB
movf VarB+0,W
BANKSEL VarA
subwf VarA+0,W ; low byte variable A
btfsc STATUS,Z ; scip if not equal
goto ElseAddress ; else is equal
not_equal:
rrcf STATUS,W ; signed carry correction
xorwf VarA+3,W
BANKSEL VarB
xorwf VarB+3,W
addlw 0x80
btfss STATUS,C ; scip if greater
goto ElseAddress ; else is below
endm
;------------------------------------------------------
.... Spass muss sein....
Siro
Lesezeichen