You can use variables to communicate back to BASIC programs. Either pass the variable name to the @IMUL command, or come up with some other way to determine the variable name.MrSterlingBS wrote: ↑Sun Jul 23, 2023 11:58 pm Example:
10 @iMUL,5,3 ; integer multiplication 5x3=15
Do i need to PEEK it from the memory location?
Or is there another way?
Code: Select all
lda #"R" + #$80 ; First letter of the variable name. High byte of both characters set means an integer (%)
sta $45 ; Store the first letter in VARNAM zero-page location
lda #$80 ; This is a one-letter variable name, but still need to set high bit
sta $46 ; Store the second character (or null here) in VARNAM+1
jsr $d0e7 ; The routine D0E7 finds or creates the variable and sets a pointer to start of its memory in $47/$48
ldy #1 ; ($47),1 will be the low byte of an integer variable value. Yes, the value is big-endian!
lda #<INTVAL ; Low byte of the integer to store
sta ($47),y ; ,,
dey ; ($47),0 will be the high byte of an integer variable value.
lda #>INTVAL ; High byte of the integer to store
sta ($47),y ; ,,
Code: Select all
?R%