;Implementation of SoftMMU - skeleton expansion code ;=================================================== ;In this file, we implement every routine defined in ;sm.skeleton.h, except for init and author. Remember ;that this file is #included along with all the other ;expansions, so keep label names unique by including ;the expansion name in the label name. ;tsp_exp is defined, before #including this file, as ; the offset into the TSP where the expansion- ; specific bytes have been reserved. ;---- ;Name ;---- ;Not a routine, just some short identifying text. ;(zero terminated) name_skeleton: .byte "Sample",$00 ;---------- ;Allocation ;---------- xalloc_skeleton: ;For normal expansions, the xalloc routine simply ;queries the free list page and takes care of the ;actual allocation. If xalloc_expansion is not ;$00xx, it is called after the expansion is successfully ;performed, for whatever purpose you may need. ;<- .X = memory expansion number (preserve it on exit!) ;-> nothing ;If no free list page is allocated, xalloc_expansion ;must perform the actual allocation & related book ;keeping. ;<- .X = memory expansion number (preserve it on exit!) ;-> c=1 allocation failed ;-> c=0 allocation successful ;------------ ;Deallocation ;------------ xfree_skeleton: ;Called under the same conditions as xalloc_expansion. ;So if you use free list pages, usually this routine will ;be unnecessary. If you don't, you must implement the ;entire deallocation here. ;------------ ;Reallocation ;------------ xrealloc_skeleton: ;not yet implemented ;--------- ;Page swap ;--------- xpage_skeleton: ;Perform a page swap, by whatever expansion-specific ;method you want. Since this will be the most called ;routine, get it as fast as you can. ;<- .Y = memory expansion number ;<- .X = zp pointer to user structure (window,page) ;<- interrupts are disabled. ;<- tmpzp+2 = page offset into the expansion that ; you need to get into addressable RAM. ; This value is guaranteed to be valid. ; ;-> MUST exit with pla:tya:pla:rts with .X preserved ; and interrupts enabled. ;If the paging routine takes a long time, cli and ;call locktsw. Obviously, make sure to unlocktsw ;before returning. ;---------------- ;Context Switches ;---------------- ;These are especially useful for banked memory systems, ;because changing the memory state will usually affect ;the entire base address space. These are only called ;if sm_setmygetcontextbit or sm_setmylosecontextbit ;have been called by some other function, and can be ;disabled by calling sm_clearmygetcontextbit or ;sm_clearmylosecontextbit. getcontext_skeleton: losecontext_skeleton: