0100 ;*******************************›0110 ;›0120 ; C-KEY›0130 ; a control key utility›0140 ; for all Atari 8-bits›0150 ;›0160 ; v1.5 06-10-91 by Doug Wokoun›0170 ;›0171 ; Program and source code is›0172 ; Copyright 1991 by Doug Wokoun›0173 ; See READ.ME file for›0174 ; conditions›0175 ;›0180 ;*******************************›0190 ;›0200 ; Equates›0210 DOSINI = $0C ; reset key vec›0220 BRKKEY = $11 ; break key flag›0230 RTCLOK = $12 ; real-time clock›0240 ATRACT = $4D ; attract timer›0250 VKEYBD = $0208 ; keyboard vector›0260 SDMCTL = $022F ; DMA control›0270 MEMLO = $02E7 ; bottom of memory›0280 CRSINH = $02F0 ; cursor inhibit›0290 SSFLAG = $02FF ; [un]lock output›0300 ICHID = $0340 ; device ID›0310 ICCOM = $0342 ; command byte›0320 ICBAL = $0344 ; filename address›0330 ICBAH = $0345›0340 ICBLL = $0348 ; transfer length›0350 ICAX1 = $034A ; auxiliary byte 1›0360 CONSOL = $D01F ; console buttons›0370 AUDF1 = $D200 ; frequency 1›0380 AUDC1 = $D201 ; control 1›0390 AUDCTL = $D208 ; audio control›0400 KBCODE = $D209 ; keyboard code›0410 SKCTL = $D20F ; serial port ctl›0420 CIOV = $E456 ; CIO vector›0430 COLDSV = $E477 ; cold start vec›0440 ;›0450 *= $3800›0460 ;›0470 ; Print the program identification›0480 ; message always›0490 ;›0500 LDX #0 ; channel 0›0510 LDA #9 ; put text command›0520 STA ICCOM›0530 LDA # MSG›0560 STA ICBAH›0570 LDA #255 ; message length›0580 STA ICBLL ; (overkill)›0590 JSR CIOV ; print it›0600 ;›0610 ; Now to check to see if the›0620 ; program is already installed›0630 ; so we don't have a bunch of›0640 ; copies in memory...to do this›0650 ; we'll use the very accurate›0660 ; method of sampling one byte›0670 ; of code›0680 ;›0690 LDA VKEYBD ; get address of›0700 STA 203 ; current key›0710 LDA VKEYBD+1 ; routine›0720 STA 204›0730 LDY #5 ; check 6th byte›0740 LDA (203),Y›0750 CMP #2 ; from 'AND #2'›0760 BNE NOTINS›0770 ; so I guess we can assume it's›0780 ; already loaded...exit stage›0790 ; right...›0800 RTS ›0810 ; in case it isn't loaded...›0820 NOTINS›0830 ; Plug values into program...›0840 CLC ›0850 LDA MEMLO›0860 STA $CB›0870 STA DOSINIT+24›0880 ADC #DOSINIT-START›0890 STA DOSINIT+4›0900 STA INSTALL+1›0910 LDA MEMLO+1›0920 STA $CC›0930 STA DOSINIT+29›0940 ADC #0›0950 STA DOSINIT+8›0960 STA INSTALL+2›0970 LDA DOSINI›0980 STA DOSINIT+1›0990 LDA DOSINI+1›1000 STA DOSINIT+2›1010 ;›1020 ; An improvement over previous›1030 ; versions, this one will not›1040 ; crash if you do a KEY command›1050 ; and then [RESET] in SpartaDOS.›1060 ; When reinstalling, it always›1070 ; gets the new VKEYBD address.›1080 ; KEY will still disable it until›1090 ; the next [RESET]. This loads›1100 ; registers for reinstallation.›1110 ;›1120 CLC ›1130 LDA MEMLO›1140 ADC #VEC-START+1›1150 STA V1+1›1160 LDA MEMLO+1›1170 ADC #0›1180 STA V1+2›1190 LDA V1+1›1200 ADC #1›1210 STA V2+1›1220 LDA V1+2›1230 ADC #0›1240 STA V2+2›1250 ;›1260 ; Now to actually move the bytes›1270 ; in the program since we have›1280 ; already modified it for›1290 ; relocation...since this version›1300 ; is larger than 255 bytes, I've›1310 ; traded my quickie copier for›1320 ; an industrial strength, 16-bit›1330 ; version...›1340 ;›1350 LDY #0›1360 LDA # START›1390 STA $CE›1400 LDA MEMLO›1410 STA $CB›1420 LDA MEMLO+1›1430 STA $CC›1440 COPY›1450 LDA ($CD),Y›1460 STA ($CB),Y›1470 INC $CB ; bump the regs›1480 BNE C1›1490 INC $CC›1500 C1 INC $CD›1510 BNE C2›1520 INC $CE›1530 C2 LDA $CE ; check if done›1540 CMP # >END+1›1550 BNE COPY›1560 LDA $CD›1570 CMP #