> RAMCount/src v0.02 5 Count RAM on startup and display startup banner = On unexpanded BBC B, SRAM banks will be seen duplicated (/ 10-Oct-2014 v0.01 Initial working version 2) 15-Oct-2014 v0.02 Works on Electron <: FD mcode% 1024,L%-1: Need enough space for two copies plus table P7OSASCI=&FFE3:OSNEWL=&FFE7:OSWRCH=&FFEE:OSBYTE=&FFF4 Z: d pass%=0 3 nopt%=sm_pass(pass%) x [OPT opt% .ROMStart BRK:EQUW RelocTable JMP Service $EQUB &82:EQUB Copyright-ROMStart EQUB &00:EQUS "RAMCount" &EQUB &00:EQUS "0.02 (15 Oct 2014)" .Copyright +EQUB &00:EQUS "(C)J.G.Harston":EQUB &00 : .Service PHA CMP #&01:BEQ RAMCount CMP #&2B:BEQ RAMCount  .ServExit  PLA:RTS : " .RAMCount ,.LDA &28D:BEQ ServExit :\ Soft BREAK 6/LDA &27A:BNE ServExit :\ Tube active @DLDA &267:BPL ServExit :\ Startup message already replaced J: #&7F:STA &267 :\ Suppress startup message TBanner message  .MsgLoop 8LDA MsgBase,X:BEQ MsgDone :\ Print banner message JSR OSASCI:INX:BNE MsgLoop  .MsgDone : ret.lo, ret.hi, code... >gLDA #1:PHA :\ Cy=Elk, A=&01, X=??, Y=count, SP=>&01, ret.lo, ret.hi, code... HgTSX :\ Cy=Elk, A=&01, X=SP, Y=count, SP=>&01, ret.lo, ret.hi, code... RgINX:INX:INX :\ Cy=Elk, A=&01, X=SP+2, Y=count, SP=>&01, ret.lo, ret.hi, code... \2BCS CallStackNotElk :\ Not Electron f,LDA #&05:STA &104+romselect2-CodeStart,X p.CallStackNotElk zmTXA:PHA :\ Cy=Elk, A=SP+3, X=SP+2, Y=count, SP=>SP+3, &01, ret.lo, ret.hi, code... ESEC:ADC #romselect-CodeStart :\ Calculate low byte of SelectRom :STA &102+loop-CodeStart,X :\ Insert JSR SelectRom FADC #(romselect2-romselect) :\ Calculate low byte of SelectRom2 ;STA &104+romselect-CodeStart,X :\ Insert JSR SelectRom2 7LDX #15 :\ Start at X=ROM 15 L%:"Code overrun": ="4647",pass%+1,1) : sm_table Bbase80%=mcode%+mclen%:base81%=mcode%:byte%=0:count%=0:off%=0: Tbyte80%=base80%?off%:byte81%=base81%?off%: off%>=mclen%:byte80%=&80:byte81%=&80 ] ((byte81%-byte80%) &FE)<>0 "ERROR: Offset by more than one page at &";~&8000+off% M (byte80% &C0)=&80:byte%=byte%2+128*(byte81%-byte80%):count%=count%+1 1 count%=8:?O%=byte%:O%=O%+1:byte%=0:count%=0 (off%=off%+1:off%>=mclen% count%=0