Hi - I'd like to have a subroutine return a series of ASCII letters from a subroutine to the primary routine. I had been thinking I might be able to use the stack, though as I understand it it's normally used to pass arguments to subroutines, not from. Anyways, I tried just writing some super simple code to see if it would still work:
.device AT90S8515 .include "8515def.inc" .ORG 0x0000 RJMP reset reset: ;Initialize stack LDI R16,low(RAMEND) OUT SPL, R16 LDI R16,high(RAMEND) OUT SPH, R16 ;Sets portb to outputs LDI R16, 0xFF OUT DDRB, R16 RCALL stacktest POP R17 OUT PORTB, R17 donithing: RJMP donothing stacktest: LDI R16, 0xAA PUSH R16 RET
And it didn't work - it just kept on jumping to reset. Is there a way to make this work, or do I have to look for another route? I was thinking I could instead just make the stack at say low(RAMEND) + 20 or something - and then use those 20 bytes to pass arguements back and forth, but as far as I know reading from and writing to the ram is more complicated (and processor intensive) then using the stack. Thanks!