Author Topic: adding modes  (Read 4323 times)

Offline OxEpicOwnagexO

  • ½ Pint
  • *
  • Posts: 35
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
adding modes
« on: August 28, 2009, 06:20:21 PM »
say i wanted to take hazers free opensource code and add a mode or two? surely this is possible. does anyone have a tutorial? Not for any game in specific but wanted to do different fire rates for each additional mode.... any and all help will be much appreciated!

Offline spurgurgle

  • Acidmods Alumni
  • Millennium Poster
  • *
  • Posts: 1121
  • Post quality +17/-1
  • Gender: Male
  • call me spurg
    • my blog
Re: adding modes
« Reply #1 on: August 29, 2009, 03:13:07 AM »
hey mate im not sure if this is correct but you can add mor modes to the 3 mode stealth and 4mode on button by copying the code twice into 1 file well kind of its not that simple you may wana check wit hazer.
so the 3 mode will end up being 7 mode as 1 mode is off and with the 4 mode you could end up with 8modes
not to fond of the idea of scrolling through7modes on the sync button.
wot would be better is if you could ad a burst mode onto either code or replace 1 of the modes with a burst setting but hey i dont know bout coding so yeah its all just guess work from me.

Sigs made by Ken and blazin from the AM Art team cheers guys.....
Spurgurgle d.t com
"I'm kinda like a typo, not quite right, but most people still understand me"

Offline OxEpicOwnagexO

  • ½ Pint
  • *
  • Posts: 35
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: adding modes
« Reply #2 on: August 29, 2009, 07:08:40 PM »
thanks for the help and good info, the doubling the code up does make since... hazer.......whats ur opinion u da man lol

Post Merge: August 29, 2009, 07:22:50 PM
tried that and it had an error in the build, maybe i should change the speeds to different on each one ima try that real quick and pop it in my controller if it works :D

Post Merge: August 29, 2009, 07:40:22 PM
update, got it to program to the pic BUT when i hit the sync it flashes led once, then hit it again and it flashes 4 times..... then back to off
« Last Edit: August 29, 2009, 07:40:22 PM by OxEpicOwnagexO »

Offline Hazer

  • x4675636B4E7574
  • Acidmods Alumni
  • Acid Modder
  • *
  • Posts: 583
  • Post quality +59/-0
Re: adding modes
« Reply #3 on: August 29, 2009, 07:45:31 PM »
Switching modes in the open-source is done by adding 0x40 to the STATER register. Its the same as adding the binary byte '01000000'. By adding this binary value to the STATER register, you end up with the following values:
'00000000'
'01000000'
'10000000'
'11000000'

So what the code then does is check the 6th and 7th bit in STATER to determine which mode you are in to change the value of FREQR (the firerate in the ISR). If you want to add modes, the easiest is to add 0x20 (or '00100000') and double the number of modes. You would have to create another set of tests (test the 5th bit of STATER as well as the 6th and 7th) to load even more firerates.

Another thing you could do is change the main routine to start in the first mode (off for most) and then call the button test as a routine. If the button is not pressed, keep looping until it is pressed. Once it is pressed, move the new value of FREQR and wait for another button test looping until the button is pressed. Keep doing this for however modes you want.
[Quote from Gamermodz via Viking forums]
Don't be jealous your not half as smart. I hate ****tards like you. An ignorant redneck. Your nothing but a posing ******. Get the **** out of here, really, your claim to fame is an open source rapid fire code? You make me laugh. You think you have control over the modding market?  You couldn't create what I can and do. You are too ignorant with your outrageous assumptions and accusations. [/Quote]

Offline OxEpicOwnagexO

  • ½ Pint
  • *
  • Posts: 35
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: adding modes
« Reply #4 on: August 29, 2009, 10:02:01 PM »
hazer, thanks for your response, i added 0X40 to stater under variable definitions, is that the right spot? you are talking to a total noob to this, this is something im trying to learn, thats why i ask none other but the man that made the code, you. after i added 0X40 to stater under variable definitions, how do i add firerate for mode 4, 5, 6, etc.

Offline Hazer

  • x4675636B4E7574
  • Acidmods Alumni
  • Acid Modder
  • *
  • Posts: 583
  • Post quality +59/-0
Re: adding modes
« Reply #5 on: August 30, 2009, 05:40:13 AM »
This is from Burnmeup:

Code: [Select]
;******MAIN LOOP***************
Start
btfsc GPIO, PROGSTATE
goto Start ;wait for the fun to begin
call Wait10ms
btfsc GPIO, PROGSTATE ;button is down for 10ms
goto Start
Release
btfss GPIO, PROGSTATE ;wait for button release
goto Release
call Wait10ms
btfss GPIO, PROGSTATE ;wait for button release
goto Release

