easy text and DOS3.3 access from assembly




TO CALL IT, JSR MSGOUT WITH THE ASCII DATA RIGHT AFTER THE jsr! THE CODE IS NEAT. IT PULLS THE RETURN ADDRESS OFF THE STACK AND COMPUTES THE LOCATION OF YOUR DATA THAT SHOULD GO TO SCREEN FROM THAT! COOOOOL

JSR MSGOUT ; HEX 8D ; ASC " YOU CAN PRINT TO THE SCREEN"



TEMP      DFB #00
COUT      EQU $FDED



*
*
*THE ANDY HERTZFELD STRING PRINTING ROUTINE FROM
*CALL - A.P.P.L.E
*

          JMP INTRO   


MSGOUT    PLA          ;FETCH THE RETURN ADDRESSES
          STA TEMP     ;FROM THE 6502'S STACK
          PLA          ;AND SAVE THEM WHERE WE CAN
          STA TEMP+1   ;GET TO THEM LATER
          LDY #0       ;CLEAR THE STRING INDEX AND
LOOP      INC TEMP     ;INCREMENT RETURN ADDRESS FOR
          BNE SKIPADD  ;EACH CHR+HI BYTE IF TEMP=0
          INC TEMP+1   ;FOR "BOUNDARY" CROSSINGS
SKIPADD   LDA (TEMP),Y ;GET THE NEXST CHAR FOR PRINTING
          BEQ MSGRTS   ;AND IF CHR=0 WE EXIT
          ORA #$80     ;TURN ON HIGH BIT FOR COUT
          JSR COUT     ;AND PRINT VIA MONITOR ROUTINE
          JMP LOOP     ;GO BACK FOR NEXT CHARACTER
MSGRTS    LDA TEMP+1   ;EXITING SO RECOVER THE
          PHA          ;ADJUSTED RETURN ADDRESS
          LDA TEMP     ;AND PUT IT ON THE STACK
          PHA          ;FOR RETURN PAST END OF STRING
          RTS          ;TO NEXT PROGRAM INSTRUCTION

*
*
INTRO     NOP

 JSR MSGOUT ;
 HEX 8D ;

 ASC " YOU CAN PRINT TO THE SCREEN"



 HEX 8D
 ASC "OR SEND COMMANDS VIA COUT"

 HEX 8D
 ASC "USING THIS CODE!"

 HEX 00