#### Archived

This topic is now archived and is closed to further replies.

# NEED Help with Sprite Scaling

This topic is 5767 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey everyone ... im still stuck in the world of qbasic .. and ive just developed a simple sprite scaling routine ... my problem is that i need to transfer it into an assembly routine ... the problem is that my routine uses numbers with decimals (not just integers) ... can anyone offer commands in assembly that support decimals .. if not does anyone know any better ways for simple sprite scaling. Ive enclosed the simple routine''s code: ******************************************** OrigSizeX = 35 ''\ OrigSizeY = 90 '' \ NewSizeX = 18 '' / These numbers are just for example NewSizeY = 45 ''/ DO SkipX = OrigSizeX / NewSizeX SkipY = OrigSizeY / NewSizeY X = 1 Y = 1 FOR B = 0 TO (OrigSizeY- 1) STEP SkipY FOR A = 0 TO (OrigSizeX - 1) STEP SkipX Q = INT(B) * OrigSizeX + INT(A) PSET (X, Y), Sprite(Q) X = X + 1 NEXT X = 1 Y = Y + 1 NEXT ********************************************* i just want to have this very same routine ... except done in assembly (for speed purposes). Thank you Come check out our game projects and products including TWIGZ, our new graphical point&click adventure, at Shattered Realm Productions

##### Share on other sites
You can use floating point numbers in ASM, that''s the f* commands (fadd, fmul, fdiv, etc). But you shouldn''t use them in the inner loop of a routine such as yours. Performance will be less than optimal.

You should use fixed point numbers instead. They are basically standard integers, but with a part of the bitfield reserved for the fractional part. Just run a search on Google on ''fixed point arithmetic'', there are tons of resources lying around. First, convert your qbasic code to use fixed point numbers. Once it works, the translation into ASM will be straightforward.

1. 1
Rutin
35
2. 2
3. 3
4. 4
5. 5

• 12
• 14
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633343
• Total Posts
3011430
• ### Who's Online (See full list)

There are no registered users currently online

×