The above is the button test code.

Code: [Select]
movlw 0x40
addwf STATER, f ;cyclic change in state manipulates
;last 2 bits in STATER.

The next line adds 0x40 to STATER when the button is pressed.

Code: [Select]
btfsc STATER, 7 ;state 1 or 2
goto Continue01
btfsc STATER, 6
goto State2

Now we check the 6th and 7th bits.

Code: [Select]
movlw FIRERATE1 ;state 1, off
movwf FREQR
bcf FLAGS, LEDON ;turn off LED
goto Start
State2
movlw FIRERATE1 ;state 2, 42ms cycle
movwf FREQR
bsf FLAGS, LEDON ;turn on LED
goto Start
Continue01
btfsc STATER, 6
goto State4
movlw FIRERATE2 ;state 3, 30 ms cycle
movwf FREQR
bcf FLAGS, LEDON ;turn off LED
goto Start
State4
movlw FIRERATE3 ;state 4, 22ms cycle
movwf FREQR
bsf FLAGS, LEDON ;turn on LED
goto Start

and the last part is to load the FIRERATE# into FREQR depending on the states of bit 6 and bit 7.

The easiest way to change this code is to add 0x20 after a succesful button test. But then you will need to create tests for bit 5 in STATER and have 4 more branches and 4 more FIRERATES.

Or you could get rid of the main loop and cycle through modes with the brute force method that most usually do.

EDIT: I opened burnemup1 for this example, but its the same thing. Burnmeup2 has extra code to flahs the LED for the modes, but the button and bit tests are the same.
« Last Edit: August 30, 2009, 05:44:10 AM by Hazer »
[Quote from Gamermodz via Viking forums]
Don't be jealous your not half as smart. I hate ****tards like you. An ignorant redneck. Your nothing but a posing ******. Get the **** out of here, really, your claim to fame is an open source rapid fire code? You make me laugh. You think you have control over the modding market?  You couldn't create what I can and do. You are too ignorant with your outrageous assumptions and accusations. [/Quote]

Offline OxEpicOwnagexO

  • ½ Pint
  • *
  • Posts: 35
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: adding modes
« Reply #6 on: August 30, 2009, 05:14:19 PM »
maybe i should upload burnmeup1, i think all the extras in burnmeup 2 is throwing me off so bad, i found the main loop in burnmeup2

            ;******MAIN LOOP***************
Start
   btfsc   GPIO, PROGSTATE
   goto   Start            ;wait for the fun to begin
   call   Wait10ms
   btfsc   GPIO, PROGSTATE      ;button is down for 10ms
   goto   Start
Release
   btfss   GPIO, PROGSTATE      ;wait for button release         
   goto   Release
   call   Wait10ms
   btfss   GPIO, PROGSTATE      ;wait for button release         
   goto   Release

   movlw   0x20
   addwf   STATER, f         ;cyclic change in state manipulates
                        ;last 2 bits in STATER.
   movf   STATER, w
   call   WriteEE            ;store state

   btfsc   STATER, 7         ;state 1 or 2
   goto   Continue01
   btfsc   STATER, 6
   goto   State2
   movlw   FIRERATE1            ;state 1, off
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED
   goto   Start

^^^ am i actually changing anything here? notice how i changed 0X40 to 0X20, if im reading you correctly i did that right. i cant seem to figure out exacty where to add the fireates to, i know you said FREQR but  :dntknw: where thats at, i see it alot. this is disheartening and very complicated..... :cry2:

Offline Hazer

  • x4675636B4E7574
  • Acidmods Alumni
  • Acid Modder
  • *
  • Posts: 583
  • Post quality +59/-0
Re: adding modes
« Reply #7 on: August 30, 2009, 06:44:56 PM »
Your part way there. What you need to do now is add another test for bit 5:

  btfsc   STATER, 7         ;state 1 or 2
   goto   Continue01
   btfsc   STATER, 6
   goto   Continue02
   btfsc   STATER, 5       ;
   goto State2
   movlw   FIRERATE1            ;STATER = '00000000' off mode
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED
   goto   Start
State2
   movlw   FIRERATE1            ;STATER = '00100000'
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED
   goto   Start

Continue02
   btfsc   STATER, 5       ;
   goto State4
   movlw   FIRERATE2            ;STATER = '0100000'
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED
   goto   Start
State4
   movlw   FIRERATE3            ;STATER = '0110000'
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED
   goto   Start

