param([string]$MasmRoot = 'F:\MASM32\masm32') $ErrorActionPreference = 'Stop' $root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path Push-Location $root try { & 'C:\Python314\python.exe' tools\tests\prepare_scratch_module.py if ($LASTEXITCODE -ne 0) { throw 'Scratch helper preparation failed' } & "$MasmRoot\bin\ml.exe" /c /coff /Cp /nologo /I. /DSCRATCH_TEST_SYNTAX=1 /DSCRATCH_MODULE_TEST=1 /Fobuild\scratch\module.obj tools\tests\scratch_syntax.asm if ($LASTEXITCODE -ne 0) { throw 'Scratch module assembly failed' } $sdk = Get-ChildItem -LiteralPath "${env:ProgramFiles(x86)}\Windows Kits\10\Lib" -Directory | Sort-Object Name -Descending | Where-Object { Test-Path -LiteralPath (Join-Path $_.FullName 'um\x86\kernel32.lib') } | Select-Object -First 1 $libraries = @() $libraries += '/LIBPATH:' + (Join-Path $sdk.FullName 'um\x86') $libraries += "/LIBPATH:$MasmRoot\lib" & "$MasmRoot\bin\link.exe" /nologo /SUBSYSTEM:CONSOLE /ENTRY:ScratchModuleStart@0 @libraries /OUT:build\scratch\module-test.exe build\scratch\module.obj build\scratch\module-base.obj kernel32.lib winmm.lib user32.lib ws2_32.lib gdi32.lib if ($LASTEXITCODE -ne 0) { throw 'Scratch module link failed' } & .\build\scratch\module-test.exe if ($LASTEXITCODE -ne 0) { throw "Scratch module assertion failed: $LASTEXITCODE" } Write-Output 'PASS: fresh MASM scratch module with real native graphics/input helpers (not a renderer simulation)' } finally { Pop-Location }