Jump to content



0

question on assembler notation found in Yar's revenge


2 replies to this topic

#1 xucaen OFFLINE  

xucaen

    Star Raider

  • 94 posts
  • Looking for new owner for commodore 64
  • Location:Ma

Posted Thu Jun 29, 2006 10:56 AM

Hi, I was just looking at the disassembly of Yar's Revenge courtesy of Debro.
Around line 3248, there is a block of code that controls the swirl motion.
The code uses the character "|".
Now, I know in C and in C++ this is a bit operator for OR.
How is it being used here? I did searches in my 6502 documents and couldn't find any reference to it.

SwirlMotionTable

   IF COMPILE_VERSION = NTSC
   
	  .byte HMOVE_0  | 10
	  .byte HMOVE_L2 | 11
	  .byte HMOVE_L3 | 13
	  .byte HMOVE_L5 | 14
	  .byte HMOVE_L6 | 0
	  .byte HMOVE_L5 | 2
	  .byte HMOVE_L3 | 3
	  .byte HMOVE_L2 | 5
	  .byte HMOVE_0  | 6
	  
   ELSE

	  .byte HMOVE_0  | 9
	  .byte HMOVE_L3 | 10
	  .byte HMOVE_L4 | 12
	  .byte HMOVE_L6 | 13
	  .byte HMOVE_L7 | 0
	  .byte HMOVE_L6 | 3
	  .byte HMOVE_L4 | 4
	  .byte HMOVE_L3 | 6
	  .byte HMOVE_0  | 7
	  
   ENDIF



#2 djmips OFFLINE  

djmips

    Dragonstomper

  • 591 posts
  • scrolling
  • Location:Seattle

Posted Thu Jun 29, 2006 10:59 AM

Yup, you are correct. It's bitwise OR.


For example. Referencing the source you are talking about

HMOVE_0 = $70

So .byte HMOVE_0 | 10 would generate $7A (since 10 = $0A)

Edited by djmips, Thu Jun 29, 2006 11:36 AM.


#3 vdub_bobby OFFLINE  

vdub_bobby

    Quadrunner

  • 5,831 posts
  • Boom bam.
  • Location:Seattle, WA

Posted Thu Jun 29, 2006 11:41 AM

Quote

I did searches in my 6502 documents and couldn't find any reference to it.
That's because it is pseudo-code for the assembler, not code for the 6502, so you'll want to look at the docs for the assembler - DASM, almost certainly.

I.e., this:
lda #($10|$01)
Will be assembled as:
lda #$11

For that reason, you can't bitwise OR two variables.

Edited by vdub_bobby, Thu Jun 29, 2006 11:42 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users