þþB X;X; *******************X; ** MOVE ROUTINES **(X; *******************2X;<!X; These routines are all usedFX; in the making of moves byP#X; both human and 'puter playersZX;d X; CHECK PLACE VALID/DO PLACEnX; position index in YxX; player number in X‚X;Œ‡CHKPLACQ>;;Init flag to–P‡VALFLAG;; invalid QƒMAP8;;If alreadyªF‡DCKPLAC;; something´:;; there, exit¾X;È#‡DCKPLAC'‡MAPPOSN;;Save positionÒQ†TEAMNO9;;Set color toÜP…COLOR;; team numberæA;;Save playerð 5;; numberú$>;;Check for move†VDIRLPQ>;; ok - each dirP…COUNT;;Init dist backQ‡MAPPOSN;;Get next pos",;; in given,O†DIROFS9;; direction6?;;First disk must@QƒMAP8;; be opponent'sJN>;; color. If itTR…COLOR;; isn't, try^H‡VNXTDIR;; next dirhX;r†VVDRLP#…COUNT;;Update dist|C;;Get next pos†,;; in currentO†DIROFS9;; directionš?¤ QƒMAP8®F‡VNXTDIR;;If empty or¸G‡VNXTDIR;; border, doÂR…COLOR;; next - ifÌH†VVDRLP;; not us go onÖX;àQ>;;Move is validê P‡VALFLAGôQ†CMPCHK;;If we wereþF†VQVDRL;; just checking7;; then exit>:&X;0†VQVDRLC;;Go back to:;;; previousDS†DIROFS9;; opponent'sNP…HOLDY;; disk - saveX&…HOLDX;; pos & dirb ‡CSMPPOS;;CalculatelQ…COLOR;; screen posvV?;; of this€>;; disk & queueŠQ>€;; it up for”P…NMIEN;; flippingžQ‡CLR2IMG9;; Use dist from¨$…COUNT;; start as² ‡ENQUEUE;; time delay¼Q>ÀÆ P…NMIENÐ$…HOLDX;;Restore posÚ%…HOLDY;; & directionä"…COUNT;;Update distîH†VQVDRL;;& Q next diskøX;‡VNXTDIR0;;Try next dir I†VDIRLP;; if any leftQ†CMPCHK;;If we were F‡CHKGMOV;; just checking*7;; then return4>>:HX;R!‡CHKGMOVQ‡VALFLAG;;If the move\H‡GOODMOV;; wasn't anyf7;; good (and itp>;; was for real)z%ƒBOX9;; zap the„Q„PENX8;; player backŽP…PLYRX9;; to the˜Q„PENY8;; starting box¢ P…PLYRY9¬:¶X;À ‡GOODMOVQ…COLOR;;Set positionÊ%‡MAPPOSN;; moved toÔPƒMAP8;; to the colorÞC;; of the moverè ‡CSMPPOS;;Get scrn posòQ…COLOR;;Update theüV?;; score of the>;; mover (+1) #†SCRPND9Q‡COLRIMG9;;Set disk at$ ‡STSCIMG;; move pos.Q>;;Init sound8 P…SSTATBQ>;;Reset gameLP‡GOVRNDX;; over indexVX;`!X; REMOVE POS FROM MOVE MATRIXjX;t$>;;Find the~Q‡MAPPOSN;; corres-ˆ‡FNDMENTR†MOVMAT9;; ponding’F‡ENTRFND;; entry inœ2;; the move¦H‡FNDMENT;; matrix°X;º‡ENTRFND&…HOLDX;;Save itÄ%‡LASTSPC;;Move lastÎQ†MOVMAT8;; move entryØP†MOVMAT9;; over oursâX;ì$†ACTIVE;;Check if anyö ‡CHKLKLPQ†PORTNO9;; 'puter isI‡CHKLKNX;; targeted on Q†TARGNO9;; our move R…HOLDX H‡CHKLKMV(Q†STATUS9;;If yes, unlock2M>ÿ†LOCKED;; it and set<P†STATUS9;; it on a newF ‡STARGXY;; targetP !‡CHKLKNXZ!‡CHKLKMVR‡LASTSPC;;Else, if ondH‡CHKLKNX;; last move,nQ…HOLDX;; reset to itsxP†TARGNO9;; new index‚ ‡STARGXYŒ ‡CHKLKNX0– I‡CHKLKLP "‡LASTSPC;;Update #movesª7;; left and´ >;; exit¾:ÈX;ÒX; MOVE SUBROUTINESÜX; ----------------æX;ðX; ENQUEUE FLIP ROUTINEúX; Image number in AX; Delay to start in XX; Disk address in POINTERX;"‡ENQUEUEP†HOLDIT;;Save image,Q‡POINTER;;Check to6%‡LASTDSK;; see if image@G†NOTINQ;; already in QJ!‡SRCDSLPR„LOCL8;;If address isTH‡ECKNDSK;; the same,^Q‡POINTER;; then it ISh R„LOCH8rF‡INQUEUE;;So go modify| Q‡POINTER†‡ECKNDSK1;;(Check allI‡SRCDSLP;; entries)šX;¤"†NOTINQ#‡LASTDSK;;Update #disks®%‡LASTDSK;;Set disk¸P„LOCL8;; addressÂQ‡POINTERÌ P„LOCH8ÖQ†HOLDIT;;Set imageàP†IMGNUM8;; numberêV?;;Dir = numôV?;; (9 or 0)þ#X; CLC ; /4 -1S>;;(subs 1)P…DIREC8;;Set dir‡STDELAYA;;Set delay&T?;; until start0‡CLRDLAYP…DELAY8::DX;N‡INQUEUEQ†HOLDIT;;Figure dirXV?;; that we wantbV?;; it to fliplS>;;If "same",vR…DIREC8;; (reverses)€F‡STDELAY;; set delayŠQ>;;Else, clear”F‡CLRDLAY;; it (it's ours)žX;¨X;²X; CALCULATE SCREEN OFFSET¼X; Map index in AÆX;Ð!‡CSMPPOS ‡SPLXYFI;;Get X/Y posÚQ‡POINTER;;Multiplyä%>;; Y pos byî'‡POINTER;; 80 (twoøT‡POINTER;; lines per%‡POINTER;; disk) T?;; and X byT?;; 2 (two T?;; chars per* T?;; disk)4 P‡POINTER>T?HT?RU‡POINTER\,f O‡POINTERp P‡POINTERz D†ADINCL„#‡POINTERŽ†ADINCLC;;Then, add˜,;; the results¢O‡POINTER;; together¬D‡ADINSCR;; and you¶#‡POINTER;; have yourÀQ‡POINTER;; offsetʇADINSCRP‡POINTERÔ:ÞX;èX;òX; SET SCREEN IMAGEüX; Image number in A X; Screen offset in POINTER X; ‡STSCIMG5;;Save imgnum$ Q‡POINTER;;Add screen. ,;; base addx8 O>4‡FRSTDSK;; to offsetB P‡POINTERL Q‡POINTERV O>5‡FRSTDSK` P‡POINTERj 7;;Calc 1stt T?;; char of~ T?;; imageˆ X; CLC’ O>‡FRSTIMGœ %>;;And save¦ P@‡POINTER7;; it° 3;;Calc andº O>;; save 2ndÄ P@‡POINTER7;; charÎ 5Ø C;;Point toâ O>';; 2nd lineì ?ö 7;;Calc and O>;; save 3rd P@‡POINTER7;; char 3;;Calc and O>;; save 4th( P@‡POINTER7;; char2 :;;All done!