flat assembler
Message board for the users of flat assembler.

Index > DOS > I'm very proud of this program.

Author
Thread Post new topic Reply to topic
2



Joined: 26 Sep 2006
Posts: 92
2 18 Dec 2006, 05:31
The reason this program is special is because it counts in binary
and it doesn't ever mov to or from a direct memory location!
All the stuff is done by general purpose registers!

Code:
org $100
mov ah,2
xor ch,ch
p1:
mov bh,ch
xor cl,cl
p0:
rol bh,1
mov dl,bh
and dl,1
or dl,$30
int $21
inc cl
cmp cl,8
jne p0
mov dl,$D
int $21
mov dl,$A
int $21
inc ch
cmp ch,$0
jne p1
ret


    


I read somebody asking why thw intel has such few registers.
We have 8 general purpose 8 bit registers.
I rarely use the the other kinds of registers as I don't know much about
them.

_________________
There are 10 kinds of people in the world.
Those who know binary and those who haven't met me.
Post 18 Dec 2006, 05:31
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 20 Dec 2006, 13:46
hi 2,

cool,

actually the fastest way is not always using only registers instead of memory,and note often used code memory gets cached. Then counter variables become many GB/s.

i'm sure this will take much time in your program...
Code:
int $21 
    
Post 20 Dec 2006, 13:46
View user's profile Send private message Visit poster's website Reply with quote
2



Joined: 26 Sep 2006
Posts: 92
2 26 Dec 2006, 02:28
It may not be the fastest,but it was a funny thing to avoid memory.

It's also possible to write any program without the mov instruction.

It would be stupid,but imaging using AND by 0 to set something to 0 then
OR it with a value. It would take time,but it would be funny to imagine
writing programs without mov just for the fun of it.
Post 26 Dec 2006, 02:28
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.