I remeber someone saying I can use registers for whatever i please... well i ran out of general purpose registers.



.while (counter<5)
mov bh,01h
mov dh,01h
inc dl
mov ah, 02h
int 10h

mov bh,1
mov al,[FBuffer+?]
mov bl,1
mov cx,1
mov ah,0ah
int 10h
inc counter
inc ?

mov al, 01h
mov ah, 05h
int 10h
.endw


since i use all my registers in that loop, and i cant use a variable as my offset pointer. what are my options, if any?
Posted on 2003-03-24 03:54:49 by Homer
NEVERMIND :tongue:
Posted on 2003-03-24 03:59:03 by Homer
You did not use di and si :grin:
Posted on 2003-03-24 06:05:32 by roticv
how about local variables ? :P
Posted on 2003-03-24 06:06:49 by wizzra
yea si and di worked for me =]

i thought they would be changing... i never look at memory dumps :rolleyes:

wizzra: I was trying to use two variables in a while statement... stupid homer... stuuuuupid homer.

anyway.. after finishing this project i realized that there aren't enough registers.
i only had to get some text to scroll in the dos...
imagine if i had to do something important.

not that i would use dos for anything... hmm... i still think there aren't enough reg's
Posted on 2003-03-24 07:00:46 by Homer
8 registers is sufficient I suppose. The most just push the data into stack and pop it out later.
Posted on 2003-03-24 07:20:51 by roticv
How come the itainium has so many?
Posted on 2003-03-24 14:20:28 by Homer
the itanium is 64-bit, so its creators know memory is of no concern to the user. In the x86, I suppose, the limit of 8 registers is to minimize size of code.
inc eax - 1 byte in 32b
inc register3 - 2 bytes (I suppose) in 64b

I read somewhere the Mac also has many registers. I've also been told that Mac needs hundreds of megabytes of RAM just to run. Mac users are mostly rich ones, if they can afford a computer for thousands of dollars, why can't they spend a hundred more on 1 GB RAM :).
If I were a cpu designer, I would also put many registers, and this won't change the design a lot. Or maybe not. x86 is standard, force, final design.

in x86, I usually use 7 registers, including ESP/ or EBP.
If you use ESP,
make:


dxxx proc ....
local esp2 ; <--- this

mov esp2,esp

; now use esp, but do not push, pop, nor call.


mov esp,esp2


but if you want to use the ebp ( and be able to push, pop, call):


push ebp

; do NOT use local variables in this block, nor arguments!
mov ebp,eax
shr ebp,6
add ebp,eax
invoke DestroyWindow,ebp


pop ebp


Posted on 2003-03-24 15:12:24 by Ultrano
If you're REALLY good with a soldering iron you might be able to make a few more :grin:
Posted on 2003-04-18 03:20:10 by donkey
Homer,

The trick is with registers if you code is complex is to start with a lot of memory variables and get the code going first. Once its reliable, you can start using your spare registers until you have made the most efficient use of them.

You tend to use registers where the speed difference will matter, in intensive loops, they are aften faster where an occasional comparison can be done with a variable with no perceivable speed loss.

Regards,

hutch@movsd.com
Posted on 2003-04-18 04:10:05 by hutch--
to add my 2 cents to Hutch's reply, if your code is running on Athlon, and the conditional / loop you have uses a variable, that is only read from, you will have the code faster than if it was with a register ;). This is mostly for conditional jumps.
why?
I guess that when the processor reads ahead, while executing some stuff, and the memory to be compared is not dirty, it feels free to think that the next place to go will be what that jz points at. And loads the code at that place. This can be used in loops, too, but if you have , I am sure it will confuse the cpu, and it will not be so sure what to load. In fact, it will load, but will invest 100% that this will be the place to go. Not fortune-telling, but weather forecast. :grin:
Posted on 2003-04-18 08:34:04 by Ultrano
Done. It works like a charm :grin:
Posted on 2003-04-18 08:36:53 by Delight
lol donkey :tongue:
Posted on 2003-04-18 12:23:27 by Homer

Done. It works like a charm :grin:


Hm... i'm no good /w a soldering iron... maybe you can help me :) btw, i've never opened my CPU (i'm assuming that's what's under the hood) - is it really so colourful? what a change from the bland motherboard!
Posted on 2003-04-18 13:12:30 by jademtech
I'm pretty sure that's just a dye. Or else it'd really be a work of art!
Posted on 2003-04-18 16:57:13 by Homer
Homer's right, it's a picture of the dye from a Pentium 4, the actually chip is probably just gray though I've never seen one I can't imagine it being that different looking from an EPROM, just alot more densly packed.
Posted on 2003-04-18 18:03:59 by donkey
I do not agree. Look at the memory. What dye would have the exact look of the dense cells of memory, looked from above. See the shadows and reflections. See the pins on the bottom. What dye would have gradients?? Such dye will make only bad chips. And, by the way, I've seen a chip inside. I think it was Pentium2. This is the look :). But it's disturbing me that might not be on a single sillicon plate. Or it may be. If there are hundreds of masks, applied.
Ah, and btw, do you know why there are gradients? I learnt about defractional net in physics. It's really the same, though the light does not go through, but reflects by the chip. Different density and angle of view leads to different color ;).
Posted on 2003-04-19 02:36:39 by Ultrano
Hi Ultrano,

You may be right, the image came from a site that said it was a pentium 4 die, outside of that I can't say. Way way way beyond any of my experience and I have no desire to cut mine open to check :)
Posted on 2003-04-19 10:44:50 by donkey
Assuming your talking about the die (and not dye).

Plain silicon is graphite in color.

Etched silicon is colorful for the same reasons that CD's and oil on water are - Quantum Electro Dynamics.
Posted on 2003-04-20 04:20:07 by eet_1024
Mmmm, my little joke has evolved this thread from practical use of registers to Quantum Electro Dynamics, not bad. It really is kind of funny when you think about it.
Posted on 2003-04-20 05:46:36 by donkey