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 text \ ================= \ Preserves X \ Corrupts A,Y \ \ Called with: \ JSR PrText \ EQUS "text message" \ EQUB 0 .PrText PLA:STA &F6:PLA:STA &F7 LDY #1 .PrTextLp LDA (&F6),Y:BEQ PrTextEnd JSR OSASCI:INY:BNE PrTextLp .PrTextEnd CLC:TYA:ADC &F6:TAY LDA #0:ADC &F7:PHA TYA:PHA:RTS \ Print inline text \ ================= \ Preserves X,Y \ Corrupts A \ \ Called with: \ JSR PrText \ EQUS "text message" \ EQUB 0 .PrText PLA:STA &F6:PLA:STA &F7 TXA:PHA:TYA:PHA:LDY #1 .PrTextLp LDA (&F6),Y:BEQ PrTextEnd JSR OSASCI:INY:BNE PrTextLp .PrTextEnd TSX:TYA:CLC:ADC &F6:STA &103,X LDA #0:ADC &F7:STA &104,X TYA:PHA:PLA:TAX:RTS \ Print inline text \ ================= \ Preserves none \ Corrupts A,X,Y \ \ Called with: \ JSR PrText \ EQUS "text message" \ EQUB 0 .PrText PLA:STA &F6:PLA:STA &F7:LDY #1 .PrTextLp LDA (&F6),Y:BEQ PrTextEnd JSR OSASCI:INY:BNE PrTextLp .PrTextEnd CLC:TYA:ADC &F6:TAY LDA #0:ADC &F7:PHA TYA:PHA:RTS \ Print inline string \ ===================== \ Preserves X \ Returns A=&00, Y=&00 \ \ Called with: \ JSR PrText \ EQUS "text message" \ EQUB 0 .PrText PLA:STA &F6:PLA:STA &F7 :\ &F6/7=>embedded string LDY #&00 :\ Offset to string .PrTextLp INC &F6:BNE PrTextChar :\ Increment address INC &F7 .PrTextChar LDA (&F6),Y:BEQ PrTextEnd :\ Get character, exit if &00 JSR OSASCI:JMP PrTextLp :\ Print character and loop back for more .PrTextEnd JMP (&00F6) :\ Jump back to code after string \ Print inline string \ ===================== \ Preserves X,Y \ Returns A=&00 \ \ Called with: \ JSR PrText \ EQUS "text message" \ EQUB 0 .PrText PLA:STA &F6:PLA:STA &F7 :\ &F6/7=>embedded string TYA:PHA :\ Save Y LDY #&00 :\ Offset to string .PrTextLp INC &F6:BNE PrTextChar :\ Increment address INC &F7 .PrTextChar LDA (&F6),Y:BEQ PrTextEnd :\ Get character, exit if &00 JSR OSASCI:JMP PrTextLp :\ Print character and loop back for more .PrTextEnd PLA:TAY:LDA #&00 :\ Restore Y JMP (&00F6) :\ Jump back to code after string 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 anyway and will be overwritten immediately after the JMP &100 when the BRK handler sets them up. &F5 use to hold a ROM number.