Trying to convert something to ASM6 - this is mostly just for future knowledge. I have the syntax bcs *+4, which I'm assuming based on the code is something along the lines of 'branch 4 lines'. I can handle this pretty easily with labels, but just curious if there is a reference to asm6 shortcuts to branching method syntax?
[Subject Fairy was here]
In some assemblers, * means the current PC. IIRC, in ASM6 it's $, so the instruction becomes bcs $+4. This is not specific to branching, the value of the PC can be used in other situations.
Perfect, got it! Thanks
Specifically, it's branch 4 bytes forward, not 4 lines.
IMO probably worth converting to a label, though I don't know the details of the example you're working with. I think that kind of use normally only comes up because of a lack of cheap local labels in the assembly language being used.
For the sake of beginners reading this thread, PC in this instance refers to the program counter used at compile time by the assembler, not the value in the PC register in the NES's CPU at runtime.
Thanks for the clarification, guys. I was able to decode and do it with labels in ASM6 just fine, but it's good to have the knowledge
In this case, $ means the address of the branch instruction itself, and $ + 4 means you go forward two bytes after the branch instruction.
This is different than the way a branch instruction is actually encoded. Branching forward 0 means proceeding to the next instruction, but branching to $ + 0 means you go back to the branch instruction itself. It's encoded as -2, and it goes in an infinite loop.