home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 53 / 053.d81 / bytes (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  2KB  |  68 lines

  1. 4 dim n(3),nd(3)
  2. 5 qq%=0:aa=0:ae$="number of decimal places (0-7):":gosub 1600::at=int(at)
  3. 6 nd(1)=at:nd(2)=at:nd(3)=at
  4. 7 ifat<0orat>7thenprint"value too large":ford=1to2000:next:goto5
  5. 9 gosub5000:goto5
  6. 10 a1$="":print"[158]";
  7. 20 get a$:if a$="" then 20
  8. 30 a=asc(a$):if a=20 thengosub200:goto20
  9. 40 if a=13then 100
  10. 50 if a$="."ora$="," then80
  11. 60 if a$ = "-" and len(a1$) = 0 then 80
  12. 65 iflen(a1$)>6 then 20
  13. 70 if a < 48 or a > 60 then20
  14. 80 a1$=a1$+a$
  15. 90 print a$;:goto 20
  16. 100 print"":dv=0:l =len(a1$):a = 0:at = 0:p = 0:an = 1
  17. 110 for i=1 to l:a$ = mid$(a1$,i,1)
  18. 115 if a$="-" then an=-1:goto160
  19. 120 ifa$=","then160
  20. 130 if a$="."thendv=1:goto160
  21. 140 if dv=0 then a=val(a$):at = at*10 + a
  22. 150 if dv=1 then p=p+1:a=val(a$):at = at + a/(10^p)
  23. 160 next:at=at*an:return
  24. 200 l=len(a1$):ifl=0then return
  25. 210 printa$;:a1$=left$(a1$,l-1):return
  26. 1600 poke 53280,6:poke53281,6:if aa<>0then1615
  27. 1605 print "[147]             bytes run it"
  28. 1610 print "           display formatting"
  29. 1611 if qq%=1thenprint:print" enter three numbers to be formatted"
  30. 1615 print ae$;:gosub 10
  31. 1620 print "":return
  32. 1640 print "             again (y/n)? ";
  33. 1650 geta$:if a$=""then1650
  34. 1660 if a$="y"then 1680
  35. 1670 if a$<>"n"then1650
  36. 1675 goto2000
  37. 1680 return
  38. 2000 :
  39. 2560 open15,8,15,"r0:hello connect=hello connect":input#15,er,er$:close15
  40. 2562 ifer<>63 then print"[147]":end
  41. 2570 load"hello connect",8,1
  42. 3990 ; *********************************
  43. 3991 ; routine as it appears in loadstar
  44. 3992 ; *********************************
  45. 4000 n=.5*(1/10^nd)+n:e=int(n*10^nd):e1$=str$(e):em$=" "
  46. 4010 if len(e1$)>3 then if mid$(e1$,len(e1$)-3,1)="e"then 4110
  47. 4020 if left$(e1$,1)="-"then em$="-":e1$=" "+right$(e1$,len(e1$)-1)
  48. 4030 l=len(e1$)-1:if l<ndthen e1$=right$("00000000"+right$(e1$,l),nd)
  49. 4040 e1$="               "+e1$:e$="."+right$(e1$,nd)+em$
  50. 4050 l=len(e1$):for i=1 to 3
  51. 4060 e$=mid$(e1$,(l-3*i-nd+1),3)+e$
  52. 4070 if mid$(e1$,(l-3*i-nd),1)=" "then 4090
  53. 4080 e$=","+e$
  54. 4090 next:e$="      "+e$
  55. 4100 e$=right$(e$,16):return
  56. 4110 e$ = "              "+e1$+" ":goto4100
  57. 4120 ; ********************************
  58. 4121 ;         end of routine
  59. 4122 ; ********************************
  60. 4123 ;
  61. 5000 forj=1to3:qq%=1:aa=0:ae$="enter entry #"+str$(j)+": ":gosub1600:n(j)=at
  62. 5015 next
  63. 5020 for j=1to3:n=n(j):nd=nd(j):gosub4000
  64. 5030 print "item #"j" "n(j),e$:next:gosub1640
  65. 5040 return
  66. 5100 print "number of decimals in conflict[145][145][145][145][145]"
  67. 5110 print "                      [145]":goto5010
  68.