flat assembler
Message board for the users of flat assembler.
Index
> DOS > Tutorial: Convert byte to binary Goto page 1, 2 Next |
Author |
|
LocoDelAssembly 03 Jan 2013, 21:19
Code: org 100h mov bh,123 ; Byte to convert mov ah,2 mov cx,8 bits: shl bx,1 mov dl,'0' adc dl, 0 ; If CF is set then '1' will be printed, otherwise '0' is printed. int 21h loop bits int 20h |
|||
03 Jan 2013, 21:19 |
|
Ciper 03 Jan 2013, 21:48
Great.
Thanks! |
|||
03 Jan 2013, 21:48 |
|
edfed 03 Jan 2013, 22:02
Code: org 100h mov bh,123 ; Byte to convert mov ah,2 mov cx,8 mov dh,'0' bits: shl bx,1 mov dl,dh adc dl, 0 ; If CF is set then '1' will be printed, otherwise '0' is printed. int 21h loop bits int 20h ? faster ? |
|||
03 Jan 2013, 22:02 |
|
AsmGuru62 03 Jan 2013, 22:12
@edfed: JMPs are minimized, so most likely it is faster.
And the code is more elegant. |
|||
03 Jan 2013, 22:12 |
|
edfed 03 Jan 2013, 22:20
mov dl,dh faster than mov dl,'0'?
|
|||
03 Jan 2013, 22:20 |
|
HaHaAnonymous 03 Jan 2013, 22:21
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 22:06; edited 1 time in total |
|||
03 Jan 2013, 22:21 |
|
edfed 03 Jan 2013, 22:22
jmp there = mov eip,there
i dislike the mov, it is a very bastard instruction. |
|||
03 Jan 2013, 22:22 |
|
Ciper 03 Jan 2013, 22:36
Hi guys (all):
I sincerely admire your assembly-optimizing wisdom. Why don't you share it via a series of "Best Practices:" posts (just a suggestion) so that a volunteer can accumulate them and perhaps write a booklet about FASM & DOS? Cheers & Regards, Ciper |
|||
03 Jan 2013, 22:36 |
|
HaHaAnonymous 03 Jan 2013, 23:03
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 22:06; edited 12 times in total |
|||
03 Jan 2013, 23:03 |
|
Ciper 03 Jan 2013, 23:07
Let's stop this nonsense.
MOV is the single most important instruction in the x86 instruction set... ...maybe after NOP ps: Even a jmp is a mov, after all. |
|||
03 Jan 2013, 23:07 |
|
HaHaAnonymous 03 Jan 2013, 23:18
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 22:06; edited 2 times in total |
|||
03 Jan 2013, 23:18 |
|
Ciper 03 Jan 2013, 23:21
Why?
What is the benefit? More importantly: What is the idea? How do you MOVe a value into a register? Just trying to understand... Last edited by Ciper on 03 Jan 2013, 23:30; edited 1 time in total |
|||
03 Jan 2013, 23:21 |
|
HaHaAnonymous 03 Jan 2013, 23:29
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 22:06; edited 3 times in total |
|||
03 Jan 2013, 23:29 |
|
Ciper 03 Jan 2013, 23:35
This was a soi-disant tutorial for God's sake!
Are we supposed to obfuscate tutorials? |
|||
03 Jan 2013, 23:35 |
|
Ciper 03 Jan 2013, 23:55
@HaHaAnonymous: Our goal in practicing assembly is not to hack but to learn. We want to practice x86 & DOS because it is much easier than x64.
Please do not make assembly unapproachable to newcomers; FASM has the unique goal of making the x86 assembler easy (first for its author then for everybody else). If your goal is hacking, I am sure there are other venues. |
|||
03 Jan 2013, 23:55 |
|
HaHaAnonymous 04 Jan 2013, 00:06
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 22:06; edited 1 time in total |
|||
04 Jan 2013, 00:06 |
|
Ciper 04 Jan 2013, 00:48
We are all people who dislike Intel CPUs; but we try to cope with them
|
|||
04 Jan 2013, 00:48 |
|
ACP 05 Jan 2013, 21:36
Ciper wrote: Hi guys (all): While personally I think that every book idea is a good idea the problem with this particular one is that you already have it all in few great books from DOS and 16bit Windows era. The only difference is that they target MASM, TASM or A86 and not FASM but since FASM roots are in TASM Ideal mode (which actually always made me sad that even in TASM 5 Users Guide you had sample programs written only in MASM mode) if you find a good book about TASM & DOS you are setup for FASM too in most cases. |
|||
05 Jan 2013, 21:36 |
|
HaHaAnonymous 05 Jan 2013, 21:46
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 22:05; edited 1 time in total |
|||
05 Jan 2013, 21:46 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.