From: Greg King (gngking_at_erols.com)
Date: 2003-02-13 02:47:21
-----Original Message----- From: stefan Date: Saturday, February 08, 2003, 09:39 PM > > > .import incsp3, decsp3 > > > > (Why do you need decsp3?) > > I thought I need both inc and decsp, because sp must have the same value > like on entrance of the procedure. > I need a decsp2 at the beginning, cause I don't have negative indices, > and I must do a incsp2 at the end. Both the hardware-stack and cc65's software-stack are "backwards" from the way that we think of stacks! When they grow, their stack-pointers move down in memory; when they shrink, their pointers move up. Data that was pushed onto a stack later is stored at lower addresses than is data that was pushed earlier. "sp" points to the lowest address that currently is used by the software-stack. You always will use positive indices to reach values that are on the stack. Also, functions must remove their arguments from the stack before they return. Therefore, you must remove that "jsr decsp3" from your code. Store the .A register into var3. Load a zero into the .Y index-register before getting var2. And, increment .Y before getting var1. ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-02-13 10:26:14 CET