8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly


BASIC IV ROM Routines
Page Last Altered:


80E7 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.

Set the error pointer [addresses &FD-&FE] to point to the Copyright message of the BASIC ROM (which is address &8013).
This sets the last Error Message description to the Copyright message (as shown by typing REPORT after the BASIC ROM
has initialised).
Note: This overrides the MOS default of setting the error pointer to the Version Number of the Language ROM.

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 &B2B2 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 &8FF2 for further initialisation.


Changes from BASIC IV: Set the error pointer [addresses &FD-&FE] to point to the Copyright message of the BASIC ROM (which is address &8013).
This didn't need to be done in BASIC IV, as the BASIC 4 ROM doesn't have a Version number (so the MOS will set &FD-&FE
to the copyright message automatically.


Disassembly for the Startup Initialisations routine

80E7 % 037 017 25 11 AND &11
80E9   005 013 05 0D ORA &0D
80EB   005 014 05 0E ORA &0E
80ED   005 015 05 0F ORA &0F
80EF   005 016 05 10 ORA &10
80F1   208 012 D0 0C BNE 12 --> &80FF
80F3 A 169 065 A9 41 LDA#&41
80F5   133 013 85 0D STA &0D
80F7 I 073 019 49 13 EOR#&13
80F9   133 014 85 0E STA &0E
80FB I 073 005 49 05 EOR#&05
80FD   133 015 85 0F STA &0F
80FF   169 132 A9 84 LDA#&84
8101   032 244 255 20 F4 FF JSR &FFF4 OSBYTE
8104   134 006 86 06 STX &06
8106   132 007 84 07 STY &07
8108 : 058 3A DEC A
8109   032 244 255 20 F4 FF JSR &FFF4 OSBYTE
810C   132 024 84 18 STY &18

810E

 

162 019

A2 13

LDX#&13

8110

 

134 253

86 FD

STX &FD

8112

 

162 128

A2 80

LDX#&80

8114

 

134 254

86 FE

STX &FE

8116 d 100 031 64 1F STZ &1F
8118   156 002 004 9C 02 04 STZ &0402
811B   156 003 004 9C 03 04 STZ &0403
811E   162 255 A2 FF LDX#&FF
8120 # 134 035 86 23 STX &23
8122   162 010 A2 0A LDX#&0A
8124   142 000 004 8E 00 04 STX &0400
8127   202 CA DEX
8128   142 001 004 8E 01 04 STX &0401
812B 169 178 A9 B2 LDA#&B2
812D   141 002 002 8D 02 02 STA &0202
8130   169 178 A9 B2 LDA#&B2
8132   141 003 002 8D 03 02 STA &0203
8135 X 088 58 CLI
8136 L- 076 045 143 4C 2D 8F JMP &8FF2 BASIC ROM Startup initialisation (part 2)

 


 Back to 8BS
Or