2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
21 int CoinMechPort[3] = { COINMECH1_PORT,
25 int CoinMechCtrl[3] = { COINMECH1_CTRLMASK,
29 unsigned int CoinMechLastCnt[3];
32 int coindev_init(CoinMechNumber)
36 int CoinMechAdj[3] = { COINMECH1_ADJMASK,
40 /* set up IO port for our special use */
41 outp(COINMECH_CMDPORT, CoinMechCtrl[CoinMechNumber]);
42 outp(CoinMechPort[CoinMechNumber], 0);
43 outp(CoinMechPort[CoinMechNumber], 0);
45 /* write to the IO board so that the counter eventually gets cleared */
46 for( x = 10; x > 0; x-- )
48 outp(COINMECH_ADJPORT, CoinMechAdj[CoinMechNumber]);
49 outp(COINMECH_ADJPORT, 0);
50 if( coindev_read(CoinMechNumber) == 0 )
56 CoinMechLastCnt[CoinMechNumber] = 0;
58 return(x); /* TRUE == CoinMech is cleared; FALSE == CoinMech error! */
62 /* Do a raw read of the specified CoinMech */
63 unsigned int coindev_read(CoinMechNumber)
67 /* read lower byte, then upper byte */
68 x = (inp(CoinMechPort[CoinMechNumber]));
69 x += (inp(CoinMechPort[CoinMechNumber]) * 256);
71 /* conver to usable number */
81 /* read the specified CoinMech and return the */
82 /* ...number of clicks since the last read */
83 unsigned int coindev_count(CoinMechNumber)
87 x = coindev_read(CoinMechNumber);
88 y = x - CoinMechLastCnt[CoinMechNumber];
90 CoinMechLastCnt[CoinMechNumber] = x;