[SDL] Calling SDL from assembly on Windows

Shawn Lindberg slindber at uiuc.edu
Wed Apr 7 19:36:36 PDT 2004


Stephane Marchesin wrote:
> It works under linux after some small modifications :
> http://icps.u-strasbg.fr/~marchesin/sdl/sdl_asm.tgz
> (maybe that'll help you)

Yes, unfortunately, it's much simpler on Linux, which is why I've 
focused on getting it to work in Windows first.

> Under windows, you'll have to use a SDL_main function instead of a main 
> function.

Both you and Michael Rickert suggested this, so I tried it.  At first, 
when I tried it, it worked, and I thought I had it beat.  However, I was 
suspicious, so I added this code:

.loop
	call	_SDL_PumpEvents

	push	dword 0
	call	_SDL_GetKeyState
	add	esp, 4

	cmp	byte [ eax + SDLK_q ], 0
	je	.loop

I put this right after the call to SetVideoMode.  And guess what, it 
crashes again... I really don't get it.

Shawn Lindberg




More information about the SDL mailing list