Jump to content

Photo

SAX opcode


6 replies to this topic

#1 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 21,890 posts
  • Location:The land of Gorch

Posted Thu Feb 19, 2009 9:33 PM

Usage:
LDA #AND_VALUE
SAX $ram

Replacement for:
TXA
AND #AND_VALUE
STA $ram


Is this unstable with some versions of the 2600?

#2 Omegamatrix OFFLINE  

Omegamatrix

    Quadrunner

  • 6,233 posts
  • Location:Canada

Posted Thu Feb 19, 2009 10:10 PM

AFAIK the SAX opcode is stable. I have a list of illegal opcodes, which is one that you actually posted Nukey. I crossed all the ones off that TJ said were unstable in a thread about FB2 compatibility. I can't remember if Batari said SAX was giving him problems or not on the FB2, but I do remember some of the illegal opcodes weren't accounted for when they made the chip.


I also once remember a post by Dennis Debro (on the Stella Mailing list, I think) where he talks of Airlock using SAX (by accident). This is where:

STA	SWBCNT		; 4
LF021:
	LDA	#$02		  ; 2

....

LFB89:
	STA	WSYNC		 ; 3
	DEX				  ; 2
	BNE	LFB89		 ; 2
	JMP	LF01F		 ; 3 jumps between the operator and operand

Now SWBCNT = $0283, so that will preform SAX ($02,X). I'm guessing the strobe will preform a WSYNC, but never tested the theory. It'd be easy to test by fixing the jump to go to $F021 instead, and see if you drop a scanline.

I've never heard of anyone having trouble with Airlock though, so I presume SAX is stable.


Edit: I had the wrong addressing mode of SAX. It is SAX ($02,X) in this case, not SAX $02 as I originally posted. Thanks Batari. :)

Edited by Omegamatrix, Fri Feb 20, 2009 7:13 PM.


#3 supercat OFFLINE  

supercat

    Quadrunner

  • 6,401 posts

Posted Thu Feb 19, 2009 11:06 PM

Is this unstable with some versions of the 2600?


I wouldn't expect so. During one half of each 6502 cycle, the internal data buses are unconditionally set to all "1"s; during the other half, any register which is supposed to output its contents will set to "0" any bus wire which should be "0". This requires considerably less circuitry than allowing each register to output both "1"'s and "0"'s. It also means that in case two registers try to put data on a bus simultaneously, any bit which is "0" in either registers will be "0" on the bus.

Some opcodes have some odd behaviors I don't understand, but SAX is very straightforward.

#4 Hornpipe2 OFFLINE  

Hornpipe2

    Moonsweeper

  • 403 posts
  • Chiptune Aficionado
  • Location:Conway, AR, USA

Posted Fri Feb 20, 2009 10:26 AM

I've never heard of anyone having trouble with Airlock though, so I presume SAX is stable.


Well this probably explains why the screen rolls with Airlock on the FB2:
http://kennedy.greg..../fb2compat.html

Interestingly it sounds like someone could bang out an FB2-compatible Airlock. I may try it here in a bit.

#5 Hornpipe2 OFFLINE  

Hornpipe2

    Moonsweeper

  • 403 posts
  • Chiptune Aficionado
  • Location:Conway, AR, USA

Posted Fri Feb 20, 2009 3:45 PM

I made the change as suggested. From what I can tell, one scanline is dropped from the title screen. (Actually this game is weird because it doesn't keep a constant number of scanlines anyway - at boot it is normally 257, then it switches to 256 after about a second or two, and during gameplay it is 260. With the hack it becomes 256/255 -> 260.)

I wonder if this game rolls on real hardware as a result of the lack of consistency, and if that is what the reported FB2 problem is (as opposed to an unsupported illegal opcode). I always want for testers : )

Attached Files


Edited by Hornpipe2, Fri Feb 20, 2009 3:46 PM.


#6 batari OFFLINE  

batari

    )66]U('=I;B$*

  • 6,680 posts
  • begin 644 contest

Posted Fri Feb 20, 2009 3:56 PM

SBX gave me trouble on the FB2, but SAX did not. I wrote a game with several illegal opcodes, including SAX, and I recall only needing to remove SBX to get it to work.

Still, FB2 compatibility should not be a consideration for a homebrew, IMO.

EDIT: Airlock performs SAX ($02,X), not SAX $02.

Edited by batari, Fri Feb 20, 2009 3:58 PM.


#7 Omegamatrix OFFLINE  

Omegamatrix

    Quadrunner

  • 6,233 posts
  • Location:Canada

Posted Fri Feb 20, 2009 7:23 PM

I'd try it for you Hornpipe2, but I don't have a modded FB2. I'm not sure the FB2 is compatible with the Krok either. I imagine that fix will work though. Looking at your list there are a whole pile of Superchip games, games that use unusual bankswicthing (like FE), and some homebrews that I presume are using some tricks or illegal ops.


I wonder why some of the F8 games don't work though? I've read Galaxian preforms some tricks to get more sprites on the screen, but WaterWorld? Of course I've never really played WW except to plug in the cartridge and see if powers up, ha ha.




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users