Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Speed question

Status
Not open for further replies.

qbasicking

Programmer
Aug 19, 2001
628
0
0
US
I am going to be using an offscreen screen 13 buffer (one dimension) so I am going to have to use (y * 320 + x)64000 times every frame. I am assembly illiterate, I was wondering if someone out there would help me out with a line of assembly to do that quicker than Qbasic would.

Is there a reason hexidecimal is used more often than decimal, is it faster?
 
Y * 320

is the same as

(Y * 256) + (Y * 64)

or

(Y * 2^8) + (Y * 2^6)

So

Offset = Y<<8 + Y<<6 + X

Something like this:
Code:
MOV AX, (y)
MOV BX, AX
SHL AX, 8
SHL BX, 6
ADD AX, BX
MOV BX, (x)
ADD AX, BX

I's been awile since I did this so you might get someone else to help you with the details...

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top