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 >
Wrap
Commodore BASIC
|
2022-10-26
|
3KB
|
139 lines
998 poke53280,14:poke646,14:poke53281,6
999 a=a+1:ifa=1thenload"xinout.code",8,1
1000 rem **************
1010 rem * xinoutdemo *
1020 rem **************
1030 :
1040 rem * illustrates the enhancements
1050 rem * and modifications to the basic
1060 rem * input routines
1070 :
1080 rem * declare variables
1090 i=0 : rem counter for input
1100 id=0: rem counter for display
1110 nu=12 : rem no. of 'using' inputs
1115 pu=4 : rem no. of 'using' pages
1120 ip=0 : rem counter for print using
1130 np=10 : rem no. of print using inputs
1140 cst=0 : rem cost of item
1150 ttl=0 : rem total cost
1170 max=0 : rem max input counter
1180 msg$="? for help"
1200 dim x(nu),y(nu) : rem input coordinates
1210 dim px(nu),py(nu) : rem prompt coordinates
1220 dim pu$(nu) : rem 'using' prompts
1230 dim u$(nu) : rem 'using' masks
1240 dim iu$(pu,nu) : rem 'using' variables
1250 dim in$(nu) : rem 'using' in-strings
1260 dim qty(np),price(np),cst$(np)
1270 :
1280 rem * main program
1290 sys 49152 : rem initialise enhancement
1300 &end "?[133][134][135][136][137][138][139][140]"
1350 print chr$(14);chr$(8) : rem set cbm mode
1360 gosub 1410
1370 gosub 1710
1380 :
1390 end
1400 :
1410 rem * 'using' demo
1430 restore 2460
1440 &for x=1 to nu
1450 read px(&x),py(&x),pu$(&x)
1460 read x(&x),y(&x),u$(&x),in$(&x)
1465 &for y=1 to pu
1470 iu$(&y,&x)=&spc(len(u$(&x)))
1490 u$(nu)=&str$(78,"#")
1500 iu$(&y,nu)=&spc(78)
1501 &next y
1502 &next x
1505 &for p=1 to pu
1510 gosub 1610:rem display input page
1520 &for i=1 to nu
1530 @ x(&i),y(&i) : rem position cursor
1540 &int(in$(&i))
1550 input usr(u$(&i)),iu$(&p,&i)
1560 &next i : rem update field
1570 &next p : rem update page
1580 return
1590 :
1600 rem * display input page
1610 print chr$(147)
1612 msg$="? for help:[195][212][210][204] [206](ext):[195][212][210][204] [208](revious)"
1614 @ 0,24 msg$;
1616 @ 30,0 "[208]age[146] ";&p
1620 &for x=1 to nu
1630 @ px(&x),py(&x) print pu$(&x)
1640 @ x(&x)-1,y(&x) print ":";
1650 print iu$(&p,&x);
1660 print ":"
1670 &next x
1680 return
1690 :
1700 rem * print using demo
1710 def " ,.\"
1740 for i=0 to np
1750 read price(i)
1760 cst$(i)=" 0.00"
1762 qty(i)=0
1770 next
1790 gosub 1940 : rem display screen
1800 &len(3) val"9".0
1810 &for i=1 to np
1820 @ 10,2*&i input ,qty(&i)
1830 @ 10,2*&i : usr"###";qty(&i)
1840 cst=qty(&i)*price(&i)
1850 cst$(&i)=&usr$("#####.##",cst)
1860 @ 20,2*&i print cst$(&i)
1870 gosub 2030 : rem adjust total
1880 @ 18,2*np+3 print cst$(0)
1890 &next i
1910 return
1920 :
1930 rem * display print using data
1940 print chr$(147)
1941 @ 8,1 "[209]uant.[160] [195]ost"
1942 for id=1 to np
1950 @ 1,id*2 : usr"##.##";price(id)
1960 @ 9,id*2 ":";&usr$("###",qty(id));":"
1970 print @ 20,id*2 cst$(id)
1980 next
1990 print @ 18,2*np+3 cst$(0)
2000 return
2010 :
2020 rem * adjust print using totals
2030 ttl=0
2040 &for y=1 to np
2050 ttl=ttl+val(cst$(&y))
2060 &next y
2070 cst$(0)=&usr$("#######.##",ttl)
2080 return
2090 :
2350 rem * print message
2360 @ 0,24 ""+msg$+"[146]";
2370 @ 0,0 input,
2380 @ 0,24 &spc(len(msg$));
2390 return
2400 :
2410 rem * press return
2420 @ 0,0 input "[208]ress return ",
2430 return
2440 :
2450 rem * data for 'using' demo
2460 data 1, 1,"[198]orename" ,11, 1,"[193]aaaaaaaaa",""
2470 data 1, 2,"[211]urname" ,11, 2,"[193]aaaaaaaaaaaaaaa",""
2480 data 30, 2,"[211]ex" ,36, 2,"l","01"
2490 data 1, 4,"[211]treet" ,11, 4,"xxxxxaaaaaaaaaaaaaaaa",""
2500 data 1, 5,"[212]own" ,11, 5,"[193]aaaaaaaaaaaaaaa",""
2510 data 1, 6,"[208]ostcode" ,11, 6,"[193]xx x[193][193]",""
2520 data 1, 8,"[196].[207].[194]" ,11, 8,"99/99/99",""
2530 data 1,10,"[200]eight" ,11,10,"9.99",""
2540 data 24,10,"[215]eight" ,33,10,"99.99",""
2550 data 1,12,"[211]alary" ,11,12,"99999",""
2560 data 1,14,"[206][201] number",11,14,"[193][193] 99 99 99 [193]",""
2570 data 1,16,"[206]otes-" , 1,17," ",""
2580 :
2590 rem * price data for print using demo
2600 data 0,1.99,3.99,5.99,7.99,9.99
2610 data 11.99,14.99,19.99,21,29