;Implementation of SoftMMU - xgetsize ;==================================== .global xgetsize ;-------- xgetsize: ;-------- ldy $04,x ;get tsp struct pointer #ifndef always_sane txa ;sanity check... cmp (lk_tsp),y ;make sure we're pointing to each other bne insane #endif iny ;advance to ending address iny iny sec lda (lk_tsp),y dey dey sbc (lk_tsp),y ;subtract starting address pha iny iny iny lda (lk_tsp),y ;and do the high bytes dey dey sbc (lk_tsp),y tya ;high byte in .Y pla ;low byte in .A clc ;no error rts #ifndef always_sane insane: jmp catcherr #endif