6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Oct 04, 2024 3:23 am

All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Wed Aug 02, 2017 3:33 pm 
Offline
User avatar

Joined: Wed May 11, 2016 4:15 am
Posts: 24
Location: Texas
whartung wrote:
The only real problem with pushing the elements on the stack is that it's not really a viable option on the 6502, not on the system stack at least, and especially not string values. You can push them on A stack (Forth uses the top of Zero page and indexes with X), but that's using X as your stack pointer, vs the systems. You also still have the problem with stack scarcity for something large like a string.

You could still use the stack if you just push addresses (address of the pattern string, address of the list of arguments (which can be 2 byte integers, or pointers), and the address of the destination buffer).


I see that being a problem when I try this on the 6502 as I'm having to juggle registers on x86.

What I've done on my x86 project is push the address of the pattern string and all string arguments onto the stack. Value arguments are just passed as such.


Last edited by N2TheRed on Thu Aug 03, 2017 11:03 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 02, 2017 5:35 pm 
Offline
User avatar

Joined: Wed May 11, 2016 4:15 am
Posts: 24
Location: Texas
I find it hard to believe that I was able to get part of it to work.


Last edited by N2TheRed on Thu Aug 03, 2017 11:04 pm, edited 5 times in total.

Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 02, 2017 6:08 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8521
Location: Southern California
I think the 6502 stacks treatise will be very helpful, especially the following chapters (although it's good to read it all, in order):

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 02, 2017 6:23 pm 
Offline
User avatar

Joined: Wed May 11, 2016 4:15 am
Posts: 24
Location: Texas
GARTHWILSON wrote:
I think the 6502 stacks treatise will be very helpful, especially the following chapters (although it's good to read it all, in order):


I have that saved to my favorites!


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 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:  
cron