Printing text ============= &F6/7 are allowed to be used as they are only otherwise used when calling OSRDRM and when ROMFS makes sideways ROM calls. As you can't *SPOOL text to ROMFS as it is a read-only filing system, printing text won't result in a ROMFS filing system call that uses &F6/7. \ Print inline string \ ===================== \ Prints any length string \ Preserves X,Y \ Corrupts A \ Size 34 bytes \ \ Called with: \ JSR PrText \ EQUS "text message" \ EQUB 0 .PrText PLA:STA &F6:PLA:STA &F7 :\ &F6/7=>embedded string TYA:PHA :\ Save Y JMP PrTextSkip :\ Step to first byte .PrTextLp LDY #0:LDA (&F6),Y :\ Get character BEQ PrTextSkip :\ Not zero, skip printing JSR OSASCI :\ Print character .PrTextSkip INC &F6:BNE PrTextNext :\ Increment address INC &F7 .PrTextNext TAY:BNE PrTextLp :\ Not zero, loop for next PLA:TAY :\ Restore Y JMP (&00F6) \ Print inline text \ ================= \ Prints up to 255 characters \ Preserves X \ Corrupts A,Y \ Size 31 bytes \ \ Called with: \ JSR PrText \ EQUS "text message" \ EQUB 0 .PrText PLA:STA &F6:PLA:STA &F7 :\ &F6/7=>embedded string LDY #1 :\ Offset to string .PrTextLp LDA (&F6),Y:BEQ PrTextEnd :\ Get character, exit if &00 JSR OSASCI :\ Print character INY:BNE PrTextLp :\ Point to next, loop back for next .PrTextEnd CLC:TYA:ADC &F6:TAY :\ Update pointer and stack it LDA #0:ADC &F7:PHA TYA:PHA:RTS :\ Return to code after string \ Print inline string \ ===================== \ Prints any length string \ Preserves X \ Returns A=&00, Y=&00, EQ \ Size 29 bytes \ \ Called with: \ JSR PrText \ EQUS "text message" \ EQUB 0 .PrText PLA:STA &F6:PLA:STA &F7 :\ &F6/7=>embedded string BNE PrTextSkip :\ Step to first byte .PrTextLp LDY #0:LDA (&F6),Y :\ Get character BEQ PrTextSkip :\ Not zero, skip printing JSR OSASCI :\ Print character .PrTextSkip INC &F6:BNE PrTextNext :\ Increment address INC &F7 .PrTextNext TAY:BNE PrTextLp :\ Not zero, loop for next JMP (&00F6) Generate error from sideways ROM ================================ When running code in a service ROM you can't generate an error with BRK as the current language will be in another ROM and won't be able to read it. The standard method is to copy the error to the bottom of the stack and execute it there. \ Generate inline error \ ===================== \ Called with: \ JSR MkError \ EQUB errornumber :\ must not be &00 \ EQUS "error message" \ EQUB 0 .MkError PLA:STA &FD:PLA:STA &FE :\ Pop address after JSR LDY #0 :\ Index into the error block .MkErrorLp INY:LDA (&FD),Y:STA &100,Y :\ Copy error block to stack BNE MkErrorLp :\ Loop until terminating &00 byte STA &100:JMP &100 :\ Store &00 as BRK and jump to it &FD/E are allowed to be used as they are the error pointer and will be overwritten immediately after the JMP &100 when the BRK handler sets them up. &F5 use to hold a ROM number.