Restart problem

ZXNet echo conference «code.zx»

From Valentin Pimenov To All 1 March 1999

+-Hello, |All! +-------- ;problem conditions: ;call restart with function by: ;rst x ;db function ;HO! changes to the rules: ;nothing can be saved in cells ;memory, only on the stack! ;because implies the possibility of ;abort this execution at any time ;programs (by interruption) and switching ;to look at another, ;which probably also does this ;same section of code. (of course they have ;different stacks :) ;i.e. condition is stronger than recursive ;strong reentry. ;nb: ;calculate the address of a function by number ;unprincipled. ;1. the address table cannot be changed during the process ;work procedure. ;2. There are 256 functions :) (otherwise everyone has become too cunning). ;interested not so much in speed (although ;and she too), what a beauty of the solution. PUSH HL PUSH DE PUSH AF LD HL,6 ADD HL,SP LD E,(HL) INC HL LD D,(HL);de-return address LD A,(DE);function INC DE; de-new return address LD (HL),D;save to stack DEC HL LD(HL),E ;... ;A-FUNCTION NUMBER -> HL-ADRESS OF FUNCTION ;... POP AF POP DE EX (SP),HL RET +-All the best, All! |I was with you |Valentin Pimenov aka Valker/Style_Group +---------------

From Ivan Mak To Valentin Pimenov 6 March 1999

Greetings, Valentin! On Valentin Pimenov wrote to All: VP> ;HO! changes in the rules: VP> ;nothing can be saved in cells VP> ;memory, only on the stack! VP> ;since implies the possibility of VP> ;abort execution of this at any moment VP> ;programs (by interruption) and switch- VP> ;change to another VP> ;which may also do this VP> ;same section of code. (naturally, they VP> ;different stacks :) VP> ;i.e. condition is stronger than recur- VP> ;strong reentrant. EX (SP),HL ; save HL PUSH DE ; save DE PUSH AF ; save A LD A,(HL) INC HL ; A -> HL EX DE,HL LD L,A LD H,TABLE/256 LD A,(HL) INC H LD H,(HL) LD L,A POP AF ; ret A EX (SP),HL ;─┐ ret DE & save function address EX DE,HL ;─┘ RET ; goto function ; Function EX (SP),HL ; ret HL - 1-st step from any function !Wow! The Protoss are attacking my Zerlings! It's time to get going. Ivan. - Divorce the scheme, big and small...