Click here to Skip to main content
15,895,667 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: How would you slice up this turkey? Pin
CodeWraith15-May-20 6:39
CodeWraith15-May-20 6:39 
GeneralRe: How would you slice up this turkey? Pin
kalberts15-May-20 5:07
kalberts15-May-20 5:07 
GeneralRe: How would you slice up this turkey? Pin
fd975015-May-20 6:25
professionalfd975015-May-20 6:25 
GeneralRe: How would you slice up this turkey? Pin
CodeWraith15-May-20 8:49
CodeWraith15-May-20 8:49 
GeneralRe: How would you slice up this turkey? Pin
Rick York15-May-20 6:01
mveRick York15-May-20 6:01 
GeneralRe: How would you slice up this turkey? Pin
kalberts15-May-20 8:44
kalberts15-May-20 8:44 
GeneralRe: How would you slice up this turkey? Pin
Rick York15-May-20 10:13
mveRick York15-May-20 10:13 
GeneralRe: How would you slice up this turkey? Pin
CodeWraith15-May-20 11:34
CodeWraith15-May-20 11:34 
Rick York wrote:
That's what I was wondering about - how can this be handled automatically for software by you and/or the OS? I doubt the compiler for that CPU has any knowledge of segment registers or anything other than what was called "small model."


It's actually very easy. The processor comes from the time of home built single board computers. In many ways it was a little ahead of its time in several ways, but was very limited by slow and small memories and expensive storage devices. With more memory and some sort of mass storage to fill that memory it can really eat any 8 bit processor of its time for breakfast and seriously stray into 16 bit territory.

It's true, the processor does not know anything about segment registers. That's ok for the stack segment. It should only be changed under certain conditions, so that will be done by the code and only when these conditions are met.

The data segment can and should be changed as needed. I have little choice but to leave that to the code as well.

At least I can do something for the code segment. Due to its RISC architecture, the processor does not have instructions to call subroutines or return from them. Instead, it loads the address of a subroutine into any one of its 16 working registers and make that register the new program counter. Returning is just as easy. Leave the original program counter alone in the subroutine and make it the program counter again.

Usually you have only two such simple procedures. One is used to call subroutines with a more elaborate protocol for passing parameters and saving registers. The other one handles returning from a subroutines, restoring the registers that were saved in the calling procedure and passing return values. Simply by modifying these procedures to save, change and restore the segment registers of the code and data segments I can instantly call subroutines anywhere in the code segment. No other processor with fixed call/return instructions can do that.

As things were, you wrote machine code. An assembler was luxury and also wanted its share of your memory. There were various BASIC interpreters, but I never was really interested. They just were too limited and wasteful with the limited memory resources. The better ones at least tokenized the code, making the memory hunger a bit smaller and the parsing at runtime a little faster. There were other interpreters, but these languages usually suffered from similar problems. Compilers were not much of a thing at all, like on most 8 bit computers. The reason for this was again memory and mass storage.

There is one exception. FORTH. It scales and adapts very well from tiny microcontrollers to modern processors. It also is quite fast, because it can't decide to be an interpreter or a just in time compiler. It even solves the problem of what to do with the OS. In the old days there was none at all and FORTH has a tendency to become the OS itself by keeping track of every bit of code you wrote. All that makes it a good candidate from the old times to adapt to my memory model.

Today we also have cross assemblers, a C compiler and an emulator/debugger. The cross assembler is open source and I might adapt it myself. The author of the emulator does his best to emulate all the little computers that use this old processor. I already had contact with him when he wanted my permission to include a little game that I wrote 40 years ago on the old computer. I think he will also include my new memory model in his emulator, once I have something to show.

And the C compiler? It needs a new project type, similar to compiling a DLL instead of an executable. And it has to use my modified call and return procedures.
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: How would you slice up this turkey? Pin
Luc Pattyn15-May-20 7:34
sitebuilderLuc Pattyn15-May-20 7:34 
GeneralPomodoro Apps Pin
Brady Kelly15-May-20 1:48
Brady Kelly15-May-20 1:48 
GeneralRe: Pomodoro Apps Pin
musefan15-May-20 2:43
musefan15-May-20 2:43 
GeneralRe: Pomodoro Apps Pin
W Balboos, GHB15-May-20 2:46
W Balboos, GHB15-May-20 2:46 
GeneralRe: Pomodoro Apps Pin
musefan15-May-20 2:51
musefan15-May-20 2:51 
GeneralRe: Pomodoro Apps Pin
W Balboos, GHB15-May-20 2:58
W Balboos, GHB15-May-20 2:58 
GeneralRe: Pomodoro Apps Pin
PIEBALDconsult17-May-20 6:55
mvePIEBALDconsult17-May-20 6:55 
GeneralRe: Pomodoro Apps Pin
W Balboos, GHB18-May-20 0:40
W Balboos, GHB18-May-20 0:40 
GeneralRe: Pomodoro Apps Pin
Brady Kelly23-May-20 19:36
Brady Kelly23-May-20 19:36 
GeneralRe: Pomodoro Apps Pin
RickZeeland15-May-20 2:50
mveRickZeeland15-May-20 2:50 
GeneralRe: Pomodoro Apps Pin
Brady Kelly23-May-20 20:14
Brady Kelly23-May-20 20:14 
GeneralRe: Pomodoro Apps Pin
RickZeeland23-May-20 20:49
mveRickZeeland23-May-20 20:49 
GeneralRe: Pomodoro Apps Pin
Brady Kelly23-May-20 21:13
Brady Kelly23-May-20 21:13 
GeneralRe: Pomodoro Apps Pin
Jacquers15-May-20 4:10
Jacquers15-May-20 4:10 
GeneralRe: Pomodoro Apps Pin
Brady Kelly23-May-20 19:39
Brady Kelly23-May-20 19:39 
GeneralRe: Pomodoro Apps Pin
User 1106097915-May-20 4:55
User 1106097915-May-20 4:55 
GeneralRe: Pomodoro Apps Pin
Brady Kelly23-May-20 19:43
Brady Kelly23-May-20 19:43 

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.