Author Topic: Access second RAM bank though Basic  (Read 1550 times)

0 Members and 1 Guest are viewing this topic.

Offline VincentGR

  • 6128 Plus
  • ******
  • Posts: 1.407
  • Country: gr
    • Parts from the past.
    • Awards
Access second RAM bank though Basic
« on: 19: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.
like
0
No reactions
Visit my BBS (Telnet) : flashbackbbs.sytes.net:6502
http://loaderror.eu/
Amiga 1200 Black Project

Offline fgbrain

  • CPC6128
  • ****
  • Posts: 249
  • Country: gr
    • index.php?action=treasury
    • Chaos CPC Homepage
    • Awards
Re: Access second RAM bank though Basic
« Reply #1 on: 20:22, 13 July 20 »
Not possible with Basic I am afraid...


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

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.

Offline andycadley

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.022
    • Awards
Re: Access second RAM bank though Basic
« Reply #2 on: 21: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
like
0
No reactions

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
    • Awards
Re: Access second RAM bank though Basic
« Reply #3 on: 10:38, 15 July 20 »
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.



Code: [Select]
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
like
0
No reactions
* 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

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 1.154
  • Country: fr
    • urban exploration
    • Awards
Re: Access second RAM bank though Basic
« Reply #4 on: 11:24, 15 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
like
0
No reactions
use RASM, the best assembler ever made :p

I will survive

Offline VincentGR

  • 6128 Plus
  • ******
  • Posts: 1.407
  • Country: gr
    • Parts from the past.
    • Awards
Re: Access second RAM bank though Basic
« Reply #5 on: 13:11, 15 July 20 »
Thank you very much all of you, I will try to translate your precious suggestions.
like
0
No reactions
Visit my BBS (Telnet) : flashbackbbs.sytes.net:6502
http://loaderror.eu/
Amiga 1200 Black Project

Offline ukmarkh

  • 6128 Plus
  • ******
  • Posts: 1.470
  • Country: england
    • Classic Replay
    • Awards
Re: Access second RAM bank though Basic
« Reply #6 on: 16:22, 11 August 21 »
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?
like
0
No reactions

Offline andycadley

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.022
    • Awards
Re: Access second RAM bank though Basic
« Reply #7 on: 16:43, 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.
like
0
No reactions

Offline eto

  • Supporter
  • 6128 Plus
  • *
  • Posts: 514
  • Country: de
    • Awards
Re: Access second RAM bank though Basic
« Reply #8 on: 18:58, 11 August 21 »
Apologies 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
like
0
No reactions

Offline Longshot

  • Supporter
  • CPC664
  • *
  • Posts: 111
  • Country: fr
    • Logon System Web Site
    • Awards
Re: Access second RAM bank though Basic
« Reply #9 on: 21:18, 01 September 21 »
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)
« Last Edit: 21:22, 01 September 21 by Longshot »
like
0
No reactions
Rhaaaaaa