Re:Turbo Rascal Syntax Error
by chromoblob on Monday May 08, 2023 @07:46AM
(#35860500)
> 6502 does not allow any stack-pointer-relative operations
Almost not true. All you have to do is add the TSX instruction, which moves stack pointer into X register, then use absolute indexed addressing mode in which address of the memory operand is computed by adding together the absolute address specified in the instruction and the X register value. For example the instructions `TSX; LDA $0105, X` will load into A the byte in the stack which is 5 bytes up from the stack pointer. Cost for this is being unable to use the X register for something else. Addition also doesn't wrap around the stack page.
Almost not true. All you have to do is add the TSX instruction, which moves stack pointer into X register, then use absolute indexed addressing mode in which address of the memory operand is computed by adding together the absolute address specified in the instruction and the X register value. For example the instructions `TSX; LDA $0105, X` will load into A the byte in the stack which is 5 bytes up from the stack pointer. Cost for this is being unable to use the X register for something else. Addition also doesn't wrap around the stack page.