Category : Printer + Display Graphics
Archive   : AI32BT.ZIP
Filename : XBITASM.ASM

 
Output of file : XBITASM.ASM contained in archive : AI32BT.ZIP
; Xbitasm.asm by Mark C. Peterson, CompuServe [70441,3353]

_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT

;int near _cdecl XBitShift(XBIT x, int XBytes, int ShiftBits)
x equ [bp + 6]
XBytes equ [bp + 8]
ShiftBits equ [bp + 10]

PUBLIC _XBitShift
_XBitShift PROC FAR
push bp
mov bp, sp
push si
xor ax, ax
mov bx, ShiftBits
or bx, bx
jz ExitXBitShift
jns ShiftXBitsLeft
neg bx

ShiftXBitsRight:
mov si, x
mov cx, XBytes
add si, cx
clc

ShiftNextByteRight:
dec si
rcr BYTE PTR [si], 1
loop ShiftNextByteRight

dec bx
jnz ShiftXBitsRight
jmp ExitXBitShift

ShiftXBitsLeft:
mov si, x
mov cx, XBytes
clc

ShiftNextByteLeft:
rcl BYTE PTR [si], 1
inc si
loop ShiftNextByteLeft

adc ax, 0
dec bx
jnz ShiftXBitsLeft

ExitXBitShift:
pop si
pop bp
ret
_XBitShift ENDP



;void near _cdecl XBitNegate(XBIT x, int XBytes);
x equ [bp + 6]
XBytes equ [bp + 8]

PUBLIC _XBitNegate
_XBitNegate PROC FAR
push bp
mov bp, sp
push si
xor ax, ax
mov si, x
mov cx, XBytes
dec cx
add si, cx
cmp WORD PTR [si], 8000h
jne Negate
ChkNextWord:
dec si
dec si
cmp WORD PTR [si], 0
jne Negate
loop ChkNextWord

add si, XBytes
dec si
mov BYTE PTR [si], 0
inc ax
jmp ExitXBitNegate

Negate:
mov si, x
mov cx, XBytes
clc

NegateNextByte:
not WORD PTR [si]
adc WORD PTR [si], ax
inc si
inc si
dec cx
loop NegateNextByte

ExitXBitNegate:
pop si
pop bp
ret
_XBitNegate ENDP

_TEXT ENDS


END



  3 Responses to “Category : Printer + Display Graphics
Archive   : AI32BT.ZIP
Filename : XBITASM.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/