home *** CD-ROM | disk | FTP | other *** search
-
- 'DSMHEX.BAS is copyright 1995 Dwight Scott Miller
- 'All Rights Reserved
-
- 'Dwight doodled this up
-
- nomainwin
-
- WindowWidth = 400
- WindowHeight = 440
-
- button #main, "1", [button2Click], UL, 14, 22
- button #main, "2", [button3Click], UL, 14, 62
- button #main, "3", [button4Click], UL, 14, 102
- button #main, "4", [button5Click], UL, 14, 142
- button #main, "5", [button6Click], UL, 14, 182
- button #main, "6", [button7Click], UL, 14, 222
- button #main, "7", [button8Click], UL, 14, 262
- button #main, "8", [button9Click], UL, 14, 302
- button #main, "9", [button10Click], UL, 62, 22
- button #main, "A", [button11Click], UL, 62, 62
- button #main, "B", [button12Click], UL, 62, 102
- button #main, "C", [button13Click], UL, 62, 142
- button #main, "D", [button14Click], UL, 62, 182
- button #main, "E", [button15Click], UL, 62, 222
- button #main, "F", [button17Click], UL, 62, 262
- button #main, "0", [button18Click], UL, 62, 302
- textbox #main.total, 190, 1, 100, 25
- textbox #main.memory, 190,49, 100, 25
- textbox #main.entryb, 190, 97, 100, 25
- statictext #main.statictext21, "Total", 302, 1, 45, 20
- statictext #main.statictext22, "Memory", 302, 49, 65, 20
- statictext #main.statictext23, "Entry", 302, 97, 45, 20
- button #main, "+(Ent)", [addit], UL, 117, 102
- button #main, "-", [subbit], UL, 126, 150
- button #main, "*", [multit], UL, 126, 198
- button #main, "/", [divit], UL, 126, 254
- button #main, "M+", [madd], UL, 182, 166
- button #main, "M-", [msub], UL, 182, 222
- button #main, "MR", [mrcl], UL, 182, 280
- button #main, "CE", [clrent], UL, 240, 166
- button #main, "CM", [clrmem], UL, 270,166
- button #main, "CT", [clrtot], UL, 302, 166
- button #main, "CLR", [clrall], UL, 262, 270
- button #main, "Exit", [goobye], UL, 290, 310
- dig$ = "0123456789ABCDEF"
- UpperLeftX = 150
- UpperLeftY = 50
- open "A Hex on You!" for dialog as #main
- print #main,"trapclose [goobye]"
-
- [getapush]
- input thing$
- goto [getapush]
-
- [button2Click] 'Perform action for the button named 'button2'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ =entry$ + "1"
- print #main.entryb,entry$
- goto [getapush]
-
- [button3Click] 'Perform action for the button named 'button3'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "2"
- print #main.entryb,entry$
- goto [getapush]
-
- [button4Click] 'Perform action for the button named 'button4'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "3"
- print #main.entryb,entry$
- goto [getapush]
-
- [button5Click] 'Perform action for the button named 'button5'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "4"
- print #main.entryb,entry$
- goto [getapush]
-
- [button6Click] 'Perform action for the button named 'button6'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "5"
- print #main.entryb,entry$
- goto [getapush]
-
- [button7Click] 'Perform action for the button named 'button7'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "6"
- print #main.entryb,entry$
- goto [getapush]
-
- [button8Click] 'Perform action for the button named 'button8'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "7"
- print #main.entryb,entry$
- goto [getapush]
-
- [button9Click] 'Perform action for the button named 'button9'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "8"
- print #main.entryb,entry$
- goto [getapush]
-
- [button10Click] 'Perform action for the button named 'button10'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "9"
- print #main.entryb,entry$
- goto [getapush]
-
- [button11Click] 'Perform action for the button named 'button11'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "A"
- print #main.entryb,entry$
- goto [getapush]
-
- [button12Click] 'Perform action for the button named 'button12'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "B"
- print #main.entryb,entry$
- goto [getapush]
-
- [button13Click] 'Perform action for the button named 'button13'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "C"
- print #main.entryb,entry$
- goto [getapush]
-
- [button14Click] 'Perform action for the button named 'button14'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "D"
- print #main.entryb,entry$
- goto [getapush]
-
- [button15Click] 'Perform action for the button named 'button15'
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "E"
- print #main.entryb,entry$
- goto [getapush]
-
- [button17Click]
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "F"
- print #main.entryb,entry$
- goto [getapush]
-
- [button18Click]
- if len(entry$) > 7 then print #main.entryb,"Overflow" : for n = 1 to 1000:next n:goto [clrent]
- entry$ = entry$ + "0"
- print #main.entryb,entry$
- goto [getapush]
-
- [addit] 'Perform action for the button named '+'
- if entry$ = "" then goto [getapush]
- gosub [hex2dec]
- itotl = itotl + jtotl
- goto [clrent]
-
- [subbit] 'Perform action for the button named '-'
- if entry$ = "" then goto [getapush]
- gosub [hex2dec]
- itotl = itotl - jtotl
- goto [clrent]
-
- [multit] 'Perform action for the button named '*'
- if entry$ = "" then goto [getapush]
- gosub [hex2dec]
- itotl = itotl * jtotl
- goto [clrent]
-
- [divit] 'Perform action for the button named '/'
- if entry$ = "" then goto [getapush]
- gosub [hex2dec]
- itotl = int(itotl / jtotl)
- if itotl <> itotl/jtotl then print #main.entryb,"Truncate":for n = 1 to 1000:next n
- goto [clrent]
-
- [madd] 'Perform action for the button named 'M+'
- imem = imem + itotl
- goto [showit]
-
- [msub] 'Perform action for the button named 'M-'
- imem = imem - itotl
- goto [showit]
-
- [clrent] 'Perform action for the button named 'CE'
- entry$ = ""
- goto [showit]
-
- [clrmem] 'Perform action for the button named 'CM'
- imem = 0
- goto [showit]
-
- [mrcl] 'Perform action for the button named 'MR'
- entry$ = mem$
- goto [showit]
-
- [clrtot] 'Perform action for the button named 'CT'
- itotl = 0
- goto [showit]
-
- [clrall] 'Perform action for the button named 'CLR'
- imem = 0
- itotl = 0
- entry$ = ""
-
- [showit]
- print #main.entryb,entry$
- funcin = abs(itotl)
- gosub [dec2hex]
- if itotl < 0 then funcout$ = "-" + funcout$
- print #main.total,funcout$
- funcin = abs(imem)
- gosub [dec2hex]
- if imem < 0 then funcout$ = "-" + funcout$
- print #main.memory,funcout$
- mem$ = funcout$
- goto [getapush]
-
- [goobye]
- close #main
- stop
- end
-
- [hex2dec]
- jtotl = 0
- p = len(entry$)
- if p = 0 then return
- for n = 1 to p
- jval = instr(dig$,mid$(entry$,n,1)) -1
- kval = 1
- if n = p then goto [nomul]
- for m = 1 to p - n
- kval =kval*16
- next m
- [nomul]
- jtotl = jtotl + jval* kval
- next n
- return
-
- [dec2hex]
- funcout$ = ""
- n = 0
- funt = funcin
- [fundiv]
- funcin = int(funcin/16)
- n = n + 1
- if funcin > 15 then goto [fundiv]
- [fundiv2]
- funcin = funt
- fund = 1
- for m = 1 to n
- fund = int(fund * 16)
- next m
- funcin = int(funcin / fund)
- funi = funcin +1
- fun$ = mid$(dig$,funi,1)
- funcout$ = funcout$ + fun$
- funt = funt - int(funcin * fund)
- n = n - 1
- funrem = funt + 1
- if n > 0 then goto [fundiv2]
- fun$ = mid$(dig$,funrem,1)
- funcout$ = funcout$ + fun$
- return
-
-