home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tiger Disk 9
/
Tiger_Disk_009_19xx_Tiger-Crew-Disk_de_Side_B.d64
/
dez_hex-umrechng
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
2KB
|
59 lines
0 rem
1 rem *****************
2 rem * *
3 rem * dez-hex-bin *
4 rem * *
5 rem *****************
6 rem
7 rem dieter jansky
8 rem wuerzburg
9 rem
10 poke53280,0:poke53281,0:poke788,52
20 print"[147][142][158]";:b$=" "
30 printb$" umrechnung -- dez -- hex -- bin "b$"[155]"
40 print" input dezimal.................1"
42 print" input hexadezimal.............2"
44 print" input binaer..................3"
45 print" ende ........................4"
50 getq$:ifq$<"1"orq$>"4"then50
55 ifq$="4"thenprint"[147]":print"":end
60 onval(q$)goto70,80,90
70 print"[147]"b$" dezimal -- hexadezimal -- binaer "b$
72 clr:print:input" ";d1:ifd1>16^4-1then72
73 ifd1=<0thenrun
75 printspc(14)"[145]";:gosub400:printspc(11);:gosub300:
78 goto72
80 print"[147]"b$" hexadezimal -- dezimal -- binaer "b$
82 clr:print:input" ";h$:l=len(h$):ifl>4then82
83 ifh$<"0"thenrun
84 printspc(17)"[145]";:gosub100:gosub300
88 goto82
90 print"[147]"b$" binaer -- dezimal -- hexadezimal "b$
92 clr:print:input" ";b$:ifb$<"0"thenrun
93 iflen(b$)<>8then92
94 printspc(14)"[145]";:gosub200:printtab(26);:gosub400
98 goto92
100 rem * hex > dez *
120 d=0:forq=lto1step-1:c$=mid$(h$,q,1)
130 ifasc(c$)>47andasc(c$)<58thenr=asc(c$)-48:goto180
140 r=asc(c$)-55
180 d=d+r*16^(l-q):next:printd,:d1=d:return
200 rem * bin > dez *
220 d=0:forq=8to1step-1
230 d=d+val(mid$(b$,9-q,1))*2^(q-1)
260 next:printd;:d1=d:return
270 rem
300 rem * dez > bin *
310 d=d1:ifd>255thenreturn
320 b$="":forq=8to1step-1
330 ifd<2^(q-1)thenb$=b$+"0":goto350
340 d=d-2^(q-1):b$=b$+"1"
350 next:printb$;:return
360 rem
400 rem * dez > hex *
420 d=d1:h$="":forq=4to1step-1
430 e=int(d/16^(q-1))
440 ife>9thenh$=h$+chr$(e+55):goto470
450 h$=h$+chr$(e+48)
470 d=d-e*16^(q-1):next:printh$;:return