News for hackers. Stuff that matters.
Re:SymbOS: Graphical Z80 Multitasking Operating System by jacquesm on Friday January 05, 2018 @12:01PM (#16079771)
> you just need PIC.

Or a relocator. This can be a bit tricky but it's been done on many architectures.

Re:SymbOS: Graphical Z80 Multitasking Operating System by sedachv on Friday January 05, 2018 @04:20PM (#16081744)
Do you have any links/pointers to systems that did this?
Re:SymbOS: Graphical Z80 Multitasking Operating System by jacquesm on Friday January 05, 2018 @05:58PM (#16082529)
Wrote my own for 68xx and 65xx chips in ancient times.

https://en.wikipedia.org/wiki/Relocation_(computing)

If you have access to the symbol table it is an easy problem to solve, if you don't it can get quite difficult all the way to impossible if the original code makes use of tricks such as jumping into the middle of an instruction. But if the code is 'well behaved' then it can usually be done.

Many games used tricks like this to relocate themselves to memory that was otherwise not usable for programs, for instance to live in secondary screen space. This ensured the game would be wiped on reset. Crude but effective.

Re:SymbOS: Graphical Z80 Multitasking Operating System by Sir_Cmpwn on Friday January 05, 2018 @08:26PM (#16083262)
For fun, I took a "happy medium" approach in KnightOS. Programs are written with RSTs (basically the z80 version of traps) next to each instruction with a relative address, then the kernel looks up the return address on the stack, partially decodes the next instruction, and then modifies the code in RAM to update the address to the correct one. It's basically just-in-time PIC.

https://github.com/KnightOS/kernel/blob/master/src/00/restar...

Re:SymbOS: Graphical Z80 Multitasking Operating System by jacquesm on Saturday January 06, 2018 @06:49AM (#16084879)
Heh, that's cool. How do you remember which ones you've modified so you don't do it twice?
Re:SymbOS: Graphical Z80 Multitasking Operating System by Sir_Cmpwn on Saturday January 06, 2018 @06:01PM (#16087982)
It also modifies the reset (trap instruction) in place and makes it a no-op.