home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_24_1988_Transactor_Publishing.d64
/
joyid.lads
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
2KB
|
53 lines
10 *= $033c
15 ; joystick id routine
20 ;
25 .o
30 .d joyid.ml
35 ;
40 conreg = $dc0d; control register
45 porta = $dc00; joy port 2
50 portb = $dc01; joy port 1
55 keyqueue = $00c6; guess where...
60 keybuf = $0277; ditto...
65 joynum = $03a0; return value
70 ;
100 joyid lda #$00; get started
110 sta joynum; clear return val
120 sta keyqueue; clear keybd buf
130 lda #$01; set up variables
140 sta temp; holds values
150 sta temp+1; from checks
160 lda #$11; kill keyboard in
170 sta conreg; prep to read
180 lda #$ff; joystick port
190 sta porta; one
200 lda portb; read joy one
210 sta temp; save the result
220 lda porta; read joy two
230 sta temp+1; and save it
240 lda #$81; turn on the
250 sta conreg; keyboard
260 lda keybuf; check keypress
270 cmp #$0d; is return,
280 bne chkrega; no return, (NULL) on
290 lda #$00; return, load joy
300 sta joynum; value with 0
310 beq return; and exit
320 chkrega lda temp; compare for fire
330 and #$10; button
340 bne chkregb; no, jump ahead
350 lda #$01; load joy value
360 sta joynum; with 1 and
370 bne return; exit
380 chkregb lda temp+1;compare for fire
390 and #$10; button
400 bne joyid; no, start over
410 lda #$02; load joy value
420 sta joynum; with 2
430 return lda #$00; ready to return
440 sta keyqueue; clear queue
450 rts; (NULL) on home
460 temp .byte 1 1; variables
470 ;
480 .end joyid.lads