flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2 |
Author |
|
Night Rider 04 Aug 2005, 13:39
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 04 Aug 2005, 19:43
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 05 Aug 2005, 15:08
Thanks locodelassembly, Well Done!
![]() |
|||
![]() |
|
Night Rider 05 Aug 2005, 18:37
What the difference - use test/or + jf or cmp... or is just nice solution.
|
|||
![]() |
|
LocoDelAssembly 05 Aug 2005, 19:20
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 05 Aug 2005, 23:48
See attachment for timings, I took this from MASM by hutch, good Docs, bad assembler
![]()
|
|||||||||||
![]() |
|
Night Rider 06 Aug 2005, 19:11
Ok, i have been searching for such document for a long time...
|
|||
![]() |
|
Tomasz Grysztar 06 Aug 2005, 21:22
According to Intel's 80386 Manual from 1986 (I once posted a copy here) "test reg,reg" takes two clocks, too.
|
|||
![]() |
|
LocoDelAssembly 06 Aug 2005, 23:53
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.