|
Post by David Drake on Feb 25, 2020 8:34:18 GMT -5
I created the code below for the Rosetta Code task "Show ASCII table." Details are available here: rosettacode.org/wiki/Show_Ascii_table. I tried to duplicate the sample image given with the task, which explains why this is a bit fancier than a simple text output. I welcome the community's thought, comments and corrections. 'Show ASCII character set from values 32 to 127 (decimal) in a table format.
nomainwin WindowWidth=440 WindowHeight=580 UpperLeftX=1 UpperLeftY=1
open "ASCII Table" for graphics_nf_nsb as #1 #1 "down;fill white;flush;trapclose [q];color black;backcolor lightgray"
for x = 1 to 12 for y = 1 to 16 #1 "font ariel 10;place ";x*30+2;" ";y*30+2;";boxfilled ";x*30+30;" ";y*30+30 next y next x
character=31 for x = 1 to 12 step 2 for y = 1 to 16 character=character+1 #1 "place ";x*30+5;" ";y*30+20;";\";character #1 "place ";x*30+42;" ";y*30+20;";\";chr$(character) next y next x
#1 "place ";30+38;" ";30+20;";\sp" #1 "place ";12*30+6;" ";16*30+20;";\del"
wait
[q] close #1 end
|
|
|
Post by David Drake on Mar 2, 2020 7:03:56 GMT -5
I haven't seen any activity here. If there are no comments or corrections, I plan to post it to Rosetta Code later today.
|
|
|
Post by tsh73 on Mar 2, 2020 8:55:36 GMT -5
Please consider posting two versions - graphic - yours - really nice one and text (really simple one)
for j = 32 to 47 for i = 0 to 5 c=j+i*16 print using("###",c);" : "; if c=32 then print "Spc"; else if c=127 then print "Del"; else print chr$(c);" "; end if end if print , next print next
|
|