Hi!
MD> emmx220.zip, EMM386 version 2.20 memory manager, mostly executable files;
One more place:
7. Code below is buggy (counted not expected bits - should be used SHL
instead SHR) or redundant (result is always zero additions):
______________O\_/_________________________________\_/O______________
@@checkhigh:
[...]
and al,0f0h
[...]
@@gethigh:
shr al,1
adc bx,0 ; bump count of allocated 4K blocks
if bit set
shr al,1
adc bx,0
shr al,1
adc bx,0
shr al,1
adc bx,0
_____________________________________________________________________
O/~\ /~\O
PS: And, of course, given code may be noticeably reduced in size. For
example, shortest code to count to AH number of nonzero bits in AL:
mov ah,0
@@: add ax,80h
shl al,1
jnz @@
xchg al,ah
This small (and fast!) loop allows to remove all 40 bytes of current code,
plus remove some bytes of initial overhead (4-8 bytes). Same for counting
16K blocks in CH: if you inverse (NOT) original value, then you may replace
"mov al,ah/and al,0f0h/cmp al,0f0H/jne/inc ch" by "test ah,0f0h/jnz/inc ch"
or something without jumps (see tricks with NEG, which sets CF for
zero/nonzero values).
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel