# E06-S03: run the interface table fixture in x128 and check its mailbox and # the TABLE records in IFTTEST.MAP. [CmdletBinding()] param([int]$Port = 6559, [int]$TimeoutSeconds = 180) $ErrorActionPreference = "Stop" $project = Split-Path $PSScriptRoot -Parent Import-Module (Join-Path $PSScriptRoot "lib\Nova128Test.psm1") -Force & (Join-Path $PSScriptRoot "build-iftable-test.ps1") $out = Join-Path $project "build\iftable-test" $disk = Join-Path $out "iftable-test.d81" $labels = Join-Path $out "iftable-test.lbl" $c1541 = Get-ViceTool "c1541" $failures = @() $session = Start-Nova128X128 -Autostart $disk -Drive8Image $disk -Port $Port ` -Screenshot (Join-Path $out "iftable-test-vicii.png") try { $mb = Wait-Nova128Mailbox $session -TimeoutSeconds $TimeoutSeconds Start-Sleep -Milliseconds 500 $screenRam = Read-Nova128Memory $session 0x0400 1000 } finally { Stop-Nova128X128 $session -SettleSeconds 0 } if ($mb[2] -ne 0x03) { $failures += "producer $($mb[2]) expected 3" } if ($mb[3] -ne 0xA5) { $failures += ("status {0:X2} expected A5" -f $mb[3]) } if ($mb[4] -ne 0 -or $mb[5] -ne 0) { $failures += "code $($mb[4] + 256 * $mb[5]) expected 0" } for ($i = 0; $i -lt 8; $i++) { if ($mb[8 + $i] -ne 1) { $failures += "phase $i flag is $($mb[8 + $i]), expected 1" } } $rows = for ($r = 0; $r -lt 25; $r++) { $chars = for ($c = 0; $c -lt 40; $c++) { $code = $screenRam[$r * 40 + $c] if ($code -le 0x1F) { [char]($code + 0x40) } elseif ($code -le 0x3F) { [char]$code } else { '?' } } (-join $chars).TrimEnd() } if (-not ($rows -contains "NOVA128 IFTABLE TEST OK")) { $failures += "screen does not contain 'NOVA128 IFTABLE TEST OK'" } function Read-DiskFile([string]$Name, [string]$Dest, [bool]$Seq) { if (Test-Path -LiteralPath $Dest) { Remove-Item -LiteralPath $Dest -Force } $spec = if ($Seq) { "$Name,s" } else { $Name } $prev = $ErrorActionPreference $ErrorActionPreference = "Continue" & $c1541 -attach $disk -read $spec $Dest 2>&1 | Out-Null $ErrorActionPreference = $prev return (Test-Path -LiteralPath $Dest) } $mapPath = Join-Path $out "IFTTEST.MAP" if (Read-DiskFile "ifttest.map" $mapPath $true) { $mapLines = ([IO.File]::ReadAllText($mapPath)).TrimEnd("`r", "`n") -split "`r`n|`r|`n" } else { $failures += ("no IFTTEST.MAP (check at {0:X2}{1:X2})" -f $mb[7], $mb[6]) $mapLines = @() } $alphaA = Get-Nova128Label $labels "m_alpha_a" $betaA = Get-Nova128Label $labels "m_beta_a" $alphaB = Get-Nova128Label $labels "m_alpha_b" $betaB = Get-Nova128Label $labels "m_beta_b" $expectedMap = @( "NOVA128 MAP 1", "ENTRY 1C0D", "SECTION STUB 1C01 000C", "SECTION START 1C0D 004A", ("TABLE A IFOO B000 02 {0:X4} {1:X4}" -f $alphaA, $betaA), ("TABLE A IBAR B004 01 {0:X4}" -f $alphaA), ("TABLE B IFOO B006 02 {0:X4} {1:X4}" -f $alphaB, $betaB)) if ($mapLines -and ($mapLines -join "`n") -ne ($expectedMap -join "`n")) { $failures += ("IFTTEST.MAP differs:`n got: " + ($mapLines -join "`n ") + "`n want: " + ($expectedMap -join "`n ")) } $detail = "last check {0:X4} value {1:X2}" -f ($mb[6] + 256 * $mb[7]), $mb[4] if ($failures) { throw ("interface table verification failed ($detail):`n " + ($failures -join "`n ") + "`n screen:`n " + (($rows | Where-Object { $_ }) -join "`n ")) } Write-Host "screen:" $rows | Where-Object { $_ } | ForEach-Object { Write-Host " |$_" } Write-Host "mailbox: producer 3, PASS, all 8 table flags set" Write-Host "MAP:" $expectedMap | ForEach-Object { Write-Host " |$_" }