scotws / TaliForth2

A Subroutine Threaded Code (STC) ANS-like Forth for the 65c02
Other
86 stars 23 forks source link

Make BYE customizable #235

Closed twoinke closed 4 years ago

twoinke commented 5 years ago

Currently, BYE executes a BRK instruction which causes py65 to execute the ml-monitor. On real hardware however, BRK is not a common way to exit and return to wherever TaliForth2 has been invoked from. SteckOS for example provides a return vector as jump target, which takes care of a safe return to the OS. Another common way is to invoke programs via JSR in order to be able to return using RTS.

Long story short, it would be nice if BYE behaviour could be customized in the platform specific files.

scotws commented 5 years ago

@SamCoVT Wouldn't this be of use to you as well? If I remember, bye doesn't really do anything useful on your hardware right now.

SamCoVT commented 5 years ago

On my hardware, Tali Forth 2 is the OS, so I just don't use bye.

We can make the word BYE jump to a label in the platform file, and move the BRK for py65mon there in the default platform file (with a comment describing what's going on). That way the Steckschwein folks can either put their own code at that label or just .alias the label to their jump target address in their platform file. If we're trying to leave 8K in the ROM memory map (assuming 32K RAM/32K ROM) for people to put their own code, it seems quite reasonable to provide an easy way to get back there.

twoinke commented 5 years ago

Sounds good to me.

scotws commented 5 years ago

@twoinke Do you want to go ahead and see about changing this, since you're the most affected and can test it with an actual on-board OS?

twoinke commented 5 years ago

@scotws I'll give it a shot.

twoinke commented 5 years ago

GitHub does not let me create a PU, so here's a patch. patch.txt

scotws commented 5 years ago

@twoinke Thank you, I'll try to get on it at the weekend!

scotws commented 5 years ago

@twoinke Sorry this is taking longer than expected, the mobo of my NAS died and I'm using the occasion to move everything from FreeNAS to Ubuntu Server with Docker. Once I've done wading in ZFS pools and bricked up the firewall I'll be right back.

SamCoVT commented 4 years ago

I believe this has already been handled with the platform_bye: label in the platform files. The only thing I can see left to do is to add some documentation about this label, either in the manual or in the platform files (or both). If you don't have time to finish that up, you can assign it to me and we can get this issue closed.

scotws commented 4 years ago

Oops, we've done this. Thanks!