Continue01
   btfsc   STATER, 6
   goto   Continue03
   btfsc   STATER, 5       ;
   goto State6
   movlw   FIRERATE4            ;STATER = '10000000' off mode
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED
   goto   Start
State6
   movlw   FIRERATE5            ;STATER = '10100000'
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED
   goto   Start

Continue03
   btfsc   STATER, 5       ;
   goto State8
   movlw   FIRERATE6            ;STATER = '1100000'
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED
   goto   Start
State8
   movlw   FIRERATE7            ;STATER = '1110000'
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED
   goto   Start


That pretty much is all the work, not including the LED blinking in BMU2. The first mode where STATER = '00000000' is handled inside the Interupt Service Routine to shut off the rapidfire for mode 1. What value is placed in FREQR does not matter for that mode.
« Last Edit: August 30, 2009, 09:06:38 PM by Hazer »
[Quote from Gamermodz via Viking forums]
Don't be jealous your not half as smart. I hate ****tards like you. An ignorant redneck. Your nothing but a posing ******. Get the **** out of here, really, your claim to fame is an open source rapid fire code? You make me laugh. You think you have control over the modding market?  You couldn't create what I can and do. You are too ignorant with your outrageous assumptions and accusations. [/Quote]

Offline OxEpicOwnagexO

  • ½ Pint
  • *
  • Posts: 35
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: adding modes
« Reply #8 on: August 30, 2009, 07:30:38 PM »
i basically took out some and pasted yours in there and didnt know how to add the fire rates. soooo when i went to build it this is what happens

Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p12F683 "Rapid Fire\Hex Codes\BurnMeUp2.asm" /l"BurnMeUp2.lst" /e"BurnMeUp2.err" /o"BurnMeUp2.o" /d__DEBUG=1
Error[116]   RAPID FIRE\HEX CODES\BURNMEUP2.ASM 362 : Address label duplicated or different in second pass (Continue02)
Error[113]   RAPID FIRE\HEX CODES\BURNMEUP2.ASM 380 : Symbol not previously defined (FIRERATE4)
Error[113]   RAPID FIRE\HEX CODES\BURNMEUP2.ASM 385 : Symbol not previously defined (FIRERATE5)
Error[113]   RAPID FIRE\HEX CODES\BURNMEUP2.ASM 393 : Symbol not previously defined (FIRERATE6)
Error[113]   RAPID FIRE\HEX CODES\BURNMEUP2.ASM 398 : Symbol not previously defined (FIRERATE7)
Halting build on first failure as requested.

Offline spurgurgle

  • Acidmods Alumni
  • Millennium Poster
  • *
  • Posts: 1121
  • Post quality +17/-1
  • Gender: Male
  • call me spurg
    • my blog
Re: adding modes
« Reply #9 on: September 04, 2009, 07:40:50 PM »
hi guys yeah ive bin avin a go at this aswell, again a complete noob. ive changed firerates before but not added modes.
ok so ive followed what bin said so far gave it a try.

this is wot ive edited so far (using burn me up 2)

            ;******MAIN LOOP***************
Start
   btfsc   GPIO, PROGSTATE
   goto   Start            ;wait for the fun to begin
   call   Wait10ms
   btfsc   GPIO, PROGSTATE      ;button is down for 10ms
   goto   Start
Release
   btfss   GPIO, PROGSTATE      ;wait for button release         
   goto   Release
   call   Wait10ms
   btfss   GPIO, PROGSTATE      ;wait for button release         
   goto   Release

   movlw   0x20
   addwf   STATER, f         ;cyclic change in state manipulates
                        ;last 2 bits in STATER.
   movf   STATER, w
   call   WriteEE            ;store state

   btfsc   STATER, 7         ;state 1 or 2
   goto   Continue01
   btfsc   STATER, 6
   goto   State2
   movlw   FIRERATE1            ;state 1, off
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED
   goto   Start
State2
   movlw   FIRERATE2         ;state 2, 42ms cycle
   movwf   FREQR
   bsf      FLAGS, LEDON      ;turn on LED
   goto   Start
Continue02
   btfsc   STATER, 5       ;
   goto State4
   movlw   FIRERATE3            ;STATER = '0100000'
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED 1/2 sec
   goto   Start
State4
   movlw   FIRERATE4            ;STATER = '0110000'
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED 1/2 sec
   goto   Start
Continue01
   btfsc   STATER, 6
   goto   State5
   movlw   FIRERATE5         ;state 3, 30 ms cycle
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED 1/2 sec
   movlw   0x0A
   movwf   TEMP3

