Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Animating in assembly language for x86

Name: Anonymous 2005-11-16 23:18

Im working on an animation project with assembly language for x86 processors. In order to slow down the animation itself I originally used delay loops, something like this:
   
    MOV CX,70
xx: PUSH CX
    MOV  CX,0FFFFH
x:  LOOP x
    POP  CX
    LOOP xx

The problem with that kind of loops is that the delay time varies a lot on different computers and I need the animation to run at the same speed everywhere. Im a total n00b regarding assembly language so I would appreciate any suggestions you guys might have.

Name: Anonymous 2005-11-16 23:26

What OS is this targeting? Does it have to be entirely asm? You should really be depending on time counters and not hardware speeds.

Name: Anonymous 2005-11-17 5:50

i think a demo'er or anyone into that scene would have the best answer.  contact one of their assembler hackers

Name: Anonymous 2005-11-17 7:28

Use a timer, duh.

Name: Anonymous 2005-11-17 14:05

a timer?? anonymous, do you even know assembly language?

i recommend using the date of the system. there's an interruption (look up it, i dont remember what service it was) that returns the date of the system in hours:minutes:seconds:miliseconds
..perhaps you could use the seconds or the miliseconds in that loop, that way the speed would always be the same =D

Name: Anonymous 2005-11-17 15:39

Depending on the OS, using a timer is possible. You'll need to set up your own event handler for when the OS signals your process, but it's not some black voodoo or anything.

Sounds like overkill for what's wanted though.

Name: Anonymous 2005-11-17 16:41

>>5

If you're in assembly language you could read the timebase registers directly instead of calling system traps.

Name: Anonymous 2005-11-22 1:28

this looks a lot like my assigment for this month, i have to code a little ball that bounces around the screen, anyone have a source code i could use?

Name: Anonymous 2005-11-25 0:34

i think there's some bios interrupt you can use for timing.
http://www.htl-steyr.ac.at/~morg/pcinfo/hardware/interrupts/inte7dgw.htm maybe this?

Name: Anonymous 2005-11-26 22:25

I find any mention of "black voodoo" in this thread completely amusing. It's not like anything at all is a particularly dark art when you're looking up from the assembly level...

Name: Anonymous 2005-11-26 22:33

>>10
actually writing a program in c for linux is probably more difficult than writing a program in assembly for menuet...
http://www.menuetos.net/syscall.txt

Name: Anonymous 2005-11-27 13:54

>>1

If this is an appliation running fullscreen on linux with a VGA equipped system, you can limit updates to the screen frame rate by polling for vsync:



mov dx, 03dah ; video status port

wait_vblank_in: ; read port, wait for bit 3 to be set
in al, dx
test al, 8
jnz, .wait_vblank_in

wait_vblank_out: ; wait for bit 3 to be clear
in al, dx
test al, 8
jz, .wait_vblank_out

If that doesn't work right, swap the jnz/jz order or try bit 0 (test al, 1) but I think that's the horizontal blank status which you don't want.

Modern CPUs have a built in counter you can use for timing. Issue the 'rdtsc' (read time stamp counter' instruction and I think the result is a 64-bit value in eax:edx. Google rdtsc for more details.

The idea is that using some other mechansim (linux syscall or dos bios func to get the time, in seconds) you can determine how many rdtsc counts there are, and once you know how many are in a second you can then time your program accordingly.

Hope this helps.


Name: Anonymous 2007-08-04 14:14 ID:IvY8n0Ih

poop

Name: Anonymous 2007-11-14 11:37


poop

poop?

Name: Anonymous 2007-11-14 11:37

poop?

poop

Name: Anonymous 2007-11-14 11:38

>piippiip

Name: Anonymous 2009-01-14 5:25

>>13-16
Offtopic

Name: Anonymous 2009-01-14 9:02

>>17
How can you do timing on x86??? Still waiting for an answer.

Name: Anonymous 2009-01-14 9:07

Same way as everywhere else. Timers and VSYNC.

Name: Anonymous 2009-01-14 12:02

>>19
What's a timer?  How do I make VSYNC kick in?

Name: Anonymous 2009-03-06 10:03

Doc and i make   a kewl visual?

Name: Trollbot9000 2009-07-01 11:14

Remember that recently a DS game was  it Final Fantasy.

Name: Anonymous 2011-07-05 23:47

wee

Name: Anonymous 2011-07-06 19:44

It's 2011, time to use HPET.

Name: Anonymous 2011-07-06 19:47

>>20
How do I make VSYNC kick in?
fuckin' lol'd

Name: Anonymous 2011-07-07 3:17

>>26
Back to the imageboards with you, sir!

Don't change these.
Name: Email:
Entire Thread Thread List