View Single Post
Old 17th Dec 2021, 9:45 pm   #25
Slothie
Octode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 1,287
Default Re: Yet another MK14 tape interface (ESP32).

Quote:
Originally Posted by coolsnaz2 View Post
I have a slight problem with the assembler, the values for COUNT and LEN need to be changed after the code has been assembled. I think this relates to the assembler not knowing that P3 is set to 0x0023.
.
When writing SC/MP programs, if one of the pointer registers is preset to some value, I tend to assign a symbol to that value and then put the appropriate calculation in the code. This seems to fix most of the offset problems I get.

e.g. in this code P1 is set to the same as the 'Ret' label in the program, and the locations 'Row' and 'Count' (at 0xF03 and 0xF04 respectively) are always accessed relative to P1.
Code:
; These values are the offset relative to P1 which points to 
; 0xF20, or the Ret label. All variables are stored before this 
; memory location at -ve offsets.
Row     .EQ 0xF03-Ret   ;Ram Offsets
Count   .EQ 0xF04-Ret
;
Slothie is offline