It is currently Wed Nov 22, 2017 3:18 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Fri Aug 25, 2017 4:47 pm 
Offline
User avatar

Joined: Sat Jul 12, 2014 3:04 pm
Posts: 950
BIT $2002, BIT $BUTTON_STATE for B in V; a few "branch always" or otherwise wanting a flag that doesn't need a refresh instruction through some routine. Not used much signed arithmetic yet for the other purpose.


Top
 Profile  
 
PostPosted: Fri Aug 25, 2017 8:09 pm 
Offline

Joined: Wed Nov 30, 2016 4:45 pm
Posts: 93
Location: Southern California
I am very, very glad (zp,X) is there. It is used all the time in situations where you have a data stack in ZP, as stack cells may contain addresses (often calculated) to use as pointers. This is done constantly in the Forth programming language, but you can do the same kind of thing in assembly too, and some other HLLs use it as well. X becomes the data stack pointer. Anticipating a couple of objections: It may initially seem like that's too big of an expense; but when you do it this way, many of the usual needs for X go away. The few times it is needed for something else, it can be saved and restored. Taking space in ZP for a data stack may also seem unrealistic when ZP space is in such high demand; but when you do it this way, many of the ZP variables will no longer be needed. It really does work out well. I discuss it in chapters 4 through 8 of my 6502 stacks treatise.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources


Top
 Profile  
 
PostPosted: Fri Aug 25, 2017 10:59 pm 
Offline
User avatar

Joined: Wed Oct 16, 2013 7:55 am
Posts: 130
Oziphantom wrote:
tepples wrote:
I learned EOR-ADC-EOR-BVC, though there were several places that could have used it.
What does the EOR-ADC-EOR-BVC trick achieve?


I wrote a blog post about this explaining its usefulness in detail: http://www.dustmop.io/blog/2015/05/20/s ... detection/


Top
 Profile  
 
PostPosted: Fri Aug 25, 2017 11:17 pm 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 256
tepples wrote:
tokumaru wrote:
I imagine that there are other uses of a pointer table on zero page. But 6502 coders who learned on Commodore 64 or Apple II won't have a lot of experience with it because Microsoft BASIC in ROM ate so much of zero page for itself.

Maybe on the Apple ][ but on the C64 only beginner programmers would suffer the issue. You can bank out all ROM, or just BASIC on a C64 allowing you to get all 64K of RAM and all of ZP ( minus 0,1) for your own uses. Most early games for the C64 keep the KERNAL in but not the BASIC ROM, later games tend to ditch both for the most part.

For other uses of (zp,x) see http://csdb.dk/forums/index.php?roomid= ... allposts=1 kefren bars seems to be common use case, as does Audio Engines, Ray casters and Forth.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group