42bs Posted June 12, 2020 Share Posted June 12, 2020 Dropped by this page by accident and think it is worth mentioning: http://wiki.nesdev.com/w/index.php/Identity_table 2 Quote Link to comment Share on other sites More sharing options...
+karri Posted June 12, 2020 Share Posted June 12, 2020 New op-codes. Not bad. Quote Link to comment Share on other sites More sharing options...
+Stephen Posted June 12, 2020 Share Posted June 12, 2020 No idea how that works, but very cool! Quote Link to comment Share on other sites More sharing options...
42bs Posted June 12, 2020 Author Share Posted June 12, 2020 10 minutes ago, Stephen said: No idea how that works, but very cool! Very simple: The "identitiy table" contains bytes 0..$FF. So if you do a "lda table,x" you get the same value as stored in x: Eg. x = 10; table + 10 contains 10 => lda table,x => lda #10 So a "and table,x" is the same as "and X". Like a multiplication table: If you fill a table with values *2, a "lda table,x" returns the double of x HTH 1 Quote Link to comment Share on other sites More sharing options...
laoo Posted June 12, 2020 Share Posted June 12, 2020 And imagine how funny instructions are there given the table is not identity table 1 Quote Link to comment Share on other sites More sharing options...
Songbird Posted June 13, 2020 Share Posted June 13, 2020 That's pretty cool! I would not have thought of doing that, but I could see where it would save some instruction space if you can give up the RAM to hold the table. Quote Link to comment Share on other sites More sharing options...
enthusi Posted June 15, 2020 Share Posted June 15, 2020 It is more interesting for speed rather than space at least the use cases I know of. Not by much though. STY *+4: CMP #23 is not that bad either ? 1 Quote Link to comment Share on other sites More sharing options...
laoo Posted June 16, 2020 Share Posted June 16, 2020 Generally they have many cool tips on this http://wiki.nesdev.com forum. Quote Link to comment Share on other sites More sharing options...
Cyprian Posted June 17, 2020 Share Posted June 17, 2020 On 6/12/2020 at 12:40 PM, 42bs said: Dropped by this page by accident and think it is worth mentioning: http://wiki.nesdev.com/w/index.php/Identity_table neat trick Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.