nxtBasic error with STA "A"

All aspects of programming on the Commander X16.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

nxtBasic error with STA "A"

Post by funkheld »

hello, good day.

here is an error with nxtbasic.

thanks.
greeting

---------------------------------
STA "A" 'puts a "A" in the accumulator
SYS $FFD2 'Calls the kernal CHROUT subroutine to print the A on the screen
PRINT GETA 'as the accumulator is not changed by CHROUT, this will return the value 65
---------------------------------
Attachments
fehler.jpg
fehler.jpg (79.23 KiB) Viewed 1289 times
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtBasic error with STA "A"

Post by unartic »

funkheld wrote: Wed Jul 24, 2024 9:31 pm hello, good day.

here is an error with nxtbasic.

thanks.
greeting

---------------------------------
STA "A" 'puts a "A" in the accumulator
SYS $FFD2 'Calls the kernal CHROUT subroutine to print the A on the screen
PRINT GETA 'as the accumulator is not changed by CHROUT, this will return the value 65
---------------------------------
Hi! The documentation is incorrect.

STA "A" should be LDA "A"

I'll correct the docs asap :-)
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: nxtBasic error with STA "A"

Post by funkheld »

hello, thanks for info.

I thought you could use this sta now too.
Could you extend this asm so that it works with sta too?

you made a great nxtBasic.

thanks.
greetings
Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

Re: nxtBasic error with STA "A"

Post by Ed Minchau »

No, the language can't be extended; the opcodes are hardwired. Even if we could, STA A would be a useless command, "store the contents of the accumulator in the accumulator".
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtBasic error with STA "A"

Post by unartic »

funkheld wrote: Thu Jul 25, 2024 2:28 pm hello, thanks for info.

I thought you could use this sta now too.
Could you extend this asm so that it works with sta too?

you made a great nxtBasic.

thanks.
greetings
To load a value in the processor registers you can use:

LDA "A"
LDX "A"
LDY "A"

To retrieve a value from one of the processor registers, you get use:
var$ = GETA()
var$ = GETX()
var$ = GETY()
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: nxtBasic error with STA "A"

Post by funkheld »

hello thanks for info.

greeting
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: nxtBasic error with STA "A"

Post by funkheld »

If I have compiled a basic, where is the ASM program?

I would like to take a look at it, please.

Which assembler did we use to make a prg from the ASM, please?

Thanks.
Greetings
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtBasic error with STA "A"

Post by unartic »

The program is assembled with a custom assembler Ive developed myself (build in). If you compile with -debug option a debug folder is created in wich you’ll find the compiler steps, which includes the assembly listing.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: nxtBasic error with STA "A"

Post by funkheld »

hello, good day.

there are wonderful ASM assemblers for the x16.

why is the wheel being reinvented here?

I would have preferred to see more light in the ASM code than more secrets.

Can you recompile the asm code that you see with -debug?

thanks.
greetings
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtBasic error with STA "A"

Post by unartic »

funkheld wrote: Fri Jul 26, 2024 6:41 am hello, good day.

there are wonderful ASM assemblers for the x16.

why is the wheel being reinvented here?

I would have preferred to see more light in the ASM code than more secrets.

Can you recompile the asm code that you see with -debug?

thanks.
greetings
I wanted to make sure there are no dependency's. So, just download nxtBasic and it runs. As this is a Basic language, I recon the assembly side if of little interest :-)

It is not possible to compile files in the /debug folder.

If you want to have look at how the build in functions work, the /asm folder is your friend.
Post Reply