home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
64'er 1991 June
/
64er_Magazin_91-06_1991_Markt__Technik_de.d64
/
dualhexe
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
948b
|
42 lines
10 print"[147]":rem umrechnung hexzahl in dualzahl
20 print" umrechnung hexzahl in dualzahl"
30 print" ******************************"
40 print:print:input" hexzahl:";h$
50 l=len(h$)
60 fori=lto1step-1
70 s$=mid$(h$,i,1)
75 ifasc(s$)>70thenprint" keine hexzahl!":goto40
80 ifasc(s$)<58thende=asc(s$)-48
85 ifasc(s$)>64thende=asc(s$)-55
90 ifde/2<>int(de/2)thendu$="1"+du$
100 ifde/2=int(de/2)thendu$="0"+du$
105 de=int(de/2)
110 ifde>=1then90
115 ifi=1then125
120 iflen(du$)<4thendu$="0"+du$:goto120
125 e$=du$+e$
130 de=0:du$=""
135 nexti
140 print:print" dualzahl="e$
150 du$="":e$="":goto40
200 print"[147]":rem umrechnung dualzahl in hexzahl
210 print" umrechnung dualzahl in hexzahl"
220 print" ******************************"
230 print:print:input" dualzahl:";du$
235 l=len(du$)
240 ifl/4=int(l/4)then270
250 f=4-(l/4-int(l/4))*4
260 fort=1tof:du$="0"+du$:nextt
270 fori=1tolstep4
280 t$=mid$(du$,i,4)
285 rem bis zeile 320 horner-schema
290 de=val(mid$(t$,1,1))
300 fork=1to3
310 de=de*2+val(mid$(t$,k+1,1))
320 nextk
330 ifde<=9thenh$=h$+str$(de)
340 ifde>9thenh$=h$+chr$(de+55)
350 de=0:nexti
360 print:print" hexzahl="h$
370 h$="":goto230