Tweak joystick code to make it more forgiving about center

This commit is contained in:
Jeremy Rand 2012-07-21 01:55:36 -05:00
parent 511bc71dd5
commit 46cd44ca17
2 changed files with 127 additions and 0 deletions

View File

@ -16,8 +16,16 @@ MAPFILE=curta.map
all: $(BIN)
# Big hack here. The joystick library from cc65 only considers a
# jostick centered if it is within 20 of 127 which is very tight.
# Thus the tests for $6B and $93. The good news is that the only
# occurrences of these bytes in the binary image are for these
# comparisons. So, I just do a global search and replace. The
# new threshold I am using is +/- 60 from 127.
a2e.stdjoy.s:
co65 --code-label _a2e_stdjoy -o $@ $(CC65_HOME)/joy/a2e.stdjoy.joy
sed -i .tmp 's/\$$6B/$$43/g' a2e.stdjoy.s
sed -i .tmp 's/\$$93/$$BB/g' a2e.stdjoy.s
a2e.hi.s:
co65 --code-label _a2e_hi -o $@ $(CC65_HOME)/tgi/a2e.hi.tgi

119
a2e.stdjoy.s.tmp Normal file
View File

@ -0,0 +1,119 @@
;
; File generated by co65 v 2.13.3 using model `cc65-module'
;
.fopt compiler,"co65 v 2.13.3"
.case on
.debuginfo off
.export _a2e_stdjoy
;
; CODE SEGMENT
;
.segment "CODE"
_a2e_stdjoy:
.byte $6A
.byte $6F
.byte $79
.byte $01
.byte $10
.byte $20
.byte $04
.byte $08
.byte $40
.byte $80
.byte $00
.byte $00
.word _a2e_stdjoy+22
.word _a2e_stdjoy+26
.word _a2e_stdjoy+27
.word _a2e_stdjoy+32
.byte $00
.byte $00
.byte $A9
.byte $00
.byte $A2
.byte $00
.byte $60
.byte $A9
.byte $02
.byte $A2
.byte $00
.byte $60
.byte $2C
.byte $82
.byte $C0
.byte $29
.byte $01
.byte $0A
.byte $AA
.byte $20
.byte $1E
.byte $FB
.byte $A9
.byte $00
.byte $C0
.byte $43
.byte $6A
.byte $C0
.byte $93
.byte $6A
.byte $48
.byte $E8
.byte $20
.byte $1E
.byte $FB
.byte $68
.byte $C0
.byte $43
.byte $6A
.byte $C0
.byte $93
.byte $6A
.byte $A8
.byte $BD
.byte $60
.byte $C0
.byte $0A
.byte $98
.byte $6A
.byte $A8
.byte $E8
.byte $8A
.byte $29
.byte $03
.byte $AA
.byte $BD
.byte $60
.byte $C0
.byte $0A
.byte $98
.byte $6A
.byte $49
.byte $14
.byte $A2
.byte $00
.byte $2C
.byte $80
.byte $C0
.byte $60
;
; DATA SEGMENT
;
.segment "DATA"
DATA:
;
; BSS SEGMENT
;
.segment "BSS"
BSS:
.res 0
;
; ZEROPAGE SEGMENT
;
.import __ZP_START__ ; Linker generated symbol
ZEROPAGE = __ZP_START__
.end