Category:Locomotive Basic: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 10:
Locomotive BASIC doubles as a simple operating system for the CPC and is used (together with AMSDOS RSX commands<ref>http://www.cpcwiki.eu/index.php/RSX</ref>) for disk and tape operations. As on many other 8-bit machines of the era, BASIC programs are often extended with Z80 machine code which is <tt>READ</tt> from <tt>DATA</tt> statements, <tt>[[wp:PEEK and POKE|POKE]]</tt>-d to RAM, and then <tt>CALL</tt>-ed—an approach that was especially popular with type-in games in CPC magazines.
 
Memory on the CPC 464 and 664 is subdivided into four 16 kB blocks (0 to 3), with block 3 at &c000 normally reserved for the screen. The CPC 6128 features a second 64 kB bank (blocks 4 to 7) which can be accessed from BASIC in block 1 of the first bank (&4000 and &7fff) viawith [[wp:Bank switching|bank switching]]. RSX commands for bank switching are included on the system discs and discussed in chapter 8 of the CPC user manual.<ref>http://www.cpcwiki.eu/index.php/User_Manual</ref> Even on the 64 kB models, it is possible to do [[wp:Multiple buffering|double buffering]] in BASIC by reserving another RAM block for1 the(&4000 screen,and drawing into the hidden screen&7fff), and then setting the CRTC screen address to the currently hidden screen with the BASIC [[wp:I/o port|port I/O]] command <tt>OUT</tt>e.g.
 
<lang locobasic>out &7fff,&x11000100</lang>
 
would make block 4 accessible in the address space of block 1.<ref>http://k1.dyndns.org/Vintage/Schneider%20CPC/Das%20Schneider%20CPC%20Systembuch/z87.htm</ref> This way, the entire 128 kB of memory can be used by BASIC. Alternatively, RSX commands for bank switching and copying between banks are included on the system discs and discussed in chapter 8 of the CPC user manual.<ref>http://www.cpcwiki.eu/index.php/User_Manual</ref> Even on the 64 kB models, it is possible to do [[wp:Multiple buffering|double buffering]] in BASIC by reserving another RAM block for the screen, drawing into the hidden screen, and then setting the CRTC screen address to the currently hidden screen with the BASIC [[wp:I/o port|port I/O]] command <tt>OUT</tt>.
 
The extensive CPC user manual features a finely written introduction to BASIC that does not feel as rushed or dumbed-down as in some other manuals of the time. Obviously Amstrad expected many customers would want to program their CPCs themselves, not just use them with off-the-shelf software. There are even some pretty decent BASIC type-in games in appendix 3, such as clones of the arcade classics ''[[wp:Breakout (video game)|Breakout]]'' and ''[[wp:Pong|Pong]]''.
Anonymous user