Continue03
   btfsc   STATER, 5       ;
   goto State8
   movlw   FIRERATE6            ;STATER = '1100000'
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED 1/2 sec
   goto   Start
State8
   movlw   FIRERATE7            ;STATER = '1110000'
   movwf   FREQR
   bcf      FLAGS, LEDON      ;turn off LED 1/2 sec
   goto   Start

i also added firerates

;**********Speed settings: change these to change speed (0x05-0xFF)
FIRERATE1      equ      0x2f
FIRERATE2      equ      0x32
FIRERATE3      equ      0x37
FIRERATE4      equ      0x41
FIRERATE5      equ      0x53   
FIRERATE6      equ      0x21
FIRERATE7      equ      0x19

but it is coming up build fail

Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\hex codes\7mode.mcs".
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p12F683 "Copy of BurnMeUp2.asm" /l"Copy of BurnMeUp2.lst" /e"Copy of BurnMeUp2.err" /o"Copy of BurnMeUp2.o" /d__DEBUG=1
Error[116]   C:\HEX CODES\COPY OF BURNMEUP2.ASM 362 : Address label duplicated or different in second pass (Continue02)
Error[113]   C:\HEX CODES\COPY OF BURNMEUP2.ASM 376 : Symbol not previously defined (State5)
Error[116]   C:\HEX CODES\COPY OF BURNMEUP2.ASM 416 : Address label duplicated or different in second pass (State4)
Halting build on first failure as requested.

not quite sure wot to do now hmmm maybe just a hint please hazer
dont realy mind if i can get this workin its not for any particular mod i just want to play around n learn something about the mods. thanks for all ya jelp so far.


Sigs made by Ken and blazin from the AM Art team cheers guys.....
Spurgurgle d.t com
"I'm kinda like a typo, not quite right, but most people still understand me"

Offline Hazer

  • x4675636B4E7574
  • Acidmods Alumni
  • Acid Modder
  • *
  • Posts: 583
  • Post quality +59/-0
Re: adding modes
« Reply #10 on: September 05, 2009, 08:09:30 AM »
OxEpicOwnagexO : You forgot to define what the new FIRERATEs are. You do this at the negining of the file.

spurgurgle:  a GOTO instruction is a jump in the program. You have to label the program of where to jump to. You have a GOTO State5 without anywhere to go to. To be honest, if you copy the example I gave 2 posts before, it will do exactly what you need it to do. The difference between your code and mine is that First I test bit 7, then test bit 6 and then finally test bit 5 before assigning a FIRERATE. In yours, you test bit 7, then bit 6, but depending on that test you assign a FIRERATE. Immediately after that, you have a Continue02 (that does not have a GOTO instruction to jump to it) that then tests bit 5, but you can never get there.
[Quote from Gamermodz via Viking forums]
Don't be jealous your not half as smart. I hate ****tards like you. An ignorant redneck. Your nothing but a posing ******. Get the **** out of here, really, your claim to fame is an open source rapid fire code? You make me laugh. You think you have control over the modding market?  You couldn't create what I can and do. You are too ignorant with your outrageous assumptions and accusations. [/Quote]

Offline PspKicks316

  • Acidmods Alumni
  • Mad Bomber
  • *
  • Posts: 5709
  • Post quality +5/-4
  • Gender: Male
Re: adding modes
« Reply #11 on: September 05, 2009, 08:36:35 AM »
This thread is full of so much win for me.

Hey, Hazer, what language is this in?

Offline Hazer

  • x4675636B4E7574
  • Acidmods Alumni
  • Acid Modder
  • *
  • Posts: 583
  • Post quality +59/-0
Re: adding modes
« Reply #12 on: September 05, 2009, 09:40:52 AM »
Its in asm. There is a complete walkthrough of the code in the opensource threads.
[Quote from Gamermodz via Viking forums]
Don't be jealous your not half as smart. I hate ****tards like you. An ignorant redneck. Your nothing but a posing ******. Get the **** out of here, really, your claim to fame is an open source rapid fire code? You make me laugh. You think you have control over the modding market?  You couldn't create what I can and do. You are too ignorant with your outrageous assumptions and accusations. [/Quote]

Offline OxEpicOwnagexO

  • ½ Pint
  • *
  • Posts: 35
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Re: adding modes
« Reply #13 on: September 05, 2009, 06:31:16 PM »
ok change of plans, due to the new cod4 patch, i would like to change ur opensource code to striclty cod5 make my fast mode, and a 3 shot burst mode and a 5 shot burst mode....how hard you think that is?

Offline PspKicks316

  • Acidmods Alumni
  • Mad Bomber
  • *
  • Posts: 5709
  • Post quality +5/-4
  • Gender: Male
