Author Topic: quick question? please help!  (Read 1273 times)

Offline Layman

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +1/-0
  • Gender: Male
  • Acidmods User
quick question? please help!
« on: February 29, 2012, 11:42:30 AM »
i have been looking into how to write code in c and started making a few of my own but i just carnt understand this bit of hazers code? ive looked and looked at other peoples to get to understand how to but could some one help? if i wanted to add one more mode would i have to alter this? thanks for your help, any help is welcome, i appreciate every little bit of help here is the part of the code im stuck with and carnt understand;

 
Code: [Select]
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

Offline magic_man185

  • Who Farted ???
  • *
  • Posts: 229
  • Post quality +16/-0
  • Gender: Male
  • Acidmods User
Re: quick question? please help!
« Reply #1 on: February 29, 2012, 12:37:38 PM »
Hazer actually wrote a walkthrough of each piece of his code explaining what it does, you can find it at http://forums.xbox-scene.com/index.php?showtopic=679378.  Essentially, this section of code is testing the bits of the state variable that are used to determine what state the chip is in.

Offline Layman

  • Chief squatting Hard
  • *
  • Posts: 18
  • Post quality +1/-0
  • Gender: Male
  • Acidmods User
Re: quick question? please help!
« Reply #2 on: February 29, 2012, 01:58:49 PM »
ok, i looked over hazers explanation, i want to add two more modes into the program is this possible, because hazer wrote " By adding the value of 0x40 to the register STATER, I can cycle through 4 states. 0x40 in binary is the same as b’0100 0000’. By adding 0x40 I switch between the following values in binary:
b’00000000’; b’01000000’; b’10000000’; b’1100000’
So I create a 4 mode STATER and use bits 6 and 7 in the register to test which state I am in" so i was thinking if i halved the 0x40 and made it twenty and did the same to bits 6 and 7 could i add more modes or am i thinking too hard? thanks

EDIT: THANK YOU FOR YOUR ALL HELP, but i have CRACKED it lol i found a way to get 8 modes on all hazers codes, thank you hazer for letting me have your codes, its very simple when thought about if you want to know post here and i will show you  :w00t:

[gmod]Do Not Double Post click modify to edit post.[/gmod]
« Last Edit: February 29, 2012, 04:06:08 PM by Rodent »

 

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