# E04-S02: run the software-frame ABI fixture in x128 and check the mailbox. [CmdletBinding()] param( [int]$Port = 6530, [int]$TimeoutSeconds = 90 ) $ErrorActionPreference = "Stop" $project = Split-Path $PSScriptRoot -Parent Import-Module (Join-Path $PSScriptRoot "lib\Nova128Test.psm1") -Force & (Join-Path $PSScriptRoot "build-frame-test.ps1") $out = Join-Path $project "build\frame-test" $prg = Join-Path $out "frame-test.prg" $session = Start-Nova128X128 -Autostart $prg -Port $Port ` -Screenshot (Join-Path $out "frame-test-vicii.png") try { $mb = Wait-Nova128Mailbox $session -TimeoutSeconds $TimeoutSeconds } finally { Stop-Nova128X128 $session } Write-Host ('mailbox: ' + (($mb | ForEach-Object { $_.ToString('X2') }) -join ' ')) $sum = $mb[8] + 256 * $mb[9] $byteSum = $mb[10] $overflow = $mb[11] $sp = $mb[12] + 256 * $mb[13] $frameError = $mb[14] $fp = $mb[15] Write-Host ("results: recursive={0} one-byte={1} overflow={2} SP=${3:X4} error={4} FP=${5:X2}" -f ` $sum, $byteSum, $overflow, $sp, $frameError, $fp) $failures = @() if ($mb[2] -ne 0x03) { $failures += "producer $($mb[2]) is not a generated program" } if ($mb[3] -ne 0xA5) { $failures += "fixture status is not PASS" } if ($mb[4] -ne 0 -or $mb[5] -ne 0) { $failures += "code is $($mb[4] + 256 * $mb[5])" } if ($sum -ne 1275) { $failures += "recursive result is $sum, expected 1275" } if ($byteSum -ne 12) { $failures += "one-byte result is $byteSum, expected 12" } if ($overflow -ne 1) { $failures += "overflow result is $overflow, expected 1" } if ($sp -ne 0xC000) { $failures += ('SP after overflow is ${0:X4}, expected $C000' -f $sp) } if ($frameError -ne 1) { $failures += "frame error is $frameError, expected 1" } if ($fp -ne 0) { $failures += "FP after overflow is $fp, expected 0" } if ($failures) { throw ("frame verification failed:`n " + ($failures -join "`n ")) } Write-Host "verified 50-deep recursion, one-byte return, and transactional overflow unwind"