💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › MiscInfo › Programmin… captured on 2024-07-09 at 04:41:11.
View Raw
More Information
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
"Terry & Utahna" <tolsen64@hotmail.com> wrote in message news:<z4LY9.36828
>
> jsr PrintRoutine
> asc "Hello World!",00
> ...continue assembly code here
>
> The print routine somehow knew to RTS to the instruction just after the 00
> termination on that string. I think the return address was pulled from the
> stack and the "modified" return address was pushed just before the RTS...Am
> I close????
You should be able to midify this to work:
- ***************************************************************
- SAYIT Sets the curser prints the string.
- string must be null terminated.
- msb on
- jsr sayit
- dc i1'10,10' ; left then top
- dc c'Hello World',h'00' ; note the null end
- msb off
- more code sayit returns to more code
- A/X/Y scrambled
- ***************************************************************
SAYIT START
TAKE EQU $FA ;FA,FB
HTAB EQU $57B
VTAB EQU $FB5B
COUT EQU $FDED ;CHAR OUT
PLA ;GET RTN ADDRESS
STA RTNADD
STA TAKE ;USE AS INDEX
PLA ;TO DATA
STA RTNADD+1
STA TAKE+1
; CORRECT TAKE
LDA TAKE
CLC
ADC #1
STA TAKE
LDA TAKE+1
ADC #0
STA TAKE+1
ldy #0 ;set the curser
ldx #0 ;rtnadd counter
lda (take),y
sta htab
inx
iny
lda (take),y
jsr vtab
iny
inx
; PRINT THE MSG
LOOP LDA (TAKE),Y
BEQ DONE
JSR COUT
LDA TAKE
CLC
ADC #1
STA TAKE
LDA TAKE+1
ADC #0
STA TAKE+1
inx
BNE LOOP
DONE inx ;set the return address
txa
clc
adc rtnadd
sta rtnadd
lda rtnadd+1
adc #0
pha
ldA RTNADD
PHA
RTS
RTNADD DS 2
END