home *** CD-ROM | disk | FTP | other *** search
/ Commodore Disk User Volume 4 #1 / Commodore_Disk_User_Vol.4_1_1990_-.d64 / xinout (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  3KB  |  139 lines

  1. 998 poke53280,14:poke646,14:poke53281,6
  2. 999 a=a+1:ifa=1thenload"xinout.code",8,1
  3. 1000 rem **************
  4. 1010 rem * xinoutdemo *
  5. 1020 rem **************
  6. 1030 :
  7. 1040 rem * illustrates the enhancements
  8. 1050 rem * and modifications to the basic
  9. 1060 rem * input routines
  10. 1070 :
  11. 1080 rem * declare variables
  12. 1090 i=0 : rem counter for input
  13. 1100 id=0: rem counter for display
  14. 1110 nu=12 : rem no. of 'using' inputs
  15. 1115 pu=4 : rem no. of 'using' pages
  16. 1120 ip=0 : rem counter for print using
  17. 1130 np=10 : rem no. of print using inputs
  18. 1140 cst=0 : rem cost of item
  19. 1150 ttl=0 : rem total cost
  20. 1170 max=0 : rem max input counter
  21. 1180 msg$="? for help"
  22. 1200 dim x(nu),y(nu) : rem input coordinates
  23. 1210 dim px(nu),py(nu) : rem prompt coordinates
  24. 1220 dim pu$(nu) : rem 'using' prompts
  25. 1230 dim u$(nu) : rem 'using' masks
  26. 1240 dim iu$(pu,nu) : rem 'using' variables
  27. 1250 dim in$(nu) : rem 'using' in-strings
  28. 1260 dim qty(np),price(np),cst$(np)
  29. 1270 :
  30. 1280 rem * main program
  31. 1290 sys 49152 : rem initialise enhancement
  32. 1300 &end "?[133][134][135][136][137][138][139][140]"
  33. 1350 print chr$(14);chr$(8) : rem set cbm mode
  34. 1360 gosub 1410
  35. 1370 gosub 1710
  36. 1380 :
  37. 1390 end
  38. 1400 :
  39. 1410 rem * 'using' demo
  40. 1430 restore 2460
  41. 1440 &for x=1 to nu
  42. 1450   read px(&x),py(&x),pu$(&x)
  43. 1460   read x(&x),y(&x),u$(&x),in$(&x)
  44. 1465   &for y=1 to pu
  45. 1470    iu$(&y,&x)=&spc(len(u$(&x)))
  46. 1490    u$(nu)=&str$(78,"#")
  47. 1500    iu$(&y,nu)=&spc(78)
  48. 1501   &next y
  49. 1502 &next x
  50. 1505 &for p=1 to pu
  51. 1510 gosub 1610:rem display input page
  52. 1520 &for i=1 to nu
  53. 1530 @ x(&i),y(&i) : rem position cursor
  54. 1540 &int(in$(&i))
  55. 1550 input usr(u$(&i)),iu$(&p,&i)
  56. 1560 &next i : rem update field
  57. 1570 &next p : rem update page
  58. 1580 return
  59. 1590 :
  60. 1600 rem * display input page
  61. 1610 print chr$(147)
  62. 1612 msg$="? for help:[195][212][210][204] [206](ext):[195][212][210][204] [208](revious)"
  63. 1614 @ 0,24 msg$;
  64. 1616 @ 30,0 "[208]age[146] ";&p
  65. 1620 &for x=1 to nu
  66. 1630   @ px(&x),py(&x) print pu$(&x)
  67. 1640   @ x(&x)-1,y(&x) print ":";
  68. 1650   print iu$(&p,&x);
  69. 1660   print ":"
  70. 1670 &next x
  71. 1680 return
  72. 1690 :
  73. 1700 rem * print using demo
  74. 1710 def " ,.\"
  75. 1740 for i=0 to np
  76. 1750 read price(i)
  77. 1760 cst$(i)="    0.00"
  78. 1762 qty(i)=0
  79. 1770 next
  80. 1790 gosub 1940  : rem display screen
  81. 1800 &len(3) val"9".0
  82. 1810 &for i=1 to np
  83. 1820 @ 10,2*&i input ,qty(&i)
  84. 1830 @ 10,2*&i : usr"###";qty(&i)
  85. 1840 cst=qty(&i)*price(&i)
  86. 1850 cst$(&i)=&usr$("#####.##",cst)
  87. 1860 @ 20,2*&i print cst$(&i)
  88. 1870 gosub 2030 : rem adjust total
  89. 1880 @ 18,2*np+3 print cst$(0)
  90. 1890 &next i
  91. 1910 return
  92. 1920 :
  93. 1930 rem * display print using data
  94. 1940 print chr$(147)
  95. 1941 @ 8,1 "[209]uant.[160]         [195]ost"
  96. 1942 for id=1 to np
  97. 1950 @ 1,id*2 : usr"##.##";price(id)
  98. 1960 @ 9,id*2 ":";&usr$("###",qty(id));":"
  99. 1970 print @ 20,id*2 cst$(id)
  100. 1980 next
  101. 1990 print @ 18,2*np+3 cst$(0)
  102. 2000 return
  103. 2010 :
  104. 2020 rem * adjust print using totals
  105. 2030 ttl=0
  106. 2040 &for y=1 to np
  107. 2050 ttl=ttl+val(cst$(&y))
  108. 2060 &next y
  109. 2070 cst$(0)=&usr$("#######.##",ttl)
  110. 2080 return
  111. 2090 :
  112. 2350 rem * print message
  113. 2360 @ 0,24 ""+msg$+"[146]";
  114. 2370 @ 0,0 input,
  115. 2380 @ 0,24 &spc(len(msg$));
  116. 2390 return
  117. 2400 :
  118. 2410 rem * press return
  119. 2420 @ 0,0 input "[208]ress return ",
  120. 2430 return
  121. 2440 :
  122. 2450 rem * data for 'using' demo
  123. 2460 data  1, 1,"[198]orename" ,11, 1,"[193]aaaaaaaaa",""
  124. 2470 data  1, 2,"[211]urname"  ,11, 2,"[193]aaaaaaaaaaaaaaa",""
  125. 2480 data 30, 2,"[211]ex"      ,36, 2,"l","01"
  126. 2490 data  1, 4,"[211]treet"   ,11, 4,"xxxxxaaaaaaaaaaaaaaaa",""
  127. 2500 data  1, 5,"[212]own"     ,11, 5,"[193]aaaaaaaaaaaaaaa",""
  128. 2510 data  1, 6,"[208]ostcode" ,11, 6,"[193]xx x[193][193]",""
  129. 2520 data  1, 8,"[196].[207].[194]"    ,11, 8,"99/99/99",""
  130. 2530 data  1,10,"[200]eight"   ,11,10,"9.99",""
  131. 2540 data 24,10,"[215]eight"   ,33,10,"99.99",""
  132. 2550 data  1,12,"[211]alary"   ,11,12,"99999",""
  133. 2560 data  1,14,"[206][201] number",11,14,"[193][193] 99 99 99 [193]",""
  134. 2570 data  1,16,"[206]otes-"   , 1,17," ",""
  135. 2580 :
  136. 2590 rem * price data for print using demo
  137. 2600 data 0,1.99,3.99,5.99,7.99,9.99
  138. 2610 data 11.99,14.99,19.99,21,29
  139.