Re: adding modes
« Reply #14 on: September 05, 2009, 07:47:35 PM »
Cool thank you.

Offline Beneath

  • Guppy
  • *
  • Posts: 9
  • Post quality +0/-0
  • Acidmods User
Re: adding modes
« Reply #15 on: August 11, 2011, 09:51:21 PM »
I understand this is a extremely old topic but I think the info above fits in with my question...

I've been able to turn the BMU2 code to a 7, even 16 mode(Yes too many modes but I've enjoyed messing around with the asm and trying new things) But I don't get how people can get a 6 mode, 10, 12, 13 etc.

As from my understanding, you need a variable of 256
56/16(0x10)=16 (Hopefully you get what I'm saying)

I do not expect to be "spoon fed" this info but I'm just curious and I would like to attempt to code this myself!

Hazer mentions:
Quote
Or you could get rid of the main loop and cycle through modes with the brute force method that most usually do.

and

Quote
Another thing you could do is change the main routine to start in the first mode (off for most) and then call the button test as a routine. If the button is not pressed, keep looping until it is pressed. Once it is pressed, move the new value of FREQR and wait for another button test looping until the button is pressed. Keep doing this for however modes you want.

Is this how people achieve the 10 mode's etc?
If anyone can elaborate on this, that'd be great :tup:

Offline hyper999

  • Acidmods Alumni
  • Millennium Poster
  • *
  • Posts: 1158
  • Post quality +544/-3
  • Research and Development
Re: adding modes
« Reply #16 on: August 11, 2011, 11:18:05 PM »
People do it different ways but for example if you wanted change BMU from 4 mode to 3, including the off state as a mode, you could add some code to the state 3 section that sets the two last bits in stater to 1, this means that the next time 0x40 the last 2 bits will roll over back to 0.

Offline Beneath

  • Guppy
  • *
  • Posts: 9
  • Post quality +0/-0
  • Acidmods User
Re: adding modes
« Reply #17 on: August 28, 2011, 01:47:17 PM »
I've been toying with that the last week or so...

Finally learned how to control button presses though  :tup:

I still don't see how people can get 12 mode controllers...atleast not threw ASM..

Are we talking about something like this?

(Just some copy/paste, not intended to be "actual idea" but is this what were talking about when Hazer mentions
Quote
Another thing you could do is change the main routine to start in the first mode (off for most) and then call the button test as a routine. If the button is not pressed, keep looping until it is pressed. Once it is pressed, move the new value of FREQR and wait for another button test looping until the button is pressed. Keep doing this for however modes you want.

Code: [Select]
movlw FIRERATE1 ;state 2 movwf FREQR
bcf FLAGS, COD5MODE
bsf FLAGS, LEDON ;turn on LED
bcf FLAGS, BURSTACTIVE
; bsf FLAGS, BURSTACTIVE ;uncomment to activate burstfire for state 2
; movlw 0X04
; movwf BURSTRATE

Start
btfss FLAGS, TRIGOUT
call BursttestCG
btfsc FLAGS, TRIGOUT
call BursttestMX

btfsc GPIO, PROGSTATE
goto Start ;wait for the fun to begin
call Wait10ms
btfsc GPIO, PROGSTATE ;button is down for 10ms
goto Start
Release
btfss GPIO, PROGSTATE ;wait for button release
goto Release
call Wait10ms
btfss GPIO, PROGSTATE ;wait for button release
goto Release

movlw FIRERATE2 ;state 3
movwf FREQR
    bcf FLAGS, COD5MODE         ;uncomment to turn COD5 mode off/comment to turn COD5 mode on
    bsf FLAGS, COD5MODE ;uncomment to turn COD5 mode on/comment to turn COD5 mode OFF
    bcf FLAGS, BURSTACTIVE
    ;bsf FLAGS, BURSTACTIVE ;uncomment to turn burstfire on/comment to turn burstfire OFF
movlw 0X04                    ;burst count 0x02 = 3 shot burst/0x03 = 4 shot burst/0x04 = 5 shot burst
bcf FLAGS, LEDON ;turn off LED 1/2 sec
movlw 0x0A
movwf TEMP3


..I've been looking at a PIC Basic Pro Source that Robbo used and thats the only way I found that I see a possiblity in 12 mode, 9 mode etc.

Just throwing stuff out there, I just normally mess with the asm and see what happens! haha It keeps me busy!
« Last Edit: August 30, 2011, 04:22:02 PM by Beneath »

 

SMF spam blocked by CleanTalk
SimplePortal 2.3.5 © 2008-2012, SimplePortal