From b32fdffb93c4fc3608b5c6767d08b1c41e058f99 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sun, 25 May 2025 18:45:24 -0400 Subject: [PATCH] initial commit --- .editorconfig | 31 +++++++++++++++++++++++++++++++ .gitignore | 1 + code/forth.asm | 2 ++ scripts/build.ps1 | 30 ++++++++++++++++++++++++++++++ scripts/helpers/devshell.ps1 | 28 ++++++++++++++++++++++++++++ scripts/run.ps1 | 7 +++++++ 6 files changed, 99 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 code/forth.asm create mode 100644 scripts/build.ps1 create mode 100644 scripts/helpers/devshell.ps1 create mode 100644 scripts/run.ps1 diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..235c6c0 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,31 @@ +root = true + +[*.refactor] +indent_style = space +indent_size = 4 + +[*.md] +indent_style = space +indent_size = 4 + +[*.{h, c, hpp, cpp}] +indent_style = tab +indent_size = 4 + +[*.{ps1, psm1}] +indent_style = tab +indent_size = 4 + +[*.odin] +indent_style = tab +indent_size = 2 +charset = utf-8 + +[*.asm] +indent_style = tab +indent_size = 2 +charset = utf-8 + +[*.{natvis, natstepfilter}] +indent_style = tab +indent_size = 4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4fcb459 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/code/forth.asm b/code/forth.asm new file mode 100644 index 0000000..874a585 --- /dev/null +++ b/code/forth.asm @@ -0,0 +1,2 @@ +; An introduction to forth based on jonesforth.S + diff --git a/scripts/build.ps1 b/scripts/build.ps1 new file mode 100644 index 0000000..2e33c48 --- /dev/null +++ b/scripts/build.ps1 @@ -0,0 +1,30 @@ +$devshell = Join-Path $PSScriptRoot 'helpers/devshell.ps1' +& $devshell -arch amd64 + +$path_root = split-path -Path $PSScriptRoot -Parent +$path_build = join-path $path_root 'build' +$path_code = join-path $path_root 'code' + +if ((test-path $path_build) -eq $false) { + new-item -itemtype directory -path $path_build +} + +$masm = 'ml64' + +$lib_kernel32 = 'kernel32.lib' + +$flag_subsystem_console = '/subsystem:console' +$flag_link = '/link' + + +push-location $path_build +$unit = join-path $path_code 'forth.asm' + +$asm_args = @() +$asm_args += $unit +$asm_args += $flag_link +$asm_args += $flag_subsystem_console +$asm_args += $lib_kernel32 + +& $masm $asm_args +pop-location diff --git a/scripts/helpers/devshell.ps1 b/scripts/helpers/devshell.ps1 new file mode 100644 index 0000000..33ca0ce --- /dev/null +++ b/scripts/helpers/devshell.ps1 @@ -0,0 +1,28 @@ +if ($env:VCINSTALLDIR) { + return +} + +$ErrorActionPreference = "Stop" + +# Use vswhere to find the latest Visual Studio installation +$vswhere_out = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath +if ($null -eq $vswhere_out) { + Write-Host "ERROR: Visual Studio installation not found" + exit 1 +} + +# Find Launch-VsDevShell.ps1 in the Visual Studio installation +$vs_path = $vswhere_out +$vs_devshell = Join-Path $vs_path "\Common7\Tools\Launch-VsDevShell.ps1" + +if ( -not (Test-Path $vs_devshell) ) { + Write-Host "ERROR: Launch-VsDevShell.ps1 not found in Visual Studio installation" + Write-Host Tested path: $vs_devshell + exit 1 +} + +# Launch the Visual Studio Developer Shell +Push-Location +write-host @args +& $vs_devshell @args +Pop-Location diff --git a/scripts/run.ps1 b/scripts/run.ps1 new file mode 100644 index 0000000..974eb2c --- /dev/null +++ b/scripts/run.ps1 @@ -0,0 +1,7 @@ +$path_root = split-path -Path $PSScriptRoot -Parent +$path_build = join-path $path_root 'build' + +Push-Location $path_build +$forth = join-path $path_build 'forth.exe' +& $forth +pop-location