449 lines
35 KiB
Plaintext
449 lines
35 KiB
Plaintext
{{
|
|
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
│ Autor: Ingo Kripahle │
|
|
│ Copyright (c) 2010 Ingo Kripahle │
|
|
│ See end of file for terms of use. │
|
|
│ Die Nutzungsbedingungen befinden sich am Ende der Datei │
|
|
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
Informationen : hive-project.de
|
|
Kontakt : drohne235@googlemail.com
|
|
System : TriOS
|
|
Name : TV-Texttreiber 13 x 40 Zeichen (experimenteller Status)
|
|
Chip : Bellatrix
|
|
Typ : Treiber
|
|
Version : 00
|
|
Subversion : 01
|
|
Funktion : TV-Text- und Tastatur-Treiber
|
|
Komponenten : TV Driver v1.1 Chip Gracey MIT
|
|
PS/2 Keyboard Driver v1.0.1 Chip Gracey, ogg MIT
|
|
|
|
COG's : MANAGMENT 1 COG
|
|
TV 1 COG
|
|
KEYB 1 COG
|
|
-------------------
|
|
3 COG's
|
|
|
|
Logbuch :
|
|
|
|
05-05-2009-dr235 - übernahme der codebasis vom vga-textdriver
|
|
22-03-2010-dr235 - anpassung trios
|
|
|
|
Kommandoliste:
|
|
|
|
0 1 Tastaturstatus abfragen
|
|
0 2 Tastaturzeichen holen
|
|
0 3 n Screensteuerzeichen
|
|
0 3 0 CLS
|
|
0 3 1 Home
|
|
0 3 2 Backspace
|
|
0 3 3 TAB
|
|
0 3 4 n SETCUR Cursorzeichen auf n setzen
|
|
0 3 5 POS1
|
|
0 3 6 x SETX
|
|
0 3 7 y SETY
|
|
0 3 8 (x) GETX
|
|
0 3 9 (y) GETY
|
|
0 3 10 c SETCOL
|
|
0 3 11 n SLINE
|
|
0 3 13 SCREENINIT
|
|
0 3 14 CURON
|
|
0 3 15 CUROFF
|
|
0 4 (status) Status der Sondertasten abfragen
|
|
0 5 (cogs) Status der belegten COG's abfragen
|
|
0 99 Reboot und neuen Treiber laden
|
|
|
|
|
|
1..255 Zeichenausgabe
|
|
|
|
|
|
Notizen:
|
|
|
|
}}
|
|
|
|
CON
|
|
|
|
_CLKMODE = XTAL1 + PLL16X
|
|
_XINFREQ = 5_000_000
|
|
|
|
'signaldefinitionen regnatix
|
|
|
|
#0, D0,D1,D2,D3,D4,D5,D6,D7 'datenbus
|
|
#8, BEL_VGABASE 'vga-signale (8pin)
|
|
#16, BEL_KEYBC,BEL_KEYBD 'keyboard-signale
|
|
#18, BEL_MOUSEC,BEL_MOUSED 'maus-signale
|
|
#20, BEL_VIDBASE 'video-signale(3pin)
|
|
#23, BEL_SELECT 'belatrix-auswahlsignal
|
|
#24, HBEAT 'front-led
|
|
BUSCLK 'bustakt
|
|
BUS_WR '/wr - schreibsignal
|
|
BUS_HS ' '/hs - quittungssignal
|
|
|
|
COLS = 40
|
|
ROWS = 13
|
|
TILES = cols * rows
|
|
|
|
screensize = cols * rows
|
|
lastrow = screensize - cols
|
|
|
|
tv_count = 14
|
|
|
|
TAB1 = 16
|
|
TAB2 = 32
|
|
TAB3 = 48
|
|
SPACETILE = $8000 + $20 << 6
|
|
|
|
VGA_BASPORT = 8 'vga startport
|
|
VGA_RESX = COLS * 16 'vga anzahl pixel x
|
|
VGA_RESY = ROWS * 16 'vga anzahl pixel y
|
|
KEYB_DPORT = BEL_KEYBD 'tastatur datenport
|
|
KEYB_CPORT = BEL_KEYBC 'tastatur taktport
|
|
CURSORCHAR = $0E 'cursorzeichen
|
|
|
|
DB_WAIT = %00000001_00000000_00000000_00000000 'dira-wert f?r wait-status am bus
|
|
DB_IN = %00001001_00000000_00000000_00000000 'dira-wert f?r datenbuseingabe
|
|
DB_OUT = %00001001_00000000_00000000_11111111 'dira-wert f?r datenbusausgabe
|
|
CNT_HBEAT = 5_000_0000 'blinkgeschw. front-led
|
|
|
|
OBJ
|
|
|
|
tv : "tv-core"
|
|
keyb : "tv-keyb"
|
|
|
|
VAR
|
|
long col, row, color, flag
|
|
|
|
word screen[screensize]
|
|
long colors[8 * 2]
|
|
|
|
long tv_status '0/1/2 = off/invisible/visible read-only (14 longs)
|
|
long tv_enable '0/non-0 = off/on write-only
|
|
long tv_pins '%pppmmmm = pin group, pin group mode write-only
|
|
long tv_mode '%tccip = tile,chroma,interlace,ntsc/pal write-only
|
|
long tv_screen 'pointer to screen (words) write-only
|
|
long tv_colors 'pointer to colors (longs) write-only
|
|
long tv_ht 'horizontal tiles write-only
|
|
long tv_vt 'vertical tiles write-only
|
|
long tv_hx 'horizontal tile expansion write-only
|
|
long tv_vx 'vertical tile expansion write-only
|
|
long tv_ho 'horizontal offset write-only
|
|
long tv_vo 'vertical offset write-only
|
|
long tv_broadcast 'broadcast frequency (Hz) write-only
|
|
long tv_auralcog 'aural fm cog write-only
|
|
|
|
long stackhb[9] 'stack f?r hbeat-cog
|
|
byte cursor 'cursorzeichen
|
|
byte curstat 'cursorstatus 1 = ein
|
|
byte sline 'startzeile des scrollfensters
|
|
byte eline 'endzeile des scrollfensters
|
|
|
|
PUB main | zeichen,n
|
|
{{interpreter f?r hostdialog}}
|
|
|
|
init_subsysteme 'bus/vga/keyboard/maus initialisieren
|
|
repeat
|
|
zeichen := bus_getchar '1. zeichen empfangen
|
|
if zeichen > 0
|
|
print_char(zeichen)
|
|
else
|
|
zeichen := bus_getchar '2. zeichen kommando empfange
|
|
case zeichen
|
|
1: bus_putchar(keyb.gotkey) '1: Tastaturstatus senden
|
|
2: n := keyb.key
|
|
bus_putchar(n) '2: Tastaturzeichen senden
|
|
3: zeichen := bus_getchar
|
|
print_char(zeichen + $100) '3: Sonderzeichen von $100 bis $1FF ausgeben
|
|
4: bus_putchar(n >> 8) '4: Statustasten
|
|
99: reboot '99: bellatrix neu starten
|
|
|
|
|
|
PUB init_subsysteme
|
|
{{initialisierung des belatrix-chips}}
|
|
cognew(led_hbeat, @stackhb) 'heartbeat aktivieren
|
|
bus_init 'bussignale initialisieren
|
|
keyb.start(keyb_dport, keyb_cport) 'tastaturport starten
|
|
start_tv(23)
|
|
print_char($100) 'bildschirm l?schen
|
|
cursor := CURSORCHAR 'cursorzeichen setzen
|
|
curstat := 1 'cursor anschalten
|
|
sline := 2
|
|
eline := rows
|
|
|
|
PUB start_tv(basepin) : okay
|
|
|
|
'' Start terminal - starts a cog
|
|
'' returns false if no cog available
|
|
|
|
setcolors(@palette)
|
|
'out(0)
|
|
|
|
longmove(@tv_status, @tv_params, tv_count)
|
|
tv_pins := (basepin & $38) << 1 | (basepin & 4 == 4) & %0101
|
|
tv_screen := @screen
|
|
tv_colors := @colors
|
|
|
|
okay := tv.start(@tv_status)
|
|
|
|
PUB setcolors(colorptr) | i, fore, back
|
|
|
|
'' Override default color palette
|
|
'' colorptr must point to a list of up to 8 colors
|
|
'' arranged as follows:
|
|
''
|
|
'' fore back
|
|
'' ------------
|
|
'' palette byte color, color 'color 0
|
|
'' byte color, color 'color 1
|
|
'' byte color, color 'color 2
|
|
'' ...
|
|
|
|
repeat i from 0 to 7
|
|
fore := byte[colorptr][i << 1]
|
|
back := byte[colorptr][i << 1 + 1]
|
|
colors[i << 1] := fore << 24 + back << 16 + fore << 8 + back
|
|
colors[i << 1 + 1] := fore << 24 + fore << 16 + back << 8 + back
|
|
|
|
PUB bus_init
|
|
{{initialisierung des bussystems}}
|
|
dira := db_in 'datenbus auf eingabe schalten
|
|
outa[bus_hs] := 1 'handshake inaktiv
|
|
|
|
PUB bus_putchar(zeichen)
|
|
{{ein byte ?ber bus ausgeben}}
|
|
waitpeq(%00000010_00000000_00000000_00000000,%00000010_10000000_00000000_00000000,0) 'busclk=1? & prop2=0?
|
|
dira := db_out 'datenbus auf ausgabe stellen
|
|
outa[7..0] := zeichen 'daten ausgeben
|
|
outa[bus_hs] := 0 'daten g?ltig
|
|
waitpeq(%00000000_00000000_00000000_00000000,%00000010_00000000_00000000_00000000,0) 'busclk=0?
|
|
'waitcnt(1_000 + cnt) 'zeit f?r master
|
|
outa[bus_hs] := 1 'daten ung?ltig
|
|
dira := db_in 'bus freigeben
|
|
|
|
PUB bus_getchar : zeichen
|
|
{{ein byte ?ber bus empfangen}}
|
|
waitpeq(%00000010_00000000_00000000_00000000,%00000010_10000000_00000000_00000000,0) 'busclk=1? & prop2=0?
|
|
zeichen := ina[7..0] 'daten einlesen
|
|
outa[bus_hs] := 0 'daten quittieren
|
|
outa[bus_hs] := 1
|
|
waitpeq(%00000000_00000000_00000000_00000000,%00000010_00000000_00000000_00000000,0) 'busclk=0?
|
|
|
|
PUB led_hbeat
|
|
{{led_hbeat - herzschlag f?r front-led}}
|
|
dira := db_in
|
|
repeat
|
|
!outa[hbeat]
|
|
waitcnt(cnt_hbeat + cnt)
|
|
|
|
PUB print_str(ptr)
|
|
{{zeichenkette auf bildschirm ausgeben}}
|
|
schar(ptr)
|
|
|
|
PUB print_char(c) | code,n
|
|
{{zeichen auf bildschirm ausgeben}}
|
|
'' Print a character
|
|
''
|
|
'' $0D = new line
|
|
'' $20..$FF = character
|
|
'' $100 = clear screen
|
|
'' $101 = home
|
|
'' $108 = backspace
|
|
''$110..$11F = select color
|
|
|
|
case c
|
|
|
|
$0A: 'LF ausblenden
|
|
return
|
|
|
|
$00..$0C:
|
|
pchar(c)
|
|
if curstat == 1
|
|
schar(cursor)
|
|
|
|
$0D: 'return?
|
|
if curstat == 1
|
|
schar($20)
|
|
newline
|
|
if curstat == 1
|
|
schar(cursor)
|
|
|
|
$0E..$FF: 'character?
|
|
pchar(c)
|
|
if curstat == 1
|
|
schar(cursor)
|
|
|
|
$100: 'clear screen?
|
|
if curstat == 1
|
|
schar($20)
|
|
n := sline * cols * 2
|
|
wordfill(@screen, $220, screensize)
|
|
row := sline
|
|
col := 0
|
|
if curstat == 1
|
|
schar(cursor)
|
|
|
|
$101: 'home?
|
|
row := sline
|
|
col := 0
|
|
|
|
$102: 'backspace?
|
|
if col
|
|
if curstat == 1
|
|
schar($20)
|
|
col--
|
|
if curstat == 1
|
|
schar(cursor)
|
|
|
|
$103: 'tab
|
|
if col < TAB1
|
|
if curstat == 1
|
|
schar($20)
|
|
col := TAB1
|
|
if curstat == 1
|
|
schar(cursor)
|
|
return
|
|
if col < TAB2
|
|
if curstat == 1
|
|
schar($20)
|
|
col := TAB2
|
|
if curstat == 1
|
|
schar(cursor)
|
|
return
|
|
if col < TAB3
|
|
if curstat == 1
|
|
schar($20)
|
|
col := TAB3
|
|
if curstat == 1
|
|
schar(cursor)
|
|
return
|
|
$104: 'setcur
|
|
code := bus_getchar
|
|
cursor := code
|
|
if curstat == 1
|
|
schar(code)
|
|
|
|
$105: 'pos1
|
|
if curstat == 1
|
|
schar($20)
|
|
col := 0
|
|
if curstat == 1
|
|
schar(cursor)
|
|
|
|
$106: 'setx
|
|
if curstat == 1
|
|
schar($20)
|
|
col := bus_getchar
|
|
if curstat == 1
|
|
schar(cursor)
|
|
|
|
$107: 'sety
|
|
if curstat == 1
|
|
schar($20)
|
|
row := bus_getchar * 2 + sline '2 tiles pro zeichen!
|
|
if curstat == 1
|
|
schar(cursor)
|
|
|
|
$108: 'getx
|
|
bus_putchar(col)
|
|
|
|
$109: 'gety
|
|
bus_putchar(row / 2)
|
|
|
|
$110: 'setcolor
|
|
color := bus_getchar
|
|
|
|
$111: 'sline
|
|
sline := bus_getchar * 2
|
|
|
|
$112: 'eline
|
|
eline := bus_getchar * 2
|
|
|
|
$113: 'screeninit
|
|
wordfill(@screen, $220, screensize)
|
|
row := 0
|
|
col := 0
|
|
sline := 0
|
|
|
|
$114: 'curon
|
|
curstat := 1
|
|
schar(cursor)
|
|
|
|
$115: 'curoff
|
|
if curstat == 1
|
|
schar($20)
|
|
curstat := 0
|
|
|
|
$116: 'scrollup
|
|
'scrollup
|
|
|
|
$117: 'scrolldown
|
|
'scrolldown
|
|
|
|
$130..$13F: 'select color?
|
|
color := c & $F
|
|
|
|
PRI schar(c)
|
|
screen[row * cols + col] := (color << 1 + c & 1) << 10 + $200 + c & $FE
|
|
|
|
PRI pchar(c)
|
|
'schreibt zeichen an aktuelle position zählt position weiter
|
|
schar(c)
|
|
if ++col == cols
|
|
newline
|
|
|
|
PRI newline | i
|
|
|
|
col := 0
|
|
if ++row == rows
|
|
row--
|
|
wordmove(@screen, @screen[cols], lastrow) 'scroll lines
|
|
wordfill(@screen[lastrow], $220, cols) 'clear new line
|
|
|
|
|
|
DAT
|
|
|
|
tv_params long 0 'status
|
|
long 1 'enable
|
|
long 0 'pins
|
|
long %10010 'mode
|
|
long 0 'screen
|
|
long 0 'colors
|
|
long cols 'hc
|
|
long rows 'vc
|
|
long 4 'hx
|
|
long 1 'vx
|
|
long 0 'ho
|
|
long 0 'vo
|
|
long 0 'broadcast
|
|
long 0 'auralcog
|
|
|
|
|
|
' fore back
|
|
' color color
|
|
palette byte $07, $0A '0 white / dark blue
|
|
byte $07, $BB '1 white / red
|
|
byte $9E, $9B '2 yellow / brown
|
|
byte $04, $07 '3 grey / white
|
|
byte $3D, $3B '4 cyan / dark cyan
|
|
byte $6B, $6E '5 green / gray-green
|
|
byte $BB, $CE '6 red / pink
|
|
byte $3C, $0A '7 cyan / blue
|
|
DAT
|
|
|
|
{{
|
|
|
|
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
│ TERMS OF USE: MIT License │
|
|
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
│Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation │
|
|
│files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, │
|
|
│modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│
|
|
│is furnished to do so, subject to the following conditions: │
|
|
│ │
|
|
│The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│
|
|
│ │
|
|
│THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE │
|
|
│WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR │
|
|
│COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, │
|
|
│ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │
|
|
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
}} |