initial check-in (version 2.05)
This commit is contained in:
commit
9508902e6c
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,87 @@
|
|||
Key Function
|
||||
============================
|
||||
F1 Display Help
|
||||
F2 File-Explorer
|
||||
F3 Programs
|
||||
F4 Display Cog-Usage
|
||||
F5 Serial Terminal
|
||||
F6 System-Info
|
||||
F7 Clock-Settings
|
||||
F8 Color-Settings
|
||||
F9 Ram-Monitor
|
||||
F10 Sid-Dmp-Player
|
||||
F11 Calendar
|
||||
F12 Reboot
|
||||
Alt+F1 About-Box
|
||||
Alt+F2 System-Settings
|
||||
Alt+F5 Baud-Select
|
||||
M Mount/Unmount
|
||||
I SD-Card-Info
|
||||
F Format SD-Card
|
||||
E empty Trash
|
||||
T Display Trash
|
||||
L+1..3 Start Link 1..3
|
||||
Del+1..3 Delete Link 1..3
|
||||
P+1..3 Link-Parameter 1..3
|
||||
ESC Delete Window
|
||||
============================
|
||||
Explorer
|
||||
I File-Info
|
||||
S Show File
|
||||
L Make Link
|
||||
R Rename File
|
||||
N New Dir
|
||||
C Copy File
|
||||
P Paste File
|
||||
Cursor Select File
|
||||
Enter Start File(bin etc)
|
||||
Entf Delete File
|
||||
Y Send File(YMODEM)
|
||||
Z Receive File(YMODEM)
|
||||
============================
|
||||
File-Info
|
||||
R Toogle Attr. R/O
|
||||
H Toogle Attr. Hid
|
||||
S Toogle Attr. Sys
|
||||
A Toogle Attr. Arch
|
||||
============================
|
||||
Systeminfo
|
||||
1..3 select Tab
|
||||
============================
|
||||
Clock-Date-Setting
|
||||
Tab Select Value
|
||||
Cur-up increment Value
|
||||
Cur-dn decrement Value
|
||||
ESC Cancel
|
||||
Enter OK
|
||||
============================
|
||||
Color-Setting
|
||||
Cursor select Object
|
||||
Tab select Value
|
||||
ESC Cancel
|
||||
Enter OK
|
||||
============================
|
||||
RAM-Monitor
|
||||
H select H-RAM
|
||||
E select E-RAM
|
||||
Tab Input Adress
|
||||
Enter Input/Enter Bytes
|
||||
============================
|
||||
DMP-Player
|
||||
+ next Title
|
||||
- previous Title
|
||||
Space Stop or Play
|
||||
ESC Cancel
|
||||
============================
|
||||
Baud Settings
|
||||
Cursor select Baudrate
|
||||
Enter Enter Value
|
||||
============================
|
||||
System Settings
|
||||
S Show Hidden Files
|
||||
U Use Trash
|
||||
D Use DCF-Receiver
|
||||
B Use HC05-Bluetooth
|
||||
============================
|
||||
Program Window
|
||||
1..3 Select Program
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,9 @@
|
|||
PLEXUS for Hive 2.05
|
||||
|
||||
Autor:R.Zielinski 03/2014
|
||||
Mail :Zille09@gmail.com
|
||||
Hive-Project.de
|
||||
|
||||
We are Borg
|
||||
You will be assimilated.
|
||||
Resistance is futile.
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
H
|
|
@ -0,0 +1,6 @@
|
|||
ADM-Spec:
|
||||
|
||||
SID-COG :Ver.1.3
|
||||
|
||||
Author:Johannes Ahlebrand
|
||||
Date :4/2012
|
|
@ -0,0 +1,12 @@
|
|||
Resolution X:640
|
||||
Resolution Y:480
|
||||
|
||||
Row :40
|
||||
Column :30
|
||||
|
||||
Colors :64
|
||||
|
||||
VGA64 Tilemap Engine
|
||||
Author:Kwabena W.Agyeman
|
||||
Date :7/27/2010
|
||||
Version 1.0
|
|
@ -0,0 +1,104 @@
|
|||
help
|
||||
diese hilfe
|
||||
|
||||
<sd:dateiname>
|
||||
bin/adm/bel-datei wird gestartet
|
||||
|
||||
mount
|
||||
sd-card mounten
|
||||
|
||||
unmount
|
||||
sd-card abmelden
|
||||
|
||||
dir wh
|
||||
verzeichnis anzeigen
|
||||
|
||||
type <sd:fn>
|
||||
anzeige einer textdatei
|
||||
|
||||
aload <sd:fn>
|
||||
administra-code laden
|
||||
|
||||
bload <sd:fn>
|
||||
bellatrix-treiber laden
|
||||
|
||||
rload <sd:fn>
|
||||
regnatix-code laden
|
||||
|
||||
del <sd:fn>
|
||||
datei loeschen
|
||||
|
||||
cls
|
||||
bildschirm loeschen
|
||||
|
||||
free
|
||||
freier speicher auf sd-card
|
||||
|
||||
attrib <sd:fn> ashr
|
||||
attribute aendern
|
||||
|
||||
cd <sd:dir>
|
||||
verzeichnis wechseln
|
||||
|
||||
mkdir <sd:dir>
|
||||
verzeichnis erstellen
|
||||
|
||||
rename <sd:fn1> <sd:fn2>
|
||||
datei/verzeichnis umbenennen
|
||||
|
||||
format <volname>
|
||||
sd-card formatieren
|
||||
|
||||
reboot
|
||||
hive neu starten
|
||||
|
||||
sysinfo
|
||||
systeminformationen
|
||||
|
||||
color <0..7>
|
||||
farbe waehlen
|
||||
|
||||
cogs
|
||||
belegung der cogs anzeigen
|
||||
|
||||
dmlist
|
||||
anzeige der verzeichnis-marker
|
||||
|
||||
dm <r/s/u/a/b/c>
|
||||
in das entsprechende marker-
|
||||
verzeichnis wechseln
|
||||
|
||||
dmset <r/s/u/a/b/c>
|
||||
setzt den entsprechenden marker
|
||||
auf das aktuelle verzeichnis
|
||||
|
||||
dmclr <r/s/u/a/b/c>
|
||||
marker loeschen
|
||||
|
||||
marker:
|
||||
r - root-verzeichnis
|
||||
s - system-verzeichnis
|
||||
u - user-verzeichnis
|
||||
a/b/c - benutzerdefinierte verzeichnismarker
|
||||
r, s, u-marker werden vom system automatisch
|
||||
gesetzt und intern verwendet.
|
||||
|
||||
sysconf
|
||||
systemeinstellungen
|
||||
|
||||
PORT-Funktionen:
|
||||
|
||||
plxput <hex adr> <hex wert>
|
||||
Hexwert an Port ausgeben
|
||||
|
||||
plxget <hex adr>
|
||||
Wert vom Port lesen
|
||||
|
||||
plxmap
|
||||
Darstellung aller I2C Teilnehmer
|
||||
|
||||
plxscan
|
||||
Nach I2C Teilnehmern scannen
|
||||
|
||||
plxtest
|
||||
Port- und A/D Kanal-Anzeige
|
|
@ -0,0 +1,78 @@
|
|||
Filesys unmounted
|
||||
Filesys corrupted
|
||||
Filesys unsupported
|
||||
not found
|
||||
File not found
|
||||
Directory not found
|
||||
File read only
|
||||
End of File-Error
|
||||
End of Directory
|
||||
End of Root
|
||||
Directory is full
|
||||
Directory is not empty
|
||||
Checksum Error
|
||||
Reboot Error
|
||||
bpb corrupt
|
||||
Filesys corrupt
|
||||
Directory already exist
|
||||
File exist,overwrite?
|
||||
Out of Disk Space
|
||||
Disk I/O Error
|
||||
Command not found
|
||||
Timeout Error
|
||||
Out of Memory Error
|
||||
Delete selected File?
|
||||
Reboot Hive-Computer?
|
||||
NO FILE SELECTED
|
||||
SD-CARD Format Ready
|
||||
Format SD-CARD ?
|
||||
Delete selected Link?
|
||||
Delete all Files?
|
||||
Trash to empty ?
|
||||
SD-Card-Info
|
||||
File-Info
|
||||
Calendar
|
||||
Filename:
|
||||
Filetype:
|
||||
Directory
|
||||
File
|
||||
- Attribute -
|
||||
R/O HID SYS ARC
|
||||
Textdisplay
|
||||
Startmenue
|
||||
Administra:
|
||||
Bellatrix :
|
||||
Regnatix :
|
||||
System-Settings
|
||||
Show hid.Files:
|
||||
Use Trash :
|
||||
Serial-Terminal
|
||||
Set Baudrate
|
||||
Systeminfo
|
||||
Clock-Settings
|
||||
Color-Settings
|
||||
Ram-Monitor
|
||||
Sid-Dmp-Player
|
||||
Copy :
|
||||
Delete:
|
||||
Venatrix :
|
||||
Start-Parameter
|
||||
Venatrix-BUS:
|
||||
Sepia-Card :
|
||||
Cogs
|
||||
About
|
||||
Date
|
||||
Time
|
||||
Col:
|
||||
H-RAM:
|
||||
E-RAM:
|
||||
DCF-77 :
|
||||
HC05 :
|
||||
Explorer
|
||||
Option
|
||||
Detect-Hardware
|
||||
Receive File ...
|
||||
No Response from Host
|
||||
Transmission complete
|
||||
Send File...
|
||||
Timeout failure!
|
Binary file not shown.
|
@ -0,0 +1,64 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Definitionen
|
||||
##D="-D __DEBUG -D __LANG_EN"
|
||||
##D="-D __LANG_EN"
|
||||
D="-D __LANG_DE"
|
||||
|
||||
# Pfade
|
||||
##bin="../Bin"
|
||||
bin="/home/ftp/hive"
|
||||
sdplex="${bin}/sdcard/plexus"
|
||||
sdsys="${bin}/sdcard/system"
|
||||
libpath="../TriOS/lib"
|
||||
BSTC="bstc"
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# Alte Versionen löschen
|
||||
|
||||
rm -rf ${sdplex}
|
||||
##rm -rf ${sdsys}/xxxx
|
||||
mkdir -p ${sdplex}
|
||||
##mkdir ${sdsys}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# Code für Administra, Bellatrix und Regime erzeugen
|
||||
|
||||
${BSTC} -L ${libpath} ${D} -D __ADM_FAT -D __ADM_FAT_EXT -D __ADM_RTC -D __ADM_SID -D __ADM_PLX -D __ADM_DCF -D __ADM_BLT -b -O a ../TriOS/flash/administra/admflash.spin
|
||||
mv admflash.binary ${sdplex}/plexus.adm
|
||||
|
||||
${BSTC} -L ${libpath} ${D} -b -O a source/Plexus-Start-Trios.spin
|
||||
mv Plexus-Start-Trios.binary ${sdplex}/plexus.bin
|
||||
|
||||
${BSTC} -L ${libpath} ${D} -b -O a source/belsVGA64.spin
|
||||
mv belsVGA64.binary ${sdplex}/plexus.bel
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# Plexus-Programme erzeugen
|
||||
|
||||
${BSTC} -L ${libpath} ${D} -b -O a source/Plexus-Shell.spin
|
||||
mv Plexus-Shell.binary ${sdplex}/plexus.dll
|
||||
|
||||
${BSTC} -L ${libpath} ${D} -b -O a source/Bluetooth.spin
|
||||
mv Bluetooth.binary ${sdplex}/Bltooth.dll
|
||||
|
||||
${BSTC} -L ${libpath} ${D} -b -O a source/Venatrix.spin
|
||||
mv Venatrix.binary ${sdplex}/Venatrix.dll
|
||||
|
||||
${BSTC} -L ${libpath} ${D} -b -O a source/YMODEM-Dll.spin
|
||||
mv YMODEM-Dll.binary ${sdplex}/YMODEM.dll
|
||||
|
||||
${BSTC} -L ${libpath} ${D} -b -O a source/DCF-Test.spin
|
||||
mv DCF-Test.binary ${sdplex}/dcf.dll
|
||||
|
||||
${BSTC} -L ${libpath} ${D} -b -O a source/dos-shell.spin
|
||||
mv dos-shell.binary ${sdplex}/dos.dll
|
||||
|
||||
${BSTC} -L ${libpath} ${D} -b -O a source/sepia-test.spin
|
||||
mv sepia-test.binary ${sdplex}/sepia.dll
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# Daten kopieren
|
||||
|
||||
cp -r data/* ${sdplex}
|
|
@ -0,0 +1,759 @@
|
|||
{{
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Autor: Reinhard Zielinski │
|
||||
│ Copyright (c) 2013 Reinhard Zielinski │
|
||||
│ See end of file for terms of use. │
|
||||
│ Die Nutzungsbedingungen befinden sich am Ende der Datei │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Informationen : hive-project.de
|
||||
Kontakt : zille09@gmail.com
|
||||
System : TriOS
|
||||
Name : Bluetooth-Testprogramm - Test der Funktionen der HC05 Bluetooth-Karte
|
||||
Chip : Regnatix
|
||||
Typ : Plexus-Erweiterungsdatei
|
||||
Version : 01
|
||||
Subversion : 00
|
||||
|
||||
|
||||
Logbuch :
|
||||
'############################################### Version 1.0 ######################################################################################################################
|
||||
|
||||
24-11-2013 :-Erstellung der Optik des Testfensters
|
||||
-Grundgerüst stammt vom Sepia-Test-Programm
|
||||
-Sepia-Programmteile entfernt
|
||||
-Bluetooth-Test-und Konfigurationsprogramm
|
||||
-6538 Longs frei
|
||||
|
||||
30-01-2014 -Anpassung an die neue reg.ios (Window-Funktionen)
|
||||
-6624 Longs frei
|
||||
|
||||
16-03-2014 -DCF-Indikator in Titelleiste eingebaut
|
||||
-6648 Longs frei
|
||||
|
||||
18-03-2014 -Parameterabfrage funktioniert jetzt korrekt (kein Datenmüll mehr auf dem Bildschirm)
|
||||
-Parametereingabefenster zur Konfiguration hinzugefügt ->funktioniert
|
||||
-jetzt müsste noch ein Scanner her, der die Geräte in der Nähe anzeigt
|
||||
-kleinere optische Korrekturen
|
||||
-6303 Longs frei
|
||||
|
||||
}}
|
||||
|
||||
obj
|
||||
ios: "reg-ios-64"
|
||||
|
||||
|
||||
con
|
||||
_CLKMODE = XTAL1 + PLL16X
|
||||
_XINFREQ = 5_000_000
|
||||
|
||||
'------------- Shell-Farben -----------------------------------------------------
|
||||
shellhcol =0 'Hauptfensterfarbe
|
||||
act_color =1 'Schriftfarbe
|
||||
winhcol =2 'Fensterhintergrundfarbe
|
||||
winframecol =3 'Fensterrandfarbe
|
||||
Titelhcol =4 'Titelleistenfarbe
|
||||
titeltextcol =5 'Titelleistentextfarbe
|
||||
hcolstatus =6 'statusleiste hintergrundfarbe
|
||||
statustextcol =7 'Statustextfarbe
|
||||
buttonhcol =8 'Buttonhintergrundfarbe
|
||||
buttontextcol =9 'Buttontextfarbe
|
||||
messagehcol =10 'Messagebox-Hintergrundfarbe
|
||||
messagetextcol =11 'Messagebox-Textfarbe
|
||||
selectcol =12 'selektionsfarbe
|
||||
mousecol =13 'Mauszeigerfarbe
|
||||
panelcol =14 'Farbe des Utility-Panels
|
||||
|
||||
ADM_SPEC = %00000000_00000000_00000000_01010011
|
||||
TEXT_RAM = $80000
|
||||
SETTING_RAM = $7FF00 'Hier stehen die System-Settings
|
||||
Hour_Glass = $66800+(167*16*4)
|
||||
|
||||
BRAM = $50000 'Overlay-Puffer
|
||||
'******************Farben ********************************************************
|
||||
#$FC, Light_Grey, #$A8, Grey, #$54, Dark_Grey
|
||||
#$C0, Light_Red, #$80, Red, #$40, Dark_Red
|
||||
#$30, Light_Green, #$20, Green, #$10, Dark_Green
|
||||
#$1F, Light_Blue, #$09, Blue, #$04, Dark_Blue
|
||||
#$F0, Light_Orange, #$E6, Orange, #$92, Dark_Orange
|
||||
#$CC, Light_Purple, #$88, Purple, #$44, Dark_Purple
|
||||
#$3C, Light_Teal, #$28, Teal, #$14, Dark_Teal
|
||||
#$FF, White, #$00, Black
|
||||
'----Icon-Nummern----------------------------------------------------------------
|
||||
BEL_PIC =14
|
||||
ADM_PIC =15
|
||||
BIN_PIC =9
|
||||
BAS_PIC =107
|
||||
DIR_PIC =7
|
||||
ALL_PIC =8
|
||||
DMP_PIC =120
|
||||
TXT_PIC =121
|
||||
SYS_PIC =122
|
||||
COG_PIC =75
|
||||
BACK_PIC =124
|
||||
VOR_PIC =123
|
||||
PLAY_PIC =125
|
||||
STOP_PIC =141
|
||||
CLR_PIC =155
|
||||
EXT_PIC =156
|
||||
|
||||
'------------- F-Tasten für Zusatzfunktionen -------------------------------------
|
||||
F1_Key = 208
|
||||
F2_Key = 209
|
||||
F3_Key = 210
|
||||
F4_Key = 211
|
||||
F5_Key = 212
|
||||
F6_Key = 213
|
||||
F7_Key = 214
|
||||
F8_Key = 215
|
||||
F9_Key = 216
|
||||
F10_Key = 217
|
||||
F11_Key = 218
|
||||
F12_Key = 219
|
||||
ESC_KEY = 27
|
||||
RETURN_KEY = 13
|
||||
'--------------------------------------------------------------------------------
|
||||
|
||||
var
|
||||
|
||||
byte mountmarker,tmptime
|
||||
long rootdir 'root-Dirmarker
|
||||
long userdir 'user-Dirmarker
|
||||
byte colors[15] 'Farbwerte
|
||||
byte ma,mb 'Maus-Tasten
|
||||
|
||||
byte textline[40] 'Texteingabestring
|
||||
long tp 'Texteingabe-übernahmestring
|
||||
byte Show_Hid_Files
|
||||
byte Use_Trash
|
||||
byte windowx[3]
|
||||
byte windowy[3]
|
||||
byte windowxx[3]
|
||||
byte windowyy[3]
|
||||
byte menuey[10] 'y-Koordinate für Start-Menue-Einträge
|
||||
byte popupx,popupxx 'x und
|
||||
byte popupy,popupyy 'y-Koordinaten des Popupmenues
|
||||
byte popupmarker 'Marker für Popupmenue
|
||||
byte infomarker
|
||||
byte buttonx[5],buttony[5]
|
||||
byte util
|
||||
long systemdir 'Plexus-System-Verzeichnis
|
||||
byte timezaehler
|
||||
byte baud
|
||||
'----------- DCF-Indikator ------------------------------------
|
||||
byte dcf_on
|
||||
|
||||
dat
|
||||
regsys byte "plexus.dll",0 'Reg.sys für Rückkehr aus externem Programm
|
||||
butOK byte " OK ",0
|
||||
Abbr byte "Cancel",0
|
||||
SYSTEM Byte "PLEXUS ",0 'Plexus-Systemverzeichnis
|
||||
'----------------------- Liste der Kommandos ----------------------------------------------
|
||||
at_name byte "AT+NAME",0
|
||||
at_addr byte "AT+ADDR",0
|
||||
at_role byte "AT+ROLE",0
|
||||
at_class byte "AT+CLASS",0
|
||||
at_access byte "AT+IAC",0
|
||||
at_passwd byte "AT+PSWD",0
|
||||
at_uart byte "AT+UART",0
|
||||
at_cmode byte "AT+CMODE",0
|
||||
at_polar byte "AT+POLAR",0
|
||||
at_ipscan byte "AT+IPSCAN",0
|
||||
at_sniff byte "AT+SNIFF",0
|
||||
at_senm byte "AT+SENM",0
|
||||
at_adcn byte "AT+ADCN",0
|
||||
at_mrad byte "AT+MRAD",0
|
||||
at_state byte "AT+STATE",0
|
||||
at_frage byte "AT",0
|
||||
ok_antwort byte "OK",0
|
||||
|
||||
at_Master byte "AT+ROLE=1",0
|
||||
at_scan byte "AT+INQ",0
|
||||
|
||||
PUB main|a
|
||||
|
||||
ios.start
|
||||
cmd_mount 'sd-card mounten
|
||||
mountmarker:=1 'mount-marker
|
||||
'--------------------------------------------------------------------------------------
|
||||
activate_dirmarker(0) 'ins root
|
||||
ios.sdchdir(@system) 'System-Verzeichnis lesen
|
||||
systemdir:=get_dirmarker 'Dir-Marker lesen
|
||||
|
||||
'--------------------------------------------------------------------------------------
|
||||
cmd_unmount
|
||||
iniload 'Ini-Datei mit Farbwerten laden
|
||||
|
||||
|
||||
testfenster
|
||||
util:=0
|
||||
ios.ram_fill(Text_Ram,$1000,0)
|
||||
a:=bdselect(baud)
|
||||
ios.serclose
|
||||
ios.seropen(a) 'ser. Schnittstelle virtuell öffnen
|
||||
buttonweg
|
||||
Abfrage_Bluetooth_Parameter
|
||||
|
||||
repeat
|
||||
|
||||
os_cmdinput 'Hauptprogrammschleife
|
||||
|
||||
|
||||
PRI os_cmdinput | x,y ,i,a,b,c,port,key,padr,durchlauf
|
||||
|
||||
repeat
|
||||
time 'Zeit und Datum anzeigen
|
||||
|
||||
ma:=ios.mouse_button(0) 'linke Maustaste
|
||||
mb:=ios.mouse_button(1) 'rechte Maustaste
|
||||
key:=ios.key
|
||||
|
||||
'**************************** Short-Cuts ****************************************************************************
|
||||
case key
|
||||
F1_Key:'Scanner_Display
|
||||
F2_Key:Command_Display
|
||||
F12_Key:ausstieg
|
||||
ESC_KEY:popup_info_weg
|
||||
RETURN_KEY:popup_info_weg
|
||||
|
||||
if util==1
|
||||
b:=texteingabe(10)
|
||||
if b==1 'Kommando eingeben
|
||||
if strsize(@textline)>1
|
||||
print_win(string(" "),8,10) 'Eingabezeilen löschen
|
||||
print_win(string(" "),8,12)
|
||||
ios.Set_Bluetooth_Command_Mode 'Kommando-Mode einschalten
|
||||
get_antwort(@textline,15,8,12,2) 'Kommando senden
|
||||
ios.Clear_Bluetooth_Command_Mode 'Kommando-Mode ausschalten
|
||||
|
||||
elseif b==2
|
||||
testfenster 'Bildschirm neu aufbauen
|
||||
date 'Datum in der Titelzeile wieder herstellen
|
||||
Abfrage_Bluetooth_Parameter 'Parameter einlesen
|
||||
util:=0
|
||||
|
||||
'***************************** linke Maustaste **********************************************************************
|
||||
if ma==255
|
||||
x:=ios.mousex
|
||||
y:=ios.mousey
|
||||
|
||||
'****************************** Globale Buttonabfrage ********************************************************
|
||||
a:=Global_Button_Press(x,y)
|
||||
|
||||
'****************************** Startmenue anzeigen ************************************************************
|
||||
if popupmarker==1
|
||||
if x>10 or y<24 'Menue loeschen, wenn man woanders hinklickt
|
||||
popup_info_weg
|
||||
util:=0
|
||||
if x=>0 and x=<10 and y=>24 and y=<28
|
||||
repeat i from 0 to 5
|
||||
if menuey[i]==y
|
||||
case i
|
||||
0:menueselect(string("Set - F2"),menuey[i])
|
||||
Command_Display
|
||||
1:menueselect(string("Help - F1"),menuey[i])
|
||||
'Scanner_Display
|
||||
2:menueselect(string("-EXIT- F12"),menuey[i])
|
||||
ausstieg
|
||||
|
||||
|
||||
|
||||
|
||||
PRI Abfrage_Bluetooth_Parameter
|
||||
|
||||
ios.Set_Bluetooth_Command_Mode
|
||||
Abfrage_ok
|
||||
|
||||
get_antwort(@at_name,0,2,5,1)
|
||||
get_antwort(@at_addr,1,2,8,1)
|
||||
get_antwort(@at_class,2,21,8,1)
|
||||
|
||||
get_antwort(@at_role,3,2,11,1)
|
||||
get_antwort(@at_access,4,21,11,1)
|
||||
|
||||
get_antwort(@at_passwd,5,2,13,1)
|
||||
get_antwort(@at_uart,6,21,13,1)
|
||||
|
||||
get_antwort(@at_cmode,7,2,15,1)
|
||||
get_antwort(@at_polar,8,21,15,1)
|
||||
|
||||
get_antwort(@at_ipscan,9,2,17,1)
|
||||
|
||||
get_antwort(@at_sniff,10,2,19,1)
|
||||
get_antwort(@at_senm,11,21,19,1)
|
||||
|
||||
get_antwort(@at_adcn,12,2,22,1)
|
||||
get_antwort(@at_mrad,13,2,23,1)
|
||||
get_antwort(@at_state,14,2,25,1)
|
||||
|
||||
ios.Clear_Bluetooth_Command_Mode
|
||||
|
||||
pri abfrage_ok|a,nx 'diese Routine garantiert, das das Modul korrekt antwortet
|
||||
a:=1
|
||||
nx:=0
|
||||
repeat while a
|
||||
get_antwort(@at_frage,15,0,0,0)
|
||||
nx++
|
||||
if strcomp(@textline,@ok_antwort) or nx>20 'nach 20 Versuchen oder OK als Rückgabewert->Ausstieg
|
||||
a:=0
|
||||
|
||||
pri get_antwort(str,n,x,y,mode)|c,i,adr,v,fx,nx
|
||||
adr:=Text_Ram+(n*40)
|
||||
if mode==1 'Abfrage-Bluetooth-Parameter
|
||||
v:=adr+mode
|
||||
if mode==0 or mode==2 'Abfrage oder Eingaberückmeldung
|
||||
v:=adr
|
||||
i:=0
|
||||
fx:=0
|
||||
nx:=0
|
||||
ios.serstr(str)
|
||||
ios.sertx(13)
|
||||
ios.sertx(10)
|
||||
waitcnt(cnt + clkfreq/10) 'einen kleinen Moment warten
|
||||
repeat
|
||||
c:=ios.serread
|
||||
nx++
|
||||
print_win(string(" "),30,5)
|
||||
if c>0
|
||||
nx:=0
|
||||
if c>31
|
||||
ios.ram_wrbyte(c,adr++)
|
||||
|
||||
if c==13
|
||||
QUIT
|
||||
|
||||
if nx>50
|
||||
quit
|
||||
|
||||
repeat while c:=ios.ram_rdbyte(v++)
|
||||
textline[i++]:=c
|
||||
|
||||
textline[i]:=0
|
||||
if mode 'im Modus 0 wird der Text nicht ausgegeben
|
||||
print_win(@textline,x,y)
|
||||
ios.serflush
|
||||
ios.ram_fill(Text_Ram+(15*40),40,0)
|
||||
|
||||
|
||||
|
||||
|
||||
PRI bdselect(bauds):bd
|
||||
bd:=lookupz(bauds:300,600,1200,4800,9600,19200,38400,57600,115200)
|
||||
|
||||
pri Global_Button_Press(x,y):antwort
|
||||
|
||||
if(x=>buttonx[4]) and (x=<buttonx[4]+5) and (y==buttony[4]) and Infomarker==1 'ok im Infofenster
|
||||
buttonpress(4)
|
||||
popup_info_weg
|
||||
antwort:=1
|
||||
|
||||
if(x=>buttonx[2]) and (x=<buttonx[2]+5) and (y==buttony[2]) and Infomarker==1 'cancel im Infofenster
|
||||
buttonpress(2)
|
||||
popup_info_weg
|
||||
antwort:=2
|
||||
|
||||
if y==windowy[2] and x==windowx[2] and Infomarker==1 'doppelklick in linke obere ecke des Info-Fensters
|
||||
if doppelklick>1
|
||||
popup_info_weg
|
||||
antwort:=2
|
||||
|
||||
if y==windowy[2] and x==windowxx[2] and Infomarker==1
|
||||
ios.get_window
|
||||
popup_info_weg
|
||||
antwort:=2
|
||||
|
||||
if y==0 and infomarker==0
|
||||
if (x==39) 'Beenden-Knopf
|
||||
ios.displaytile(1,250,0,0,0,39) 'Schliessen-Symbol
|
||||
Mouse_Release 'warten bis Maustaste losgelassen wird
|
||||
ios.displaytile(1,colors[winhcol],0,colors[winframecol],0,39) 'Schliessen-Symbol
|
||||
ausstieg
|
||||
|
||||
if (x==0) 'Beenden bei Doppelklick auf linke obere Ecke
|
||||
if doppelklick>1
|
||||
ausstieg
|
||||
if x>1 and x<20 'Doppelklick in die Titelleiste
|
||||
if doppelklick>1
|
||||
popup_info_weg
|
||||
Display_Info
|
||||
|
||||
if ((x=>0) and (x=<5)) and (y==29) 'Start-Knopf
|
||||
buttonpress(1)
|
||||
if popupmarker==1
|
||||
popup_info_weg
|
||||
|
||||
else
|
||||
if infomarker==1
|
||||
popup_info_weg
|
||||
antwort:=0
|
||||
startmenue
|
||||
popupmarker:=1
|
||||
|
||||
{PRI Scanner_Display|i
|
||||
infofenster(5,10,34,17,string("Device-Scanner"),1) 'Info-Fenster anzeigen
|
||||
Abfrage_ok
|
||||
get_antwort(@at_Master,16,5,10,0)
|
||||
ios.serstr(@at_scan)
|
||||
ios.sertx(13)
|
||||
ios.sertx(10)
|
||||
waitcnt(cnt + clkfreq/10) 'einen kleinen Moment warten
|
||||
|
||||
scanning(5)
|
||||
|
||||
|
||||
pri scanning(y)|x,nx,c
|
||||
x:=5
|
||||
repeat
|
||||
c:=ios.serread
|
||||
nx++
|
||||
print_win(string(" "),30,5)
|
||||
if c>0
|
||||
nx:=0
|
||||
if c>31
|
||||
win_tile(c-16,x++,y)
|
||||
if c==13 or x>34
|
||||
y++
|
||||
x:=5
|
||||
if nx>50
|
||||
quit
|
||||
}
|
||||
PRI Display_Info
|
||||
infofenster(9,8,31,13,string("Program-Info"),1) 'Info-Fenster anzeigen
|
||||
Print_win(string("Bluetooth-Settings HC05"),9,8)
|
||||
Print_win(string("Version 1.1 - 03/2014"),9,9)
|
||||
Print_win(string("Autor:R.Zielinski"),9,10)
|
||||
Print_win(string("Hive-Project.de"),9,11)
|
||||
|
||||
PRI Command_Display|a,ack,z,vx
|
||||
infofenster(7,10,35,15,string("Bluetooth-Command"),2) 'Infofenster mit OK-Knopf anzeigen
|
||||
'printfont(@filestring,colors[Titelhcol],0,colors[Titeltextcol],20,8) 'verlinkte Datei in Titelleiste anzeigen
|
||||
rahmen(7,9,35,13)
|
||||
util:=1
|
||||
|
||||
PRI infofenster(x,y,xx,yy,strg,knopf)'|i
|
||||
|
||||
ios.backup_area(x-1,y-2,xx+1,yy+1,BRAM) 'Hintergrund sichern
|
||||
window(2,4,y,x,yy,xx,strg) 'Fenster erstellen
|
||||
if knopf==1
|
||||
button(4,@butOK,((xx-x)/2)+x-2,yy) 'Button 4 gibt es nur im SD-Card-Info-Fenster
|
||||
if knopf==2
|
||||
button(2,@Abbr,((xx-x)/2)+x-2,yy)
|
||||
infomarker:=1
|
||||
|
||||
PRI button(n,btext,x,y)
|
||||
buttonx[n]:=x
|
||||
buttony[n]:=y
|
||||
printfont(btext,colors[buttonhcol],0,colors[buttontextcol],x,y)
|
||||
|
||||
PRI Mouse_Release
|
||||
repeat while ios.mouse_button(0) 'warten bis Maustaste losgelassen wird
|
||||
|
||||
pri ausstieg
|
||||
'ios.display3DBox(255, colors[winhcol], 0, 12, 8, 14, 28)
|
||||
'Print_win(string("Return to Plexus..."),9,13)
|
||||
ios.Mousepointer(hour_glass)
|
||||
ios.serclose
|
||||
cmd_mount
|
||||
activate_dirmarker(systemdir)
|
||||
ios.sdopen("r",@regsys)
|
||||
ios.ldbin(@regsys)
|
||||
|
||||
|
||||
pri testfenster|i,y,a
|
||||
|
||||
a:=0
|
||||
window(0,4,2,1,27,38,string("HC05-Bluetooth-Module"))
|
||||
rahmen (1,6,38,27)
|
||||
rahmen (1,1,38,3)
|
||||
rahmen (1,4,38,6)
|
||||
ios.displaytile(133,colors[winhcol],colors[winhcol],colors[act_color],6,1) 'Rahmen-Verbindungsstücke
|
||||
ios.displaytile(117,colors[winhcol],colors[winhcol],colors[act_color],6,38)
|
||||
|
||||
rahmen (1,10,38,20)
|
||||
ios.displaytile(133,colors[winhcol],colors[winhcol],colors[act_color],10,1) 'Rahmen-Verbindungsstücke
|
||||
ios.displaytile(117,colors[winhcol],colors[winhcol],colors[act_color],10,38)
|
||||
ios.displaytile(133,colors[winhcol],colors[winhcol],colors[act_color],20,1) 'Rahmen-Verbindungsstücke
|
||||
ios.displaytile(117,colors[winhcol],colors[winhcol],colors[act_color],20,38)
|
||||
|
||||
Print_win(string("Bluetooth for Hive-Computer V1.1"),2,2)
|
||||
|
||||
PRI Print_win(str,x,y)
|
||||
printfont(str,colors[winhcol],0,colors[act_color],x,y)
|
||||
|
||||
PRI printhex(value, digits,x,y,back,vor)|wert 'screen: hexadezimalen zahlenwert auf bildschirm ausgeben
|
||||
{{hex(value,digits) - screen: hexadezimale bildschirmausgabe eines zahlenwertes}}
|
||||
value <<= (8 - digits) << 2
|
||||
repeat digits
|
||||
wert:=lookupz((value <-= 4) & $F : "0".."9", "A".."F")
|
||||
ios.displaytile(wert-16,back,0,vor,y,x++)
|
||||
|
||||
PRI texteingabe(y):ok|k,sp,i,mx,my '************** Texteingabe im Dateifenster ******************
|
||||
sp:=8
|
||||
i:=0
|
||||
WIN_TILE(26,y,sp)
|
||||
bytefill(@textline,40,0) 'Stringpuffer löschen
|
||||
repeat
|
||||
k:=ios.key
|
||||
ma:=ios.mouse_button(0)
|
||||
if ma==255
|
||||
mx:=ios.mousex
|
||||
my:=ios.mousey
|
||||
|
||||
if Global_Button_Press(mx,my)==2
|
||||
ok:=2
|
||||
quit
|
||||
'else
|
||||
' ok:=0
|
||||
' quit
|
||||
if k==13 'Return? dann String abschliessen
|
||||
ok:=1
|
||||
textline[i++]:=0
|
||||
quit
|
||||
if k==27 'Abbruch
|
||||
ok:=2
|
||||
quit
|
||||
if k==ios#CHAR_BS 'Backspace
|
||||
if i>0
|
||||
WIN_TILE(16,y,sp--)
|
||||
WIN_TILE(26,y,sp)
|
||||
i--
|
||||
if k=>32 and k=<122 'Buchstaben und Zahlen
|
||||
WIN_TILE(k-16,y,sp++)
|
||||
textline[i++]:=k
|
||||
if i>39
|
||||
i:=39 'Zeichen von Tastatur
|
||||
WIN_TILE(26,y,sp)
|
||||
|
||||
if sp>34
|
||||
sp:=34
|
||||
|
||||
con'****************************************************** Datum und Zeitanzeige *************************************************************************************************
|
||||
|
||||
PRI time|s 'Zeitanzeige in der Statusleiste
|
||||
timezaehler++
|
||||
if timezaehler>150
|
||||
timezaehler:=0
|
||||
s:=ios.getminutes
|
||||
Status_extern(ios.dcf_sync,dcf_on,170,27,0,colors[titeltextcol],black) 'Anzeige des aktuellen Status in der Titelzeile
|
||||
if s<>tmptime
|
||||
displaytime
|
||||
|
||||
PRI displaytime|h,m
|
||||
|
||||
h:=ios.gethours
|
||||
m:=ios.getminutes
|
||||
|
||||
print_zehner(h,29,34,colors[hcolstatus],colors[statustextcol])
|
||||
ios.displaytile(42,colors[hcolstatus],0,colors[statustextcol],29,36)
|
||||
|
||||
print_zehner(m,29,37,colors[hcolstatus],colors[statustextcol])
|
||||
tmptime:=m
|
||||
date
|
||||
|
||||
PRI date
|
||||
|
||||
print_zehner(ios.getdate,0,29,colors[titelhcol],colors[titeltextcol])
|
||||
ios.displaytile(30,colors[titelhcol],0,colors[titeltextcol],0,31)
|
||||
|
||||
print_zehner(ios.getmonth,0,32,colors[titelhcol],colors[titeltextcol])
|
||||
ios.displaytile(30,colors[titelhcol],0,colors[titeltextcol],0,34)
|
||||
printdec(ios.getyear,0,35,colors[titelhcol],colors[titeltextcol])
|
||||
|
||||
pri print_zehner(wert,y,x,hin,vor)|a
|
||||
a:=0
|
||||
if wert<10
|
||||
printdec(0,y,x,hin,vor)
|
||||
a:=1
|
||||
printdec(wert,y,x+a,hin,vor)
|
||||
|
||||
pri Status_extern(wert1,wert2,tnr_act,x,y,col,f3)
|
||||
|
||||
if wert1==1
|
||||
ios.displaytile(tnr_act,colors[Titelhcol],col,f3,y,x) 'Status ok-anzeigen
|
||||
else
|
||||
if wert2 'Externe Komponente in Settingmenue ausgewählt?
|
||||
ios.displaytile(tnr_act,colors[titelhcol],grey,0,y,x) 'Symbol grau
|
||||
else
|
||||
ios.displaytile(16,colors[Titelhcol],colors[titeltextcol],0,y,x) 'Ohne externe Komponente arbeiten (kein Symbol)
|
||||
|
||||
con'
|
||||
PRI doppelklick:click 'pseudo-doppelklick
|
||||
click:=0
|
||||
ios.get_window
|
||||
'Mouse_Release
|
||||
|
||||
repeat 800
|
||||
if ios.mouse_button(0)==255
|
||||
click++
|
||||
|
||||
pri Buttonweg|i
|
||||
repeat i from 0 to 7
|
||||
buttonx[i]:=-1
|
||||
buttony[i]:=-1
|
||||
|
||||
con'
|
||||
PRI iniload|i,a
|
||||
a:=SETTING_RAM
|
||||
repeat i from 0 to 14
|
||||
colors[i]:=ios.ram_rdbyte(a++)
|
||||
|
||||
baud:=ios.ram_rdbyte(a++) 'Übertragungsrate serielles Terminal
|
||||
Show_Hid_Files:=ios.ram_rdbyte(a++) 'unsichtbare Dateien anzeigen? ja/nein
|
||||
Use_Trash:=ios.ram_rdbyte(a++) 'Mülleimer verwenden? ja/nein
|
||||
dcf_on:=ios.ram_rdbyte(a++) 'DCF-Empfänger benutzen
|
||||
|
||||
|
||||
|
||||
PRI activate_dirmarker(mark) 'USER-Marker setzen
|
||||
|
||||
ios.sddmput(ios#DM_USER,mark) 'usermarker wieder in administra setzen
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
PRI get_dirmarker:dm 'USER-Marker lesen
|
||||
|
||||
ios.sddmset(ios#DM_USER)
|
||||
dm:=ios.sddmget(ios#DM_USER)
|
||||
PRI cmd_mount :err 'cmd: mount
|
||||
|
||||
repeat 16
|
||||
err:=ios.sdmount
|
||||
ifnot err
|
||||
mountmarker:=1
|
||||
quit
|
||||
else
|
||||
' display_error(err)
|
||||
quit
|
||||
|
||||
PRI cmd_unmount|err 'cmd: unmount
|
||||
err:=ios.sdunmount
|
||||
ifnot err
|
||||
mountmarker:=0
|
||||
else
|
||||
'display_error(err)
|
||||
|
||||
PRI window(num,cntrl,y,x,yy,xx,strg)|i 'ein Fenster erstellen
|
||||
|
||||
windowx[num]:=x-1
|
||||
windowy[num]:=y-2
|
||||
windowxx[num]:=xx+1
|
||||
windowyy[num]:=yy+1
|
||||
|
||||
ios.window(num,0,colors[winhcol],0,colors[winframecol],colors[titelhcol],colors[titeltextcol],colors[hcolstatus],colors[statustextcol],y-2,x-1,yy+1,xx+1,cntrl,0)
|
||||
ios.printcursorrate(0)
|
||||
ios.printchar(12) 'cls
|
||||
printfont(strg,colors[titelhcol],0,colors[titeltextcol],x,y-2)
|
||||
|
||||
PRI printfont(str1,a,b,c,d,e)|f
|
||||
|
||||
repeat strsize(str1)
|
||||
f:= byte[str1++]
|
||||
f-=16 'anderer Zeichensatz, Zeichen um -16 Positionen versetzt
|
||||
if d>39 'wenn Bildschirmrand erreicht, neue Zeile
|
||||
d:=0
|
||||
e++
|
||||
ios.displayTile(f,a,b,c,e,d) 'einzelnes Tile anzeigen ('displayTile(tnr,pcol,scol,tcol, row, column))
|
||||
|
||||
d++
|
||||
PRI printdec(value,y,xx,hint,vor) | i ,c ,x 'screen: dezimalen zahlenwert auf bildschirm ausgeben
|
||||
{{printdec(value) - screen: dezimale bildschirmausgabe zahlenwertes}}
|
||||
' if value < 0 'negativer zahlenwert
|
||||
' -value
|
||||
'printchar("-")
|
||||
|
||||
i := 1_000_000_000
|
||||
repeat 10 'zahl zerlegen
|
||||
if value => i
|
||||
x:=value / i + "0"
|
||||
ios.displayTile(x-16,hint,0,vor,y,xx) 'printchar(x)
|
||||
xx++
|
||||
c:=value / i + "0"
|
||||
value //= i
|
||||
result~~
|
||||
elseif result or i == 1
|
||||
printfont(string("0"),hint,0,vor,xx,y) 'printchar("0")
|
||||
xx++
|
||||
i /= 10 'nächste stelle
|
||||
con '************************************************** Button-Funktionen ********************************************************************************************************
|
||||
|
||||
PRI buttonpress(n)
|
||||
case n
|
||||
1:printfont(string("Start"),250,0,0,0,29)
|
||||
2:printfont(@Abbr,250,0,0,buttonx[n],buttony[n])
|
||||
4:printfont(@butOK,250,0,0,buttonx[n],buttony[n])
|
||||
|
||||
Mouse_Release
|
||||
case n
|
||||
1:printfont(string("Start"),colors[hcolstatus],0,colors[statustextcol],0,29)
|
||||
2:printfont(@Abbr,colors[Buttonhcol],0,colors[buttontextcol],buttonx[n],buttony[n])
|
||||
4:printfont(@butOK,colors[Buttonhcol],0,colors[buttontextcol],buttonx[n],buttony[n])
|
||||
|
||||
|
||||
con '*************************************************** Start-Menue *************************************************************************************************************
|
||||
PRI Menue(x,y,xx,yy)|i
|
||||
popup(x,y,xx,yy)
|
||||
repeat i from x to xx
|
||||
ios.displaytile(16,colors[Titelhcol],$ff,$ff,y-1,i)
|
||||
|
||||
PRI separator(x,y,xx)|i
|
||||
repeat i from x to xx
|
||||
ios.displaytile(6,colors[Messagehcol],0,colors[winframecol],y,i)
|
||||
|
||||
PRI menueselect(stri,y)
|
||||
printfont(stri,colors[messagetextcol],0,colors[messagehcol],0,y)
|
||||
Mouse_Release
|
||||
printfont(stri,colors[messagehcol],0,colors[messagetextcol],0,y)
|
||||
popup_info_weg
|
||||
|
||||
PRI Startmenue
|
||||
menue(0,24,9,28)
|
||||
printfont(string("Startmenue"),colors[titelhcol],0,colors[titeltextcol],0,23)
|
||||
|
||||
printfont(string("Set - F2"),colors[messagehcol],0,colors[messagetextcol],0,24)
|
||||
menuey[0]:=24
|
||||
printfont(string("Help - F1"),colors[messagehcol],0,colors[messagetextcol],0,25)
|
||||
menuey[1]:=25
|
||||
separator(0,26,9)
|
||||
|
||||
printfont(string("-EXIT- F12"),colors[messagehcol],0,colors[messagetextcol],0,27)
|
||||
menuey[2]:=27
|
||||
con '*************************************************** Popup-Menue *************************************************************************************************************
|
||||
|
||||
PRI popup(x,y,xx,yy)
|
||||
popupx:=x
|
||||
popupy:=y-1
|
||||
popupyy:=yy
|
||||
popupxx:=xx
|
||||
ios.backup_area(popupx,popupy,popupxx,popupyy,BRAM)
|
||||
ios.display2dbox(colors[messagehcol],y,x,yy,xx,0)
|
||||
|
||||
PRI Popup_Info_weg
|
||||
if popupmarker==1 'Popupmenue sichtbar?
|
||||
ios.restore_area(popupx,popupy,popupxx,popupyy,BRAM) 'Hintergrund wiederherstellen
|
||||
popupmarker:=0 'Popupmarker loeschen
|
||||
if infomarker==1
|
||||
ios.restore_area(windowx[2],windowy[2],windowxx[2],windowyy[2],BRAM) 'Hintergrund wiederherstellen
|
||||
infomarker:=0
|
||||
|
||||
PRI rahmen(x,y,xx,yy)|i
|
||||
win_tile(137,y,x)
|
||||
win_tile(136,yy,x)
|
||||
win_tile(157,y,xx)
|
||||
win_tile(119,yy,xx)
|
||||
repeat i from y+1 to yy-1
|
||||
win_tile(2,i,x)
|
||||
win_tile(114,i,xx)
|
||||
line(x+1,y,xx-1)
|
||||
line(x+1,yy,xx-1)
|
||||
|
||||
PRI line(x,y,xx)|i
|
||||
repeat i from x to xx
|
||||
win_tile(130,y,i)
|
||||
|
||||
con '---------------------------------------------- Ausgaberoutinen ---------------------------------------------------------------------------------------------------------------
|
||||
PRI Win_Tile(nu,ty,tx)
|
||||
ios.displaytile(nu,colors[winhcol],0,colors[act_color],ty,tx)
|
||||
|
||||
DAT
|
||||
|
||||
sepia_ini byte "sepia.ini",0
|
||||
|
|
@ -0,0 +1,563 @@
|
|||
{{
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Autor: Reinhard Zielinski │
|
||||
│ Copyright (c) 2013 Reinhard Zielinski │
|
||||
│ See end of file for terms of use. │
|
||||
│ Die Nutzungsbedingungen befinden sich am Ende der Datei │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Informationen : hive-project.de
|
||||
Kontakt : zille09@gmail.com
|
||||
System : TriOS
|
||||
Name : Venatrix-Testprogramm - Test der Funktionen der Venatrix-Bus-Erweiterung
|
||||
Chip : Regnatix
|
||||
Typ : Plexus-Erweiterungsdatei
|
||||
Version : 01
|
||||
Subversion : 00
|
||||
|
||||
|
||||
Logbuch :
|
||||
'############################################### Version 1.0 ######################################################################################################################
|
||||
|
||||
24-11-2013 :-Erstellung der Optik des Testfensters
|
||||
-Grundgerüst stammt vom Sepia-Test-Programm
|
||||
-Sepia-Programmteile entfernt
|
||||
-noch hab ich keine Ahnung, was ich überhaupt testen will ???
|
||||
-6538 Longs frei
|
||||
|
||||
30-01-2014 -Anpassung an die neue reg.ios (Window-Funktionen)
|
||||
-6624 Longs frei
|
||||
}}
|
||||
|
||||
obj
|
||||
ios: "reg-ios-64"
|
||||
|
||||
con
|
||||
_CLKMODE = XTAL1 + PLL16X
|
||||
_XINFREQ = 5_000_000
|
||||
|
||||
'------------- Shell-Farben -----------------------------------------------------
|
||||
shellhcol =0 'Hauptfensterfarbe
|
||||
act_color =1 'Schriftfarbe
|
||||
winhcol =2 'Fensterhintergrundfarbe
|
||||
winframecol =3 'Fensterrandfarbe
|
||||
Titelhcol =4 'Titelleistenfarbe
|
||||
titeltextcol =5 'Titelleistentextfarbe
|
||||
hcolstatus =6 'statusleiste hintergrundfarbe
|
||||
statustextcol =7 'Statustextfarbe
|
||||
buttonhcol =8 'Buttonhintergrundfarbe
|
||||
buttontextcol =9 'Buttontextfarbe
|
||||
messagehcol =10 'Messagebox-Hintergrundfarbe
|
||||
messagetextcol =11 'Messagebox-Textfarbe
|
||||
selectcol =12 'selektionsfarbe
|
||||
mousecol =13 'Mauszeigerfarbe
|
||||
panelcol =14 'Farbe des Utility-Panels
|
||||
|
||||
ADM_SPEC = %00000000_00000000_00000000_01010011
|
||||
SETTING_RAM = $7FF00 'Hier stehen die System-Settings
|
||||
BRAM = $50000 'Overlay-Puffer
|
||||
Hour_Glass = $66800+(167*16*4)
|
||||
'******************Farben ********************************************************
|
||||
#$FC, Light_Grey, #$A8, Grey, #$54, Dark_Grey
|
||||
#$C0, Light_Red, #$80, Red, #$40, Dark_Red
|
||||
#$30, Light_Green, #$20, Green, #$10, Dark_Green
|
||||
#$1F, Light_Blue, #$09, Blue, #$04, Dark_Blue
|
||||
#$F0, Light_Orange, #$E6, Orange, #$92, Dark_Orange
|
||||
#$CC, Light_Purple, #$88, Purple, #$44, Dark_Purple
|
||||
#$3C, Light_Teal, #$28, Teal, #$14, Dark_Teal
|
||||
#$FF, White, #$00, Black
|
||||
'----Icon-Nummern----------------------------------------------------------------
|
||||
BEL_PIC =14
|
||||
ADM_PIC =15
|
||||
BIN_PIC =9
|
||||
BAS_PIC =107
|
||||
DIR_PIC =7
|
||||
ALL_PIC =8
|
||||
DMP_PIC =120
|
||||
TXT_PIC =121
|
||||
SYS_PIC =122
|
||||
COG_PIC =75
|
||||
BACK_PIC =124
|
||||
VOR_PIC =123
|
||||
PLAY_PIC =125
|
||||
STOP_PIC =141
|
||||
CLR_PIC =155
|
||||
EXT_PIC =156
|
||||
|
||||
'------------- F-Tasten für Zusatzfunktionen -------------------------------------
|
||||
F1_Key = 208
|
||||
F2_Key = 209
|
||||
F3_Key = 210
|
||||
F4_Key = 211
|
||||
F5_Key = 212
|
||||
F6_Key = 213
|
||||
F7_Key = 214
|
||||
F8_Key = 215
|
||||
F9_Key = 216
|
||||
F10_Key = 217
|
||||
F11_Key = 218
|
||||
F12_Key = 219
|
||||
ESC_KEY = 27
|
||||
RETURN_KEY = 13
|
||||
'--------------------------------------------------------------------------------
|
||||
|
||||
var
|
||||
|
||||
byte mountmarker,tmptime
|
||||
byte colors[15] 'Farbwerte
|
||||
byte ma,mb 'Maus-Tasten
|
||||
|
||||
byte windowx[3]
|
||||
byte windowy[3]
|
||||
byte windowxx[3]
|
||||
byte windowyy[3]
|
||||
byte menuey[10] 'y-Koordinate für Start-Menue-Einträge
|
||||
byte popupx,popupxx 'x und
|
||||
byte popupy,popupyy 'y-Koordinaten des Popupmenues
|
||||
byte popupmarker 'Marker für Popupmenue
|
||||
byte infomarker
|
||||
byte buttonx[5],buttony[5]
|
||||
byte util
|
||||
long systemdir 'Plexus-System-Verzeichnis
|
||||
byte timezaehler
|
||||
|
||||
dat
|
||||
regsys byte "plexus.dll",0 'Reg.sys für Rückkehr aus externem Programm
|
||||
butOK byte " OK ",0
|
||||
Abbr byte "Cancel",0
|
||||
SYSTEM Byte "PLEXUS ",0 'Plexus-Systemverzeichnis
|
||||
|
||||
PUB main
|
||||
|
||||
ios.start
|
||||
cmd_mount 'sd-card mounten
|
||||
mountmarker:=1 'mount-marker
|
||||
'--------------------------------------------------------------------------------------
|
||||
activate_dirmarker(0) 'ins root
|
||||
ios.sdchdir(@system) 'System-Verzeichnis lesen
|
||||
systemdir:=get_dirmarker 'Dir-Marker lesen
|
||||
|
||||
'--------------------------------------------------------------------------------------
|
||||
cmd_unmount
|
||||
iniload 'Ini-Datei mit Farbwerten laden
|
||||
testfenster
|
||||
util:=0
|
||||
displaytime 'Datum/Zeit
|
||||
repeat
|
||||
|
||||
os_cmdinput 'Hauptprogrammschleife
|
||||
|
||||
PRI os_cmdinput | x,y ,i,dk,key,sync,dcferror,bit_tmp,lvl_tmp,bit_num,bit_lvl,gt_act,act_tmp
|
||||
|
||||
repeat
|
||||
time 'Zeit und Datum anzeigen
|
||||
|
||||
ma:=ios.mouse_button(0) 'linke Maustaste
|
||||
mb:=ios.mouse_button(1) 'rechte Maustaste
|
||||
key:=ios.key
|
||||
|
||||
if popupmarker==0 and infomarker==0
|
||||
sync:=ios.dcf_sync
|
||||
dcferror:=ios.dcf_geterror
|
||||
plot_status(sync,18,8,1)
|
||||
plot_status(dcferror,18,9,0)
|
||||
printdec(ios.dcf_getdatacount,10,18,colors[winhcol],colors[act_color])
|
||||
bit_num:=ios.dcf_getbitnumber
|
||||
if bit_tmp<>bit_num
|
||||
Print_win(string(" "),19,11)
|
||||
printdec(bit_num,11,18,colors[winhcol],colors[act_color])
|
||||
bit_tmp:=bit_num
|
||||
bit_lvl:=ios.dcf_getbitlevel
|
||||
if lvl_tmp<>bit_lvl
|
||||
Print_win(string(" "),19,12)
|
||||
lvl_tmp:=bit_lvl
|
||||
printdec(bit_lvl,12,18,colors[winhcol],colors[act_color])
|
||||
printdec(ios.dcf_gettimezone,14,18,colors[winhcol],colors[act_color])
|
||||
gt_act:=ios.dcf_getactive
|
||||
if gt_act<>act_tmp
|
||||
Print_win(string(" "),19,15)
|
||||
act_tmp:=gt_act
|
||||
printdec(gt_act,15,18,colors[winhcol],colors[act_color])
|
||||
'####################### DCF-Empfangssymbol in der Titelleiste #########################################################
|
||||
if sync==1
|
||||
ios.displaytile(170,colors[Titelhcol],colors[titeltextcol],0,0,27)
|
||||
else
|
||||
ios.displaytile(170,colors[titelhcol],grey,0,0,27) 'dcf-Symbol grau
|
||||
|
||||
'####################### DCF-Zeit anzeigen #############################################################################
|
||||
dcf_time
|
||||
if key
|
||||
popup_info_weg
|
||||
util:=0
|
||||
'**************************** Short-Cuts ****************************************************************************
|
||||
case key
|
||||
F12_Key:ausstieg
|
||||
ESC_KEY:popup_info_weg
|
||||
RETURN_KEY:popup_info_weg
|
||||
|
||||
'***************************** linke Maustaste **********************************************************************
|
||||
if ma==255
|
||||
dk:=0
|
||||
x:=ios.mousex
|
||||
y:=ios.mousey
|
||||
|
||||
|
||||
'****************************** Startmenue anzeigen ************************************************************
|
||||
if popupmarker==1
|
||||
if x>10 or y<24 'Menue loeschen, wenn man woanders hinklickt
|
||||
popup_info_weg
|
||||
util:=0
|
||||
if x=>0 and x=<10 and y==27
|
||||
menueselect(string("-EXIT- F12"),menuey[0])
|
||||
ausstieg
|
||||
|
||||
|
||||
|
||||
'****************************** Globale Funktionstasten ********************************************************
|
||||
if(x=>buttonx[4]) and (x=<buttonx[4]+5) and (y==buttony[4]) and Infomarker==1 'ok im Infofenster
|
||||
buttonpress(4)
|
||||
popup_info_weg
|
||||
if util==1
|
||||
util:=0
|
||||
|
||||
if y==windowy[2] and x==windowx[2] and Infomarker==1 'doppelklick in linke obere ecke des Info-Fensters
|
||||
if doppelklick
|
||||
popup_info_weg
|
||||
util:=0
|
||||
|
||||
if y==windowy[2] and x==windowxx[2] and Infomarker==1
|
||||
ios.get_window
|
||||
popup_info_weg
|
||||
util:=0
|
||||
|
||||
if y==0
|
||||
if (x==39) 'Beenden-Knopf
|
||||
ios.displaytile(1,250,0,0,0,39) 'Schliessen-Symbol
|
||||
Mouse_Release 'warten bis Maustaste losgelassen wird
|
||||
ios.displaytile(1,colors[winhcol],0,colors[winframecol],0,39) 'Schliessen-Symbol
|
||||
ausstieg
|
||||
|
||||
if (x==0) 'Beenden bei Doppelklick auf linke obere Ecke
|
||||
if doppelklick
|
||||
ausstieg
|
||||
if x>1 and x<20 'Doppelklick in die Titelleiste
|
||||
if doppelklick
|
||||
popup_info_weg
|
||||
util:=0
|
||||
Display_Info
|
||||
|
||||
if ((x=>0) and (x=<5)) and (y==29) 'Start-Knopf
|
||||
buttonpress(1)
|
||||
if popupmarker==1
|
||||
popup_info_weg
|
||||
util:=0
|
||||
|
||||
else
|
||||
if infomarker==1
|
||||
popup_info_weg
|
||||
util:=0
|
||||
startmenue
|
||||
popupmarker:=1
|
||||
|
||||
pri plot_status(wert,x,y,act)
|
||||
if wert==act
|
||||
ios.displaytile(COG_PIC,colors[winhcol],green,0,y,x)
|
||||
else
|
||||
ios.displaytile(COG_PIC,colors[winhcol],red,0,y,x)
|
||||
|
||||
PRI Display_Info
|
||||
infofenster(9,10,31,15,string("Program-Info"),1) 'Info-Fenster anzeigen
|
||||
Print_win(string("DCF77-Test for Hive"),9,10)
|
||||
Print_win(string("Version 1.0 - 01/2014"),9,11)
|
||||
Print_win(string("Autor:R.Zielinski"),9,12)
|
||||
Print_win(string("Hive-Project.de"),9,13)
|
||||
|
||||
|
||||
PRI infofenster(x,y,xx,yy,strg,knopf)'|i
|
||||
|
||||
ios.backup_area(x-1,y-2,xx+1,yy+1,BRAM) 'Hintergrund sichern
|
||||
window(2,4,y,x,yy,xx,strg) 'Fenster erstellen
|
||||
if knopf==1
|
||||
button(4,@butOK,((xx-x)/2)+x-2,yy) 'Button 4 gibt es nur im SD-Card-Info-Fenster
|
||||
if knopf==2
|
||||
button(2,@Abbr,((xx-x)/2)+x-2,yy)
|
||||
infomarker:=1
|
||||
|
||||
PRI button(n,btext,x,y)
|
||||
buttonx[n]:=x
|
||||
buttony[n]:=y
|
||||
printfont(btext,colors[buttonhcol],0,colors[buttontextcol],x,y)
|
||||
|
||||
PRI Mouse_Release
|
||||
repeat while ios.mouse_button(0) 'warten bis Maustaste losgelassen wird
|
||||
|
||||
pri ausstieg
|
||||
'ios.dcf_down
|
||||
'ios.display3DBox(255, colors[winhcol], 0, 12, 8, 14, 28)
|
||||
'Print_win(string("Return to Plexus..."),9,13)
|
||||
ios.mousepointer(hour_glass)
|
||||
cmd_mount
|
||||
activate_dirmarker(systemdir)
|
||||
ios.sdopen("r",@regsys)
|
||||
ios.ldbin(@regsys)
|
||||
|
||||
|
||||
pri testfenster|a
|
||||
|
||||
a:=0
|
||||
window(0,4,2,1,27,38,string("DCF77-Receiver-Test"))
|
||||
rahmen (1,6,38,27)
|
||||
rahmen (1,1,38,3)
|
||||
rahmen (1,4,38,6)
|
||||
ios.displaytile(133,colors[winhcol],colors[winhcol],colors[act_color],6,1) 'Rahmen-Verbindungsstücke
|
||||
ios.displaytile(117,colors[winhcol],colors[winhcol],colors[act_color],6,38)
|
||||
Print_win(string("DCF77-Clock for Hive-Computer V1.0"),2,2)
|
||||
|
||||
Print_win(string("Sync-Status :"),2,8)
|
||||
Print_win(string("Receive-Error :"),2,9)
|
||||
Print_win(string("Receive-Count :"),2,10)
|
||||
Print_win(string("Receive-Bit :"),2,11)
|
||||
Print_win(string("Bit-Level :"),2,12)
|
||||
|
||||
Print_win(string("Time-Zone :"),2,14)
|
||||
Print_win(string("DCF-active :"),2,15)
|
||||
|
||||
|
||||
PRI Print_win(str,x,y)
|
||||
printfont(str,colors[winhcol],0,colors[act_color],x,y)
|
||||
|
||||
PRI printhex(value, digits,x,y,back,vor)|wert 'screen: hexadezimalen zahlenwert auf bildschirm ausgeben
|
||||
{{hex(value,digits) - screen: hexadezimale bildschirmausgabe eines zahlenwertes}}
|
||||
value <<= (8 - digits) << 2
|
||||
repeat digits
|
||||
wert:=lookupz((value <-= 4) & $F : "0".."9", "A".."F")
|
||||
ios.displaytile(wert-16,back,0,vor,y,x++)
|
||||
|
||||
con'****************************************************** Datum und Zeitanzeige *************************************************************************************************
|
||||
|
||||
PRI time|s 'Zeitanzeige in der Statusleiste
|
||||
|
||||
s:=ios.getminutes
|
||||
if s<>tmptime
|
||||
displaytime
|
||||
|
||||
PRI displaytime|h,m,x,y
|
||||
|
||||
h:=ios.gethours
|
||||
m:=ios.getminutes
|
||||
|
||||
print_zehner(h,29,34,colors[hcolstatus],colors[statustextcol])
|
||||
ios.displaytile(42,colors[hcolstatus],0,colors[statustextcol],29,36)
|
||||
|
||||
print_zehner(m,29,37,colors[hcolstatus],colors[statustextcol])
|
||||
tmptime:=m
|
||||
date
|
||||
|
||||
PRI date|t,m,j
|
||||
t:=ios.getdate
|
||||
m:=ios.getmonth
|
||||
j:=ios.getyear
|
||||
|
||||
|
||||
print_zehner(t,0,29,colors[titelhcol],colors[titeltextcol])
|
||||
ios.displaytile(30,colors[titelhcol],0,colors[titeltextcol],0,31)
|
||||
|
||||
print_zehner(m,0,32,colors[titelhcol],colors[titeltextcol])
|
||||
ios.displaytile(30,colors[titelhcol],0,colors[titeltextcol],0,34)
|
||||
printdec(j,0,35,colors[titelhcol],colors[titeltextcol])
|
||||
|
||||
pri dcf_time|h,m,s
|
||||
h:=ios.dcf_gethours
|
||||
m:=ios.dcf_getminutes
|
||||
s:=ios.dcf_getseconds
|
||||
|
||||
print_zehner(h,5,21,colors[winhcol],colors[act_color])
|
||||
ios.displaytile(42,colors[winhcol],0,colors[act_color],5,23)
|
||||
|
||||
print_zehner(m,5,24,colors[winhcol],colors[act_color])
|
||||
ios.displaytile(42,colors[winhcol],0,colors[act_color],5,26)
|
||||
|
||||
print_zehner(s,5,27,colors[winhcol],colors[act_color])
|
||||
dcf_date
|
||||
|
||||
PRI dcf_date|t,m,j
|
||||
t:=ios.dcf_getday
|
||||
m:=ios.dcf_getmonth
|
||||
j:=ios.dcf_getyear
|
||||
|
||||
print_zehner(t,5,9,colors[winhcol],colors[act_color])
|
||||
ios.displaytile(30,colors[winhcol],0,colors[act_color],5,11)
|
||||
|
||||
print_zehner(m,5,12,colors[winhcol],colors[act_color])
|
||||
ios.displaytile(30,colors[winhcol],0,colors[act_color],5,14)
|
||||
printdec(j,5,15,colors[winhcol],colors[act_color])
|
||||
|
||||
pri print_zehner(wert,y,x,hin,vor)|a
|
||||
if wert<10
|
||||
printdec(0,y,x,hin,vor)
|
||||
a:=1
|
||||
else
|
||||
a:=0
|
||||
printdec(wert,y,x+a,hin,vor)
|
||||
|
||||
con'
|
||||
PRI doppelklick:click 'pseudo-doppelklick
|
||||
click:=0
|
||||
ios.get_window
|
||||
repeat while ios.mouse_button(0)
|
||||
'Mouse_Release
|
||||
|
||||
repeat 500
|
||||
if ios.mouse_button(0)==255
|
||||
click++
|
||||
|
||||
con'
|
||||
PRI iniload|i,a
|
||||
a:=SETTING_RAM
|
||||
repeat i from 0 to 14
|
||||
colors[i]:=ios.ram_rdbyte(a++)
|
||||
|
||||
PRI activate_dirmarker(mark) 'USER-Marker setzen
|
||||
|
||||
ios.sddmput(ios#DM_USER,mark) 'usermarker wieder in administra setzen
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
PRI get_dirmarker:dm 'USER-Marker lesen
|
||||
|
||||
ios.sddmset(ios#DM_USER)
|
||||
dm:=ios.sddmget(ios#DM_USER)
|
||||
PRI cmd_mount :err 'cmd: mount
|
||||
|
||||
repeat 16
|
||||
err:=ios.sdmount
|
||||
ifnot err
|
||||
mountmarker:=1
|
||||
quit
|
||||
else
|
||||
' display_error(err)
|
||||
quit
|
||||
|
||||
PRI cmd_unmount|err 'cmd: unmount
|
||||
err:=ios.sdunmount
|
||||
ifnot err
|
||||
mountmarker:=0
|
||||
else
|
||||
'display_error(err)
|
||||
|
||||
PRI window(num,cntrl,y,x,yy,xx,strg) 'ein Fenster erstellen
|
||||
|
||||
windowx[num]:=x-1
|
||||
windowy[num]:=y-2
|
||||
windowxx[num]:=xx+1
|
||||
windowyy[num]:=yy+1
|
||||
|
||||
ios.window(num,0,colors[winhcol],0,colors[winframecol],colors[titelhcol],colors[titeltextcol],colors[hcolstatus],colors[statustextcol],y-2,x-1,yy+1,xx+1,cntrl,0)
|
||||
ios.printcursorrate(0)
|
||||
ios.printchar(12) 'cls
|
||||
printfont(strg,colors[titelhcol],0,colors[titeltextcol],x,y-2)
|
||||
|
||||
PRI printfont(str1,a,b,c,d,e)|f
|
||||
|
||||
repeat strsize(str1)
|
||||
f:= byte[str1++]
|
||||
f-=16 'anderer Zeichensatz, Zeichen um -16 Positionen versetzt
|
||||
if d>39 'wenn Bildschirmrand erreicht, neue Zeile
|
||||
d:=0
|
||||
e++
|
||||
ios.displayTile(f,a,b,c,e,d) 'einzelnes Tile anzeigen ('displayTile(tnr,pcol,scol,tcol, row, column))
|
||||
|
||||
d++
|
||||
PRI printdec(value,y,xx,hint,vor) | i ,c ,x 'screen: dezimalen zahlenwert auf bildschirm ausgeben
|
||||
{{printdec(value) - screen: dezimale bildschirmausgabe zahlenwertes}}
|
||||
' if value < 0 'negativer zahlenwert
|
||||
' -value
|
||||
'printchar("-")
|
||||
|
||||
i := 1_000_000_000
|
||||
repeat 10 'zahl zerlegen
|
||||
if value => i
|
||||
x:=value / i + "0"
|
||||
ios.displayTile(x-16,hint,0,vor,y,xx) 'printchar(x)
|
||||
xx++
|
||||
c:=value / i + "0"
|
||||
value //= i
|
||||
result~~
|
||||
elseif result or i == 1
|
||||
printfont(string("0"),hint,0,vor,xx,y) 'printchar("0")
|
||||
xx++
|
||||
i /= 10 'nächste stelle
|
||||
con '************************************************** Button-Funktionen ********************************************************************************************************
|
||||
|
||||
PRI buttonpress(n)
|
||||
case n
|
||||
1:printfont(string("Start"),250,0,0,0,29)
|
||||
4:printfont(@butOK,250,0,0,buttonx[n],buttony[n])
|
||||
|
||||
Mouse_Release
|
||||
case n
|
||||
1:printfont(string("Start"),colors[hcolstatus],0,colors[statustextcol],0,29)
|
||||
4:printfont(@butOK,colors[Buttonhcol],0,colors[buttontextcol],buttonx[n],buttony[n])
|
||||
|
||||
|
||||
con '*************************************************** Start-Menue *************************************************************************************************************
|
||||
PRI Menue(x,y,xx,yy)|i
|
||||
popup(x,y,xx,yy)
|
||||
repeat i from x to xx
|
||||
ios.displaytile(16,colors[Titelhcol],$ff,$ff,y-1,i)
|
||||
|
||||
PRI separator(x,y,xx)|i
|
||||
repeat i from x to xx
|
||||
ios.displaytile(6,colors[Messagehcol],0,colors[winframecol],y,i)
|
||||
|
||||
PRI menueselect(stri,y)
|
||||
printfont(stri,colors[messagetextcol],0,colors[messagehcol],0,y)
|
||||
Mouse_Release
|
||||
printfont(stri,colors[messagehcol],0,colors[messagetextcol],0,y)
|
||||
popup_info_weg
|
||||
|
||||
PRI Startmenue
|
||||
menue(0,26,9,28)
|
||||
printfont(string("Startmenue"),colors[titelhcol],0,colors[titeltextcol],0,25)
|
||||
printfont(string("-EXIT- F12"),colors[messagehcol],0,colors[messagetextcol],0,27)
|
||||
menuey[0]:=27
|
||||
con '*************************************************** Popup-Menue *************************************************************************************************************
|
||||
|
||||
PRI popup(x,y,xx,yy)
|
||||
popupx:=x
|
||||
popupy:=y-1
|
||||
popupyy:=yy
|
||||
popupxx:=xx
|
||||
ios.backup_area(popupx,popupy,popupxx,popupyy,BRAM)
|
||||
ios.display2dbox(colors[messagehcol],y,x,yy,xx,0)
|
||||
|
||||
PRI Popup_Info_weg
|
||||
if popupmarker==1 'Popupmenue sichtbar?
|
||||
ios.restore_area(popupx,popupy,popupxx,popupyy,BRAM) 'Hintergrund wiederherstellen
|
||||
popupmarker:=0 'Popupmarker loeschen
|
||||
if infomarker==1
|
||||
ios.restore_area(windowx[2],windowy[2],windowxx[2],windowyy[2],BRAM) 'Hintergrund wiederherstellen
|
||||
infomarker:=0
|
||||
|
||||
PRI rahmen(x,y,xx,yy)|i
|
||||
win_tile(137,y,x)
|
||||
win_tile(136,yy,x)
|
||||
win_tile(157,y,xx)
|
||||
win_tile(119,yy,xx)
|
||||
repeat i from y+1 to yy-1
|
||||
win_tile(2,i,x)
|
||||
win_tile(114,i,xx)
|
||||
line(x+1,y,xx-1)
|
||||
line(x+1,yy,xx-1)
|
||||
|
||||
PRI line(x,y,xx)|i
|
||||
repeat i from x to xx
|
||||
win_tile(130,y,i)
|
||||
|
||||
con '---------------------------------------------- Ausgaberoutinen ---------------------------------------------------------------------------------------------------------------
|
||||
PRI Win_Tile(nu,ty,tx)
|
||||
ios.displaytile(nu,colors[winhcol],0,colors[act_color],ty,tx)
|
||||
|
||||
DAT
|
||||
|
||||
sepia_ini byte "sepia.ini",0
|
||||
|
|
@ -0,0 +1,524 @@
|
|||
{{******************************************************************************}
|
||||
{ FileName............: Dcf77.spin }
|
||||
{ Project.............: }
|
||||
{ Author(s)...........: MM }
|
||||
{ Version.............: 1.00 }
|
||||
{------------------------------------------------------------------------------}
|
||||
{ DCF77 (clock) control }
|
||||
{ }
|
||||
{ Copyright (C) 2006-2007 M.Majoor }
|
||||
{ }
|
||||
{ This program is free software; you can redistribute it and/or }
|
||||
{ modify it under the terms of the GNU General Public License }
|
||||
{ as published by the Free Software Foundation; either version 2 }
|
||||
{ of the License, or (at your option) any later version. }
|
||||
{ }
|
||||
{ This program is distributed in the hope that it will be useful, }
|
||||
{ but WITHOUT ANY WARRANTY; without even the implied warranty of }
|
||||
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the }
|
||||
{ GNU General Public License for more details. }
|
||||
{ }
|
||||
{ You should have received a copy of the GNU General Public License }
|
||||
{ along with this program; if not, write to the Free Software }
|
||||
{ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. }
|
||||
{ }
|
||||
{------------------------------------------------------------------------------}
|
||||
{ }
|
||||
{ Version Date Comment }
|
||||
{ 1.00 20070727 - Initial release }
|
||||
{******************************************************************************}
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
DCF77 is a time signal being transmitted by 'radio'. The time signal being
|
||||
transmitted is based on an atomic clock.
|
||||
This code assumes we have a DCF77 receiver with a digital output. This output
|
||||
is connected to one of the available input pins.
|
||||
The output pin of the DCF77 receiver changes it output according to the
|
||||
received radio signal. This radio signal is an amplitude modulated signal.
|
||||
The amplitude level is converted into a digital signal by the DCF77 receiver.
|
||||
A typical output signal of a DCF77 receiver is:
|
||||
|
||||
┌──┐ ┌──┐ ┌─┐
|
||||
│ │ │ │ │ │
|
||||
│ │ │ │ │ │
|
||||
│ │ │ │ │ │
|
||||
┘ └─────────────────┘ └───────────────────┘ └──────────────────
|
||||
|
||||
The spacing of these pulses is 1 second. Every second the amplitude signal is
|
||||
being lowered for a small duration (0.1 s or 0.2 s). This lowered amplitude
|
||||
is being output as a pulse here.
|
||||
The duration of the pulse defines whether it represents a digital '0' or a
|
||||
digital '1'.
|
||||
These digital '0' and '1' together form a digital representation of the time.
|
||||
This digital stream of bits is being transmitted within one minute. The next
|
||||
minute a new digital stream starts.
|
||||
For synchronization purposes there will be no pulse when the 59's digital signal
|
||||
is being transmitted. This is used to indicate the start of the next digital
|
||||
stream (and the next minute).
|
||||
The pulse length is converted into a binary signal according to its length:
|
||||
0.1s --> '0'
|
||||
0.2s --> '1'
|
||||
|
||||
The digital stream format is (with the first received bit at the right):
|
||||
|
||||
5 555555555 44444 444 443333 3333332 22222222 211111 11111
|
||||
Sec 9 876543210 98765 432 109876 5432109 87654321 098765 432109876543210
|
||||
|
||||
D P84218421 18421 421 218421 P218421 P4218421 SAZZAR
|
||||
30000 0 00 200 1000 2211
|
||||
|
||||
|
||||
|
||||
R = Call bit (irregularities in DCF77 control facilities)
|
||||
|
||||
A1 = '1' Imminent change-over of time from CET <-> CEST
|
||||
Transmitted 1 hour prior to change (refelected in Z1/Z2)
|
||||
Z1 = Zone time bit 0 '10' = CET ; UTC + 1 hour
|
||||
Z2 = Zone time bit 1 '01' = CEST; DST ; dayligt saving time, UTC + 2 hours
|
||||
A2 = '1' Imminent change-over of leap second
|
||||
Transmitted 1 hour prior to change (January 1/July 1)
|
||||
|
||||
S = Startbit coded time information (always '1')
|
||||
|
||||
1 = Minute (BCD)
|
||||
2 = ,,
|
||||
4 = ,,
|
||||
8 = ,,
|
||||
10 = ,,
|
||||
20 = ,,
|
||||
40 = ,,
|
||||
P1 = Parity bit preceeding 7 bits (all bits including parity equals even number)
|
||||
|
||||
1 = Hour (BDC)
|
||||
2 = ,,
|
||||
4 = ,,
|
||||
8 = ,,
|
||||
10 = ,,
|
||||
20 = ,,
|
||||
P2 = Parity bit preceeding 6 bits (all bits including parity equals even number)
|
||||
|
||||
1 = Calendar day (BCD)
|
||||
2 = ,,
|
||||
4 = ,,
|
||||
8 = ,,
|
||||
10 = ,,
|
||||
20 = ,,
|
||||
|
||||
1 = Day of the week (BCD) 1 = Monday
|
||||
2 = ,,
|
||||
4 = ,,
|
||||
|
||||
1 = Month (BCD)
|
||||
2 = ,,
|
||||
4 = ,,
|
||||
8 = ,,
|
||||
10 = ,,
|
||||
|
||||
1 = Year (BCD)
|
||||
2 = ,,
|
||||
4 = ,,
|
||||
8 = ,,
|
||||
10 = ,,
|
||||
20 = ,,
|
||||
40 = ,,
|
||||
80 = ,,
|
||||
|
||||
P3 = Parity bit preceeding 22 bits (all bits including parity equals even number)
|
||||
|
||||
D = No pulse here except for leap second ('0' pulse) -> the next (leap) second
|
||||
then has no pulse.
|
||||
The pulse following the 'no pulse' indicates start of next minute/data stream.
|
||||
|
||||
|
||||
The DCF device is connected as follows:
|
||||
3V3
|
||||
┌────────┐
|
||||
R │ DCF │ 10k
|
||||
3V3 ──┳──┳──┤ ├─┻── Input
|
||||
C │ device │
|
||||
┌────┻──┻──┤ │
|
||||
└────────┘
|
||||
|
||||
R = 1kΩ
|
||||
C = 1uF + 1nF
|
||||
|
||||
The resistor here has one major purpose: filtering out any noise from the 3V3
|
||||
power supply, which is typically connected directly to the Propeller device.
|
||||
Since the DCF signal itself is a low frequency (77.5 kHz), it falls within
|
||||
the frequency range of the Propeller chip itself, which can lead to problems.
|
||||
Without this resistor the DCF device was unable to function properly. The
|
||||
resistor has very little impact on the voltage available to the DCF device.
|
||||
Because the DCF device draws very little current, the voltage drop over the
|
||||
resistor is very low (0.08V here).
|
||||
{------------------------------------------------------------------------------}}
|
||||
|
||||
|
||||
CON
|
||||
CDcfIn = 22 ' Input pin for DCF77 _>Hive ADM-Port 1 ->Expansionsbus B17
|
||||
CDcfOut = 24 ' Output pin for DCF77 signal (debug/visualization) ->Hive-Administra-LED
|
||||
CDcfLevel = 1 ' Level for '1' signal
|
||||
CNoSync = 0 ' Not in sync (never sync data received)
|
||||
CInSync = 1 ' In sync (no error since last sync)
|
||||
CInSyncWithError = 2 ' Not in sync (error since last sync), but time is up to date
|
||||
CCest = 1 ' CEST timezone (daylight saving time)
|
||||
CCet = 2 ' CET timezone
|
||||
CAm = 0 ' AM
|
||||
CPm = 1 ' PM
|
||||
|
||||
VAR
|
||||
byte Cog ' Active cog
|
||||
long Stack[26] ' Stack for cog
|
||||
byte Bits[8] ' Current detection of pulses (bit access)
|
||||
long BitLevel ' Current bit level (NOT the signal level!)
|
||||
long BitError ' Current bit status
|
||||
byte BitNumber ' Current index of bit (== seconds)
|
||||
|
||||
' Time settings
|
||||
byte DataCount ' Incremented when data below updated
|
||||
byte TimeIndex ' Indicates the active index for the time settings
|
||||
' Typically the background writes in one of the registers
|
||||
' and if they all check out it makes them available by
|
||||
' changing the TimeIndex.
|
||||
byte InSync ' Synchronization indication
|
||||
|
||||
byte TimeZone[2]
|
||||
byte Seconds[2]
|
||||
byte Minutes[2]
|
||||
byte Hours[2] ' 0..23 hour indication
|
||||
byte HoursAmPm[2] ' 1..12 hour indication (used with AM/PM)
|
||||
byte AmPm[2]
|
||||
byte WeekDay[2]
|
||||
byte Day[2]
|
||||
byte Month[2]
|
||||
word Year[2]
|
||||
|
||||
|
||||
{{------------------------------------------------------------------------------
|
||||
Params : -
|
||||
Returns : <Result> TRUE if cog available
|
||||
|
||||
Descript: Start DCF acquisition
|
||||
Notes :
|
||||
------------------------------------------------------------------------------}}
|
||||
|
||||
PUB Start: Success
|
||||
{
|
||||
DIRA[dcfstart]~~
|
||||
outa[dcfstart]:=1
|
||||
waitcnt((clkfreq * 2)+ cnt)
|
||||
outa[dcfstart]:=0
|
||||
}
|
||||
result := Cog := cognew(DcfReceive, @Stack)
|
||||
|
||||
|
||||
{{------------------------------------------------------------------------------
|
||||
Params : -
|
||||
Returns : -
|
||||
|
||||
Descript: Stop cog and DCF acquisition
|
||||
Notes :
|
||||
------------------------------------------------------------------------------}}
|
||||
PUB Stop
|
||||
if Cog == 0 ' Only if cog is active
|
||||
return
|
||||
cogstop(Cog) ' Stop the cog
|
||||
|
||||
|
||||
{{------------------------------------------------------------------------------
|
||||
Params : -
|
||||
Returns : -
|
||||
|
||||
Descript: Interfaces to variables
|
||||
Notes :
|
||||
------------------------------------------------------------------------------}}
|
||||
PUB GetActiveSet: Value
|
||||
result := TimeIndex
|
||||
|
||||
PUB GetInSync: Value
|
||||
result := InSync
|
||||
|
||||
PUB GetTimeZone: Value
|
||||
result := TimeZone[TimeIndex]
|
||||
|
||||
PUB GetSeconds: Value
|
||||
result := Seconds[TimeIndex]
|
||||
|
||||
PUB GetMinutes: Value
|
||||
result := Minutes[TimeIndex]
|
||||
|
||||
PUB GetHours: Value
|
||||
result := Hours[TimeIndex]
|
||||
|
||||
PUB GetWeekDay: Value
|
||||
result := WeekDay[TimeIndex]
|
||||
|
||||
PUB GetDay: Value
|
||||
result := Day[TimeIndex]
|
||||
|
||||
PUB GetMonth: Value
|
||||
result := Month[TimeIndex]
|
||||
|
||||
PUB GetYear: Value
|
||||
result := Year[TimeIndex]
|
||||
|
||||
PUB GetBit(Index): Value
|
||||
result := Bits[Index]
|
||||
|
||||
PUB GetDataCount: Value
|
||||
result := DataCount
|
||||
|
||||
PUB GetBitNumber: Value
|
||||
result := BitNumber
|
||||
|
||||
PUB GetBitLevel: Value
|
||||
result := BitLevel
|
||||
|
||||
PUB GetBitError: Value
|
||||
result := BitError
|
||||
|
||||
|
||||
{{------------------------------------------------------------------------------
|
||||
Params : -
|
||||
Returns : -
|
||||
|
||||
Descript: Handle DCF reception
|
||||
Notes : At fixed intervals the DCF input is polled. Every second the
|
||||
data is checked and the data updated.
|
||||
This code does not compensate for a leap second. However, this
|
||||
is handled by a resynchronization.
|
||||
We use a state machine so we can divide everything up.
|
||||
Digital output:
|
||||
On : In sync (no error)
|
||||
1 Hz : In sync with DCF77 signal (rising edge is start second)
|
||||
3 Hz : In sync with DCF77 signal (59th second)
|
||||
Active in first 0.5 second
|
||||
10 Hz : Previous bit had error
|
||||
Active in first 0.5 second
|
||||
20 Hz : Resyncing (waiting for pulse, max 1 s); followed by bit
|
||||
error signal
|
||||
This is the only variable in length (time) signal
|
||||
The last 100 ms of the 2nd 0.5 second contains a small 40 ms pulse
|
||||
when a binary '1' has been detected (for a '0' no pulse is generated)
|
||||
If no signal is being received then the following output is
|
||||
repeatedly generated: 20 Hz (1s), 10 Hz (0.5s), no signal (0.5s)
|
||||
------------------------------------------------------------------------------}}
|
||||
PUB DcfReceive | LLocalTime, LIntervalCounts, LState, LWaitInterval, LBitNumber, LBitError, LLevels, LBitLevel, LIndex, LAccu, LParity, LError, LNewData
|
||||
DIRA[CDcfIn]~
|
||||
DIRA[CDcfOut]~~
|
||||
DataCount := 0
|
||||
LLocalTime := 0
|
||||
InSync := CNoSync
|
||||
LNewData := FALSE
|
||||
LWaitInterval := CNT ' Get current system counter
|
||||
LState := 99 ' Last state == initiates new state
|
||||
LIntervalCounts := (CLKFREQ / (1000 / 10)) #>381 ' Interval counts
|
||||
TimeIndex := 0
|
||||
LIndex := 1
|
||||
repeat
|
||||
|
||||
' The state machine consists of 100 equal steps
|
||||
' Each of these steps have a time span of 10 ms, getting to a total
|
||||
' of 1 second
|
||||
waitcnt(LWaitInterval += LIntervalCounts) ' Wait for next interval
|
||||
|
||||
' We keep the local time running independent from the received DCF signal
|
||||
' because that might need synchronization. Only when synchronization has taken place
|
||||
' the local time is synchronized with the DCF. This only happens every minute, when
|
||||
' the received data checks out correctly
|
||||
LLocalTime++
|
||||
case LLocalTime
|
||||
001: ' Update local time
|
||||
' Note: the date is not adjusted
|
||||
if Seconds[TimeIndex] == 59
|
||||
Seconds[TimeIndex] := 0
|
||||
if Minutes[TimeIndex] == 59
|
||||
Minutes[TimeIndex] := 0
|
||||
if HoursAmPm[TimeIndex] == 12
|
||||
HoursAmPm[TimeIndex] := 1
|
||||
if AmPm[TimeIndex] == CAm
|
||||
AmPm[TimeIndex] := CPm
|
||||
else
|
||||
AmPm[TimeIndex] := CAm
|
||||
else
|
||||
HoursAmPm[TimeIndex]++
|
||||
if Hours[TimeIndex] == 23
|
||||
Hours[TimeIndex] := 0
|
||||
if WeekDay[TimeIndex] == 7
|
||||
WeekDay[TimeIndex] := 1
|
||||
else
|
||||
WeekDay[TimeIndex]++
|
||||
else
|
||||
Hours[TimeIndex]++
|
||||
else
|
||||
Minutes[TimeIndex]++
|
||||
else
|
||||
Seconds[TimeIndex]++
|
||||
100: LLocalTime := 0
|
||||
|
||||
' Handling the 0/1 detection
|
||||
' We allow a 10% margin of error:
|
||||
' 0 .. 0.3s 0/1 signal detection
|
||||
' 0.3 .. 0.9s signal must be 0
|
||||
' 0.9 .. 1 s not checked
|
||||
' 1 .. 2 s only when resync active
|
||||
LState++
|
||||
case LState
|
||||
01..30 : if INA[CDcfIn] == CDcfLevel
|
||||
LLevels++ ' We only need to check one level
|
||||
31..90 : if INA[CDcfIn] == CDcfLevel
|
||||
LBitError := TRUE ' Any signal here is an error
|
||||
101..200: if INA[CDcfIn] == CDcfLevel
|
||||
LState := 0 ' Restart state machine
|
||||
|
||||
' We divide the second up into several parts, including handling data of the
|
||||
' previous second.
|
||||
' In the last state (100) data from the current second are copied to the data
|
||||
' which is handled the next second
|
||||
case LState
|
||||
091: if (LLevels => 15) ' Decide if we detected a binary '0' or '1'
|
||||
LBitLevel := TRUE
|
||||
Bits[LBitNumber / 8] |= (1 << (LBitNumber // 8))
|
||||
else
|
||||
LBitLevel := FALSE
|
||||
Bits[LBitNumber / 8] &= !(1 << (LBitNumber // 8))
|
||||
092: ' Check for illogical data (this might also be the missing pulse occuring every minute)
|
||||
if LBitNumber <> 59
|
||||
LBitError := LBitError | (LLevels =< 5) | (LLevels => 25)
|
||||
093: ' We can check the received data immediately
|
||||
' The background operates on the inactive settings
|
||||
if LBitLevel
|
||||
LParity++
|
||||
case LBitNumber
|
||||
0 : if LNewData ' If new data, switch over to new data set
|
||||
Seconds[LIndex] := 0 ' Synchronize seconds
|
||||
' Note: we can not synchronize in the
|
||||
' 59th seconds because the 'local time'
|
||||
' state machine adjusts the minutes/hours
|
||||
' when the seconds reaches '60'
|
||||
LLocalTime := 0 ' Synchronize the 'local time' state machine
|
||||
if TimeIndex == 0 ' Switch to different active set
|
||||
TimeIndex := 1
|
||||
LIndex := 0
|
||||
else
|
||||
TimeIndex := 0
|
||||
LIndex := 1
|
||||
InSync := CInSync
|
||||
OUTA[CDcfOut]~~ ' Output on
|
||||
LNewData := FALSE
|
||||
LError := FALSE
|
||||
15 : ' R = Call bit (irregularities in DCF77 control facilities)
|
||||
16 : ' A1 = '1' Imminent change-over of time from CET <-> CEST
|
||||
' Transmitted 1 hour prior to change (refelected in Z1/Z2)
|
||||
19 : ' A2 = '1' Imminent change-over of leap second
|
||||
' Transmitted 1 hour prior to change (January 1/July 1)
|
||||
20 : if !LBitLevel ' S = Startbit coded time information (always '1')
|
||||
LError := TRUE
|
||||
17, 42, 45, 50 : if LBitLevel ' Start new data
|
||||
LAccu := 1
|
||||
else
|
||||
LAccu := 0
|
||||
21, 29, 36 : if LBitLevel ' Start new data and parity controlled data
|
||||
LAccu := 1
|
||||
LParity := 1
|
||||
else
|
||||
LAccu := 0
|
||||
LParity := 0
|
||||
18, 22, 30, 37, 43, 46, 51: if LBitLevel ' 2
|
||||
LAccu += 2
|
||||
case LBitNumber
|
||||
18: TimeZone[LIndex] := LAccu
|
||||
if (LAccu == %00) or (LAccu == %11)
|
||||
LError := TRUE
|
||||
23, 31, 38, 44, 47, 52 : if LBitLevel ' 4
|
||||
LAccu += 4
|
||||
case LBitNumber
|
||||
44: WeekDay[LIndex] := LAccu
|
||||
24, 32, 39, 48, 53 : if LBitLevel ' 8
|
||||
LAccu += 8
|
||||
25, 33, 40, 49, 54 : if LBitLevel ' 10
|
||||
LAccu += 10
|
||||
case LBitNumber
|
||||
49: Month[LIndex] := LAccu
|
||||
26, 34, 41, 55 : if LBitLevel ' 20
|
||||
LAccu += 20
|
||||
case LBitNumber
|
||||
34: Hours[LIndex] := LAccu
|
||||
if LAccu > 11 ' 1..12 Hour + AM/PM
|
||||
AmPm[LIndex] := CPm
|
||||
else
|
||||
AmPm[LIndex] := CAm
|
||||
if LAccu > 12
|
||||
HoursAmPm[LIndex] := LAccu - 12
|
||||
else
|
||||
if LAccu == 0
|
||||
HoursAmPm[LIndex] := 12
|
||||
else
|
||||
HoursAmPm[LIndex] := LAccu
|
||||
41: Day[LIndex] := LAccu
|
||||
27, 56 : if LBitLevel ' 40
|
||||
LAccu += 40
|
||||
case LBitNumber
|
||||
27: Minutes[Lindex] := LAccu
|
||||
57 : if LBitLevel ' 80
|
||||
LAccu += 80
|
||||
Year[LIndex] := 2000 + LAccu
|
||||
28, 35, 58 : if (LParity & %1) <> 0
|
||||
LError := TRUE
|
||||
|
||||
59 : ' D = No pulse here except for leap second ('0' pulse) -> the next (leap) second
|
||||
' then has no pulse.
|
||||
' The pulse following the 'no pulse' indicates start of next minute/data stream.
|
||||
if !LError
|
||||
LNewData := TRUE
|
||||
|
||||
|
||||
100: ' Copy current second data to data we will be handling the next second
|
||||
' and (re)set data for next second
|
||||
if !LBitError ' An error switches to the next state (resync)
|
||||
LState := 0 ' otherwise restart state machine
|
||||
BitLevel := LBitLevel
|
||||
LBitLevel := FALSE
|
||||
BitError := LBitError
|
||||
LBitError := FALSE
|
||||
BitNumber := LBitNumber ' Last to change because foreground might check this one
|
||||
' to read others
|
||||
LLevels := 0
|
||||
if BitError ' A sync error resets the second counter
|
||||
LBitNumber := 0
|
||||
if InSync == CInSync
|
||||
InSync := CInSyncWithError ' 'Out of sync' if we were 'in sync'
|
||||
else
|
||||
LBitNumber++ ' Next second
|
||||
if LBitNumber == 60 ' We could check for leap second here, but ...
|
||||
LBitNumber := 0
|
||||
DataCount++ ' Adjust data indicator for foreground
|
||||
201: LState := 0 ' Resync failed: restart state machine
|
||||
|
||||
|
||||
' Output
|
||||
' time out biterror sec59 level Note: 'biterror' and 'sec59' never active at same time
|
||||
' 1 1 1 1 1
|
||||
' 10 0
|
||||
' 17 0
|
||||
' 20 1
|
||||
' 30 0
|
||||
' 34 1
|
||||
' 40 1
|
||||
' 50 0 0 0 0
|
||||
' 75 1
|
||||
' 91 1
|
||||
' 95 0 0 0 0
|
||||
' 101 1 1 1 1
|
||||
' .. t t t t
|
||||
' 195 0 0 0 0
|
||||
if InSync <> CInSync ' Only control the output when not in sync
|
||||
case LState
|
||||
001 : OUTA[CDcfOut]~~ ' Always on
|
||||
010, 020, 030, 040: if BitError ' 10 Hz signal (bit error)
|
||||
!OUTA[CDcfOut]
|
||||
017, 034, 075 : if !BitError AND (LBitNumber == 59) ' 3 Hz signal (in sync and 59th second)
|
||||
!OUTA[CDcfOut]
|
||||
091 : if LBitLevel ' Bit is '1'
|
||||
!OUTA[CDcfOut] ' Always off
|
||||
050, 095 : OUTA[CDcfOut]~
|
||||
101, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195: !OUTA[CDcfOut]
|
|
@ -0,0 +1,294 @@
|
|||
''*********************************************
|
||||
''* Full-Duplex Serial Driver v1.1 Extended *
|
||||
''* (C) 2006 Parallax, Inc. *
|
||||
''*********************************************
|
||||
|
||||
CON
|
||||
buffer_length = 128 'can be 2, 4, 8, 16, 32, 64, 128, 256
|
||||
buffer_mask = buffer_length - 1
|
||||
|
||||
VAR
|
||||
|
||||
long cog 'cog flag/id
|
||||
|
||||
long rx_head '9 contiguous longs
|
||||
long rx_tail
|
||||
long tx_head
|
||||
long tx_tail
|
||||
long rx_pin
|
||||
long tx_pin
|
||||
long rxtx_mode
|
||||
long bit_ticks
|
||||
long buffer_ptr
|
||||
|
||||
byte rx_buffer[buffer_length] 'transmit and receive buffers
|
||||
byte tx_buffer[buffer_length]
|
||||
|
||||
PUB start(rxpin, txpin, mode, baudrate) : okay
|
||||
|
||||
'' Start serial driver - starts a cog
|
||||
'' returns false if no cog available
|
||||
''
|
||||
'' mode bit 0 = invert rx
|
||||
'' mode bit 1 = invert tx
|
||||
'' mode bit 2 = open-drain/source tx
|
||||
'' mode bit 3 = ignore tx echo on rx
|
||||
|
||||
stop
|
||||
longfill(@rx_head, 0, 4)
|
||||
longmove(@rx_pin, @rxpin, 3)
|
||||
bit_ticks := clkfreq / baudrate
|
||||
buffer_ptr := @rx_buffer
|
||||
okay := cog := cognew(@entry, @rx_head) + 1
|
||||
|
||||
PUB stop
|
||||
|
||||
'' Stop serial driver - frees a cog
|
||||
|
||||
if cog
|
||||
cogstop(cog~ - 1)
|
||||
longfill(@rx_head, 0, 9)
|
||||
|
||||
PUB rxflush
|
||||
|
||||
'' Flush receive buffer
|
||||
|
||||
repeat while rxcheck => 0
|
||||
|
||||
PUB rxcheck : rxbyte
|
||||
|
||||
'' Check if byte received (never waits)
|
||||
'' returns -1 if no byte received, $00..$FF if byte
|
||||
|
||||
rxbyte--
|
||||
if rx_tail <> rx_head
|
||||
rxbyte := rx_buffer[rx_tail]
|
||||
rx_tail := (rx_tail + 1) & buffer_mask
|
||||
|
||||
|
||||
PUB rxtime(ms) : rxbyte | t
|
||||
|
||||
'' Wait ms milliseconds for a byte to be received
|
||||
'' returns -1 if no byte received, $00..$FF if byte
|
||||
|
||||
t := cnt
|
||||
repeat until (rxbyte := rxcheck) => 0 or (cnt - t) / (clkfreq / 1000) > ms
|
||||
|
||||
PUB rx : rxbyte
|
||||
|
||||
'' Receive byte (may wait for byte)
|
||||
'' returns $00..$FF
|
||||
|
||||
repeat while (rxbyte := rxcheck) < 0
|
||||
|
||||
PUB tx(txbyte)
|
||||
|
||||
'' Send byte (may wait for room in buffer)
|
||||
|
||||
'Wait till there's space in the Tx buffer
|
||||
repeat until (tx_tail <> (tx_head + 1) & buffer_mask)
|
||||
tx_buffer[tx_head] := txbyte
|
||||
tx_head := (tx_head + 1) & buffer_mask
|
||||
|
||||
if rxtx_mode & %1000
|
||||
rx
|
||||
|
||||
PUB str(stringptr)
|
||||
|
||||
'' Send string
|
||||
|
||||
repeat strsize(stringptr)
|
||||
tx(byte[stringptr++])
|
||||
|
||||
|
||||
PUB dec(value) | i
|
||||
|
||||
'' Print a decimal number
|
||||
|
||||
if value < 0
|
||||
-value
|
||||
tx("-")
|
||||
|
||||
i := 1_000_000_000
|
||||
|
||||
repeat 10
|
||||
if value => i
|
||||
tx(value / i + "0")
|
||||
value //= i
|
||||
result~~
|
||||
elseif result or i == 1
|
||||
tx("0")
|
||||
i /= 10
|
||||
|
||||
|
||||
PUB hex(value, digits)
|
||||
|
||||
'' Print a hexadecimal number
|
||||
|
||||
value <<= (8 - digits) << 2
|
||||
repeat digits
|
||||
tx(lookupz((value <-= 4) & $F : "0".."9", "A".."F"))
|
||||
|
||||
|
||||
PUB bin(value, digits)
|
||||
|
||||
'' Print a binary number
|
||||
|
||||
value <<= 32 - digits
|
||||
repeat digits
|
||||
tx((value <-= 1) & 1 + "0")
|
||||
|
||||
|
||||
DAT
|
||||
|
||||
'***********************************
|
||||
'* Assembly language serial driver *
|
||||
'***********************************
|
||||
|
||||
org
|
||||
'
|
||||
'
|
||||
' Entry
|
||||
'
|
||||
entry mov t1,par 'get structure address
|
||||
add t1,#4 << 2 'skip past heads and tails
|
||||
|
||||
rdlong t2,t1 'get rx_pin
|
||||
mov rxmask,#1
|
||||
shl rxmask,t2
|
||||
|
||||
add t1,#4 'get tx_pin
|
||||
rdlong t2,t1
|
||||
mov txmask,#1
|
||||
shl txmask,t2
|
||||
|
||||
add t1,#4 'get rxtx_mode
|
||||
rdlong rxtxmode,t1
|
||||
|
||||
add t1,#4 'get bit_ticks
|
||||
rdlong bitticks,t1
|
||||
|
||||
add t1,#4 'get buffer_ptr ...
|
||||
rdlong rxbuff,t1 '... for the receiver
|
||||
mov txbuff,rxbuff '... and the transmitter
|
||||
add txbuff,#buffer_length
|
||||
|
||||
test rxtxmode,#%100 wz 'if_nz = open drain Tx
|
||||
test rxtxmode,#%010 wc 'if_c = inverted output
|
||||
if_z_ne_c or outa,txmask
|
||||
if_z or dira,txmask
|
||||
|
||||
mov txcode,#transmit 'initialize ping-pong multitasking
|
||||
'
|
||||
'
|
||||
' Receive
|
||||
'
|
||||
receive jmpret rxcode,txcode 'run a chunk of transmit code, then return
|
||||
|
||||
test rxtxmode,#%001 wz 'wait for start bit on rx pin
|
||||
test rxmask,ina wc
|
||||
if_z_eq_c jmp #receive
|
||||
|
||||
mov rxbits,#9 'ready to receive byte
|
||||
mov rxcnt,bitticks
|
||||
shr rxcnt,#1 'half a bit tick
|
||||
add rxcnt,cnt '+ the current clock
|
||||
|
||||
:bit add rxcnt,bitticks 'ready for the middle of the bit period
|
||||
|
||||
:wait jmpret rxcode,txcode 'run a chuck of transmit code, then return
|
||||
|
||||
mov t1,rxcnt 'check if bit receive period done
|
||||
sub t1,cnt
|
||||
cmps t1,#0 wc
|
||||
if_nc jmp #:wait
|
||||
|
||||
test rxmask,ina wc 'receive bit on rx pin into carry
|
||||
rcr rxdata,#1 'shift carry into receiver
|
||||
djnz rxbits,#:bit 'go get another bit till done
|
||||
|
||||
test rxtxmode,#%001 wz 'find out if rx is inverted
|
||||
if_z_ne_c jmp #receive 'abort if no stop bit
|
||||
|
||||
shr rxdata,#32-9 'justify and trim received byte
|
||||
and rxdata,#$FF
|
||||
if_nz xor rxdata,#$FF 'if rx inverted, invert byte
|
||||
|
||||
rdlong t2,par 'rx_head
|
||||
add t2,rxbuff 'plus the buffer offset
|
||||
wrbyte rxdata,t2 'write the byte
|
||||
sub t2,rxbuff
|
||||
add t2,#1 'update rx_head
|
||||
and t2,#buffer_mask
|
||||
wrlong t2,par 'and save
|
||||
|
||||
jmp #receive 'byte done, receive next byte
|
||||
'
|
||||
'
|
||||
' Transmit
|
||||
'
|
||||
transmit jmpret txcode,rxcode 'run a chunk of receive code, then return
|
||||
|
||||
mov t1,par 'check for head <> tail
|
||||
add t1,#2 << 2 'tx_head
|
||||
rdlong t2,t1
|
||||
add t1,#1 << 2 'tx_tail
|
||||
rdlong t3,t1
|
||||
cmp t2,t3 wz
|
||||
if_z jmp #transmit
|
||||
|
||||
add t3,txbuff 'get byte and inc tail
|
||||
rdbyte txdata,t3
|
||||
sub t3,txbuff
|
||||
add t3,#1
|
||||
and t3,#buffer_mask
|
||||
wrlong t3,t1
|
||||
|
||||
or txdata,#$100 'or in a stop bit
|
||||
shl txdata,#2
|
||||
or txdata,#1 'or in a idle line state and a start bit
|
||||
mov txbits,#11
|
||||
mov txcnt,cnt
|
||||
|
||||
:bit test rxtxmode,#%100 wz 'output bit on tx pin according to mode
|
||||
test rxtxmode,#%010 wc
|
||||
if_z_and_c xor txdata,#1
|
||||
shr txdata,#1 wc
|
||||
if_z muxc outa,txmask
|
||||
if_nz muxnc dira,txmask
|
||||
add txcnt,bitticks 'ready next cnt
|
||||
|
||||
:wait jmpret txcode,rxcode 'run a chunk of receive code, then return
|
||||
|
||||
mov t1,txcnt 'check if bit transmit period done
|
||||
sub t1,cnt
|
||||
cmps t1,#0 wc
|
||||
if_nc jmp #:wait
|
||||
|
||||
djnz txbits,#:bit 'another bit to transmit?
|
||||
|
||||
jmp #transmit 'byte done, transmit next byte
|
||||
'
|
||||
'
|
||||
' Uninitialized data
|
||||
'
|
||||
t1 res 1
|
||||
t2 res 1
|
||||
t3 res 1
|
||||
|
||||
rxtxmode res 1
|
||||
bitticks res 1
|
||||
|
||||
rxmask res 1
|
||||
rxbuff res 1
|
||||
rxdata res 1
|
||||
rxbits res 1
|
||||
rxcnt res 1
|
||||
rxcode res 1
|
||||
|
||||
txmask res 1
|
||||
txbuff res 1
|
||||
txdata res 1
|
||||
txbits res 1
|
||||
txcnt res 1
|
||||
txcode res 1
|
|
@ -0,0 +1,819 @@
|
|||
{{
|
||||
*************************************
|
||||
* Numbers v1.1 *
|
||||
* Author: Jeff Martin *
|
||||
* Copyright (c) 2005 Parallax, Inc. *
|
||||
* See end of file for terms of use. *
|
||||
*************************************
|
||||
|
||||
{-----------------REVISION HISTORY-----------------
|
||||
v1.1 - 5/5/2009 fixed formatting bug caused by specifying field width smaller than location of first grouping character.}
|
||||
|
||||
}}
|
||||
|
||||
VAR
|
||||
long BCX0, BCX1, BCX2, BCX3 'BCX Workspace
|
||||
byte Symbols[7] 'Special symbols (7 characters)
|
||||
byte StrBuf[49] 'Internal String Buffer
|
||||
|
||||
PUB Init
|
||||
''Initialize to default settings. Init MUST be called before first object use.
|
||||
'' ┌──────────────────────────────────────────────────┐
|
||||
'' │ DEFAULT SPECIAL SYMBOLS │
|
||||
'' ├─────┬──────┬─────────────────────────────────────┤
|
||||
'' │ ID │ Char │ Usage │
|
||||
'' ├─────┼──────┼─────────────────────────────────────┤
|
||||
'' │ 1 │ , │ Comma (digit group separator) │
|
||||
'' │ 2 │ _ │ Underscore (digit group separator) │
|
||||
'' │ 3 │ $ │ Dollar Sign (Hexadecimal indicator) │
|
||||
'' │ 4 │ % │ Percent Sign (Binary indicator) │
|
||||
'' │ 5-7 │ │ Unused (User definable via Config) │
|
||||
'' └─────┴──────┴─────────────────────────────────────┘
|
||||
Config(@DefaultSymbols)
|
||||
|
||||
|
||||
PUB Config(SymAddr)
|
||||
{{Configure for custom symbols.
|
||||
PARAMETERS: SymAddr = Address of a string of characters (7 or less) to be used as Special Symbols (indexed from 1 to 7). New symbols can be added or
|
||||
existing symbols can be modified based on regional customs. Note: The first four symbols must always be the logical: 1) digit group separator
|
||||
(default is ','), 2) general separator (default is '_'), 3) hexadecimal base indicator (default is '$'), and 4) binary base indicator
|
||||
(default is '%').}}
|
||||
bytemove(@Symbols, SymAddr, 7)
|
||||
|
||||
|
||||
PUB ToStr(Num, Format): StrAddr
|
||||
{{Convert long Num to z-string using Format; returns string address.
|
||||
PARAMETERS: Num = 32-bit signed value to translate to ASCII string.
|
||||
Format = Indicates output format: base, width, grouping, etc. See "FORMAT SYNTAX" for more information.
|
||||
RETURNS: Actual length of output string, not including null terminator.}}
|
||||
BCXToText(Format >> 19 & 7, Format >> 13 & $3F, Format >> 12 & 1, Format >> 11 & 1, Format >> 5 & $3F, BinToBCX(Num, Format & $1F #> 2 <# 16))
|
||||
StrAddr := @StrBuf
|
||||
|
||||
|
||||
PUB FromStr(StrAddr, Format): Num | Idx, N, Val, Char, Base, GChar, IChar, Field
|
||||
''Convert z-string (at StrAddr) to long Num using Format.
|
||||
''PARAMETERS: StrAddr = Address of string buffer containing the numeric string to convert.
|
||||
'' Format = Indicates input format: base, width, etc. See "FORMAT SYNTAX" for more information. Note: three Format elements are ignored by
|
||||
'' FromStr(): Zero/Space Padding, Hide/Show Plus Sign, and Digit Group Size. All other elements are actively used during translation.
|
||||
''RETURNS: Long containing 32-bit signed result.
|
||||
Base := Format & $1F #> 2 <# 16 'Get base
|
||||
if GChar := Format >> 13 & 7 'Get grouping character
|
||||
GChar := Symbols[--GChar #> 0]
|
||||
if IChar := Format >> 19 & 7 'Get indicator character
|
||||
IChar := Symbols[--IChar #> 0]
|
||||
Field := Format >> 5 & $3F - 1 'Get field size, if any (subtract out sign char)
|
||||
longfill(@Idx, 0, 3) 'Clear Idx, N and Val
|
||||
repeat while Char := byte[StrAddr][Idx] 'While not null
|
||||
if (not IChar or (IChar and Val)) and InBaseRange(Char, Base) > 0 'Found first valid digit? (with prefix indicator if required)?
|
||||
quit ' exit to process digits
|
||||
else 'else
|
||||
if not Val := IChar and (Char == IChar) ' look for indicator character (if required)
|
||||
N := Char == "-" 'Update N flag if not indicator
|
||||
Idx++
|
||||
Field += Val 'Subract indicator character from remaining field size
|
||||
repeat while (Field--) and (Char := byte[StrAddr][Idx++]) and ((Val := InBaseRange(Char, Base)) > 0 or (GChar and (Char == GChar)))
|
||||
if Val 'While not null and valid digit or grouping char
|
||||
Num := Num * Base + --Val 'Accumulate if valid digit
|
||||
if N
|
||||
-Num 'Negate if necessary
|
||||
|
||||
|
||||
PRI BinToBCX(Num, Base): Digits | N
|
||||
'Convert signed binary Num to signed BCX value (Binary Coded X ;where X (2..16) is determined by Base)
|
||||
'Returns: Number of significant Digits (not counting zero-left-padding).
|
||||
longfill(@BCX0, 0, 4) 'Clear BCX Workspace
|
||||
N := (Num < 0) & $10000000 'Remember if Num negative
|
||||
repeat 'Calc all BCX digits
|
||||
byte[@BCX0][Digits++ >> 1] += ||(Num // Base) << (4 * Digits&1)
|
||||
while Num /= Base
|
||||
BCX3 |= N 'If negative, set flag (highest digit of BCX Workspace)
|
||||
|
||||
|
||||
PRI BCXToText(IChar, Group, ShowPlus, SPad, Field, Digits): Size | Idx, GCnt, SChar, GChar, X
|
||||
'Convert BCX Buffer contents to z-string at StrBuf.
|
||||
'IChar..Field each correspond to elements of Format. See "FORMAT SYNTAX" for more information.
|
||||
'If Field = 0, Digits+1+Group is the effective field (always limited to max of 49).
|
||||
'Digits : Number of significant digits (not counting zero-left-padding).
|
||||
'RETURNS: Actual Size (length) of output string, not including null terminator.
|
||||
X := 1-(IChar > 0) 'Xtra char count (1 or 2, for sign and optional base indicator)
|
||||
IChar := Symbols[--IChar] 'Get base indicator character
|
||||
SChar := "+" + 2*(BCX3 >> 28) + 11*(not (ShowPlus | (BCX3 >> 28)) or ((Digits == 1) and (BCX0 == 0))) 'Determine sign character ('+', ' ' or '-')
|
||||
GChar := Symbols[Group & 7 - 1 #> 0] 'Get group character
|
||||
if Field > 0 and SPad^1 and Digits < 32 'Need to add extra zero-padding?
|
||||
BCX3 &= $0FFFFFFF ' then clear negative flag and set to 32 digits
|
||||
Digits := 32
|
||||
Group := -((Group >>= 3)-(Group > 0))*(Group+1 < Digits) 'Get group size (0 if not enough Digits)
|
||||
Size := (Field - (Field==0)*(Digits+X+((Digits-1)/Group))) <# 49 'Field = 0? Set Size to Digits+X+Group (max 49).
|
||||
if Group 'Insert group chars
|
||||
bytefill(@StrBuf+(Size-Digits-(Digits-1)/Group #> 2), GChar, Digits+(Digits-1)/Group <# Size)
|
||||
Idx~~ 'Insert digits
|
||||
repeat while (++Idx < Digits) and (Idx + (GCnt := Idx/Group) < Size-X)
|
||||
byte[@StrBuf][Size-Idx-1-GCnt] := lookupz(byte[@BCX0][Idx>>1] >> (4 * Idx&1) // 16: "0".."9","A".."F")
|
||||
bytefill(@StrBuf, " ", Size-Idx-(Idx-1)/Group #> 0) 'Left pad with spaces, if necessary
|
||||
byte[@StrBuf][Size-X-Idx-(Idx-1)/Group #> 0] := SChar 'Insert sign
|
||||
if X == 2
|
||||
byte[@StrBuf][Size-1-Idx-(Idx-1)/Group #> 1] := IChar 'Insert base indicator, if necessary
|
||||
byte[@StrBuf][Size] := 0 'Zero-terminate string
|
||||
|
||||
|
||||
PRI InBaseRange(Char, Base): Value
|
||||
'Compare Char against valid characters for Base (1..16) (adjusting for lower-case automatically).
|
||||
'Returns 0 if Char outside valid Base chars or, if valid, returns corresponding Value+1.
|
||||
Value := ( Value -= (Char - $2F) * (Char => "0" and Char =< "9") + ((Char &= $DF) - $36) * (Char => "A" and Char =< "F") ) * -(Value < ++Base)
|
||||
|
||||
|
||||
DAT
|
||||
DefaultSymbols byte ",_$%xxx" 'Special, default, symbols ("x" means unused)
|
||||
|
||||
|
||||
''
|
||||
''
|
||||
''**************************
|
||||
''* FUNCTIONAL DESCRIPTION *
|
||||
''**************************
|
||||
''
|
||||
''The Numbers object converts values in variables (longs) to strings and vice-versa in any base from 2 to 16.
|
||||
''
|
||||
''Standard/Default Features:
|
||||
'' * supports full 32-bit signed values
|
||||
'' * converts using any base from 2 to 16 (binary to hexadecimal)
|
||||
'' * defaults to variable widths (ouputs entire number, regardless of size)
|
||||
'' * uses ' ' or '-' for sign character
|
||||
''
|
||||
''Optional Features
|
||||
'' * allows fixed widths (1 to 49 characters); left padded with either zeros (left justified) or spaces (right justified)
|
||||
'' * can show plus sign for values > 0
|
||||
'' * allows digit grouping (each 2 to 8 characters) with customizable separators; ex: 1000000 becomes 1,000,000 and 7AB14B9C becomes 7AB1_4B9C
|
||||
'' * allows base indicator character (inserted right after sign) with customizable characters; ex: 7AB1 becomes $7AB1 and -1011 becomes -%1011
|
||||
'' * all special symbols can be customized
|
||||
''
|
||||
''
|
||||
''**************************
|
||||
''* FORMAT SYNTAX *
|
||||
''**************************
|
||||
''
|
||||
''The Format parameter of ToStr() and FromStr() is a 22-bit value indicating the desired output or input format. Custom values can be used for the Format
|
||||
''parameter, however, a series of pre-defined constants for common formats as well as each of the elemental building blocks have already been defined by this
|
||||
''object. These pre-defined constants are listed below, followed by a detailed explanation of the syntax of the Format parameter.
|
||||
''
|
||||
''┌────────────────────────────────────────────────────────────────────────────────────────┐ ┌───────────────────────────────────────┐
|
||||
''│ COMMON FORMAT CONSTANTS │ │ Working Examples │
|
||||
''├─────────────────────┬───────────┬────────────┬─────────┬─────────────┬─────────────────┤ ├────────────┬────────┬─────────────────┤
|
||||
''│ CONSTANT │ INDICATED │ DELIMITING │ PADDING │ BASE │ WIDTH │ │ Long Value │ Format │ String Result │
|
||||
''│ │ BASE │ │ │ │ (incl. symbols) │ ├────────────┼────────┼─────────────────┤
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ │ -1234 │ DEC │ -1234 │
|
||||
''│ BIN │ │ │ │ Binary │ Variable │ ├────────────┼────────┼─────────────────┤
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ │ 1234 │ DEC │ 1234 │
|
||||
''│ IBIN │ % │ │ │ Binary │ Variable │ ├────────────┼────────┼─────────────────┤
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ │ 1234 │ HEX │ 4D2 │
|
||||
''│ DBIN │ │ Underscore │ │ Binary │ Variable │ ├────────────┼────────┼─────────────────┤
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ │ -1234 │ IHEX │ -$4D2 │
|
||||
''│ IDBIN │ % │ Underscore │ │ Binary │ Variable │ ├────────────┼────────┼─────────────────┤
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ │ 1234 │ BIN │ 10011010010 │
|
||||
''│ BIN2..BIN33 │ │ │ Zero │ Binary │ Fixed │ ├────────────┼────────┼─────────────────┤
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ │ -1234 │ IBIN │ -%10011010010 │
|
||||
''│ IBIN3..IBIN34 │ % │ │ Zero │ Binary │ Fixed │ ├────────────┼────────┼─────────────────┤
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ │ 1234 │ DDEC │ 1,234 │
|
||||
''│ DBIN7..DBIN40 │ │ Underscore │ Zero │ Binary │ Fixed │ ├────────────┼────────┼─────────────────┤
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ │ -1234 │ DDEC8 │ -001,234 │
|
||||
''│ IDBIN8..IDBIN41 │ % │ Underscore │ Zero │ Binary │ Fixed │ ├────────────┼────────┼─────────────────┤
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ │ -1234 │ DSDEC8 │ -1,234 │
|
||||
''│ SBIN3..SBIN33 │ │ │ Space │ Binary │ Fixed │ ├────────────┼────────┼─────────────────┤
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ │ 1234 │ DBIN │ 100_1101_0010 │
|
||||
''│ ISBIN4..ISBIN34 │ % │ │ Space │ Binary │ Fixed │ ├────────────┼────────┼─────────────────┤
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ │ -1234 │ DBIN15 │ -0100_1101_0010 │
|
||||
''│ DSBIN7..DSBIN40 │ │ Underscore │ Space │ Binary │ Fixed │ └────────────┴────────┴─────────────────┘
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ *Note: In these examples, all positive
|
||||
''│ IDSBIN8..IDSBIN41 │ % │ Underscore │ Space │ Binary │ Fixed │ values' output strings have a space
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ for the sign character. Don't forget
|
||||
''│ DEC │ │ │ │ Decimal │ Variable │ that fact when sizing string buffer
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤ or otherwise using result.
|
||||
''│ DDEC │ │ Comma │ │ Decimal │ Variable │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ DEC2..DEC11 │ │ │ Zero │ Decimal │ Fixed │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ SDEC3..SDEC11 │ │ │ Space │ Decimal │ Fixed │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ DSDEC6..DSDEC14 │ │ Comma │ Space │ Decimal │ Fixed │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ HEX │ │ │ │ Hexadecimal │ Variable │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ IHEX │ $ │ │ │ Hexadecimal │ Variable │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ DHEX │ │ Underscore │ │ Hexadecimal │ Variable │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ IDHEX │ $ │ Underscore │ │ Hexadecimal │ Variable │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ HEX2..HEX9 │ │ │ Zero │ Hexadecimal │ Fixed │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ IHEX3..IHEX10 │ $ │ │ Zero │ Hexadecimal │ Fixed │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ DHEX7..DHEX10 │ │ Underscore │ Zero │ Hexadecimal │ Fixed │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ IDHEX8..IDHEX11 │ $ │ Underscore │ Zero │ Hexadecimal │ Fixed │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ SHEX3..SHEX9 │ │ │ Space │ Hexadecimal │ Fixed │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ ISHEX4..ISHEX10 │ $ │ │ Space │ Hexadecimal │ Fixed │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ DSHEX7..DSHEX10 │ │ Underscore │ Space │ Hexadecimal │ Fixed │
|
||||
''├─────────────────────┼───────────┼────────────┼─────────┼─────────────┼─────────────────┤
|
||||
''│ IDSHEX8..IDSHEX11 │ $ │ Underscore │ Space │ Hexadecimal │ Fixed │
|
||||
''└─────────────────────┴───────────┴────────────┴─────────┴─────────────┴─────────────────┘
|
||||
''
|
||||
''
|
||||
''If the desired format was not already defined by the Common Format Constants, above, you may use the following constants as building blocks to create
|
||||
''the customer format you need.
|
||||
''
|
||||
''┌─────────────────────────────────────────────────────┐
|
||||
''│ FORMAT CONSTANT "BUILDING BLOCKS" │
|
||||
''│ (use these if no equivelant common format exisits) │
|
||||
''├────────────────────┬────────────────────────────────┤
|
||||
''│ CONSTANT │ DESCRIPTION │
|
||||
''├────────────────────┼────────────────────────────────┤
|
||||
''│ BIN, DEC or HEX │ Binary, Decimal or Hexadecimal │
|
||||
''├────────────────────┼────────────────────────────────┤
|
||||
''│ CHAR1..CHAR48 │ Field Width (includes symbols) │
|
||||
''├────────────────────┼────────────────────────────────┤
|
||||
''│ <nothing> / SPCPAD │ Zero / Space Pad │
|
||||
''├────────────────────┼────────────────────────────────┤
|
||||
''│ <nothing> / PLUS │ Hide / Show Plus │
|
||||
''├────────────────────┼────────────────────────────────┤
|
||||
''│ COMMA, USCORE │ Group Character │
|
||||
''├────────────────────┼────────────────────────────────┤
|
||||
''│ GROUP2..GROUP8 │ Group Size │
|
||||
''├────────────────────┼────────────────────────────────┤
|
||||
''│ BINCHAR or HEXCHAR │ Indicator Character │
|
||||
''└────────────────────┴────────────────────────────────┘
|
||||
''
|
||||
''
|
||||
''The detailed syntax of the Format parameter is described below.
|
||||
''
|
||||
''There are 7 elements of the Format parameter:
|
||||
'' 1) Base,
|
||||
'' 2) Field Width,
|
||||
'' 3) Zero/Space Padding,
|
||||
'' 4) Hide/Show Plus Sign,
|
||||
'' 5) Grouping Character ID,
|
||||
'' 6) Digit Group Size,
|
||||
'' 7) Indicator Character
|
||||
''Only the Base element is required, all others are optional.
|
||||
''
|
||||
''The 22-bit syntax is as follows:
|
||||
''
|
||||
'' III ZZZ GGG P S FFFFFF BBBBB
|
||||
''
|
||||
''I : Indicator Character ID (0-7). 0 = no indicator character, 1 = Comma, 2 = Underscore, 3 = Dollar Sign, 4 = Percent Sign, etc., as defined by default Init; may be customized via call to Config().
|
||||
''Z : Digit Group Size (0-7). 0 = no digit group characters, 1 = every 2 chars, 2 = every 3 chars, etc.
|
||||
''G : Grouping Character ID (0-7). 0 or 1 = Comma, 2 = Underscore, etc., as defined by default Init; may be customized via call to Config().
|
||||
''P : Hide/Show Plus Sign (0-1). For Num values > 0, sign char is: ' ' (if P = 0), or '+' (if P = 1).
|
||||
''S : Zero/Space Pad (0-1). [Ignored unless Field Width > 0]. 0 = left pad with zeros (left justified), 1 = left pad with spaces (right justified).
|
||||
''F : Field Width (0-48). String field width, including sign character and any special characters (not including zero terminator).
|
||||
''B : Base (2-16). Base to convert number to; 2 = binary, 10 = decimal, 16 = hexadecimal, etc. This element is required.
|
||||
''
|
||||
''Examples:
|
||||
''
|
||||
''Conversion to variable-width decimal value:
|
||||
'' Use Format of: %000_000_000_0_0_000000_01010, or simply %1010 (decimal 10).
|
||||
''
|
||||
''Conversion to 5-character wide, fixed-width hexadecimal value (left padded with zeros):
|
||||
'' Use Format of: %000_000_000_0_0_000101_10000
|
||||
''
|
||||
''Conversion to 5-character wide, fixed-width hexadecimal value (left padded with spaces):
|
||||
'' Use Format of: %000_000_000_0_1_000101_10000
|
||||
''
|
||||
''Conversion to variable-width decimal value comma-separated at thousands:
|
||||
'' Use Format of: %000_010_001_0_0_000000_01010
|
||||
''
|
||||
''Conversion to Indicated, 6-character wide, fixed-width hexadecimal value (left padded with spaces):
|
||||
'' Use Format of: %011_000_000_0_1_000110_10000
|
||||
''
|
||||
''For convenience and code readability, a number of pre-defined symbolic constants are included that can be added together for any format
|
||||
''combination imaginable. See "FORMAT CONSTANT 'BUILDING BLOCKS'", above. For example, using these constants, the above example format values become
|
||||
''the following, respectively:
|
||||
'' DEC
|
||||
'' HEX+CHAR5
|
||||
'' HEX+CHAR5+SPCPAD
|
||||
'' DEC+GROUP3+COMMA
|
||||
'' HEX+CHAR6+HEXCHAR+SPCPAD
|
||||
''
|
||||
''
|
||||
''┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
''│ 32-Bit Statistics for Bases 2 to 16 │
|
||||
''├──────┬────────────┬────────────────────────────────────────────────────────────────────────────┬───────────────────┤
|
||||
''│ Base │ Max Digits │ Range (Signed) │ Range Is Shown │
|
||||
''│ │ w/o symbols│ Minimum │ Maximum │ Grouped By │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 2 │ 32 │ -10000000_00000000_00000000_00000000 │ +1111111_11111111_11111111_11111111 │ Bytes (exact) │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 3 │ 20 │ -12112_12221_21102_02102 │ +12112_12221_21102_02101 │ Bytes │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 4 │ 16 │ -2000_0000_0000_0000 │ +1333_3333_3333_3333 │ Bytes (exact) │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 5 │ 14 │ -13_344223_434043 │ +13_344223_434042 │ Words │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 6 │ 12 │ -553032_005532 │ +553032_005531 │ Words │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 7 │ 12 │ -10_41342_11162 │ +10_41342_11161 │ Words │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 8 │ 11 │ -2_00000_00000 │ +1_77777_77777 │ Words (15 bits) │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 9 │ 10 │ -54787_73672 │ +54787_73671 │ Words │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 10 │ 10 │ -2,147,483,648 │ +2,147,483,647 │ Thousands (exact) │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 11 │ 9 │ -A_0222_0282 │ +A_0222_0281 │ Words │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 12 │ 9 │ -4_BB23_08A8 │ +4_BB23_08A7 │ Words │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 13 │ 9 │ -2_82BA_4AAB │ +2_82BA_4AAA │ Words │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 14 │ 9 │ -1_652C_A932 │ +1_652C_A931 │ Words │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 15 │ 8 │ -C87D_66B8 │ +C87D_66B7 │ Words │
|
||||
''├──────┼────────────┼──────────────────────────────────────┼─────────────────────────────────────┼───────────────────┤
|
||||
''│ 16 │ 8 │ -8000_0000 │ +7FFF_FFFF │ Words (exact) │
|
||||
''└──────┴────────────┴──────────────────────────────────────┴─────────────────────────────────────┴───────────────────┘
|
||||
|
||||
|
||||
|
||||
CON
|
||||
'┌──────────────────────────────────────────┐
|
||||
'│ Format "Building Blocks" │
|
||||
'└──────────────────────────────────────────┘
|
||||
' III ZZZ GGG P S FFFFFF BBBBB
|
||||
CHAR2 = %000_000_000_0_0_000010_00000 'Fixed Width (includes sign and special symbols)
|
||||
CHAR3 = %000_000_000_0_0_000011_00000
|
||||
CHAR4 = %000_000_000_0_0_000100_00000
|
||||
CHAR5 = %000_000_000_0_0_000101_00000
|
||||
CHAR6 = %000_000_000_0_0_000110_00000
|
||||
CHAR7 = %000_000_000_0_0_000111_00000
|
||||
CHAR8 = %000_000_000_0_0_001000_00000
|
||||
CHAR9 = %000_000_000_0_0_001001_00000
|
||||
CHAR10 = %000_000_000_0_0_001010_00000
|
||||
CHAR11 = %000_000_000_0_0_001011_00000
|
||||
CHAR12 = %000_000_000_0_0_001100_00000
|
||||
CHAR13 = %000_000_000_0_0_001101_00000
|
||||
CHAR14 = %000_000_000_0_0_001110_00000
|
||||
CHAR15 = %000_000_000_0_0_001111_00000
|
||||
CHAR16 = %000_000_000_0_0_010000_00000
|
||||
CHAR17 = %000_000_000_0_0_010001_00000
|
||||
CHAR18 = %000_000_000_0_0_010010_00000
|
||||
CHAR19 = %000_000_000_0_0_010011_00000
|
||||
CHAR20 = %000_000_000_0_0_010100_00000
|
||||
CHAR21 = %000_000_000_0_0_010101_00000
|
||||
CHAR22 = %000_000_000_0_0_010110_00000
|
||||
CHAR23 = %000_000_000_0_0_010111_00000
|
||||
CHAR24 = %000_000_000_0_0_011000_00000
|
||||
CHAR25 = %000_000_000_0_0_011001_00000
|
||||
CHAR26 = %000_000_000_0_0_011010_00000
|
||||
CHAR27 = %000_000_000_0_0_011011_00000
|
||||
CHAR28 = %000_000_000_0_0_011100_00000
|
||||
CHAR29 = %000_000_000_0_0_011101_00000
|
||||
CHAR30 = %000_000_000_0_0_011110_00000
|
||||
CHAR31 = %000_000_000_0_0_011111_00000
|
||||
CHAR32 = %000_000_000_0_0_100000_00000
|
||||
CHAR33 = %000_000_000_0_0_100001_00000
|
||||
CHAR34 = %000_000_000_0_0_100010_00000
|
||||
CHAR35 = %000_000_000_0_0_100011_00000
|
||||
CHAR36 = %000_000_000_0_0_100100_00000
|
||||
CHAR37 = %000_000_000_0_0_100101_00000
|
||||
CHAR38 = %000_000_000_0_0_100110_00000
|
||||
CHAR39 = %000_000_000_0_0_100111_00000
|
||||
CHAR40 = %000_000_000_0_0_101000_00000
|
||||
CHAR41 = %000_000_000_0_0_101001_00000
|
||||
CHAR42 = %000_000_000_0_0_101010_00000
|
||||
CHAR43 = %000_000_000_0_0_101011_00000
|
||||
CHAR44 = %000_000_000_0_0_101100_00000
|
||||
CHAR45 = %000_000_000_0_0_101101_00000
|
||||
CHAR46 = %000_000_000_0_0_101110_00000
|
||||
CHAR47 = %000_000_000_0_0_101111_00000
|
||||
CHAR48 = %000_000_000_0_0_110000_00000
|
||||
CHAR49 = %000_000_000_0_0_110001_00000
|
||||
|
||||
SPCPAD = %000_000_000_0_1_000000_00000 'Space padded
|
||||
|
||||
PLUS = %000_000_000_1_0_000000_00000 'Show plus sign '+' for num > 0
|
||||
|
||||
COMMA = %000_000_001_0_0_000000_00000 'Comma delimiter
|
||||
USCORE = %000_000_010_0_0_000000_00000 'Underscore delimiter
|
||||
|
||||
HEXCHAR = %011_000_000_0_0_000000_00000 'Hexadecimal prefix '$'
|
||||
BINCHAR = %100_000_000_0_0_000000_00000 'Binary prefix '%'
|
||||
|
||||
GROUP2 = %000_001_000_0_0_000000_00000 'Group digits
|
||||
GROUP3 = %000_010_000_0_0_000000_00000
|
||||
GROUP4 = %000_011_000_0_0_000000_00000
|
||||
GROUP5 = %000_100_000_0_0_000000_00000
|
||||
GROUP6 = %000_101_000_0_0_000000_00000
|
||||
GROUP7 = %000_110_000_0_0_000000_00000
|
||||
GROUP8 = %000_111_000_0_0_000000_00000
|
||||
|
||||
|
||||
'┌──────────────────────────────────────────┐
|
||||
'│ Common Decimal Formatters │
|
||||
'└──────────────────────────────────────────┘
|
||||
|
||||
DEC = %000_000_000_0_0_000000_01010 'Decimal, variable widths
|
||||
|
||||
DDEC = DEC+GROUP3+COMMA 'Decimal, variable widths, delimited with commas
|
||||
|
||||
DEC2 = DEC+CHAR2 'Decimal, fixed widths, zero padded
|
||||
DEC3 = DEC+CHAR3
|
||||
DEC4 = DEC+CHAR4
|
||||
DEC5 = DEC+CHAR5
|
||||
DEC6 = DEC+CHAR6
|
||||
DEC7 = DEC+CHAR7
|
||||
DEC8 = DEC+CHAR8
|
||||
DEC9 = DEC+CHAR9
|
||||
DEC10 = DEC+CHAR10
|
||||
DEC11 = DEC+CHAR11
|
||||
|
||||
SDEC3 = DEC3+SPCPAD 'Decimal, fixed widths, space padded
|
||||
SDEC4 = DEC4+SPCPAD
|
||||
SDEC5 = DEC5+SPCPAD
|
||||
SDEC6 = DEC6+SPCPAD
|
||||
SDEC7 = DEC7+SPCPAD
|
||||
SDEC8 = DEC8+SPCPAD
|
||||
SDEC9 = DEC9+SPCPAD
|
||||
SDEC10 = DEC10+SPCPAD
|
||||
SDEC11 = DEC11+SPCPAD
|
||||
|
||||
DSDEC6 = SDEC6+GROUP3+COMMA 'Decimal, fixed widths, space padded, delimited with commas
|
||||
DSDEC7 = SDEC7+GROUP3+COMMA
|
||||
DSDEC8 = SDEC8+GROUP3+COMMA
|
||||
DSDEC9 = SDEC9+GROUP3+COMMA
|
||||
DSDEC10 = SDEC10+GROUP3+COMMA
|
||||
DSDEC11 = SDEC11+GROUP3+COMMA
|
||||
DSDEC12 = DEC+CHAR12+SPCPAD+GROUP3+COMMA
|
||||
DSDEC13 = DEC+CHAR13+SPCPAD+GROUP3+COMMA
|
||||
DSDEC14 = DEC+CHAR14+SPCPAD+GROUP3+COMMA
|
||||
|
||||
|
||||
'┌──────────────────────────────────────────┐
|
||||
'│ Common Hexadecimal Formatters │
|
||||
'└──────────────────────────────────────────┘
|
||||
|
||||
HEX = %000_000_000_0_0_000000_10000 'Hexadecimal, variable widths
|
||||
|
||||
DHEX = HEX+GROUP4+USCORE 'Hexadecimal, variable widths, delimited with underscore
|
||||
|
||||
HEX2 = HEX+CHAR2 'Hexadecimal, fixed widths, zero padded
|
||||
HEX3 = HEX+CHAR3
|
||||
HEX4 = HEX+CHAR4
|
||||
HEX5 = HEX+CHAR5
|
||||
HEX6 = HEX+CHAR6
|
||||
HEX7 = HEX+CHAR7
|
||||
HEX8 = HEX+CHAR8
|
||||
HEX9 = HEX+CHAR9
|
||||
|
||||
SHEX3 = HEX3+SPCPAD 'Hexadecimal, fixed widths, space padded
|
||||
SHEX4 = HEX4+SPCPAD
|
||||
SHEX5 = HEX5+SPCPAD
|
||||
SHEX6 = HEX6+SPCPAD
|
||||
SHEX7 = HEX7+SPCPAD
|
||||
SHEX8 = HEX8+SPCPAD
|
||||
SHEX9 = HEX9+SPCPAD
|
||||
|
||||
DHEX7 = HEX7+GROUP4+USCORE 'Hexadecimal, fixed widths, zero padded, delimited with underscore
|
||||
DHEX8 = HEX8+GROUP4+USCORE
|
||||
DHEX9 = HEX9+GROUP4+USCORE
|
||||
DHEX10 = HEX+CHAR10+GROUP4+USCORE
|
||||
|
||||
DSHEX7 = DHEX7+SPCPAD 'Hexadecimal, fixed widths, space padded, delimited with underscore
|
||||
DSHEX8 = DHEX8+SPCPAD
|
||||
DSHEX9 = DHEX9+SPCPAD
|
||||
DSHEX10 = DHEX10+SPCPAD
|
||||
|
||||
IHEX = HEX+HEXCHAR 'Indicated hexadecimal, variable widths
|
||||
|
||||
IDHEX = DHEX+HEXCHAR 'Indicated hexadecimal, variable widths, delimited with underscore
|
||||
|
||||
IHEX3 = HEX3+HEXCHAR 'Indicated hexadecimal, fixed widths, zero padded
|
||||
IHEX4 = HEX4+HEXCHAR
|
||||
IHEX5 = HEX5+HEXCHAR
|
||||
IHEX6 = HEX6+HEXCHAR
|
||||
IHEX7 = HEX7+HEXCHAR
|
||||
IHEX8 = HEX8+HEXCHAR
|
||||
IHEX9 = HEX9+HEXCHAR
|
||||
IHEX10 = HEX+CHAR10+HEXCHAR
|
||||
|
||||
ISHEX4 = SHEX4+HEXCHAR 'Indicated hexadecimal, fixed widths, space padded
|
||||
ISHEX5 = SHEX5+HEXCHAR
|
||||
ISHEX6 = SHEX6+HEXCHAR
|
||||
ISHEX7 = SHEX7+HEXCHAR
|
||||
ISHEX8 = SHEX8+HEXCHAR
|
||||
ISHEX9 = SHEX9+HEXCHAR
|
||||
ISHEX10 = HEX+CHAR10+SPCPAD+HEXCHAR
|
||||
|
||||
IDHEX8 = DHEX8+HEXCHAR 'Indicated hexadecimal, fixed widths, zero padded, delimited with underscore
|
||||
IDHEX9 = DHEX9+HEXCHAR
|
||||
IDHEX10 = DHEX10+HEXCHAR
|
||||
IDHEX11 = HEX+CHAR11+GROUP4+USCORE+HEXCHAR
|
||||
|
||||
IDSHEX8 = DSHEX8+HEXCHAR 'Indicated hexadecimal, fixed widths, space padded, delimited with underscore
|
||||
IDSHEX9 = DSHEX9+HEXCHAR
|
||||
IDSHEX10 = DSHEX10+HEXCHAR
|
||||
IDSHEX11 = HEX+CHAR11+GROUP4+USCORE+HEXCHAR
|
||||
|
||||
'┌──────────────────────────────────────────┐
|
||||
'│ Common Binary Formatters │
|
||||
'└──────────────────────────────────────────┘
|
||||
|
||||
BIN = %000_000_000_0_0_000000_00010 'Binary, variable widths
|
||||
|
||||
DBIN = BIN+GROUP4+USCORE 'Binary, variable widths, delimited with underscores
|
||||
|
||||
BIN2 = BIN+CHAR2 'Binary, fixed widths, zero padded
|
||||
BIN3 = BIN+CHAR3
|
||||
BIN4 = BIN+CHAR4
|
||||
BIN5 = BIN+CHAR5
|
||||
BIN6 = BIN+CHAR6
|
||||
BIN7 = BIN+CHAR7
|
||||
BIN8 = BIN+CHAR8
|
||||
BIN9 = BIN+CHAR9
|
||||
BIN10 = BIN+CHAR10
|
||||
BIN11 = BIN+CHAR11
|
||||
BIN12 = BIN+CHAR12
|
||||
BIN13 = BIN+CHAR13
|
||||
BIN14 = BIN+CHAR14
|
||||
BIN15 = BIN+CHAR15
|
||||
BIN16 = BIN+CHAR16
|
||||
BIN17 = BIN+CHAR17
|
||||
BIN18 = BIN+CHAR18
|
||||
BIN19 = BIN+CHAR19
|
||||
BIN20 = BIN+CHAR20
|
||||
BIN21 = BIN+CHAR21
|
||||
BIN22 = BIN+CHAR22
|
||||
BIN23 = BIN+CHAR23
|
||||
BIN24 = BIN+CHAR24
|
||||
BIN25 = BIN+CHAR25
|
||||
BIN26 = BIN+CHAR26
|
||||
BIN27 = BIN+CHAR27
|
||||
BIN28 = BIN+CHAR28
|
||||
BIN29 = BIN+CHAR29
|
||||
BIN30 = BIN+CHAR30
|
||||
BIN31 = BIN+CHAR31
|
||||
BIN32 = BIN+CHAR32
|
||||
BIN33 = BIN+CHAR33
|
||||
|
||||
SBIN3 = BIN3+SPCPAD 'Binary, fixed widths, space padded
|
||||
SBIN4 = BIN4+SPCPAD
|
||||
SBIN5 = BIN5+SPCPAD
|
||||
SBIN6 = BIN6+SPCPAD
|
||||
SBIN7 = BIN7+SPCPAD
|
||||
SBIN8 = BIN8+SPCPAD
|
||||
SBIN9 = BIN9+SPCPAD
|
||||
SBIN10 = BIN10+SPCPAD
|
||||
SBIN11 = BIN11+SPCPAD
|
||||
SBIN12 = BIN12+SPCPAD
|
||||
SBIN13 = BIN13+SPCPAD
|
||||
SBIN14 = BIN14+SPCPAD
|
||||
SBIN15 = BIN15+SPCPAD
|
||||
SBIN16 = BIN16+SPCPAD
|
||||
SBIN17 = BIN17+SPCPAD
|
||||
SBIN18 = BIN18+SPCPAD
|
||||
SBIN19 = BIN19+SPCPAD
|
||||
SBIN20 = BIN20+SPCPAD
|
||||
SBIN21 = BIN21+SPCPAD
|
||||
SBIN22 = BIN22+SPCPAD
|
||||
SBIN23 = BIN23+SPCPAD
|
||||
SBIN24 = BIN24+SPCPAD
|
||||
SBIN25 = BIN25+SPCPAD
|
||||
SBIN26 = BIN26+SPCPAD
|
||||
SBIN27 = BIN27+SPCPAD
|
||||
SBIN28 = BIN28+SPCPAD
|
||||
SBIN29 = BIN29+SPCPAD
|
||||
SBIN30 = BIN30+SPCPAD
|
||||
SBIN31 = BIN31+SPCPAD
|
||||
SBIN32 = BIN32+SPCPAD
|
||||
SBIN33 = BIN33+SPCPAD
|
||||
|
||||
DBIN7 = BIN7+GROUP4+USCORE 'Binary, fixed widths, zero padded, delimited with underscores
|
||||
DBIN8 = BIN8+GROUP4+USCORE
|
||||
DBIN9 = BIN9+GROUP4+USCORE
|
||||
DBIN10 = BIN10+GROUP4+USCORE
|
||||
DBIN11 = BIN11+GROUP4+USCORE
|
||||
DBIN12 = BIN12+GROUP4+USCORE
|
||||
DBIN13 = BIN13+GROUP4+USCORE
|
||||
DBIN14 = BIN14+GROUP4+USCORE
|
||||
DBIN15 = BIN15+GROUP4+USCORE
|
||||
DBIN16 = BIN16+GROUP4+USCORE
|
||||
DBIN17 = BIN17+GROUP4+USCORE
|
||||
DBIN18 = BIN18+GROUP4+USCORE
|
||||
DBIN19 = BIN19+GROUP4+USCORE
|
||||
DBIN20 = BIN20+GROUP4+USCORE
|
||||
DBIN21 = BIN21+GROUP4+USCORE
|
||||
DBIN22 = BIN22+GROUP4+USCORE
|
||||
DBIN23 = BIN23+GROUP4+USCORE
|
||||
DBIN24 = BIN24+GROUP4+USCORE
|
||||
DBIN25 = BIN25+GROUP4+USCORE
|
||||
DBIN26 = BIN26+GROUP4+USCORE
|
||||
DBIN27 = BIN27+GROUP4+USCORE
|
||||
DBIN28 = BIN28+GROUP4+USCORE
|
||||
DBIN29 = BIN29+GROUP4+USCORE
|
||||
DBIN30 = BIN30+GROUP4+USCORE
|
||||
DBIN31 = BIN31+GROUP4+USCORE
|
||||
DBIN32 = BIN32+GROUP4+USCORE
|
||||
DBIN33 = BIN33+GROUP4+USCORE
|
||||
DBIN34 = BIN+CHAR34+GROUP4+USCORE
|
||||
DBIN35 = BIN+CHAR35+GROUP4+USCORE
|
||||
DBIN36 = BIN+CHAR36+GROUP4+USCORE
|
||||
DBIN37 = BIN+CHAR37+GROUP4+USCORE
|
||||
DBIN38 = BIN+CHAR38+GROUP4+USCORE
|
||||
DBIN39 = BIN+CHAR39+GROUP4+USCORE
|
||||
DBIN40 = BIN+CHAR40+GROUP4+USCORE
|
||||
|
||||
DSBIN7 = DBIN7+SPCPAD 'Binary, fixed widths, space padded, delimited with underscores
|
||||
DSBIN8 = DBIN8+SPCPAD
|
||||
DSBIN9 = DBIN9+SPCPAD
|
||||
DSBIN10 = DBIN10+SPCPAD
|
||||
DSBIN11 = DBIN11+SPCPAD
|
||||
DSBIN12 = DBIN12+SPCPAD
|
||||
DSBIN13 = DBIN13+SPCPAD
|
||||
DSBIN14 = DBIN14+SPCPAD
|
||||
DSBIN15 = DBIN15+SPCPAD
|
||||
DSBIN16 = DBIN16+SPCPAD
|
||||
DSBIN17 = DBIN17+SPCPAD
|
||||
DSBIN18 = DBIN18+SPCPAD
|
||||
DSBIN19 = DBIN19+SPCPAD
|
||||
DSBIN20 = DBIN20+SPCPAD
|
||||
DSBIN21 = DBIN21+SPCPAD
|
||||
DSBIN22 = DBIN22+SPCPAD
|
||||
DSBIN23 = DBIN23+SPCPAD
|
||||
DSBIN24 = DBIN24+SPCPAD
|
||||
DSBIN25 = DBIN25+SPCPAD
|
||||
DSBIN26 = DBIN26+SPCPAD
|
||||
DSBIN27 = DBIN27+SPCPAD
|
||||
DSBIN28 = DBIN28+SPCPAD
|
||||
DSBIN29 = DBIN29+SPCPAD
|
||||
DSBIN30 = DBIN30+SPCPAD
|
||||
DSBIN31 = DBIN31+SPCPAD
|
||||
DSBIN32 = DBIN32+SPCPAD
|
||||
DSBIN33 = DBIN33+SPCPAD
|
||||
DSBIN34 = DBIN34+SPCPAD
|
||||
DSBIN35 = DBIN35+SPCPAD
|
||||
DSBIN36 = DBIN36+SPCPAD
|
||||
DSBIN37 = DBIN37+SPCPAD
|
||||
DSBIN38 = DBIN38+SPCPAD
|
||||
DSBIN39 = DBIN39+SPCPAD
|
||||
DSBIN40 = DBIN40+SPCPAD
|
||||
|
||||
IBIN = BIN+BINCHAR 'Indicated binary, variable widths
|
||||
|
||||
IDBIN = DBIN+BINCHAR 'Indicated binary, variable widths, delimited with underscores
|
||||
|
||||
IBIN3 = BIN3+BINCHAR 'Indicated binary, fixed widths, zero padded
|
||||
IBIN4 = BIN4+BINCHAR
|
||||
IBIN5 = BIN5+BINCHAR
|
||||
IBIN6 = BIN6+BINCHAR
|
||||
IBIN7 = BIN7+BINCHAR
|
||||
IBIN8 = BIN8+BINCHAR
|
||||
IBIN9 = BIN9+BINCHAR
|
||||
IBIN10 = BIN10+BINCHAR
|
||||
IBIN11 = BIN11+BINCHAR
|
||||
IBIN12 = BIN12+BINCHAR
|
||||
IBIN13 = BIN13+BINCHAR
|
||||
IBIN14 = BIN14+BINCHAR
|
||||
IBIN15 = BIN15+BINCHAR
|
||||
IBIN16 = BIN16+BINCHAR
|
||||
IBIN17 = BIN17+BINCHAR
|
||||
IBIN18 = BIN18+BINCHAR
|
||||
IBIN19 = BIN19+BINCHAR
|
||||
IBIN20 = BIN20+BINCHAR
|
||||
IBIN21 = BIN21+BINCHAR
|
||||
IBIN22 = BIN22+BINCHAR
|
||||
IBIN23 = BIN23+BINCHAR
|
||||
IBIN24 = BIN24+BINCHAR
|
||||
IBIN25 = BIN25+BINCHAR
|
||||
IBIN26 = BIN26+BINCHAR
|
||||
IBIN27 = BIN27+BINCHAR
|
||||
IBIN28 = BIN28+BINCHAR
|
||||
IBIN29 = BIN29+BINCHAR
|
||||
IBIN30 = BIN30+BINCHAR
|
||||
IBIN31 = BIN31+BINCHAR
|
||||
IBIN32 = BIN32+BINCHAR
|
||||
IBIN33 = BIN33+BINCHAR
|
||||
IBIN34 = BIN+CHAR34+BINCHAR
|
||||
|
||||
ISBIN4 = SBIN4+BINCHAR 'Indicated binary, fixed widths, space padded
|
||||
ISBIN5 = SBIN5+BINCHAR
|
||||
ISBIN6 = SBIN6+BINCHAR
|
||||
ISBIN7 = SBIN7+BINCHAR
|
||||
ISBIN8 = SBIN8+BINCHAR
|
||||
ISBIN9 = SBIN9+BINCHAR
|
||||
ISBIN10 = SBIN10+BINCHAR
|
||||
ISBIN11 = SBIN11+BINCHAR
|
||||
ISBIN12 = SBIN12+BINCHAR
|
||||
ISBIN13 = SBIN13+BINCHAR
|
||||
ISBIN14 = SBIN14+BINCHAR
|
||||
ISBIN15 = SBIN15+BINCHAR
|
||||
ISBIN16 = SBIN16+BINCHAR
|
||||
ISBIN17 = SBIN17+BINCHAR
|
||||
ISBIN18 = SBIN18+BINCHAR
|
||||
ISBIN19 = SBIN19+BINCHAR
|
||||
ISBIN20 = SBIN20+BINCHAR
|
||||
ISBIN21 = SBIN21+BINCHAR
|
||||
ISBIN22 = SBIN22+BINCHAR
|
||||
ISBIN23 = SBIN23+BINCHAR
|
||||
ISBIN24 = SBIN24+BINCHAR
|
||||
ISBIN25 = SBIN25+BINCHAR
|
||||
ISBIN26 = SBIN26+BINCHAR
|
||||
ISBIN27 = SBIN27+BINCHAR
|
||||
ISBIN28 = SBIN28+BINCHAR
|
||||
ISBIN29 = SBIN29+BINCHAR
|
||||
ISBIN30 = SBIN30+BINCHAR
|
||||
ISBIN31 = SBIN31+BINCHAR
|
||||
ISBIN32 = SBIN32+BINCHAR
|
||||
ISBIN33 = SBIN33+BINCHAR
|
||||
ISBIN34 = BIN+CHAR34+SPCPAD+BINCHAR
|
||||
|
||||
IDBIN8 = DBIN8+BINCHAR 'Indicated binary, fixed widths, zero padded, delimited with underscores
|
||||
IDBIN9 = DBIN9+BINCHAR
|
||||
IDBIN10 = DBIN10+BINCHAR
|
||||
IDBIN11 = DBIN11+BINCHAR
|
||||
IDBIN12 = DBIN12+BINCHAR
|
||||
IDBIN13 = DBIN13+BINCHAR
|
||||
IDBIN14 = DBIN14+BINCHAR
|
||||
IDBIN15 = DBIN15+BINCHAR
|
||||
IDBIN16 = DBIN16+BINCHAR
|
||||
IDBIN17 = DBIN17+BINCHAR
|
||||
IDBIN18 = DBIN18+BINCHAR
|
||||
IDBIN19 = DBIN19+BINCHAR
|
||||
IDBIN20 = DBIN20+BINCHAR
|
||||
IDBIN21 = DBIN21+BINCHAR
|
||||
IDBIN22 = DBIN22+BINCHAR
|
||||
IDBIN23 = DBIN23+BINCHAR
|
||||
IDBIN24 = DBIN24+BINCHAR
|
||||
IDBIN25 = DBIN25+BINCHAR
|
||||
IDBIN26 = DBIN26+BINCHAR
|
||||
IDBIN27 = DBIN27+BINCHAR
|
||||
IDBIN28 = DBIN28+BINCHAR
|
||||
IDBIN29 = DBIN29+BINCHAR
|
||||
IDBIN30 = DBIN30+BINCHAR
|
||||
IDBIN31 = DBIN31+BINCHAR
|
||||
IDBIN32 = DBIN32+BINCHAR
|
||||
IDBIN33 = DBIN33+BINCHAR
|
||||
IDBIN34 = DBIN34+BINCHAR
|
||||
IDBIN35 = DBIN35+BINCHAR
|
||||
IDBIN36 = DBIN36+BINCHAR
|
||||
IDBIN37 = DBIN37+BINCHAR
|
||||
IDBIN38 = DBIN38+BINCHAR
|
||||
IDBIN39 = DBIN39+BINCHAR
|
||||
IDBIN40 = DBIN40+BINCHAR
|
||||
IDBIN41 = BIN+CHAR41+GROUP4+USCORE+BINCHAR
|
||||
|
||||
IDSBIN8 = DSBIN8+BINCHAR 'Indicated binary, fixed widths, space padded, delimited with underscores
|
||||
IDSBIN9 = DSBIN9+BINCHAR
|
||||
IDSBIN10 = DSBIN10+BINCHAR
|
||||
IDSBIN11 = DSBIN11+BINCHAR
|
||||
IDSBIN12 = DSBIN12+BINCHAR
|
||||
IDSBIN13 = DSBIN13+BINCHAR
|
||||
IDSBIN14 = DSBIN14+BINCHAR
|
||||
IDSBIN15 = DSBIN15+BINCHAR
|
||||
IDSBIN16 = DSBIN16+BINCHAR
|
||||
IDSBIN17 = DSBIN17+BINCHAR
|
||||
IDSBIN18 = DSBIN18+BINCHAR
|
||||
IDSBIN19 = DSBIN19+BINCHAR
|
||||
IDSBIN20 = DSBIN20+BINCHAR
|
||||
IDSBIN21 = DSBIN21+BINCHAR
|
||||
IDSBIN22 = DSBIN22+BINCHAR
|
||||
IDSBIN23 = DSBIN23+BINCHAR
|
||||
IDSBIN24 = DSBIN24+BINCHAR
|
||||
IDSBIN25 = DSBIN25+BINCHAR
|
||||
IDSBIN26 = DSBIN26+BINCHAR
|
||||
IDSBIN27 = DSBIN27+BINCHAR
|
||||
IDSBIN28 = DSBIN28+BINCHAR
|
||||
IDSBIN29 = DSBIN29+BINCHAR
|
||||
IDSBIN30 = DSBIN30+BINCHAR
|
||||
IDSBIN31 = DSBIN31+BINCHAR
|
||||
IDSBIN32 = DSBIN32+BINCHAR
|
||||
IDSBIN33 = DSBIN33+BINCHAR
|
||||
IDSBIN34 = DSBIN34+BINCHAR
|
||||
IDSBIN35 = DSBIN35+BINCHAR
|
||||
IDSBIN36 = DSBIN36+BINCHAR
|
||||
IDSBIN37 = DSBIN37+BINCHAR
|
||||
IDSBIN38 = DSBIN38+BINCHAR
|
||||
IDSBIN39 = DSBIN39+BINCHAR
|
||||
IDSBIN40 = DSBIN40+BINCHAR
|
||||
IDSBIN41 = BIN+CHAR41+SPCPAD+GROUP4+USCORE+BINCHAR
|
||||
|
||||
|
||||
|
||||
{{
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ 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. │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
}}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,328 @@
|
|||
{{
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Autor: Reinhard Zielinski │
|
||||
│ Copyright (c) 2013 Reinhard Zielinski │
|
||||
│ See end of file for terms of use. │
|
||||
│ Die Nutzungsbedingungen befinden sich am Ende der Datei │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Informationen : hive-project.de
|
||||
Kontakt : zille09@gmail.com
|
||||
System : TriOS
|
||||
Name : PLEXUS - Zentrale Kommunikationseinheit der Borg
|
||||
Chip : Regnatix
|
||||
Typ : Loader-Programm für Plexus - TRIOS-Version
|
||||
Version : 01
|
||||
Subversion : 01-TRIOS
|
||||
|
||||
Funktion : "Startdatei für PLEXUS - unter TRIOS lauffähig, startet den Administra- und Bellatrixcode von SD-Karte
|
||||
|
||||
Logbuch :
|
||||
'############################################# Version 1.00 #################################################################################################################
|
||||
04-08-2013 : -Erster Versuch der Herauslösung der Startfunktionen aus der eigentlichen Plexus-Shell, es werden alle Startparameter in den E-Ram geladen und dann
|
||||
die eigentliche Shell gestartet
|
||||
-Außerdem wird das Plexus-Logo beim Start angezeigt -> das sieht cool aus ;-)
|
||||
|
||||
16-08-2013 -LOGO wurde Borg-mäßig in grün geändert - nu is noch cooler ;-)
|
||||
-Scrolltext für unser Motto hinzugefügt - nu is aber Schluss mit cool
|
||||
|
||||
'############################################# Version 1.01 #################################################################################################################
|
||||
15-10-2013 -LOGO-Farbgebung geändert, jetzt bunter, weil Plexus Version 2.0 geladen wird
|
||||
19-10-2013 -Fehler in Iniload behoben, es wurde der Venatrix- und Sepia-Marker an die falsche Stelle im Ram abgelegt
|
||||
07-11-2013 -Fehldarstellung beim Löschen des Start-Logo's behoben (jetzt wird der Bildschirm mit der aktuellen Shell-Hintergrundfarbe gelöscht)
|
||||
|
||||
'############################################# VERSION 1.02 #################################################################################################################
|
||||
19-03-2014 -Laderoutine für die Error-und Systemtexte geändert, jeder Text hat jetzt eine feste Adresse, ist beim laden zwar langsamer aber die Texte
|
||||
-werden viel schneller aus dem Ram geladen und angezeigt, egal wieviele Texte vorhanden sind
|
||||
}}
|
||||
|
||||
OBJ
|
||||
ios: "reg-ios-64"
|
||||
|
||||
CON
|
||||
|
||||
_CLKMODE = XTAL1 + PLL16X
|
||||
_XINFREQ = 5_000_000
|
||||
|
||||
'-------- Speicher für diverse Texte ------------
|
||||
TXT_RAM = $20000
|
||||
vidnfo = $21000
|
||||
sndnfo = $21200
|
||||
prgnfo = $21400
|
||||
Verz_RAM = $21800
|
||||
MENU_RAM = $22000
|
||||
'-------- Speicher für Titelliste ---------------
|
||||
DMP_RAM = $40000
|
||||
'-------- Speicher für Screensaver --------------
|
||||
SCREEN_SV = $63000
|
||||
'-------- Speicher für Systemfont ---------------
|
||||
SYS_FONT = $66800 '....$693FF ' ab hier liegt der System-Font 11kb
|
||||
|
||||
|
||||
|
||||
'-------- Speicher für Dateiliste ---------------
|
||||
DIR_RAM = $69440 '....$6AFFF
|
||||
MOUSE_RAM = $69400 '....$6943F ' User-Mouse-Pointer 64byte
|
||||
'-------- YMODEM Temp-Speicher ------------------
|
||||
YMODEM_RAM= $7E400 '... $7E417 Name, der zu sendenden Datei, Was soll gemacht werden(0Empfang,1Senden)+Dirmarker
|
||||
|
||||
LINK_RAM = $7FE00
|
||||
PARA_RAM = $7FE40
|
||||
SETTING_RAM = $7FF00 'Hier stehen die System-Settings
|
||||
START_FLAG = $7FFFF 'Flag das Plexus schonmal gestartet wurde ->Logo unterdrücken
|
||||
|
||||
|
||||
ADM_SPEC = %00000000_00000000_00000000_01010011
|
||||
|
||||
'******************Farben ********************************************************
|
||||
#$FC, Light_Grey, #$A8, Grey, #$54, Dark_Grey
|
||||
#$C0, Light_Red, #$80, Red, #$40, Dark_Red
|
||||
#$30, Light_Green, #$20, Green, #$10, Dark_Green
|
||||
#$1F, Light_Blue, #$09, Blue, #$04, Dark_Blue
|
||||
#$F0, Light_Orange, #$E6, Orange, #$92, Dark_Orange
|
||||
#$CC, Light_Purple, #$88, Purple, #$44, Dark_Purple
|
||||
#$3C, Light_Teal, #$28, Teal, #$14, Dark_Teal
|
||||
#$FF, White, #$00, Black
|
||||
|
||||
|
||||
VAR
|
||||
'systemvariablen
|
||||
byte font[25] 'Hilfsstring für Strings aus dem Ram
|
||||
byte colors[14]
|
||||
long systemdir 'Systemverzeichnis-Marker
|
||||
|
||||
dat
|
||||
ini byte "reg.ini",0 'Ini-Datei für Farbwerte, Dateiverknüpfungen und Systemeinstellungen
|
||||
errortxt byte "reg.err",0
|
||||
' Trash byte "TRASH ",0
|
||||
video_inf byte "VIDEO.NFO",0
|
||||
prg_inf byte "prg.nfo",0
|
||||
sound_nfo byte "sound.nfo",0
|
||||
plexus byte "plexus.dll",0
|
||||
SYSTEM Byte "PLEXUS ",0 'Plexus-Systemverzeichnis
|
||||
Version byte "Version 2.05",0
|
||||
|
||||
sysfont byte "reg.fnt",0
|
||||
scrsaver byte "plexus.dat",0
|
||||
scroll byte "WE ARE BORG! YOU WILL BE ASSIMILATED. RESISTANCE IS FUTIL.",0
|
||||
|
||||
PUB main | i,a
|
||||
|
||||
ios.start
|
||||
ios.sdmount 'sd-card mounten
|
||||
activate_dirmarker(0)
|
||||
ios.sdchdir(@system) 'in's System-Verzeichnis springen
|
||||
systemdir:=get_dirmarker 'System-Dirmarker lesen
|
||||
'activate_dirmarker(0)
|
||||
|
||||
if ios.admgetspec<>ADM_SPEC
|
||||
ios.admload(string("plexus.adm")) 'Administracode laden
|
||||
|
||||
activate_dirmarker(systemdir) 'nach dem Neustart von Administra wieder ins Systemverzeichnis springen
|
||||
|
||||
if ios.bel_get<>88
|
||||
ios.belload(string("plexus.bel")) 'Bellatrixcode laden
|
||||
|
||||
|
||||
ios.ram_fill(DIR_RAM,$1BFF,0) 'Dir-Speicher löschen
|
||||
ios.ram_fill(DMP_RAM,$1FFF,0) 'Dmp-File-Speicher löschen
|
||||
ios.ram_fill(TXT_RAM,$2000,0) 'Error-Text-Speicher löschen
|
||||
ios.ram_fill(LINK_RAM,$1ff,0) 'Link-Speicher löschen
|
||||
ios.ram_fill(MENU_RAM,$500,0) 'Menue-Text-Speicher löschen
|
||||
ios.ram_fill(YMODEM_RAM,$30,0) 'YMODEM-RAM löschen
|
||||
'--------------------------------------------------------------------------------------
|
||||
activate_dirmarker(systemdir) 'nach dem Neustart von Administra wieder ins Systemverzeichnis springen
|
||||
|
||||
ios.sdopen("R",@errortxt)
|
||||
fileload_err(TXT_RAM) 'Fehler-Texte laden
|
||||
ios.sdopen("R",@video_inf)
|
||||
fileload(vidnfo) 'Video-Info laden
|
||||
ios.sdopen("R",@sound_nfo)
|
||||
fileload(sndnfo) 'Sound-Info laden
|
||||
ios.sdopen("R",@prg_inf)
|
||||
fileload(prgnfo) 'Programm-Info laden
|
||||
'***************** Initialisierung ohne Ini-Datei ****************************
|
||||
if iniload 'wenn keine Ini da ist, standardwerte setzen
|
||||
colors[0]:=light_blue
|
||||
colors[1]:=white
|
||||
colors[2]:=light_blue
|
||||
colors[3]:=white
|
||||
colors[4]:=dark_blue
|
||||
colors[5]:=white
|
||||
colors[6]:=grey
|
||||
colors[7]:=white
|
||||
colors[8]:=white
|
||||
colors[9]:=dark_blue
|
||||
colors[10]:=blue
|
||||
colors[11]:=white
|
||||
colors[12]:=purple
|
||||
colors[13]:=black
|
||||
colors[14]:=grey
|
||||
i:=SETTING_RAM
|
||||
a:=0
|
||||
repeat 15
|
||||
ios.ram_wrbyte(colors[a++],i++)
|
||||
|
||||
ios.ram_wrbyte(7,i++) 'baudrate setzen auf 57600
|
||||
ios.ram_wrbyte(1,i++) 'show hidden files
|
||||
ios.ram_wrbyte(1,i++) 'use trash
|
||||
ios.ram_wrbyte(0,i++) 'Venatrix nicht verwenden
|
||||
ios.ram_wrbyte(0,i++) 'Sepia nicht verwenden
|
||||
|
||||
'****************** Hauptbildschirm ******************************************
|
||||
ios.printBoxcolor(0,red,orange,95)
|
||||
ios.printchar(12) 'cls
|
||||
|
||||
LoadTiletoRam(@sysfont,SYS_FONT) 'Systemfont auf jeden Fall in den Ram laden
|
||||
'******************************************************************************
|
||||
'*Wird Plexus aus beendeten Bin Dateien geladen, wird das Logo nicht angezeigt*
|
||||
'******************************************************************************
|
||||
if ios.ram_rdbyte(START_FLAG)<>235
|
||||
LoadTiletoRam(@scrsaver,SCREEN_SV) 'Plexus-Logo in den Ram laden
|
||||
loadtile(SCREEN_SV) 'Plexus-Logo nach Bella laden
|
||||
ios.display2dbox(red,0,0,2,39,0)
|
||||
ios.display2dbox(blue,3,0,5,39,0)
|
||||
ios.display2dbox(orange,6,0,9,39,0)
|
||||
|
||||
ios.display2dbox(light_blue,10,0,10,39,0)
|
||||
|
||||
ios.display2dbox(black,11,0,18,39,0)
|
||||
|
||||
ios.display2dbox(light_blue,19,0,19,39,0)
|
||||
|
||||
ios.display2dbox(orange,20,0,23,39,0)
|
||||
ios.display2dbox(blue,24,0,26,39,0)
|
||||
ios.display2dbox(red,27,0,29,39,0)
|
||||
ios.displaypic(black,255,0,11,10,8,22)'light_orange,0,11,10,8,22) 'Plexus-Logo anzeigen
|
||||
|
||||
ios.setpos(7,15)
|
||||
ios.print(string("Welcome to"))
|
||||
ios.setpos(21,12)
|
||||
ios.print(string("for Hive-Computer"))
|
||||
ios.printBoxcolor(0,orange,blue,95)
|
||||
ios.setpos(24,14)
|
||||
ios.print(@version)
|
||||
ios.printBoxcolor(0,orange,light_orange,95)
|
||||
|
||||
ios.scrollString(@scroll,4, light_orange, red, 27, 0, 39)
|
||||
|
||||
'************************* Plexus wird geladen *************************************
|
||||
ios.printBoxcolor(0,0,ios.ram_rdbyte(SETTING_RAM),0)'ios.ram_rdbyte(0,colors[0],SETTING_RAM)
|
||||
ios.printchar(12) 'cls
|
||||
|
||||
ios.sdopen("R",@plexus) 'Plexus.Dll öffnen
|
||||
ios.ldbin(@plexus) 'Plexus laden
|
||||
ios.stop
|
||||
{
|
||||
#$FC, Light_Grey, #$A8, Grey, #$54, Dark_Grey
|
||||
#$C0, Light_Red, #$80, Red, #$40, Dark_Red
|
||||
#$30, Light_Green, #$20, Green, #$10, Dark_Green
|
||||
#$1F, Light_Blue, #$09, Blue, #$04, Dark_Blue
|
||||
#$F0, Light_Orange, #$E6, Orange, #$92, Dark_Orange
|
||||
#$CC, Light_Purple, #$88, Purple, #$44, Dark_Purple
|
||||
#$3C, Light_Teal, #$28, Teal, #$14, Dark_Teal
|
||||
#$FF, White, #$00, Black
|
||||
}
|
||||
con '***************************************************** Diverse Texte in den E-Ram laden **************************************************************************************
|
||||
|
||||
PRI fileload(adr)|cont
|
||||
|
||||
cont:=ios.sdfattrib(0)
|
||||
ios.sdxgetblk(adr,cont)
|
||||
ios.sdclose
|
||||
|
||||
PRI fileload_err(adr)| cont,c,b,a,i
|
||||
i:=adr
|
||||
|
||||
b:=0
|
||||
repeat
|
||||
a:=ios.sdgetc
|
||||
|
||||
if a==$0A
|
||||
b++
|
||||
i:=adr+(25*b)
|
||||
next
|
||||
else
|
||||
ios.ram_wrbyte(a,i++)
|
||||
until ios.sdeof
|
||||
ios.sdclose
|
||||
|
||||
PRI activate_dirmarker(mark) 'USER-Marker setzen
|
||||
|
||||
ios.sddmput(ios#DM_USER,mark) 'usermarker wieder in administra setzen
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
PRI get_dirmarker:dm 'USER-Marker lesen
|
||||
|
||||
ios.sddmset(ios#DM_USER)
|
||||
dm:=ios.sddmget(ios#DM_USER)
|
||||
|
||||
con '********************************* Unterprogramme zur Tile-Verwaltung *********************************************************************************************************
|
||||
PRI LoadTiletoRam(datei,adress) 'tile:=tilenr,dateiname,xtile-zahl,ytilezahl
|
||||
|
||||
ios.sdopen("R",datei)') 'datei öffnen
|
||||
ios.sdxgetblk(adress,11264) 'datei in den Speicher schreiben (der blockbefehl ist viel schneller als der char-Befehl)
|
||||
ios.sdclose
|
||||
|
||||
PRI loadtile(adress) 'tileset aus eram in bella laden
|
||||
|
||||
'anzahl:=2816 'anzahl longs '(16*11*16longs)
|
||||
ios.loadtilebuffer(adress,2816) 'laden 'Systemfont-Bereich (Basic verwendet den gleichen Bereich)
|
||||
|
||||
|
||||
PRI iniload:err|i,tmp
|
||||
|
||||
|
||||
|
||||
if ios.sdopen("R",@ini)
|
||||
err:=1
|
||||
else
|
||||
err:=0
|
||||
i:=SETTING_RAM
|
||||
'---- SYSTEM-SETTINGS IN DEN RAM LADEN -------------
|
||||
repeat 18
|
||||
ios.ram_wrbyte(ios.sdgetc,i++)
|
||||
tmp:=i
|
||||
'---- DESKTOP-VERKNÜPFUNGEN IN DEN RAM LADEN -------
|
||||
i:=LINK_RAM
|
||||
repeat 51
|
||||
ios.ram_wrbyte(ios.sdgetc,i++)
|
||||
'---- USER-MAUSZEIGER IN DEN RAM LADEN -------------
|
||||
i:=MOUSE_RAM
|
||||
repeat 64
|
||||
ios.ram_wrbyte(ios.sdgetc,i++)
|
||||
ios.Mousepointer(MOUSE_RAM) 'MAUSZEIGER ANWENDEN
|
||||
ios.displaymouse(0,0)
|
||||
'---- LINK-PARAMETER IN DEN RAM LADEN --------------
|
||||
i:=PARA_RAM
|
||||
repeat 192
|
||||
ios.ram_wrbyte(ios.sdgetc,i++)
|
||||
'---- DCF-Empfänger benutzen -----------------------
|
||||
ios.ram_wrbyte(ios.sdgetc,tmp++)
|
||||
'---- HC05-Bluetooth-Modul -------------------------
|
||||
ios.ram_wrbyte(ios.sdgetc,tmp++)
|
||||
|
||||
ios.sdclose
|
||||
|
||||
|
||||
|
||||
DAT 'lizenz
|
||||
{{
|
||||
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ 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. │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
}}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,252 @@
|
|||
{{
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Autor: Ingo Kripahle Anpassungen:Reinhard Zielinski │
|
||||
│ Copyright (c) 2013 Ingo Kripahle │
|
||||
│ See end of file for terms of use. │
|
||||
│ Die Nutzungsbedingungen befinden sich am Ende der Datei │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Informationen : hive-project.de
|
||||
Kontakt : zille9@googlemail.com
|
||||
System : Hive
|
||||
Name : Bus-Erweiterung für Hive-Computer
|
||||
Chip : Venatrix-Bus-Protokoll
|
||||
Typ : EEProm-Urfile
|
||||
Version : 00
|
||||
Subversion : 01
|
||||
Funktion : Bus-System für Erweiterungsmodule
|
||||
|
||||
Der integrierte Loader kann Venatrix mit einem beliebigen Code versorgen
|
||||
|
||||
|
||||
COG's : MANAGMENT 1 COG
|
||||
-------------------
|
||||
1 COG
|
||||
|
||||
}}
|
||||
CON
|
||||
_CLKMODE = XTAL1 + PLL16X
|
||||
_XINFREQ = 5_000_000
|
||||
|
||||
' /cs --------+
|
||||
' clk -------+|
|
||||
' /wr ------+||
|
||||
' /hs -----+||| +------------------------- /cs ->bei Venatrix P24 statt P23
|
||||
' |||| | -------- d0..d7
|
||||
DB_IN = %00001000_00000000_00000000_00000000 'maske: dbus-eingabe
|
||||
DB_OUT = %00001000_00000000_00000000_11111111 'maske: dbus-ausgabe
|
||||
|
||||
M1 = %00000010_00000000_00000000_00000000 'busclk=1? & /cs=0?
|
||||
M2 = %00000011_00000000_00000000_00000000 'maske: busclk & /cs (/prop4)
|
||||
|
||||
M3 = %00000000_00000000_00000000_00000000 'busclk=0?
|
||||
M4 = %00000010_00000000_00000000_00000000 'maske busclk
|
||||
|
||||
|
||||
#24, BUS_CS 'Chip-Select
|
||||
BUSCLK 'bustakt
|
||||
BUS_WR '/wr - schreibsignal
|
||||
BUS_HS ' '/hs - quittungssignal
|
||||
|
||||
STRCOUNT =64 'Größe des Stringpuffers
|
||||
|
||||
Var
|
||||
byte proghdr[16] 'puffer für objektkopf
|
||||
long plen 'länge datenblock loader
|
||||
byte strpuffer[STRCOUNT] 'stringpuffer
|
||||
|
||||
PUB bus_init 'bus: initialisiert bussystem
|
||||
{{bus_init - bus: initialisierung aller bussignale }}
|
||||
|
||||
dira:= db_in ' datenbus auf eingabe schalten
|
||||
outa[bus_hs] := 1 ' handshake inaktiv ,frida
|
||||
'outa[23..8] := 0 ' Port 2 und 3 Null setzen
|
||||
|
||||
PUB bus_putchar(zeichen) 'chip: ein byte über bus ausgeben
|
||||
''funktionsgruppe : chip
|
||||
''funktion : senderoutine für ein byte zu regnatix über den systembus
|
||||
''eingabe : byte zeichen
|
||||
''ausgabe : -
|
||||
|
||||
waitpeq(M1,M2,0) 'busclk=1? & /prop1=0?
|
||||
dira := db_out 'datenbus auf ausgabe stellen
|
||||
outa[7..0] := zeichen 'daten ausgeben
|
||||
outa[bus_hs] := 0 'daten gültig
|
||||
waitpeq(M3,M4,0) 'busclk=0?
|
||||
dira := db_in
|
||||
outa[bus_hs] := 1 'daten ungültig
|
||||
|
||||
PUB bus_getchar : zeichen 'chip: ein byte über bus empfangen
|
||||
''funktionsgruppe : chip
|
||||
''funktion : emfangsroutine für ein byte von regnatix über den systembus
|
||||
''eingabe : -
|
||||
''ausgabe : byte zeichen
|
||||
waitpeq(M1,M2,0) 'busclk=1? & prop4=0?
|
||||
zeichen := ina[7..0] 'daten einlesen
|
||||
outa[bus_hs] := 0 'daten quittieren
|
||||
waitpeq(M3,M4,0) 'busclk=0?
|
||||
outa[bus_hs] := 1
|
||||
|
||||
PUB bus_putstr(stradr) | len,i 'bus: string zu administra senden
|
||||
|
||||
len := strsize(stradr)
|
||||
bus_putchar(len)
|
||||
repeat i from 0 to len - 1
|
||||
bus_putchar(byte[stradr++])
|
||||
|
||||
PUB bus_getstr: stradr | len,i 'bus: string von administra empfangen
|
||||
|
||||
len := bus_getchar 'längenbyte empfangen
|
||||
repeat i from 0 to len - 1 '20 zeichen dateinamen empfangen
|
||||
strpuffer[i] := bus_getchar
|
||||
strpuffer[i] := 0
|
||||
return @strpuffer
|
||||
|
||||
PUB bus_getword: wert 'bus: 16 bit von bellatrix empfangen hsb/lsb
|
||||
|
||||
wert := bus_getchar << 8
|
||||
wert := wert + bus_getchar
|
||||
|
||||
PUB bus_putword(wert) 'bus: 16 bit an bellatrix senden hsb/lsb
|
||||
|
||||
bus_putchar(wert >> 8)
|
||||
bus_putchar(wert)
|
||||
|
||||
PUB bus_getlong: wert 'bus: long von bellatrix empfangen hsb/lsb
|
||||
|
||||
wert := bus_getchar << 24 '32 bit empfangen hsb/lsb
|
||||
wert := wert + bus_getchar << 16
|
||||
wert := wert + bus_getchar << 8
|
||||
wert := wert + bus_getchar
|
||||
|
||||
PUB bus_putlong(wert) 'bus: long an bellatrix senden hsb/lsb
|
||||
|
||||
bus_putchar(wert >> 24) '32bit wert senden hsb/lsb
|
||||
bus_putchar(wert >> 16)
|
||||
bus_putchar(wert >> 8)
|
||||
bus_putchar(wert)
|
||||
|
||||
con'------------------------------------------------ Chiploader -------------------------------------------------------------------------------------------------------------------
|
||||
PUB mgr_getcogs: cogs |i,c,cog[8] 'cmgr: abfragen wie viele cogs in benutzung sind
|
||||
''funktionsgruppe : cmgr
|
||||
''funktion : abfrage wie viele cogs in benutzung sind
|
||||
''eingabe : -
|
||||
''ausgabe : cogs - anzahl der cogs
|
||||
''busprotokoll : [097][put.cogs]
|
||||
'' : cogs - anzahl der belegten cogs
|
||||
|
||||
cogs := i := 0
|
||||
repeat 'loads as many cogs as possible and stores their cog numbers
|
||||
c := cog[i] := cognew(@entry, 0)
|
||||
if c=>0
|
||||
i++
|
||||
while c => 0
|
||||
cogs := i
|
||||
repeat 'unloads the cogs and updates the string
|
||||
i--
|
||||
if i=>0
|
||||
cogstop(cog[i])
|
||||
while i=>0
|
||||
|
||||
|
||||
PUB mgr_load|i 'cmgr: venatrix-loader
|
||||
''funktionsgruppe : cmgr
|
||||
''funktion : funktion um einen neuen code in bellatrix zu laden
|
||||
''
|
||||
|
||||
' kopf der bin-datei einlesen ------------------------------------------------------
|
||||
repeat i from 0 to 15 '16 bytes --> proghdr
|
||||
byte[@proghdr][i] := bus_getchar
|
||||
|
||||
plen := 0
|
||||
plen := byte[@proghdr + $0B] << 8
|
||||
plen := plen + byte[@proghdr + $0A]
|
||||
plen := plen - 8
|
||||
|
||||
' objektlänge an regnatix senden
|
||||
bus_putchar(plen >> 8) 'hsb senden
|
||||
bus_putchar(plen & $FF) 'lsb senden
|
||||
|
||||
repeat i from 0 to 7 'alle anderen cogs anhalten
|
||||
ifnot i == cogid
|
||||
cogstop(i)
|
||||
|
||||
dira := 0 'diese cog vom bus trennen
|
||||
cognew(@loader, plen)
|
||||
|
||||
cogstop(cogid) 'cog 0 anhalten
|
||||
|
||||
DAT
|
||||
org 0
|
||||
|
||||
loader
|
||||
mov outa, M_0 'bus inaktiv
|
||||
mov dira, DINP 'bus auf eingabe schalten
|
||||
mov reg_a, PAR 'parameter = plen
|
||||
mov reg_b, #0 'adresse ab 0
|
||||
|
||||
' datenblock empfangen
|
||||
loop
|
||||
call #get 'wert einlesen
|
||||
wrbyte in, reg_b 'wert --> hubram
|
||||
add reg_b, #1 'adresse + 1
|
||||
djnz reg_a, #loop
|
||||
|
||||
' neuen code starten
|
||||
|
||||
rdword reg_a, #$A ' Setup the stack markers.
|
||||
sub reg_a, #4 '
|
||||
wrlong SMARK, reg_a '
|
||||
sub reg_a, #4 '
|
||||
wrlong SMARK, reg_a '
|
||||
|
||||
rdbyte reg_a, #$4 ' Switch to new clock mode.
|
||||
clkset reg_a '
|
||||
|
||||
coginit SINT ' Restart running new code.
|
||||
|
||||
|
||||
cogid reg_a
|
||||
cogstop reg_a 'cog hält sich selbst an
|
||||
|
||||
|
||||
get
|
||||
waitpeq M_1, M_2 'busclk=1? & /cs=0?
|
||||
mov in, ina 'daten einlesen
|
||||
and in, DMASK 'wert maskieren
|
||||
mov outa, M_3 'hs=0
|
||||
waitpeq M_3, M_4 'busclk=0?
|
||||
mov outa, M_0 'hs=1
|
||||
get_ret ret
|
||||
|
||||
|
||||
' /cs --------+
|
||||
' clk -------+|
|
||||
' /wr ------+||
|
||||
' /hs -----+|||+------------------------- /cs ->geändert auf 24
|
||||
' ||||| -------- d0..d7
|
||||
DINP long %00001000000000000000000000000000 'constant dinp hex \ bus input
|
||||
DOUT long %00001000000000000000000011111111 'constant dout hex \ bus output
|
||||
|
||||
M_0 long %00001000000000000000000000000000 'bus inaktiv
|
||||
|
||||
M_1 long %00000010000000000000000000000000
|
||||
M_2 long %00000011000000000000000000000000 'busclk=1? & /cs=0?
|
||||
|
||||
M_3 long %00000000000000000000000000000000
|
||||
M_4 long %00000010000000000000000000000000 'busclk=0?
|
||||
|
||||
|
||||
DMASK long %00000000000000000000000011111111 'datenmaske
|
||||
|
||||
SINT long ($0001 << 18) | ($3C01 << 4) ' Spin interpreter boot information.
|
||||
SMARK long $FFF9FFFF ' Stack mark used for spin code.
|
||||
|
||||
in res 1
|
||||
reg_a res 1
|
||||
reg_b res 1
|
||||
Dat
|
||||
|
||||
' Entry: dummy-assemblercode fuer cogtest
|
||||
'
|
||||
entry jmp entry 'just loops
|
|
@ -0,0 +1,539 @@
|
|||
{{
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Autor: Reinhard Zielinski │
|
||||
│ Copyright (c) 2013 Reinhard Zielinski │
|
||||
│ See end of file for terms of use. │
|
||||
│ Die Nutzungsbedingungen befinden sich am Ende der Datei │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Informationen : hive-project.de
|
||||
Kontakt : zille09@gmail.com
|
||||
System : TriOS
|
||||
Name : Venatrix-Testprogramm - Test der Funktionen der Venatrix-Bus-Erweiterung
|
||||
Chip : Regnatix
|
||||
Typ : Plexus-Erweiterungsdatei
|
||||
Version : 01
|
||||
Subversion : 00
|
||||
|
||||
|
||||
Logbuch :
|
||||
'############################################### Version 1.0 ######################################################################################################################
|
||||
|
||||
24-11-2013 :-Erstellung der Optik des Testfensters
|
||||
-Grundgerüst stammt vom Sepia-Test-Programm
|
||||
-Sepia-Programmteile entfernt
|
||||
-noch hab ich keine Ahnung, was ich überhaupt testen will ???
|
||||
-6538 Longs frei
|
||||
|
||||
30-01-2014 -Anpassung an die neue reg.ios (Window-Funktionen)
|
||||
-6624 Longs frei
|
||||
|
||||
16-03-2014 -DCF-Indikator in Titelzeile eingebaut
|
||||
}}
|
||||
|
||||
obj
|
||||
ios: "reg-ios-64"
|
||||
|
||||
con
|
||||
_CLKMODE = XTAL1 + PLL16X
|
||||
_XINFREQ = 5_000_000
|
||||
|
||||
'------------- Shell-Farben -----------------------------------------------------
|
||||
shellhcol =0 'Hauptfensterfarbe
|
||||
act_color =1 'Schriftfarbe
|
||||
winhcol =2 'Fensterhintergrundfarbe
|
||||
winframecol =3 'Fensterrandfarbe
|
||||
Titelhcol =4 'Titelleistenfarbe
|
||||
titeltextcol =5 'Titelleistentextfarbe
|
||||
hcolstatus =6 'statusleiste hintergrundfarbe
|
||||
statustextcol =7 'Statustextfarbe
|
||||
buttonhcol =8 'Buttonhintergrundfarbe
|
||||
buttontextcol =9 'Buttontextfarbe
|
||||
messagehcol =10 'Messagebox-Hintergrundfarbe
|
||||
messagetextcol =11 'Messagebox-Textfarbe
|
||||
selectcol =12 'selektionsfarbe
|
||||
mousecol =13 'Mauszeigerfarbe
|
||||
panelcol =14 'Farbe des Utility-Panels
|
||||
|
||||
ADM_SPEC = %00000000_00000000_00000000_01010011
|
||||
SETTING_RAM = $7FF00 'Hier stehen die System-Settings
|
||||
BRAM = $50000 'Overlay-Puffer
|
||||
Hour_Glass = $66800+(167*16*4) 'Sanduhr
|
||||
'******************Farben ********************************************************
|
||||
#$FC, Light_Grey, #$A8, Grey, #$54, Dark_Grey
|
||||
#$C0, Light_Red, #$80, Red, #$40, Dark_Red
|
||||
#$30, Light_Green, #$20, Green, #$10, Dark_Green
|
||||
#$1F, Light_Blue, #$09, Blue, #$04, Dark_Blue
|
||||
#$F0, Light_Orange, #$E6, Orange, #$92, Dark_Orange
|
||||
#$CC, Light_Purple, #$88, Purple, #$44, Dark_Purple
|
||||
#$3C, Light_Teal, #$28, Teal, #$14, Dark_Teal
|
||||
#$FF, White, #$00, Black
|
||||
'----Icon-Nummern----------------------------------------------------------------
|
||||
BEL_PIC =14
|
||||
ADM_PIC =15
|
||||
BIN_PIC =9
|
||||
BAS_PIC =107
|
||||
DIR_PIC =7
|
||||
ALL_PIC =8
|
||||
DMP_PIC =120
|
||||
TXT_PIC =121
|
||||
SYS_PIC =122
|
||||
COG_PIC =75
|
||||
BACK_PIC =124
|
||||
VOR_PIC =123
|
||||
PLAY_PIC =125
|
||||
STOP_PIC =141
|
||||
CLR_PIC =155
|
||||
EXT_PIC =156
|
||||
|
||||
'------------- F-Tasten für Zusatzfunktionen -------------------------------------
|
||||
F1_Key = 208
|
||||
F2_Key = 209
|
||||
F3_Key = 210
|
||||
F4_Key = 211
|
||||
F5_Key = 212
|
||||
F6_Key = 213
|
||||
F7_Key = 214
|
||||
F8_Key = 215
|
||||
F9_Key = 216
|
||||
F10_Key = 217
|
||||
F11_Key = 218
|
||||
F12_Key = 219
|
||||
ESC_KEY = 27
|
||||
RETURN_KEY = 13
|
||||
'--------------------------------------------------------------------------------
|
||||
|
||||
var
|
||||
|
||||
byte mountmarker,tmptime
|
||||
long rootdir 'root-Dirmarker
|
||||
long userdir 'user-Dirmarker
|
||||
byte colors[15] 'Farbwerte
|
||||
byte ma,mb 'Maus-Tasten
|
||||
|
||||
byte windowx[3]
|
||||
byte windowy[3]
|
||||
byte windowxx[3]
|
||||
byte windowyy[3]
|
||||
byte menuey[10] 'y-Koordinate für Start-Menue-Einträge
|
||||
byte popupx,popupxx 'x und
|
||||
byte popupy,popupyy 'y-Koordinaten des Popupmenues
|
||||
byte popupmarker 'Marker für Popupmenue
|
||||
byte PORT_IO[7] 'In-Out-Richtungsmarker in=0 out=1
|
||||
byte PORT_BIT[8] 'BIT-Wert-Marker
|
||||
byte port_bit_old[8] 'temp-puffer
|
||||
byte bitmuster[9] 'bit-muster puffer
|
||||
byte bitfarbe[9]
|
||||
byte bit_muster4[9],bit_muster5[9],bit_muster6[9] 'Ausgabe-Bitmuster der Digital-Ports
|
||||
byte ADDA_ADR,PORT_ADR
|
||||
byte infomarker
|
||||
byte buttonx[5],buttony[5]
|
||||
byte util
|
||||
long systemdir 'Plexus-System-Verzeichnis
|
||||
byte timezaehler
|
||||
'----------- DCF-Indikator ------------------------------------
|
||||
byte dcf_on
|
||||
|
||||
dat
|
||||
regsys byte "plexus.dll",0 'Reg.sys für Rückkehr aus externem Programm
|
||||
butOK byte " OK ",0
|
||||
Abbr byte "Cancel",0
|
||||
SYSTEM Byte "PLEXUS ",0 'Plexus-Systemverzeichnis
|
||||
|
||||
PUB main
|
||||
|
||||
ios.start
|
||||
cmd_mount 'sd-card mounten
|
||||
mountmarker:=1 'mount-marker
|
||||
'--------------------------------------------------------------------------------------
|
||||
activate_dirmarker(0) 'ins root
|
||||
ios.sdchdir(@system) 'System-Verzeichnis lesen
|
||||
systemdir:=get_dirmarker 'Dir-Marker lesen
|
||||
|
||||
'--------------------------------------------------------------------------------------
|
||||
cmd_unmount
|
||||
iniload 'Ini-Datei mit Farbwerten laden
|
||||
|
||||
testfenster
|
||||
util:=0
|
||||
repeat
|
||||
|
||||
os_cmdinput 'Hauptprogrammschleife
|
||||
|
||||
PRI os_cmdinput | x,y ,i,dk,a,b,c,port,key,padr,durchlauf
|
||||
|
||||
repeat
|
||||
time 'Zeit und Datum anzeigen
|
||||
|
||||
ma:=ios.mouse_button(0) 'linke Maustaste
|
||||
mb:=ios.mouse_button(1) 'rechte Maustaste
|
||||
key:=ios.key
|
||||
if key
|
||||
' ifnot key=="d" or key=="a"
|
||||
popup_info_weg
|
||||
util:=0
|
||||
'**************************** Short-Cuts ****************************************************************************
|
||||
case key
|
||||
F1_Key:Display_Help
|
||||
F2_Key:Adress_Scanner
|
||||
F12_Key:ausstieg
|
||||
ESC_KEY:popup_info_weg
|
||||
RETURN_KEY:popup_info_weg
|
||||
|
||||
'***************************** linke Maustaste **********************************************************************
|
||||
if ma==255
|
||||
dk:=0
|
||||
x:=ios.mousex
|
||||
y:=ios.mousey
|
||||
|
||||
|
||||
'****************************** Startmenue anzeigen ************************************************************
|
||||
if popupmarker==1
|
||||
if x>10 or y<24 'Menue loeschen, wenn man woanders hinklickt
|
||||
popup_info_weg
|
||||
util:=0
|
||||
if x=>0 and x=<10 and y=>24 and y=<28
|
||||
repeat i from 0 to 5
|
||||
if menuey[i]==y
|
||||
case i
|
||||
0:menueselect(string("Scan - F2"),menuey[i])
|
||||
Adress_Scanner
|
||||
1:menueselect(string("Help - F1"),menuey[i])
|
||||
Display_Help
|
||||
2:menueselect(string("-EXIT- F12"),menuey[i])
|
||||
ausstieg
|
||||
|
||||
|
||||
|
||||
'****************************** Globale Funktionstasten ********************************************************
|
||||
if(x=>buttonx[4]) and (x=<buttonx[4]+5) and (y==buttony[4]) and Infomarker==1 'ok im Infofenster
|
||||
buttonpress(4)
|
||||
popup_info_weg
|
||||
if util==1
|
||||
util:=0
|
||||
|
||||
if y==windowy[2] and x==windowx[2] and Infomarker==1 'doppelklick in linke obere ecke des Info-Fensters
|
||||
if doppelklick>1
|
||||
popup_info_weg
|
||||
util:=0
|
||||
|
||||
if y==windowy[2] and x==windowxx[2] and Infomarker==1
|
||||
ios.get_window
|
||||
popup_info_weg
|
||||
util:=0
|
||||
|
||||
if y==0
|
||||
if (x==39) 'Beenden-Knopf
|
||||
ios.displaytile(1,250,0,0,0,39) 'Schliessen-Symbol
|
||||
Mouse_Release 'warten bis Maustaste losgelassen wird
|
||||
ios.displaytile(1,colors[winhcol],0,colors[winframecol],0,39) 'Schliessen-Symbol
|
||||
ausstieg
|
||||
|
||||
if (x==0) 'Beenden bei Doppelklick auf linke obere Ecke
|
||||
if doppelklick>1
|
||||
ausstieg
|
||||
if x>1 and x<20 'Doppelklick in die Titelleiste
|
||||
if doppelklick>1
|
||||
popup_info_weg
|
||||
util:=0
|
||||
Display_Info
|
||||
|
||||
if ((x=>0) and (x=<5)) and (y==29) 'Start-Knopf
|
||||
buttonpress(1)
|
||||
if popupmarker==1
|
||||
popup_info_weg
|
||||
util:=0
|
||||
|
||||
else
|
||||
if infomarker==1
|
||||
popup_info_weg
|
||||
util:=0
|
||||
startmenue
|
||||
popupmarker:=1
|
||||
|
||||
PRI Display_Help
|
||||
infofenster(5,10,34,17,string("Help"),1) 'Info-Fenster anzeigen
|
||||
Print_win(string("This Program"),5,10)
|
||||
Print_win(string("is under Construction!"),5,11)
|
||||
'Print_win(string("Press and hold -a- for AD-Port"),5,12)
|
||||
'Print_win(string("or -d- for Digital-Port and"),5,13)
|
||||
'Print_win(string("click on the Adress do you"),5,14)
|
||||
'Print_win(string("want!"),5,15)
|
||||
|
||||
PRI Display_Info
|
||||
infofenster(9,10,31,15,string("Program-Info"),1) 'Info-Fenster anzeigen
|
||||
Print_win(string("Venatrix-Test for Hive"),9,10)
|
||||
Print_win(string("Version 1.1 - 01/2014"),9,11)
|
||||
Print_win(string("Autor:R.Zielinski"),9,12)
|
||||
Print_win(string("Hive-Project.de"),9,13)
|
||||
|
||||
PRI Adress_Scanner|a,ack,z,vx
|
||||
infofenster(9,10,29,20,string("Adress-Scanner"),1) 'Info-Fenster anzeigen
|
||||
util:=1
|
||||
|
||||
PRI infofenster(x,y,xx,yy,strg,knopf)'|i
|
||||
|
||||
ios.backup_area(x-1,y-2,xx+1,yy+1,BRAM) 'Hintergrund sichern
|
||||
window(2,4,y,x,yy,xx,strg) 'Fenster erstellen
|
||||
if knopf==1
|
||||
button(4,@butOK,((xx-x)/2)+x-2,yy) 'Button 4 gibt es nur im SD-Card-Info-Fenster
|
||||
if knopf==2
|
||||
button(2,@Abbr,((xx-x)/2)+x-2,yy)
|
||||
infomarker:=1
|
||||
|
||||
PRI button(n,btext,x,y)
|
||||
buttonx[n]:=x
|
||||
buttony[n]:=y
|
||||
printfont(btext,colors[buttonhcol],0,colors[buttontextcol],x,y)
|
||||
|
||||
PRI Mouse_Release
|
||||
repeat while ios.mouse_button(0) 'warten bis Maustaste losgelassen wird
|
||||
|
||||
pri ausstieg
|
||||
'ios.display3DBox(255, colors[winhcol], 0, 12, 8, 14, 28)
|
||||
'Print_win(string("Return to Plexus..."),9,13)
|
||||
ios.mousepointer(hour_glass)
|
||||
cmd_mount
|
||||
activate_dirmarker(systemdir)
|
||||
ios.sdopen("r",@regsys)
|
||||
ios.ldbin(@regsys)
|
||||
|
||||
|
||||
pri testfenster|i,y,a
|
||||
|
||||
a:=0
|
||||
window(0,4,2,1,27,38,string("BUS-Expansion-Test"))
|
||||
rahmen (1,6,38,27)
|
||||
rahmen (1,1,38,3)
|
||||
rahmen (1,4,38,6)
|
||||
ios.displaytile(133,colors[winhcol],colors[winhcol],colors[act_color],6,1) 'Rahmen-Verbindungsstücke
|
||||
ios.displaytile(117,colors[winhcol],colors[winhcol],colors[act_color],6,38)
|
||||
Print_win(string("Venatrix-Test for Hive-Computer V1.2"),2,2)
|
||||
|
||||
PRI Print_win(str,x,y)
|
||||
printfont(str,colors[winhcol],0,colors[act_color],x,y)
|
||||
|
||||
PRI printhex(value, digits,x,y,back,vor)|wert 'screen: hexadezimalen zahlenwert auf bildschirm ausgeben
|
||||
{{hex(value,digits) - screen: hexadezimale bildschirmausgabe eines zahlenwertes}}
|
||||
value <<= (8 - digits) << 2
|
||||
repeat digits
|
||||
wert:=lookupz((value <-= 4) & $F : "0".."9", "A".."F")
|
||||
ios.displaytile(wert-16,back,0,vor,y,x++)
|
||||
|
||||
con'****************************************************** Datum und Zeitanzeige *************************************************************************************************
|
||||
|
||||
PRI time|s 'Zeitanzeige in der Statusleiste
|
||||
timezaehler++
|
||||
if timezaehler>150
|
||||
timezaehler:=0
|
||||
s:=ios.getminutes
|
||||
Status_extern(ios.dcf_sync,dcf_on,170,27,0,colors[titeltextcol],black) 'Anzeige des aktuellen Status in der Titelzeile
|
||||
if s<>tmptime
|
||||
displaytime
|
||||
|
||||
PRI displaytime|h,m
|
||||
|
||||
h:=ios.gethours
|
||||
m:=ios.getminutes
|
||||
|
||||
print_zehner(h,29,34,colors[hcolstatus],colors[statustextcol])
|
||||
ios.displaytile(42,colors[hcolstatus],0,colors[statustextcol],29,36)
|
||||
|
||||
print_zehner(m,29,37,colors[hcolstatus],colors[statustextcol])
|
||||
tmptime:=m
|
||||
date
|
||||
|
||||
PRI date
|
||||
|
||||
print_zehner(ios.getdate,0,29,colors[titelhcol],colors[titeltextcol])
|
||||
ios.displaytile(30,colors[titelhcol],0,colors[titeltextcol],0,31)
|
||||
|
||||
print_zehner(ios.getmonth,0,32,colors[titelhcol],colors[titeltextcol])
|
||||
ios.displaytile(30,colors[titelhcol],0,colors[titeltextcol],0,34)
|
||||
printdec(ios.getyear,0,35,colors[titelhcol],colors[titeltextcol])
|
||||
|
||||
pri print_zehner(wert,y,x,hin,vor)|a
|
||||
a:=0
|
||||
if wert<10
|
||||
printdec(0,y,x,hin,vor)
|
||||
a:=1
|
||||
printdec(wert,y,x+a,hin,vor)
|
||||
|
||||
pri Status_extern(wert1,wert2,tnr_act,x,y,col,f3)
|
||||
|
||||
if wert1==1
|
||||
ios.displaytile(tnr_act,colors[Titelhcol],col,f3,y,x) 'Status ok-anzeigen
|
||||
else
|
||||
if wert2 'Externe Komponente in Settingmenue ausgewählt?
|
||||
ios.displaytile(tnr_act,colors[titelhcol],grey,0,y,x) 'Symbol grau
|
||||
else
|
||||
ios.displaytile(16,colors[Titelhcol],colors[titeltextcol],0,y,x) 'Ohne externe Komponente arbeiten (kein Symbol)
|
||||
'printdec(dcf_on,1,1,colors[winhcol],colors[act_color])
|
||||
con'
|
||||
PRI doppelklick:click 'pseudo-doppelklick
|
||||
click:=0
|
||||
ios.get_window
|
||||
'Mouse_Release
|
||||
|
||||
repeat 800
|
||||
if ios.mouse_button(0)==255
|
||||
click++
|
||||
|
||||
con'
|
||||
PRI iniload|i,a
|
||||
a:=SETTING_RAM
|
||||
repeat i from 0 to 14
|
||||
colors[i]:=ios.ram_rdbyte(a++)
|
||||
dcf_on:=ios.ram_rdbyte(a+3)
|
||||
|
||||
PRI activate_dirmarker(mark) 'USER-Marker setzen
|
||||
|
||||
ios.sddmput(ios#DM_USER,mark) 'usermarker wieder in administra setzen
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
PRI get_dirmarker:dm 'USER-Marker lesen
|
||||
|
||||
ios.sddmset(ios#DM_USER)
|
||||
dm:=ios.sddmget(ios#DM_USER)
|
||||
PRI cmd_mount :err 'cmd: mount
|
||||
|
||||
repeat 16
|
||||
err:=ios.sdmount
|
||||
ifnot err
|
||||
mountmarker:=1
|
||||
quit
|
||||
else
|
||||
' display_error(err)
|
||||
quit
|
||||
|
||||
PRI cmd_unmount|err 'cmd: unmount
|
||||
err:=ios.sdunmount
|
||||
ifnot err
|
||||
mountmarker:=0
|
||||
else
|
||||
'display_error(err)
|
||||
|
||||
PRI window(num,cntrl,y,x,yy,xx,strg)|i 'ein Fenster erstellen
|
||||
|
||||
windowx[num]:=x-1
|
||||
windowy[num]:=y-2
|
||||
windowxx[num]:=xx+1
|
||||
windowyy[num]:=yy+1
|
||||
|
||||
ios.window(num,0,colors[winhcol],0,colors[winframecol],colors[titelhcol],colors[titeltextcol],colors[hcolstatus],colors[statustextcol],y-2,x-1,yy+1,xx+1,cntrl,0)
|
||||
ios.printcursorrate(0)
|
||||
ios.printchar(12) 'cls
|
||||
printfont(strg,colors[titelhcol],0,colors[titeltextcol],x,y-2)
|
||||
|
||||
PRI printfont(str1,a,b,c,d,e)|f
|
||||
|
||||
repeat strsize(str1)
|
||||
f:= byte[str1++]
|
||||
f-=16 'anderer Zeichensatz, Zeichen um -16 Positionen versetzt
|
||||
if d>39 'wenn Bildschirmrand erreicht, neue Zeile
|
||||
d:=0
|
||||
e++
|
||||
ios.displayTile(f,a,b,c,e,d) 'einzelnes Tile anzeigen ('displayTile(tnr,pcol,scol,tcol, row, column))
|
||||
|
||||
d++
|
||||
PRI printdec(value,y,xx,hint,vor) | i ,c ,x 'screen: dezimalen zahlenwert auf bildschirm ausgeben
|
||||
{{printdec(value) - screen: dezimale bildschirmausgabe zahlenwertes}}
|
||||
' if value < 0 'negativer zahlenwert
|
||||
' -value
|
||||
'printchar("-")
|
||||
|
||||
i := 1_000_000_000
|
||||
repeat 10 'zahl zerlegen
|
||||
if value => i
|
||||
x:=value / i + "0"
|
||||
ios.displayTile(x-16,hint,0,vor,y,xx) 'printchar(x)
|
||||
xx++
|
||||
c:=value / i + "0"
|
||||
value //= i
|
||||
result~~
|
||||
elseif result or i == 1
|
||||
printfont(string("0"),hint,0,vor,xx,y) 'printchar("0")
|
||||
xx++
|
||||
i /= 10 'nächste stelle
|
||||
con '************************************************** Button-Funktionen ********************************************************************************************************
|
||||
|
||||
PRI buttonpress(n)
|
||||
case n
|
||||
1:printfont(string("Start"),250,0,0,0,29)
|
||||
4:printfont(@butOK,250,0,0,buttonx[n],buttony[n])
|
||||
|
||||
Mouse_Release
|
||||
case n
|
||||
1:printfont(string("Start"),colors[hcolstatus],0,colors[statustextcol],0,29)
|
||||
4:printfont(@butOK,colors[Buttonhcol],0,colors[buttontextcol],buttonx[n],buttony[n])
|
||||
|
||||
|
||||
con '*************************************************** Start-Menue *************************************************************************************************************
|
||||
PRI Menue(x,y,xx,yy)|i
|
||||
popup(x,y,xx,yy)
|
||||
repeat i from x to xx
|
||||
ios.displaytile(16,colors[Titelhcol],$ff,$ff,y-1,i)
|
||||
|
||||
PRI separator(x,y,xx)|i
|
||||
repeat i from x to xx
|
||||
ios.displaytile(6,colors[Messagehcol],0,colors[winframecol],y,i)
|
||||
|
||||
PRI menueselect(stri,y)
|
||||
printfont(stri,colors[messagetextcol],0,colors[messagehcol],0,y)
|
||||
Mouse_Release
|
||||
printfont(stri,colors[messagehcol],0,colors[messagetextcol],0,y)
|
||||
popup_info_weg
|
||||
|
||||
PRI Startmenue
|
||||
menue(0,24,9,28)
|
||||
printfont(string("Startmenue"),colors[titelhcol],0,colors[titeltextcol],0,23)
|
||||
|
||||
printfont(string("Scan - F2"),colors[messagehcol],0,colors[messagetextcol],0,24)
|
||||
menuey[0]:=24
|
||||
printfont(string("Help - F1"),colors[messagehcol],0,colors[messagetextcol],0,25)
|
||||
menuey[1]:=25
|
||||
separator(0,26,9)
|
||||
|
||||
printfont(string("-EXIT- F12"),colors[messagehcol],0,colors[messagetextcol],0,27)
|
||||
menuey[2]:=27
|
||||
con '*************************************************** Popup-Menue *************************************************************************************************************
|
||||
|
||||
PRI popup(x,y,xx,yy)
|
||||
popupx:=x
|
||||
popupy:=y-1
|
||||
popupyy:=yy
|
||||
popupxx:=xx
|
||||
ios.backup_area(popupx,popupy,popupxx,popupyy,BRAM)
|
||||
ios.display2dbox(colors[messagehcol],y,x,yy,xx,0)
|
||||
|
||||
PRI Popup_Info_weg
|
||||
if popupmarker==1 'Popupmenue sichtbar?
|
||||
ios.restore_area(popupx,popupy,popupxx,popupyy,BRAM) 'Hintergrund wiederherstellen
|
||||
popupmarker:=0 'Popupmarker loeschen
|
||||
if infomarker==1
|
||||
ios.restore_area(windowx[2],windowy[2],windowxx[2],windowyy[2],BRAM) 'Hintergrund wiederherstellen
|
||||
infomarker:=0
|
||||
|
||||
PRI rahmen(x,y,xx,yy)|i
|
||||
win_tile(137,y,x)
|
||||
win_tile(136,yy,x)
|
||||
win_tile(157,y,xx)
|
||||
win_tile(119,yy,xx)
|
||||
repeat i from y+1 to yy-1
|
||||
win_tile(2,i,x)
|
||||
win_tile(114,i,xx)
|
||||
line(x+1,y,xx-1)
|
||||
line(x+1,yy,xx-1)
|
||||
|
||||
PRI line(x,y,xx)|i
|
||||
repeat i from x to xx
|
||||
win_tile(130,y,i)
|
||||
|
||||
con '---------------------------------------------- Ausgaberoutinen ---------------------------------------------------------------------------------------------------------------
|
||||
PRI Win_Tile(nu,ty,tx)
|
||||
ios.displaytile(nu,colors[winhcol],0,colors[act_color],ty,tx)
|
||||
|
||||
DAT
|
||||
|
||||
sepia_ini byte "sepia.ini",0
|
||||
|
|
@ -0,0 +1,452 @@
|
|||
{{
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Autor: Reinhard Zielinski -> Original-Code: Ingo Kripahle │
|
||||
│ Copyright (c) 2013 Ingo Kripahle │
|
||||
│ See end of file for terms of use. │
|
||||
│ Die Nutzungsbedingungen befinden sich am Ende der Datei │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Informationen : hive-project.de
|
||||
Kontakt : zille9@googlemail.com
|
||||
System : Hive
|
||||
Name : Bus-Erweiterung für Hive-Computer
|
||||
Chip : Venatrix
|
||||
Typ : Treiber
|
||||
Version : 01
|
||||
Subversion : 00
|
||||
Funktion : Bus-System für Erweiterungsmodule
|
||||
|
||||
Der integrierte Loader kann Venatrix mit einem beliebigen Code versorgen
|
||||
|
||||
20-11-2013 -I2C-Slave Funktion hinzugefügt, damit die Bus-Karte vom Hive (Plexus) erkannt werden kann (Adresse 5)
|
||||
|
||||
22-03-2014 -HC05-Bluetoothmodul-Statuspin-Abfrage an Portpin 16 hinzugefügt
|
||||
-IP-Stack von Joerg angefangen zu integrieren
|
||||
-
|
||||
COG's : MANAGMENT 1 COG
|
||||
I2C-Slave 1 COG
|
||||
IP-Stack 1 COG
|
||||
-------------------
|
||||
3 COG's
|
||||
|
||||
}}
|
||||
CON
|
||||
_CLKMODE = XTAL1 + PLL16X
|
||||
_XINFREQ = 5_000_000
|
||||
Treiberversion= %00010001
|
||||
'Treiberdatum = 20122013
|
||||
|
||||
|
||||
' /cs --------+
|
||||
' clk -------+|
|
||||
' /wr ------+||
|
||||
' /hs -----+||| +------------------------- /cs ->bei Venatrix P24 statt P23
|
||||
' |||| | -------- d0..d7
|
||||
DB_IN = %00001000_00000000_00000000_00000000 'maske: dbus-eingabe
|
||||
DB_OUT = %00001000_00000000_00000000_11111111 'maske: dbus-ausgabe
|
||||
|
||||
M1 = %00000010_00000000_00000000_00000000 'busclk=1? & /cs=0?
|
||||
M2 = %00000011_00000000_00000000_00000000 'maske: busclk & /cs (/prop4)
|
||||
|
||||
M3 = %00000000_00000000_00000000_00000000 'busclk=0?
|
||||
M4 = %00000010_00000000_00000000_00000000 'maske busclk
|
||||
|
||||
|
||||
|
||||
|
||||
#0, D0,D1,D2,D3,D4,D5,D6,D7 'datenbus (Port A)
|
||||
#8, B0,B1,B2,B3,B4,B5,B6,B7 'Port B
|
||||
#16, C0,C1,C2,C3,C4,C5,C6,C7 'Port C
|
||||
#24, BUS_CS 'Chip-Select
|
||||
BUSCLK 'bustakt
|
||||
BUS_WR '/wr - schreibsignal
|
||||
BUS_HS ' '/hs - quittungssignal
|
||||
|
||||
SDA_PIN = 29
|
||||
SCL_PIN = 28
|
||||
'Netzwerk-Puffergrößen (müssen Vielfaches von 2 sein!)
|
||||
rxlen = 2048
|
||||
txlen = 128
|
||||
CON 'Signaldefinitionen --------------------------------------------------------------------------
|
||||
|
||||
'signaldefinitionen administra (todo: nach glob-con.spin auslagern!!!)
|
||||
|
||||
'#20, A_NETCS,A_NETSCK,A_NETSI,A_NETSO 'Pins zum ENC28J60
|
||||
|
||||
CON 'NVRAM Konstanten --------------------------------------------------------------------------
|
||||
|
||||
' todo: nach glob-con.spin auslagern!!!
|
||||
{
|
||||
#4, NVRAM_IPADDR
|
||||
#8, NVRAM_IPMASK
|
||||
#12, NVRAM_IPGW
|
||||
#16, NVRAM_IPDNS
|
||||
#20, NVRAM_IPBOOT
|
||||
#24, NVRAM_HIVE ' 4 Bytes
|
||||
}
|
||||
txpin = 9
|
||||
rxpin = 8
|
||||
Ack = 6
|
||||
Error =15
|
||||
obj
|
||||
bus : "Venatrix-Bus" 'allgemeine Bus-Funktionen
|
||||
i2c_slave: "i2c_slave_Venatrix"
|
||||
' sock : "driver_socket" 'LAN
|
||||
'gc : "glob-con" 'globale konstanten
|
||||
' num : "glob-numbers" 'Number Engine
|
||||
' ser : "FullDuplexSerialExtended"
|
||||
|
||||
Var
|
||||
byte proghdr[16] 'puffer für objektkopf
|
||||
long plen 'länge datenblock loader
|
||||
' byte lan_started 'LAN gestartet?
|
||||
' long sockhandle[sock#sNumSockets] 'Handle für mit sock.connect/sock.listen erstellten Socket
|
||||
' byte bufidx[sock#sNumSockets] 'zum Handle-Index gehörender Puffer-abschnitt
|
||||
'(zum Socket mit dem Handle 2 gehört der Pufferabschnitt aus bufidx[2])
|
||||
' byte bufrx[rxlen*sock#sNumSockets] 'LAN Empfangspuffer
|
||||
' byte buftx[txlen*sock#sNumSockets] 'LAN Sendepuffer
|
||||
|
||||
PUB main | zeichen,i 'chip: kommandointerpreter
|
||||
''funktionsgruppe : chip
|
||||
''funktion : kommandointerpreter
|
||||
''eingabe : -
|
||||
''ausgabe : -
|
||||
|
||||
bus.bus_init
|
||||
'LAN
|
||||
' lan_started := false 'LAN noch nicht gestartet
|
||||
i2c_Slave.Start( SCL_PIN, SDA_PIN, $5)
|
||||
' ser.start(rxpin, txpin, 0, 9600)
|
||||
|
||||
repeat
|
||||
zeichen := bus.bus_getchar 'kommandocode empfangen
|
||||
'if zeichen
|
||||
'else
|
||||
' zeichen:=bus.bus_getchar
|
||||
case zeichen
|
||||
|
||||
10: bus.bus_putchar(Port2_In) 'Sende Port-Zustand 2
|
||||
20: bus.bus_putchar(Port3_In) 'Sende Portzustand 3
|
||||
30: Port2_Out(bus.bus_getchar) 'Setze Port 2
|
||||
40: Port3_Out(bus.bus_getchar) 'Setze Port 3
|
||||
50: bus.bus_putchar(HC05_Status) 'Status des HC05-Bluetooth-Moduls
|
||||
|
||||
' ---------------------------------------------- LAN-FUNKTIONEN
|
||||
{ 71: lan_start 'Start Network
|
||||
72: lan_stop 'Stop Network
|
||||
73: lan_connect 'ausgehende TCP-Verbindung öffnen
|
||||
74: lan_listen 'auf eingehende TCP-Verbindung lauschen
|
||||
75: lan_waitconntimeout 'bestimmte Zeit auf Verbindung warten
|
||||
76: lan_close 'TCP-Verbindung schließen
|
||||
77: lan_rxtime 'bestimmte Zeit warten auf Byte aus Empfangspuffer
|
||||
78: lan_rxdata 'Daten aus Empfangspuffer lesen
|
||||
79: lan_txdata 'Daten senden
|
||||
80: lan_rxbyte 'wenn vorhanden, Byte aus Empfangspuffer lesen
|
||||
81: lan_isconnected 'TRUE, wenn Socket verbunden, sonst FALSE
|
||||
}
|
||||
' ---------------------------------------------- CHIP-MANAGMENT
|
||||
96: bus.bus_putchar(bus.mgr_getcogs) 'freie cogs abfragen
|
||||
97: bus.mgr_load 'neuen Venatrix-code laden
|
||||
98: bus.bus_putlong(Treiberversion) 'Rückgabe Testwert (Version des Venatrix-Treibers)
|
||||
|
||||
99: reboot 'Venatrix neu starten
|
||||
|
||||
pri Port2_In:c
|
||||
|
||||
dira[8..15]~
|
||||
c:=ina[15..8]
|
||||
dira:=db_in
|
||||
|
||||
pri Port3_In:c
|
||||
dira[16..23]~
|
||||
c:=ina[23..16]
|
||||
dira:=db_in
|
||||
|
||||
pri Port2_Out(char)
|
||||
|
||||
dira[8..15]~~
|
||||
outa[8..15]:=char
|
||||
dira:=db_in
|
||||
|
||||
pri Port3_Out(char)
|
||||
|
||||
dira[16..23]~~
|
||||
outa[16..23]:=char
|
||||
dira:=db_in
|
||||
|
||||
pri HC05_Status:c 'Rueckgabewert des HC05-Statuspin
|
||||
dira[16]~
|
||||
c:=ina[16]
|
||||
dira:=db_in
|
||||
|
||||
CON ''------------------------------------------------- LAN-FUNKTIONEN
|
||||
|
||||
{PRI lan_start | hiveid, hivestr, strpos, macpos, i, a
|
||||
''funktionsgruppe : lan
|
||||
''funktion : Netzwerk starten
|
||||
''eingabe : -
|
||||
''ausgabe : -
|
||||
''busprotokoll : [071]
|
||||
|
||||
if (not lan_started)
|
||||
|
||||
'Pufferindex zurücksetzen
|
||||
i := 0
|
||||
repeat sock#sNumSockets
|
||||
bufidx[i++] := $FF '0xFF: nicht zugewiesen
|
||||
'######################### Das hier muss nach Administra ################################
|
||||
get_ip 'diese funktionen ersetzen den auskommentierten Teil
|
||||
hiveid:=bus.bus_putchar(72) 'in Administra hiveid ermitteln und übertragen
|
||||
{
|
||||
'IP-Parameter setzen
|
||||
if probeRTC
|
||||
repeat a from 0 to 15
|
||||
ip_addr[a] := rtc.getNVSRAM(NVRAM_IPADDR+a) ' fill addresses
|
||||
hiveid := rtc.getNVSRAM(NVRAM_HIVE)
|
||||
hiveid += rtc.getNVSRAM(NVRAM_HIVE+1) << 8
|
||||
hiveid += rtc.getNVSRAM(NVRAM_HIVE+2) << 16
|
||||
hiveid += rtc.getNVSRAM(NVRAM_HIVE+3) << 24
|
||||
else
|
||||
dmarker[UMARKER] := sdfat.getDirCluster 'u-marker setzen
|
||||
ifnot dmarker[SMARKER] == TRUE 's-marker aktivieren
|
||||
sdfat.setDirCluster(dmarker[SMARKER])
|
||||
ifnot \sdfat.openFile(@strNVRAMFile, "R")
|
||||
\sdfat.setCharacterPosition(NVRAM_IPADDR)
|
||||
repeat a from 0 to 15
|
||||
ip_addr[a] := \sdfat.readCharacter 'fill addresses
|
||||
\sdfat.setCharacterPosition(NVRAM_HIVE)
|
||||
hiveid := \sdfat.readCharacter
|
||||
hiveid += \sdfat.readCharacter << 8
|
||||
hiveid += \sdfat.readCharacter << 16
|
||||
hiveid += \sdfat.readCharacter << 24
|
||||
\sdfat.closeFile
|
||||
ifnot dmarker[UMARKER] == TRUE 'U-marker aktivieren
|
||||
sdfat.setDirCluster(dmarker[UMARKER])
|
||||
|
||||
nach Venatrix senden: ip_addr[0]..[15], hiveid
|
||||
}
|
||||
'########################################################################################
|
||||
hivestr := num.ToStr(hiveid, num#DEC)
|
||||
strpos := strsize(hivestr)
|
||||
macpos := 5
|
||||
repeat while (strpos AND macpos)
|
||||
strpos--
|
||||
if(strpos)
|
||||
strpos--
|
||||
mac_addr[macpos] := num.FromStr(hivestr+strpos, num#HEX)
|
||||
byte[hivestr+strpos] := 0
|
||||
macpos--
|
||||
|
||||
sock.start(A_NETCS,A_NETSCK,A_NETSI,A_NETSO, -1, @mac_addr, @ip_addr)
|
||||
lan_started := true
|
||||
|
||||
PRI get_ip|i
|
||||
bus.bus_putchar(71) 'ip-adresse von Administra empfangen
|
||||
repeat i from 0 to 15
|
||||
ip_addr[i]:=bus.bus_getchar
|
||||
|
||||
PRI lan_stop
|
||||
''funktionsgruppe : lan
|
||||
''funktion : Netzwerk anhalten
|
||||
''eingabe : -
|
||||
''ausgabe : -
|
||||
''busprotokoll : [072]
|
||||
|
||||
if lan_started
|
||||
sock.stop
|
||||
lan_started := false
|
||||
|
||||
PRI lan_connect | ipaddr, remoteport, handle, handleidx, i
|
||||
''funktionsgruppe : lan
|
||||
''funktion : ausgehende TCP-Verbindung öffnen (mit Server verbinden)
|
||||
''eingabe : -
|
||||
''ausgabe : -
|
||||
''busprotokoll : [073][sub_getlong.ipaddr][sub_getword.remoteport][put.handleidx]
|
||||
'' : ipaddr - ipv4 address packed into a long (ie: 1.2.3.4 => $01_02_03_04)
|
||||
'' : remoteport - port number to connect to
|
||||
'' : handleidx - lfd. Nr. der Verbindung (index des kompletten handle)
|
||||
|
||||
ipaddr := bus.bus_getlong
|
||||
remoteport := bus.bus_getword
|
||||
|
||||
'freien Pufferabschnitt suchen
|
||||
i := 0
|
||||
repeat sock#sNumSockets
|
||||
if bufidx[i] == $FF '0xFF: nicht zugewiesen
|
||||
quit
|
||||
i++
|
||||
|
||||
ifnot (handle := sock.connect(ipaddr, remoteport, @bufrx[i*rxlen], rxlen, @buftx[i*txlen], txlen)) == -102
|
||||
sock.resetBuffers(handle)
|
||||
handleidx := handle.byte[0] 'extract the handle index from the lower 8 bits
|
||||
sockhandle[handleidx] := handle 'komplettes handle zu handle index speichern
|
||||
bufidx[i] :=handleidx
|
||||
bus.bus_putchar(handleidx) 'handleidx senden
|
||||
else
|
||||
bus.bus_putchar($FF)
|
||||
|
||||
PRI lan_listen | port, handle, handleidx, i
|
||||
''funktionsgruppe : lan
|
||||
''funktion : Port für eingehende TCP-Verbindung öffnen
|
||||
''eingabe : -
|
||||
''ausgabe : -
|
||||
''busprotokoll : [074][sub_getword.port][put.handleidx]
|
||||
'' : port - zu öffnende Portnummer
|
||||
'' : handleidx - lfd. Nr. der Verbindung (index des kompletten handle)
|
||||
|
||||
port := bus.bus_getword
|
||||
|
||||
'freien Pufferabschnitt suchen
|
||||
i := 0
|
||||
repeat sock#sNumSockets
|
||||
if bufidx[i] == $FF '0xFF: nicht zugewiesen
|
||||
quit
|
||||
i++
|
||||
|
||||
ifnot (handle := sock.listen(port, @bufrx[i*rxlen], rxlen, @buftx[i*txlen], txlen)) == -102
|
||||
handleidx := handle.byte[0] 'extract the handle index from the lower 8 bits
|
||||
sockhandle[handleidx] := handle 'komplettes handle zu handle index speichern
|
||||
bufidx[i] :=handleidx
|
||||
bus.bus_putchar(handleidx) 'handleidx senden
|
||||
else
|
||||
bus.bus_putchar($FF)
|
||||
|
||||
PRI lan_waitconntimeout | handleidx, timeout, t, connected
|
||||
''funktionsgruppe : lan
|
||||
''funktion : bestimmte Zeit auf Verbindung warten
|
||||
''eingabe : -
|
||||
''ausgabe : -
|
||||
''busprotokoll : [075][get.handleidx][sub_getword.timeout][put.connected]
|
||||
'' : handleidx - lfd. Nr. der zu testenden Verbindung
|
||||
'' : timeout - Timeout in Millisekunden
|
||||
'' : connected - True, if connected
|
||||
|
||||
handleidx := bus.bus_getchar
|
||||
timeout := bus.bus_getword
|
||||
|
||||
t := cnt
|
||||
repeat until (connected := sock.isConnected(sockhandle[handleidx])) or (((cnt - t) / (clkfreq / 1000)) > timeout)
|
||||
|
||||
bus.bus_putchar(connected)
|
||||
|
||||
PRI lan_close | handleidx, i
|
||||
''funktionsgruppe : lan
|
||||
''funktion : TCP-Verbindung (ein- oder ausgehend) schließen
|
||||
''eingabe : -
|
||||
''ausgabe : -
|
||||
''busprotokoll : [076][get.handleidx]
|
||||
'' : handleidx - lfd. Nr. der zu schließenden Verbindung
|
||||
|
||||
handleidx := bus.bus_getchar
|
||||
|
||||
sock.close(sockhandle[handleidx])
|
||||
|
||||
'reservierten Pufferabschnitt freigeben
|
||||
i := 0
|
||||
repeat sock#sNumSockets
|
||||
if bufidx[i++] == handleidx '0xFF: nicht zugewiesen
|
||||
bufidx[i++] := $FF
|
||||
quit
|
||||
|
||||
|
||||
PRI lan_rxtime | handleidx, timeout, t, rxbyte
|
||||
''funktionsgruppe : lan
|
||||
''funktion : angegebene Zeit auf ASCII-Zeichen warten
|
||||
'' : nicht verwenden, wenn anderes als ASCII (0 - 127) empfangen wird
|
||||
''eingabe : -
|
||||
''ausgabe : -
|
||||
''busprotokoll : [077][get.handleidx][sub_getword.timeout][put.rxbyte]
|
||||
'' : handleidx - lfd. Nr. der Verbindung
|
||||
'' : timeout - Timeout in Millisekunden
|
||||
'' : rxbyte - empfangenes Zeichen (0 - 127) oder
|
||||
'' : sock#RETBUFFEREMPTY (-1) wenn Timeout oder keine Verbindung mehr
|
||||
|
||||
handleidx := bus.bus_getchar
|
||||
timeout := bus.bus_getword
|
||||
|
||||
t := cnt
|
||||
repeat until (rxbyte := sock.readByteNonBlocking(sockhandle[handleidx])) => 0 or (not sock.isConnected(sockhandle[handleidx])) or (cnt - t) / (clkfreq / 1000) > timeout
|
||||
|
||||
bus.bus_putchar(rxbyte)
|
||||
|
||||
PRI lan_rxdata | handleidx, len, rxbyte, error
|
||||
''funktionsgruppe : lan
|
||||
''funktion : bei bestehender Verbindung die angegebene Datenmenge empfangen
|
||||
''eingabe : -
|
||||
''ausgabe : -
|
||||
''busprotokoll : [078][get.handleidx][sub_getlong.len][put.byte1][put.byte<len>][put.error]
|
||||
'' : handleidx - lfd. Nr. der Verbindung
|
||||
'' : len - Anzahl zu empfangender Bytes
|
||||
'' : error - ungleich Null bei Fehler
|
||||
|
||||
error := FALSE
|
||||
handleidx := bus.bus_getchar
|
||||
len := bus.bus_getlong
|
||||
|
||||
repeat len
|
||||
ifnot error
|
||||
repeat while (rxbyte := sock.readByteNonBlocking(sockhandle[handleidx])) < 0
|
||||
ifnot sock.isConnected(sockhandle[handleidx])
|
||||
error := sock#ERRSOCKETCLOSED
|
||||
quit
|
||||
bus.bus_putchar(rxbyte)
|
||||
|
||||
bus.bus_putchar(error)
|
||||
|
||||
PRI lan_txdata | handleidx, len, txbyte, error
|
||||
''funktionsgruppe : lan
|
||||
''funktion : bei bestehender Verbindung die angegebene Datenmenge senden
|
||||
''eingabe : -
|
||||
''ausgabe : -
|
||||
''busprotokoll : [079][get.handleidx][sub_getlong.len][get.byte1][get.byte<len>][put.error]
|
||||
'' : handleidx - lfd. Nr. der Verbindung
|
||||
'' : len - Anzahl zu sendender Bytes
|
||||
'' : error - ungleich Null bei Fehler
|
||||
|
||||
error := FALSE
|
||||
handleidx := bus.bus_getchar
|
||||
len := bus.bus_getlong
|
||||
|
||||
repeat len
|
||||
txbyte := bus.bus_getchar
|
||||
ifnot error
|
||||
repeat while sock.writeByteNonBlocking(sockhandle[handleidx], txbyte) < 0
|
||||
ifnot sock.isConnected(sockhandle[handleidx])
|
||||
error := sock#ERRSOCKETCLOSED
|
||||
quit
|
||||
|
||||
bus.bus_putchar(error)
|
||||
|
||||
PRI lan_rxbyte
|
||||
''funktionsgruppe : lan
|
||||
''funktion : wenn vorhanden, ein empfangenes Byte lesen
|
||||
'' : nicht verwenden, wenn auch $FF empfangen werden kann
|
||||
''eingabe : -
|
||||
''ausgabe : -
|
||||
''busprotokoll : [080][get.handleidx][put.rxbyte]
|
||||
'' : handleidx - lfd. Nr. der Verbindung
|
||||
'' : rxbyte - empfangenes Zeichen oder
|
||||
'' : sock#RETBUFFEREMPTY (-1) wenn kein Zeichen vorhanden
|
||||
|
||||
bus.bus_putchar(sock.readByteNonBlocking(sockhandle[bus.bus_getchar]))
|
||||
|
||||
PRI lan_isconnected
|
||||
''funktionsgruppe : lan
|
||||
''funktion : Returns true if the socket is connected, false otherwise
|
||||
''eingabe : -
|
||||
''ausgabe : -
|
||||
''busprotokoll : [081][get.handleidx][put.connected]
|
||||
'' : handleidx - lfd. Nr. der Verbindung
|
||||
'' : connected - TRUE wenn verbunden, sonst FALSE
|
||||
|
||||
bus.bus_putchar(sock.isConnected(sockhandle[bus.bus_getchar]))
|
||||
|
||||
DAT
|
||||
long ' long alignment for addresses
|
||||
ip_addr byte 10, 1, 1, 1 'ip
|
||||
ip_subnet byte 255, 255, 255, 0 'subnet-maske
|
||||
ip_gateway byte 10, 1, 1, 254 'gateway
|
||||
ip_dns byte 10, 1, 1, 254 'dns
|
||||
ip_boot long 0 'boot-server (IP address in long)
|
||||
mac_addr byte $c0, $de, $ba, $be, $00, $00 'mac-adresse
|
||||
}
|
|
@ -0,0 +1,722 @@
|
|||
{{
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Autor: Reinhard Zielinski │
|
||||
│ Copyright (c) 2013 Reinhard Zielinski │
|
||||
│ See end of file for terms of use. │
|
||||
│ Die Nutzungsbedingungen befinden sich am Ende der Datei │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Informationen : hive-project.de
|
||||
Kontakt : zille09@gmail.com
|
||||
System : TriOS
|
||||
Name : YModem - Treiber für die Dateiübertragung vom Hive zum PC und umgekehrt
|
||||
Chip : Regnatix
|
||||
Typ : Plexus-Erweiterungsdatei
|
||||
Version : 01
|
||||
Subversion : 00
|
||||
|
||||
|
||||
Logbuch :
|
||||
'############################################### Version 1.0 ######################################################################################################################
|
||||
|
||||
20-03-2014 :-Template für DLL-Dateien an die neuen Anforderungen angepasst
|
||||
|
||||
21-03-2014 -YModem-Treiber eingebunden, momentan funktioniert nur das Senden
|
||||
-6624 Longs frei
|
||||
|
||||
23-03-2014 -Fehler in der Empfangsroutine gefunden
|
||||
-einige kleine Korrekturen im Code des Treibers, am Ende einer Datei wurden falsche Bytes übertragen
|
||||
-jetzt funktioniert der Treiber korrekt
|
||||
-5965 Longs frei
|
||||
|
||||
23-03-2014 -Sende-Routine auf SD-Karten-Blocklese-Befehl umgestellt, dadurch die Übertragungsgeschwindigkeit fast verdoppelt :-)
|
||||
-Korrektur beim Lesen der letzten zwei Bytes durchgeführt, jetzt wird die Datei korrekt bis zum letzten Byte übertragen
|
||||
-Korrektur in der Buttonabfrage
|
||||
-kleinere optische Korrekturen
|
||||
-5957 Longs frei
|
||||
|
||||
24-03-2014 -doppelten seriell Treiber entfernt
|
||||
-Korrektur in der Empfangsroutine (fehlendes ACK), jetzt funktioniert der Empfang auch mit ZTerm
|
||||
-seltsamerweise wird das Sendefenster in den Terminal-Programmen nach erfolgreichem Empfang nicht geschlossen!?
|
||||
-die Datei wird aber korrekt übertragen
|
||||
-6141 Longs frei
|
||||
|
||||
25-03-2014 -Beim Beenden wird jetzt nicht mehr der Desktop gelöscht
|
||||
-dadurch entsteht eine noch bessere Illusion, das die DLL im Plexus integriert ist
|
||||
-6148 Longs frei
|
||||
}}
|
||||
|
||||
obj
|
||||
ios: "reg-ios-64"
|
||||
num: "Numbers"
|
||||
|
||||
con
|
||||
_CLKMODE = XTAL1 + PLL16X
|
||||
_XINFREQ = 5_000_000
|
||||
|
||||
'------------- Shell-Farben -----------------------------------------------------
|
||||
shellhcol =0 'Hauptfensterfarbe
|
||||
act_color =1 'Schriftfarbe
|
||||
winhcol =2 'Fensterhintergrundfarbe
|
||||
winframecol =3 'Fensterrandfarbe
|
||||
Titelhcol =4 'Titelleistenfarbe
|
||||
titeltextcol =5 'Titelleistentextfarbe
|
||||
hcolstatus =6 'statusleiste hintergrundfarbe
|
||||
statustextcol =7 'Statustextfarbe
|
||||
buttonhcol =8 'Buttonhintergrundfarbe
|
||||
buttontextcol =9 'Buttontextfarbe
|
||||
messagehcol =10 'Messagebox-Hintergrundfarbe
|
||||
messagetextcol =11 'Messagebox-Textfarbe
|
||||
selectcol =12 'selektionsfarbe
|
||||
mousecol =13 'Mauszeigerfarbe
|
||||
panelcol =14 'Farbe des Utility-Panels
|
||||
|
||||
ADM_SPEC = %00000000_00000000_00000000_01010011
|
||||
'-------- Speicher für diverse Texte ------------
|
||||
TXT_RAM = $20000
|
||||
Hour_Glass = $66800+(167*16*4)
|
||||
'-------- YMODEM Temp-Speicher ------------------
|
||||
YMODEM_RAM= $7E400 '... $7E417 Name, der zu sendenden Datei, Was soll gemacht werden(0Empfang,1Senden)+Dirmarker
|
||||
|
||||
SETTING_RAM = $7FF00 'Hier stehen die System-Settings
|
||||
BRAM = $50000 'Overlay-Puffer
|
||||
'******************Farben ********************************************************
|
||||
#$FC, Light_Grey, #$A8, Grey, #$54, Dark_Grey
|
||||
#$C0, Light_Red, #$80, Red, #$40, Dark_Red
|
||||
#$30, Light_Green, #$20, Green, #$10, Dark_Green
|
||||
#$1F, Light_Blue, #$09, Blue, #$04, Dark_Blue
|
||||
#$F0, Light_Orange, #$E6, Orange, #$92, Dark_Orange
|
||||
#$CC, Light_Purple, #$88, Purple, #$44, Dark_Purple
|
||||
#$3C, Light_Teal, #$28, Teal, #$14, Dark_Teal
|
||||
#$FF, White, #$00, Black
|
||||
'----Icon-Nummern----------------------------------------------------------------
|
||||
BEL_PIC =14
|
||||
ADM_PIC =15
|
||||
BIN_PIC =9
|
||||
BAS_PIC =107
|
||||
DIR_PIC =7
|
||||
ALL_PIC =8
|
||||
DMP_PIC =120
|
||||
TXT_PIC =121
|
||||
SYS_PIC =122
|
||||
COG_PIC =75
|
||||
BACK_PIC =124
|
||||
VOR_PIC =123
|
||||
PLAY_PIC =125
|
||||
STOP_PIC =141
|
||||
CLR_PIC =155
|
||||
EXT_PIC =156
|
||||
|
||||
'------------- F-Tasten für Zusatzfunktionen -------------------------------------
|
||||
F1_Key = 208
|
||||
F2_Key = 209
|
||||
F3_Key = 210
|
||||
F4_Key = 211
|
||||
F5_Key = 212
|
||||
F6_Key = 213
|
||||
F7_Key = 214
|
||||
F8_Key = 215
|
||||
F9_Key = 216
|
||||
F10_Key = 217
|
||||
F11_Key = 218
|
||||
F12_Key = 219
|
||||
ESC_KEY = 27
|
||||
RETURN_KEY = 13
|
||||
'--------------------------------------------------------------------------------
|
||||
|
||||
var
|
||||
|
||||
byte mountmarker
|
||||
long userdir 'user-Dirmarker
|
||||
byte colors[15] 'Farbwerte
|
||||
byte ma,mb 'Maus-Tasten
|
||||
byte messagex 'x-Position der Messagebox
|
||||
|
||||
byte windowx[3]
|
||||
byte windowy[3]
|
||||
byte windowxx[3]
|
||||
byte windowyy[3]
|
||||
byte buttonx[5],buttony[5]
|
||||
byte util
|
||||
long systemdir 'Plexus-System-Verzeichnis
|
||||
byte font[25] 'Hilfsstring für Strings aus dem Ram
|
||||
|
||||
'----------- DCF-Indikator ------------------------------------
|
||||
byte dcf_on
|
||||
'----------- YMODEM-Variablen ---------------------------------
|
||||
byte fbuf[12]
|
||||
byte sbuf[30]
|
||||
byte pdata[1028] 'packet data
|
||||
byte baud
|
||||
byte was 'Was soll ich machen? Senden oder Empfangen
|
||||
|
||||
dat
|
||||
regsys byte "plexus.dll",0 'Reg.sys für Rückkehr aus externem Programm
|
||||
butOK byte " OK ",0
|
||||
Abbr byte "Cancel",0
|
||||
SYSTEM Byte "PLEXUS ",0 'Plexus-Systemverzeichnis
|
||||
fertig byte "Transmission done!",0 'fertig-Meldung
|
||||
{{
|
||||
'################################################### ACHTUNG ###############################################################
|
||||
'# #
|
||||
'# Für eine optimale Übertragungsgeschwindigkeit muss der Puffer im Seriell-Treiber #
|
||||
'# auf die Mindest-Größe (128) eingestellt werden !!!! #
|
||||
'# #
|
||||
'################################################### ACHTUNG ###############################################################
|
||||
}}
|
||||
PUB main|yadr,i
|
||||
|
||||
ios.start
|
||||
cmd_mount 'sd-card mounten
|
||||
mountmarker:=1 'mount-marker
|
||||
'--------------------------------------------------------------------------------------
|
||||
activate_dirmarker(0) 'ins root
|
||||
ios.sdchdir(@system) 'System-Verzeichnis lesen
|
||||
systemdir:=get_dirmarker 'Dir-Marker lesen
|
||||
|
||||
'--------------------------------------------------------------------------------------
|
||||
cmd_unmount
|
||||
iniload 'Ini-Datei mit Farbwerten laden
|
||||
yadr:=YMODEM_RAM
|
||||
i:=0
|
||||
was:=ios.ram_rdbyte(YMODEM_RAM+15) 'Modus=1 Senden 0=Empfangen
|
||||
userdir:=ios.ram_rdlong(YMODEM_RAM+16)
|
||||
if was 'was=1 heisst senden
|
||||
repeat 12 'Dateiname aus dem RAM lesen
|
||||
fbuf[i++]:=ios.ram_rdbyte(yadr++)
|
||||
fbuf[i]:=0
|
||||
|
||||
ios.seropen(bdselect(baud))
|
||||
util:=0
|
||||
testfenster
|
||||
|
||||
repeat
|
||||
|
||||
os_cmdinput 'Hauptprogrammschleife
|
||||
|
||||
PRI os_cmdinput | x,y ,key
|
||||
|
||||
repeat
|
||||
'time 'Zeit und Datum anzeigen
|
||||
|
||||
ma:=ios.mouse_button(0) 'linke Maustaste
|
||||
mb:=ios.mouse_button(1) 'rechte Maustaste
|
||||
key:=ios.key
|
||||
if key
|
||||
'**************************** Short-Cuts ****************************************************************************
|
||||
case key
|
||||
ESC_KEY:ausstieg
|
||||
RETURN_KEY:ausstieg
|
||||
|
||||
'***************************** linke Maustaste **********************************************************************
|
||||
if ma
|
||||
x:=ios.mousex
|
||||
y:=ios.mousey
|
||||
'****************************** Globale Funktionstasten ********************************************************
|
||||
if(x=>buttonx[1]) and (x=<buttonx[1]+5) and (y==buttony[1]) 'ok
|
||||
buttonpress(1)
|
||||
ausstieg
|
||||
if(x=>buttonx[2]) and (x=<buttonx[2]+6) and (y==buttony[2]) 'cancel
|
||||
buttonpress(2)
|
||||
ausstieg
|
||||
|
||||
con'************************************ YMODEM-Funktion *************************************************************************************************************************
|
||||
'XMODEM chars from ymodem.txt
|
||||
SOH=$01
|
||||
STX=$02
|
||||
EOT=$04
|
||||
ACK=$06
|
||||
NAK=$15
|
||||
CAN=$18
|
||||
Cee=$43 'liberties here
|
||||
Zee=$1A 'or SUB (DOS EOF?)
|
||||
|
||||
PRI bdselect(bauds):bd
|
||||
bd:=lookupz(bauds:300,600,1200,4800,9600,19200,38400,57600,115200)
|
||||
|
||||
pri Send_file|key,i,size,timer,packet,d,crc,p,j,k,deot,e,position,zaehler,tmp,stand
|
||||
'Ymodem protocol: http://timeline.textfiles.com/1988/10/14/1/FILES/ymodem.txt
|
||||
' http://en.wikipedia.org/wiki/XMODEM
|
||||
' ios.seropen(bdselect(baud))'com.start(31, 30, 0, bdselect(baud))
|
||||
print_win(@fbuf,10,13)
|
||||
print_titel(string("Send"),22,7)
|
||||
key:=0
|
||||
i:=0
|
||||
ios.sdmount
|
||||
'Transmit file to host
|
||||
activate_dirmarker(userdir)
|
||||
e:=ios.sdopen("R",@fbuf)
|
||||
if e
|
||||
error(e)
|
||||
return
|
||||
size:=ios.sdfattrib(0)'sdfat.fsize
|
||||
printdec_win(size,14,10)
|
||||
stand:=size
|
||||
tmp:=size/18 'anzahl bytes pro block
|
||||
zaehler:=0
|
||||
|
||||
timer:=cnt
|
||||
key:=0
|
||||
bytefill(@pdata,0,128) 'Puffer löschen
|
||||
|
||||
repeat until key==Cee 'Wait for NAK from host: Signal to start sending
|
||||
i:=ios.serread'com.rxcheck
|
||||
if i>0
|
||||
key:=i
|
||||
i:=cnt
|
||||
if ((cnt-timer)/clkfreq)>10 '10 second timeout
|
||||
error(75)
|
||||
return 'fail
|
||||
|
||||
|
||||
'start sending packets
|
||||
packet:=0
|
||||
repeat
|
||||
timer:=cnt
|
||||
crc:=0
|
||||
deot:=false
|
||||
|
||||
ios.sertx(SOH) 'send header
|
||||
ios.sertx(packet)
|
||||
ios.sertx(!packet)
|
||||
'construct packet
|
||||
if packet==0
|
||||
i:=strsize(@fbuf)
|
||||
bytemove(@pdata,@fbuf,i+1)
|
||||
p:=num.tostr(size,num#DEC)
|
||||
j:=strsize(p)
|
||||
bytemove(@pdata+i+1,p,j+1) 'Send filename and length
|
||||
|
||||
else
|
||||
|
||||
if stand=>128 'Paket von SD-Karte lesen
|
||||
ios.sdgetblk(128,@pdata)
|
||||
zaehler+=128
|
||||
stand-=128
|
||||
|
||||
else
|
||||
repeat i from 0 to 127 'letztes Paket
|
||||
d:=ios.sdgetc
|
||||
zaehler++
|
||||
if zaehler==size+1
|
||||
repeat i from i to 127
|
||||
pdata[i]:=0
|
||||
stand:=0
|
||||
deot:=true
|
||||
quit
|
||||
pdata[i]:=d
|
||||
|
||||
|
||||
position:=zaehler/tmp 'balkenposition
|
||||
positionsbalken(position,11,11)
|
||||
|
||||
|
||||
repeat i from 0 to 127 'send packet
|
||||
ios.sertx(pdata[i])
|
||||
crc:=UpdateCRC(pdata[i],crc)
|
||||
|
||||
ios.sertx((crc>>8)&$FF)
|
||||
ios.sertx(crc&$FF)
|
||||
|
||||
repeat
|
||||
i:=ios.serread'com.rxcheck
|
||||
if i==ACK 'Paket OK
|
||||
quit
|
||||
if i==NAK 'Paket Not OK
|
||||
'retransmit packet
|
||||
repeat i from 0 to 127
|
||||
ios.sertx(pdata[i])
|
||||
ios.sertx((crc>>8)&$FF)
|
||||
ios.sertx(crc&$FF)
|
||||
if ((cnt-timer)/clkfreq)>10
|
||||
ios.sertx(EOT)
|
||||
error(78) '"Timeout failure."))
|
||||
return 'fail
|
||||
if (deot==true) 'done
|
||||
quit
|
||||
else
|
||||
packet++
|
||||
timer:=cnt
|
||||
|
||||
|
||||
|
||||
ios.sertx(EOT) 'send EOT wait for ACK and send end of batch packet
|
||||
repeat
|
||||
i:=ios.serread'com.rxcheck
|
||||
if i==ACK
|
||||
|
||||
timer:=cnt
|
||||
key:=0
|
||||
repeat until key==Cee 'now, wait for "C"
|
||||
i:=ios.serread'com.rxcheck
|
||||
if i>0
|
||||
key:=i
|
||||
i:=cnt
|
||||
if ((cnt-timer)/clkfreq)>10 '10 second timeout
|
||||
error(75)
|
||||
return 'fail
|
||||
'now, transmit null packet and wait for ACK
|
||||
key:=0
|
||||
repeat until key==ACK
|
||||
ios.sertx(SOH)
|
||||
ios.sertx(0)
|
||||
ios.sertx($FF)
|
||||
crc:=0
|
||||
repeat 128
|
||||
ios.sertx(0)
|
||||
crc:=UpdateCRC(0,crc)
|
||||
ios.sertx((crc>>8)&$FF)
|
||||
ios.sertx(crc&$FF)
|
||||
'wait for ack
|
||||
key:=ios.serget
|
||||
if key<>ACK and key<>NAK
|
||||
error(75)
|
||||
return 'fail
|
||||
quit 'all done!
|
||||
|
||||
ios.sertx(EOT)
|
||||
|
||||
print_win(@fertig,10,14)
|
||||
' waitcnt(cnt+clkfreq)
|
||||
ausstieg
|
||||
|
||||
PRI positionsbalken(pos,x,y)
|
||||
ios.display2dbox(colors[act_color],y,x,y,x+pos,0)
|
||||
|
||||
pri Empfang_file|key,i,packet,crc,j,k,timer,bytes,done,zaehler,tmp,position
|
||||
'get file from computer and save to SD
|
||||
'Ymodem protocol: http://timeline.textfiles.com/1988/10/14/1/FILES/ymodem.txt
|
||||
zaehler:=0
|
||||
print_titel(string("Receive"),22,7)
|
||||
|
||||
ios.sdmount
|
||||
'Receive file from host
|
||||
activate_dirmarker(userdir)
|
||||
|
||||
'repeat 'batch reception loop
|
||||
'wait for first packet
|
||||
packet:=0
|
||||
'############ erstes Paket #################
|
||||
repeat until packet==1
|
||||
key:=0
|
||||
'waitcnt(cnt+clkfreq*3)
|
||||
ios.sertx(Cee)
|
||||
timer:=cnt
|
||||
repeat until key==SOH
|
||||
key:=ios.serread
|
||||
if(cnt-timer)>clkfreq*5
|
||||
ios.sertx(EOT)
|
||||
error(75)
|
||||
return
|
||||
|
||||
'analyze first packet
|
||||
if(ios.serget==0)
|
||||
if(ios.serget==$FF)
|
||||
crc:=0
|
||||
j:=0
|
||||
i:=-1
|
||||
done:=0
|
||||
'filename
|
||||
repeat until i==0
|
||||
i:=ios.serget
|
||||
fbuf[j++]:=i
|
||||
crc:=UpdateCRC(i,crc)
|
||||
print_win(@fbuf,10,13) 'Dateiname anzeigen
|
||||
i:=-1
|
||||
k:=j
|
||||
j:=0
|
||||
|
||||
repeat until i==0 or i==32
|
||||
i:=ios.serget
|
||||
if i<>32
|
||||
sbuf[j++]:=i
|
||||
else
|
||||
sbuf[j++]:=0
|
||||
crc:=UpdateCRC(i,crc)
|
||||
|
||||
k+=j
|
||||
|
||||
bytes:=num.fromstr(@sbuf,num#dec)
|
||||
tmp:=bytes/18
|
||||
printdec_win(bytes,14,10) 'Dateigröße anzeigen
|
||||
repeat j from k+1 to 128
|
||||
i:=ios.serget
|
||||
crc:=UpdateCRC(i,crc)
|
||||
else
|
||||
ios.sertx(NAK)
|
||||
else
|
||||
ios.sertx(NAK)
|
||||
|
||||
i:=ios.serget
|
||||
|
||||
j:=ios.serget
|
||||
|
||||
if i<>(crc>>8) or j<>(crc&$FF)
|
||||
ios.sertx(NAK)
|
||||
else
|
||||
packet:=1
|
||||
|
||||
'###################### ende Paket 1 ##################################
|
||||
ios.sertx(ACK)
|
||||
|
||||
|
||||
'open output file
|
||||
ios.sdnewfile(@fbuf)
|
||||
ios.sdopen("W",@fbuf)
|
||||
|
||||
|
||||
'receive packets
|
||||
'################################# restliche Pakete empfangen ####################
|
||||
ios.sertx(Cee)
|
||||
k:=0
|
||||
repeat until k==EOT
|
||||
k:=ios.serget
|
||||
if k==SOH
|
||||
packet:=ios.serget
|
||||
i:=ios.serget
|
||||
if (255-i)<>packet
|
||||
quit
|
||||
|
||||
crc:=0
|
||||
repeat j from 0 to 127
|
||||
i:=ios.serget
|
||||
crc:=UpdateCRC(i,crc)
|
||||
pdata[j]:=i
|
||||
zaehler++
|
||||
|
||||
i:=ios.serget
|
||||
j:=ios.serget
|
||||
if i<>(crc>>8) or j<>(crc&$FF)
|
||||
ios.sertx(NAK)
|
||||
|
||||
else
|
||||
'write data
|
||||
if bytes>128
|
||||
ios.sdputblk(128,@pdata)
|
||||
bytes-=128
|
||||
|
||||
else
|
||||
ios.sdputblk(bytes,@pdata)
|
||||
bytes:=0
|
||||
ios.sertx(ACK) 'funktioniert auch ohne, ist aber unlogisch
|
||||
'get more
|
||||
elseif k==STX
|
||||
'1024 byte packets
|
||||
repeat j from 0 to 1027
|
||||
pdata[j]:=ios.serget
|
||||
zaehler++
|
||||
|
||||
packet:=pdata[0]
|
||||
i:=pdata[1]
|
||||
if (255-i)<>packet
|
||||
|
||||
quit
|
||||
|
||||
|
||||
crc:=0
|
||||
repeat j from 2 to 1025
|
||||
i:=pdata[j]
|
||||
crc:=UpdateCRC(i,crc)
|
||||
i:=pdata[1026]
|
||||
j:=pdata[1027]
|
||||
if i<>(crc>>8) or j<>(crc&$FF)
|
||||
ios.sertx(NAK)
|
||||
else
|
||||
'write data
|
||||
if bytes>1024
|
||||
ios.sdputblk(1024,@pdata+2)
|
||||
bytes-=1024
|
||||
else
|
||||
ios.sdputblk(bytes,@pdata+2)
|
||||
bytes:=0
|
||||
ios.sertx(ACK)
|
||||
|
||||
position:=zaehler/tmp 'balkenposition
|
||||
positionsbalken(position,11,11)
|
||||
|
||||
ios.sertx(ACK)
|
||||
ios.sdclose
|
||||
print_win(@fertig,10,14)
|
||||
'waitcnt(cnt+clkfreq)
|
||||
ausstieg
|
||||
|
||||
PRI UpdateCRC(data,crc):newcrc|i
|
||||
'look here:http://web.mit.edu/6.115/www/miscfiles/amulet/amulet-help/xmodem.htm
|
||||
|
||||
crc:=crc^(data<<8)
|
||||
repeat i from 0 to 7
|
||||
if crc&$8000
|
||||
crc:=((crc<<1)&$FFFF)^$1021
|
||||
else
|
||||
crc:=(crc<<=1)&$FFFF
|
||||
|
||||
return crc&$FFFF
|
||||
con '********************************************* Ausgabe von Fehlermeldungen ***************************************************************************************************
|
||||
PRI error(err)
|
||||
|
||||
messagebox(ram_txt(err),1)
|
||||
|
||||
PRI messagebox(st,ok)|laenge,mindest
|
||||
laenge:=strsize(st)+2
|
||||
mindest:= 20
|
||||
messagex:=10+laenge
|
||||
ios.backup_area(7,10,messagex,17,BRAM)
|
||||
ios.display3DBox(white, colors[messagehcol], black, 10, 7, 17, messagex)
|
||||
print_message(st,8,11)
|
||||
if ok==1
|
||||
button(1,@butOK,10,15)
|
||||
button(2,@Abbr,1+laenge,15)
|
||||
|
||||
PRI ram_txt(nummer)|c,i,ad
|
||||
i:=0
|
||||
ad:=TXT_RAM+((nummer-1)*25)
|
||||
repeat while c:=ios.ram_rdbyte(ad++)
|
||||
if c>13
|
||||
byte[@font][i++]:=c
|
||||
byte[@font][i]:=0
|
||||
return @font
|
||||
|
||||
PRI button(n,btext,x,y)
|
||||
buttonx[n]:=x
|
||||
buttony[n]:=y
|
||||
printfont(btext,colors[buttonhcol],0,colors[buttontextcol],x,y)
|
||||
|
||||
PRI Mouse_Release
|
||||
repeat while ios.mouse_button(0) 'warten bis Maustaste losgelassen wird
|
||||
|
||||
pri ausstieg
|
||||
'ios.restore_Area(8,7,32,15,BRAM)
|
||||
'ios.display2dbox(colors[shellhcol], 1,1, 25,34,0)
|
||||
ios.Mousepointer(hour_glass)
|
||||
cmd_mount
|
||||
activate_dirmarker(systemdir)
|
||||
ios.sdopen("r",@regsys)
|
||||
ios.ldbin(@regsys)
|
||||
|
||||
pri testfenster|a
|
||||
|
||||
a:=0
|
||||
window(2,4,9,9,14,31,string("Filetransfer:"))
|
||||
rahmen(10,10,30,12)
|
||||
printdec_win(0,9,10)
|
||||
printdec_win(100,9,28)
|
||||
if was
|
||||
Send_File
|
||||
else
|
||||
Empfang_File
|
||||
con '---------------------------------------------- Ausgaberoutinen ---------------------------------------------------------------------------------------------------------------
|
||||
PRI Win_Tile(nu,ty,tx)
|
||||
ios.displaytile(nu,colors[winhcol],0,colors[act_color],ty,tx)
|
||||
|
||||
PRI print_message(stradr,x,y)
|
||||
printfont(stradr,colors[messagehcol],0,colors[messagetextcol],x,y)
|
||||
|
||||
PRI printdec_win(n,y,x)
|
||||
printdec(n,y,x,colors[winhcol],colors[act_color])
|
||||
|
||||
PRI Print_win(str,x,y)
|
||||
printfont(str,colors[winhcol],0,colors[act_color],x,y)
|
||||
PRI print_titel(stradr,x,y)
|
||||
printfont(stradr,colors[titelhcol],0,colors[titeltextcol],x,y)
|
||||
con'
|
||||
PRI iniload|i,a
|
||||
a:=SETTING_RAM
|
||||
repeat i from 0 to 14
|
||||
colors[i]:=ios.ram_rdbyte(a++)
|
||||
baud:=ios.ram_rdbyte(a++) 'Übertragungsrate serielles Terminal
|
||||
|
||||
dcf_on:=ios.ram_rdbyte(a+2)
|
||||
|
||||
PRI activate_dirmarker(mark) 'USER-Marker setzen
|
||||
|
||||
ios.sddmput(ios#DM_USER,mark) 'usermarker wieder in administra setzen
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
PRI get_dirmarker:dm 'USER-Marker lesen
|
||||
|
||||
ios.sddmset(ios#DM_USER)
|
||||
dm:=ios.sddmget(ios#DM_USER)
|
||||
PRI cmd_mount :err 'cmd: mount
|
||||
|
||||
repeat 16
|
||||
err:=ios.sdmount
|
||||
ifnot err
|
||||
mountmarker:=1
|
||||
quit
|
||||
|
||||
PRI cmd_unmount|err 'cmd: unmount
|
||||
err:=ios.sdunmount
|
||||
ifnot err
|
||||
mountmarker:=0
|
||||
|
||||
PRI window(numm,cntrl,y,x,yy,xx,strg) 'ein Fenster erstellen
|
||||
|
||||
windowx[numm]:=x-1
|
||||
windowy[numm]:=y-2
|
||||
windowxx[numm]:=xx+1
|
||||
windowyy[numm]:=yy+1
|
||||
|
||||
ios.window(numm,0,colors[winhcol],0,colors[winframecol],colors[titelhcol],colors[titeltextcol],colors[hcolstatus],colors[statustextcol],y-2,x-1,yy+1,xx+1,cntrl,0)
|
||||
ios.printcursorrate(0)
|
||||
ios.printchar(12) 'cls
|
||||
printfont(strg,colors[titelhcol],0,colors[titeltextcol],x,y-2)
|
||||
|
||||
PRI printfont(str1,a,b,c,d,e)|f
|
||||
|
||||
repeat strsize(str1)
|
||||
f:= byte[str1++]
|
||||
f-=16 'anderer Zeichensatz, Zeichen um -16 Positionen versetzt
|
||||
if d>39 'wenn Bildschirmrand erreicht, neue Zeile
|
||||
d:=0
|
||||
e++
|
||||
ios.displayTile(f,a,b,c,e,d) 'einzelnes Tile anzeigen ('displayTile(tnr,pcol,scol,tcol, row, column))
|
||||
|
||||
d++
|
||||
PRI printdec(value,y,xx,hint,vor) | i ,c ,x 'screen: dezimalen zahlenwert auf bildschirm ausgeben
|
||||
{{printdec(value) - screen: dezimale bildschirmausgabe zahlenwertes}}
|
||||
' if value < 0 'negativer zahlenwert
|
||||
' -value
|
||||
'printchar("-")
|
||||
|
||||
i := 1_000_000_000
|
||||
repeat 10 'zahl zerlegen
|
||||
if value => i
|
||||
x:=value / i + "0"
|
||||
ios.displayTile(x-16,hint,0,vor,y,xx) 'printchar(x)
|
||||
xx++
|
||||
c:=value / i + "0"
|
||||
value //= i
|
||||
result~~
|
||||
elseif result or i == 1
|
||||
printfont(string("0"),hint,0,vor,xx,y) 'printchar("0")
|
||||
xx++
|
||||
i /= 10 'nächste stelle
|
||||
con '************************************************** Button-Funktionen ********************************************************************************************************
|
||||
|
||||
PRI buttonpress(n)
|
||||
case n
|
||||
1:printfont(@butOK,250,0,0,buttonx[n],buttony[n])
|
||||
2:printfont(@Abbr,250,0,0,buttonx[n],buttony[n])
|
||||
|
||||
Mouse_Release
|
||||
case n
|
||||
1:printfont(@butOK,colors[hcolstatus],0,colors[statustextcol],buttonx[n],buttony[n])
|
||||
2:printfont(@Abbr,colors[Buttonhcol],0,colors[buttontextcol],buttonx[n],buttony[n])
|
||||
|
||||
|
||||
|
||||
PRI rahmen(x,y,xx,yy)|i
|
||||
win_tile(137,y,x)
|
||||
win_tile(136,yy,x)
|
||||
win_tile(157,y,xx)
|
||||
win_tile(119,yy,xx)
|
||||
repeat i from y+1 to yy-1
|
||||
win_tile(2,i,x)
|
||||
win_tile(114,i,xx)
|
||||
line(x+1,y,xx-1)
|
||||
line(x+1,yy,xx-1)
|
||||
|
||||
PRI line(x,y,xx)|i
|
||||
repeat i from x to xx
|
||||
win_tile(130,y,i)
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,244 @@
|
|||
{{ Bellatrix-Code
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Autor: Ingo Kripahle │
|
||||
│ Copyright (c) 2012 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 : mental
|
||||
Name :
|
||||
Chip : global
|
||||
Typ : Konstanten
|
||||
|
||||
|
||||
}}
|
||||
|
||||
con ' signaldefinitionen
|
||||
|
||||
'signaldefinitionen global
|
||||
|
||||
#0, D0,D1,D2,D3,D4,D5,D6,D7 'datenbus
|
||||
#24, HBEAT 'front-led
|
||||
BUSCLK 'bustakt
|
||||
BUS_WR '/wr - schreibsignal
|
||||
BUS_HS ' '/hs - quittungssignal
|
||||
I2C_SCL
|
||||
I2C_SDA
|
||||
SER_TX
|
||||
SER_RX
|
||||
|
||||
|
||||
'signaldefinitionen bellatrix
|
||||
|
||||
#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
|
||||
|
||||
|
||||
'signaldefinitionen administra
|
||||
|
||||
#8, ADM_SOUNDL,ADM_SOUNDR 'sound (stereo 2 pin)
|
||||
#10, ADM_SDD0,ADM_SDCLK,ADM_SDCMD,ADM_SDD3 'sd-cardreader (4 pin)
|
||||
#23, ADM_SELECT 'administra-auswahlsignal
|
||||
|
||||
con ' administra-funktionen
|
||||
|
||||
ADM_OPT = 0
|
||||
|
||||
'sdcard-funktionen
|
||||
ADM_SD_MOUNT = 1
|
||||
ADM_SD_CHECKMOUNTED = 2
|
||||
ADM_SD_UNMOUNT = 3
|
||||
ADM_SD_OPEN = 4
|
||||
ADM_SD_CLOSE = 5
|
||||
ADM_SD_GETC = 6
|
||||
ADM_SD_PUTC = 7
|
||||
ADM_SD_EOF = 8
|
||||
ADM_SD_GETBLK = 9
|
||||
|
||||
ADM_SCR_FILL = 11 'screenpuffer mit zeichen füllen
|
||||
ADM_SCR_READ = 12 'screen in den puffer laden
|
||||
ADM_SCR_WRITE = 13 'screen auf disk schreiben
|
||||
ADM_SCR_GETNR = 14 'nummer des aktuellen screens abfragen
|
||||
ADM_SCR_SETPOS = 15 'zeiger auf position im puffer setzen
|
||||
ADM_SCR_GETPOS = 16 'aktuelle position im puffer abfragen
|
||||
ADM_SCR_GETC = 17 'zeichen wird aus dem puffer gelesen
|
||||
ADM_SCR_PUTC = 18 'zeichen wird in den puffer geschrieben
|
||||
ADM_SCR_ERR = 19 'fehlerstatus abfragen
|
||||
ADM_SCR_MAXSCR = 20 'anzahl screens des containers abfragen
|
||||
ADM_SCR_EOS = 21 'end of screen abfragen
|
||||
ADM_SCR_CALL = 22 'subscreen aufrufen
|
||||
ADM_SCR_RET = 23 'subscreen beenden
|
||||
ADM_SCR_USE = 24 'tape öffnen
|
||||
ADM_SCR_TAPES = 25 'tapeliste abfragen
|
||||
|
||||
ADM_M_PARSE = 30 'nächstes token aus screen parsen
|
||||
ADM_M_SETBASE = 31 'zahlenbasis setzen
|
||||
|
||||
ADM_COM_TX = 40 'com: zeichen senden
|
||||
ADM_COM_RX = 41 'com: zeichen empfangen
|
||||
|
||||
adm_m_run = 50 'plx: polling aktivieren
|
||||
adm_m_halt = 51 'plx: polling anhalten
|
||||
adm_m_setctrl = 52
|
||||
adm_m_in = 53
|
||||
adm_m_out = 54
|
||||
adm_m_ad_ch = 55
|
||||
adm_m_getreg = 56
|
||||
adm_m_setreg = 57
|
||||
adm_m_start = 58
|
||||
adm_m_stop = 59
|
||||
adm_m_write = 60
|
||||
adm_m_read = 61
|
||||
adm_m_ping = 62
|
||||
adm_m_joy = 63
|
||||
adm_m_paddle = 64
|
||||
adm_m_pad = 65
|
||||
adm_m_setjoy = 66
|
||||
adm_m_setpad = 67
|
||||
|
||||
adm_m_chan = 70
|
||||
adm_m_regclr = 71
|
||||
adm_m_setvol = 72
|
||||
adm_m_play = 73
|
||||
adm_m_noteon = 74
|
||||
adm_m_noteoff = 75
|
||||
adm_m_setfreq = 76
|
||||
adm_m_setwave = 77
|
||||
adm_m_setpw = 78
|
||||
adm_m_setadsr = 79
|
||||
adm_m_setres = 80
|
||||
adm_m_setcoff = 81
|
||||
adm_m_setfmask = 82
|
||||
adm_m_setftype = 83
|
||||
adm_m_ringmod = 84
|
||||
adm_m_sync = 85
|
||||
|
||||
adm_m_getspec = 97 'spezifikation abfragen
|
||||
adm_m_getver = 98 'codeversion abfragen
|
||||
adm_m_reboot = 99 'neu starten
|
||||
|
||||
'plexbus
|
||||
adm_sda = 19 'i2c-datenpin
|
||||
adm_scl = 20 'i2c-clockpin
|
||||
adm_int1 = 21 'interrupt port 1&2
|
||||
adm_int2 = 22 'interrupt port 3
|
||||
|
||||
|
||||
con ' bellatrix-funktionen
|
||||
|
||||
' ---------------------------------------------- FUNKTIONEN
|
||||
|
||||
bel_key_stat = 1 'tastaturstatus abfragen
|
||||
bel_key_code = 2 'tastaturzeichen abfragen
|
||||
bel_key_spec = 3 'sondertasten abfragen
|
||||
bel_key_wait = 4 'auf tastaturzeichen warten
|
||||
bel_pchar = 5 'zeichen ohne steuerzeichen augeben
|
||||
bel_setx = 6 'x-position setzen
|
||||
bel_sety = 7 'y-position setzen
|
||||
bel_getx = 8 'x-position abfragen
|
||||
bel_gety = 9 'y-position abfragen
|
||||
bel_color = 10 'farbe setzen
|
||||
bel_sline = 11 'startzeile scrollbereich
|
||||
bel_eline = 12 'endzeile scrollbereich
|
||||
bel_settab = 13 'tabulatorposition setzen
|
||||
|
||||
bel_cls = 1
|
||||
bel_home = 2
|
||||
bel_pos1 = 3
|
||||
bel_curon = 4
|
||||
bel_curoff = 5
|
||||
bel_up = 6
|
||||
bel_down = 7
|
||||
bel_bs = 8
|
||||
bel_tab = 9
|
||||
bel_nl = 13
|
||||
|
||||
' ---------------------------------------------- M-FUNKTIONEN
|
||||
|
||||
bel_m_parse = 20 'nächstes token von eingabezeile parsen
|
||||
bel_m_setbase = 21 'base setzen
|
||||
bel_m_dot = 22 'formatierte ausgabe eines zahlenwertes
|
||||
bel_m_error = 23 'm fehlermeldung
|
||||
|
||||
' ---------------------------------------------- SCREENEDITOR
|
||||
|
||||
bel_scr_edit = 24 'screeneditor
|
||||
bel_scr_put = 25 'screen empfangen
|
||||
bel_scr_get = 26 'screen senden
|
||||
bel_scr_setnr = 27 'screennummer setzen
|
||||
|
||||
' ---------------------------------------------- CHIP-MANAGMENT
|
||||
|
||||
bel_mgr_setcolor= 97 'neuen bellatrix-code laden
|
||||
bel_mgr_load = 98 'farbregister setzen
|
||||
bel_reboot = 99 'bellatrix neu starten
|
||||
|
||||
con ' color-tags
|
||||
|
||||
M_C_TAG1 = $16 'wort ausführen
|
||||
M_C_TAG2 = $17 'wort definieren
|
||||
M_C_TAG3 = $18 'wort compilieren
|
||||
M_C_TAG4 = $19 'zahl
|
||||
M_C_TAG5 = $1A 'zahl literal
|
||||
M_C_TAG6 = $1B 'string
|
||||
M_C_TAG7 = $1C 'string literal
|
||||
M_C_TAG8 = $1D 'data
|
||||
M_C_TAG9 = $1E 'kommentar
|
||||
M_C_TAG10 = $1F 'eos/cursor
|
||||
|
||||
|
||||
M_C_EXECUTE = M_C_TAG1
|
||||
M_C_CREATE = M_C_TAG2
|
||||
M_C_COMPILE = M_C_TAG3
|
||||
M_C_NUMBER = M_C_TAG4
|
||||
M_C_NUMBERLIT = M_C_TAG5
|
||||
M_C_STRING = M_C_TAG6
|
||||
M_C_STRINGLIT = M_C_TAG7
|
||||
M_C_DATA = M_C_TAG8
|
||||
M_C_REMARK = M_C_TAG9
|
||||
|
||||
M_C_MAX = M_C_TAG9 ' tag mit höchstem wert
|
||||
|
||||
M_C_EOS = M_C_TAG10 ' end of screen tag für den adm-parser
|
||||
|
||||
con ' farbzuordnung
|
||||
C_EXECUTE = 0
|
||||
C_CREATE = 1
|
||||
C_COMPILE = 2
|
||||
C_NUMBER = 3
|
||||
C_NUMBERLIT = 4
|
||||
C_STRING = 5
|
||||
C_STRINGLIT = 6
|
||||
C_DATA = 7
|
||||
C_REMARK = 8
|
||||
|
||||
C_CURSOR = 15 ' cursorfarbe
|
||||
C_NORMAL = 0 ' normale ausgabefarbe
|
||||
C_INFO = 8 ' farbe für infos
|
||||
C_ATTENTION = 1 ' farbe für hinweise
|
||||
|
||||
con ' fehlercodes
|
||||
|
||||
M_ERR_NO = 0 ' kein fehler
|
||||
M_ERR_RS = 1 ' returnstack fehler
|
||||
M_ERR_DS = 2 ' datenstack fehler
|
||||
M_ERR_IN = 3 ' fehler interpreter
|
||||
M_ERR_CP = 4 ' fehler compiler
|
||||
M_ERR_SI = 5 ' strukturfehler
|
||||
M_ERR_SD = 6 ' datenträgerfehler
|
||||
M_ERR_RW = 7 ' schreib/lesefehler
|
||||
M_ERR_NF = 8 ' not found
|
||||
M_ERR_ST = 9 ' stackfehler
|
||||
|
||||
|
||||
pub dummy
|
||||
|
||||
' diese routine muss vorhanden sein,
|
||||
' da sonst kein objekt erzeugt und eingebunden wird
|
||||
|
|
@ -0,0 +1,492 @@
|
|||
''***************************************
|
||||
''* PS/2 Mouse Driver v1.1 *
|
||||
''* Author: Chip Gracey *
|
||||
''* Copyright (c) 2006 Parallax, Inc. *
|
||||
''* See end of file for terms of use. *
|
||||
''***************************************
|
||||
|
||||
' v1.0 - 01 May 2006 - original version
|
||||
' v1.1 - 01 Jun 2006 - bound coordinates added to simplify upper objects
|
||||
|
||||
|
||||
VAR
|
||||
|
||||
long cog
|
||||
|
||||
long oldx, oldy, oldz 'must be followed by parameters (10 contiguous longs)
|
||||
|
||||
long par_x 'absolute x read-only (7 contiguous longs)
|
||||
long par_y 'absolute y read-only
|
||||
long par_z 'absolute z read-only
|
||||
long par_buttons 'button states read-only
|
||||
long par_present 'mouse present read-only
|
||||
long par_dpin 'data pin write-only
|
||||
long par_cpin 'clock pin write-only
|
||||
|
||||
long bx_min, by_min, bz_min 'min/max must be contiguous
|
||||
long bx_max, by_max, bz_max
|
||||
long bx_div, by_div, bz_div
|
||||
long bx_acc, by_acc, bz_acc
|
||||
|
||||
|
||||
PUB start(dpin, cpin) : okay
|
||||
|
||||
'' Start mouse driver - starts a cog
|
||||
'' returns false if no cog available
|
||||
''
|
||||
'' dpin = data signal on PS/2 jack
|
||||
'' cpin = clock signal on PS/2 jack
|
||||
''
|
||||
'' use 100-ohm resistors between pins and jack
|
||||
'' use 10K-ohm resistors to pull jack-side signals to VDD
|
||||
'' connect jack-power to 5V, jack-gnd to VSS
|
||||
|
||||
stop
|
||||
par_dpin := dpin
|
||||
par_cpin := cpin
|
||||
okay := cog := cognew(@entry, @par_x) + 1
|
||||
|
||||
|
||||
PUB stop
|
||||
|
||||
'' Stop mouse driver - frees a cog
|
||||
|
||||
if cog
|
||||
cogstop(cog~ - 1)
|
||||
longfill(@oldx, 0, 10)
|
||||
|
||||
|
||||
PUB present : type
|
||||
|
||||
'' Check if mouse present - valid ~2s after start
|
||||
'' returns mouse type:
|
||||
''
|
||||
'' 3 = five-button scrollwheel mouse
|
||||
'' 2 = three-button scrollwheel mouse
|
||||
'' 1 = two-button or three-button mouse
|
||||
'' 0 = no mouse connected
|
||||
|
||||
type := par_present
|
||||
|
||||
|
||||
PUB button(b) : state
|
||||
|
||||
'' Get the state of a particular button
|
||||
'' returns t|f
|
||||
|
||||
state := -(par_buttons >> b & 1)
|
||||
|
||||
|
||||
PUB buttons : states
|
||||
|
||||
'' Get the states of all buttons
|
||||
'' returns buttons:
|
||||
''
|
||||
'' bit4 = right-side button
|
||||
'' bit3 = left-side button
|
||||
'' bit2 = center/scrollwheel button
|
||||
'' bit1 = right button
|
||||
'' bit0 = left button
|
||||
|
||||
states := par_buttons
|
||||
|
||||
|
||||
{PUB abs_x : x
|
||||
|
||||
'' Get absolute-x
|
||||
|
||||
x := par_x
|
||||
|
||||
|
||||
PUB abs_y : y
|
||||
|
||||
'' Get absolute-y
|
||||
|
||||
y := par_y
|
||||
|
||||
}
|
||||
PUB abs_z : z
|
||||
|
||||
'' Get absolute-z (scrollwheel)
|
||||
|
||||
z := par_z
|
||||
|
||||
|
||||
{PUB delta_reset
|
||||
|
||||
'' Reset deltas
|
||||
|
||||
oldx := par_x
|
||||
oldy := par_y
|
||||
oldz := par_z
|
||||
|
||||
}
|
||||
PUB delta_x : x | newx
|
||||
|
||||
'' Get delta-x
|
||||
|
||||
newx := par_x
|
||||
x := newx - oldx
|
||||
oldx := newx
|
||||
|
||||
|
||||
PUB delta_y : y | newy
|
||||
|
||||
'' Get delta-y
|
||||
|
||||
newy := par_y
|
||||
y := newy - oldy
|
||||
oldy := newy
|
||||
|
||||
|
||||
PUB delta_z : z | newz
|
||||
|
||||
'' Get delta-z (scrollwheel)
|
||||
|
||||
newz := par_z
|
||||
z := newz - oldz
|
||||
oldz := newz
|
||||
|
||||
|
||||
PUB bound_limits(xmin, ymin, zmin, xmax, ymax, zmax) | i
|
||||
|
||||
'' Set bounding limits
|
||||
|
||||
longmove(@bx_min, @xmin, 6)
|
||||
|
||||
|
||||
PUB bound_scales(x_scale, y_scale, z_scale)
|
||||
|
||||
'' Set bounding scales (usually +/-1's, bigger values divide)
|
||||
|
||||
longmove(@bx_div, @x_scale, 3)
|
||||
|
||||
|
||||
PUB bound_preset(x, y, z) | i, d
|
||||
|
||||
'' Preset bound coordinates
|
||||
|
||||
repeat i from 0 to 2
|
||||
d := ||bx_div[i]
|
||||
bx_acc[i] := (x[i] - bx_min[i]) * d + d >> 1
|
||||
|
||||
|
||||
PUB bound_x : x
|
||||
|
||||
'' Get bound-x
|
||||
|
||||
x := bound(0, delta_x)
|
||||
|
||||
|
||||
PUB bound_y : y
|
||||
|
||||
'' Get bound-y
|
||||
|
||||
y := bound(1, delta_y)
|
||||
|
||||
|
||||
PUB bound_z : z
|
||||
|
||||
'' Get bound-z
|
||||
|
||||
z := bound(2, delta_z)
|
||||
|
||||
|
||||
PRI bound(i, delta) : b | d
|
||||
|
||||
d := bx_div[i]
|
||||
b := bx_min[i] + (bx_acc[i] := bx_acc[i] + delta * (d < 0) | 1 #> 0 <# (bx_max[i] - bx_min[i] + 1) * ||d - 1) / ||d
|
||||
|
||||
|
||||
DAT
|
||||
|
||||
'***************************************
|
||||
'* Assembly language PS/2 mouse driver *
|
||||
'***************************************
|
||||
|
||||
org
|
||||
'
|
||||
'
|
||||
' Entry
|
||||
'
|
||||
entry mov p,par 'load input parameters:
|
||||
add p,#5*4 '_dpin/_cpin
|
||||
rdlong _dpin,p
|
||||
add p,#4
|
||||
rdlong _cpin,p
|
||||
|
||||
mov dmask,#1 'set pin masks
|
||||
shl dmask,_dpin
|
||||
mov cmask,#1
|
||||
shl cmask,_cpin
|
||||
|
||||
test _dpin,#$20 wc 'modify port registers within code
|
||||
muxc _d1,dlsb
|
||||
muxc _d2,dlsb
|
||||
muxc _d3,#1
|
||||
muxc _d4,#1
|
||||
test _cpin,#$20 wc
|
||||
muxc _c1,dlsb
|
||||
muxc _c2,dlsb
|
||||
muxc _c3,#1
|
||||
|
||||
movd :par,#_x 'reset output parameters:
|
||||
mov p,#5 '_x/_y/_z/_buttons/_present
|
||||
:par mov 0,#0
|
||||
add :par,dlsb
|
||||
djnz p,#:par
|
||||
'
|
||||
'
|
||||
' Reset mouse
|
||||
'
|
||||
reset mov dira,#0 'reset directions
|
||||
mov dirb,#0
|
||||
|
||||
mov stat,#1 'set reset flag
|
||||
'
|
||||
'
|
||||
' Update parameters
|
||||
'
|
||||
update movd :par,#_x 'update output parameters:
|
||||
mov p,par '_x/_y/_z/_buttons/_present
|
||||
mov q,#5
|
||||
:par wrlong 0,p
|
||||
add :par,dlsb
|
||||
add p,#4
|
||||
djnz q,#:par
|
||||
|
||||
test stat,#1 wc 'if reset flag, transmit reset command
|
||||
if_c mov data,#$FF
|
||||
if_c call #transmit
|
||||
'
|
||||
'
|
||||
' Get data packet
|
||||
'
|
||||
mov stat,#0 'reset state
|
||||
|
||||
call #receive 'receive first byte
|
||||
|
||||
cmp data,#$AA wz 'powerup/reset?
|
||||
if_z jmp #init
|
||||
|
||||
mov _buttons,data 'data packet, save buttons
|
||||
|
||||
call #receive 'receive second byte
|
||||
|
||||
test _buttons,#$10 wc 'adjust _x
|
||||
muxc data,signext
|
||||
add _x,data
|
||||
|
||||
call #receive 'receive third byte
|
||||
|
||||
test _buttons,#$20 wc 'adjust _y
|
||||
muxc data,signext
|
||||
add _y,data
|
||||
|
||||
and _buttons,#%111 'trim buttons
|
||||
|
||||
cmp _present,#2 wc 'if not scrollwheel mouse, update parameters
|
||||
if_c jmp #update
|
||||
|
||||
|
||||
call #receive 'scrollwheel mouse, receive fourth byte
|
||||
|
||||
cmp _present,#3 wz 'if 5-button mouse, handle two extra buttons
|
||||
if_z test data,#$10 wc
|
||||
if_z_and_c or _buttons,#%01000
|
||||
if_z test data,#$20 wc
|
||||
if_z_and_c or _buttons,#%10000
|
||||
|
||||
shl data,#28 'adjust _z
|
||||
sar data,#28
|
||||
sub _z,data
|
||||
|
||||
jmp #update 'update parameters
|
||||
'
|
||||
'
|
||||
' Initialize mouse
|
||||
'
|
||||
init call #receive '$AA received, receive id
|
||||
|
||||
movs crate,#100 'try to enable 3-button scrollwheel type
|
||||
call #checktype
|
||||
movs crate,#200 'try to enable 5-button scrollwheel type
|
||||
call #checktype
|
||||
shr data,#1 'if neither, 3-button type
|
||||
add data,#1
|
||||
mov _present,data
|
||||
|
||||
movs srate,#200 'set 200 samples per second
|
||||
call #setrate
|
||||
|
||||
mov data,#$F4 'enable data reporting
|
||||
call #transmit
|
||||
|
||||
jmp #update
|
||||
'
|
||||
'
|
||||
' Check mouse type
|
||||
'
|
||||
checktype movs srate,#200 'perform "knock" sequence to enable
|
||||
call #setrate '..scrollwheel and extra buttons
|
||||
|
||||
crate movs srate,#200/100
|
||||
call #setrate
|
||||
|
||||
movs srate,#80
|
||||
call #setrate
|
||||
|
||||
mov data,#$F2 'read type
|
||||
call #transmit
|
||||
call #receive
|
||||
|
||||
checktype_ret ret
|
||||
'
|
||||
'
|
||||
' Set sample rate
|
||||
'
|
||||
setrate mov data,#$F3
|
||||
call #transmit
|
||||
srate mov data,#0
|
||||
call #transmit
|
||||
|
||||
setrate_ret ret
|
||||
'
|
||||
'
|
||||
' Transmit byte to mouse
|
||||
'
|
||||
transmit
|
||||
_c1 or dira,cmask 'pull clock low
|
||||
movs napshr,#13 'hold clock for ~128us (must be >100us)
|
||||
call #nap
|
||||
_d1 or dira,dmask 'pull data low
|
||||
movs napshr,#18 'hold data for ~4us
|
||||
call #nap
|
||||
_c2 xor dira,cmask 'release clock
|
||||
|
||||
test data,#$0FF wc 'append parity and stop bits to byte
|
||||
muxnc data,#$100
|
||||
or data,dlsb
|
||||
|
||||
mov p,#10 'ready 10 bits
|
||||
transmit_bit call #wait_c0 'wait until clock low
|
||||
shr data,#1 wc 'output data bit
|
||||
_d2 muxnc dira,dmask
|
||||
mov wcond,c1 'wait until clock high
|
||||
call #wait
|
||||
djnz p,#transmit_bit 'another bit?
|
||||
|
||||
mov wcond,c0d0 'wait until clock and data low
|
||||
call #wait
|
||||
mov wcond,c1d1 'wait until clock and data high
|
||||
call #wait
|
||||
|
||||
call #receive_ack 'receive ack byte with timed wait
|
||||
cmp data,#$FA wz 'if ack error, reset mouse
|
||||
if_nz jmp #reset
|
||||
|
||||
transmit_ret ret
|
||||
'
|
||||
'
|
||||
' Receive byte from mouse
|
||||
'
|
||||
receive test _cpin,#$20 wc 'wait indefinitely for initial clock low
|
||||
waitpne cmask,cmask
|
||||
receive_ack
|
||||
mov p,#11 'ready 11 bits
|
||||
receive_bit call #wait_c0 'wait until clock low
|
||||
movs napshr,#16 'pause ~16us
|
||||
call #nap
|
||||
_d3 test dmask,ina wc 'input data bit
|
||||
rcr data,#1
|
||||
mov wcond,c1 'wait until clock high
|
||||
call #wait
|
||||
djnz p,#receive_bit 'another bit?
|
||||
|
||||
shr data,#22 'align byte
|
||||
test data,#$1FF wc 'if parity error, reset mouse
|
||||
if_nc jmp #reset
|
||||
and data,#$FF 'isolate byte
|
||||
|
||||
receive_ack_ret
|
||||
receive_ret ret
|
||||
'
|
||||
'
|
||||
' Wait for clock/data to be in required state(s)
|
||||
'
|
||||
wait_c0 mov wcond,c0 '(wait until clock low)
|
||||
|
||||
wait mov q,tenms 'set timeout to 10ms
|
||||
|
||||
wloop movs napshr,#18 'nap ~4us
|
||||
call #nap
|
||||
_c3 test cmask,ina wc 'check required state(s)
|
||||
_d4 test dmask,ina wz 'loop until got state(s) or timeout
|
||||
wcond if_never djnz q,#wloop '(replaced with c0/c1/c0d0/c1d1)
|
||||
|
||||
tjz q,#reset 'if timeout, reset mouse
|
||||
wait_ret
|
||||
wait_c0_ret ret
|
||||
|
||||
|
||||
c0 if_c djnz q,#wloop '(if_never replacements)
|
||||
c1 if_nc djnz q,#wloop
|
||||
c0d0 if_c_or_nz djnz q,#wloop
|
||||
c1d1 if_nc_or_z djnz q,#wloop
|
||||
'
|
||||
'
|
||||
' Nap
|
||||
'
|
||||
nap rdlong t,#0 'get clkfreq
|
||||
napshr shr t,#18/16/13 'shr scales time
|
||||
min t,#3 'ensure waitcnt won't snag
|
||||
add t,cnt 'add cnt to time
|
||||
waitcnt t,#0 'wait until time elapses (nap)
|
||||
|
||||
nap_ret ret
|
||||
'
|
||||
'
|
||||
' Initialized data
|
||||
'
|
||||
dlsb long 1 << 9
|
||||
tenms long 10_000 / 4
|
||||
signext long $FFFFFF00
|
||||
'
|
||||
'
|
||||
' Uninitialized data
|
||||
'
|
||||
dmask res 1
|
||||
cmask res 1
|
||||
stat res 1
|
||||
data res 1
|
||||
p res 1
|
||||
q res 1
|
||||
t res 1
|
||||
|
||||
_x res 1 'write-only
|
||||
_y res 1 'write-only
|
||||
_z res 1 'write-only
|
||||
_buttons res 1 'write-only
|
||||
_present res 1 'write-only
|
||||
_dpin res 1 'read-only
|
||||
_cpin res 1 'read-only
|
||||
|
||||
|
||||
{{
|
||||
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ 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. │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
}}
|
|
@ -0,0 +1,344 @@
|
|||
{{
|
||||
|
||||
Hive-Computer-Projekt
|
||||
|
||||
Name : Peek and Poke
|
||||
Chip : Regnatix-Code (ramtest)
|
||||
Version : 0.1
|
||||
Dateien : ram_pasm.spin
|
||||
|
||||
Beschreibung :
|
||||
}}
|
||||
CON
|
||||
|
||||
_CLKMODE = XTAL1 + PLL16X
|
||||
_XINFREQ = 5_000_000
|
||||
DB_IN = %00000111_11111111_11111111_00000000 'maske: dbus-eingabe
|
||||
|
||||
#0,JOB_NONE,JOB_POKE,JOB_PEEK,JOB_FILL,JOB_WRLONG,JOB_RDLONG,JOB_WRWORD,JOB_RDWORD,DO_READ,DO_WRITE,PUT_BYTE,GET_BYTE
|
||||
VAR
|
||||
long CogNr
|
||||
long JobNr ' 3 continue params
|
||||
long Address
|
||||
long Value
|
||||
long Anzahl
|
||||
long Werte
|
||||
|
||||
pub rd_value(adr,m):w
|
||||
Address := adr
|
||||
Value := m
|
||||
dira := 0
|
||||
JobNr := DO_READ
|
||||
repeat until JobNr == JOB_NONE
|
||||
dira := DB_IN
|
||||
w := Werte
|
||||
|
||||
pub wr_value(adr,val,m)
|
||||
Address := adr
|
||||
Value := val
|
||||
Anzahl := m
|
||||
dira := 0
|
||||
JobNr := DO_WRITE
|
||||
repeat until JobNr == JOB_NONE
|
||||
dira := DB_IN
|
||||
|
||||
{pub get_value(chip,m):w
|
||||
Address := chip
|
||||
Value := m
|
||||
dira := 0
|
||||
JobNr := GET_BYTE
|
||||
repeat until JobNr == JOB_NONE
|
||||
dira := DB_IN
|
||||
w := Werte
|
||||
|
||||
pub put_value(chip,m)
|
||||
Address := chip
|
||||
Value := m
|
||||
dira := 0
|
||||
JobNr := PUT_BYTE
|
||||
repeat until JobNr == JOB_NONE
|
||||
dira := DB_IN
|
||||
}
|
||||
pub ram_fill(adr,anz,wert)
|
||||
|
||||
Address:=adr
|
||||
Value :=wert
|
||||
Anzahl :=anz
|
||||
dira :=0
|
||||
JobNr :=JOB_FILL
|
||||
repeat until JobNr==JOB_NONE
|
||||
dira:=DB_IN
|
||||
|
||||
|
||||
Pub Start
|
||||
CogNr := cognew(@cog_loop,@JobNr)
|
||||
|
||||
Pub Stop
|
||||
if CogNr==-1
|
||||
return
|
||||
cogstop(CogNr)
|
||||
CogNr:=-1
|
||||
DAT ORG 0
|
||||
|
||||
cog_loop rdlong _job,par wz ' get job id
|
||||
if_z jmp #cog_loop
|
||||
|
||||
cmp _job,#DO_WRITE wz
|
||||
if_z jmp #cog_write
|
||||
|
||||
cmp _job,#DO_READ wz
|
||||
if_z jmp #cog_read
|
||||
|
||||
cmp _job,#JOB_FILL wz
|
||||
if_z jmp #cog_fill
|
||||
|
||||
{ cmp _job,#PUT_BYTE wz
|
||||
if_z jmp #cog_put
|
||||
|
||||
cmp _job,#GET_BYTE wz
|
||||
if_z jmp #cog_get
|
||||
}
|
||||
jmp #cog_loop
|
||||
|
||||
|
||||
'**************************************************************************************
|
||||
|
||||
cog_ready mov _ptr,par
|
||||
mov _job,#JOB_NONE
|
||||
wrlong _job,_ptr
|
||||
|
||||
jmp #cog_loop
|
||||
'######################################################################################
|
||||
'######################################################################################
|
||||
{cog_get call #sub_param
|
||||
cmp _adr,#1 wz
|
||||
if_z jmp #adm_get
|
||||
|
||||
|
||||
cog_put call #sub_param
|
||||
cmp _adr,#1 wz
|
||||
if_z jmp #adm_put
|
||||
' cmp _adr,#2 wz
|
||||
'if_z jmp #bel_put
|
||||
' cmp _adr,#3 wz
|
||||
'if_z jmp #ven_put
|
||||
|
||||
adm_put
|
||||
' zeichen zu administra senden
|
||||
' waitpeq _hs,_hs ' warte auf hs=1 (slave bereit)
|
||||
and _val,#$ff ' wert maskieren
|
||||
or _val,_a1 ' + bel=0 wr=0 clk=0
|
||||
mov outa,_val ' daten + signale ausgeben
|
||||
mov dira,_DIR_OUT ' bus auf ausgabe schalten
|
||||
or outa,_a2 ' clk=0 --> clk=1
|
||||
waitpeq _zero,_hs ' warte auf hs=0
|
||||
mov dira,_DIR_IN ' bus auf eingabe schalten
|
||||
mov outa,_s1 ' bussignale inaktiv
|
||||
jmp #cog_ready
|
||||
|
||||
adm_get ' zeichen von administra empfangen
|
||||
waitpeq _hs,_hs ' warte auf hs=1 (slave bereit)
|
||||
mov outa,_a3 ' bel=0 wr=1 clk=1
|
||||
waitpeq _zero,_hs ' warte auf hs=0
|
||||
mov _val,ina ' daten einlesen
|
||||
and _val,#$ff ' wert maskieren
|
||||
mov outa,_s1 ' bussignale inaktiv
|
||||
mov _tmp,_val
|
||||
jmp cog_subpeek
|
||||
|
||||
}
|
||||
'######################################################################################
|
||||
{ outa := %00001001_01011000_00000000_00000000 'prop1=0, wr=0
|
||||
dira := db_out 'datenbus auf ausgabe stellen
|
||||
outa[7..0] := c 'daten --> dbus
|
||||
outa[busclk] := 1 'busclk=1
|
||||
waitpeq(%00000000_00000000_00000000_00000000,%00001000_00000000_00000000_00000000,0) 'hs=0?
|
||||
dira := db_in 'bus freigeben
|
||||
outa := %00001101_01111000_00000000_00000000 'wr=1, prop1=1, busclk=0
|
||||
}
|
||||
'######################################################################################
|
||||
|
||||
'**************************************************************************************
|
||||
|
||||
cog_subpeek add _ptr,#4 ' Ergebnis nach Werte übergeben next param
|
||||
wrlong _tmp,_ptr
|
||||
|
||||
jmp #cog_ready
|
||||
'**************************************************************************************
|
||||
'########## Parameterfeld (3-Parameter) einlesen###############
|
||||
sub_param mov _ptr,par ' pointer of params
|
||||
add _ptr,#4 ' move to param 1
|
||||
rdlong _adr,_ptr ' get address1
|
||||
add _ptr,#4 ' move to param 2
|
||||
rdlong _val,_ptr ' wert
|
||||
add _ptr,#4 ' move to param 3
|
||||
rdlong _count,_ptr ' lese Jobnummer
|
||||
sub_param_ret ret
|
||||
|
||||
'**************************************************************************************
|
||||
|
||||
cog_fill call #sub_param
|
||||
mov _ftemp,_adr ' adresse merken
|
||||
|
||||
loop_fill call #sub_poke ' schreiben
|
||||
add _ftemp, #1 'adr := adr + 1
|
||||
mov _adr,_ftemp 'adresse zurueckschreiben
|
||||
djnz _count, #loop_fill 'nächste zelle bis _count = 0
|
||||
|
||||
jmp #cog_ready
|
||||
'**************************************************************************************
|
||||
cog_write call #sub_param
|
||||
mov _ftemp,_adr ' adresse merken
|
||||
mov _RegA,_val ' wert merken
|
||||
mov _RegB,#8 ' shiftwert
|
||||
mov _RegC,#3 ' Zaehlerschleifenwert
|
||||
call #sub_poke
|
||||
|
||||
cmp _count,#JOB_POKE wz 'wenn nur poke hier aussteigen
|
||||
if_z jmp #cog_ready
|
||||
|
||||
loop_wrlong mov _val,_RegA
|
||||
shr _val,_RegB 'wert>>8
|
||||
add _RegB,#8 'shiftwert um 8 erhoehen
|
||||
add _ftemp, #1 'adr := adr + 1
|
||||
mov _adr,_ftemp 'adresse zurueckschreiben
|
||||
call #sub_poke
|
||||
|
||||
cmp _count,#JOB_WRWORD wz 'wenn wrword hier aussteigen
|
||||
if_z jmp #cog_ready
|
||||
|
||||
djnz _RegC,#loop_wrlong
|
||||
|
||||
jmp #cog_ready
|
||||
|
||||
'**************************************************************************************
|
||||
cog_read call #sub_param
|
||||
|
||||
mov _ftemp,_adr ' adresse merken
|
||||
mov _RegA,#8 ' shiftwert
|
||||
mov _RegC,#3 ' Schleifenzaehler
|
||||
|
||||
call #sub_peek
|
||||
|
||||
cmp _val,#JOB_PEEK wz 'wenn nur peek hier aussteigen
|
||||
if_z jmp #cog_subpeek
|
||||
|
||||
call #rd_wr
|
||||
|
||||
loop_rd call #sub_peek
|
||||
shl _tmp,_RegA
|
||||
add _tmp,_RegB
|
||||
call #rd_wr
|
||||
|
||||
cmp _val,#JOB_RDWORD wz 'wenn rdword, dann hier raus
|
||||
if_z jmp #cog_subrdword
|
||||
|
||||
add _regA,#8
|
||||
djnz _RegC,#loop_rd
|
||||
|
||||
cog_subrdword add _ptr,#4 ' next param
|
||||
wrlong _RegB,_ptr
|
||||
|
||||
jmp #cog_ready
|
||||
|
||||
|
||||
'**************************************************************************************
|
||||
rd_wr mov _RegB,_tmp
|
||||
add _ftemp,#1 'adresse+1
|
||||
mov _adr,_ftemp 'adresse zurueckschreiben
|
||||
rd_wr_ret ret
|
||||
'**************************************************************************************
|
||||
|
||||
'**************************************************************************************
|
||||
sub_poke mov _tmp,_adr ' make a copy
|
||||
and _val,#$FF ' only D7-D0
|
||||
' BUS
|
||||
mov outa,_BUS_INIT ' all de-selected
|
||||
mov dira,_DIR_OUT ' D7..D0 as output
|
||||
call #setadr
|
||||
|
||||
or _adr,_val ' D7-D0
|
||||
or _adr,_BUS_INIT ' BUS
|
||||
and _tmp,_m_A19 wz ' MSB of address
|
||||
mov _tmp,_adr
|
||||
if_z and _adr,_BUS_WR_R1 ' address <= $07FFFF
|
||||
if_nz and _adr,_BUS_WR_R2 ' address >= $800000
|
||||
mov outa,_adr ' /WR+/RAMx + A10-A0 + D7-D0
|
||||
nop
|
||||
nop
|
||||
mov outa,_tmp ' BUS + A10-A0 + D7-D0
|
||||
nop
|
||||
mov dira,#0
|
||||
|
||||
sub_poke_ret ret
|
||||
'**************************************************************************************
|
||||
|
||||
sub_peek mov _tmp,_adr ' make a copy
|
||||
|
||||
' BUS
|
||||
|
||||
mov outa,_BUS_INIT ' all de-selected
|
||||
mov dira,_DIR_IN ' D7..D0 as input
|
||||
call #setadr
|
||||
and _tmp,_m_A19 wz ' MSB of address
|
||||
mov _tmp,_adr
|
||||
if_z or _adr,_BUS_RD_R1 ' address <= $07FFFF
|
||||
if_nz or _adr,_BUS_RD_R2 ' address >= $800000
|
||||
nop
|
||||
mov outa,_adr ' /RAMx + A10-A0
|
||||
nop
|
||||
nop
|
||||
mov _tmp,ina
|
||||
nop
|
||||
and _tmp,#$FF ' only D7-D0
|
||||
mov dira,#0
|
||||
sub_peek_ret ret
|
||||
'**************************************************************************************
|
||||
|
||||
setadr ' ADR HI
|
||||
and _adr,_m_A18_A11 ' hi part
|
||||
shr _adr,#3 ' move to latch port
|
||||
or _adr,_BUS_AL_HI ' BUS + AL hi
|
||||
mov outa,_adr ' BUS + AL hi + ADR
|
||||
and _adr,_BUS_AL_LO
|
||||
mov outa,_adr ' BUS + AL lo + LATCH
|
||||
' ADR LO
|
||||
mov _adr,_tmp ' from copy
|
||||
and _adr,_m_A10_A00 ' lo part
|
||||
shl _adr,#8 ' mov to address port
|
||||
setadr_ret ret
|
||||
'**************************************************************************************
|
||||
|
||||
' __ ____
|
||||
' HWCL ACBRR Latch
|
||||
' SRLE LSEAA A18-A11
|
||||
' kD ALMMAAA AAAAAAAA DDDDDDDD
|
||||
' 21098 76543210 76543210
|
||||
|
||||
_DIR_OUT long %00000111_11111111_11111111_11111111
|
||||
_DIR_IN long %00000111_11111111_11111111_00000000
|
||||
_BUS_INIT long %00000101_01111000_00000000_00000000
|
||||
_BUS_AL_HI long %00000101_11111000_00000000_00000000
|
||||
_BUS_AL_LO long %00000101_01111000_11111111_00000000
|
||||
_BUS_WR_R1 long %00000001_01110111_11111111_11111111
|
||||
_BUS_WR_R2 long %00000001_01101111_11111111_11111111
|
||||
_BUS_RD_R1 long %00000101_01110000_00000000_00000000
|
||||
_BUS_RD_R2 long %00000101_01101000_00000000_00000000
|
||||
_m_A19 long %00000100_00001000_00000000_00000000
|
||||
_m_A18_A11 long %00000000_00000111_11111000_00000000
|
||||
_m_A10_A00 long %00000000_00000000_00000111_11111111
|
||||
'|_________________________________ HBEAT
|
||||
|
||||
|
||||
_job res 1
|
||||
_ptr res 1
|
||||
_adr res 1
|
||||
_val res 1
|
||||
_count res 1
|
||||
_tmp res 22
|
||||
_ftemp res 1
|
||||
_regA res 1
|
||||
_RegB res 1
|
||||
_RegC res 1
|
||||
|
||||
fit 496
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,824 @@
|
|||
{{
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Autor: Reinhard Zielinski │
|
||||
│ Copyright (c) 2013 Reinhard Zielinski │
|
||||
│ See end of file for terms of use. │
|
||||
│ Die Nutzungsbedingungen befinden sich am Ende der Datei │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Informationen : hive-project.de
|
||||
Kontakt : zille09@gmail.com
|
||||
System : TriOS
|
||||
Name : Sepia-Testprogramm - Test der Funktionen der Sepia-IO-Card
|
||||
Chip : Regnatix
|
||||
Typ : Plexus-Erweiterungsdatei
|
||||
Version : 01
|
||||
Subversion : 02
|
||||
|
||||
|
||||
Logbuch :
|
||||
'############################################### Version 1.0 ######################################################################################################################
|
||||
|
||||
02-11-2013 :-Erstellung der Optik des Testfensters
|
||||
-erste Funktionalität integriert -> Digital-Port-Eingabe und Joystickabfrage funktioniert
|
||||
-AD-Kanal-Werte als Balken und Zahlenwert ->funktioniert noch nicht, da noch kein Chip gesteckt ist
|
||||
-6125 Longs frei
|
||||
|
||||
03-11-2013 :-Setzen und lesen der Digitalports funktioniert jetzt fehlerfrei (hoffentlich, werde es mit Tests beobachten)
|
||||
-fehlt noch die AD-Port-Abfrage (noch kein PCF8591 vorhanden)
|
||||
-6335 Longs frei
|
||||
|
||||
05-11-2013 -Portfunktionen und AD-Wandler-Kanäle io.
|
||||
-fehlt noch die neu in TRIOS hinzugekommene Adressänderung der Ports
|
||||
-6311 Longs frei
|
||||
|
||||
'############################################### Version 1.1 ######################################################################################################################
|
||||
06-11-2013 -Adresseingabe und Änderung zur Laufzeit mit Hilfe von Drohne235 hinzugefügt
|
||||
-Code von überflüssigen Teilen befreit
|
||||
-Beenden Funktion mit Hinweisfenster ergänzt
|
||||
-Programm soweit fertig, kann aber noch optimiert werden
|
||||
-6268 Longs frei
|
||||
|
||||
08-11-2013 -Portadresswerte werden in sepia.ini gespeichert und beim Start geladen
|
||||
-6255 Longs frei
|
||||
|
||||
12-11-2013 -Adressport-Scanner eingebaut, nun könnte man noch die Adressübernahme direkt aus dem Scannerfenster realisieren
|
||||
-6081 Longs frei
|
||||
|
||||
13-11-2013 -Adressübernahme direkt aus dem Scanner-Fenster realisiert Taste "a" für AD Taste "d" für Digitalport drücken und auf die gewünschte Adresse klicken
|
||||
-dadurch etwas Code gespart
|
||||
-6124 Longs frei
|
||||
|
||||
'############################################### Version 1.2 ######################################################################################################################
|
||||
|
||||
20-11-2013 -Venatrix-Karte wird über den Venatrix-EEPROM (Adresse $50) am Sepia-I2C-Bus erkannt
|
||||
-Eigenen I2C-Treiber in Venatrix eingebunden, Venatrix hat die Adresse 5 (beide Adressen werden im Scan-Fenster blau dargestellt)
|
||||
-5918 Longs frei
|
||||
|
||||
22-11-2013 -Echtzeitscanner eingebaut, die I2C-Adressen werden jetzt im Scanner-Fenster zur Laufzeit aktualisiert, so ist jede Veränderung sofort sichtbar
|
||||
-das Programm hat erst mal seinen Endstand erreicht und ist zur Veröffentlichung bereit
|
||||
-noch etwas Codeoptimierung
|
||||
-5985 Longs frei
|
||||
|
||||
11-12-2013 -Farbunterscheidung für Venatrix-karte im Scannerfenster verworfen, sonst wird bei nicht angeschlossener Venatrix falsch dargestellt
|
||||
-5992 Longs frei
|
||||
|
||||
30-01-2014 -Anpassung an die neue reg.ios (window-Funktionen)
|
||||
-6090 Longs frei
|
||||
|
||||
16-03-2014 -DCF-Indikator in Titelleiste eingebaut
|
||||
-Code optimiert
|
||||
-6055 Longs frei
|
||||
}}
|
||||
|
||||
obj
|
||||
ios: "reg-ios-64"
|
||||
|
||||
con
|
||||
_CLKMODE = XTAL1 + PLL16X
|
||||
_XINFREQ = 5_000_000
|
||||
|
||||
'------------- Shell-Farben -----------------------------------------------------
|
||||
shellhcol =0 'Hauptfensterfarbe
|
||||
act_color =1 'Schriftfarbe
|
||||
winhcol =2 'Fensterhintergrundfarbe
|
||||
winframecol =3 'Fensterrandfarbe
|
||||
Titelhcol =4 'Titelleistenfarbe
|
||||
titeltextcol =5 'Titelleistentextfarbe
|
||||
hcolstatus =6 'statusleiste hintergrundfarbe
|
||||
statustextcol =7 'Statustextfarbe
|
||||
buttonhcol =8 'Buttonhintergrundfarbe
|
||||
buttontextcol =9 'Buttontextfarbe
|
||||
messagehcol =10 'Messagebox-Hintergrundfarbe
|
||||
messagetextcol =11 'Messagebox-Textfarbe
|
||||
selectcol =12 'selektionsfarbe
|
||||
mousecol =13 'Mauszeigerfarbe
|
||||
panelcol =14 'Farbe des Utility-Panels
|
||||
|
||||
ADM_SPEC = %00000000_00000000_00000000_01010011
|
||||
SETTING_RAM = $7FF00 'Hier stehen die System-Settings
|
||||
BRAM = $50000 'Overlay-Puffer
|
||||
Hour_Glass = $66800+(167*16*4) 'Sanduhr
|
||||
'******************Farben ********************************************************
|
||||
#$FC, Light_Grey, #$A8, Grey, #$54, Dark_Grey
|
||||
#$C0, Light_Red, #$80, Red, #$40, Dark_Red
|
||||
#$30, Light_Green, #$20, Green, #$10, Dark_Green
|
||||
#$1F, Light_Blue, #$09, Blue, #$04, Dark_Blue
|
||||
#$F0, Light_Orange, #$E6, Orange, #$92, Dark_Orange
|
||||
#$CC, Light_Purple, #$88, Purple, #$44, Dark_Purple
|
||||
#$3C, Light_Teal, #$28, Teal, #$14, Dark_Teal
|
||||
#$FF, White, #$00, Black
|
||||
'----Icon-Nummern----------------------------------------------------------------
|
||||
BEL_PIC =14
|
||||
ADM_PIC =15
|
||||
BIN_PIC =9
|
||||
BAS_PIC =107
|
||||
DIR_PIC =7
|
||||
ALL_PIC =8
|
||||
DMP_PIC =120
|
||||
TXT_PIC =121
|
||||
SYS_PIC =122
|
||||
COG_PIC =75
|
||||
BACK_PIC =124
|
||||
VOR_PIC =123
|
||||
PLAY_PIC =125
|
||||
STOP_PIC =141
|
||||
CLR_PIC =155
|
||||
EXT_PIC =156
|
||||
|
||||
'------------- F-Tasten für Zusatzfunktionen -------------------------------------
|
||||
F1_Key = 208
|
||||
F2_Key = 209
|
||||
F3_Key = 210
|
||||
F4_Key = 211
|
||||
F5_Key = 212
|
||||
F6_Key = 213
|
||||
F7_Key = 214
|
||||
F8_Key = 215
|
||||
F9_Key = 216
|
||||
F10_Key = 217
|
||||
F11_Key = 218
|
||||
F12_Key = 219
|
||||
ESC_KEY = 27
|
||||
RETURN_KEY = 13
|
||||
'--------------------------------------------------------------------------------
|
||||
|
||||
var
|
||||
|
||||
byte mountmarker,tmptime
|
||||
long rootdir 'root-Dirmarker
|
||||
long userdir 'user-Dirmarker
|
||||
byte colors[15] 'Farbwerte
|
||||
byte ma,mb 'Maus-Tasten
|
||||
|
||||
byte windowx[3]
|
||||
byte windowy[3]
|
||||
byte windowxx[3]
|
||||
byte windowyy[3]
|
||||
byte menuey[10] 'y-Koordinate für Start-Menue-Einträge
|
||||
byte popupx,popupxx 'x und
|
||||
byte popupy,popupyy 'y-Koordinaten des Popupmenues
|
||||
byte popupmarker 'Marker für Popupmenue
|
||||
byte PORT_IO[7] 'In-Out-Richtungsmarker in=0 out=1
|
||||
byte PORT_BIT[8] 'BIT-Wert-Marker
|
||||
byte port_bit_old[8] 'temp-puffer
|
||||
byte bitmuster[9] 'bit-muster puffer
|
||||
byte bitfarbe[9]
|
||||
byte bit_muster4[9],bit_muster5[9],bit_muster6[9] 'Ausgabe-Bitmuster der Digital-Ports
|
||||
byte ADDA_ADR,PORT_ADR
|
||||
byte infomarker
|
||||
byte buttonx[5],buttony[5]
|
||||
byte util
|
||||
long systemdir 'Plexus-Systemverzeichnis
|
||||
byte timezaehler
|
||||
'----------- DCF-Indikator ------------------------------------
|
||||
byte dcf_on
|
||||
|
||||
dat
|
||||
regsys byte "plexus.dll",0 'Reg.sys für Rückkehr aus externem Programm
|
||||
butOK byte " OK ",0
|
||||
Abbr byte "Cancel",0
|
||||
SYSTEM Byte "PLEXUS ",0 'Plexus-Systemverzeichnis
|
||||
|
||||
PUB main
|
||||
|
||||
ios.start
|
||||
cmd_mount 'sd-card mounten
|
||||
mountmarker:=1 'mount-marker
|
||||
'--------------------------------------------------------------------------------------
|
||||
activate_dirmarker(0)
|
||||
ios.sdchdir(@system)
|
||||
systemdir:=get_dirmarker 'Dir-Marker für System-Verzeichnis lesen
|
||||
|
||||
'--------------------------------------------------------------------------------------
|
||||
cmd_unmount
|
||||
iniload 'Ini-Datei mit Farbwerten laden
|
||||
ADDA_ADR:=$48 'Standard-Portadressen vorbelegen
|
||||
PORT_ADR:=$20
|
||||
sepia_iniload 'sepia-ini datei lesen mit gespeicherten Portadressen
|
||||
ios.set_plxAdr(ADDA_ADR,PORT_ADR) 'Portadressen setzen
|
||||
testfenster
|
||||
port_setting
|
||||
util:=0
|
||||
repeat
|
||||
|
||||
os_cmdinput 'Hauptprogrammschleife
|
||||
|
||||
PRI os_cmdinput | x,y ,i,dk,a,b,c,port,key,padr,durchlauf,kl
|
||||
|
||||
repeat
|
||||
time 'Zeit und Datum anzeigen
|
||||
|
||||
ma:=ios.mouse_button(0) 'linke Maustaste
|
||||
mb:=ios.mouse_button(1) 'rechte Maustaste
|
||||
key:=ios.key
|
||||
if key
|
||||
ifnot key=="d" or key=="a"
|
||||
popup_info_weg
|
||||
util:=0
|
||||
case key
|
||||
F1_Key:Display_Help
|
||||
F2_Key:Adress_Scanner
|
||||
F12_Key:ausstieg
|
||||
ESC_KEY:popup_info_weg
|
||||
RETURN_KEY:popup_info_weg
|
||||
F3_Key:util:=0
|
||||
Display_Info
|
||||
|
||||
if infomarker==0
|
||||
Lese_register 'alle portregister lesen, wenn nicht das Scannerfenster angezeigt wird
|
||||
if util==1
|
||||
durchlauf++
|
||||
if durchlauf >100 'bei jedem 100ten Durchlauf wird gescannt, so bleibt genug Zeit für die restlichen Abfragen
|
||||
Scan
|
||||
durchlauf:=0
|
||||
'***************************** linke Maustaste **********************************************************************
|
||||
if ma==255
|
||||
dk:=0
|
||||
x:=ios.mousex
|
||||
y:=ios.mousey
|
||||
kl:=ios.get_window//10
|
||||
'****************************** Scannerfenster Aktionen ************************************************************
|
||||
if util==1
|
||||
if x=>12 and x=<27 and y=>11 and y=<18
|
||||
padr:=(x-12)+((y-11)*16) 'angewählte Adresse berechnen
|
||||
if key=="a" 'Taste a für AD-Wandler-Adresse
|
||||
ADDA_ADR:=padr
|
||||
printhex(ADDA_ADR,2,21,5,colors[winhcol],colors[act_color])
|
||||
if key=="d" 'Taste d für DigitalPort-Adresse
|
||||
PORT_ADR:=padr
|
||||
printhex(PORT_ADR,2,32,5,colors[winhcol],colors[act_color])
|
||||
ios.set_plxAdr(ADDA_ADR,PORT_ADR) 'neue Adressen setzen
|
||||
|
||||
|
||||
'****************************** Startmenue anzeigen ************************************************************
|
||||
if popupmarker==1
|
||||
if x>10 or y<24 'Menue loeschen, wenn man woanders hinklickt
|
||||
popup_info_weg
|
||||
util:=0
|
||||
if x=>0 and x=<10 and y=>24 and y=<28
|
||||
repeat i from 0 to 5
|
||||
if menuey[i]==y
|
||||
case i
|
||||
0:menueselect(string("Scan - F2"),menuey[i])
|
||||
Adress_Scanner
|
||||
1:menueselect(string("Help - F1"),menuey[i])
|
||||
Display_Help
|
||||
2:menueselect(string("-EXIT- F12"),menuey[i])
|
||||
ausstieg
|
||||
|
||||
|
||||
'****************************** IO-Port-Fenster ****************************************************************
|
||||
if infomarker==0
|
||||
if x==32 'Input Radio-Button
|
||||
case y
|
||||
11:port_io[4]:=toogle_value(0,x,y)
|
||||
port:=0
|
||||
bytefill(@bit_muster4,0,9)
|
||||
13:port_io[5]:=toogle_value(0,x,y)
|
||||
port:=1
|
||||
bytefill(@bit_muster5,0,9)
|
||||
15:port_io[6]:=toogle_value(0,x,y)
|
||||
port:=2
|
||||
bytefill(@bit_muster6,0,9)
|
||||
ios.plxOut(PORT_ADR+port,255) 'Port auf null setzen
|
||||
port_io[port+4]:=0 'Portwert auf null setzen
|
||||
|
||||
if x==34 'Output Radiobutton
|
||||
case y
|
||||
11:port_io[4]:=toogle_value(1,x,y)
|
||||
13:port_io[5]:=toogle_value(1,x,y)
|
||||
15:port_io[6]:=toogle_value(1,x,y)
|
||||
|
||||
if x=>23 and x=<30 'Portzustände
|
||||
if y==11 or y==13 or y==15
|
||||
a:=b:=c:=0
|
||||
case y
|
||||
11:if port_io[4]==1
|
||||
bit_muster4[30-x]:=toogle_bit(bit_muster4[30-x],x,y)
|
||||
repeat i from 0 to 7
|
||||
a:=a+bit_muster4[i]<<(i)
|
||||
port_bit[4]:=a
|
||||
port:=0
|
||||
13:if port_io[5]==1
|
||||
bit_muster5[30-x]:=toogle_bit(bit_muster5[30-x],x,y)
|
||||
repeat i from 0 to 7
|
||||
b:=b+bit_muster5[i]<<(i)
|
||||
port_bit[5]:=b
|
||||
port:=1
|
||||
15:if port_io[6]==1
|
||||
bit_muster6[30-x]:=toogle_bit(bit_muster6[30-x],x,y)
|
||||
repeat i from 0 to 7
|
||||
c:=c+bit_muster6[i]<<(i)
|
||||
port_bit[6]:=c
|
||||
port:=2
|
||||
|
||||
|
||||
ios.plxOut(PORT_ADR+port,!port_bit[port+4])
|
||||
|
||||
'****************************** Globale Funktionstasten ********************************************************
|
||||
if(x=>buttonx[4]) and (x=<buttonx[4]+5) and (y==buttony[4]) and Infomarker==1 'ok im Infofenster
|
||||
buttonpress(4)
|
||||
popup_info_weg
|
||||
if util==1
|
||||
testfenster
|
||||
port_setting
|
||||
lese_register
|
||||
sepia_binsave
|
||||
util:=0
|
||||
if kl==1 'doppelklick in linke obere ecke des Info-Fensters
|
||||
if doppelklick>1
|
||||
popup_info_weg
|
||||
util:=0
|
||||
if kl==2 'Klick auf rechte obere Ecke
|
||||
popup_info_weg
|
||||
util:=0
|
||||
|
||||
if y==0
|
||||
if (x==39) 'Beenden-Knopf
|
||||
ios.displaytile(1,250,0,0,0,39) 'Schliessen-Symbol
|
||||
ausstieg
|
||||
|
||||
if (x==0) 'Beenden bei Doppelklick auf linke obere Ecke
|
||||
if doppelklick>1
|
||||
ausstieg
|
||||
if x>1 and x<16 'Doppelklick in die Titelleiste
|
||||
if doppelklick>1
|
||||
popup_info_weg
|
||||
util:=0
|
||||
Display_Info
|
||||
|
||||
if ((x=>0) and (x=<5)) and (y==29) 'Start-Knopf
|
||||
buttonpress(1)
|
||||
if popupmarker==1
|
||||
popup_info_weg
|
||||
util:=0
|
||||
|
||||
else
|
||||
if infomarker==1
|
||||
popup_info_weg
|
||||
util:=0
|
||||
startmenue
|
||||
popupmarker:=1
|
||||
|
||||
PRI Display_Help
|
||||
infofenster(5,10,34,17,string("Help"),1) 'Info-Fenster anzeigen
|
||||
Print_win(string("Change Adress:"),5,10)
|
||||
Print_win(string("Choose Start -> Scan,"),5,11)
|
||||
Print_win(string("Press and hold -a- for AD-Port"),5,12)
|
||||
Print_win(string("or -d- for Digital-Port and"),5,13)
|
||||
Print_win(string("click on the Adress do you"),5,14)
|
||||
Print_win(string("want!"),5,15)
|
||||
|
||||
PRI Display_Info
|
||||
infofenster(9,10,31,15,string("Program-Info"),1) 'Info-Fenster anzeigen
|
||||
Print_win(string("Sepia-Test for Hive"),9,10)
|
||||
Print_win(string("Version 1.3 - 01/2014"),9,11)
|
||||
Print_win(string("Autor:R.Zielinski"),9,12)
|
||||
Print_win(string("Hive-Project.de"),9,13)
|
||||
|
||||
PRI Adress_Scanner|a,ack,z,vx
|
||||
infofenster(9,10,29,20,string("Adress-Scanner"),1) 'Info-Fenster anzeigen
|
||||
util:=1
|
||||
Print_win(string("0123456789ABCDEF"),12,10)
|
||||
Scan
|
||||
|
||||
pri SCAN|ack,a,z,vx
|
||||
z:=11 'Zeile
|
||||
vx:=12
|
||||
ios.plxhalt
|
||||
repeat a from 0 to 127
|
||||
ack:=ios.plxping(a)
|
||||
if vx==12
|
||||
printhex(a,2,10,z,colors[winhcol],colors[act_color])
|
||||
|
||||
if ack
|
||||
ios.displaytile(Cog_pic,colors[winhcol],green,0,z,vx++)
|
||||
else
|
||||
'if a==$5 or a==$50
|
||||
' ios.displaytile(Cog_pic,colors[winhcol],blue,0,z,vx++) 'Venatrix-Karte wird blau dargestellt
|
||||
'else
|
||||
ios.displaytile(Cog_pic,colors[winhcol],red,0,z,vx++)
|
||||
|
||||
if vx>27
|
||||
vx:=12
|
||||
z++
|
||||
|
||||
ios.plxrun
|
||||
PRI infofenster(x,y,xx,yy,strg,knopf)'|i
|
||||
|
||||
ios.backup_area(x-1,y-2,xx+1,yy+1,BRAM) 'Hintergrund sichern
|
||||
window(2,4,y,x,yy,xx,strg) 'Fenster erstellen
|
||||
if knopf==1
|
||||
button(4,@butOK,((xx-x)/2)+x-2,yy) 'Button 4 gibt es nur im SD-Card-Info-Fenster
|
||||
if knopf==2
|
||||
button(2,@Abbr,((xx-x)/2)+x-2,yy)
|
||||
infomarker:=1
|
||||
|
||||
PRI button(n,btext,x,y)
|
||||
buttonx[n]:=x
|
||||
buttony[n]:=y
|
||||
printfont(btext,colors[buttonhcol],0,colors[buttontextcol],x,y)
|
||||
|
||||
PRI Mouse_Release
|
||||
repeat while ios.mouse_button(0) 'warten bis Maustaste losgelassen wird
|
||||
|
||||
pri ausstieg
|
||||
'ios.display3DBox(255, colors[winhcol], 0, 12, 8, 14, 28)
|
||||
'Print_win(string("Return to Plexus..."),9,13)
|
||||
ios.mousepointer(hour_glass)
|
||||
cmd_mount
|
||||
activate_dirmarker(systemdir)
|
||||
ios.sdopen("r",@regsys)
|
||||
ios.ldbin(@regsys)
|
||||
|
||||
pri toogle_bit(value,vx,vy):wert
|
||||
Mouse_Release 'warten bis maustaste losgelassen wird
|
||||
if value==0
|
||||
ios.displaytile(Cog_pic,colors[winhcol],red,0,vy,vx)
|
||||
wert:=1
|
||||
if value==1
|
||||
ios.displaytile(Cog_pic,colors[winhcol],green,0,vy,vx)
|
||||
wert:=0
|
||||
|
||||
|
||||
pri lese_register|i
|
||||
repeat i from 0 to 6
|
||||
PORT_BIT[i]:=!ios.getreg(i)
|
||||
|
||||
zeige_register
|
||||
|
||||
pri zeige_register|i,b,c,a
|
||||
|
||||
repeat i from 0 to 6
|
||||
if port_io[i]==0 'Port auf Eingang?
|
||||
c:=port_bit[i]
|
||||
c <<= 32 - 8
|
||||
repeat b from 1 to 8
|
||||
bitmuster[b]:=(c <-= 1) & 1 '+ "0"
|
||||
if bitmuster[b]==0
|
||||
bitfarbe[b]:=green
|
||||
else
|
||||
bitfarbe[b]:=red
|
||||
if port_bit[i]<>port_bit_old[i] 'nur geänderte werte anzeigen
|
||||
case i
|
||||
0:balken(port_bit[0],21)
|
||||
1:balken(port_bit[1],22)
|
||||
2:balken(port_bit[2],23)
|
||||
3:balken(port_bit[3],24)
|
||||
4:Show_Joybit(bitfarbe[8],10,6) 'hoch
|
||||
Show_Joybit(bitfarbe[6],11,5) 'links
|
||||
Show_Joybit(bitfarbe[5],11,7) 'rechts
|
||||
Show_Joybit(bitfarbe[7],12,6) 'runter
|
||||
Show_Joybit(bitfarbe[4],14,6) 'feuer
|
||||
repeat a from 1 to 8
|
||||
Show_Joybit(bitfarbe[a],11,23+a-1) 'Port-Icon
|
||||
5:Show_Joybit(bitfarbe[8],10,14)
|
||||
Show_Joybit(bitfarbe[6],11,13)
|
||||
Show_Joybit(bitfarbe[5],11,15)
|
||||
Show_Joybit(bitfarbe[7],12,14)
|
||||
Show_Joybit(bitfarbe[4],14,14)
|
||||
repeat a from 1 to 8
|
||||
Show_Joybit(bitfarbe[a],13,23+a-1) 'Port-Icon
|
||||
6:repeat a from 1 to 8
|
||||
Show_Joybit(bitfarbe[a],15,23+a-1) 'Port-Icon
|
||||
port_bit_old[i]:=port_bit[i]
|
||||
|
||||
|
||||
|
||||
pri balken(pwert,y)|light,x
|
||||
|
||||
light:=pwert*25/255
|
||||
repeat x from 0 to light
|
||||
ios.displaytile(129,colors[winhcol],colors[winhcol],colors[act_color],y,x+5) 'Wertebalken
|
||||
|
||||
repeat x from light+5 to 30
|
||||
ios.displaytile(129,colors[winhcol],colors[winhcol],colors[winhcol],y,x) 'Balken nach dem Wertebalken
|
||||
|
||||
Print_win(string(" "),32,y) 'AD-Wert löschen
|
||||
printdec(pwert,y,32,colors[winhcol],colors[act_color]) 'neuen AD-Wert schreiben
|
||||
|
||||
pri toogle_value(tg,tx,ty)
|
||||
if tg==0
|
||||
ios.displaytile(138,colors[winhcol],colors[winhcol],colors[act_color],ty,tx)
|
||||
ios.displaytile(Cog_pic,colors[winhcol],colors[winhcol],colors[act_color],ty,tx+2)
|
||||
return 0
|
||||
if tg==1
|
||||
ios.displaytile(Cog_pic,colors[winhcol],colors[winhcol],colors[act_color],ty,tx-2)
|
||||
ios.displaytile(138,colors[winhcol],colors[winhcol],colors[act_color],ty,tx)
|
||||
return 1
|
||||
|
||||
pri port_setting|i,b
|
||||
b:=0
|
||||
repeat i from 4 to 6
|
||||
port_io[i]:=0
|
||||
ios.displaytile(138,colors[winhcol],colors[winhcol],colors[act_color],11+i-4+b,32) 'Digital-Ports IN anzeigen
|
||||
ios.displaytile(Cog_pic,colors[winhcol],colors[winhcol],colors[act_color],11+i-4+b,34) 'Radiobutton OUT
|
||||
b++
|
||||
|
||||
pri Show_Joybit(farbe,y,x)
|
||||
ios.displaytile(COG_PIC,colors[winhcol],farbe,0,y,x)
|
||||
|
||||
pri testfenster|i,y,a
|
||||
|
||||
a:=0
|
||||
window(0,4,2,1,27,38,string("I/O-Card-Test"))
|
||||
rahmen (1,6,38,27)
|
||||
rahmen (1,1,38,3)
|
||||
rahmen (1,4,38,6)
|
||||
rahmen (3,8,18,18)
|
||||
rahmen (21,8,36,18)
|
||||
rahmen (3,19,36,26)
|
||||
ios.displaytile(133,colors[winhcol],colors[winhcol],colors[act_color],6,1) 'Rahmen-Verbindungsstücke
|
||||
ios.displaytile(117,colors[winhcol],colors[winhcol],colors[act_color],6,38)
|
||||
Print_win(string("Sepia-Test for Hive-Computer V1.2"),4,2)
|
||||
Print_win(string("Adress AD-Port:$ D-Port:$"),4,5)
|
||||
printhex(ADDA_ADR,2,21,5,colors[winhcol],colors[act_color])
|
||||
printhex(PORT_ADR,2,32,5,colors[winhcol],colors[act_color])
|
||||
|
||||
'y,x
|
||||
Show_Joybit(green,10,6)
|
||||
Show_Joybit(green,11,5)
|
||||
Show_Joybit(green,11,7)
|
||||
Show_Joybit(green,12,6)
|
||||
|
||||
Show_Joybit(green,14,6)
|
||||
|
||||
Print_win(string("Port 1"),4,16)
|
||||
|
||||
Show_Joybit(green,10,14)
|
||||
Show_Joybit(green,11,13)
|
||||
Show_Joybit(green,11,15)
|
||||
Show_Joybit(green,12,14)
|
||||
|
||||
Show_Joybit(green,14,14)
|
||||
|
||||
Print_win(string("Port 2"),12,16)
|
||||
|
||||
Print_win(string("Joystick-Test"),4,8)
|
||||
Print_win(string("Digital-Ports"),22,8)
|
||||
Print_win(string("A/D-Channels"),4,19)
|
||||
|
||||
repeat y from 0 to 5 step 2
|
||||
|
||||
repeat i from 0 to 7
|
||||
if y==0
|
||||
printdec(7-i,10,23+i,colors[winhcol],colors[act_color]) 'Port-Bits
|
||||
printdec(a+1,11+y,22,colors[winhcol],colors[act_color]) 'Port Nr
|
||||
Show_Joybit(green,11+y,23+i) 'Port-Icon
|
||||
a++
|
||||
Print_win(string("I"),32,10)
|
||||
|
||||
Print_win(string("O"),34,10)
|
||||
|
||||
repeat i from 0 to 3
|
||||
printdec(i,21+i,4,colors[winhcol],colors[act_color]) 'Port Nr der AD-Kanäle
|
||||
|
||||
PRI Print_win(str,x,y)
|
||||
printfont(str,colors[winhcol],0,colors[act_color],x,y)
|
||||
|
||||
PRI printhex(value, digits,x,y,back,vor)|wert 'screen: hexadezimalen zahlenwert auf bildschirm ausgeben
|
||||
{{hex(value,digits) - screen: hexadezimale bildschirmausgabe eines zahlenwertes}}
|
||||
value <<= (8 - digits) << 2
|
||||
repeat digits
|
||||
wert:=lookupz((value <-= 4) & $F : "0".."9", "A".."F")
|
||||
ios.displaytile(wert-16,back,0,vor,y,x++)
|
||||
|
||||
con'****************************************************** Datum und Zeitanzeige *************************************************************************************************
|
||||
|
||||
PRI time|s 'Zeitanzeige in der Statusleiste
|
||||
timezaehler++
|
||||
if timezaehler>50
|
||||
timezaehler:=0
|
||||
s:=ios.getminutes
|
||||
Status_extern(ios.dcf_sync,dcf_on,170,27,0,colors[titeltextcol],black) 'Anzeige des aktuellen Status in der Titelzeile
|
||||
if s<>tmptime
|
||||
displaytime
|
||||
|
||||
PRI displaytime|h,m
|
||||
|
||||
h:=ios.gethours
|
||||
m:=ios.getminutes
|
||||
|
||||
print_zehner(h,29,34,colors[hcolstatus],colors[statustextcol])
|
||||
ios.displaytile(42,colors[hcolstatus],0,colors[statustextcol],29,36)
|
||||
|
||||
print_zehner(m,29,37,colors[hcolstatus],colors[statustextcol])
|
||||
tmptime:=m
|
||||
date
|
||||
|
||||
PRI date
|
||||
|
||||
print_zehner(ios.getdate,0,29,colors[titelhcol],colors[titeltextcol])
|
||||
ios.displaytile(30,colors[titelhcol],0,colors[titeltextcol],0,31)
|
||||
|
||||
print_zehner(ios.getmonth,0,32,colors[titelhcol],colors[titeltextcol])
|
||||
ios.displaytile(30,colors[titelhcol],0,colors[titeltextcol],0,34)
|
||||
printdec(ios.getyear,0,35,colors[titelhcol],colors[titeltextcol])
|
||||
|
||||
pri print_zehner(wert,y,x,hin,vor)|a
|
||||
a:=0
|
||||
if wert<10
|
||||
printdec(0,y,x,hin,vor)
|
||||
a:=1
|
||||
printdec(wert,y,x+a,hin,vor)
|
||||
|
||||
pri Status_extern(wert1,wert2,tnr_act,x,y,col,f3)
|
||||
|
||||
if wert1==1
|
||||
ios.displaytile(tnr_act,colors[Titelhcol],col,f3,y,x) 'Status ok-anzeigen
|
||||
else
|
||||
if wert2 'Externe Komponente in Settingmenue ausgewählt?
|
||||
ios.displaytile(tnr_act,colors[titelhcol],grey,0,y,x) 'Symbol grau
|
||||
else
|
||||
ios.displaytile(16,colors[Titelhcol],colors[titeltextcol],0,y,x) 'Ohne externe Komponente arbeiten (kein Symbol)
|
||||
|
||||
con'
|
||||
PRI doppelklick:click 'pseudo-doppelklick
|
||||
click:=0
|
||||
Mouse_Release
|
||||
|
||||
repeat 500
|
||||
if ios.mouse_button(0)==255
|
||||
click++
|
||||
con'
|
||||
PRI iniload|i,a
|
||||
a:=SETTING_RAM
|
||||
repeat i from 0 to 14
|
||||
colors[i]:=ios.ram_rdbyte(a++)
|
||||
dcf_on:=ios.ram_rdbyte(a+3)
|
||||
|
||||
PRI activate_dirmarker(mark) 'USER-Marker setzen
|
||||
|
||||
ios.sddmput(ios#DM_USER,mark) 'usermarker wieder in administra setzen
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
PRI get_dirmarker:dm 'USER-Marker lesen
|
||||
|
||||
ios.sddmset(ios#DM_USER)
|
||||
dm:=ios.sddmget(ios#DM_USER)
|
||||
|
||||
PRI cmd_mount :err 'cmd: mount
|
||||
|
||||
repeat 16
|
||||
err:=ios.sdmount
|
||||
ifnot err
|
||||
mountmarker:=1
|
||||
quit
|
||||
else
|
||||
' display_error(err)
|
||||
quit
|
||||
|
||||
PRI cmd_unmount|err 'cmd: unmount
|
||||
err:=ios.sdunmount
|
||||
ifnot err
|
||||
mountmarker:=0
|
||||
else
|
||||
'display_error(err)
|
||||
|
||||
PRI window(num,cntrl,y,x,yy,xx,strg)|i 'ein Fenster erstellen
|
||||
|
||||
windowx[num]:=x-1
|
||||
windowy[num]:=y-2
|
||||
windowxx[num]:=xx+1
|
||||
windowyy[num]:=yy+1
|
||||
ios.window(num,0,colors[winhcol],0,colors[winframecol],colors[titelhcol],colors[titeltextcol],colors[hcolstatus],colors[statustextcol],y-2,x-1,yy+1,xx+1,cntrl,0)
|
||||
ios.printcursorrate(0)
|
||||
ios.printchar(12) 'cls
|
||||
'windownum[num]:=1
|
||||
printfont(strg,colors[titelhcol],0,colors[titeltextcol],x+1,y-2)
|
||||
|
||||
PRI printfont(str1,a,b,c,d,e)|f
|
||||
|
||||
repeat strsize(str1)
|
||||
f:= byte[str1++]
|
||||
f-=16 'anderer Zeichensatz, Zeichen um -16 Positionen versetzt
|
||||
if d>39 'wenn Bildschirmrand erreicht, neue Zeile
|
||||
d:=0
|
||||
e++
|
||||
ios.displayTile(f,a,b,c,e,d) 'einzelnes Tile anzeigen ('displayTile(tnr,pcol,scol,tcol, row, column))
|
||||
|
||||
d++
|
||||
PRI printdec(value,y,xx,hint,vor) | i ,c ,x 'screen: dezimalen zahlenwert auf bildschirm ausgeben
|
||||
{{printdec(value) - screen: dezimale bildschirmausgabe zahlenwertes}}
|
||||
' if value < 0 'negativer zahlenwert
|
||||
' -value
|
||||
'printchar("-")
|
||||
|
||||
i := 1_000_000_000
|
||||
repeat 10 'zahl zerlegen
|
||||
if value => i
|
||||
x:=value / i + "0"
|
||||
ios.displayTile(x-16,hint,0,vor,y,xx) 'printchar(x)
|
||||
xx++
|
||||
c:=value / i + "0"
|
||||
value //= i
|
||||
result~~
|
||||
elseif result or i == 1
|
||||
printfont(string("0"),hint,0,vor,xx,y) 'printchar("0")
|
||||
xx++
|
||||
i /= 10 'nächste stelle
|
||||
con '************************************************** Button-Funktionen ********************************************************************************************************
|
||||
|
||||
PRI buttonpress(n)
|
||||
case n
|
||||
1:printfont(string("Start"),250,0,0,0,29)
|
||||
4:printfont(@butOK,250,0,0,buttonx[n],buttony[n])
|
||||
|
||||
Mouse_Release
|
||||
case n
|
||||
1:printfont(string("Start"),colors[hcolstatus],0,colors[statustextcol],0,29)
|
||||
4:printfont(@butOK,colors[Buttonhcol],0,colors[buttontextcol],buttonx[n],buttony[n])
|
||||
|
||||
|
||||
con '*************************************************** Start-Menue *************************************************************************************************************
|
||||
PRI Menue(x,y,xx,yy)|i
|
||||
popup(x,y,xx,yy)
|
||||
repeat i from x to xx
|
||||
ios.displaytile(16,colors[Titelhcol],$ff,$ff,y-1,i)
|
||||
|
||||
PRI separator(x,y,xx)|i
|
||||
repeat i from x to xx
|
||||
ios.displaytile(6,colors[Messagehcol],0,colors[winframecol],y,i)
|
||||
|
||||
PRI menueselect(stri,y)
|
||||
printfont(stri,colors[messagetextcol],0,colors[messagehcol],0,y)
|
||||
Mouse_Release
|
||||
printfont(stri,colors[messagehcol],0,colors[messagetextcol],0,y)
|
||||
popup_info_weg
|
||||
|
||||
PRI Startmenue
|
||||
menue(0,24,9,28)
|
||||
printfont(string("Startmenue"),colors[titelhcol],0,colors[titeltextcol],0,23)
|
||||
|
||||
printfont(string("Scan - F2"),colors[messagehcol],0,colors[messagetextcol],0,24)
|
||||
menuey[0]:=24
|
||||
printfont(string("Help - F1"),colors[messagehcol],0,colors[messagetextcol],0,25)
|
||||
menuey[1]:=25
|
||||
separator(0,26,9)
|
||||
|
||||
printfont(string("-EXIT- F12"),colors[messagehcol],0,colors[messagetextcol],0,27)
|
||||
menuey[2]:=27
|
||||
con '*************************************************** Popup-Menue *************************************************************************************************************
|
||||
|
||||
PRI popup(x,y,xx,yy)
|
||||
popupx:=x
|
||||
popupy:=y-1
|
||||
popupyy:=yy
|
||||
popupxx:=xx
|
||||
ios.backup_area(popupx,popupy,popupxx,popupyy,BRAM)
|
||||
ios.display2dbox(colors[messagehcol],y,x,yy,xx,0)
|
||||
|
||||
PRI Popup_Info_weg
|
||||
if popupmarker==1 'Popupmenue sichtbar?
|
||||
ios.restore_area(popupx,popupy,popupxx,popupyy,BRAM) 'Hintergrund wiederherstellen
|
||||
popupmarker:=0 'Popupmarker loeschen
|
||||
if infomarker==1
|
||||
ios.restore_area(windowx[2],windowy[2],windowxx[2],windowyy[2],BRAM) 'Hintergrund wiederherstellen
|
||||
infomarker:=0
|
||||
ios.windel(2)
|
||||
|
||||
PRI rahmen(x,y,xx,yy)|i
|
||||
win_tile(137,y,x)
|
||||
win_tile(136,yy,x)
|
||||
win_tile(157,y,xx)
|
||||
win_tile(119,yy,xx)
|
||||
repeat i from y+1 to yy-1
|
||||
win_tile(2,i,x)
|
||||
win_tile(114,i,xx)
|
||||
line(x+1,y,xx-1)
|
||||
line(x+1,yy,xx-1)
|
||||
|
||||
PRI line(x,y,xx)|i
|
||||
repeat i from x to xx
|
||||
win_tile(130,y,i)
|
||||
|
||||
con '---------------------------------------------- Ausgaberoutinen ---------------------------------------------------------------------------------------------------------------
|
||||
PRI Win_Tile(nu,ty,tx)
|
||||
ios.displaytile(nu,colors[winhcol],0,colors[act_color],ty,tx)
|
||||
|
||||
pri sepia_binsave
|
||||
cmd_mount
|
||||
activate_dirmarker(systemdir)
|
||||
ios.sddel(@sepia_ini)
|
||||
ios.sdnewfile(@sepia_ini)
|
||||
ios.sdopen("W",@sepia_ini)
|
||||
ios.sdputc(ADDA_ADR)
|
||||
ios.sdputc(PORT_ADR)
|
||||
ios.sdclose
|
||||
cmd_unmount
|
||||
|
||||
pri sepia_iniload|e
|
||||
cmd_mount
|
||||
activate_dirmarker(systemdir)
|
||||
e:=ios.sdopen("R",@sepia_ini) 'datei öffnen
|
||||
ifnot e
|
||||
ADDA_ADR:=ios.sdgetc
|
||||
PORT_ADR:=ios.sdgetc
|
||||
ios.sdclose
|
||||
cmd_unmount
|
||||
|
||||
DAT
|
||||
|
||||
sepia_ini byte "sepia.ini",0
|
||||
|
Loading…
Reference in New Issue