Finnish was by some guys that I assume were from Finland. If anybody knows the correct attribution please let me know.
I was thinking about it the other day because we talked about the old segment register trick that we used to do, and I always thought this was such a neat little bit of code. It also uses the byte-regs as part of word-reg tricks.
Finnish :
; es = CharTable
; bx = hash index
; dl = control bits
; ds[si] = input
; ds[di] = output
; ax/al/ah = input char
; bp = control ptr
ProcessByte macro SourceReg,BitVal
cmp SourceReg, es:[bx]
je ProcessByte_done
or dl, BitVal
mov es:[bx], SourceReg
mov ds:[di], SourceReg
inc di
ProcessByte_done: mov bh, bl
mov bl, SourceReg
endm
ProcessBlockLoop:
mov bp, di ; ControlPtr = CompPtr++;
inc di
xor dl, dl ; Control = 0;
lodsw ; AX = ds[si] , si += 2
ProcessByte al, 80h
ProcessByte ah, 40h
lodsw
ProcessByte al, 20h
ProcessByte ah, 10h
lodsw
ProcessByte al, 08h
ProcessByte ah, 04h
lodsw
ProcessByte al, 02h
ProcessByte ah, 01h
mov ds:[bp], dl ; *ControlPtr = Control
No comments:
Post a Comment