×   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

802B Startup Initialisations

Submitted by Steve Fewell

Description:

If the Random Number seed value (&0D-&11) is zero then default the seed value to &0000575241, where:
byte &0D contains #&41, byte &0E contains #&52, byte &0F contains #&57, byte &10 contains 0
and byte &11 contains 0.
Otherwise, leave the Random Number seed at its current value.

Call OSBYTE &84 (Read top of user RAM address) and set HIMEM (&06-&07) to the address returned.
Call OSBYTE &83 (Read operating system high water mark (OSHWM)) and set PAGE (&18) to the MSB of the address returned.

Zero byte &1F (LISTO Flag).
Initialise the @% variable:
-> Zero &0402 (@% field 2 - number format = 'general')
-> Zero &0403 (@% field 3 - STR$ number format = 'do not use @% for STR$')
-> Set @% field 0 (Field width) to #&0A (10 characters wide)
-> Set @% field 1 (Number of Decimals to display) to #&09 (Show 9 digits after the decimal point)

Set the BRK vector (&0202-&0203) to address &B278 this is the routine that BASIC will run when an error is
generated.
Clear the 6502 Interrupt flag (so that operating system interrupts are now allowed).
jump to &8F2D for further initialisation.


Disassembly for the Startup Initialisations routine

802B % 037 017 25 11 AND &11
802D   005 013 05 0D ORA &0D
802F   005 014 05 0E ORA &0E
8031   005 015 05 0F ORA &0F
8033   005 016 05 10 ORA &10
8035   208 012 D0 0C BNE 12 --> &8043
8037 A 169 065 A9 41 LDA#&41
8039   133 013 85 0D STA &0D
803B I 073 019 49 13 EOR#&13
803D   133 014 85 0E STA &0E
803F I 073 005 49 05 EOR#&05
8041   133 015 85 0F STA &0F
8043   169 132 A9 84 LDA#&84
8045   032 244 255 20 F4 FF JSR &FFF4 OSBYTE
8048   134 006 86 06 STX &06
804A   132 007 84 07 STY &07
804C : 058 3A DEC A
804D   032 244 255 20 F4 FF JSR &FFF4 OSBYTE
8050   132 024 84 18 STY &18
8052 d 100 031 64 1F STZ &1F
8054   156 002 004 9C 02 04 STZ &0402
8057   156 003 004 9C 03 04 STZ &0403
805A   162 255 A2 FF LDX#&FF
805C # 134 035 86 23 STX &23
805E   162 010 A2 0A LDX#&0A
8060   142 000 004 8E 00 04 STX &0400
8063   202 CA DEX
8064   142 001 004 8E 01 04 STX &0401
8067 x 169 120 A9 78 LDA#&78
8069   141 002 002 8D 02 02 STA &0202
806C   169 178 A9 B2 LDA#&B2
806E   141 003 002 8D 03 02 STA &0203
8071 X 088 58 CLI
8072 L- 076 045 143 4C 2D 8F JMP &8F2D BASIC ROM Startup initialisation (part 2)

 


 Back to 8BS
Or