SUBttl tast80 .PRINTX 'TASTATURROUTINE' ; Tastatureingabe fuer MikroDOS-mode ; by K.-D. Kirves ; 23.11.87 ; global itakt,ctint,itast,piint,bsmod PIOBD EQU 89H ctc0 equ 8ch ctc3 equ 8fh PIINT equ 1e6H CTINT equ 1eeH klatch equ 0f4h resbit equ 04 nmibit equ 08 ; fcont equ 0b7d1h fpuf equ 0b900h ; ;belegung der IX-zellen ;ix+7 ;bit 3 f-taste ; 4 code folgt ;ix+8 ;bit 0 kode steht bereit ; 1 tondauer ; 2 autorepeat on/off ; 3 time-interrupt ; 4 dauereingabe ; 5 click-on/off ; 6 CONTROL ; 7 shift lock ;ix+13 Code ;ix+10 autorepeatcounter ;ix+11 zwischencodevergleich ;ix+12 zwischencode ; ;FESTWERTE FUER TASTATURPROGRAMM TCTZK equ 143 ;CTC-ZEITKONSTANTE ;FUER TASTATURPROGRAMM TGE0 equ 101 ;GRENZE FUER NULL TGE1 equ 68 ;GRENZE FUER EINS ; ;INTERRUPTROUTINEN FUER TASTATURABFRAGE ;Z E I T I N T E R R U P T ITAKT: EI PUSH AF LD A,23H ;CTC STOP OUT (CTC3),a SET 3,(IX+8) xor a LD (IX+13),a ld (ix+11),0FFH JR ITEND ;T A S T A T U R I N T E R R U P T ITAST: EI PUSH AF IN a,(CTC3) ;CTC-STAND ABFRAGEN PUSH AF LD A,0A7H ;CTC NEU STARTEN OUT (CTC3),a LD A,TCTZK OUT (CTC3),a POP AF BIT 3,(IX+8) RES 3,(IX+8) JR NZ,ITEND CP TGE0 JR NC,ITA0 ;NULL ERKANNT CP TGE1 JR NC,ITA1 ;EINS ERKANNT PUSH HL PUSH DE ld de,ktab SRL (IX+12) and a ;cy=0 ld a,(ix+12) ld h,a rra ld l,a add a,a add a,l ;*3 bit 6,(ix+8) ;contr ? jr z,itx1 add a,2 jr itx2 ; itx1: ld l,a ld a,(ix+8) rlca xor h and 1 add a,l itx2: ld l,a ld h,0 ADD HL,DE POP DE ld a,(hl) pop hl ld (ix+13),a ;code eintragen ld a,(ix+12) ;zwischencode cp (ix+11) ; = alt ? JR Z,IT3 ld (ix+11),a ;umspeichern RES 4,(IX+8) IT5: SET 0,(IX+8) LD (IX+10),0 res 6,(ix+8) ITEND: IN A,(PIOBD) OUT (PIOBD),A POP AF RETI ; ITA0: OR A JR ITAS2 ITA1: SCF ITAS2: RR (IX+12) JR ITEND ; IT3: bit 2,(ix+8) jr nz,itend INC (IX+10) BIT 4,(IX+8) JR NZ,IT4 BIT 4,(IX+10) JR Z,ITEND SET 4,(IX+8) JR IT5 ; IT4: BIT 1,(IX+10) JR NZ,IT5 JR ITEND ;CODEWANDLUNGSTABELLE FUER TASTATUR KTAB: DEFB 'Ww',17h DEFB 'Aa',1 DEFB '2"',7ch ;oe DEFB 8h,1,8h ;CUL: ^H,^A,^H DEFB 84h,85h,86h ;Autorep/scr/back DEFB '-=',20h DEFB 0F1h,0f6h,0f1h ;F2 DEFB 'Yy',19h DEFB 'Ee',5 DEFB 'Ss',13h DEFB '3#',7dh ;ue DEFB '^~',32 DEFB 10h,87h,88h ;^P/hardcopy/ink DEFB ':*',32 DEFB 0F2h,0f7h,0f2h ;F3 DEFB 'Xx',18h DEFB 'Tt',14h DEFB 'Ff',6 DEFB '5%',5ch ;OE DEFB 'Pp',10h DEFB 7fh,19h,89h ;DEL/^Y/80-40 DEFB '0',40h,7eh ;sz DEFB 0f4h,0f9h,0f4h ;F5 DEFB 'Vv',16h DEFB 'Uu',15h DEFB 'Hh',8 DEFB '7',27h,32 DEFB 'Oo',0fh DEFB 16h,8ah,8bh ;INS/click/gr-kl DEFB '9)',8ch ;am/dt. DEFB 3,3h,8eh ;BRK/reset=8DH/mni DEFB 'Nn',0eh DEFB 'Ii',9 DEFB 'Jj',0ah DEFB '8(',20h DEFB ' ' ;SPACE DEFB 'Kk',0bh DEFB ',<',32 DEFB 13h,11h,8fh ;hex-input DEFB 'Mm',0dh DEFB 'Zz',1ah DEFB 'Gg',7 DEFB '6&',5dh ;UE DEFB ' ' ;FEHLERCODE DEFB 'Ll',0ch DEFB '.>',32 DEFB 0F5h,0fah,0f5h ;F6 DEFB 'Bb',2 DEFB 'Rr',12h DEFB 'Dd',4 DEFB '4$',5bh ;AE DEFB '_|',32 DEFB '+;',32 DEFB '/?',20h DEFB 0F3h,0f8h,0f3h ;F4 DEFB 'Cc',3 DEFB 'Qq',11h DEFB 90h,90h,90h ;SHIFT LOCK DEFB '1!',7bh ;ae DEFB 18h,3,18h ;CUD ^x/^c/^x DEFB 5,12h,5 ;CUU ^E/^R/^E DEFB 4,6,4 ;CUR ^D/^F/^D DEFB 91h,1bh,91h ;F1= ^ /ESC/ ^ DEFB 0dh,0dh,0dh ;CR key80: push hl push de push bc ky1: bit 3,(ix+7) ;f-taste? jr nz,ky2 ky3: bit 0,(ix+8) ;taste ? jR z,KYNC1 ld a,(ix+13) res 0,(ix+8) cp 0f1h jr c,kye set 3,(ix+7) ;f-taste sub 0f0h ld b,a ld hl,fpuf ky4: ld a,m inc hl and a jr nz,ky4 djnz ky4 ld a,m and a jr z,ky7 inc hl ky6: ld (fcont),hl kye: bit 4,(ix+7) jr nz,kyfc ;folgecode cp 83h ;spez.code ? jr nc,kyz bit 5,(ix+8) ;click? jr z,kync ld hl,25 ld (arg1),hl ld l,15 ld (arg1+4),hl ld l,0 ld (arg1+2),hl push af call caos defb 35h ld a,15 call caos defb 14h ld a,3 out (ctc0),a pop af KYNC: AND A KYNC1: jp pops1 ; kyfc: ld hl,(foltas) res 4,(ix+7) jr kyz1 ; ky2: ld a,(ix+13) cp 3 jr nz,ky5 ky7: res 3,(ix+7) jr ky3 ; ky5: ld hl,(fcont) ld a,m inc hl and a jr nz,ky6 jr ky7 ; kyz: ld hl,spetab sub 84h rlca ld e,a ld d,0 add hl,de ld e,m inc hl ld d,m ex de,hl res 4,(ix+7) ;code folgt res 0,(ix+8) ;taste abgeholt kyz1: ld de,ky3 push de jp (hl) ; spetab: defw auto defw scrmod ;ext defw kback ;(ext) defw hcopy defw kink ;(ext) defw bsmodx ;ext defw kclick defw kbdmod ;ext defw zsatz ;ext defw kreset defw knmi defw khex defw kshlk defw kcontr bsmodx: push de call cls8 pop de call cucpl jp bsmode ; auto: ld b,4 ;kompl auto repeat auto1: ld a,(ix+8) xor b ld (ix+8),a ret ; kshlk: ld b,80h ;kompl shift lock jr auto1 ; kcontr: ld b,40h ;control on jr auto1 ; kclick: ld b,20h ;compl click jr auto1 ; kback: ld hl,kbck1 kb1: ld (foltas),hl kb2: set 4,(ix+7) ;code folgt ret ; kbck1: call hexcon ;hintergrund jr c,kb2 jp back kink: ld hl,kink1 jr kb1 ; kink1: call hexcon ;vordergrund jr c,kb2 jp ink ; khex: ld hl,hex1 ;vorbereitung hex jr kb1 ; hex1: call hexcon ;erwarten 1.hex jr c,kb2 rlca rlca rlca rlca ld (hexm),a ld hl,hex2 jr kb1 ; hex2: call hexcon ;erwarten 2.hex jr c,kb2 ld e,a ld a,(hexm) add a,e pop de jp kync ; hexcon: sub 30h ;lesen hexzeichen ret c cp 0ah ccf ret nc AND 5FH ;KLEIN->GROSS sub 7 cp 10h ccf ret ; kreset: ld hl,kres1 ;erzeugen reset jr kb1 ; kres1: cp 8dh ret nz ld a,resbit kres2: out (klatch),a ;ausgabe steuerlatch XOR A out (klatch),a ret ; knmi: ld a,nmibit ;ausloesen nmi jr kres2 ; hcopy: ld a,0fh ;aufruf hardcopy JP OUT ; foltas: defw 0 hexm: defb 0