Coding - the procedure for correctly accessing TR-DOS through entry point #3d13.

Body #28
■· ·
(c) Brom^Ellipse 

Hello everyone, it’s me again with my necessary procedures. On this
since I want to bring to your attention the procedure for correct
accessing TR-DOS through entry point #3d13. Possibly for many
the procedure will seem familiar, so I don’t attribute it
I'm applying :)

DOS CALL SV_REG
        EX AF,AF'
        XOR A
        LD (#5D10),A
        LD(#5DOF),A
        DEC A
        LD (#5CЗА),A
        EX AF,AF'  
        LD IY,#5СЗА
        PUSH HL
        LD HL,ERROR
        EX (SP),HL
        LD (#5СЗD),SP
        CALL #3D13
        D.I. 
        POP HL
        LD (SOST_BC+1),BC
        CALL LD_REG
SOST_BC LD BC,0
        RET 
                  
ERROR DI 
        LD SP,(#5СЗD)
        POP HL
        CALL LD_REG
        JR DOS

;save the contents of all registers for later
;successful restoration
     
SV_REG EX (SP),HL
        LD (RETURN2+1),HL
        POP HL
        PUSH HL,DE,BC,AF,IX,IY
        EXX 
        PUSH HL,DE,BC
        EX AF,AF'
        PUSH AF
        EX AF,AF'
        EXX 
RETURN2 JP 0

;restore the states of the registers at the time of calling
;DOS procedure
     
LD_REG POP HL
        LD(RETURN1+1),HL
        POP AF
        EX AF,AF'
        POP BC,DE,HL
        EXX 
        POP IY,IX,AF,BC,DE,HL
RETURN1 JP 0

 

Share your thoughts about the article