Friday, 13 July 2012

Subroutines - an addendum

Having pondered this for a little time today, I think using STA $00 as the effective return from subroutine is a bad idea.

The reason is because you can't do a subroutine call to the root page, zero. This introduces as unnecessary limit because you may want to write code to the 16 bytes of RAM to do things like indexing and indirection.

So, STA $0F is now the 'return from subroutine' (actually , switch paging register and PC back to original without long branch). This makes code difficult to access in page $F - you can't call that page - but not impossible (you can get there by running code past page $1DF.

This is, of course, completely insane given the hardware :)

No comments:

Post a Comment