I would like to exchange data with the bank, please.

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

I would like to exchange data with the bank, please.

Post by funkheld »

Hi good afternoon.
I would like to exchange data with the bank, please.

set bank:
poke (0,8) = do I have bank 8 for my data with the address $a000 , 8kb ?

...poke($a000,123)....poke($a001,124).......

poke(0,9) = fill bank 9 with data ....poke($a000)....

poke(0,8)....peek($a000).....peek($a001)....my old bank data has been preserved?

Which bank can I still use?

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

Re: I would like to exchange data with the bank, please.

Post by unartic »

You can use any of the banks from #1 (#0 is reserved for other stuff).

A 512kb system (which is the default) has 64 banks, so #63 is the last bank you can use.

See https://github.com/X16Community/x16-doc ... y%20Map.md for more information.
User avatar
ahenry3068
Posts: 1146
Joined: Tue Apr 04, 2023 9:57 pm

Re: I would like to exchange data with the bank, please.

Post by ahenry3068 »

You can use $BF00-BFFF ONLY in Bank 0 for interprocess communication. This area is reserved for this purpose. The rest of Bank 0 should be considered off limits.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: I would like to exchange data with the bank, please.

Post by funkheld »

Thanks for the info.

Can I do it as I described above: fill the benches and collect them with poke/peeke etc?

what kind of bank 0/1 is this on vpoke/vpeek?

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

Re: I would like to exchange data with the bank, please.

Post by funkheld »

Hmm... a misconception on my part.

actually should:
123
124
come out?

Thanks.
greeting
Attachments
bank.jpg
bank.jpg (42.98 KiB) Viewed 1213 times
TomXP411
Posts: 1785
Joined: Tue May 19, 2020 8:49 pm

Re: I would like to exchange data with the bank, please.

Post by TomXP411 »

In BASIC, do not use POKE 0 or POKE 1 to set the bank. Instead, use the BANK command.

https://github.com/X16Community/x16-doc ... IC.md#bank

Since the KERNAL uses bank 0 for its own purposes, you can't count on the bank staying set between statements in BASIC, hence the BANK command, which sets the bank used by the next POKE, PEEK, SYS, or USR statement.
User avatar
ahenry3068
Posts: 1146
Joined: Tue Apr 04, 2023 9:57 pm

Re: I would like to exchange data with the bank, please.

Post by ahenry3068 »

At least he's poking 0. I made kind of the same mistake but I was trying to read the ROM font. POKE 1, 6 put me straight to the monitor. ;).
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: I would like to exchange data with the bank, please.

Post by funkheld »

hello , thanks.

madpascal is ok.

Code: Select all

uses x16_vera, x16, crt;

var 
x: byte;

begin
        Poke(0,8);
	Poke($a010,77);
	
	Poke(0,9);
	Poke($a010,88);
	
	writeln('');
	
	Poke(0,8);
	x:=Peek($a010);
	writeln(x);
	
	Poke(0,9);
	x:=Peek($a010);
        writeln(x);
end.
Attachments
bank1.jpg
bank1.jpg (35.1 KiB) Viewed 1196 times
Post Reply