Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.
Moderator: Coders of Rage
Tvspelsfreak
Chaos Rift Junior
Posts: 272 Joined: Wed Sep 29, 2004 5:53 pm
Favorite Gaming Platforms: NES, SNES
Programming Language of Choice: C/C++
Location: Umeå, Sweden
Contact:
Post
by Tvspelsfreak » Tue Jan 25, 2005 7:56 pm
As requested by GV, I'll post a very simple ASM example of switching 2 numbers.
Code: Select all
#include <stdio.h>
void main(){
int a = 10;
int b = 20;
printf("Before:\t%d,%d\n",a,b);
__asm{
mov eax,a
mov ebx,b
mov a,ebx
mov b,eax
}
printf("After:\t%d,%d\n",a,b);
}
Last edited by
Tvspelsfreak on Tue Jan 25, 2005 7:56 pm, edited 1 time in total.
Falco Girgis
Elysian Shadows Team
Posts: 10294 Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:
Post
by Falco Girgis » Tue Jan 25, 2005 8:29 pm
Btw, it's moving a to register eax and b to register ebx. Then it's putting what's in ebx in a and what's in eax in b.
Thanks for explaining that Tvspelsfreak. XD
JS Lemming
Game Developer
Posts: 2383 Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON
Post
by JS Lemming » Wed Jan 26, 2005 7:27 am
Yeah I diddle daddled in ASM in my time. But it was for TI 83 plus. Hmm. It looks easy to incorparate. Maybe I can use it to speed up some repetive code! An asm particle engine would be friggen sweet.
Small girl at the harbor wrote: Look Brandon, that crab's got ham!
Falco Girgis
Elysian Shadows Team
Posts: 10294 Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:
Post
by Falco Girgis » Wed Jan 26, 2005 8:11 am
Dear god, I pray that you aren't talking about for Dreamcast.
You do realize that x86 ASM is NOT going to work on DC. ASM is not portable so whatever platform you code that particle engine for will stay on that platform.
It's SH4 asm for the DC.
JS Lemming
Game Developer
Posts: 2383 Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON
Post
by JS Lemming » Wed Jan 26, 2005 8:16 am
NAH DUH Gyrovobis! I'm sad you would think that I am that nieve.
Last edited by
JS Lemming on Wed Jan 26, 2005 8:16 am, edited 1 time in total.
Small girl at the harbor wrote: Look Brandon, that crab's got ham!
Falco Girgis
Elysian Shadows Team
Posts: 10294 Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:
Post
by Falco Girgis » Wed Jan 26, 2005 8:19 am
I was just making sure.
Maybe you are naive !
:guffaw:
JS Lemming
Game Developer
Posts: 2383 Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON
Post
by JS Lemming » Wed Jan 26, 2005 8:22 am
No i think YOU are the nuaieve one.
Small girl at the harbor wrote: Look Brandon, that crab's got ham!