home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 4 #4
/
Commodore_Disk_User_Vol.4_4_1991_-.d64
/
mov-ptr.list
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
3KB
|
120 lines
10 ;"@:mov-ptr.list"
20 *=$c000
30 sei ;set up interrupts
40 lda #$20
50 sta $0314
60 lda #$c0
70 sta $0315
80 cli
90 lda $c01c ;get fine x-val
100 sta $c0bd ;poke into program
110 sta $c0cd ;in two places
120 lda $c01d ;get fine y-val
130 sta $c0da ;poke into program
140 rts ;leave
150 byt $10 ;fine x-val
160 byt $29 ;fine y-val
170 *=$c020
180 lda $dc00 ;get joy pos port 2
190 sta $c01e ;put it in memory
200 lsr $c01e ;shift right
210 bcs d ;if bit 0, next bit
220 jsr up ;otherwise up
230 d lsr $c01e ;shift right
240 bcs l ;if bit 0, next bit
250 jsr down ;otherwise down
260 l lsr $c01e ;shift right
270 bcs r ;if bit 0, next bit
280 jsr left ;otherwise left
290 r lsr $c01e ;shift right
300 bcs f ;if bit 0, next bit
310 jsr right ;otherwise right
320 f lsr $c01e ;shift right
330 bcs q ;if bit 0, next bit
340 jsr fire ;otherwise fire
350 q jmp $ea31 ;housekeeping code
360 up ;move up
370 ldy $d001 ;get y-pos
380 cpy #$1f ;check if not off scrn
390 beq quitu ;if off, leave
400 dec $d001 ;move up one
410 quitu ;leave
420 rts
430 down ;move down
440 lda $d001 ;get y-pos
450 cmp #$f9 ;check if not off scrn
460 beq quitd ;if off, leave
470 inc $d001 ;move down one
480 quitd ;leave
490 rts
500 left ;move left
510 lda $d010 ;get x-msb
520 and #$01 ;check which side
530 cmp #$01 ;check msb right
540 bne onleft ;no, goto onleft
550 dec $d000 ;move left
560 bmi msb0 ;check if passed line
570 rts ;leave
580 msb0 ;0>msb
590 lda $d010 ;get reg
600 and #$fe ;0>bit0
610 sta $d010 ;put it back
620 rts ;leave
630 onleft ;onleft
640 ldx $d000 ;get x-pos
650 cpx #$01 ;check if not off scrn
660 beq quitl ;if off, leave
670 dec $d000 ;move left
680 quitl ;leave
690 rts
700 right ;move right
710 lda $d010 ;get x-msb
720 and #$01 ;check which side
730 cmp #$01 ;on right?
740 beq onright ;yes, goto onright
750 inc $d000 ;move right
760 lda $d000 ;get x-pos
770 cmp #$00 ;check if passed line
780 beq msb1 ;if has, goto msb1
790 rts ;leave
800 msb1 ;1>msb
810 lda $d010 ;get reg
820 ora #$01 ;1>bit0
830 sta $d010 ;put it back
840 rts ;leave
850 onright ;onright
860 lda $d000 ;get x-pos
870 cmp #$57 ;check if not off scrn
880 beq quitr ;if off, leave
890 inc $d000 ;move right
900 quitr ;leave
910 rts
920 fire ;fire routine
930 lda $d010 ;get msb
940 and #$01 ;get bit
950 bne firemsb ;if <>0, goto firemsb
960 lda $d000 ;get x-pos
970 sbc #$10 ;take away fine
980 lsr a ;div 2
990 lsr a ;div 4
1000 lsr a ;div 8
1010 sta $c01a ;store x-pos
1020 jmp ybit ;calculate y-pos
1030 firemsb ;firemsb
1040 lda $d000 ;get x-pos
1050 adc #$14 ;add 16 to make fine
1060 sbc #$10 ;take away fine
1070 lsr a ;div 2
1080 lsr a ;div 4
1090 lsr a ;div 8
1100 adc #$1d ;add 29
1110 sta $c0f0 ;store x-pos
1120 ybit ;y calculate
1130 lda $d001 ;get y-pos
1140 sbc #$29 ;take away fine
1150 lsr a ;div 2
1160 lsr a ;div 4
1170 lsr a ;div 8
1180 sta $c0f1 ;store y-pos
1190 rts ;leave