Date : Fri, 11 Feb 2000 01:05:16 +0000
From : jgh@... (Jonathan Graham Harston)
Subject: BBC Master not Y19C compliant
jgh@... (Jonathan Graham Harston) wrote:
> The code should really have been written to do something like:
> FFFFxxxx: AD F7 02 LDA &02F7 ; get year number from workspace
> C9 81 CMP #&81 ; check against pivot year
> A9 19 LDA #&19 ; 1981...1999
> B0 02 BCS P%+4
> A9 20 LDA #&20 ; 2000...2080
> Yeah gods, only an addition 9 bytes!
> And there's 65 spare bytes at &FFFFB8BF! It would have fitted!
In trawling around the web (after the office internet access was restored)
I came across http://members.tripod.com/~g8fsl/bbc/bbc_master.html which
has been alluded to elsewhere, which pointed out that the A register is
still holding the decade character at the point FFFFxxxx above, so it
could have been written as:
20 93 98 JSR &9893 ; store year number in string
FFFFxxxx: C9 38 CMP #ASC"8" ; check pivot decade character
A9 19 LDA #&19 ; 1980...1999
B0 02 BCS P%+4
A9 20 LDA #&20 ; 2000...2079
Only 6 additional bytes!
Andrew's recommended patch is:
Change: to:
FFFF9880: A9 LDA #&19 20 JSR &B8E0
FFFF9881: 19 E0
FFFF9882: 20 JSR &9893 B8
FFFF9883: 93 EA NOP
FFFF9884: 98 EA NOP
FFFFB8E0 C9 38 CMP #ASC"8"
A9 19 LDA #&19
B0 02 BCS P%+4
A9 20 LDA #&20
4C 93 98 JMP &9893
In my instinctive efficiency-searching, I'd get rid of those NOPs by
factorising out the CMP:
Change: to:
FFFF9880: A9 LDA #&19 C9 CMP #ASC"8"
FFFF9881: 19 38
FFFF9882: 20 JSR &9893 20 JSR &B8E0
FFFF9883: 93 E0
FFFF9884: 98 B8
FFFFB8E0 A9 19 LDA #&19
B0 02 BCS P%+4
A9 20 LDA #&20
4C 93 98 JMP &9893
(and the same method for MOS 3.50)
Posters have asked what roms are essential, having extra bits of MOS in
them, and so can't be replaced. Generally:
FFFFC000 MOS
FFFFFFFF
FFFF8000 Terminal - Most MOS OSCLI, OSWORD, OSBYTE, and CFS routines
FFFF81ish Reset/Startup routines
FFFF83ish MOS *Command table and *HELP MOS routine
FFFF85ish MOS *Command routines
FFFF87ish MOS *Configure and *Status routines
FFFF8Fish OSWORDs and OSBYTEs
FFFF9Fish Cassette Filing System
FFFFB1ish Terminal
FFFFB8BF 65 Spare bytes (all &FFs)
FFFFB900 Default font
FFFFBFFF
FFFE8000 View - View word processor, VDU routines
FFFEB310 View Tube reloctation code
FFFEB39F View Tube relocation table
FFFEB9E6 Spare bytes (all &FFs)
FFFEBA00 VDU routines
FFFEBFF6 Spare bytes (all &FFs)
FFFEBFFF
FFFD8000 ADFS - calls routines in rom (this EOR 4) (ie rom 9 - DFS)
directly.
FFFC8000 BASIC
FFFCBFFF
FFFB8000 Edit
FFFB8780 Help screen text
FFFB9780
FFFB9CBish More help text
FFFBA4Bish
FFFBBFEB "Roger Wilson"
FFFBBFF7 spare bytes (all &00s)
FFFBBFFF
FFFA8000 ViewSheet
FFFABFFF
FFF98000 DFS - routines called by (this EOR 4) (ie rom 13 - ADFS)
directly.
FFF9AA64 SRAM utilities
FFF9B8D7 spare bytes (all &FFs)
FFF9BFFF
So, you need to keep the first half of rom 15, the last 7 pages of rom 15,
and the last six pages of rom 14. The relative positions of ADFS and DFS
have to stay the same - four slots apart - and you have to take care with
the cross-rom routine calling. If you remove rom 9 you loose the SRAM
utilities as well as DFS.
I'd personally rip out the CFS and Terminal from rom 15, patch View to
make NewView, remove ViewSheet and Edit. That would leave me with about
8k in rom 15, which I'd put a better terminal into, and two other roms
slots. I'd replace the combination of DFS, ADFS and HADFS in another rom
with HADFS6 and DiskCore, giving me another spare rom slot. Something
like:
Change: to:
ROM F MOS+TERMINAL MOS+Better terminal
ROM E VIEW+VDU routines NewView+VDU routines
ROM D ADFS DiskCore
ROM C BASIC BASIC
ROM B Edit <spare>
ROM A ViewSheet ANFS
ROM 9 DFS HADFS6 (DFS+ADFS+HADFS+DOSFS+CPMFS)
ROM 8 ANFS
ROM 7 HADFS
--
J.G.Harston (JGH BBC PD Library) 70 Camm Street, Walkley, SHEFFIELD S6 3TR
jgh@... - Running on BBCs & Masters with SJ MDFS FileServer
Z80+6502/CoPro+Tubes/Econet+SJ -- http://mdfs.net
A TRUE Klingon Warrior does not comment his code!