I am learning how to program the Atari 800 by examining some tutorial code that came with the IDE/Assembler I am using. I am using the MADS assembler for this.
putchar_ptr = $346 csrhinh = 752 character = $80 rowcrs = $54 colcrs = $55 org $2000 .proc main mva #1 csrhinh mva #6 rowcrs mva #16 colcrs mva #0 character next_character ldx character cpx #.len text beq stop lda text,x jsr putchar inc character jmp next_character stop jmp stop .proc putchar tax lda putchar_ptr+$1 pha lda putchar_ptr pha txa rts .endp .local text .byte 'Hi there!',$9b,'new line' .endl .endp run main
I did reference the Atari 800 manual and the MADS-Assembler manual but I didn't find anything. The specific question I am asking is, in the putchar procedure, why is the accumulator pushed onto the stack? From what I can tell all it is loaded with is the location of the routine pointer on the first push and the put pointer on the second. A few possibilities I see are that I could be mistaken on what the routine actually is (the atari 800 manual wasn't very informative about that) or the push might point to something else other than the stack. I would say the latter is true but then we aren't pushing the character we are trying to print because of the txa instruction and the accumulator being reloaded.