1000 REM ----------------------------›1010 REM This is a demonstration›1020 REM program for the ChalkBoard›1030 REM PowerPad. It will scan the›1040 REM pad, and report the contact›1050 REM area to the screen.›1060 REM ----------------------------›1070 REM Entered and modified by:›1080 REM Chuck Steinman›1090 REM DataQue Software›1100 REM ----------------------------›1110 REM Some information has been›1120 REM provided by ChalkBoard, Inc.›1130 REM›1140 REM ----------------------------›1150 REM SAVE "D:CBPPPRG1.LST"›1160 REM ----------------------------›1170 PRINT CHR$(125) : REM clear screen›1180 PRINT:PRINT "Power Pad Test Program"›1190 GOSUB 1290 : REM init vars›1200 GOSUB 1370 : REM init pad›1210 GOSUB 1570 : REM check it›1220 GOSUB 1700 : REM get & display›1230 IF X = 0 AND Y = 0 THEN 1210›1240 PRINT"X = ";X;" Y =";Y›1250 GOTO 1210›1260 REM ----------------------------›1270 REM initialize variables›1280 REM ----------------------------›1290 PORTB = 54016 : REM stick(0)›1300 DDRA = PORTA : REM direction›1310 PACTL = 54018 : REM control›1320 SCAN = 0 : REM scan counter›1330 RETURN›1340 REM ----------------------------›1350 REM initialize pad›1360 REM ----------------------------›1370 SCAN = SCAN + 1 : IF SCAN = 5 THEN 1370›1380 POKE PACTL,56 : REM direction mode›1390 POKE DDRA,6 : REM set direction›1400 POKE PACTL,60 : REM normal mode›1410 POKE PORTA,0 : REM default i/o›1420 POKE PORTA,2 : REM clear line›1430 POKE PORTA,0 : REM start scan›1440 RETURN›1450 REM ----------------------------›1460 REM error status›1470 REM ----------------------------›1480 PRINT:PRINT "Communications with the Power Pad"›1490 PRINT "was unsuccessful. Check that the"›1500 PRINT "pad is plugged into the first"›1510 PRINT "joystick location!"›1520 PRINT:PRINT›1530 END›1540 REM ----------------------------›1550 REM check if a point is pressed›1560 REM ----------------------------›1570 COUNT = 0 : REM counter›1580 SENSE = PEEL(PORTA) : REM check line›1590 K = (INT(SENSE/16))*16›1600 SENSE = SENSE - K›1610 SENSE = INT(SENSE/8) : REM get bit-3›1620 IF SENSE = 1 THEN 1640›1630 SCAN = 0: RETURN›1640 COUNT = COUNT + 1 : IF COUNT < 50 THEN 1580›1650 GOSUB 1370›1660 GOTO 1570›1670 REM ----------------------------›1680 REM get x and y values›1690 REM ----------------------------›1700 POKE PORTA,4 : REM clock line›1710 POKE PORTA,0 : REM shift bit›1720 GOSUB 1800 : Y = BYTE›1730 GOSUB 1800 : X = BYTE›1740 POKE PORTA,2 : REM clear›1750 POKE PORTA,0 : REM normal›1760 RETURN›1770 REM ----------------------------›1780 REM load byte›1790 REM ----------------------------›1800 BYTE = 0›1810 FOR L = 1 TO 7 : REM get 7-bits›1820 POKE PORTA,4 : REM clock high›1830 POKE PORTA,0 : REM clock data›1840 DTA = PEEK(PORTA) : GET PORT›1850 K = (INT(DTA / 2)) * 2›1860 DTA = DTA - K›1870 IF DTA = 0 THEN BYTE = BYTE + 128›1880 BYTE = BYTE / 2›1890 NEXT L›1900 RETURN›1910 REM ----------------------------›