Acidmods
Console Modding------ ( Here you can talk about your favorite Consoles ) => XBOX 360 => 360 Controllers / 360 Rapid Fire Controllers => Topic started by: Judgement on January 25, 2009, 02:12:56 PM
-
H3 hex
:020000040000FA
:02000000942842
:08000800F0000308F1008C1C5C
:100010000900A01D1128AB0B16280A30AB00A01157
:100020001628AB0B16280A30AB00A01523181C2885
:100030008316051683122328A0190516A01D051284
:10004000831605128312A318292883168516831296
:100050003028A0198516A01D8512831685128312DB
:10006000231836288316051483124D28201D0510E9
:1000700020190514201C4528A10B4D28201083169B
:10008000051483122508A1004D28A20B4D28201429
:100090008316051083122508A200A318532883167F
:1000A000851483126A28201D851020198514A01C30
:1000B0006228A80B6A28A0108316851483122508CD
:1000C000A8006A28A90B6A28A01483168510831239
:1000D0002508A9008C1071088300F00E700E09002D
:1000E0004030A5000800A7010D30A600A70B762818
:1000F000A60B76280800831602309B001C141A08F1
:100100008312080083169A0002309B001C158B1383
:100110008B1B872855309D00AA309D009C149C188D
:100120008F2883128B1708008501A00107309900E2
:1001300083160F30850051309F00043095008113E5
:10014000831201309F001030A600A60BA5289F1433
:100150009F18A82840301E020318201583160C3063
:1001600085009F0183120A30AB002D30A100A8004A
:10017000A200A9007B20A300013092008316FA3070
:1001800092008C1483121215C0308B008519D3286D
:1001900073208519D328851DCB287320851DCB2876
:1001A0000230A30682200519C62873200519C62827
:1001B0006430A400732005195629A40BDA284030B6
:1001C000A3072D30A50023100A30AC007320AC0B20
:1001D000E6282314201656292D30A50023100A30B6
:1001E000AC007320AC0BF12823140A30AC00732050
:1001F000AC0BF72823100A30AC007320AC0BFD28A1
:10020000231420165629231B28292D30A50023103E
:100210000A30AC007320AC0B0A2923140A30AC005E
:100220007320AC0B102923100A30AC007320AC0BE8
:10023000162923140A30AC007320AC0B1C292310A0
:100240000A30AC007320AC0B222923142016562947
:100250002D30A50023100A30AC007320AC0B2D29E3
:1002600023140A30AC007320AC0B332923100A305E
:10027000AC007320AC0B392923140A30AC00732076
:10028000AC0B3F2923100A30AC007320AC0B45297E
:1002900023140A30AC007320AC0B4B2923100A3016
:1002A000AC007320AC0B512923142016051D5629D0
:1002B0007320851D5629201A5F290130A3062012BC
:0402C0008220C628AA
:02400E00C430BC
:1042000000000000000000000000000000000700A7
:00000001FF
Cod4 hex
:020000040000FA
:02000000942842
:08000800F0000308F1008C1C5C
:100010000900A01D1128AB0B16280A30AB00A01157
:100020001628AB0B16280A30AB00A01523181C2885
:100030008316051683122328A0190516A01D051284
:10004000831605128312A318292883168516831296
:100050003028A0198516A01D8512831685128312DB
:10006000231836288316051483124D28201D0510E9
:1000700020190514201C4528A10B4D28201083169B
:10008000051483122508A1004D28A20B4D28201429
:100090008316051083122508A200A318532883167F
:1000A000851483126A28201D851020198514A01C30
:1000B0006228A80B6A28A0108316851483122508CD
:1000C000A8006A28A90B6A28A01483168510831239
:1000D0002508A9008C1071088300F00E700E09002D
:1000E0004030A5000800A7010D30A600A70B762818
:1000F000A60B76280800831602309B001C141A08F1
:100100008312080083169A0002309B001C158B1383
:100110008B1B872855309D00AA309D009C149C188D
:100120008F2883128B1708008501A00107309900E2
:1001300083160F30850051309F00043095008113E5
:10014000831201309F001030A600A60BA5289F1433
:100150009F18A82840301E020318201583160C3063
:1001600085009F0183120A30AB001630A100A80061
:10017000A200A9007B20A300013092008316FA3070
:1001800092008C1483121215C0308B008519D3286D
:1001900073208519D328851DCB287320851DCB2876
:1001A0000230A30682200519C62873200519C62827
:1001B0006430A400732005195829A40BDA284030B4
:1001C000A307231BEE281630A50023100A30AC002D
:1001D0007320AC0BE8282314201658291630A500EC
:1001E00023100A30AC007320AC0BF32823140A3020
:1001F000AC007320AC0BF92823100A30AC0073203C
:10020000AC0BFF28231420165829231B2A290B3056
:10021000A50023100A30AC007320AC0B0C2923146A
:100220000A30AC007320AC0B122923100A30AC004A
:100230007320AC0B182923140A30AC007320AC0BCC
:100240001E2923100A30AC007320AC0B2429231480
:10025000201658290B30A50023100A30AC0073205B
:10026000AC0B2F2923140A30AC007320AC0B3529BA
:1002700023100A30AC007320AC0B3B2923140A3046
:10028000AC007320AC0B412923100A30AC00732062
:10029000AC0B472923140A30AC007320AC0B4D295A
:1002A00023100A30AC007320AC0B53292314201602
:1002B000051D58297320851D5829201A61290130F0
:0802C000A30620128220C628CB
:02400E00C430BC
:1042000000000000000000000000000000000700A7
:00000001FF
Cod5 hex
:020000040000FA
:02000000942842
:08000800F0000308F1008C1C5C
:100010000900A01D1128AB0B16280A30AB00A01157
:100020001628AB0B16280A30AB00A01523181C2885
:100030008316051683122328A0190516A01D051284
:10004000831605128312A318292883168516831296
:100050003028A0198516A01D8512831685128312DB
:10006000231836288316051483124D28201D0510E9
:1000700020190514201C4528A10B4D28201083169B
:10008000051483122508A1004D28A20B4D28201429
:100090008316051083122508A200A318532883167F
:1000A000851483126A28201D851020198514A01C30
:1000B0006228A80B6A28A0108316851483122508CD
:1000C000A8006A28A90B6A28A01483168510831239
:1000D0002508A9008C1071088300F00E700E09002D
:1000E0004030A5000800A7010D30A600A70B762818
:1000F000A60B76280800831602309B001C141A08F1
:100100008312080083169A0002309B001C158B1383
:100110008B1B872855309D00AA309D009C149C188D
:100120008F2883128B1708008501A00107309900E2
:1001300083160F30850051309F00043095008113E5
:10014000831201309F001030A600A60BA5289F1433
:100150009F18A82840301E020318201583160C3063
:1001600085009F0183120A30AB003D30A100A8003A
:10017000A200A9007B20A300013092008316FA3070
:1001800092008C1483121215C0308B008519D3286D
:1001900073208519D328851DCB287320851DCB2876
:1001A0000230A30682200519C62873200519C62827
:1001B0006430A40073200519EC28A40BDA28403021
:1001C000A3073D30A50023100A30AC007320AC0B10
:1001D000E62823142016EC28051DEC287320851D25
:1001E000EC28201AF5280130A30620128220C62808
:02400E00C430BC
:1042000000000000000000000000000000000700A7
:00000001FF
-
I took COD5 hex and pasted it into notepad. I saved the file as bull.hex. I then opened up the file in ICprog and pressed the button to view it in assembly. This is what I got:
; Generated by WinDis84, (c) Nigel Goodwin 1998.
LIST P=16F84, F=INHX8M
include "P16FXX.inc"
ORG 0x0000
GOTO Label_0001
ORG 0x0004
MOVWF 0x70
MOVF STATUS , W
MOVWF 0x71
BTFSS 0x0C , 01
RETFIE
BTFSS 0x20 , 03
GOTO Label_0002
DECFSZ 0x2B , f
GOTO Label_0003
MOVLW 0x0A
MOVWF 0x2B
BCF 0x20 , 03
GOTO Label_0003
Label_0002 DECFSZ 0x2B , f
GOTO Label_0003
MOVLW 0x0A
MOVWF 0x2B
BSF 0x20 , 03
Label_0003 BTFSC 0x23 , 00
GOTO Label_0004
BSF STATUS , RP0
BSF TRISA , 04
BCF STATUS , RP0
GOTO Label_0005
Label_0004 BTFSC 0x20 , 03
BSF PORTA , 04
BTFSS 0x20 , 03
BCF PORTA , 04
BSF STATUS , RP0
BCF TRISA , 04
BCF STATUS , RP0
Label_0005 BTFSC 0x23 , 01
GOTO Label_0006
BSF STATUS , RP0
BSF TRISA , 05
BCF STATUS , RP0
GOTO Label_0007
Label_0006 BTFSC 0x20 , 03
BSF PORTA , 05
BTFSS 0x20 , 03
BCF PORTA , 05
BSF STATUS , RP0
BCF TRISA , 05
BCF STATUS , RP0
Label_0007 BTFSC 0x23 , 00
GOTO Label_0008
BSF STATUS , RP0
BSF TRISA , 00
BCF STATUS , RP0
GOTO Label_0009
Label_0008 BTFSS 0x20 , 02
BCF PORTA , 00
BTFSC 0x20 , 02
BSF PORTA , 00
BTFSS 0x20 , 00
GOTO Label_000A
DECFSZ 0x21 , f
GOTO Label_0009
BCF 0x20 , 00
BSF STATUS , RP0
BSF TRISA , 00
BCF STATUS , RP0
MOVF 0x25 , W
MOVWF 0x21
GOTO Label_0009
Label_000A DECFSZ 0x22 , f
GOTO Label_0009
BSF 0x20 , 00
BSF STATUS , RP0
BCF TRISA , 00
BCF STATUS , RP0
MOVF 0x25 , W
MOVWF 0x22
Label_0009 BTFSC 0x23 , 01
GOTO Label_000B
BSF STATUS , RP0
BSF TRISA , 01
BCF STATUS , RP0
GOTO Label_000C
Label_000B BTFSS 0x20 , 02
BCF PORTA , 01
BTFSC 0x20 , 02
BSF PORTA , 01
BTFSS 0x20 , 01
GOTO Label_000D
DECFSZ 0x28 , f
GOTO Label_000C
BCF 0x20 , 01
BSF STATUS , RP0
BSF TRISA , 01
BCF STATUS , RP0
MOVF 0x25 , W
MOVWF 0x28
GOTO Label_000C
Label_000D DECFSZ 0x29 , f
GOTO Label_000C
BSF 0x20 , 01
BSF STATUS , RP0
BCF TRISA , 01
BCF STATUS , RP0
MOVF 0x25 , W
MOVWF 0x29
Label_000C BCF 0x0C , 01
MOVF 0x71 , W
MOVWF STATUS
SWAPF 0x70 , f
SWAPF 0x70 , W
RETFIE
MOVLW 0x40
MOVWF 0x25
RETURN
Label_0015 CLRF 0x27
MOVLW 0x0D
MOVWF 0x26
Label_000E DECFSZ 0x27 , f
GOTO Label_000E
DECFSZ 0x26 , f
GOTO Label_000E
RETURN
Label_0013 BSF STATUS , RP0
MOVLW 0x02
MOVWF 0x1B
BSF 0x1C , 00
MOVF 0x1A , W
BCF STATUS , RP0
RETURN
Label_0017 BSF STATUS , RP0
MOVWF 0x1A
MOVLW 0x02
MOVWF 0x1B
BSF 0x1C , 02
Label_000F BCF INTCON , GIE
BTFSC INTCON , GIE
GOTO Label_000F
MOVLW 0x55
MOVWF 0x1D
MOVLW 0xAA
MOVWF 0x1D
BSF 0x1C , 01
Label_0010 BTFSC 0x1C , 01
GOTO Label_0010
BCF STATUS , RP0
BSF INTCON , GIE
RETURN
Label_0001 CLRF PORTA
CLRF 0x20
MOVLW 0x07
MOVWF 0x19
BSF STATUS , RP0
MOVLW 0x0F
MOVWF TRISA
MOVLW 0x51
MOVWF 0x1F
MOVLW 0x04
MOVWF 0x15
BCF OPTION_REG, NOT_RBPU
BCF STATUS , RP0
MOVLW 0x01
MOVWF 0x1F
MOVLW 0x10
MOVWF 0x26
Label_0011 DECFSZ 0x26 , f
GOTO Label_0011
BSF 0x1F , 01
Label_0012 BTFSC 0x1F , 01
GOTO Label_0012
MOVLW 0x40
SUBWF 0x1E , W
BTFSC STATUS , C
BSF 0x20 , 02
BSF STATUS , RP0
MOVLW 0x0C
MOVWF TRISA
CLRF 0x1F
BCF STATUS , RP0
MOVLW 0x0A
MOVWF 0x2B
MOVLW 0x3D
MOVWF 0x21
MOVWF 0x28
MOVWF 0x22
MOVWF 0x29
CALL Label_0013
MOVWF 0x23
MOVLW 0x01
MOVWF 0x12
BSF STATUS , RP0
MOVLW 0xFA
MOVWF 0x12
BSF 0x0C , 01
BCF STATUS , RP0
BSF 0x12 , 02
MOVLW 0xC0
MOVWF INTCON
Label_0018 BTFSC PORTA , 03
GOTO Label_0014
CALL Label_0015
BTFSC PORTA , 03
GOTO Label_0014
Label_0016 BTFSS PORTA , 03
GOTO Label_0016
CALL Label_0015
BTFSS PORTA , 03
GOTO Label_0016
MOVLW 0x02
XORWF 0x23 , f
CALL Label_0017
Label_0014 BTFSC PORTA , 02
GOTO Label_0018
CALL Label_0015
BTFSC PORTA , 02
GOTO Label_0018
MOVLW 0x64
MOVWF 0x24
Label_001A CALL Label_0015
BTFSC PORTA , 02
GOTO Label_0019
DECFSZ 0x24 , f
GOTO Label_001A
MOVLW 0x40
ADDWF 0x23 , f
MOVLW 0x3D
MOVWF 0x25
BCF 0x23 , 00
MOVLW 0x0A
MOVWF 0x2C
Label_001B CALL Label_0015
DECFSZ 0x2C , f
GOTO Label_001B
BSF 0x23 , 00
BSF 0x20 , 04
GOTO Label_0019
Label_0019 BTFSS PORTA , 02
GOTO Label_0019
CALL Label_0015
BTFSS PORTA , 03
GOTO Label_0019
BTFSC 0x20 , 04
GOTO Label_001C
MOVLW 0x01
XORWF 0x23 , f
Label_001C BCF 0x20 , 04
CALL Label_0017
GOTO Label_0018
ORG 0x2000
DATA 0x0F
DATA 0x0F
DATA 0x0F
DATA 0x0F
ORG 0x2007
DATA 0x04
ORG 0x2100
DATA 0x00
DATA 0x00
DATA 0x00
DATA 0x00
DATA 0x00
DATA 0x00
DATA 0x00
DATA 0x07
Reached max character, continued in next post -->
-
Compare, line for line with this:
;***** VARIABLE DEFINITIONS******************
w_temp EQU 0x70 ; variable used for context saving
status_temp EQU 0x71 ; variable used for context saving
FLAGS EQU 0x20 ;software state register
PULSER EQU 0x21 ;pulse on counter
DWELLTIMER EQU 0x22 ;pulse off counter
STATE EQU 0x23 ;programmed state
BUTTONHOLD EQU 0x24
FREQR EQU 0x25 ;frequency value
TEMP1 EQU 0x26
TEMP2 EQU 0x27
PULSEL EQU 0x28
DWELLTIMEL EQU 0x29
TEMP5 EQU 0x2A
LEDBLINK EQU 0x2B
TEMP3 EQU 0x2C
;*******bits in FLAGS register***********
PULSEONR equ 0
PULSEONL equ 1
TRIGOUT equ 2
LEDHI equ 3
STATECHANGE equ 4
;*******bits in STATE register***********
RIGHTACTIVE equ 0
LEFTACTIVE equ 1
;*********GPIO pin names*****************
LEDL equ 5
LEDR equ 4
BUTTONR equ 2
BUTTONL equ 3
TRIGGERR equ 0
TRIGGERL equ 1
;**********Speed settings: change these to change speed (0x05-0xFF)
FIRERATE1 equ 0x2F
FIRERATE2 equ 0x16
FIRERATE3 equ 0x12
FIRERATE4 equ 0x0F
;**********************************************************************
ORG 0x000 ; processor reset vector
goto main ; go to beginning of program
ORG 0x004 ; interrupt vector location
movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register
;Take a good note here. OSC is left at default 4MHz.
; We are running at 1MHz instruction cycle, or 1 micro second
;Timer 2 is prescaled 1:4 and compared (PR2) to 250.
; we now have hardware interupt that falls every 1ms exactly
;within limitation of osctune. Main code is inconsequential.
;PULSE and DWELL values control the signals precisely.
;All pulse logic is switched within the few microseconds to
;service the interupt routine. DO NOT modify the ISR
;with any kind of 'wait' or 'loop'. If you want to trigger
; timed events do so by setting an open FLAG bit and have the
;event done in the main loop.
btfss PIR1, TMR2IF ;timer 2 int happened
retfie
;**************** LED blinking *********************************************
;Our main routine will turn the flag bit
;LEDON on or off. The 10ms pulse is a duty cycle
;for the code to work with both CG and
;matrix controllers.
BlinkLed
btfss FLAGS, LEDHI
goto LedLow
decfsz LEDBLINK, f ;if pulse is active, count down 10ms
goto RightLED
movlw 0x0A
movwf LEDBLINK
bcf FLAGS, LEDHI ;10ms done, turn off LEDHI bit
goto RightLED
LedLow
decfsz LEDBLINK, f ;LEDLO time, count down 10ms
goto RightLED
movlw 0x0A
movwf LEDBLINK
bsf FLAGS, LEDHI ;10ms done, turn LEDHI bit on
RightLED
btfsc STATE, RIGHTACTIVE ;is RF on?
goto OutputRightLED
bsf STATUS, RP0 ;bank 1
bsf TRISIO, LEDR ;tristate LED
bcf STATUS, RP0 ;bank 0
goto LeftLED
OutputRightLED
btfsc FLAGS, LEDHI ;if ledhi true,
bsf GPIO, LEDR ;turn output hi
btfss FLAGS, LEDHI ;if ledhi flase,
bcf GPIO, LEDR ;turn led output lo
bsf STATUS, RP0 ;bank 1
bcf TRISIO, LEDR ;turn output on
bcf STATUS, RP0 ;bank 0
LeftLED
btfsc STATE, LEFTACTIVE ;is RF on?
goto OutputleftLED
bsf STATUS, RP0 ;bank 1
bsf TRISIO, LEDL ;tristate LED
bcf STATUS, RP0 ;bank 0
goto RightTrigger
OutputleftLED
btfsc FLAGS, LEDHI ;if ledhi true,
bsf GPIO, LEDL ;turn output hi
btfss FLAGS, LEDHI ;if ledhi flase,
bcf GPIO, LEDL ;turn led output lo
bsf STATUS, RP0 ;bank 1
bcf TRISIO, LEDL ;turn output on
bcf STATUS, RP0 ;bank 0
;**************** Right trigger logic***************************************
RightTrigger
btfsc STATE, RIGHTACTIVE ;is RF on?
goto ActiveR
bsf STATUS, RP0 ;bank 1
bsf TRISIO, TRIGGERR ;output off
bcf STATUS, RP0 ;bank 0
goto LeftTrigger
ActiveR
btfss FLAGS, TRIGOUT ;controllertype
bcf GPIO, TRIGGERR ;determines
btfsc FLAGS, TRIGOUT ;output state
bsf GPIO, TRIGGERR
btfss FLAGS, PULSEONR ;is pulse active?
goto OffstateR
decfsz PULSER, f ;if pulse is active, count down 10ms
goto LeftTrigger
bcf FLAGS, PULSEONR ;10ms is over, clear flags and
bsf STATUS, RP0 ;bank 1
bsf TRISIO, TRIGGERR ;tristate output
bcf STATUS, RP0 ;bank 0
movf FREQR, w ;and reset pulse time.
movwf PULSER
goto LeftTrigger
OffstateR
decfsz DWELLTIMER, f ;count down dwell time to next pulse
goto LeftTrigger
bsf FLAGS, PULSEONR ;if dwell is done turn on outputs
bsf STATUS, RP0 ;bank 1
bcf TRISIO, TRIGGERR ;and reset pulse time
bcf STATUS, RP0 ;bank 0
movf FREQR, w ;from frequency value
movwf DWELLTIMER
LeftTrigger
btfsc STATE, LEFTACTIVE ;is RF on?
goto ActiveL
bsf STATUS, RP0 ;bank 1
bsf TRISIO, TRIGGERL ;output off
bcf STATUS, RP0 ;bank 0
goto EndInterupt
ActiveL
btfss FLAGS, TRIGOUT ;controllertype
bcf GPIO, TRIGGERL ;determines
btfsc FLAGS, TRIGOUT ;output state
bsf GPIO, TRIGGERL
btfss FLAGS, PULSEONL ;is pulse active?
goto OffstateL
decfsz PULSEL, f ;if pulse is active, count down 10ms
goto EndInterupt
bcf FLAGS, PULSEONL ;10ms is over, clear flags and
bsf STATUS, RP0 ;bank 1
bsf TRISIO, TRIGGERL ;tristate output
bcf STATUS, RP0 ;bank 0
movf FREQR, w ;and reset pulse time.
movwf PULSEL
goto EndInterupt
OffstateL
decfsz DWELLTIMEL, f ;count down dwell time to next pulse
goto EndInterupt
bsf FLAGS, PULSEONL ;if dwell is done turn on outputs
bsf STATUS, RP0 ;bank 1
bcf TRISIO, TRIGGERL ;and reset pulse time
bcf STATUS, RP0 ;bank 0
movf FREQR, w ;from frequency value
movwf DWELLTIMEL
EndInterupt
bcf PIR1, TMR2IF
movf status_temp,w ; retrieve copy of STATUS register
movwf STATUS ; restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
retfie ; return from interrupt
;*************************************SUBROUTINES**********************************
Wait10ms
clrf TEMP2
movlw 0x0D
movwf TEMP1 ;rough 10ms timer for button debounce.
Loop1
decfsz TEMP2, f ;count down 256*3=768 cycles
goto Loop1
decfsz TEMP1, f ;count down 768*13=9986 cycles
goto Loop1
return
;*************************************************************
ReadEE
bsf STATUS , RP0 ;Bank1
movlw 0x02
movwf EEADR
bsf EECON1 , RD ;start read
movf EEDAT , W
bcf STATUS , RP0 ;Bank0
return
;*************************************************************
WriteEE
bsf STATUS , RP0
movwf EEDAT
movlw 0x02
movwf EEADR
bsf EECON1,WREN ;Enable write
bcf INTCON, GIE ;Disable INTs
btfsc INTCON, GIE ;See AN576
goto $-2
movlw 0x55 ;Unlock write
movwf EECON2
movlw 0xAA
movwf EECON2
bsf EECON1, WR ;Start the write
WaitForEEWrite
btfsc EECON1, WR ;wait for hardware to clear (done writing)
goto WaitForEEWrite
bcf STATUS , RP0 ;Bank0
bsf INTCON, GIE ;Enable INTS
return
;**********************************************************************************
;**********************************************************************************
;**********************************************************************************
main
clrf GPIO
clrf FLAGS ;clear outputs and code status register
movlw 0x07
movwf CMCON0 ;comparators off
bsf STATUS, RP0 ;bank 1
movlw 0x0F ;start with 0-3 inputs (ADC read)
movwf TRISIO ;pin 0 & 1 & 5 out, all other inputs
movlw 0x51 ;Fosc/16, pin 0 analog
movwf ANSEL ;Right trigger is analog input
movlw 0x04
movwf WPU ;enable week pullups
bcf OPTION_REG, 7 ;enable all week pullups
bcf STATUS, RP0 ;bank 0
movlw 0x01 ;Left just, Vdd, channel 0
movwf ADCON0 ;module on.
movlw 0x10
movwf TEMP1
Wait4ADC
decfsz TEMP1, f
goto Wait4ADC ;acquisition time
bsf ADCON0, 1 ;start ADC
btfsc ADCON0, 1
goto $-1 ;wait for conversion to be done
movlw 0x40 ;about 0.5V from 2V ref
subwf ADRESH, w ;if f > W, C=1
btfsc STATUS, C ;ie- if trigger > 0.5V, then matrix
bsf FLAGS, TRIGOUT ;matrix config sources (output high)
bsf STATUS, RP0 ;bank 1
movlw 0x0C ;restore pin IO
movwf TRISIO
clrf ANSEL ;all digital now
bcf STATUS, RP0 ;bank 0
movlw 0x0A ;start with 10ms pulse width
movwf LEDBLINK ;for the LEDs
movlw FIRERATE1 ;this will get overwritten,
movwf PULSER ; but start with a default value
movwf PULSEL
movwf DWELLTIMER
movwf DWELLTIMEL
call ReadEE ;get state value
movwf STATE
movlw 0x01
movwf T2CON ;timer 2, prescale 1:4, no postscale
bsf STATUS, RP0 ;bank 1
movlw 0xFA
movwf PR2 ;setup 1ms hardware interupt
bsf PIE1, TMR2IE ;enable timer2 interupt
bcf STATUS, RP0 ;bank 0
bsf T2CON, TMR2ON ;turn on timer2
movlw 0xC0
movwf INTCON ;turn on interupts globally
goto InitState ;get first firerate value
;******MAIN LOOP***************
Start
TestLeft
btfsc GPIO, BUTTONL
goto TestRight ;Test for left button press
call Wait10ms
btfsc GPIO, BUTTONL ;button is down for 10ms
goto TestRight
ReleaseLeft
btfss GPIO, BUTTONL ;wait for button release
goto ReleaseLeft
call Wait10ms
btfss GPIO, BUTTONL ;wait for button release
goto ReleaseLeft
movlw 0x02
xorwf STATE, f ;toggle left trigger
call WriteEE ;store state
TestRight
btfsc GPIO, BUTTONR
goto Start
; goto DisplayState ;Test for right button press
call Wait10ms
btfsc GPIO, BUTTONR ;button is down for min 10ms
goto Start
; goto DisplayState
movlw 0xC8
movwf BUTTONHOLD ;setup for 2 second hold
First2seconds
call Wait10ms
btfsc GPIO, BUTTONR ;button is down for more than 10ms
goto ReleaseRight
decfsz BUTTONHOLD, f
goto First2seconds
movlw 0xC8
movwf BUTTONHOLD ;setup for 2 second hold
Second2seconds
call Wait10ms
btfsc GPIO, BUTTONR
goto ReleaseRight
decfsz BUTTONHOLD, f
goto Second2seconds ;button down for 4 seconds, change firerate
NextState
movlw 0x40
addwf STATE, f ;change firerate state
InitState ;begin test for
btfsc STATE, 7 ;state 1 or 2
goto State3
btfsc STATE, 6
goto State2
State1
movlw FIRERATE1 ;state 1
movwf FREQR
bcf STATE, RIGHTACTIVE ;led off
movlw 0x0A
movwf TEMP3
Loop01
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop01
bsf STATE, RIGHTACTIVE ;led on
bsf FLAGS, STATECHANGE ;notify a state change
goto ReleaseRight
State2
movlw FIRERATE2 ;state 2
movwf FREQR
bcf STATE, RIGHTACTIVE ;blink twice, led off
movlw 0x0A
movwf TEMP3
Loop02
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop02
bsf STATE, RIGHTACTIVE ;led on
movlw 0x0A
movwf TEMP3
Loop03
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop03
bcf STATE, RIGHTACTIVE ;led off
movlw 0x0A
movwf TEMP3
Loop04
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop04
bsf STATE, RIGHTACTIVE ;led on
bsf FLAGS, STATECHANGE ;notify a state change
goto ReleaseRight
State3
btfsc STATE, 6
goto State4
movlw FIRERATE3 ;state 3
movwf FREQR
bcf STATE, RIGHTACTIVE ;blink 3 times, led off
movlw 0x0A
movwf TEMP3
Loop05
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop05
bsf STATE, RIGHTACTIVE ;led on
movlw 0x0A
movwf TEMP3
Loop06
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop06
bcf STATE, RIGHTACTIVE ;led off
movlw 0x0A
movwf TEMP3
Loop07
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop07
bsf STATE, RIGHTACTIVE ;led on
movlw 0x0A
movwf TEMP3
Loop08
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop08
bcf STATE, RIGHTACTIVE ;led off
movlw 0x0A
movwf TEMP3
Loop09
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop09
bsf STATE, RIGHTACTIVE ;led on
bsf FLAGS, STATECHANGE ;notify a state change
goto ReleaseRight
State4
movlw FIRERATE4 ;state 4, 22ms cycle
movwf FREQR
bcf STATE, RIGHTACTIVE ;blink 4 times, led off
movlw 0x0A
movwf TEMP3
Loop10
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop10
bsf STATE, RIGHTACTIVE ;led on
movlw 0x0A
movwf TEMP3
Loop11
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop11
bcf STATE, RIGHTACTIVE ;led off
movlw 0x0A
movwf TEMP3
Loop12
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop12
bsf STATE, RIGHTACTIVE ;led on
movlw 0x0A
movwf TEMP3
Loop13
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop13
bcf STATE, RIGHTACTIVE ;led off
movlw 0x0A
movwf TEMP3
Loop14
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop14
bsf STATE, RIGHTACTIVE ;led on
movlw 0x0A
movwf TEMP3
Loop15
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop15
bcf STATE, RIGHTACTIVE ;led off
movlw 0x0A
movwf TEMP3
Loop16
call Wait10ms ;100 ms
decfsz TEMP3, f
goto Loop16
bsf STATE, RIGHTACTIVE ;led on
bsf FLAGS, STATECHANGE ;notify a state change
ReleaseRight
btfss GPIO, BUTTONR ;wait for button release
goto ReleaseRight
call Wait10ms
btfss GPIO, BUTTONL ;wait for button release
goto ReleaseRight
btfsc FLAGS, STATECHANGE ;test for button tap or state change
goto Continue01
movlw 0x01
xorwf STATE, f ;toggle left trigger if button tap
Continue01
bcf FLAGS, STATECHANGE
call WriteEE ;store state
goto Start
; initialize eeprom locations
ORG 0x2100
DE 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07
END ; directive 'end of program'
-
good eye hazer..lol
why post a hex like that anyway??? what are you going to do with it. copy, paste, convert...why go through all that??
if you want a hex tested, please post a link to the hex file, and I will test it for you, otherwise this is usless to me.
besides, hazers code is posted here in full with 4 fire rates to cover all of these games on one chip, yes, thats right 4 modes to cover all the common games https://www.acidmods.com/forum/index.php?topic=22727.0 (https://www.acidmods.com/forum/index.php?topic=22727.0)
-
wow judgement you must have worked so hard to post those hex codes without crediting the original author. good thing the original author is here for you to thank him :#1:
-
I got these so called hex Codes off of :censored:. But would this coding work? or is it complete BS? Sorry I am kinda new to and this Hex stuff. Modded Matt can you tell me how to convert it in to the proper form?
-
I got these so called hex Codes off of :censored
where exactly is that again?
-
Spark
-
mods I had to post separate due to the "censored" lmao