asm incs
        !SOURCE    "vmsrc/plvmzp.inc"
XPAGE   =       $1600
NEXTOP  =       $F0
FETCHOP =       NEXTOP+1
IP      =       FETCHOP+1
IPL     =       IP
IPH     =       IPL+1
IPX     =       XPAGE+IPH
end
//
// Save environment (PLASMA ZP and stack) for below and return 0
//
export asm except(env)
        LDA     ESTKL,X
        STA     SRC
        LDA     ESTKH,X
        STA     SRC+1
        STX     ESP
        TSX
        STX     TMPL
        LDY     TMPL
-       LDA     $0100,Y
        STA     (SRC),Y
        INY
        BNE     -
        INC     SRC+1
        LDX     #ESTK
-       LDA     $00,X
        STA     (SRC),Y
        INY
        INX
        BNE     -
        TXA
        LDX     ESP
        STA     ESTKL,X
        STA     ESTKH,X
        RTS
end
//
// Restore environment saved above and return retval
//
export asm throw(env, retval)
        LDA     ESTKL,X
        STA     SRC
        LDA     ESTKH,X
        STA     SRC+1
        LDA     ESTKL+1,X
        STA     DST
        LDY     ESTKH+1,X
        INY
        STY     DST+1
        LDX     #ESTK
        LDY     #$00
-       LDA     (DST),Y
        STA     $00,X
        INY
        INX
        BNE     -
        DEC     DST+1
        LDX     TMPL
        TXS
        LDY     #$FE
-       LDA     (DST),Y
        STA     $0100,Y
        DEY
        CPY     TMPL
        BNE     -
        LDX     ESP
        LDA     SRC
        STA     ESTKL,X
        LDA     SRC+1
        STA     ESTKH,X
        RTS
end
done
