Use new joystick decls
git-svn-id: svn://svn.cc65.org/cc65/trunk@2777 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -28,7 +28,7 @@ OFFS = 10
|
|||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $6A, $6F, $79 ; "joy"
|
.byte $6A, $6F, $79 ; "joy"
|
||||||
.byte $00 ; Driver API version number
|
.byte JOY_API_VERSION ; Driver API version number
|
||||||
|
|
||||||
; Button state masks (8 values)
|
; Button state masks (8 values)
|
||||||
|
|
||||||
@@ -70,8 +70,7 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
|||||||
INSTALL:
|
INSTALL:
|
||||||
lda #<JOY_ERR_OK
|
lda #<JOY_ERR_OK
|
||||||
ldx #>JOY_ERR_OK
|
ldx #>JOY_ERR_OK
|
||||||
|
; rts ; Run into UNINSTALL instead
|
||||||
; rts ; Run into DEINSTALL instead
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $6A, $6F, $79 ; "joy"
|
.byte $6A, $6F, $79 ; "joy"
|
||||||
.byte $00 ; Driver API version number
|
.byte JOY_API_VERSION ; Driver API version number
|
||||||
|
|
||||||
; Button state masks (8 values)
|
; Button state masks (8 values)
|
||||||
|
|
||||||
@@ -65,8 +65,7 @@ JOY_COUNT = 4 ; Number of joysticks we support
|
|||||||
INSTALL:
|
INSTALL:
|
||||||
lda #<JOY_ERR_OK
|
lda #<JOY_ERR_OK
|
||||||
ldx #>JOY_ERR_OK
|
ldx #>JOY_ERR_OK
|
||||||
|
; rts ; Run into UNINSTALL instead
|
||||||
; rts ; Run into DEINSTALL instead
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $6A, $6F, $79 ; "joy"
|
.byte $6A, $6F, $79 ; "joy"
|
||||||
.byte $00 ; Driver API version number
|
.byte JOY_API_VERSION ; Driver API version number
|
||||||
|
|
||||||
; Button state masks (8 values)
|
; Button state masks (8 values)
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.word INSTALL
|
.word INSTALL
|
||||||
.word DEINSTALL
|
.word UNINSTALL
|
||||||
.word COUNT
|
.word COUNT
|
||||||
.word READ
|
.word READ
|
||||||
|
|
||||||
@@ -60,15 +60,14 @@ JOY_COUNT = 4 ; Number of joysticks we support
|
|||||||
INSTALL:
|
INSTALL:
|
||||||
lda #<JOY_ERR_OK
|
lda #<JOY_ERR_OK
|
||||||
ldx #>JOY_ERR_OK
|
ldx #>JOY_ERR_OK
|
||||||
|
; rts ; Run into UNINSTALL instead
|
||||||
; rts ; Run into DEINSTALL instead
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; DEINSTALL routine. Is called before the driver is removed from memory.
|
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||||
; Can do cleanup or whatever. Must not return anything.
|
; Can do cleanup or whatever. Must not return anything.
|
||||||
;
|
;
|
||||||
|
|
||||||
DEINSTALL:
|
UNINSTALL:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $6A, $6F, $79 ; "joy"
|
.byte $6A, $6F, $79 ; "joy"
|
||||||
.byte $00 ; Driver API version number
|
.byte JOY_API_VERSION ; Driver API version number
|
||||||
|
|
||||||
; Button state masks (8 values)
|
; Button state masks (8 values)
|
||||||
|
|
||||||
@@ -65,8 +65,7 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
|||||||
INSTALL:
|
INSTALL:
|
||||||
lda #<JOY_ERR_OK
|
lda #<JOY_ERR_OK
|
||||||
ldx #>JOY_ERR_OK
|
ldx #>JOY_ERR_OK
|
||||||
|
; rts ; Run into UNINSTALL instead
|
||||||
; rts ; Run into DEINSTALL instead
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $6A, $6F, $79 ; "joy"
|
.byte $6A, $6F, $79 ; "joy"
|
||||||
.byte $00 ; Driver API version number
|
.byte JOY_API_VERSION ; Driver API version number
|
||||||
|
|
||||||
; Button state masks (8 values)
|
; Button state masks (8 values)
|
||||||
|
|
||||||
@@ -103,11 +103,9 @@ pollirq:
|
|||||||
ldy #$00 ; port b direction
|
ldy #$00 ; port b direction
|
||||||
sty $dd03 ; => input
|
sty $dd03 ; => input
|
||||||
|
|
||||||
; ldy #$00
|
|
||||||
sty $dd05 ; cia2 timer a highbyte
|
sty $dd05 ; cia2 timer a highbyte
|
||||||
sty $dc05 ; cia1 timer a highbyte
|
sty $dc05 ; cia1 timer a highbyte
|
||||||
iny
|
iny
|
||||||
; lda #$01
|
|
||||||
sty $dd04 ; cia2 timer a lowbyte
|
sty $dd04 ; cia2 timer a lowbyte
|
||||||
sty $dc04 ; cia1 timer a lowbyte
|
sty $dc04 ; cia1 timer a lowbyte
|
||||||
|
|
||||||
@@ -119,10 +117,6 @@ pollirq:
|
|||||||
; serial port: input
|
; serial port: input
|
||||||
|
|
||||||
; cia 1 setup
|
; cia 1 setup
|
||||||
|
|
||||||
; lda #%00000001
|
|
||||||
; sty $dc0d ; irq ctrl reg
|
|
||||||
|
|
||||||
lda #%01010001
|
lda #%01010001
|
||||||
sta $dc0e ; control register a
|
sta $dc0e ; control register a
|
||||||
; timer: start
|
; timer: start
|
||||||
@@ -132,13 +126,11 @@ pollirq:
|
|||||||
|
|
||||||
|
|
||||||
; read directions 3
|
; read directions 3
|
||||||
|
|
||||||
lda $dd01 ;read cia 2 port b
|
lda $dd01 ;read cia 2 port b
|
||||||
and #$0f
|
and #$0f
|
||||||
sta temp3
|
sta temp3
|
||||||
|
|
||||||
; read button 3
|
; read button 3
|
||||||
|
|
||||||
lda $dd02 ;cia 2 port a
|
lda $dd02 ;cia 2 port a
|
||||||
and #%11111011 ;data direction
|
and #%11111011 ;data direction
|
||||||
sta $dd02 ;=> bit 2 input
|
sta $dd02 ;=> bit 2 input
|
||||||
@@ -151,7 +143,6 @@ pollirq:
|
|||||||
sta temp3
|
sta temp3
|
||||||
|
|
||||||
; read directions 4
|
; read directions 4
|
||||||
|
|
||||||
lda $dd01 ;read cia 2 port b
|
lda $dd01 ;read cia 2 port b
|
||||||
lsr a
|
lsr a
|
||||||
lsr a
|
lsr a
|
||||||
@@ -160,7 +151,6 @@ pollirq:
|
|||||||
sta temp4
|
sta temp4
|
||||||
|
|
||||||
; read button 4
|
; read button 4
|
||||||
|
|
||||||
ldx #$ff ;serial data register
|
ldx #$ff ;serial data register
|
||||||
stx $dc0c;=> writing $ff causes
|
stx $dc0c;=> writing $ff causes
|
||||||
;cia to output some
|
;cia to output some
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $6A, $6F, $79 ; "joy"
|
.byte $6A, $6F, $79 ; "joy"
|
||||||
.byte $00 ; Driver API version number
|
.byte JOY_API_VERSION ; Driver API version number
|
||||||
|
|
||||||
; Button state masks (8 values)
|
; Button state masks (8 values)
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.word INSTALL
|
.word INSTALL
|
||||||
.word DEINSTALL
|
.word UNINSTALL
|
||||||
.word COUNT
|
.word COUNT
|
||||||
.word READ
|
.word READ
|
||||||
|
|
||||||
@@ -59,15 +59,14 @@ JOY_COUNT = 4 ; Number of joysticks we support
|
|||||||
INSTALL:
|
INSTALL:
|
||||||
lda #<JOY_ERR_OK
|
lda #<JOY_ERR_OK
|
||||||
ldx #>JOY_ERR_OK
|
ldx #>JOY_ERR_OK
|
||||||
|
; rts ; Run into UNINSTALL instead
|
||||||
; rts ; Run into DEINSTALL instead
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; DEINSTALL routine. Is called before the driver is removed from memory.
|
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||||
; Can do cleanup or whatever. Must not return anything.
|
; Can do cleanup or whatever. Must not return anything.
|
||||||
;
|
;
|
||||||
|
|
||||||
DEINSTALL:
|
UNINSTALL:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $6A, $6F, $79 ; "joy"
|
.byte $6A, $6F, $79 ; "joy"
|
||||||
.byte $00 ; Driver API version number
|
.byte JOY_API_VERSION ; Driver API version number
|
||||||
|
|
||||||
; Button state masks (8 values)
|
; Button state masks (8 values)
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ INSTALL:
|
|||||||
lda #<JOY_ERR_OK
|
lda #<JOY_ERR_OK
|
||||||
ldx #>JOY_ERR_OK
|
ldx #>JOY_ERR_OK
|
||||||
|
|
||||||
; rts ; Run into DEINSTALL instead
|
; rts ; Run into UNINSTALL instead
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $6A, $6F, $79 ; "joy"
|
.byte $6A, $6F, $79 ; "joy"
|
||||||
.byte $00 ; Driver API version number
|
.byte JOY_API_VERSION ; Driver API version number
|
||||||
|
|
||||||
; Button state masks (8 values)
|
; Button state masks (8 values)
|
||||||
|
|
||||||
@@ -65,7 +65,6 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
|||||||
INSTALL:
|
INSTALL:
|
||||||
lda #<JOY_ERR_OK
|
lda #<JOY_ERR_OK
|
||||||
ldx #>JOY_ERR_OK
|
ldx #>JOY_ERR_OK
|
||||||
|
|
||||||
; rts ; Run into UNINSTALL instead
|
; rts ; Run into UNINSTALL instead
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
.bss
|
.bss
|
||||||
_joy_drv: .res 2 ; Pointer to driver
|
_joy_drv: .res 2 ; Pointer to driver
|
||||||
|
|
||||||
_joy_masks: .res JOY_MASK_COUNT
|
_joy_masks: .res .sizeof(JOY_HDR::MASKS)
|
||||||
|
|
||||||
; Jump table for the driver functions.
|
; Jump table for the driver functions.
|
||||||
.data
|
.data
|
||||||
@@ -32,8 +32,7 @@ joy_read: jmp $0000
|
|||||||
|
|
||||||
; Driver header signature
|
; Driver header signature
|
||||||
.rodata
|
.rodata
|
||||||
joy_sig: .byte $6A, $6F, $79, $00 ; "joy", version
|
joy_sig: .byte $6A, $6F, $79, JOY_API_VERSION ; "joy", version
|
||||||
joy_sig_len = * - joy_sig
|
|
||||||
|
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
@@ -49,7 +48,7 @@ _joy_install:
|
|||||||
|
|
||||||
; Check the driver signature
|
; Check the driver signature
|
||||||
|
|
||||||
ldy #joy_sig_len-1
|
ldy #.sizeof(joy_sig)-1
|
||||||
@L0: lda (ptr1),y
|
@L0: lda (ptr1),y
|
||||||
cmp joy_sig,y
|
cmp joy_sig,y
|
||||||
bne inv_drv
|
bne inv_drv
|
||||||
@@ -58,8 +57,8 @@ _joy_install:
|
|||||||
|
|
||||||
; Copy the mask array
|
; Copy the mask array
|
||||||
|
|
||||||
ldy #JOY_MASKS + JOY_MASK_COUNT - 1
|
ldy #JOY_HDR::MASKS + .sizeof(JOY_HDR::MASKS) - 1
|
||||||
ldx #JOY_MASK_COUNT-1
|
ldx #.sizeof(JOY_HDR::MASKS)-1
|
||||||
@L1: lda (ptr1),y
|
@L1: lda (ptr1),y
|
||||||
sta _joy_masks,x
|
sta _joy_masks,x
|
||||||
dey
|
dey
|
||||||
@@ -68,12 +67,12 @@ _joy_install:
|
|||||||
|
|
||||||
; Copy the jump vectors
|
; Copy the jump vectors
|
||||||
|
|
||||||
ldy #JOY_HDR_JUMPTAB
|
ldy #JOY_HDR::JUMPTAB
|
||||||
ldx #0
|
ldx #0
|
||||||
@L2: inx ; Skip the JMP opcode
|
@L2: inx ; Skip the JMP opcode
|
||||||
jsr copy ; Copy one byte
|
jsr copy ; Copy one byte
|
||||||
jsr copy ; Copy one byte
|
jsr copy ; Copy one byte
|
||||||
cpx #(JOY_HDR_JUMPCOUNT*3)
|
cpy #(JOY_HDR::JUMPTAB + .sizeof(JOY_HDR::JUMPTAB))
|
||||||
bne @L2
|
bne @L2
|
||||||
|
|
||||||
jmp joy_install ; Call driver install routine
|
jmp joy_install ; Call driver install routine
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $6A, $6F, $79 ; "joy"
|
.byte $6A, $6F, $79 ; "joy"
|
||||||
.byte $00 ; Driver API version number
|
.byte JOY_API_VERSION ; Driver API version number
|
||||||
|
|
||||||
; Button state masks (8 values)
|
; Button state masks (8 values)
|
||||||
|
|
||||||
@@ -64,8 +64,7 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
|||||||
INSTALL:
|
INSTALL:
|
||||||
lda #<JOY_ERR_OK
|
lda #<JOY_ERR_OK
|
||||||
ldx #>JOY_ERR_OK
|
ldx #>JOY_ERR_OK
|
||||||
|
; rts ; Run into UNINSTALL instead
|
||||||
; rts ; Run into DEINSTALL instead
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $6A, $6F, $79 ; "joy"
|
.byte $6A, $6F, $79 ; "joy"
|
||||||
.byte $00 ; Driver API version number
|
.byte JOY_API_VERSION ; Driver API version number
|
||||||
|
|
||||||
; Button state masks (8 values)
|
; Button state masks (8 values)
|
||||||
|
|
||||||
@@ -65,8 +65,7 @@ JOY_COUNT = 1 ; Number of joysticks we support
|
|||||||
INSTALL:
|
INSTALL:
|
||||||
lda #<JOY_ERR_OK
|
lda #<JOY_ERR_OK
|
||||||
ldx #>JOY_ERR_OK
|
ldx #>JOY_ERR_OK
|
||||||
|
; rts ; Run into UNINSTALL instead
|
||||||
; rts ; Run into DEINSTALL instead
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||||
|
|||||||
Reference in New Issue
Block a user