This file contains routines to add the following operations to BASIC-11/RT:

	1. Peek at a location (word)
	2. Poke to a location (word)
	3. Single character input (keyboard)
	4. Bit setting at a location (word)
	5. Bit clearing at a location (word)

To build the new version, extract any or all of the MACRO sources for the
functions you want. Copy the file BSCLI.MAC to a convenient name and edit
any or all of the following to that file to create a new table:

	.GLOBL	FTABI,BKGI

	.GLOBL	POKENM,PEEKNM,GETCH,BISNAM,BICNAM ;This line is added

FTABI:	.WORD	FTBL
FTBL:	.WORD	POKENM	;new
	.WORD	PEEKNM	;new
	.WORD	GETCH	;new
	.word	BISNAM	;new
	.word	BICNAM	;new
	.WORD	0

BKGI:	.WORD	0

Follow the instructions in the BASIC-11 Installation Guide (paragraph 4.2.4)
to do the assembly of the routines. Substitute the newly created file  for
BSCLI.MAC.

After the assembly is complete run the configuration program to create
a new command file to build your new BASIC. At the "CALL support" question
answer yes and then at each "Module name" prompt enter the function name.
Note that this name is the same as the MACRO-11's ASCII operator's argument
in each routine. The order of the new functions is not important.

Complete instructions for adding routines to BASCI-11/RT are contained in
chapter 4 of the User's Guide and in paragraphs 4.2.4 to 4.4 of the
Installation Guide.

***************************************************************************

	.TITLE	PEEK.MAC	A PEEK UTILITY FOR BASIC-11

	.Enabl lc

; This routine copies the 16-bit value from an address in physical memory
; to an integer variable. Usage is "PEEK at A...store in B". Both values
; must be integer variables. Error check is done for number of arguements,
; but not for the variable type. 

	.GLOBL	PEEKNM $ARGER

PEEKNM:	.BYTE	4
	.ASCII	"PEEK"
	.EVEN
	.WORD	PEEKST

PEEKST:	CMPB	#2,(R5)			; Two arguements only ?
	BNE	ERROR			; No, tell the dummy.
	MOV	@2(R5),R0		; Get read address first.
	MOV	(R0),@4(R5)		; Then pass value back.
	RETURN
ERROR:	JMP	$ARGER			; Error entry.
	.END

******************************************************************************

	.TITLE	POKE.MAC	A POKE UTILITY FOR BASIC-11

	.Enabl	lc

; This routine moves a 16-bit value into a physical address. Usage is "POKE
; A into B". A and B are integers. A check is done for the correct number of
; arguements, but the variable type passed is not checked. Both must be
; integers. 

	.GLOBL	POKENM $ARGER

POKENM:	.BYTE	4
	.ASCII	"POKE"
	.EVEN
	.WORD	POKEST

POKEST:	CMPB	#2,(R5)			; Two and only two ARGs ?
	BNE	ERROR			; No, tell the dummy.
	MOV	@4(R5),R0		; Get location to stuff
	MOV	@2(R5),(R0)		; And stuff it.
	RETURN
ERROR:	JMP	$ARGER			; Error entry.
	.END

*****************************************************************************

	.Title	BISMAC.MAC	BASIC-11 BIS UTILITY

	.Enabl	lc

; This routine provides for direct bit-setting operations on a physical
; address. Unlike the POKE call this routine doesn't disturb other bits
; in a location. Useage is "BIS A into B" where both A and B are 16-bit
; integer variables. Error checking is done on the number of arguements
; but not on the type of arguement.

	.Globl	bisnam,$arger

bisnam:	.byte	3
	.ascii	'BIS'
	.even
	.word	bisst

bisst:	cmpb	#2,(r5)			; Two arguements only?
	bne	error			; No, tell the user.
	mov	@2(r5),r0		; Get the bit pattern to use.
	mov	@4(r5),r1		; Then get where to change.
	bis	r0,(r1)			; And change it.
	return
error:	jmp	$arger			; Error entry.
	.end

******************************************************************************

	.Title	BICMAC.MAC	BASIC-11 bit clear function
	.Enabl	lc

; This routine allows the user to selectively clear bits in a 16-bit
; physical location. Useage is "BIC A into B" where both A and B are
; integer variables. Error checking is done on the number of arguements
; but not on the type. This call complements the BIS call, and the POKE
; call.

	.Globl	bicnam,$arger

bicnam:	.byte	3
	.ascii	'BIC'
	.even
	.word	bicst

bicst:	cmpb	#2,(r5)			; Two arguements only ?
	bne	error			; No, tell user.
	mov	@2(r5),r0		; Get the bit pattern to use.
	mov	@4(r5),r1		; Next get the location to clear.
	bic	r0,(r1)			; Clear them bits.
	return
error:	jmp	$arger			; Error entry.
	.end

******************************************************************************

	.TITLE	GETCH.MAC	SINGLE CHAR FETCH FROM KEYBORD

	.Enabl lc

; This routine allows BASIC to use characters immediately after they become
; available, rather than after a line terminator is entered. Usage is "GETCH
; in A" where A is an integer variable. If no character is available, a
; negative value is passed. If a character is available, then that character
; is passed back. Note that a whole word is passed rather than a byte.
; For proper results the JSW (44 oct.) should be setup prior to calling GETCH.

	.GLOBL	GETCH,$ARGER

	.MCALL	.TTINR

GETCH:	.BYTE	5
	.ASCII	"GETCH"
	.EVEN
	.WORD	GETCST

	.Enabl	lsb

GETCST:	.TTINR				; See if monitor has a character.
	BCC	1$			; Yes, skip the next step
	ROR	R0			; No, copy the carry bit in bit-15.
1$:	MOV	R0,@2(R5)		; Pass the contents of R0 back.
	RETURN
	.END
