Category : C Source Code
Archive   : CEXPRESS.ZIP
Filename : INTFIELD.ASM
; unsigned short value;
; unsigned char start_bit,number_bits;
EXTRN _memory_model:byte
EXTRN _error_code:byte
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _int_field
_int_field proc near
push bp ;save BP
mov bp,sp ;set stack frame
push di ;
cmp _memory_model,0 ;near or far?
jle begin ;jump if near
inc bp ;else add 2 to BP
inc bp ;
begin: mov _error_code,0 ;clear _error_code
sub ax,ax ;clear AX
mov bx,ax ;BX too
mov dx,ax ;DX too
mov bl,[bp+8] ;number of bits
mov dl,[bp+6] ;starting bit
inc _error_code ;1 = bits out of range
cmp dl,15 ;in range?
ja L1 ;quit if not
mov di,dx ;copy start bit
add di,bx ;add number bits
inc _error_code ;2 = field doesn't fit
cmp di,16 ;fits in the byte?
ja L1 ;quit if not
mov cx,16 ;from 16 bits...
sub cx,bx ;subtract number of bits
sub cx,dx ;subtract starting bit
mov ax,[bp+4] ;get the integer
shl ax,cl ;shift field to high end
add cx,dx ;prepare to shift back
shr ax,cl ;shift field to low end
mov _error_code,0 ;0 = success
L1: pop di ;
pop bp ;
cmp _memory_model,0 ;quit
jle quit ;
db 0CBh ;RET far
quit: ret ;RET near
_int_field ENDP
_TEXT ENDS
END
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
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/