english greek
Home arrow Newbrain Information arrow Basic Extensions with Peripherals

Basic Extensions with Peripherals

Written by Chris Despoinidis
Wednesday, 23 July 2008


(Memory, Savf , Exi,  External)





1.1) Memory
When running BASIC under the paged memory operating system the storage available for programs and data is 40K. This is not affected by the amount of
I/0 facilities used. This means that a large screen (up to 80 by 255) or a large high resolution graphics area, or the DISCIO system can be used without
affecting the 40K available to the user. This will be between 2000H and BFFFH. Space may be RESERVED at the top of the area which can be used for
machine code routines, as before. Such routines can make system calls as described in the systems documentation without pre-or postamble. The pages
will always be present so that PEEK, POKE and CALL can be used as before. In addition the system page will always be present between 0 and 1FFFH and can
be PEEKed and POKEd.

1.2) Savf
A new command SAVF is available (syntax is the same as SAVE). This will save the current program in such a way that it will LOAD or MERGE faster. Programs
saved used SAVF will not VERIFY. Programs saved using SAVF can be LOADed by any BASIC. It will be found that the speed increase obtained will be greater
the larger the program is.

1.3) Exit
A new command EXIT will cause a return to the main system menu. The current program and data are lost.


1.4) External
A new command EXTERNAL and functions EXTERNAL and EXTERNALS (EXT is a synonym for EXTERNAL) exist. This facility allows access to subroutines and functions that are in add-on ROM librarys. The keyword is always followed by the name of the routine. Any parameters should be enclosed in brackets and
separated by commas. EXTERNAL routines are unusual in that the parameters may be used to return results. In this case the parameters must be variables. It
is not possible to use a function with a string result parameter in a DEF statement.



EXT sound (x,7,z)

EXTERNAL complexadd (a(1),a(2),b(1),b(2))

PRINT EXT e, EXTERNAL parity(x), EXT$ spaces(20)

EXT exchange (a$,b$,c$)

1.4)External cont..........(examples)

The following new error numbers may be given:

58) Use of an EXTERNAL subroutine as a function.

59) Use of an EXTERNAL function as a subroutin.

60) The name of the requested EXTERNAL routine cannot be found in the attached library modules.

61) The EXTERNAL function being used delivers the wrong type of result.

62) Attempt to use a function with a string result parameter within a DEF statement.

64) The type of parameter is wrong.



When the disc controller on its own is connected, BASIC works exactly as it does in a NewBrain on its own. There are two additional commands, SAVF which
is as described above, and CPM which immediately enters the 32K CP/M system, losing the current program and data.

When the disc controller is connected to a NewBrain with an expansion interface no further extension than is described above occurs (the CPM
command does not exist). To enter CP/M use EXIT and then enter CP/M from the paged system menu.

When the disc controller is connected to the system, with or without an expansion interface, devices 12-15 become available (see DISCIO
documentation). In addition commands like LOAD "PROGRAM" will use the disc system (device 12) to load the program rather than the cassette port. In this
case the name of the program will not be displayed while loading and a filename must be given (simply saying LOAD will not do).

To load or save programs from cassette, device 1 or 2 has to opened explicitly. e.g. to load a program:


And to save a program:

SAVE#1:REM Could use SAVF here!


The NewBrain CP/M system operates with two memory configurations - the 32K and 64K systems. The 32K system requires a NewBrain A or AD and a floppy disc
controller with at least one floppy disc drive. The 64K system requires the expansion interface fitted with 64K extra RAM in addition. Although the two
systems work in the same way, you may find that some of the CP/M programs you wish to run will only operate in the full 64K system. For example WORDSTAR
will only run on a 64K system. The same discs can be used for either system.

With the 32K CP/M system this can be done by using the command "CPM" from BASIC or by pressing the stop key on powerup. The 64K system can only be
entered by selecting "CP/M 2.2" from the system menu. The system information will be read from drive A and the copyright message will be displayed. At
this point if an initial command has been set by the SETINIT program it will be executed. Otherwise the CP/M prompt "A>" will be displayed.

The keyboard operates in a slightly different way than under normal conditions. The first thing is that control codes will operate as is usual
under CP/M. This means that, for example it is not immediately possible to change the mode of the screen using cntrl/W. To do this the codes have to be
sent to the screen. A trick to get round this is to use the fact that the command program reflects unrecognisable commands. If you wish say to make the
screen black on white type following "A>" cntrl/W, cntrl/Q and NEWLINE. The screen will change followed by a "?" to indicate that the control program
doesn't understand. The desired effect will however have been achieved.

Since the cursor control, home, insert and escape keys are really control keys, these will also not have the expected effect, unless the program being
run will interprete them. One effect is that cursor left often means delete the character on the left, and shift cursor left will often mean delete
everything on the left up to the prompt (if any). Many programs (e.g.WORDSTAR) will use different control keys for cursor movements.

The NewBrain keyboard has no 'delete' key. When the delete key is refered to in CP/M documentation or in CP/M program documentation the control key should
be used with the comma key instead.

