Hello

if someone is interested in SDL: today I wrote (my first) SDL program in Masm. For this I translated the SDL C header files to MASM include files.

the sample is simple



;--- this is a SDL sample written in MASM

        .386
        .model flat, stdcall
        option casemap:none

        .nolist
        .nocref
        include windows.inc
        include macros.inc
        include sdl.inc
        .cref
        .list


        .code

main  proc c argc:dword, argv:ptr ptr SBYTE

local display:dword
local image:dword

invoke SDL_Init, SDL_INIT_VIDEO
        test eax, 80000000h
        jnz exit
       
        invoke SDL_SetVideoMode, 640, 480, 16, SDL_SWSURFACE
        and eax, eax
        jz exit2

        mov display, eax
        mov esi, CStr(".\winnt.bmp")
        invoke SDL_LoadBMP(esi)
        .if (!eax)
          invoke MessageBox, 0, esi, CStr("Error: bitmap not found"), MB_OK
            jmp exit2
        .endif
        mov image, eax
       
        invoke SDL_BlitSurface, image, NULL, display, NULL
       
        invoke SDL_Flip, display
       
        invoke SDL_FreeSurface, image

invoke SDL_Delay, 3000       
exit2:
        invoke SDL_Quit
exit:       
        ret
main  endp

        end




the source, binary, includes, ...  can be found at http://www.japheth.de/Download/sdl1.zip. But be warned, to create the binary you will have to know what a Makefile is.


Posted on 2005-09-30 12:50:53 by japheth