flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2 |
Author |
|
Night Rider
tom tobias, i think that in this code (string output) no difference between OR or TEST (test is boolean operator too). They both put ZF...
|
|||
![]() |
|
LocoDelAssembly
Code: PrintMsg: mov ah, 0x0E ; teletype output mov bh, 0x00 ; we are writing on page number 0 jmp .loadChar .printChar: int 0x10 ; call bios video function .loadChar: lodsb ; load [si] to al and increment si test al, al ; set zero flag if al = 0 jnz .printChar ; if zero flag is not set, jump to printChar ret ; return It's only a silly modification I know but I think it could be better. If the Opcodes help of MASM (by hutch) is right "test reg, reg" is one clock faster than "cmp reg, immed" and "or reg, reg" on a 386. |
|||
![]() |
|
tom tobias
Thanks locodelassembly, Well Done!
![]() |
|||
![]() |
|
Night Rider
What the difference - use test/or + jf or cmp... or is just nice solution.
|
|||
![]() |
|
LocoDelAssembly
The difference is this loop is one instruction less than the original code and "test reg, reg" takes only one clock on 386. "cmp reg, immed" and "or reg, immed" takes two clocks on 386.
|
|||
![]() |
|
LocoDelAssembly
See attachment for timings, I took this from MASM by hutch, good Docs, bad assembler
![]()
|
|||||||||||
![]() |
|
Night Rider
Ok, i have been searching for such document for a long time...
|
|||
![]() |
|
Tomasz Grysztar
According to Intel's 80386 Manual from 1986 (I once posted a copy here) "test reg,reg" takes two clocks, too.
|
|||
![]() |
|
LocoDelAssembly
Tomasz: I thought it's not an error of the docs because "test" don't save the result but I was wrong, the doc has a mistake. Thank you.
Night Rider: The new code now it's just "a nice solution" with one instruction less in the loop. |
|||
![]() |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.