Click here to Skip to main content
15,920,896 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Memories... Pin
Rick York21-May-18 11:49
mveRick York21-May-18 11:49 
GeneralRe: Memories... Pin
Kornfeld Eliyahu Peter21-May-18 10:42
professionalKornfeld Eliyahu Peter21-May-18 10:42 
PraiseRe: Memories... Pin
Daniel Pfeffer21-May-18 9:06
professionalDaniel Pfeffer21-May-18 9:06 
GeneralRe: Memories... Pin
CodeWraith21-May-18 9:55
CodeWraith21-May-18 9:55 
GeneralRe: Memories... Pin
kalberts21-May-18 11:11
kalberts21-May-18 11:11 
GeneralRe: Memories... Pin
CodeWraith21-May-18 11:36
CodeWraith21-May-18 11:36 
GeneralRe: Memories... Pin
Marc Clifton21-May-18 14:30
mvaMarc Clifton21-May-18 14:30 
GeneralRe: Memories... Pin
CodeWraith21-May-18 20:35
CodeWraith21-May-18 20:35 
The processor does not have a fixed program counter, nor does it have instructions for calling or returning from a subroutine.

Instead, I can load an address into any of it's 16 registers and simply make it the current program counter to call a routine and simply make the previous register, which still points back to the last address where it left off, progrogram counter again to return.

That's the simplest technique. It does not involve any use of the stack at all. The stack, by the way, works in a similar fashion. I can load an address into any register at any time and make this register the current stack pointer.

Implementing a stack protocol for subroutines means writing two routines using this basic calling technique, one to call another routine and the other one to return. I will have to pass the address of the routine that is to be called and the parameters. Adding a further parameter for the memory page of the routine and doing the switching in the calling routine actually is very simple. The page of the calling routine is saved on the stack, along with the return address. Both are restored when returning.

Both the stack(s) and the routines for calling and returning must not be in the paged memory and then everything is well for the code and calling subroutines. For the beginning logical pages will be identical to the physical pages the code will be loaded to, to keep it simple. Later I may use an allocation table to automatically convert logical page numbers to physical page numbers.
I have lived with several Zen masters - all of them were cats.

His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.

GeneralRe: Memories... Pin
CPallini21-May-18 20:52
mveCPallini21-May-18 20:52 
GeneralRe: Memories... Pin
CodeWraith21-May-18 22:17
CodeWraith21-May-18 22:17 
GeneralRe: Memories... Pin
Rage21-May-18 21:44
professionalRage21-May-18 21:44 
GeneralRe: Memories... Pin
kalberts22-May-18 7:07
kalberts22-May-18 7:07 
GeneralRe: Memories... Pin
Rick York22-May-18 8:21
mveRick York22-May-18 8:21 
GeneralRe: Memories... Pin
kalberts22-May-18 9:12
kalberts22-May-18 9:12 
GeneralRe: Memories... Pin
Rick York22-May-18 10:15
mveRick York22-May-18 10:15 
GeneralRe: Memories... Pin
glennPattonWork321-May-18 22:36
professionalglennPattonWork321-May-18 22:36 
GeneralRe: Memories... Pin
CodeWraith21-May-18 22:36
CodeWraith21-May-18 22:36 
GeneralRe: Memories... Pin
kalberts22-May-18 7:18
kalberts22-May-18 7:18 
GeneralRe: Memories... Pin
CodeWraith24-May-18 20:18
CodeWraith24-May-18 20:18 
GeneralRe: Memories... Pin
DerekT-P22-May-18 10:42
professionalDerekT-P22-May-18 10:42 
GeneralRe: Memories... Pin
Jinto Jacob23-May-18 22:25
professionalJinto Jacob23-May-18 22:25 
GeneralW3.CSS Pin
gggustafson21-May-18 6:55
mvagggustafson21-May-18 6:55 
GeneralRe: W3.CSS Pin
Kornfeld Eliyahu Peter21-May-18 7:19
professionalKornfeld Eliyahu Peter21-May-18 7:19 
GeneralRe: W3.CSS Pin
gggustafson21-May-18 7:30
mvagggustafson21-May-18 7:30 
GeneralRe: W3.CSS Pin
W Balboos, GHB21-May-18 7:38
W Balboos, GHB21-May-18 7:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.