Date : Thu, 21 Aug 2008 22:37:38 +0100
From : jgh@... (Jonathan Graham Harston)
Subject: Master 128 century programs
"Raf" wrote:
> On 18/08/2008 Jonathan Graham Harston wrote:-
[snip]
> 200 .ServReset
> 210 LDA &20C:STA oldwordv+0
> 220 LDA &20D:STA oldwordv+1
> 230 LDA #newword AND 255:STA &DB1
> 240 LDA #newword DIV 256:STA &DB2
> 250 STX &DB3 --> LDA &F4:STA &DB3
Why? The service handler is entered with X holding the ROM number
already.
> 260 LDA #&12:STA &20C
> 270 LDA #&FF:STA &20D
> 280 LDA #&27:RTS
> 290 :
> 300 .newword
> 310 CMP #14:BEQ newword14
> 320 .oldword
> 330 JMP (oldwordv)
> 340 :
> 350 .newword14
> 360 STX &F0:STY &F1
> 370 LDY #0:LDA (&F0),Y:PHA --> STA &EF:JSR oldword
Why? The code doesn't use &EF anywhere, and the very first thing
the MOS OSWORD routine called by JSR oldword does *is* STA &EF.
> 380 LDY &F1:LDA #14:JSR oldword --> LDX &F0:CPX #0:BEQ over
So, if the control block is on a page boundary, then jump past the
following instruction. Why? The position of the OSWORD control
block has absolutely no relavance to the functioning of the OSWORD
call, and if OSWORD calls do take account of the location of the
control block, it destroys the functionality of the OSWORD call, as
DIM ctrl% num can put the control block anywhere in memory.
> 390 PLA:BNE exit --> JMP oldword
--> .over
Your changes have changed the code from:
Save the OSWORD 14 subfunction, call the MOS OSWORD 14 code, if the
OSWORD 14 subfunction was not zero, exit, otherwise modify the
returned data
to:
Waste an instruction storing the number 14 in location &EF, call
the MOS OSWORD 14 code, if the control block happens to be at &xx00
then modify the returned data, otherwise, call the MOS OSWORD 14
code a second time.
> 400 LDY #11:LDA #ASC"2":STA (&F0),Y
> 410 INY:LDA #ASC"0":STA (&F0),Y
> 420 .exit
> The listing above that you sent me causes problems
> with *BUILD <fsp> and *APPEND <fsp>. These
That's weird. I've just tried it here, and you're right:
>*BUILD &._TEST_
1 HELLO
2
>*DUMP &._TEST_
000000 0D .
>*SPOOL
There's no way that should be happening. The only thing I can think
of is that the *BUILD command is in ROM 15, and when it calls
OSWORD 0 to read a line it is unprepared for the OSWORD call to
page in a different ROM. The only way around that is to not use the
extended vectors, but manually intercept WORDV in main memory with
something like:
.newword
PHX
LDX &F4:PHX
LDX #myrom:STX &F4:STX &FE30
PHA
TSX:LDA &103,X:TAX
PLA:JSR myword
STX &F0
PLX:STX &F4:STX &FE30
LDX &F0:RTS
> be others that don't work, etc. The contents of &B0 to
> &CF don't appear to be correct.
What do you mean by "correct". &B0-&CF are private filing system
workspace, so what's correct is whatever the filing system itself
wants, and will change at any time whenever any filing system
operation occurs.
--
J.G.Harston - jgh@... - mdfs.net/User/JGH
05:10:36, 18-Nov-2008 - RISC OS time rolls over to &5000000000