flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Boot loader....w/o the...boot loader? 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...
|
|||
04 Aug 2005, 13:39 |
|
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. |
|||
04 Aug 2005, 19:43 |
|
tom tobias 05 Aug 2005, 15:08
Thanks locodelassembly, Well Done!
|
|||
05 Aug 2005, 15:08 |
|
Night Rider 05 Aug 2005, 18:37
What the difference - use test/or + jf or cmp... or is just nice solution.
|
|||
05 Aug 2005, 18:37 |
|
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.
|
|||
05 Aug 2005, 19:20 |
|
LocoDelAssembly 05 Aug 2005, 23:48
See attachment for timings, I took this from MASM by hutch, good Docs, bad assembler
|
|||||||||||
05 Aug 2005, 23:48 |
|
Night Rider 06 Aug 2005, 19:11
Ok, i have been searching for such document for a long time...
|
|||
06 Aug 2005, 19:11 |
|
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.
|
|||
06 Aug 2005, 21:22 |
|
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. |
|||
06 Aug 2005, 23:53 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.