Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > SHX/SHY
2012-11-26 14:30
Oswald

Registered: Apr 2002
Posts: 5017
SHX/SHY

I cant seem to get them working. I'm not sure wether the value for the AND comes from the PC counter or from the destination address, anyway neither running code at $ff00 or storing to $ff00 does work. maybe vice does not support this illegal?

edit: vice 2.2 unstable, x64 on win7.
2012-11-26 14:43
chatGPZ

Registered: Dec 2001
Posts: 11100
2.2 o_O i wouldnt expect that to work quite right =P

that said, SHX/SHY are both unstable, and have funny side effects when used in a badline/during DMA. (the bank the value is stored can turn into the value stored). i wouldnt use it at all in code that i want to run reliably on real c64s =)
2012-11-26 15:32
Endurion

Registered: Mar 2007
Posts: 72
Couldn't Vice emulate the instability of illegal opcodes as well, so coders aren't tempted in the first case? :)
2012-11-26 15:42
chatGPZ

Registered: Dec 2001
Posts: 11100
it could (and should and will) once the behaviour is exactly known :) - and it DOES emulate at least some of it (some "emulamer" thingy required it - which doesnt run reliably on all real C64s, btw)
2012-11-26 15:46
Fresh

Registered: Jan 2005
Posts: 101
Try using $fe00: SHX/Y => save [X/Y & (PCH+1)]
Some more info in this thread:
http://noname.c64.org/csdb/forums/index.php?roomid=11&topicid=3..

Edit:
:BasicUpstart2(start)
.pc=$0900
start:
	shx $fe00,y
	dex
	iny
	bne start
	dex
	jmp start

Execute and use vice monitor to look at the ram behind $fe00 (bank ram).
2012-11-26 17:18
Oswald

Registered: Apr 2002
Posts: 5017
Thanks for the help. The mistake is on Graham's page: "{adr}:=X&H" which leaves me anding with #$00 when running the code :P
2012-11-26 17:40
Cruzer

Registered: Dec 2001
Posts: 1048
As far as I know SHX/SHY have been emulated correctly in Vice for a long time, including the instabilities. And yes, it's hi-byte of the destination address + 1.

The instability is only that the and'ing sometimes is skipped, so e.g. if you have shy $7e00,x and expected it be anded by $7f, it sometimes isn't anded at all. But for $fe00 there's no problem, since anding with $ff is the same as not anding. And if your values don't mind whether they are anded, e.g. if they are all $00-$7f for shy $7e00,x, there is also no difference whether the and works or not.
2012-11-26 18:50
chatGPZ

Registered: Dec 2001
Posts: 11100
"The instability is only that the and'ing sometimes is skipped"
there is another problem when indexing crosses a page boundary, then the page the value is stored might be the same as the value itself.
2012-11-26 21:09
Cruzer

Registered: Dec 2001
Posts: 1048
Groepaz: Interesting, guess I haven't tried crossing page boundaries.
2012-11-27 04:51
Oswald

Registered: Apr 2002
Posts: 5017
"it could (and should and will) once the behaviour is exactly known :)"

why isnt it known? every single transistor has been reverse engineered. visual6502 anyone ?
2012-11-27 09:47
Ninja

Registered: Jan 2002
Posts: 404
It is known. I somewhere have a test-program which reliably does SHX/Y with no AND happening because it waits for the VIC to take over the bus. I intended to make that a bit more robust and write an VN article about it, but well, -EBUSY. I seem to recall that idea was later mentioned in this forum, too.
 
... 16 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Dr. Doom/RAD
Scooby/G★P/Light
Matt
Guests online: 116
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.9)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top NTSC-Fixers
1 Pudwerx  (10)
2 Booze  (9.7)
3 Stormbringer  (9.7)
4 Fungus  (9.6)
5 Grim Reaper  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.043 sec.