Linux x86_64 implementation of libglitch : https://github.com/erlehmann/libglitch.git
x86-64
nasm
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sdl.asm 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. EXTERN SDL_Init
  2. Extern SDL_Quit
  3. Extern SDL_Delay
  4. Extern SDL_OpenAudio
  5. Extern SDL_PauseAudio
  6. Extern SDL_WaitEvent
  7. Extern SDL_GetError
  8. Extern SDL_CreateRGBSurface
  9. Extern SDL_LockSurface
  10. Extern SDL_UnlockSurface
  11. Extern SDL_UpperBlit
  12. %define SDL_BlitSurface SDL_UpperBlit
  13. %ifdef SDL1
  14. %define SDL_QUIT 0x0C
  15. %define SDL_DOUBLEBUF 0x40000000
  16. %define SDL_HWSURFACE 0x1
  17. Extern SDL_GetVideoSurface
  18. Extern SDL_SetVideoMode
  19. Extern SDL_Flip
  20. %endif
  21. %ifdef SDL2
  22. ; events
  23. %define SDL_QUIT 0x100
  24. %define SDL_AUDIODEVICEADDED 0x1100
  25. ; values
  26. %define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000
  27. %define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_MASK | 0 ; display 0
  28. ; function
  29. Extern SDL_CreateWindow
  30. extern SDL_GetWindowSurface
  31. extern SDL_memset
  32. extern SDL_UpdateWindowSurface
  33. %endif
  34. %ifdef MIX_AUDIO
  35. Extern SDL_MixAudio
  36. %define SDL_MAX_VOLUME 128
  37. %endif
  38. %define SDL_SWSURFACE 0
  39. %define AUDIO_U8 0x0008 ; Unsigned 8-bit samples
  40. %define AUDIO_S8 0x8008 ; Signed 8-bit samples
  41. %define AUDIO_U16LSB 0x0010 ; Unsigned 16-bit samples
  42. %define AUDIO_S16LSB 0x8010 ; Signed 16-bit samples
  43. %define AUDIO_U16MSB 0x1010 ; As above, but big-endian byte order
  44. %define AUDIO_S16MSB 0x9010 ; As above, but big-endian byte order
  45. %define AUDIO_U16 AUDIO_U16LSB
  46. %define AUDIO_S16 AUDIO_S16LSB
  47. STRUC SDL_AudioSpec_STRUC
  48. .freq: resw 1
  49. .format: resw 1
  50. .channels: resb 1
  51. .silence: resb 1
  52. .samples: resw 1
  53. .size: resw 1
  54. .callback: resq 1
  55. .userdata: resq 1
  56. ENDSTRUC
  57. %macro def_SDL_AudioSpec 1
  58. %define %1.freq %1+SDL_AudioSpec_STRUC.freq
  59. %define %1.format %1+SDL_AudioSpec_STRUC.format
  60. %define %1.channels %1+SDL_AudioSpec_STRUC.channels
  61. %define %1.silence %1+SDL_AudioSpec_STRUC.silence
  62. %define %1.samples %1+SDL_AudioSpec_STRUC.samples
  63. %define %1.size %1+SDL_AudioSpec_STRUC.size
  64. %define %1.callback %1+SDL_AudioSpec_STRUC.callback
  65. %define %1.userdata %1+SDL_AudioSpec_STRUC.userdata
  66. %1:
  67. ISTRUC SDL_AudioSpec_STRUC
  68. %endmacro
  69. %macro MOV_surf_w 2
  70. mov %1, [%2]
  71. mov %1, [%1 + 16]
  72. %endmacro
  73. %macro MOV_surf_h 2
  74. mov %1, [%2]
  75. mov %1, [%1 + 20]
  76. %endmacro
  77. %macro MOV_surf_pitch 2
  78. mov %1, [%2]
  79. mov %1, [%1 + 24]
  80. %endmacro
  81. %macro MOV_surf_pixels 2
  82. mov %1, [%2]
  83. mov %1, [%1 + 32]
  84. %endmacro