From 6feff68b33fc08db6b4de6d0a03039242a14f974 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Thu, 6 Aug 2026 21:10:04 -0400 Subject: [PATCH] Some more prep --- .gitignore | 1 + Readme.md | 7 +++++++ code/duffle/hashing.h | 1 + code/duffle/tables.h | 1 + code/duffle/text.h | 1 + code/duffle/win32.h | 41 ++++++++++++++++++++++++++--------------- code/part_1/sim_8086.c | 4 ++++ perfaware.proj | 9 +++++++++ 8 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 Readme.md create mode 100644 perfaware.proj diff --git a/.gitignore b/.gitignore index 4fcb459..919c3e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ build +course_content diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..56101af --- /dev/null +++ b/Readme.md @@ -0,0 +1,7 @@ +# Computer Enhance: Performance Aware Programming Course + +``` +git -C . config --local diff.ignoreSubmodules all +git -C . config --local status.submoduleSummary false +git -C . config --local submodule.recurse false +``` \ No newline at end of file diff --git a/code/duffle/hashing.h b/code/duffle/hashing.h index e731be2..c72d84d 100644 --- a/code/duffle/hashing.h +++ b/code/duffle/hashing.h @@ -2,6 +2,7 @@ # pragma once # include "dsl.h" # include "memory.h" +# include "analysis.h" #endif #pragma region Hashing diff --git a/code/duffle/tables.h b/code/duffle/tables.h index 4fa1bf4..6113376 100644 --- a/code/duffle/tables.h +++ b/code/duffle/tables.h @@ -3,6 +3,7 @@ # include "dsl.h" # include "memory.h" # include "hashing.h" +# include "analysis.h" #endif #pragma region Key Table Linear (KTL) diff --git a/code/duffle/text.h b/code/duffle/text.h index 0242e0c..bb95c8f 100644 --- a/code/duffle/text.h +++ b/code/duffle/text.h @@ -4,6 +4,7 @@ # include "memory.h" # include "hashing.h" # include "tables.h" +# include "analysis.h" #endif // NOTE(rjf): Includes reverses for uppercase and lowercase hex. diff --git a/code/duffle/win32.h b/code/duffle/win32.h index aec8262..cb42b28 100644 --- a/code/duffle/win32.h +++ b/code/duffle/win32.h @@ -52,6 +52,10 @@ WinAPI B4 ms_write_console( U4_V chars_written, U8 reserved ) asm("WriteConsoleA"); +WinAPI void* ms_create_file_a(char const* lpFileName, U4 dwDesiredAccess, U4 dwShareMode, void* lpSecurityAttributes, U4 dwCreationDisposition, U4 dwFlagsAndAttributes, void* hTemplateFile) asm("CreateFileA"); +WinAPI B4 ms_write_file(void* hFile, void const* lpBuffer, U4 nNumberOfBytesToWrite, U4* lpNumberOfBytesWritten, void* lpOverlapped) asm("WriteFile"); +WinAPI B4 ms_read_file(void* hFile, void* lpBuffer, U4 nNumberOfBytesToRead, U4* lpNumberOfBytesRead, void* lpOverlapped) asm("ReadFile"); +WinAPI B4 ms_close_handle(void* hObject) asm("CloseHandle"); // --- User32 --- WinAPI U2 ms_register_class_a(MS_WNDCLASSA const* lpWndClass) asm("RegisterClassA"); @@ -106,17 +110,24 @@ WinAPI void* ms_create_compatible_bitmap(void* hdc, S4 cx, S4 cy) asm WinAPI B4 ms_bit_blt(void* hdcDest, S4 x, S4 y, S4 w, S4 h, void* hdcSrc, S4 xSrc, S4 ySrc, U4 rop) asm("BitBlt"); WinAPI B4 ms_delete_dc(void* hdc) asm("DeleteDC"); WinAPI B4 ms_get_client_rect(void* hwnd, MS_RECT* lpRect) asm("GetClientRect"); -WinAPI void* ms_select_object(void* hdc, void* h) asm("SelectObject"); -WinAPI S4 ms_rectangle(void* hdc, S4 left, S4 top, S4 right, S4 bottom) asm("Rectangle"); -WinAPI S4 ms_set_bk_mode(void* hdc, S4 mode) asm("SetBkMode"); -WinAPI void* ms_create_solid_brush(U4 color) asm("CreateSolidBrush"); -WinAPI S4 ms_delete_object(void* ho) asm("DeleteObject"); +WinAPI void* ms_select_object(void* hdc, void* h) asm("SelectObject"); +WinAPI S4 ms_rectangle(void* hdc, S4 left, S4 top, S4 right, S4 bottom) asm("Rectangle"); +WinAPI S4 ms_set_bk_mode(void* hdc, S4 mode) asm("SetBkMode"); +WinAPI void* ms_create_solid_brush(U4 color) asm("CreateSolidBrush"); +WinAPI S4 ms_delete_object(void* ho) asm("DeleteObject"); enum { + MS_GENERIC_READ = 0x80000000, + MS_GENERIC_WRITE = 0x40000000, + MS_CREATE_ALWAYS = 2, + MS_OPEN_EXISTING = 3, + MS_FILE_ATTRIBUTE_NORMAL = 0x80, + MS_MEM_COMMIT = 0x00001000, MS_MEM_RESERVE = 0x00002000, MS_PAGE_READWRITE = 0x04, MS_SRCCOPY = 0x00CC0020, + MS_WM_DESTROY = 0x0002, MS_WM_SIZE = 0x0005, MS_WM_PAINT = 0x000F, @@ -133,26 +144,26 @@ enum { MS_WM_MOUSEWHEEL = 0x020A, MS_WS_OVERLAPPEDWINDOW = 0x00CF0000, MS_WS_VISIBLE = 0x10000000, - MS_VK_LEFT = 0x25, - MS_VK_UP = 0x26, - MS_VK_RIGHT = 0x27, - MS_VK_DOWN = 0x28, MS_PAGE_EXECUTE_READWRITE = 0x40, - MS_WM_CHAR = 0x0102, - MS_VK_RETURN = 0x0D, MS_VK_BACK = 0x08, MS_VK_TAB = 0x09, + MS_VK_RETURN = 0x0D, + MS_VK_SHIFT =0x10, MS_VK_SPACE = 0x20, - MS_VK_F5 = 0x74, MS_VK_PRIOR = 0x21, MS_VK_NEXT = 0x22, - - MS_VK_SHIFT =0x10, + MS_VK_LEFT = 0x25, + MS_VK_UP = 0x26, + MS_VK_RIGHT = 0x27, + MS_VK_DOWN = 0x28, + MS_VK_F1 = 0x70, + MS_VK_F2 = 0x71, + MS_VK_F5 = 0x74, + MS_WM_CHAR = 0x0102, }; - #if BUILD_DEBUG FI_ void assert(U8 cond) { if(cond){return;} else{debug_trap(); ms_exit_process(1);} } #endif diff --git a/code/part_1/sim_8086.c b/code/part_1/sim_8086.c index f27836e..b33171a 100644 --- a/code/part_1/sim_8086.c +++ b/code/part_1/sim_8086.c @@ -3,8 +3,12 @@ #include "duffle/memory.h" #include "duffle/win32.h" + + int main() { + + ms_exit_process(0); return 0; } diff --git a/perfaware.proj b/perfaware.proj new file mode 100644 index 0000000..7f4a170 --- /dev/null +++ b/perfaware.proj @@ -0,0 +1,9 @@ +// raddbg 0.9.28 project file + +target: +{ + executable: "build/sim_8086.exe" + working_directory: "build/" + enabled: 1 + label: "Sim 8086" +}