RST #10, command
ZXNet echo conference «code.zx»
From 812/03.00 → To Denis Parinov 6 December 1997
I suddenly saw on 05-12-97, at 02:24, Denis Parinov wrote to All:
Hi Denis!
DP> Maybe someone was involved in calling subroutines via RST #10:
DP> RST #10
DP> db
DP> I'm interested in a program that does this as quickly as possible.
DP> 48 BASIC does not need to be processed, we will get to RST
DP> this program right away.
I’m not ashamed to admit that I’m working on it... :)
There's no way to get anything quick here. the gist is this:
First we initialize the interceptions...
where we write the thread:
LD HL,rst16_
LD (#5C51),HL
and on the rst16_ label there should be
this is:
rst16_DW rst16
that is, this address contains the real
interceptor address.
Well, this is the processing procedure itself,
there were no optimizations! this is an example
from raw source.
rst16
LD HL,0
ADD HL,SP
LD BC,4
ADD HL,BC
LD (ADR_ST+1),HL
LD E,(HL)
INC HL
LD D,(HL); found the address
LD A,(DE); which follows
INC DE; just after rst 16
; saved ix
; in register A with us
; next byte immediately
; for rst
The DE register is vital, it is now
points to the second byte after rst16.after the ADR_ST label it must indicate
per byte after all data! that is already
to the next command. this is of course for
of this example.
here by type we switch to ours
procedures.
AND A
JR Z,proc1
DEC A
JR Z,proc2
exit
ADR_ST LD HL,0; replace the address
; return on stack
LD (HL), E to the one we need,
INC HL contained in DE
LD(HL),D
RET
that's all, in a nutshell
say... try, optimize, I hope
you've already seen what's going on in the ROM for this
about... trace any rst 16...
ps. This procedure does not allow recursions!
that is, it cannot be called if we have already
went via rst16. only one occurrence, but
You can do anything you want.
▌▌║▌█▐│▌▌▐▐ WiTh The BeST wIsheS fROM
▌▌║▌█▐│▌▌▐▐ *C*R*E*A*T*O*R*
▌812/03.00▐
-+- SMM version 1.05
From 812/08.16 → To Paul Falcon 7 December 1997
Greetings, Paul!
In the echo of CODE.ZX, you wrote a letter
for Denis Parinov. It was 06-12-97, at 00:00.
DP>> Maybe someone was involved in calling subroutines via RST #10:
DP>> RST #10
DP>> db
DP>> I'm interested in a program that does this as quickly as possible.
DP>> 48 BASIC does not need to be processed, we will get to RST
DP>> this program right away.
[skip]
The point is that the handler must be in ROM and save
registers. I wrote it in principle, but it has a drawback
he ruins the flags.
rst_16 PUSH HL
PUSH DE
LD HL,4
ADD HL,SP
LD E,(HL) ;Take the lowest byte of the return address
INC (HL) ;Adjust the low byte of the address. on the stack
INC HL
LD D,(HL) ;Take the high byte of the return address
JP NZ,LP
INC (HL); If necessary, corr. high byte return address
LP EX DE,HL ;B HL - return address
LD L,(HL) ;Take the code
LD H,PROG/256
LD E,(HL) ;Remove the smallest byte of the subroutine address from
;tables
INC H ;Go to the table of high bytes
LD D,(HL);Remove high byte
EX DE,HL
POP DE
EX (SP),HL ;Place the address of the required subroutine on the stackRET ; and go to it
PROG DEFS 256 ;256 ml bytes of subroutine addresses
DEFS 256 ;256 st.bytes ---------//--------
Maybe it can be done faster somehow.
PF>
PF> that's all, in a nutshell
PF> say... try, optimize, I hope
Well, of course I’ll try it :)
PF> you've already seen what's going on in the ROM for this
PF> about... trace any rst 16...
Yes, there is nothing interesting in the choice of channels, but for RST 8,
In general, it looks like they decided not to bother :)
PF> ▌▌║▌█▐│▌▌▐▐ WiTh The BeST wIsheS fROM
PF> ▌▌║▌█▐│▌▌▐▐ *C*R*E*A*T*O*R*
PF> ▌812/03.00▐
All the best, Mr. Paul Falcon
That's actually all I wanted to say
on the topic "RST #10, command".
Best regards, Denis.
-+- SMM version 1.05
From 812/03.00 → To Denis Parinov 13 December 1997
Suddenly I saw on 12/12/97, at 05:08, Denis Parinov wrote to Paul Falcon:
Hi Denis!
giving two and a half hours of his
great life to this problem, that's what I
got it... ;)
rst_16
PUSH HL; 11
POP HL; 10th place X
POP HL; 10
INC HL; 6
PUSH HL; 11
DEC HL; 6
LD L,(HL) ; 7
LD H,PROG/256; 7
DEC SP; 6
DEC SP ; 6
PUSH AF ; 11th place Y
LD A,(HL) ; 7
INC H; 4
LD H,(HL) ; 7
LD L,A ; 4
POP AF ; 10
EX (SP),HL ; 19
RET ; 10
after all, 152 bars...
PROG DEFS 256 ;256 ml bytes of subroutine addresses
DEFS 256 ;256 st.bytes ---------//--------
OOO! it looks like something happened, it works at first glance, but
even if not, I think you understand.
152 clock cycles... in my opinion this is not the limit ;)
but... if there is an interruption between
place X and Y then HL will be lost.
▌▌║▌█▐│▌▌▐▐ WiTh The BeST wIsheS fROM
▌▌║▌█▐│▌▌▐▐ *C*R*E*A*T*O*R*
▌812/03.00▐
-+- asm...