JOYSTICKINCMDRAW COMPtMDRAW DOCJMDRAW PAS^$,MOUSE INCMOUSECURINCR@ { SG Tools Pro (C) 1992 Steve Goldsmith The Joystick module allows you to read joystick 2 } const cia1DataPortRegA = $dc00; cia1DataDirRegA = $dc02; {joystick direction masks} joyNone = $1f; joyFire = $10; joyUp = $01; joyDown = $02; joyLeft = $04; joyRight = $08; joyUpLeft = $05; joyUpRight = $09; joyDownLeft = $06; joyDownRight = $0a; function ReadJoy2 : byte; var RegSave : byte; begin RegSave := PortIn (cia1DataDirRegA); {save ddr} PortOut (cia1DataDirRegA,$0); {set ddr to all inputs} ReadJoy2 := PortIn (cia1DataPortRegA) and $1f; {read joystick 2} PortOut (cia1DataDirRegA,RegSave) {restore ddr} end; { SG Tools Pro (C) 1992 Steve Goldsmith The Mouse module allows you to read the 1351 and compatible mouses in port 2 } {sid pot addrs} const sidPotX = $d419; sidPotY = $d41a; {global mouse vars} var mseX, mseY : byte; {read 1351 mouse, port 2, proportional mode and return x, y value >= 0 and <= 63 } procedure ReadMouse2; var NewX, NewY : byte; begin NewX := PortIn (sidPotX) and $7f; {read new pos and} NewY := PortIn (sidPotY) and $7f; {mask out high bit} if NewX < $7f then {if new pos <> $7f then} mseX := NewX shr 1; {cur pos = new pos div 2} if NewY < $7f then mseY := NewY shr 1 end;  ͫCopyright (C) 1985 BORLAND IncBLear-Siegler ADM-31dP= *EE RT)1(1~7#~=  oͦlԅ!!"~#(}:$= +*!6!*!!:(2!6:(>2!!!:O::O:!*! !45(! +/ 0y0( d!k6!{6``o&  :(͠|(  *"x2y( >28!"9!! og2"">~22!:05+:!Co&ͦͣ} [ (!e|ͧA8Q0G: x@!\w# (̓ ?(*( .( x_. _!h6# (?( *( ̓( w#>?> w#ͧ 8 !ɿ .,;:=?*[]<>{}a{ |͵};Ɛ'@'7||}>2Ͱ*Bک  "og"2>2! ""*B"[Rv*"^#V#^#V#N#FO/o&9O/o&9!9(> (G!9 w#Eͻw}8( RB0 >( RrRR!+ ͱ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DMx(R0 U(͞O/o&9q# (!>F0#( ~ ( #]( ~ ( (#}(  i&T-a%ã}ͧo*!~6o&|:2!2}:__{ѯ2*|KB " z ^C User break+=  I/O Run-time error {͵, PC=*ͰNot enough memory Program aborted :m'1!?e!(<?>æ("s?*s?"i?Ki?x2h?*h?&"u?*u?}2e?"f?*f?"Z?*e?&}2\?KZ?:\?y!!}2P?!!#!!!!|g}o}2Y?!*P?&#!*Y?&!!!|g}o}2E?!!!|g}o}2D?*E?&!E!*E?&!W}2O?*D?&!E!*D?&!W}2N?}2"?}2#?}2$?}2%?"&?"(?"*?",?".?"0?*0?"?!}2O?!}2N?!}2C?!}2@?*C?&*O?&Ŕ}2?*?&*B?&ͦE>#*?&*A?&E5#*?&E#*:?*2?*N?&*@?&}oEʱ#*:?!":?#*:?*4?*N?&*@?&}oE#*:?!R":?*N?&}2@?}2?}2?͜N=*?&! e.>*?&! e.>!ͫ }2=!=!P!=;ͤR!*=&#!=;͜!ͫ !<}2=}2=*=&*=&#!<;͜!ͫ ͜ͻ: ͜N!NG4>!ͫ N2 Mouse Draw 1.0 11/25/92 (C) 1992 Steve Goldsmith !3$͜ͻG0 NKMouse Port 2, [LEFF] Draw, [RIGHT] Erase, [C] Color [S] Clr Scr, [ESC] exit!3$!!P!Rgz&}2<*<&!#͜NG4!*e.>NG0>!ͫ *<&!!R#͜NG4!*e.>NG0>!ͫ *<&#Ñ%!!!Rgzʱ&}2NG0>!ͫ !P!R*<&#͜NG4!*e.>NG0>!ͫ *<&#+&*!ͫ ͐"?#͈!*NG0>!ͫ o'*<&!|g}o!̀Eo'͜! # *?&!Eʔ'*?&!}2?Û'!}2?͜N! *?&e.>NG4>! e.>NG0>!ͫ *= mseXFeel then {see if diff > feel} begin if XDiff < mseXOverflow then {see if diff overflowed} begin if (mseXCur < mseXCurMax) and {which direction are we going?} (mseX > mseXOld) then mseXCur := mseXCur+1 else if (mseXCur > mseXCurMin) and (mseX < mseXOld) then mseXCur := mseXCur-1 end; mseXOld := mseX {old mouse pos = new pos} end end; procedure UpdateMouseCurY; var YDiff : byte; begin YDiff := abs (mseYOld-mseY); {calc abs diff between old and new pos} if YDiff >= mseYFeel then {see if diff > feel} begin if YDiff < mseYOverflow then {see if diff overflowed} begin if (mseYCur < mseYCurMax) and {which direction are we going?} (mseY < mseYOld) then mseYCur := mseYCur+1 else if (mseYCur > mseYCurMin) and (mseY > mseYOld) then mseYCur := mseYCur-1 end; mseYOld := mseY {old mouse pos = new pos} end end;  CP/M Mouse Draw 1.0 (C) 1992 Steve Goldsmith All Rights Reserved The C128 CP/M Mouse Draw may be copied and distributed freely providing that all files are kept intact, no fee is charged and it is not part of a package for which a charge is made. * OVERVIEW CP/M Mouse Draw show you how to read a 1351 mouse in port 2 and control a cursor for drawing. You may already have Mouse Demo 1.0, Joy Stick Demo 1.0 or 1.1. I include the JOYSTICK.INC and MOUSE.INC modules with mouse updates since all mouse routines rely on them. See the Turbo Pascal source files MDRAW.PAS, MOUSE.INC, MOUSECUR.INC and JOYSTICK.INC for more detailed information. You may want to check out the MOUSE.LBR or JOYSTICK.LBR demos if you already haven't. * REQUIREMENTS + A C128 or C128D + At least one 1541, 1541 compatible or better disk drive + 1351 Mouse + CP/M 3.0 + CP/M Turbo Pascal 2.0+ + SG Tools 1 of 3, TC128 #32 from Parsec, Inc. * SG TOOLS If you want to make programming on the C128 easy then check out SG Tools Programmer's tool box for Turbo Pascal 2.0+. SG Tools gives you the capability to develop truly great programs. Turbo Pascal offers better productivity, portability and maintainability than GEOS or C128 native mode languages. Take it from a Commodore programmer with 12 years experience, Turbo Pascal and SG Tools are an unbeatable combination. To get a copy of SG Tools contact: Parsec, Inc. PO Box 111 Salem, MA 01970-0111 (508) 745-9125 On-line on GEnie as C128.JBEE * PAYMENT Any contribution (even a buck is nice) towards the development of professional C128 CP/M products is greatly appreciated. * HOW TO CONTACT ME Please report any problems, suggestions, etc. to me via GEnie as S.GOLDSMITH2, voice phone (813) 925-1064 or mail to: Steve Goldsmith 2805 Jamaica Street Sarasota, FL 34231