Classic Computer Magazine Archive PROGRAM LISTING: 87-03/DVORAK.M65


0100 ;PARTIAL DVORAK KEYBOARD
0110 ;BY DAVE YEARKE
0120 ;(c) 1986, ANTIC PUBLISHING
0130 ATRACT = $4D
0140 CH  =   $02FC
0150 CH1 =   $02F2
0160 DOSINI = $0C
0170 DOSVEC = $0A
0180 HELPFG = $02DC  ;XL/XE ONLY
0190 HOLDCH = $7C
0200 INITAD = $02E2
0210 KBCODE = $D209
0220 KEYDEF = $79
0230 KEYDEL = $02F1
0240 KRPDEL = $02D9  ;XL/XE ONLY
0250 MEMLO = $02E7
0260 SRTIMR = $022B
0270 SSFLAG = $02FF
0280 START = $1D00
0290 VKEYBD = $0208
0300 ;SYSTEM RESET TRAP
0310     *=  START
0320 RSTTRAP JSR DUMMY
0330     LDA # <RSTTRAP ;RESET TRAP
0340     STA DOSINI  ;ADDRESS IN DOSINI
0350     LDA # >RSTTRAP ;LO BYTES
0360     STA DOSINI+1 ;HI BYTES
0370     LDA # <DOSTRAP ;TRAP DOS CALL
0380     STA DOSVEC
0390     LDA # >DOSTRAP
0400     STA DOSVEC+1
0410     LDA # <BOTTOM ;END OF TABLE
0420     STA MEMLO   ;RESET MEMLO
0430     LDA # >BOTTOM
0440     STA MEMLO+1
0450     LDA # <HANDLER ;ADDRESS OF
0460     STA VKEYBD  ;POKEY HANDLER
0470     LDA # >HANDLER ;INTO VKEYBD
0480     STA VKEYBD+1
0490     LDA #$FF
0500     STA ARFLAG
0510     STA KBFLAG
0520     RTS 
0530 DOSTRAP LDA #$30
0540     STA SRTIMR  ;AUTO-REPEAT ON.
0550     LDA RSTTRAP+1
0560     STA DOSINI
0570     LDA RSTTRAP+2
0580     STA DOSINI+1
0590     LDA BYEBYE+1
0600     STA DOSVEC
0610     LDA BYEBYE+2
0620     STA DOSVEC+1
0630     LDA MEMHOLD
0640     STA MEMLO
0650     LDA MEMHOLD+1
0660     STA MEMLO+1
0670     LDA KEYHOLD ;REPLACE ORIGINAL
0680     STA VKEYBD  ;HANDLER
0690     LDA KEYHOLD+1
0700     STA VKEYBD+1
0710 BYEBYE JMP DUMMY
0720 ;POKEY INTERRUPT ROUTINE
0730 HANDLER TXA 
0740     PHA 
0750     LDA KBCODE
0760     CMP CH1
0770     BNE NEWKEY
0780     LDX KEYDEL
0790     BNE SETTIMES
0800 NEWKEY TAX      ;KEY VALUE INTO X.
0810     CMP #$9F    ;IS IT CTL-1?
0820     BNE CTL4    ;IF NOT, BRANCH.
0830     LDA SSFLAG  ;SCREEN FREEZE FLAG.
0840     EOR #$FF
0850     STA SSFLAG
0860     BCS SETDELAY ;SET TIMERS.
0870 CTL4 CMP #$98
0880     BNE CTL5
0890     LDA KBFLAG
0900     EOR #$FF    ;TOGGLE FLAG.
0910     STA KBFLAG
0920     BCS SETDELAY
0930 CTL5 CMP #$9D
0940     BNE HELP
0950     LDA ARFLAG
0960     EOR #$FF
0970     STA ARFLAG
0980     BCS SETDELAY
0990 HELP AND #$3F   ;MASK HIGH BITS.
1000     CMP #$11
1010     BNE CONVERT
1020     STX HELPFG
1030     BEQ SETDELAY
1040 CONVERT STX HOLDCH
1050     STX CH1
1060 ARROWS LDA ARFLAG
1070     BNE DVORAK
1080     TXA 
1090     AND #$40    ;TEST SHIFT BIT.
1100     BNE DVORAK
1110     TXA 
1120     STA HOLDCH
1130     AND #$3F
1140     LDX #$04
1150 ARLOOP DEX 
1160     CMP ARRTAB,X ;CHECK TABLE
1170     BEQ NEWARR  ;ARROW
1180     CPX #$00    ;DONE?
1190     BNE ARLOOP
1200 DVORAK LDA KBFLAG ;CHECK TYPE
1210     BNE PUTCH
1220     LDX HOLDCH
1230     TXA 
1240     AND #$C0
1250     STA HOLDCH
1260     TXA 
1270     AND #$3F
1280     TAX 
1290     LDA TABLE,X
1300     ORA HOLDCH
1310     STA HOLDCH
1320 PUTCH LDA HOLDCH
1330     STA CH
1340 SETDELAY LDA #$03 ;DEBOUNCE
1350     STA KEYDEL
1360     LDA #$00
1370     STA ATRACT
1380 SETTIMES LDA KBFLAG
1390     BEQ STIME
1400     LDA ARFLAG
1410     BEQ STIME
1420     LDA #$30
1430 STIME STA SRTIMR
1440     PLA 
1450     TAX 
1460     PLA 
1470     RTI 
1480 NEWARR LDA HOLDCH
1490     EOR #$80
1500     STA HOLDCH
1510     BNE PUTCH
1520 ;DVORAK OFFSET TABLE
1530 TABLE .BYTE $23,$39,$3E,$03,$04,$2D,$06,$07
1540     .BYTE $28,$09,$00,$3D,$0C,$12,$0E,$0F
1550     .BYTE $05,$11,$01,$13,$14,$16,$2F,$02
1560     .BYTE $18,$19,$1A,$1B,$1C,$1D,$1E,$1F
1570     .BYTE $2E,$21,$10,$15,$24,$25,$17,$27
1580     .BYTE $0A,$29,$22,$38,$2C,$2B,$20,$26
1590     .BYTE $30,$31,$32,$33,$34,$35,$36,$37
1600     .BYTE $0B,$3A,$2A,$3B,$3C,$0D,$08,$3F
1610 ;ARROW KEY TABLE
1620 ARRTAB .BYTE $06,$07,$0E,$0F
1630 KEYHOLD .DS 2
1640 MEMHOLD .DS 2
1650 ARFLAG .DS 1
1660 KBFLAG .DS 1
1670 DUMMY
1680 BOTTOM .DS 1
1690 ;INSTALLATION ROUTINE
1700 INIT LDA DOSINI
1710     STA RSTTRAP+1
1720     LDA DOSINI+1
1730     STA RSTTRAP+2
1740     LDA DOSVEC
1750     STA BYEBYE+1
1760     LDA DOSVEC+1
1770     STA BYEBYE+2
1780     LDA MEMLO
1790     STA MEMHOLD
1800     LDA MEMLO+1
1810     STA MEMHOLD+1
1820     LDA VKEYBD
1830     STA KEYHOLD
1840     LDA VKEYBD+1
1850     STA KEYHOLD+1
1860     JMP RSTTRAP+3
1870     *=  INITAD
1880     .WORD INIT
1890     .END 

Back to previous page