The control 0 to 9 functions now have new meanings, Cntrl/0 to contrl/7 have no effect (they were to have special meanings under MP/M. Cntrl/8 will set
and unset the 'telytype caps'. When this mode is set all letters keyed in will be made into capitals whether or not the shift key is pressed. This is
similar to the old cntrl/1 function. Whenever this mode is set, the mode will be displayed on the single line display in model AD NewBrains. To obtain the
meanings the cntrl/0 to cntrl/9 keys had previously, cntrl/9 should be pressed beforehand.

The stop key has no effect.

The keyboard operates on a type-ahead buffer, which means that anything typed in will be stored until the next input is required.

The screen used by CP/M is similar to the normal screen editor except it is much simpler. It operates on a 25 by 80 screen using the normal character
set. Characters whose top bit are set will display according to the current TV mode. When the last column has been typed to the cursor stays on the last
character but changes from a line to a block to indicate that the next character typed will appear on the next line. Those control codes not listed
below will perform no action at the moment, but they may be made to do something at a later time and should be avoided.

00H - Null. No action.
01H - Insert Line. The lines below the current line (if any) are scrolled down. The current line is cleared and the cursor is moved to the left hand side.
02H - Delete Line.The current line is deleted and the lines below (if any) are scrolled up. A blank line is inserted at the bottom of the screen.
03H - Delete To The End Of Line. The character at the cursor and all characters to the right of it (if any) are converted to spaces.
05H - Cursor Off. The cursor will cease to flash.
06H - Cursor On. The cursor will start to flash.
08H - Backspace. The cursor is moved one space to the left, or if it was on the left hand side to the right hand side but one of the above
line (the 80th character). If the cursor was at the top-left corner, it is moved to the top-right corner.
09H - Tab. Spaces are printed until the column number is a multiple of 8. A NEWLINE is taken if necessary.
0AH - Cursor Down.The cursor is moved one space down, and if the cursor was at the bottom of the screen, the screen is scrolled up and a blank
line inserted at the bottom.
0BH - Cursor Up. The cursor is moved up one line, unless it was already at the top line.
0CH - Cursor Home. The cursor is moved to the top left corner.
0DH - Carriage Return. The cursor is moved to the left of the current line.
11H - Insert Mode. Further non-control characters are inserted at the cursor position, with the character previously at the cursor position and characters to the right of it moved to the right. Characters overflowing the right hand side of the screen are lost. This mode is cancelled when another control character is sent.
16H - Set Cursor Position. Following this control code the next two characters sent are interpreted as the column and row number to which
the cursor should be set. The column number should be sent first. The top row is row 1 and the left most column is column 1.
17H - Set TV Mode. Following this control code the next character sent will set the TV control register whenever that screen is being displayed.
Only bits 0 and 1 are interpreted. Bit 0 determines the background colour (0 means background dark, 1 background bright). Bit 1 determines
how characters with bit 7 set are interpreted (0 gives reverse characters, 1 allows 256 character set).
18H - Delete Left. The character to the left of the cursor is deleted and subsequent characters are moved one position to the left.The cursor is
moved one position leftwards. If the cursor was in the leftmost column, no action is taken.
19H - Delete. The character at the cursor is deleted and subsequent characters are moved one position to the left.
1AH - Cursor Right. The cursor is moved one position to the right, or if it was beyond the rightmost column (with block cursor) it is moved to the
second column on the next line.
1BH - Escape. The following character is not interpreted as a control code, except for 0, which is always ignored.
1CH - Cursor Home Left. As carriage return.
1DH - Cursor Home Right. The cursor is moved to the right most column in the line (with block cursor).
1EH - Clear Line.The current line is written with spaces and the cursor moved to the left hand side.
1FH - Clear Screen.The screen is cleared and the cursor is moved to the top left corner.

In the 32K system the PTR: device is always set to the printer port, and the RDR: and PUN: devices are set to the communications port. These are set to
work at 9600 baud. In the 64K system the ports used will be in the expansion interface instead, but these may be changed by using the CONFIGUR program.
Configuring Stream 3



Last Updated Monday, 28 July 2008

User Login

No account yet? Create account


Languages: 2
Members: 616
News: 93
WebLinks: 16
Visits since 15/09/2004
mod_vvisit_counterThis Week1628
mod_vvisit_counterThis Month3635
We have 9 guests online

Please use the NB CATALOG page here to insert your hardware and help us catalog everything that survived all these years.

Most  programs on this website are in WinRar format. The WinRar compression program is available for free on the Internet.

Latest Version is 3.0B4 (28/06/2017)

Latest Full Version is 3.0B4 (Jun 2017)

Latest Version is 2.65B1

Latest update is 2.64FN1

Latest Full Version is 2.64FINal

* Register to be able to download

  • IOS Image Rotator
  • IOS Image Rotator
  • IOS Image Rotator
  • IOS Image Rotator


Saphir17: For the diy-hard NB fanboys... Check Ebay for : GRUNDY NEWBRAIN RETRO COMPUTER MUG (Date: 25/02/2022 16:41)
gillespienewbrain: Hi, Can anyone tell me what commands I need to load a program from PC to NB over serial using PC2NB or the emulator? (Date: 08/08/2019 17:13)
Shoppie: Hello all, Found my old Newbrain in my garage again. The sticker on the bottoms shows I bought it in March 1984.... The good old computer days :-) (Date: 03/04/2018 14:12)

You are not allowed to post!


Do you have a Newbrain Home Computer?



RSS 0.91
RSS 1.0
RSS 2.0
ATOM 0.3
Powered by Elxis - Open Source CMS.
Copyright (C) 2006-2023 Elxis.org. All rights reserved.