home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 5
/
ctrom5b.zip
/
ctrom5b
/
PROGRAM
/
DIVERSEN
/
TIPI2A
/
ASCII.TPI
< prev
next >
Wrap
Text File
|
1994-10-04
|
1KB
|
53 lines
# ASCII.TPI by Kent Peterson 9/29/94
define hex$ ( n -- )
( -- h$ )
# returns the hex equivalent of a number 0-15
"" begin
dup 16 mod
"0123456789ABCDEF" 1 + 1 mid$
swap$ +$
16 / dup not
until drop
enddef
define asciiline ( c -- )
( -- )
# displays c as a character, its hex code and its decimal code
" ║ ║ ║ ║ " print$
dup row 3 locate chr$ print$
dup row 7 locate hex$ print$
row 12 locate print cr
enddef
define asciichart ( n -- )
0 0 locate
| ╔═══╦════╦═════╗
| ║Chr║Hex ║ Dec ║
| ╠═══╬════╬═════╣
10 do
dup 10 index - + 256 mod asciiline
loop
drop
| ╚═══╩════╩═════╝
enddef
define wait
begin key dup if dup endif until
enddef
0 0 locate
0 cursor
2560 dup asciichart
begin
wait dup 14 2 locate "Keycode = " print$
row column 3 - locate print
dup case 328 of drop 10 - dup asciichart endof
336 of drop 10 + dup asciichart endof
27 of drop drop 1 cursor 0 bye endof
default swap drop 2560 + dup asciichart
endcase
0
until