From 888873e0994a5a7ae21a75d515e55e0df890e3d6 Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 28 Aug 2022 10:38:45 +0200 Subject: broken NES emulator (PPU and APU broken) --- examples/nesemu1/sdl.hff | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 examples/nesemu1/sdl.hff (limited to 'examples/nesemu1/sdl.hff') diff --git a/examples/nesemu1/sdl.hff b/examples/nesemu1/sdl.hff new file mode 100644 index 0000000..d001842 --- /dev/null +++ b/examples/nesemu1/sdl.hff @@ -0,0 +1,43 @@ +extern fn SDL_Init() int; +extern fn SDL_Quit() void; +extern fn SDL_GetError() *const u8; +extern fn SDL_Delay(u32) void; + +struct SDL_Window; +extern fn SDL_CreateWindow(title *const u8, x int, y int, w int, h int, flags u32) *SDL_Window; +extern fn SDL_DestroyWindow(*SDL_Window) void; + +struct SDL_PixelFormat; +struct SDL_BlitMap; + +struct SDL_Rect { + x int, y int, w int, h int +} + +struct SDL_Surface { + _flags u32, + format *SDL_PixelFormat, + w int, h int, + pitch int, + pixels *void, + userdata *void, + _locked intbool, + _lock_data *void, + clip_rect SDL_Rect, + _map *SDL_BlitMap, + refcount int, +} +extern fn SDL_CreateRGBSurface( + flags u32, width int, height int, depth int, Rmask u32, Gmask u32, Bmask u32, Amask u32 +) *SDL_Surface; +extern fn SDL_GetWindowSurface(*SDL_Window) *SDL_Surface; +extern fn SDL_UpdateWindowSurface(*SDL_Window) int; +extern fn SDL_UpperBlit(src *SDL_Surface, srcrect *SDL_Rect, dst *SDL_Surface, dstrect *SDL_Rect) int; + +union SDL_Event { + t enum { quit = 0x100 }, + _pad [8]f64, // idc exactly how big this union is but this should suffice +} +extern fn SDL_PollEvent(evt *SDL_Event) intbool; + +extern fn SDL_QueueAudio(dev int, data *const void, len u32) int; -- cgit v1.2.3