4020 *--------------------------------
4025 V.BASEL .EQ $478+SLOTNUM
4030 V.BASEH .EQ $4F8+SLOTNUM
4035 V.CHORZ .EQ $578+SLOTNUM
4040 V.XSAV1 .EQ $402
4045 V.OLDCHAR .EQ $678
4050 *
4055 V.DEV0  .EQ SLOTNUM*16+$C080
4060 V.DISP0 .EQ $CC00
4065 V.DISP1 .EQ $CD00
4070 *--------------------------------
4075 *
4080 RDKEY  LDA KEYBOARD
4085        BPL RDKEY
4090        STA KEYSTROBE
4095        ORA #$80
4100        CMP #$81     Shift lock?
4105        BNE .1
4110        .DO LCVERSION
4115        JSR UNPROTECT.LC.RAM
4120        .FIN
4125        LSR SCM.SHIFT.FLAG
4130        BPL .2       Return with errant key
4135 .1     CMP #$9A     Shift unlock?
4140        BNE CTRLU    No, return with key
4145        .DO LCVERSION
4150        JSR UNPROTECT.LC.RAM
4155        .FIN
4160        SEC
4165        ROR SCM.SHIFT.FLAG
4170 .2     LDA #$96     Return with errant key
4175        .DO LCVERSION
4180        BIT $C080    Reprotect LC RAM
4185        RTS
4190 *
4195 UNPROTECT.LC.RAM
4200        BIT $C083    Enable Bank 2
4205        BIT $C083
4210        .FIN
4215        RTS
4220 *
4225 CTRLU  CMP #$95     CTRL-U COPY KEY
4230        BNE .3
4235        STX $400
4240        STY $401
4245        LDA V.CHORZ
4250        JSR PSNCALC
4255        BCS .1
4260        LDA V.DISP0,X
4265        BCC .2
4270 .1     LDA V.DISP1,X
4275 .2     ORA #$80
4280        STA V.OLDCHAR
4285        LDX $400
4290        LDY $401
4295 .3     RTS
4300 *
4305 PSNCALC CLC
4310        ADC V.BASEL
4315        STA V.XSAV1
4320        LDA #0
4325        ADC V.BASEH
4330        LSR
4335        PHP
4340        AND #3
4345        ASL
4350        ASL
4355        TAY
4360        LDA V.DEV0,Y
4365        PLP
4370        LDX V.XSAV1
4375        RTS
4380 *--------------------------------
