×   Main Menu ALL The 8BS News Manuals (New menu) Links Worth a Look Tools Disc and Basic Webring Site Map 8BS Guestbook Old Guest Book Me The Barnsley Rovers   
8-Bit Software

The BBC and Master Computer Public Domain Library

BBAC Initialise Page 7 & reset Variable pointers, etc...

Submitted by Steve Fewell

Description:

Set LOMEM and VARTOP to TOP [end of BASIC program].
Gosub BBCF to do the following:
  Set BASIC PROGRAM START (MSB byte) page (&1D) to PAGE.
  Set BASIC Stack Pointer to HIMEM.
  Clear the top bit of &1F -> LISTO flag (to cancel *EDIT mode).
  Clear the Curent REPEAT level (&24).
  Clear the Current FOR level (&26).
  Clear the Current GOSUB level (&25).
  Clear the BASIC PROGRAM START LSB address (&1C).

Copy the 16-byte table in BASIC ROM locations &BF14 to &BF23 to page 7 (RAM) locations
&07F0 to &07FF. This is the Floating-Point routine table, and provides the address
for various routines which can be called from an assembly language program.

This table contains the following information (all addresses are stored LSB first):

BASIC ROM Locations Page &7 location Value and meaning
BF14-BF15 07F0-07F1 A7B8 = the executable address for FWA = SQR(FWA)
BF16-BF17 07F2-07F3 A5EE = Executable address for FWA = [argp] / FWA
BF18-BF19 07F4-07F5 A6A6 = Executable address for FWA = [argp] * FWA
BF1A-BF1B 07F6-07F7 A68D = Executable address for FWA = [argp] + FWA
BF1C-BF1D 07F8-07F9 ACCA = Executable address for compliment FWA [FWA = -FWA]
BF1E-BF1F 07FA-07FB A541 = Executable address for Load FWA [FWA = [argp]]
BF20-BF21 07FC-07FD A519 = Executable address for Store FWA [[argp] = FWA]
BF22 07FE 4A = Start of the zero page location for argp [pointer to Float variable]
BF23 07FF 2E = Start of the 8 byte zero page location of FWA


This page 7 information will be overwritten if a BASIC text (program) line is entered
which exceeds &F0 characters. But BASIC refreshes this information often, so that
it will always be available to assembly language programs.

Zero the locations &0480 to &04FF. This will overwrite the BASIC variable pointer table.
This will, however, preserve the resident Integer (A%, B%, etc...) workspace and
the Temporary Floating-Point variable areas.


Disassembly for the Initialise Page 7, etc...

BBAC   165 018 A5 12 LDA &12
BBAE   133 000 85 00 STA &00
BBB0   133 002 85 02 STA &02
BBB2   165 019 A5 13 LDA &13
BBB4   133 001 85 01 STA &01
BBB6   133 003 85 03 STA &03
BBB8   032 207 187 20 CF BB JSR &BBCF /td>
BBBB   162 016 A2 10 LDX#&10
BBBD   189 019 191 BD 13 BF LDA &BF13,X
BBC0   157 239 007 9D EF 07 STA &07EF,X
BBC3   202 CA DEX
BBC4   208 247 D0 F7 BNE -9 --> &BBBD
BBC6   162 128 A2 80 LDX#&80
BBC8   158 127 004 9E 7F 04 STZ &047F,X
BBCB   202 CA DEX
BBCC   208 250 D0 FA BNE -6 --> &BBC8
BBCE ` 096 60 RTS
BBCF   165 024 A5 18 LDA &18
BBD1   133 029 85 1D STA &1D
BBD3   165 006 A5 06 LDA &06
BBD5   133 004 85 04 STA &04
BBD7   165 007 A5 07 LDA &07
BBD9   133 005 85 05 STA &05
BBDB   169 128 A9 80 LDA#&80
BBDD   020 031 14 1F TRB &1F
BBDF d$ 100 036 64 24 STZ &24
BBE1 d& 100 038 64 26 STZ &26
BBE3 d% 100 037 64 25 STZ &25
BBE5 d 100 028 64 1C STZ &1C
BBE7 ` 096 60 RTS

 


 Back to 8BS
Or