View Single Post
Old Mar 9th, 2008, 7:24 AM   #3
Irwin
Newbie
 
Join Date: Mar 2008
Posts: 9
Rep Power: 0 Irwin is on a distinguished road
Re: [MASM32] Working with arrays

IsKeyPressed proc Key:DWORD
    mov   ecx, [dwKey]
    movzx eax, byte [gKeys+ecx]
    test  eax, eax
    sete  al
    ret
IsKeyPressed endp

InputCreate  proc
    push  256d
    push  GPTR ; memory is filled with 0's
    call  GlobalAlloc
    push  27d
    push  IsKeyPressed
    ret
InputCreate endp

Also, a word to the wise. Don't use MSVCRT in ASM, it completely destroys the purpose of using ASM. The converting is fairly easy too:

malloc -> GlobalAlloc
memset -> stosb/stosw/stosd/stosq
Irwin is offline   Reply With Quote