6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 01, 2024 11:24 pm

All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Sat Oct 28, 2006 10:24 am 
Offline

Joined: Tue Nov 18, 2003 8:41 pm
Posts: 250
Quote:
A calculated jump table I CAN see using jmps to do the return, a quasi JSR setup. But using actual JSRs I simply cannot.


If I understand what's being suggested ..

The stack is the jump table and you set up the jump for the return
before you do the jsr. The rts is sort of a double indirect jump
through a special location, the stack pointer.

You'd still have to do a software stack if you want nested subroutines.

I can't think how you'd manage with interupts if there were more than
one possible return address though (and if there's only one possible,
it'd be implied, ie wouldn't necessarily have to be set up prior to a jsr).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 28, 2006 7:03 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
k, you can set the stack so it can point to ROM. Wait, ok, got it, stack pointer increments through the returns table.

One trick to avoid other variables would be to have the program routine actually be what is going on or the state. bunch of compare and jmp festivities, sort of a choose your own adventure thing based on a conditional, then any other would created a new conditional. This would mean duplicated routines for every possible variable state but it could add to the versatility.

start
get the work variable
if variable = 1 then goto routine 1a
if variable = 2 then goto routine 2a
if variable = 3 then goto routine 3a
goback to start

1a
get letter variable
if letter = a then goto routine 1a1
if letter = b then goto routine 1b1
if letter = c then goto routine 1c1

2a
get letter variable
if letter = a then goto routine 2a1
if letter = b then goto routine 2b2
if letter = c then goto routine 2c3

3a
get letter variable
if letter = a then goto routine 3a1
if letter = b then goto routine 3b2
if letter = c then goto routine 3c3





Anyhow, you see where my line of logic is going here.
(this is the thinking of someone who had the nervous breakdown, and is still kind of nuts, so I hope you can follow the logic. It SEEMS ok, but my thought processes are kind of suspect right now.

_________________
"My biggest dream in life? Building black plywood Habitrails"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Nov 15, 2006 12:33 am 
Offline

Joined: Tue Dec 30, 2003 10:35 am
Posts: 42
Quote:
My application just has to monitor serial port data and respond to a certain string, so I really didn't need any temporary storage since the data comes in byte by byte.

How did I forget the program counter as 16 bits of storage! Reading the above I remembered since the hidden state of where you are in the string is the program counter. This technique of encoding state into the program counter has important applications on modern CPUs too, where you do it for efficiency since it allows the code to know the state at assembly/compile time.

Someone asked about JSR being unusable: the instruction would be usable though mostly useless, as a JMP would do mostly the same thing in less time (except decrementing the stack by two). JSR doesn't care whether the memory writes actually go somewhere. Even RTS doesn't care whether there is any memory to read from; it just fetches whatever is on the data bus and jumps to that (plus one, of course).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Nov 15, 2006 3:34 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
In a very early design iteration for the Kestrel-1, I was thinking of mapping a few bits of the address bus to various control signals for the monitor (e.g., A14 -> HSYNC, A13 -> VSYNC, A12 -> Display Enable). This means that the ROM image can itself be no more than 4K in this case, which is repeated on 4K boundaries. That way, to control these signals, you'd just jump to different locations in the ROM.

Thank goodness I don't need to do that anymore. :D


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 10 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: