mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-11-13 20:04:37 +00:00
Add VT100 driver for Atari.
A special font will be needed for best user experience. This is not included yet.
This commit is contained in:
parent
0ecc367b85
commit
e2b58b0683
@ -10,6 +10,7 @@
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "../inc/common.i"
|
||||
.include "atari.inc"
|
||||
|
||||
allowed_ptr = ptr1
|
||||
|
||||
@ -37,10 +38,10 @@ get_filtered_input:
|
||||
jsr get_key
|
||||
sta LASTCHAR
|
||||
|
||||
cmp #$fe ; Delete
|
||||
cmp #ATRUB ; Delete
|
||||
beq @delete
|
||||
|
||||
cmp #$9b ; Return
|
||||
cmp #ATEOL ; Return
|
||||
beq @input_done
|
||||
|
||||
; End reached?
|
||||
@ -105,15 +106,15 @@ get_filtered_input:
|
||||
sta GOTINPUT,y
|
||||
|
||||
; Print the backspace char
|
||||
lda #$88
|
||||
lda #ATRUB
|
||||
jsr print_a
|
||||
|
||||
; Print the a space
|
||||
lda #$a0
|
||||
lda #' '
|
||||
jsr print_a
|
||||
|
||||
; Print the backspace char
|
||||
lda #$88
|
||||
lda #ATRUB
|
||||
jsr print_a
|
||||
|
||||
; Wait for next char
|
||||
|
@ -5,7 +5,7 @@
|
||||
.export get_key_if_available
|
||||
.export get_key_ip65
|
||||
.export abort_key
|
||||
.exportzp abort_key_default = 0
|
||||
.exportzp abort_key_default = 1
|
||||
.exportzp abort_key_disable = 0
|
||||
|
||||
.import ip65_process
|
||||
@ -13,9 +13,61 @@
|
||||
|
||||
.data
|
||||
|
||||
abort_key: .byte 0 ; ???
|
||||
iocb: .byte 0
|
||||
kname: .byte "K:",155
|
||||
abort_key: .byte 1
|
||||
|
||||
|
||||
; keyboard translation tables for combinations not handled or supported by the ROM
|
||||
|
||||
; scan codes
|
||||
special_key_table:
|
||||
.byte $b5 ; Ctrl-8
|
||||
.byte $f5 ; Shift-Ctrl-8
|
||||
.byte $a0 ; Ctrl-,
|
||||
.byte $e0 ; Shift-Ctrl-,
|
||||
.byte $a6 ; Ctrl-/
|
||||
.byte $e6 ; Shift-Ctrl-/
|
||||
.byte $a2 ; Ctrl-.
|
||||
.byte $e2 ; Shift-Ctrl-.
|
||||
.byte $b3 ; Ctrl-7
|
||||
.byte $f3 ; Shift-Ctrl-7
|
||||
.byte $ce ; Shift-Ctrl--
|
||||
.byte $a1 ; Ctrl-<Space>
|
||||
.byte $e1 ; Shift-Ctrl-<Space>
|
||||
.byte $b0 ; Ctrl-9
|
||||
.byte $f0 ; Shift-Ctrl-9
|
||||
.byte $b2 ; Ctrl-0
|
||||
.byte $f2 ; Shirt-Ctrl-0
|
||||
.byte $ed ; Shirt-Ctrl-T
|
||||
.byte $de ; Shirt-Ctrl-2
|
||||
special_key_table_len = * - special_key_table
|
||||
|
||||
; return values for scan codes
|
||||
special_key_table2:
|
||||
.byte $00 ; Ctrl-8 ==> Ctrl-@
|
||||
.byte $00 ; Shift-Ctrl-8 ==> Ctrl-@
|
||||
.byte $1b ; Ctrl-, ==> Ctrl-[
|
||||
.byte $1b ; Shift-Ctrl-, ==> Ctrl-[
|
||||
.byte $9c ; Ctrl-/ ==> Ctrl-\ ($1c already used for cursor up, ATURW)
|
||||
.byte $9c ; Shift-Ctrl-/ ==> Ctrl-\
|
||||
.byte $9d ; Ctrl-. ==> Ctrl-] ($1d already used for cursor down, ATDRW)
|
||||
.byte $9d ; Shift-Ctrl-. ==> Ctrl-]
|
||||
.byte $9e ; Ctrl-7 ==> Ctrl-^ ($1e already used for cursor left, ATLRW)
|
||||
.byte $60 ; Shift-Ctrl-7 ==> `
|
||||
.byte $9f ; Shift-Ctrl-- ==> Ctrl-_ ($1f already used for cursor right, ATRRW)
|
||||
.byte $00 ; Ctrl-<Space> ==> Ctrl-@
|
||||
.byte $00 ; Shift-Ctrl-<Space> ==> Ctrl-@
|
||||
.byte $7b ; Ctrl-9 ==> {
|
||||
.byte $7b ; Shift-Ctrl-9 ==> {
|
||||
.byte $fd ; Ctrl-0 ==> }
|
||||
.byte $fd ; Shift-Ctrl-0 ==> }
|
||||
.byte $9e ; Shift-Ctrl-T ==> ~
|
||||
.byte $9e ; Shift-Ctrl-2 ==> ~
|
||||
; translations $9c..$9f -> $1c..$1f, $9e -> $7e, and $fd -> $7d will be done in atrvt100.s
|
||||
|
||||
.bss
|
||||
|
||||
; uncomment for debugging all CH_save related stuff
|
||||
;CH_save: .res 1
|
||||
|
||||
|
||||
.code
|
||||
@ -28,40 +80,78 @@ get_key:
|
||||
rts
|
||||
|
||||
; inputs: none
|
||||
; outputs: A contains ASCII value of key just pressed (0 if no key pressed)
|
||||
; outputs: A contains ASCII value of key just pressed (A=0 and ZF=1 if no key pressed, sometimes only ZF is tested by the caller)
|
||||
get_key_if_available:
|
||||
lda CH ; GLOBAL VARIABLE FOR KEYBOARD
|
||||
cmp #255
|
||||
beq @nokey
|
||||
ldx iocb ; K: already open?
|
||||
bne @read
|
||||
ldx #$40 ; IOCB to use for keyboard input
|
||||
stx iocb ; mark K: as open
|
||||
lda #<kname
|
||||
sta ICBAL,x ; 1-byte low buffer address
|
||||
lda #>kname
|
||||
sta ICBAH,x ; 1-byte high buffer address
|
||||
lda #OPEN ; open
|
||||
sta ICCOM,x ; COMMAND CODE
|
||||
lda #OPNIN ; open for input (all devices)
|
||||
sta ICAX1,x ; 1-byte first auxiliary information
|
||||
jsr CIOV ; vector to CIO
|
||||
@read:
|
||||
lda BRKKEY
|
||||
bne @no_abort
|
||||
dec BRKKEY
|
||||
lda #$03 ; ^C
|
||||
bne @done ; jump always
|
||||
@no_abort:
|
||||
lda HELPFG ; HELP key? (to be 100% correct we should check for XL-type machine before...)
|
||||
cmp #17 ; HELP alone
|
||||
beq @help
|
||||
cmp #81 ; Shift-HELP
|
||||
beq @help
|
||||
cmp #145 ; Control-HELP
|
||||
bne @no_help
|
||||
@help:
|
||||
lda #0
|
||||
sta ICBLL,x ; 1-byte low buffer length
|
||||
sta ICBLH,x ; 1-byte high buffer length
|
||||
lda #GETCHR ; get character(s)
|
||||
sta ICCOM,x ; COMMAND CODE
|
||||
jsr CIOV ; vector to CIO
|
||||
ldx #255
|
||||
stx CH ; GLOBAL VARIABLE FOR KEYBOARD
|
||||
sta HELPFG ; clear HELPFG
|
||||
lda #$82 ; pseudo key code, handled in atrvt100.s
|
||||
bne @done
|
||||
@no_help:
|
||||
lda CH ; keyboard input (scan code)
|
||||
cmp #255 ; was a key pressed?
|
||||
beq nokey ; 255 means "no"
|
||||
; sta CH_save ; remember keyboard scan code (debugging)
|
||||
bpl @call_k ; Ctrl wasn't pressed, continue with ROM
|
||||
jsr handle_special_keys
|
||||
bcs @done ; keypress was handled
|
||||
@call_k:
|
||||
lda #0
|
||||
sta INVFLG ; never input an inverse char
|
||||
; ideas from cc65's cgetc.s
|
||||
lda #12
|
||||
sta ICAX1Z
|
||||
jsr getkey_k
|
||||
@done:
|
||||
ldx #255 ; if K: handler hasn't been called, "consume" the key press
|
||||
stx CH ; and clear the zero flag which is a return value
|
||||
; php
|
||||
; ldx CH_save ; for debugging purposes, return the scan code in X
|
||||
; plp
|
||||
rts
|
||||
@nokey:
|
||||
nokey:
|
||||
lda #0
|
||||
rts
|
||||
|
||||
; process inbound ip packets while waiting for a keypress
|
||||
; inputs: A - keycode (CH)
|
||||
; outputs: A - char, CF=0 if regular ROM handling is needed
|
||||
handle_special_keys:
|
||||
ldx #special_key_table_len-1
|
||||
@lookup:
|
||||
cmp special_key_table,x
|
||||
beq @found
|
||||
dex
|
||||
bpl @lookup
|
||||
clc
|
||||
rts
|
||||
@found:
|
||||
lda special_key_table2,x
|
||||
sec
|
||||
rts
|
||||
|
||||
; call "short-cut" handler of K:
|
||||
getkey_k:
|
||||
lda KEYBDV+5
|
||||
pha
|
||||
lda KEYBDV+4
|
||||
pha
|
||||
rts
|
||||
|
||||
get_key_ip65:
|
||||
; process inbound ip packets while waiting for a keypress
|
||||
jsr ip65_process
|
||||
jsr get_key_if_available
|
||||
beq get_key_ip65
|
||||
@ -69,9 +159,16 @@ get_key_ip65:
|
||||
|
||||
;check whether the abort key is being pressed
|
||||
;inputs: none
|
||||
;outputs: sec if abort key pressed, clear otherwise
|
||||
;outputs: CF=1 if abort key pressed, clear otherwise
|
||||
check_for_abort_key:
|
||||
; TODO: implement actual check
|
||||
lda abort_key ; is "abort" enabled?
|
||||
beq @no_abort ; no
|
||||
lda BRKKEY
|
||||
bne @no_abort
|
||||
dec BRKKEY
|
||||
sec
|
||||
rts
|
||||
@no_abort:
|
||||
clc
|
||||
rts
|
||||
|
||||
@ -82,16 +179,16 @@ check_for_abort_key:
|
||||
; Version 1.1 (the "License"); you may not use this file except in
|
||||
; compliance with the License. You may obtain a copy of the License at
|
||||
; http://www.mozilla.org/MPL/
|
||||
;
|
||||
;
|
||||
; Software distributed under the License is distributed on an "AS IS"
|
||||
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
; License for the specific language governing rights and limitations
|
||||
; under the License.
|
||||
;
|
||||
;
|
||||
; The Original Code is ip65.
|
||||
;
|
||||
;
|
||||
; The Initial Developer of the Original Code is Jonno Downes,
|
||||
; jonno@jamtronix.com.
|
||||
; Portions created by the Initial Developer are Copyright (C) 2009
|
||||
; Jonno Downes. All Rights Reserved.
|
||||
; Jonno Downes. All Rights Reserved.
|
||||
; -- LICENSE END --
|
||||
|
@ -60,12 +60,29 @@ cls:
|
||||
lda #ATCLR ; clear screen
|
||||
jmp print_a
|
||||
|
||||
; use ATARI CIOV function to make a 'beep' noise
|
||||
; make a 'beep' noise the same way as the ROM does
|
||||
; inputs: none
|
||||
; outputs: none
|
||||
beep:
|
||||
lda #ATBEL ; beep char
|
||||
jmp print_a
|
||||
tya ; FIXME: why is preservation of Y needed?
|
||||
pha
|
||||
ldy #20 ; do the next loop 20 times
|
||||
@beep1:
|
||||
ldx #63*2
|
||||
@beep2:
|
||||
stx CONSOL ; turn on speaker
|
||||
lda VCOUNT ; current vertical line
|
||||
@beep3:
|
||||
cmp VCOUNT ; still the same?
|
||||
beq @beep3 ; yes, delay...
|
||||
dex
|
||||
dex
|
||||
bpl @beep2
|
||||
dey
|
||||
bpl @beep1
|
||||
pla
|
||||
tay
|
||||
rts
|
||||
|
||||
print_a_inverse:
|
||||
ora #$80 ; turn on top bit
|
||||
|
1711
drivers/atrvt100.s
1711
drivers/atrvt100.s
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user