Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > illegal opcodes that f
2003-02-05 09:02
Dwangi

Registered: Dec 2001
Posts: 130
illegal opcodes that f

2003-02-05 09:04
Dwangi

Registered: Dec 2001
Posts: 130
hmm sorry something went wrong here the topic should be "illegal opcodes that fuxx up or something" :)

Anyway.. can anyone tell me any illegal opcodes that works fine on a c64 but that dont work on c128?



2003-02-05 09:20
Ninja

Registered: Jan 2002
Posts: 411
Try looking here:

http://mars.wiwi.uni-halle.de/ec64/technical/aay64/c64/ibmain.h..

The instable opcodes are marked, dunno if they fail on C128 only...
2003-02-05 10:42
Graham
Account closed

Registered: Dec 2002
Posts: 990
http://oxyron.net/graham/opcodes.html
2003-02-05 10:46
Graham
Account closed

Registered: Dec 2002
Posts: 990
forgot to say: the blue marked opcodes are unstable but still usuable (like SHX/SHY which is used quite often), the red marked ones are completely unusable atleast on some machines.
2003-02-05 16:38
Ninja

Registered: Jan 2002
Posts: 411
graham: could you please give me a hint what SHX/SHY could be used for when from time to time the "&H" is dropped?
2003-02-07 18:52
Graham
Account closed

Registered: Dec 2002
Posts: 990
Quote: graham: could you please give me a hint what SHX/SHY could be used for when from time to time the "&H" is dropped?

the "&H" is only an unwanted side-effect which originally wasn't supposed to be.

SHX and SHY should have been STX (adr),Y and STY (adr),X.
due to some internal trouble in the 6502 core the value which is going to be stored to ram is on the internal cpu bus at the same time as the incremented high-byte of the adress. this results in a logical AND in most cases.

These two opcodes exist in legal form for zeropage adresses, but sometimes you could use them for other memory aswell, so if you really badly need them, you use SHX or SHY and choose an adress which doesn't harm the values you want to store (usually that would be $3E00, $7E00 or $FE00). for example, oneder uses these illegal opcodes to make some calculations a lot faster. if the demo is run on a cpu which doesn't have these illegal opcodes, an alternative code is executed which is slower, but i think this doesn't matter because that usually would mean that the demo is run on supercpu or something similar.
2003-02-07 19:52
Ninja

Registered: Jan 2002
Posts: 411
Graham: Thanx! That is a fucking cool trick :)

So, it looks like the 6502-designers at least tried to implement STX xxxx,Y but simply failed?
2003-02-07 21:16
Stryyker

Registered: Dec 2001
Posts: 468
Failed? I have no idea how they make an opcode legal or illegal but if you search the online Transactor achives there is some writing on how the 6502 possible decodes the opcode (bitwise) which helps further explain all the patterns. Maybe they thought at a later date we will debug it, much like how one of the shift or roll instructions wasn't added until June 1976 or so.
2003-02-08 13:03
Graham
Account closed

Registered: Dec 2002
Posts: 990
anyway, they never really fixed these opcodes, but they were "replaced" by STZ which usually means: store zero to ram (hardly any 6502-based cpus actually have a Z-register). this way they didn't need to fix anything, just pull everything to zero. that's also the reason why the 65816 does indeed have STX and STY indexed adressing modes, but on other opcodes. they wanted to keep the STZ's on $9C and $9E to remain compatible with previous designs.
2003-02-11 10:02
chatGPZ

Registered: Dec 2001
Posts: 11386
btw for some weirdo opcodes in the 65xx line, checkout the HuC6280 (which is a 65c02 derivate used in NECs PCEngine) ... some neat things there. (i like the way bankswitching is done in zeropage vs i/o... kindof smart :))
 
... 13 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
leonofsgr/Singular C..
Conjuror
New Design/Excess
ΛΛdZ
CreaMD/React
Andy/AEG
Guests online: 142
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 Tim  (9.7)

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