Improve shell completion and Bob64 text readability

This commit is contained in:
Alvin-Zilverstand committed 2026-10-13 23:26:00 +02:00
1 parent 57787bfc7f
commit 412000b481
14 files changed
+2383 -1249

No files matched your search

+2 -2
View File
@@ -83,7 +83,7 @@ static int decay_type(int type);
static int global_address(Node *n,const char **name,int *offset);
static void binary_typed(int op,int left,int right);
static Node *top, **top_tail=⊤
static uint32_t code[65536];
static uint32_t code[131072];
static int ncode, legacy, wide, serial, return_label;
static uint32_t origin=0x300;
static int wide_app;
@@ -748,7 +748,7 @@ static void parse(void) {
}
parsing_types=0;
}
static void emit(int value) { if(ncode>=65536)error("code too large");code[ncode++]=(uint32_t)value; }
static void emit(int value) { if(ncode>=131072)error("code too large");code[ncode++]=(uint32_t)value; }
static void emit_relocation(const char *name,int offset) {
if(ncode>=65536 || nfixups>=65536)error("code/relocation limit exceeded");
fixups[nfixups++]=(Fixup){ncode,copy(name),offset};emit(0);
+90 -1
View File
@@ -273,6 +273,76 @@ function Assert-FramebufferRendered([string]$path) {
Write-Output " framebuffer: $width x $height, $($colors.Count) sampled colors"
}
function Assert-FontTestFramebuffer([string]$path) {
$qemuPath = $path.Replace('\', '/')
[void](Send-MonitorCommand "screendump $qemuPath" -Capture)
if (-not (Test-Path -LiteralPath $path -PathType Leaf)) {
throw 'QEMU did not produce the font-test framebuffer screenshot.'
}
$bytes = [IO.File]::ReadAllBytes($path)
$headerLength = [Math]::Min($bytes.Length,128)
$headerText = [Text.Encoding]::ASCII.GetString($bytes,0,$headerLength)
$header = [regex]::Match($headerText,'^P6\s+(\d+)\s+(\d+)\s+(\d+)\s')
if (-not $header.Success) { throw 'Font-test screenshot has an invalid PPM header.' }
$width = [int]$header.Groups[1].Value
$height = [int]$header.Groups[2].Value
$dataOffset = $header.Length
if ($width -lt 640 -or $height -lt 240 -or
$bytes.Length-$dataOffset -ne $width*$height*3) {
throw "Font-test screenshot has invalid dimensions or pixel data ($width x $height)."
}
$lines = @(
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz',
'0123456789',
'',
'0 O',
'1 l I',
'5 S',
'8 B',
'',
'[] {} () <> / \ | _ - + = : ; , . ! ?',
'bob64 kernel shell',
'The quick brown fox jumps over the lazy dog.',
'bob!'
)
$background = @(12,18,28)
for ($row=0; $row -lt $lines.Count; $row++) {
$line = $lines[$row]
for ($column=0; $column -lt $line.Length; $column++) {
if ([char]::IsWhiteSpace($line[$column])) { continue }
$foundInk = $false
$left = $column*9
$top = $row*18+1
for ($y=$top; $y -lt $top+16 -and -not $foundInk; $y++) {
for ($x=$left; $x -lt $left+8; $x++) {
$offset = $dataOffset+($y*$width+$x)*3
if ($bytes[$offset] -ne $background[0] -or
$bytes[$offset+1] -ne $background[1] -or
$bytes[$offset+2] -ne $background[2]) {
$foundInk = $true
break
}
}
}
if (-not $foundInk) {
throw "Font-test glyph '$($line[$column])' has no visible pixels at row $row, column $column."
}
}
if ($row -lt 12) {
$spacingY = $row*18+17
for ($x=0; $x -lt $width; $x++) {
$offset=$dataOffset+($spacingY*$width+$x)*3
if ($bytes[$offset] -ne $background[0] -or
$bytes[$offset+1] -ne $background[1] -or
$bytes[$offset+2] -ne $background[2]) {
throw "Font-test line spacing is not clear after row $row."
}
}
}
}
}
$machine = 'q35'
if ($ProbeOnly) { $machine = 'q35,i8042=off' }
$xhciDevice = 'qemu-xhci,id=usb-controller'
@@ -810,6 +880,7 @@ try {
$deadline = [DateTime]::UtcNow.AddSeconds($overallTimeout)
$serialText = ''
$mouseSmokeStarted = $false
$fontTestStarted = $false
$graphicsSmokeStarted = $false
$nativeLauncherSmokeStarted = $false
$compilerSmokeStarted = $false
@@ -829,7 +900,25 @@ try {
break
}
}
if ($allPresent -and -not $mouseSmokeStarted) {
if ($allPresent -and -not $fontTestStarted) {
Send-GuestText 'fonttest'
$fontTestDeadline = [DateTime]::UtcNow.AddSeconds(10)
do {
Start-Sleep -Milliseconds 100
$serialText = [string](Get-Content -LiteralPath $serialPath -Raw)
} while ([DateTime]::UtcNow -lt $fontTestDeadline -and
-not $serialText.Contains(
'The quick brown fox jumps over the lazy dog.'))
if (-not $serialText.Contains(
'The quick brown fox jumps over the lazy dog.')) {
throw "The shell font-test screen did not print its final sample line.`n$serialText"
}
Start-Sleep -Milliseconds 200
Assert-FontTestFramebuffer $framebufferPath
Write-Output ' shell font test: printable ASCII glyphs and 9x18 line spacing passed on the GOP framebuffer'
$fontTestStarted = $true
}
if ($allPresent -and $fontTestStarted -and -not $mouseSmokeStarted) {
$shellMarkerCountBeforeMouse = [regex]::Matches($serialText,
[regex]::Escape($shellPromptMarker)).Count
$exitMarkerCountBeforeMouse = [regex]::Matches($serialText,