›00010 ;******************************›00020 ;  VBI PLAYER MOVER 1.0›00030 ;     BY F.PINHO 7/83›00040 ;  ASSEMBLE WITH ASM/ED›00050 ;  HALF-SPEED ROUTINE›00060 ;  NOP'S IN CODE CHANGED BY›00070 ;  BASIC FOR NORMAL SPEED›00080 ;******************************›00090          *=  $600    ;RELOCATABLE›00100 STICK0   = $0278›00110 STICK1   = $0279›00120 XITVBV   = $E462›00130 HPOSP0   = $D000›00140 HPOSP1   = $D001›00150 PB1      = 203›00160 PB2      = 204›00170 STPLL    = 205›00180 STPLH    = 206›00190 VPSP0    = 1000›00200 VPSP1    = 1001›00210 STPL0L   = 1002›00220 STPL1L   = 1003›00230 STPL0H   = 1004›00240 STPL1H   = 1005›00250 UPL0     = 1006›00260 UPL1     = 1007›00270 LL0      = 1008›00280 LL1      = 1009›00290 LFL0     = 1010›00300 LFL1     = 1011›00310 HPOST0   = 1012›00320 HPOST1   = 1013›00330 RTL0     = 1014›00340 RTL1     = 1015›00350          LDX #0      ;PLAYER NUMBER›00360 B0       LDA STICK0,X;READ JOYSTICK›00370          AND #1      ;CHECK FIRST BIT›00380          BNE B1      ;IF BIT SET,KEEP CHECKING›00390          BEQ UP      ;BIT CLEAR,GOTO UP›00400 B1       LDA STICK0,X;READ STICK›00410          AND #2      ;SECOND BIT›00420          BNE B2      ;BIT SET?›00430          BEQ DOWN    ;CLEAR.GO DOWN›00440 B2       LDA STICK0,X›00450          AND #4      ;THIRD BIT›00460          BNE B3      ;BIT SET?›00470          BEQ LFTI    ;CLEAR. GO LEFT›00480 B3       LDA STICK0,X›00490          AND #8      ;FOURTH BIT›00500          BNE STICK   ;IF BIT SET,GO ON›00510          BEQ RIGHTI  ;CLEAR.GO RIGHT›00520 STICK    INX         ;NEXT PLAYER›00530          CPX #2      ;ALL DONE?›00540          BEQ EXIT    ;YES.EXIT VBI›00550          BNE B0      ;NO.REPEAT›00560 EXIT     JMP XITVBV  ;BACK TO ATARI VBI›00570 UP       LDA VPSP0,X ;VERTICAL POSITION›00580          TAY         ;HOLD IN Y›00590          DEY         ;DOWN ONE›00600          NOP         ;CHANGED BY BASIC›00610          TYA›00620          CMP UPL0,X  ;TOO FAR?›00630          BCC B1      ;YES. GO BACK›00640          STA VPSP0,X ;NO.STORE NEW VERTICAL›00650          INY         ;BACK TO OLD LOCATION›00660          NOP›00670          LDA STPL0L,X;PLAYER DATA ADDRESS LOW›00680          STA STPLL   ;STORE IN WORKING LOCATION›00690          LDA STPL0H,X;ADDRESS HIGH›00700          STA STPLH›00710 UPLP     LDA (STPLL),Y;GET BYTE›00720          DEY         ;DOWN ONE›00730          NOP›00740          STA (STPLL),Y;STORE AT NEW LOCATION›00750          INY         ;GO BACK FOR NEXT BYTE›00760          INY›00770          NOP›00780          DEC PB1     ;DECREASE COUNTER›00790          BPL UPLP    ;IF NOT DONE,DO IT AGAIN›00800          LDA PB2     ;RELOAD INITIAL COUNTER VALUE›00810          STA PB1     ;RESET COUNTER›00820          CLC         ;FORCED BRANCH›00830 RETURN1  BCC B1›00840 RIGHTI   BEQ RIGHT   ;INTERMEDIATE BRANCH POINT.USED TO EXTEND RANGE›00850 RTN2I    BCC B2      ;SAME›00860 B3I      BCC B3      ;SAME›00870 LFTI     BEQ LEFT    ;SAME›00880 STKI     BCC STICK   ;SAME›00890 STICKI   BCS STICK   ;SAME›00900 DOWN     LDA VPSP0,X ;OLD VERTICAL›00910          TAY         ;HOLD IN Y›00920          INY         ;UP ONE›00930          NOP›00940          TYA›00950          CMP LL0,X   ;TOO FAR?›00960          BCS B2      ;YES. GO BACK›00970          STA VPSP0,X ;NO. STORE NEW VERTICAL›00980          DEC PB1     ;GO TO TOP OF IMAGE›00990          DEC PB1›01000          DEC PB1›01010          NOP›01020          NOP›01030 DLP      INY›01040          DEC PB1›01050          BNE DLP     ;DONE?›01060          LDA PB2     ;YES. RESET COUNTER›01070          STA PB1›01080          LDA STPL0L,X;PLAYER ADDRESS›01090          STA STPLL   ;STORE IN WORKING LOCATION›01100          LDA STPL0H,X›01110          STA STPLH›01120 DWNLP    LDA (STPLL),Y;GET TOP IMAGE BYTE›01130          INY         ;UP ONE›01140          NOP›01150          STA (STPLL),Y;STORE AT NEW LOCATION›01160          DEY         ;BACK FOR NEW BYTE›01170          DEY›01180          NOP›01190          DEC PB1     ;DECREMENT COUNTER›01200          BPL DWNLP   ;IF NOT DONE,GO BACK›01210          LDA PB2     ;RESET COUNTER›01220          STA PB1›01230          CLC›01240 RETURN2  BCC RTN2I   ;FORCED BRANCH›01250 LEFT     LDY HPOST0,X;OLD HORIZONTAL POSITION›01260          DEY         ;MOVE LEFT ONE›01270          NOP›01280          TYA›01290          CMP LFL0,X  ;TOO FAR?›01300          BCC B3I     ;YES. GO BACK›01310          STA HPOST0,X;STORE NEW HORIZONTAL›01320          STA HPOSP0,X;STORE IN HARDWARE REGISTER›01330          CLC›01340 RETURN3  BCC B3I     ;FORCED BRANCH›01350 RIGHT    LDY HPOST0,X;SAME FOR RIGHT MOVEMENT›01360          INY›01370          NOP›01380          TYA›01390          CMP RTL0,X›01400          BEQ GOON›01410          BCS STICKI›01420 GOON     STA HPOST0,X›01430          STA HPOSP0,X›01440          CLC›01450 RETURN   BCC STKI    ;FORCED BRANCH›