Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

56 lignes
2.4KB

  1. # E04-S06: parse STMTS.N8 in x128, run the emitted body, and check the locals
  2. # and the bytes the generated print calls asked for.
  3. [CmdletBinding()]
  4. param([int]$Port = 6560, [int]$TimeoutSeconds = 180)
  5. $ErrorActionPreference = "Stop"
  6. $project = Split-Path $PSScriptRoot -Parent
  7. Import-Module (Join-Path $PSScriptRoot "lib\Nova128Test.psm1") -Force
  8. & (Join-Path $PSScriptRoot "build-statements-test.ps1")
  9. $out = Join-Path $project "build\statements-test"
  10. $disk = Join-Path $out "statements-test.d81"
  11. $failures = @()
  12. $lbl = Get-Content -Raw -LiteralPath (Join-Path $out "statements-test.lbl")
  13. if ($lbl -notmatch "([0-9A-Fa-f]{6})\s+\.rec_buf\b") { throw "rec_buf not in the label file" }
  14. $recBuf = [Convert]::ToInt32($matches[1], 16)
  15. $session = Start-Nova128X128 -Autostart $disk -Drive8Image $disk -Port $Port `
  16. -Screenshot (Join-Path $out "statements-vicii.png")
  17. try {
  18. $mb = Wait-Nova128Mailbox $session -TimeoutSeconds $TimeoutSeconds
  19. $log = Read-Nova128Memory $session $recBuf 16
  20. } finally {
  21. Stop-Nova128X128 $session
  22. }
  23. Write-Host ("mailbox: " + (($mb | ForEach-Object { $_.ToString('X2') }) -join ' '))
  24. Write-Host ("recorded: " + (($log | ForEach-Object { $_.ToString('X2') }) -join ' '))
  25. if ($mb[2] -ne 0x02) { $failures += ("producer $($mb[2]) expected 2 (compiler)") }
  26. if ($mb[3] -ne 0xA5) {
  27. $failures += ("fixture status {0:X2} failed at stage {1}" -f $mb[3], $mb[4])
  28. }
  29. if ($mb[8] -ne 0) { $failures += "diagnostics present: $($mb[8])" }
  30. if ($mb[9] -ne 0) { $failures += "emitter error $($mb[9])" }
  31. if ($mb[10] -ne 10) { $failures += ("a = {0}, expected 10" -f $mb[10]) }
  32. if ($mb[11] -ne 7) { $failures += ("b = {0}, expected 7" -f $mb[11]) }
  33. if ($mb[12] -lt 60) { $failures += "emitted only $($mb[12]) bytes" }
  34. if ($mb[13] -ne 0) { $failures += "codegen error $($mb[13])" }
  35. # print "sum" records SUM + CR; print a records $FF, $0A, CR.
  36. $expect = @(0x53, 0x55, 0x4D, 0x0D, 0xFF, 0x0A, 0x0D)
  37. if ($mb[14] -ne $expect.Count) {
  38. $failures += ("recorded {0} bytes, expected {1}" -f $mb[14], $expect.Count)
  39. } else {
  40. for ($i = 0; $i -lt $expect.Count; $i++) {
  41. if ($log[$i] -ne $expect[$i]) {
  42. $failures += ("recorded byte {0} is {1:X2}, expected {2:X2}" -f $i, $log[$i], $expect[$i])
  43. }
  44. }
  45. }
  46. if ($failures) { throw ("statements verification failed:`n " + ($failures -join "`n ")) }
  47. Write-Host ("emitted {0} bytes; a=10, b=7; print recorded SUM, 10" -f $mb[12])
  48. Write-Host "verified parser pass-2 statement emission executes in x128"

Powered by TurnKey Linux.