News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_VincentGR

Access second RAM bank though Basic

Started by VincentGR, 17:14, 13 July 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

VincentGR

Hello everybody.


A friend made an excel clone on CPC's basic.
The prog runs fine but the memory is not enough.
He hasn't figured out how to access the rest 64K to create a table.


Thanks in advance.

fgbrain

Not possible with Basic I am afraid...


You can access extra memory with OUT command but you cannot use it with Basic...
_____

6128 (UK keyboard, Crtc type 0/2), 6128+ (UK keyboard), 3.5" and 5.25" drives, Reset switch and Digiblaster (selfmade), Inicron Romram box, Bryce Megaflash, SVideo & PS/2 mouse, , Magnum Lightgun, X-MEM, X4 Board, C4CPC, Multiface2 X4, RTC X4 and Gotek USB Floppy emulator.

andycadley

You could use the bankman rsx to access the extra memory from basic to some extent, but it's not necessarily suitable for all uses and obviously prevents your program from running on a 64K machine

AMSDOS

Not sure this is what @VincentGR friend had in mind, which is storing a string to the 2nd RAM Bank by using POKE, ASC and MID$, the trouble is Excel Spreadsheets can have cells which carry Strings upto any number of characters, just like an BASIC String Array, but in order to store it in Memory, the full String needs to be extracted, just like my example.
After <any key> has been pressed, the code proceeds to the retrival and a WHILE loop is used to put the string back together.



100 a$="Hello 128k Memory From BASIC!"
110 CALL &BC02:OUT &7F00,&C4
120 FOR p=1 TO LEN(a$)
130   POKE &3FFF+p,ASC(MID$(a$,p,1))
140 NEXT p
150 OUT &7F00,&C0
160 a$="":INK 0,3:INK 1,26:BORDER 3:CALL &BB18
170 OUT &7F00,&C4
180 addr=&4000
190 WHILE PEEK(&4000+s)<>0
200   a$=a$+CHR$(PEEK(&4000+s)):s=s+1
210 WEND
220 OUT &7F00,&C0
230 PRINT a$
240 END
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

roudoudou

Quote from: VincentGR on 17:14, 13 July 20
Hello everybody.


A friend made an excel clone on CPC's basic.
The prog runs fine but the memory is not enough.
He hasn't figured out how to access the rest 64K to create a table.


Thanks in advance.
If your basic programm is less than 16K you can switch upper bank in #4000-#7FFF zone
First protect the memory at #4000 and above => MEMORY &3FFF

Then you can use OUT to switch

out &7F00,&C4 : REM switch bank 4
out &7F00,&C5 : REM switch bank 5
out &7F00,&C6 : REM switch bank 6
out &7F00,&C7 : REM switch bank 7
out &7F00,&C0 : REM default configuration (bank 1)
see cpcwiki gate array bank switching for other configurations (not all possible in basic)
Then you can use PEEK and POKE to access the area
My pronouns are RASM and ACE

VincentGR

Thank you very much all of you, I will try to translate your precious suggestions.

ukmarkh

Quote from: andycadley on 19:15, 13 July 20
You could use the bankman rsx to access the extra memory from basic to some extent, but it's not necessarily suitable for all uses and obviously prevents your program from running on a 64K machine


Apologies for dragging this back up, but how can I access bankman?

andycadley

Quote from: ukmarkh on 14:22, 11 August 21

Apologies for dragging this back up, but how can I access bankman?
There were a bunch of RSXs on one of the system disks with the 6128, I'd assume a copy is floating around on the internet somewhere if you don't have that any more.

eto

Quote from: ukmarkh on 14:22, 11 August 21Apologies for dragging this back up, but how can I access bankman?

It's on the 6128 system disks: http://www.cpcwiki.eu/index.php/System_Disk

For a description see chapter 1, page 84 of the 6128 manual:
http://www.cpcwiki.eu/manuals/AmstradCPC6128-hypertext-en-Sinewalker.pdf

Longshot

#9
Hi.
You can also use the RSX MPACK set( https://cpcrulez.fr/applications_util-MPACK.htm )
You can save a basic program in the ram with MBSAVE and run it with MBRUN (there are other instructions like MLDIR, MSAVE, MLOAD, ...).
If your program is more than 16k, you can modify the code given by AMSDOS using MPACK.
You must remove the OUT &7F00,xx (line 110, 140, 170, 220) and replace the POKE by MPOKE,p,ASC(MID$(a$,p,1)) , line 180 addr=0, and PEEK by MPEEK, addr.(The address in MPACK is an address between 0 and 65535 to access the 64k)
Rhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!!

Powered by SMFPacks Menu Editor Mod