home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
baslib1.zip
/
CONVERT.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-03-27
|
2KB
|
57 lines
'DEC,HEX,BIN,ASCII Number conversions
'By Jeff Bretz, John Craig
'Additional rwts & conversion to Quickbasic 2.01 By Dennis Dreyer
'CONVERT.BAS
cls
locate 9,30:Print " "
locate 10,30,0:Print " Conversion Demo "
locate 11,30:Print " In Quickbasic 2.01 "
locate 12,30:Print " "
color 4,4,1:locate 13,30:Print " "
locate 8,30:Print " "
locate 19,25:color 4,0:Print " Be SURE your printer is on!"
locate 21,22:color 5,0:print "Enter `Q' to quit - if printer not ready."
locate 22,24:print "Otherwise enter `S' to start printing."
locate 24,24:INPUT A$
IF A$ = "S" or A$ ="s" then goto start else end
START:
lprint "Decimal, Hexadecimal, Binary, and ASCII Number Conversions"
lprint string$(79,61)
lprint "Decimal Hexadecimal ";
lprint "Binary ASCII"
lprint string$(34,32);" 7 6 5 4 - 3 2 1 0"
lprint string$(79,61)
for y=0 to 255
lprint using "#######";Y;
lprint " ";
if len(hex$(y))<2 then lprint "0";
lprint hex$(y);
lprint " ";
X=Y
lprint abs(X>127);:X=X MOD 128
lprint abs(X>63);:X=X MOD 64
lprint abs(X>31);:X=X MOD 32
lprint abs(X>15);:X=X MOD 16
lprint "-";
lprint abs(X>7);:X=X MOD 8
lprint abs(X>3);:X=X MOD 4
lprint abs(X>1);:X=X MOD 2
lprint abs(X>0);
lprint " ";
if (y>32) and (Y<128) then lprint chr$(Y);
lprint " "
z=y+1:If z mod 10=0 then lprint " "
next
lprint chr$(12)
end