> S/NullKbd 0.12 " Null keyboard support module E Demonstrate building relocation table from two images in memory (: 24 mcode% 1024: Need enough space for two copies <: Flen%=0: pass%=0 3 PP%=&8100-128*(pass%2) ZO%=mcode%+len%*(pass%2)2 dopt%="4647",pass%+1,1) n [OPT opt% x .RomStart BRK:EQUW RelocTable JMP Service $EQUB &82:EQUB Copyright-RomStart EQUB &00:EQUS "NullKeyboard" &EQUB &00:EQUS "0.12 (01 Aug 1998)" .Copyright +EQUB &00:EQUS "(C)J.G.Harston":EQUB &00 : .Service CMP #1:BNE NotService1 @LDA &28F:BNE Service1Done :\ Keyboard isn't absent LLDA &229:BPL Service1Done :\ Somebody has already claimed KEYV LDX #7 .Service1Lp !LDA KeyIntercept,X:STA &3D0,X HDEX:BPL Service1Lp :\ Copy intercept code to memory "BLDA &228:STA &3D8:LDA &229:STA &3D9 :\ Copy old KEYV to memory ,HLDA #&D0:STA &228:LDA #3:STA &229 :\ Direct KEYV to intercept code 6.Service1Done @BVS OldKeyJmp:BCS OldKeyJmp:LDA #0:RTS:.OldKeyJmp:EQUB &4C |: .RelocTable ]:len%=RelocTable-RomStart  MakeRelocTable A"*Save NullKbd ";~(mcode%+len%);" ";~O%;" FFFF0000 FFFBBC00"  : MakeRelocTable @base80%=mcode%+len%:base81%=mcode%:byte%=0:count%=0:off%=0: Rbyte80%=base80%?off%:byte81%=base81%?off%: off%>=len%: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%>=len% count%=0