RosettaCodeData/Task/Show-ASCII-table/FreeBASIC/show-ascii-table.basic

22 lines
471 B
Plaintext

function getasc( n as unsigned byte ) as string
if n=32 then return "Spc"
if n=127 then return "Del"
return chr(n)+" "
end function
function padto( i as ubyte, j as integer ) as string
return wspace(i-len(str(j)))+str(j)
end function
dim as unsigned byte r, c, n
dim as string disp
for r = 0 to 15
disp = ""
for c = 0 to 5
n = 32 + 6*r + c
disp = disp + padto(3, n) + ": " + getasc(n) + " "
next c
print disp
next r