commit 9508902e6c0ccdcbd6cff63a9c941f073669f04d Author: Joerg Deckert Date: Tue Apr 29 16:38:54 2014 +0200 initial check-in (version 2.05) diff --git a/data/Belstart.dat b/data/Belstart.dat new file mode 100644 index 0000000..721b789 Binary files /dev/null and b/data/Belstart.dat differ diff --git a/data/COLORS/AMIGA.CLR b/data/COLORS/AMIGA.CLR new file mode 100644 index 0000000..30a429a Binary files /dev/null and b/data/COLORS/AMIGA.CLR differ diff --git a/data/COLORS/ARMY.CLR b/data/COLORS/ARMY.CLR new file mode 100644 index 0000000..1ee2b4d Binary files /dev/null and b/data/COLORS/ARMY.CLR differ diff --git a/data/COLORS/ATARI.CLR b/data/COLORS/ATARI.CLR new file mode 100644 index 0000000..48f3b8e Binary files /dev/null and b/data/COLORS/ATARI.CLR differ diff --git a/data/COLORS/BLUE.CLR b/data/COLORS/BLUE.CLR new file mode 100644 index 0000000..ff3a5a5 Binary files /dev/null and b/data/COLORS/BLUE.CLR differ diff --git a/data/COLORS/BLWHITE.CLR b/data/COLORS/BLWHITE.CLR new file mode 100644 index 0000000..c2b9aac Binary files /dev/null and b/data/COLORS/BLWHITE.CLR differ diff --git a/data/COLORS/BROWN.CLR b/data/COLORS/BROWN.CLR new file mode 100644 index 0000000..e1977b7 Binary files /dev/null and b/data/COLORS/BROWN.CLR differ diff --git a/data/COLORS/C64.CLR b/data/COLORS/C64.CLR new file mode 100644 index 0000000..b24778e Binary files /dev/null and b/data/COLORS/C64.CLR differ diff --git a/data/COLORS/GREEN.CLR b/data/COLORS/GREEN.CLR new file mode 100644 index 0000000..17b6b03 Binary files /dev/null and b/data/COLORS/GREEN.CLR differ diff --git a/data/COLORS/LIGHTBLU.CLR b/data/COLORS/LIGHTBLU.CLR new file mode 100644 index 0000000..300d1a0 Binary files /dev/null and b/data/COLORS/LIGHTBLU.CLR differ diff --git a/data/COLORS/LPINK.CLR b/data/COLORS/LPINK.CLR new file mode 100644 index 0000000..5a0c04f Binary files /dev/null and b/data/COLORS/LPINK.CLR differ diff --git a/data/COLORS/PINK.CLR b/data/COLORS/PINK.CLR new file mode 100644 index 0000000..42ad828 Binary files /dev/null and b/data/COLORS/PINK.CLR differ diff --git a/data/COLORS/PLEXUS.CLR b/data/COLORS/PLEXUS.CLR new file mode 100644 index 0000000..77b8465 Binary files /dev/null and b/data/COLORS/PLEXUS.CLR differ diff --git a/data/COLORS/RED.CLR b/data/COLORS/RED.CLR new file mode 100644 index 0000000..3ef42b5 Binary files /dev/null and b/data/COLORS/RED.CLR differ diff --git a/data/COLORS/REDBROWN.CLR b/data/COLORS/REDBROWN.CLR new file mode 100644 index 0000000..4aa0022 Binary files /dev/null and b/data/COLORS/REDBROWN.CLR differ diff --git a/data/COLORS/REDYELL.CLR b/data/COLORS/REDYELL.CLR new file mode 100644 index 0000000..ca86be9 Binary files /dev/null and b/data/COLORS/REDYELL.CLR differ diff --git a/data/COLORS/TEAL.CLR b/data/COLORS/TEAL.CLR new file mode 100644 index 0000000..0f46332 Binary files /dev/null and b/data/COLORS/TEAL.CLR differ diff --git a/data/COLORS/YELLOW.CLR b/data/COLORS/YELLOW.CLR new file mode 100644 index 0000000..35f55f6 Binary files /dev/null and b/data/COLORS/YELLOW.CLR differ diff --git a/data/Help.txt b/data/Help.txt new file mode 100644 index 0000000..6e45ab7 --- /dev/null +++ b/data/Help.txt @@ -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 diff --git a/data/Mouse/Amiga1.mau b/data/Mouse/Amiga1.mau new file mode 100644 index 0000000..911581f Binary files /dev/null and b/data/Mouse/Amiga1.mau differ diff --git a/data/Mouse/Amiga2.mau b/data/Mouse/Amiga2.mau new file mode 100644 index 0000000..07ef878 Binary files /dev/null and b/data/Mouse/Amiga2.mau differ diff --git a/data/Mouse/Army.mau b/data/Mouse/Army.mau new file mode 100644 index 0000000..c5dccee Binary files /dev/null and b/data/Mouse/Army.mau differ diff --git a/data/Mouse/Bombe.mau b/data/Mouse/Bombe.mau new file mode 100644 index 0000000..63ad2f7 Binary files /dev/null and b/data/Mouse/Bombe.mau differ diff --git a/data/Mouse/Clock1.mau b/data/Mouse/Clock1.mau new file mode 100644 index 0000000..f9357df Binary files /dev/null and b/data/Mouse/Clock1.mau differ diff --git a/data/Mouse/Clock2.mau b/data/Mouse/Clock2.mau new file mode 100644 index 0000000..9e7ad45 Binary files /dev/null and b/data/Mouse/Clock2.mau differ diff --git a/data/Mouse/Knife.mau b/data/Mouse/Knife.mau new file mode 100644 index 0000000..48aeae2 Binary files /dev/null and b/data/Mouse/Knife.mau differ diff --git a/data/Mouse/Mouse1.mau b/data/Mouse/Mouse1.mau new file mode 100644 index 0000000..2ecd61a Binary files /dev/null and b/data/Mouse/Mouse1.mau differ diff --git a/data/Mouse/Mouse2.mau b/data/Mouse/Mouse2.mau new file mode 100644 index 0000000..99f7917 Binary files /dev/null and b/data/Mouse/Mouse2.mau differ diff --git a/data/Mouse/Mouse4.mau b/data/Mouse/Mouse4.mau new file mode 100644 index 0000000..caf07a8 Binary files /dev/null and b/data/Mouse/Mouse4.mau differ diff --git a/data/Mouse/Mouse5.mau b/data/Mouse/Mouse5.mau new file mode 100644 index 0000000..3b5b685 Binary files /dev/null and b/data/Mouse/Mouse5.mau differ diff --git a/data/Mouse/Nagel.mau b/data/Mouse/Nagel.mau new file mode 100644 index 0000000..7e98656 Binary files /dev/null and b/data/Mouse/Nagel.mau differ diff --git a/data/Mouse/Nuck.mau b/data/Mouse/Nuck.mau new file mode 100644 index 0000000..fd514d4 Binary files /dev/null and b/data/Mouse/Nuck.mau differ diff --git a/data/Mouse/Rocket.mau b/data/Mouse/Rocket.mau new file mode 100644 index 0000000..cd3e2d8 Binary files /dev/null and b/data/Mouse/Rocket.mau differ diff --git a/data/Mouse/Round.mau b/data/Mouse/Round.mau new file mode 100644 index 0000000..5d23c38 Binary files /dev/null and b/data/Mouse/Round.mau differ diff --git a/data/Mouse/Stift.mau b/data/Mouse/Stift.mau new file mode 100644 index 0000000..768bb7a Binary files /dev/null and b/data/Mouse/Stift.mau differ diff --git a/data/Mouse/drop.mau b/data/Mouse/drop.mau new file mode 100644 index 0000000..5f5ebf6 Binary files /dev/null and b/data/Mouse/drop.mau differ diff --git a/data/Mouse/fantasy.mau b/data/Mouse/fantasy.mau new file mode 100644 index 0000000..45032cf Binary files /dev/null and b/data/Mouse/fantasy.mau differ diff --git a/data/Mouse/mouse3.mau b/data/Mouse/mouse3.mau new file mode 100644 index 0000000..82e32a1 Binary files /dev/null and b/data/Mouse/mouse3.mau differ diff --git a/data/Mouse/pfeil.mau b/data/Mouse/pfeil.mau new file mode 100644 index 0000000..591168e Binary files /dev/null and b/data/Mouse/pfeil.mau differ diff --git a/data/PRG.NFO b/data/PRG.NFO new file mode 100644 index 0000000..e2a8dd4 --- /dev/null +++ b/data/PRG.NFO @@ -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. diff --git a/data/Plexus.dat b/data/Plexus.dat new file mode 100644 index 0000000..07706f2 Binary files /dev/null and b/data/Plexus.dat differ diff --git a/data/REG.INI b/data/REG.INI new file mode 100644 index 0000000..6bf0776 Binary files /dev/null and b/data/REG.INI differ diff --git a/data/SEPIA.INI b/data/SEPIA.INI new file mode 100644 index 0000000..ba33855 --- /dev/null +++ b/data/SEPIA.INI @@ -0,0 +1 @@ +H \ No newline at end of file diff --git a/data/SOUND.NFO b/data/SOUND.NFO new file mode 100644 index 0000000..228e4eb --- /dev/null +++ b/data/SOUND.NFO @@ -0,0 +1,6 @@ +ADM-Spec: + +SID-COG :Ver.1.3 + +Author:Johannes Ahlebrand +Date :4/2012 diff --git a/data/VIDEO.NFO b/data/VIDEO.NFO new file mode 100644 index 0000000..46340d6 --- /dev/null +++ b/data/VIDEO.NFO @@ -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 diff --git a/data/dos.txt b/data/dos.txt new file mode 100644 index 0000000..4047db5 --- /dev/null +++ b/data/dos.txt @@ -0,0 +1,104 @@ +help +diese hilfe + + +bin/adm/bel-datei wird gestartet + +mount +sd-card mounten + +unmount +sd-card abmelden + +dir wh +verzeichnis anzeigen + +type +anzeige einer textdatei + +aload +administra-code laden + +bload +bellatrix-treiber laden + +rload +regnatix-code laden + +del +datei loeschen + +cls +bildschirm loeschen + +free +freier speicher auf sd-card + +attrib ashr +attribute aendern + +cd +verzeichnis wechseln + +mkdir +verzeichnis erstellen + +rename +datei/verzeichnis umbenennen + +format +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 +in das entsprechende marker- +verzeichnis wechseln + +dmset +setzt den entsprechenden marker +auf das aktuelle verzeichnis + +dmclr +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 +Hexwert an Port ausgeben + +plxget +Wert vom Port lesen + +plxmap +Darstellung aller I2C Teilnehmer + +plxscan +Nach I2C Teilnehmern scannen + +plxtest +Port- und A/D Kanal-Anzeige diff --git a/data/reg.err b/data/reg.err new file mode 100644 index 0000000..5342a75 --- /dev/null +++ b/data/reg.err @@ -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! diff --git a/data/reg.fnt b/data/reg.fnt new file mode 100644 index 0000000..90cc153 Binary files /dev/null and b/data/reg.fnt differ diff --git a/make.sh b/make.sh new file mode 100755 index 0000000..97c0a4a --- /dev/null +++ b/make.sh @@ -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} diff --git a/source/Bluetooth.spin b/source/Bluetooth.spin new file mode 100644 index 0000000..9801864 --- /dev/null +++ b/source/Bluetooth.spin @@ -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[2]) and (x=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 + diff --git a/source/DCF-Test.spin b/source/DCF-Test.spin new file mode 100644 index 0000000..62efddb --- /dev/null +++ b/source/DCF-Test.spin @@ -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=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 + diff --git a/source/Dcf77.spin b/source/Dcf77.spin new file mode 100644 index 0000000..7744477 --- /dev/null +++ b/source/Dcf77.spin @@ -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 : 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] diff --git a/source/FullDuplexSerialExtended.spin b/source/FullDuplexSerialExtended.spin new file mode 100644 index 0000000..4fa72b4 --- /dev/null +++ b/source/FullDuplexSerialExtended.spin @@ -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 diff --git a/source/Numbers.spin b/source/Numbers.spin new file mode 100644 index 0000000..405a047 --- /dev/null +++ b/source/Numbers.spin @@ -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) │ +''├────────────────────┼────────────────────────────────┤ +''│ / SPCPAD │ Zero / Space Pad │ +''├────────────────────┼────────────────────────────────┤ +''│ / 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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} \ No newline at end of file diff --git a/source/Plexus-Shell.spin b/source/Plexus-Shell.spin new file mode 100644 index 0000000..a39df1c --- /dev/null +++ b/source/Plexus-Shell.spin @@ -0,0 +1,4465 @@ +{{ +┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ 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 : Programm +Version : 02 +Subversion : 00 + +Funktion : "Erste TRIOS-Shell für den Hive + +Logbuch : +################################################### Version 1.00 ################################################################################################################ + +04-06-2013 : -Erster Fensteraufbau mit allgemeinen Funktionen + +05-06-2013 : -Utilities-Fenster hinzugefügt, Anzeige der belegten Cogs ist möglich + +06-06-2013 : -Farbänderung der Oberfläche mit Speicherung der eingestellten Werte auf SD-Card, Farben werden beim Start geladen + +07-06-2013 : -Dateifenster erstellt -> mit Mausbedienung wird die Sache etwas komplizierter + +10-06-2013 : -Statusleiste mit Uhranzeige, Startknopf und Anzeige der ausgewählten Datei + +11-06-2013 : -Navigation in Dateifenster teilweise realisiert (Scrolling fehlt noch) + -Starten von BIN-Dateien möglich, Anzeigen von Text-und Basic-Dateien möglich, Abspielen von Sid-und DMP-Dateien möglich + -Starten von Bel und ADM-Dateien möglich + +14-06-2013 : -Terminalfenster (Baudselektion fehlt noch) und Datum/Zeit-Einstellungen funktioniert + -E-Ram-Monitor funktioniert nur die Eingabe der Startadresse fehlt noch + -Dateiliste wird mit Attributen im E-Ram gespeichert, dadurch kann man im Dateifenster scrollen wärend Sid-File abgespielt wird + -Startmenue hinzugefügt + +16-06-2013 : -Baudselektion funktioniert, Popupmenues integriert -> Maus-Rechtsklick + +'################################################### Version 1.01 ################################################################################################################ + +21-06-2013 : -E-Ram-Monitor erweitert, jetzt kann man direkt in den Speicher schreiben + -E-Ram-Monitor Eingabe der Startadresse realisiert + -SD-Card - Format Befehl hinzugefügt, funktioniert noch nicht zuverlässig (keine Ahnung warum), außerdem wird der Vol-Name nicht immer richtig gelesen + -Datei-Info hinzugefügt + -Datei-LöschBefehl hinzugefügt (Rename fehlt noch) + -Programm hängt sich nach doppelklick auf ???? + +22-06-2013 -Fehler gefunden ->waitcnt hat den Programmhänger verursacht ->ersetzt durch repeat-Schleife ->jetzt funktioniert alles wieder + -ändern von Dateiattributen eingefügt und funktioniert + -Datei-Icons hinzugefügt ->sieht cool aus :-) + -SID-DMP-Player realisiert + -Datei-Hex-Display hinzugefügt -> erreichbar über popupmenü (rechtsklick im Dateifenster) + +24-06-2013 -Fehler in der Dateinamen-Anzeige in der Statuszeile bei Playerbetrieb korrigiert + +'################################################### Version 1.02 ################################################################################################################ + +01-07-2013 -Datei-Kopierfunktion jetzt vorhanden + -Datei-Attribute ändern korrigiert (bisher konnte man nur ein attribut ändern, jetzt können mehrere Attribute gleichzeitig geändert werden) + -Dateilösch-Funktion korrigiert (hat bisher auch schreibgeschützte Dateien gelöscht, jetzt nicht mehr) + -Datei-Kopierfunktion beschleunigt (durch Read und WriteData-Funktion in adm-fat) + +03-07-2013 -Mülleimerfunktion hinzugefügt, ist noch ausbaufähig :-( + -Möglichkeit, alle Dateien eines Verzeichnisses auf einmal zu kopieren oder zu löschen + -Aufräumarbeiten, Programmteile etwas sortiert + -Ram-Nutzung geändert (Bereich 0-$20000 bleibt frei ->Basic Reclaim-Funktion funktioniert sonst nicht) + -Korrektur der Pfadabfrage beim Start, jetzt wird nach Wiederkehr aus einer Bin-Datei in das Verzeichnis zurückgekehrt aus dem die Bin-Datei gestartet wurde + -E-Ram-Monitor Anzeige der geänderten Ram-Zeile nach Eingabe korrigiert + +08-07-2013 -Versuch, Verknüpfungen für Verzeichnisse oder Bin-Dateien auf dem Desktop zu erstellen, mal sehen ,was daraus wird ? + -Fenster für externe Programme erstellt, hier sollen kleine externe Programme rein (Taschenrechner, Kalender usw.) + +10-07-2013 -Desktopverknüpfungen sind jetzt startbar und werden in ini-Datei gesichert und beim Start auch wieder geladen + -Fehler noch in DMP-Player bei Aufruf von verknüpften DMP-Files (Anzeige im Player falsch) + +'################################################### Version 1.03 ################################################################################################################ + +14-07-2013 -Korrektur der Playerroutine bei Start von Dmp-Datei-Desktop-Verknüpfungen + -Löschen von Desktop-Verknüpfungen möglich + -Fehler im Explorer beim Datei-Scrolling behoben + -Version 1.03 ist nun die erste offizielle Version für das Hive-Forum + +17-07-2013 -Aufräumarbeiten + -Fehler in Reboot-Routine behoben (beim Reboot wurde die Ini-Datei mit falschen Werten für die Links überschrieben) + -Pfadanzeige in der Statusleiste stimmt noch nicht (springt man aus einem Unterverzeichnis eine Ebene höher, stimmt die Pfadanzeige nicht mehr) + +18-07-2013 -Im Mülleimer keine Links möglich (ist ja der Mülleimer :) + -Ein Wechsel des Verzeichnisses im Mülleimer wird verhindert, da sonst die Pfadanzeige durcheinander kommt + -Pfadanzeige zeigt zumindest immer das richtige aktuelle Verzeichnis an (nicht den kompletten Pfad-> daran arbeite ich noch) + -Start von Links, wenn SD-Karte nicht gemounted war, führte zum Absturz -> behoben + +23-07-2013 -System-Setting-Fenster erstellt, hier ist es möglich zu wählen, ob versteckte Dateien angezeigt werden und ob der Mülleimer verwendet wird + +29-07-2013 -Abgespeckte DLL_Version erstellt um eingebettete Programme zu starten, diese Version wird nur von eingebetteten Programmen verwendet, + da grundlegende Startfunktionen fehlen, diese werden beim ersten Start der Shell geladen (Systemfont,Grafikinitialisierung usw.) + So sieht es zumindest optisch so aus, als würden die externen Programme in der Shell integriert sein + -Copymarker wird beim Schließen des Dateifensters gelöscht, sonst wird man ihn nicht mehr los (nur noch Paste im Popupmenue verfügbar) + -kleinere Korrekturen bei der Maus-Abfrage, etwas Code-Optimierung + -noch 2480 Longs frei + +31-07-2013 -kleinere Aenderungen in der Fenster-Verwaltung + -ESC-Taste für Fensterlöschung eingefügt (löscht alle Fenster auf einmal) + -DMP-Player Steuerung jetzt auch mit den Tasten + =nächster Titel - =Titel zurück und Space =Play/Stop möglich + -Fehler in E-Ram-Poke im Ram-Monitor behoben (es wurde nach dem 8.Byte weiter geschrieben,jetzt wird immer an der achten Position beendet) + -noch 2412 Longs frei + +'################################################### Version 1.04 ################################################################################################################ + +04-08-2013 -Erste Versuche eine allgemeine Startdatei zu erstellen, in der alle Parameter in den Ram geladen werden, danach wird die eigentliche Shell gestartet, das spart + Platz und es müssen nicht 2 Programme (die eigentliche Shell und die Dll gepflegt werden) + -Programmteil-Infofenster in Programmteil-Window zum größten Teil integriert -> Longs gespart + -Programm-Start-Logo hinzugefügt -> cooool + -Kalender integriert, über Doppelklick auf Datum erreichbar + -2220 Longs frei + +05-08-2013 -kleinere Änderungen im seriellen Terminal, jetzt wird auch Backspace gesendet und im Terminal optisch korrekt auch bei Backspace geschrieben + -serielles Terminal-Eingabefenster um eine Zeile erweitert (jetzt 20 Zeilen) + -allgemeines Fensterhandling angepasst (kleinere Darstellungsfehler behoben) + -Code optimiert + -2231 Longs frei + +15-08-2013 -Diverse Darstellungsfehler behoben + -SID Dateiendung und Verarbeitung entfernt, ist ja keine Endung, die zum DMP-File gehört + -Fehler in der Farbverwaltung behoben (beim Druck auf Cancel im Farbeinstellfenster wurden die Farben nicht zurückgesetzt) + -START_FLAG eingebaut, Start-LOGO wird nur beim ersten Start von Plexus angezeigt + -Code weiter massiv optimiert (213 Longs gespart) + -2444 Longs frei + +16-08-2013 -weitere Codeoptimierung -> 2505 Longs frei (274 Longs gespart) + -im Color-Setting-Fenster wird jetzt der Farbwert auch dezimal dargestellt, kann manchmal hilfreich sein + -Ini-Load und -Save optimiert + -Fehler bei Color-Settings beseitigt(wurden Farben geändert und das Color-Setting-Fenster geschlossen, wurden die Farben nicht zurückgesetzt) + -loadtile und LoadTileToRam-Routinen entfernt - werden nicht mehr benötigt, da die Tile Dateien in der Reg.sys geladen werden + -2499 Longs frei + +'################################################### Version 1.05 ################################################################################################################# + +17-08-2013 -automatische Link-Aktualisierung (wird eine neue SD-Karte eingelegt, werden die, in der Ini gespeicherten Links auf dem Desktop aktualisiert, ist keine + Ini-Datei vorhanden, werden die Links auf dem Desktop gelöscht) + -Farb und Systemeinstellungen werden ebenfalls aktualisiert + -Fehler in der Anzeige der Dateianzahl behoben + -2456 Longs frei + +18-08-2013 -Fehler in der Format-Routine von adm-fat.spin behoben (Hive hängte sich beim Format Befehl auf) + -Nach dem Formatieren wurde der Verzeichnisinhalt nicht korrekt dargestellt(nur Müll),Karte wurde aber korrekt formatiert + -ohne Einträge kommt die entspr.Routine aus dem Tritt, deshalb wird nach dem formatieren der Trash-Ordner und die Ini-Datei auf die SD-Karte geschrieben + -2454 Longs frei + +19-08-2013 -noch etwas Codeoptimierung + -Fehler in der Darstellung des Dateinamens bei CLR-Dateien behoben + -optimiert,optimiert und wieder optimiert + -2613 Longs frei + +21-08-2013 -noch etwas Codeoptimierung + -Korrektur Popup-Menue-X-Abfrage im Dateifenster (war zu groß) + -Abfrage beim Kopieren und Einfügen schon existierender Dateien eingebaut + -einige Änderungen in den Farbzuweisungen der Hilfsfenster (Kopier,Lösch,Playerfenster) + -Icon für CLR-Dateien eingepflegt + -2606 Longs frei + +23-08-2013 -Änderung im Verzeichniswechsel, ein Doppelklick auf .. geht ein Verzeichnis höher und ein Doppelklick auf . wechselt ins Root-Verzeichnis + -User-Mauspfeil eingebaut, wird in der reg.ini gespeichert + -2550 Longs frei + +24-08-2013 -Hex-Monitor um die Anzeige des HUB-Ram erweitert, Auswahl über Checkboxen + -Editierung aber nur im E-Ram möglich + -2501 longs frei + +25-08-2013 -Dateifenster jetzt so gross wie Speichermonitor, Infofenster hat jetzt feste Position,da die gesamte Dateizeile als Rechtsklickbereich gilt + -und wieder ein paar longs eingespart + -2533 Longs frei + +26-08-2013 -Fenster zusammengefasst, es gibt nur noch 2 Fenstertypen 1=Arbeitsfenster 2=Infofenster + -Hauptschleifen-Struktur umgebaut + -Strings zusammengefasst -> wieder Platz gespart + -2619 Longs frei + +27-08-2013 -wieder Code geschrumpft + -Adresseingabe im Ram-Monitor korrigiert (5 Stellen sind möglich) + -Adressraum-Eingrenzung bei der Auswahl des Hub-Ram (hier nur 4-stellig), E-Ram 5-stellig + -2642 Longs frei + +'################################################### Version 1.06 ################################################################################################################# + +29-08-2013 -wieder einige Optimierungen durchgeführt (Icon-Darstellung) + -2667 Longs frei + +30-08-2013 -Fehler in der Checkboxen-Funktion behoben (falsche x-Koordinaten durch die Fensterzusammenfassung) + -2664 Longs frei + +31-08-2013 -einige Texte in den Ram ausgelagert, spart massiv Platz + -Codeoptimierung + -2758 Longs frei + +07-09-2013 -Fehler in Kopierfunktion behoben (bei der Meldung File exist wurde das Kopierfenster gelöscht und es war nur noch der Fortschrittsbalken sichtbar) + -Fehler in der Routine Mülleimer erstellen behoben (existierte das Verzeichnis nicht, wurde nach dem Erstellen der Verzeichnismarker falsch gelesen) + -Beim Wechsel der SD-Card wurde der Mauszeiger nicht aktualisiert ->behoben + -durch Optimierungen wieder etwas Code gespart + -2770 Longs frei + +15-09-2013 -Hervorhebungsbalken für Dateinamen im Explorer hinzugefügt->noch nicht perfekt, da andersfarbige Dateinamen in der falschen Farbe zurückgeschrieben werden + -Fehler in der Playerroutine behoben (wurde nach dem Playerfenster ein anderes Fenster aufgerufen, löschte der Player nach Titelende eine Zeile im aktiven Fenster-->Balkenleer-Routine) + -Buttonweg-Routine beim Start hinzugefügt, um die Buttonwerte zu resetten(sonst erschien beim Klick in die Titelzeile ein ungewollter Button) + -playerstop-Funktion bei diversen Dateioperationen eingefügt um Fehlfunktionen abzufangen + -erste Codesegmente für Venatrix-Erweiterungskarte in reg-ios-64 eingebaut + -2686 Longs frei + +17-09-2013 -Fehldarstellung Aboutbox, wenn Player lief behoben + -noch etwas Code geschrumfpt + -der Versuch, vollständiger Tastenbedienung von Plexus stellte sich als zu umfangreich heraus.->wird zurückgestellt,wegen Speichermangel + -2719 longs frei + +22-09-2013 -Fehler Verzeichniswechsel im Trash-Ordner behoben + -Darstellung Trash in der Statusleiste hinzugefügt + -Venatrix-Dateien mit der Endung VNX sind nun startbar, entsprechende Routinen in reg-ios hinzugefügt + -2691 Longs frei + +23-09-2013 -Abbruch-Möglichkeit beim Kopieren oder Löschen von Dateien eingebaut + -diverse Fehler in der Darstellung des Hervorhebungsbalkens behoben, hoffentlich funktioniert er jetzt richtig!? + -Venatrix-Platine eingetroffen, die Tests gehen in die nächste Runde nach Aufbau der Testplatine + -2648 Longs frei + +'################################################################################################################################################################################# +'####################################### PLEXUS 2.0 mit VENATRIX und SEPIA-Unterstützung ######################################################################################## +'################################################################################################################################################################################# +'***************************** Einbindung der Sepia-Karte, Einbindung der Bus-Erweiterungs-Platine Venatrix*********************************************************************** + +29-09-2013 -Venatrix-Karte eingebunden, wählbar über Settings + -Venatrix-Dateien startbar gemacht, noch hakt es manchmal !? + -erste Venatrix-Testdatei erstellt + -in Venatrix befindet sich ein Loader, der über den Start einer mit VNX endenden Venatrix-Datei mit User-Code gefüllt werden kann + -Basic,Climber,Boing neu kompiliert ->durch Venatrix-CS-Signal nötig + -fehlt noch die Sepia-Karten-Unterstützung + -2602 Longs frei + +10-10-2013 -im Datei-Popupmenue den Befehl Delete mit Separator versehen + -Backup und Restore durch variablen Popupyy Merker erweitert um auf die verschiedenen Popupmenue-Längen richtig zu reagieren + -Dateihervorhebung merkt sich jetzt auch die Farbe von Verzeichnissen und schreibt die Namen in der richtigen Farbe zurück + -Start-Logo-Datei reg.sys für Version 2.0 farblich verändert + -2592 Longs frei + +28-10-2013 -Anzeige der Anzahl der Verzeichnisse in der Titelzeile des Dateifensters und Korrektur der Datei und Verzeichniszählung + -2503 Longs frei + +02-11-2013 -Sepia-Testprogramm entworfen, Digital-Port- und Joystickabfragen funktionieren schon + -startbar über das Programms-Fenster durch klick auf das IO-Card-Symbol ganz links + -2482 Longs frei + +08-11-2013 -Sicherheitsabfrage für zu ladende Dateien und Links hinzugefügt + -Neues Datei-Icon für externe Programme hinzugefügt + -externe Programme haben die Dateiendung DLL + -2450 Longs frei + +11-11-2013 -Sepia-Card-Scanner eingebaut, jetzt wird automatisch auf eine Sepia-Karte gescannt und im Settingmenue angezeigt + -Für die Venatrix-Karte hab ich noch keine Idee für den Scanner, Bus_putchar und Bus_getchar scheiden aus, da sie auf Signale warten und so + -bei nicht angeschlossener Karte das System einfrieren (waitpeq-Befehl) + -2442 Longs frei + +13-11-2013 -Venatrix-Card-Erkennung über Register 7 des Plx-Pollers realisiert, Pin 22 vom ADM-Port wird auf High abgefragt. Mittels Pullup-Widerstand auf + -der Venatrix-Bus-Platine am Port 22 des ADM-Ports wird das Vorhandensein der Venatrix-Karte abgefragt + -2429 Longs frei + +15-11-2013 -Der Puffer für Bildschirmbereiche wurde von Bellatrix in den E-Ram verschoben, dadurch wurden in Bella ca.600Longs frei und es ist nun möglich, große + -Bildschirmbereiche zu puffern und wieder herzustellen + -somit wird das Überlappen und Wiederherstellen von mehreren Fenstern möglich, ob ich das mache, weis ich noch nicht + -Menueroutinen entfernt (durch die Pufferverlagerung nicht mehr nötig)->umgestellt auf popup + -noch etwas Code geschrumpft + -2433 Longs frei + +20-11-2013 -Venatrix-Karten-Erkennung erfolgt über den EEPROM von Venatrix am Sepia-I2C-Bus (Adresse $50), keine Ahnung, ob das sauber ist, funktioniert aber + -Entsprechende Routinen für Cog-Anzeige und Setting-Anzeige angepasst und zusammengefasst, dadurch wieder etwas Code gespart + -Venatrix hat jetzt einen eigenen I2C-Slave Treiber und wird über Adresse 5 erkannt + -2434 Longs frei + +24-11-2013 -Durch diverse Versuche hat sich herausgestellt, das die Ping-Funktion allein nicht ausreicht um + -das Vorhandensein der Sepia oder Venatrix-Karte zu detektieren, da eine nicht angeschlossene Karte + -eine Null zurückgibt, genauso wie ein angeschlossener I2C-Teilnehmer. Deshalb wird beim Scan die + -Anzahl Nullen mit der Gesamtanzahl der Adressen verglichen. Ist die Anzahl zurückgegebener Nullen + -mit der Anzahl Adressen identisch, so ist offensichtlich keine Karte vorhanden. Diese Methode + -verhindert Fehldetektionen und gerade in Verbindung mit der Venatrixkarte ein Festfahren des HIVE + -zum Beispiel bei Aufruf der Cog-Anzeige. + -2440 Longs frei + +'################################################### Version 2.01 ################################################################################################################# + +21-12-2013 -Venatrix-Karten-Erkennung umgebaut, da sie nicht richtig funktionierte + -2432 Longs frei + +'################################################### Version 2.02 ################################################################################################################# + +27-01-2014 -es geht weiter + -Window-Routine wird von Bellatrix übernommen, entsprechend in Plexus gekürzt + -Fehler in der Popup_Info_weg Routine behoben, der rechte Schließen Button konnte auch nach dem Löschen des Fensters angeklickt werden + -Close_Klick und Double_Klick zusammengefasst + -2478 Longs frei + +30-01-2014 -Close_klick entfernt und durch ios.get_window ersetzt, dadurch Code gespart + -Routine Hauptschirm entfernt + -werde versuchen einen Scheduler einzubauen, mal sehen, was draus wird + -Icon's für Scheduler erstellt und erste Anzeigetests für die Bimmel -> sieht cool aus + -2468 Longs frei + +12-02-2014 -Änderungen in der admsid.spin, die Abfrage der Sepia-Karte muss vor dem Starten eines neuen Administra-Codes beendet werden, sonst funktionieren + -Programme, die eigenen Administra-Code mitbringen nicht korrekt -> in diesem Fall der IRC-Client von Joerg + -Jetzt ist das Starten des IRC-Clienten aus Plexus möglich :-) + -sollte jetzt auch das Problem mit Basic 2.1 und älteren Plexus-Varianten behoben sein? + +'################################################### Version 2.03 ################################################################################################################# +14-02-2014 -Beginn des Einbau's der Tastaturbedienung von Plexus + -Regal-Aufrufe auf die F-Tasten gelegt + -Mülleimer anzeigen, leeren auf Taste T und E + -Mount/Unmount auf Taste M + -SD-Card-Info auf Taste I + -Enter-Taste als OK-Tastenabfrage + -hoch und runter scrollt durch das Datei- und Ram-Monitor-Fenster + -Links sind startbar über Taste L und Nummerntaste 1..3 + -im Programms-Fenster per Nummerntaste DLL-Programm starten (momentan nur 1 und 2) + -System-Info-Fenster F6 und Nummerntasten 1-3 + -2314 Longs frei + +15-02-2014 -durch die Tastenbedienung wird eine Hilfe nötig, in der die Tastenbelegung erklärt wird + -Hilfefenster über Taste F1 erreichbar (eigentlich nur das Textdisplay, funktioniert auch so), ruft die Datei Hilfe.txt auf + -2311 Longs frei + +18-02-2014 -Tastatureinbindung fortgesetzt, Dateihandling im Explorer realisiert, noch nicht hundertprozentig perfekt ->Copy und Paste fehlt noch + -Handling im Color-Settings-Fenster und Baud-Settings fehlt noch + -2220 Longs frei + +19-02-2014 -Baud-Einstellung funktioniert mit Tastenbedienung + -Pfeilnavigation im Color-Fenster funktioniert + -Fehler in Dir-Speicher-Lösch-Routine behoben (ein Eintrag zuviel übrig geblieben) + -Korrektur der Explorer-Tastenbedienung (Scrollroutine hat nicht richtig funktioniert) + -2161 Longs frei + +20-02-2014 -ganz nebenbei wird noch eine DOS-Shell als DLL integriert (abgewandelte Regime-Version) + -diese ist im Programms-Fenster startbar + -2139 Longs frei + +22-02-2014 -Farbwerte im Color-Setting-Fenster können jetzt durch Eingabe des Dezimal-Farbwertes über die Tastatur geändert werden + -Auswahl über Pfeiltasten, Eingabe startet nach drücken der Tab-Taste + -Kalendernavigation über Tasten bedienbar (Pfeiltasten für Monats-und Jahr-Wechsel) + -Datum- und Uhrzeiteinstellung jetzt über die Tastatur möglich (mit Tab auswählen und mit Pfeiltasten hoch/runter einstellen) + -etwas Code zusammengefasst + -Hilfedisplay mit Playerstop-Abfrage ergänzt + -Copy und Paste jetzt auch über Tastatur erreichbar (C=Copy, P=Paste) + -Format-Befehl auf Taste F, wenn kein anderes Fenster angezeigt wird + -jetzt fehlt nur noch der RAM-Monitor und das Systemsetting-Fenster + -1939 Longs frei + +24-02-2014 -Systemsetting-Fenster über Tasten bedienbar (Tasten S und U) + -Auswahl der Ram-Bereiche im Ram-Monitor über die Tasten H und E änderbar + -1916 Longs frei + +25-02-2014 -RAM-Monitor jetzt über Tasten bedienbar + -das Löschen von Links ist über Taste Entf+1..3 möglich + -somit ist die komplette Tastenbedienung von Plexus realisiert !!! + +'################################################### Version 2.04 ################################################################################################################# +25-02-2014 -Fehler in der Dateiselektion behoben (nach dem Löschen des Dateifensters und Neuaufruf wurde der Scrollmarker falsch gelesen) + -Aktualisierung des Dateifensters beim Sprung des Dmp-Titel-Zählers zurück auf 1 (nach dem letzten Titel) + -1862 Longs frei + +26-02-2014 -Dateiliste wird jetzt nur von SD-geladen,wenn sich das Verzeichnis ändert + -bleibt man also im Verzeichnis , kann das Dateifenster beliebig oft geöffnet und geschlossen werden, ohne das ein Song unterbrochen werden muss + -Fehler im Aufruf der Dateiliste behoben, nach dem Mülleimer wurde das SD-Card Verzeichnis nicht mehr eingelesen, kam durch den neuen Change_marker + -1822 Longs frei + +27-02-2014 -einige Darstellungsfehler beim wiederherstellen des Infofenster-Hintergrundes behoben + -Parameterfenster für Start-Parameter von Links angefangen + -Handling der Links verbessert, jetzt können nur vorhandene Links zum starten,löschen oder parametrieren angewählt werden (Link_counter) + -Parameter-Fenster-Handling soweit fertig, jetzt muss nur noch die Eingabe (und das Ändern) funktionieren. + -1756 Longs frei + +28-02-2014 -Parametereingabe funktioniert soweit, zwar noch nicht perfekt, aber es geht. + -nun muss der entsprechende Parameter beim Start übergeben werden + -Texteingabe beim Terminal verbessert + -1639 Longs frei + +01-03-2014 -die Übergabe von Parametern scheint zu funktionieren + -neue Funktion in reg-ios eingefügt, paracopy (da die Parameter im Link-Speicher stehen wird mit paracopy direkt in den Parameter-Ram von Trios kopiert) + -Basic mit der Start-Parameter-Übernahme erweitert ->coole Sache, gleich beim Start Basic-Befehle ausführen zu lassen + -die Parameterfunktion müsste man jetzt mit anderen Programmen ausprobieren + -diverse Fehler in der Tastenabfrage, beim Attribut-Handling und dem Explorer-Aufrufen behoben, hat gekostet :-( + -DCF-Routinen zum Betrieb eines DCF-Empfängers in Administra und der Reg-Ios eingebaut + -Im Plexus Hauptbildschirm wird die Synchronisation in der oberen Titelleiste als Antennensymbol dargestellt + -synchronisiert wird die RTC dann jede Stunde, noch ist kein Empfänger dran aber morgen wirds ausprobiert :-) + -1573 Longs frei + +02-03-2014 -DCF-Modul an den Hive gehängt, noch gibt es Probleme mit der Synchronisation, diese funktioniert nur außerhalb des Gehäuses + -Prinzipiell funktioniert das Ganze .Vielleicht konstruiere ich das DCF-Modul als Steckmodul für den Erweiterungsbus + -nach diversen Versuchen ist klar, ein Einbau ins Hive-Gehäuse scheidet definitiv aus, da der Empfang zu stark gestört wird + -also werde ich den DCF-Empfänger extern betreiben, wie, weis ich noch nicht (Modul für Venatrix oder per Kabel an den Hive) + -zunächst folgt die Einbindung der Möglichkeit, den DCF-Empfänger unter Plexus auszuwählen (als externe DLL) + -und ein Testprogramm für den Empfänger wäre auch hilfreich (warscheinlich extern als DLL). + -1569 Longs frei + +03-03-2014 -einige Texte in den E-Ram ausgelagert, ram_txt-Routine gekürzt, dadurch einige Longs gespart + -1594 Longs frei + +04-03-2014 -damit im Root-Verzeichnis nicht zuviel Chaos durch diverse Dateien entsteht, werde ich ein Plexus-System-Verzeichnis erstellen, wo alle zu + -Plexus gehörenden Hilfsdateien enthalten sind. Das Verzeichnis heisst PLEXUS + -Plexus-Systemverzeichnis eingerichtet und entsprechende Änderungen im Code vorgenommen + -Plexus-DLL-Dateien entsprechend angepasst + -1570 Longs frei + +05-03-2014 -Grundgerüst DCF-Testprogramm erstellt + -kleine Korrekturen in der Icon-Darstellung vorgenommen + -überflüssige Variablen gelöscht + -Routine iconpress gekürzt + -1566 Longs frei + +'############################################################### Version 2.05 #################################################################################################### +09-03-2014 -Fehler in der Mount-Routine behoben, es wurde nicht ins Systemverzeichnis zum Lesen der Ini-Datei gesprungen + -dadurch wurden die Links nicht gefunden und nicht angezeigt + -DCF-Testprogramm weitergemacht, zeigt jetzt den aktuellen Status der Verbindung an mit diversen Parametern + -Bluetooth und WLAN-Symbol erstellt und in reg.fnt eingebunden + -die Symbole werden testhalber in der Titelleiste angezeigt, ein Bluetooth-Modul bei ebay erstanden, mal sehen wie es funktioniert + -als WLAN-Modul kommt warscheinlich ein Flyport zum Einsatz, erst mal bluetooth dann sehen wir weiter + -beide Module werden für Venatrix als Steckmodul ausgeführt + -Fehler in INI-Load-Routine behoben, Mauszeiger wurde nicht zurückgesetzt + -1548 Longs frei + +12-03-2014 -DCF-Empfang fest in Plexus integriert, Empfänger wird an ADM-Port 22 angeschlossen und in Administra abgefragt + -DCF-Empfänger wird im Setting-Menue aktiviert + -Synchronität wird in der Titelzeile durch ein Antennensymbol dargestellt (grau=nicht synchron, farbig=synchron) + -Fehler in Iniload behoben, DCF-Marker wurde nicht geladen + -reg.sys entsprechend angepasst, hier werden alle Ini-Werte als erstes geladen + -Abfrage des DCF-Empfängerstatus eingebaut um Mehrfachstart der DCF-Cog zu verhindern + -erste Versuche mit einem Bluetooth-Empfänger in Venatrix ->vielversprechend + -1513 Longs frei + +13-03-2014 -etwas Codeoptimierung + -1523 Longs frei + +14-03-2014 -Bluetooth-Settings über Programms-Fenster (Programm 5=bltooth.dll) aufrufbar, zum Konfigurieren des HC05 Bluetooth-Moduls + -noch etwas Codeoptimierung + -kleine Korrekturen in der Abfrage der DCF-Synchronität + -1515 Longs frei + +15-03-2014 -kleinere Anpassungen im Programmteil Input_Text (Scrollbereich wird aus den x-y-Übergabeparametern gebildet und ist nicht mehr fest) + -Tests mit dem Bluetooth-Modul sind erfolgreich, nur der PIN-LED will nicht funktionieren, lt.Datenblatt erst nach dem Pairing aktiv??? + -AT-Kommandos zum Konfigurieren sind einfach im Terminal einzugeben, vielleicht kann ich dadurch die DLL einsparen, mal sehen + -wird gepairt, müsste noch das Bluetooth-Symbol in der Titelleiste auftauchen. + -dazu muss der KEY-Pin aber an einen freien Port-Pin (Statusabfrage nur im AT-Modus möglich), ADM-Port 21? + -ADM-Port-Belegung 19+20=I2C (Sepia+Joystickkarte), 22=DCF-Modul, 21=Bluetooth-Key-Pin? + -timerzeahler-Schleife eingebaut um den BUS-Datenverkehr zu entlasten (nur jede 150zigste Schleife wird die Zeit abgefragt) + -DLL-Dateien mit DCF-Indikator ausgerüstet und ebenfalls timerzaehler-Schleifen eingebaut + -playerstop-Routine zentraler eingebaut (dadurch ein Long gespart) + -1499 Longs frei + +18-03-2014 -der Versuch, eine aktive Bluetooth-Connect-Anzeige in der Titelzeile zu implementieren, ist gescheitert + -der Hive reagiert mit Fehlfunktionen und festhängen + -die Bluetoothanzeige wird jetzt blau, wenn das Terminal (und damit der serielle Port) geöffnet wird + -1478 Longs frei + +19-03-2014 -System-Setting-Fenster umgebaut und mit der Bluetooth-Option erweitert + -Bluetooth_ON-Merker wird jetzt in der Ini-Datei gespeichert und geladen + -Laden der Error-und Systemtexte durch andere Laderoutine jetzt schneller,da jeder Text jetzt direkt im Speicher angesprungen wird + -dadurch eine viel schnellere Ausgabe, egal wieviele Texte sich im Ram befinden + -Bluetooth-Connect-Anzeige erfolgt jetzt über den LED-Ausgang des Moduls, wird an Port 16 von Venatrix abgefragt und entsprechend + -in der Titelleiste angezeigt -> das funktioniert jetzt perfekt + -Existiert Venatrix nicht, erfolgt die Connect-Anzeige sobald das Terminal-Fenster geöffnet wird (nicht real aber besser als nichts) + -das Scannen der Expansions-Karten erfolgt jetzt gleich beim Start von Plexus - somit braucht der venatrix und sepia Marker nicht in der Ini gespeichert werden + -und die Bluetooth-Connect-Anzeige funktioniert entsprechend + -1420 Longs frei + +20-03-2014 -Routine:Texteingabe in Text_Input integriert, dadurch ein paar Longs gespart + -1446 Longs frei + +21-03-2014 -Serial-Treiber ausgetauscht, dadurch weniger Datenverluste durch größeren Puffer ->hat aber gekostet :-( + -Versuch der Einbindung eines YModem-Treibers für die Datenübertragung von Plexus zum PC und zurück, mal sehen, obs funktioniert + -1218 Longs Frei + +22-03-2014 -Der YMODEM-Treiber funktioniert teilweise, die Übertragung zum PC funktioniert, umgekehrt leider noch nicht + -allerdings verschlingt der Treiber sehr viel Platz,deshalb wird er warscheinlich als Dll ausgelagert + -kleiner Vorgeschmack ->435 Longs frei :-( + -in Routine Popup ->ios.backup_area integriert + -1411 Longs frei + +23-03-2014 -YModem-Treiber als Dll erstellt + -Aufruf erfolgt im Explorer-Popupmenue (Send und Receive) + -Korrektur in der Regalabfrage, überdeckte ein Popup das Regal, konnte man den entsprechenden Menuepunkt nicht anwählen + -stattdessen wurde das darunterliegende Regalsymbol aktiviert + -Textdisplay-Routine in der Breite geändert, jetzt wird bis Position 34 geschrieben + -Standard-Puffergröße im seriellen Treiber auf 128 Bytes eingestellt + -1345 Longs frei + +25-03-2014 -Doppelten Seriell-Treiber wieder entfernt, da YMODEM als Dll ausgeführt wird, wieder etwas Platz + -Schaffung eines Return_Merkers, hier kann die Aktion (Als Tastencode) hinterlegt werden, die nach Rückkehr aus einer DLL ausgeführt werden soll. + -Dadurch entsteht eine noch bessere Illusion, das DLL's in Plexus integriert sind + -playerstop-routine beim Mülleimer entleeren hinzugefügt + -1392 Longs frei + +29-03-2014 -Sanduhr-Anzeige beim Beenden von DLL's hinzugefügt, damit entfällt die Rückkehrmeldung + -Fehler im Rückkehrmarker behoben, der entsprechende Rambereich wurde beim Erststart nicht gelöscht, dadurch wurde der Rückkehr-Verzeichnismarker + -mit unsinnigen Daten gefüllt + -1375 Longs frei + +Notizen : Window 0 = Hauptbildschirm, darf nicht anderweitig genutzt werden !!! + Window 1 = Utilitie-Fenster (serielles Terminal, Uhr-Einstellung,Color-Settings, Ram-Monitor,Player,Systemsettings,Baud-Einstellung) + Window 2 = Infofenster (SD-Card-Info,Kopierfenster,Messagebox,Datei-Info) +}} + +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 +'-------- Speicher für Titelliste --------------- +DMP_RAM = $40000 +'-------- Overlay-Puffer ------------------------ +BRAM = $50000 +'-------- Speicher für Systemfont --------------- +SYS_FONT = $66800 '....$693FF ' ab hier liegt der System-Font 11kb +Hour_Glass= $66800+(167*16*4) +MOUSE_RAM = $69400 '....$6943F ' User-Mouse-Pointer 64byte + +'-------- Speicher für Dateiliste --------------- +DIR_RAM = $69440 '....$7DFFF +'-------- YMODEM Temp-Speicher ------------------ +YMODEM_RAM = $7E400 '... $7E417 Name, der zu sendenden Datei, Was soll gemacht werden(0Empfang,1Senden)+Dirmarker +MARKER_RAM = $7E410 '... $7E414 Dirmarker-Speicher +RETURN_POINT= $7E420' Aktion nach Rückkehr aus YModem (zBsp.Explorer öffnen) +'-------- Speicher der Fenster-Tiles ------------ +WTILE_RAM= $7E500 '.... $7E5FF ' Win-Tile Puffer hier können die Tiles, aus denen die Fenster gebaut werden geändert werden +'-------- Speicher für Verknüpfungen ------------ +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 +RETURN_FLAG = $7FFFE 'Rückkehr-Flag aus gestarteter Bin-Datei + +ADM_SPEC = %00000000_00000000_00000000_01010011 +BEL_COLORS =64 +BEL_X =640 +BEL_Y =480 +BEL_ZEILEN =30 +BEL_SPALTEN =40 + +'INTERPRETER = $f004 'interpreteradresse (rom) + +Adressraum =4 'Adressbereich für Speicher-Monitor, Standardwert 4-stellig (plus 1 für ext.Ram) +'******************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 + +len = 80 'länge der Eingabezeile im Terminal +'------------- TASTENCODES ------------------------------------------------------- +Backspace = $C8 ' PS/2 keyboard backspace key +ESC_KEY = 27 +RETURN_KEY = 13 +Plus_Key = 43 +Minus_Key = 45 +Space_Key = 32 +TAB_KEY = 9 +ENTF_KEY = 186 +EINF_KEY = 187 + + +'------------- 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 +'------------- ALTGR+F ---------------------------------------------------------- +ALT_F1 = 159 +ALT_F2 = 158 +ALT_F3 = 157 +ALT_F4 = 156 +ALT_F5 = 144 +ALT_F6 = 145 +ALT_F7 = 146 +ALT_F8 = 147 +ALT_F9 = 151 +ALT_F10 = 150 +ALT_F11 = 149 +ALT_F12 = 148 +'----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 +'-------------------------------------------------------------------------------- + +VAR +'systemvariablen + byte mountmarker,tmptime 'Marker für Mountbefehl, Vergleichsvariable für Time-Funktion + byte buttonx[8] 'Knöpfe + byte buttony[8] + byte windownum[3] 'Arbeits-Windows + byte windowx[3] + byte windowy[3] + byte windowxx[3] + byte windowyy[3] + byte messagex 'x-Position der Messagebox + '---------------- Farben ------------------------------------------- + byte act_color 'Speicher für gewählte zeichenfarbe + byte hcolstatus 'statusleiste hintergrundfarbe + byte winhcol 'Fensterhintergrundfarbe + byte winframecol 'Fensterrandfarbe + byte shellhcol 'Hauptfensterfarbe + byte Titelhcol 'Titelleistenfarbe + byte titeltextcol 'Titelleistentextfarbe + byte statustextcol 'Statustextfarbe + byte buttonhcol 'Buttonhintergrundfarbe + byte buttontextcol 'Buttontextfarbe + byte messagehcol 'Messagebox-Hintergrundfarbe + byte messagetextcol 'Messagebox-Textfarbe + byte selectcol 'selektionsfarbe + byte mousecol 'Mauszeigerfarbe + byte panelcol 'Farbe des Utilitie-Panels + '------------------------------------------------------------------ + byte iconnr[30] 'Tilenummer des Icons + byte iconx[30] 'Icon Koordinaten + byte icony[30] + byte iconf1[30],iconf2[30],iconf3[30] 'Iconfarben + + byte buff[8] 'Dir-Befehl-variablen + byte filestring[13] 'selektierte Datei + + byte dumpstring[13] 'dmp-datei + byte copystring[13] 'kopier-string + word filenumber,dirnumber 'Anzahl Dateien und Verzeichnisse im aktuellen Verzeichnis + byte infomarker 'Marker für Info-Fenster-Anzeige + + byte ma,mb,mz 'Maus-Taste und Scrollrad + byte play 'Player läuft oder nicht + byte dirname[20] 'Directoryname + long scrollende,scrollanfang,zeilenanfang, zeilenende 'Variablen für Scrollfunktion + byte zeile,spalte 'Zeilen und spalten für terminalfenster + byte inputline[len] 'Eingabezeile Terminal + byte baud 'Baud-Parameter + byte tag,monat,stunde,minute sekunde 'Datum -und Zeit + word jahr + long startadresse,endadresse 'E-Ram-Monitor Variablen + byte menuemarker 'Marker für Startmenue + long filelen 'Dateigröße + byte filedir 'Marker ob Datei oder Verzeichnis + byte filehidden 'Datei versteckt Attribut + byte filesystem 'Datei System Attribut + byte filearchiv 'Datei Archiv Attribut + byte filerdonly 'Datei nur lesen Attribut + byte fileday 'Datei Erstellungstag + byte filemonth 'Datei Erstellungsmonat + byte selection 'selektierte Datei + word fileyear 'Datei Erstellungsjahr + byte popupx 'x und + byte popupy 'y-Koordinaten des Popupmenues + byte popupyy '2te y-koordinate + byte popupxx '2te x-koordinate + byte popupmarker 'Marker für Popupmenue + byte menue_nr 'nr des gerade angezeigten Menues + byte textline[12] 'Texteingabestring + long tp 'Texteingabe-übernahmestring + byte platz 'Platzhalter für Verzeichnisname in der Statusleiste + byte mc 'Mouse z-Koordinate + byte lines 'Zeilen im Dateifenster + byte attrmarker[4] 'Datei-Attribute-Marker + byte tabx[3],taby[3],tabl[3] 'Tab-Parameter + byte playerposition 'Position im Dmp-File + word dmpfiles 'Anzahl Dmp-Files im Verzeichnis + long dmplen 'Länge des Dmp-Files + word dumpnummer 'aktuelle Dmp-Nummer + word tmpplay 'temporäre Dmp-Nummer + byte buttontext[50] 'String mit allen Button-Texten (8*6 Zeichen) + byte attribute[4] 'Attribute-Set + byte font[25] 'Hilfsstring für Strings aus dem Ram + long rootdir 'root-Dirmarker + long systemdir 'system-Dirmarker + long trashdir 'Muelleimer-Dirmarker + long userdir 'user-Dirmarker + long targetdir 'Ziel-Dirmarker + long HEX_ADRESSE 'Adresse E-Ram-Monitor + word trashcounter 'Muellzähler + byte dump_ram 'Anzeige externer oder interner speicher + byte pfeil,pfeil_old 'Positionspfeil im Color-Fenster + byte change_marker 'Merker, das Verzeichnis geändert wurde + byte do_restore 'merker, ob Displayhintergrund wieder hergestellt wird + byte link_merker 'merker, ob bei geöffnetem Explorer ein Link angeklickt wird + byte attribut_fenster 'merker für Datei-Info-Fenster + '---------- Variablen für Programmverknüpfungen --------------- + long Link_marker[3] 'Dir_marker der 3 Links + byte link_string[40] 'String für die drei Links + byte link_pointer 'Linkposition + byte link_counter 'Linkzaehler + byte Verzeichnis_counter 'Verzeichnis-Tiefenzähler + byte muelleimer 'Marker für Muelleimerfenster + byte Show_Hid_Files 'Versteckte Dateien anzeigen Marker + byte Use_Trash 'Mülleimer Verwenden Marker + byte util 'Utilitie-Marker + '----------- Kalender-Variablen ------------------------------- + byte today + byte tag_zahl 'Anzahl Tage im Monat und Schaltjahrerkenner + byte Wert_Monat + word Wert_Jahr + '----------- Hervorhebungsbalken im Explorer ------------------ + byte y_old 'alte y-Koordinate + byte highlight 'Hervorhebungsmarker des Dateinamens + byte filestring_old[13] 'alter Dateiname + byte break 'Abbruch-Marker Kopier und Löschfunktion + byte old_color 'alte Farbe des Dateieintrages merken + '----------- Venatrix Variablen ------------------------------- + byte venatrix 'Venatrix-Marker + '----------- Sepia Variablen ---------------------------------- + byte sepia 'Sepia-Marker + + byte tab_taste 'Tab-Tasten-Zähler + byte kz 'Position im Scrollfenster Pfeiltasten + byte scr 'scrollmerker für Pfeiltasten + '___________ Kopier-Variablen --------------------------------- + long dmpaste,dmcopy 'Quell,Zielpfad-Merker + byte copy_all 'gesamten Verzeichnisinhalt kopieren + byte copy_marker 'Kopier-Marker + '----------- RAM-Monitor Variablen ---------------------------- + long pokeram,tmp_poke + '----------- DCF-Indikator ------------------------------------ + byte dcf_on + byte timezaehler + '----------- Bluetooth-Variablen ------------------------------ + byte Bluetooth_on,bl_connect + byte serial + + byte return_merker 'Rückkehraktion aus DLL + +dat + ini byte "reg.ini",0 'Ini-Datei für Farbwerte, Dateiverknüpfungen und Systemeinstellungen + errortxt byte "reg.err",0 + sepia_card byte "sepia.dll",0 'Sepia-Card-Testdatei + Venatrix_card byte "venatrix.dll",0 'Venatrix-Card-Testdatei + DOS_SHELL byte "dos.dll",0 'Dos-Shell + DCF77 byte "dcf.dll",0 'DCF77-Empfänger-Test + BLUETOOTH byte "bltooth.dll",0 'Bluetooth-Settings + Ymodem byte "ymodem.dll",0 'Ymodem-Funktion + + root byte ".. ",0 + dirhoch byte ". ",0 + Trash byte "TRASH ",0 + SYSTEM Byte "PLEXUS ",0 'Plexus-Systemverzeichnis + binfile byte "BIN",0 + extfile byte "DLL",0 'externe-Plexus-Programme + txtfile byte "TXT",0 + dmpfile byte "DMP",0 + basfile byte "BAS",0 + admfile byte "ADM",0 + belfile byte "BEL",0 + venfile byte "VNX",0 'Venatrix-Treiber + sysfile byte "SYS",0 + colorfile byte "CLR",0 'Farb-Schemen-Dateien + maus byte "MAU",0 'Mauszeiger-Dateien + + video_inf byte "VIDEO.NFO",0 + prg_inf byte "prg.nfo",0 + sound_nfo byte "sound.nfo",0 + + butOK byte " OK ",0 + Abbr byte "Cancel",0 + sysfont byte "reg.fnt",0 + promt byte "OK>",0 + Version byte "2.05",0 + New_dir byte "NEWDIR",0 + '------------ Tage ------------------------------------ + DAY1 byte "MO",0 + DAY2 byte "TU",0 + DAY3 byte "WE",0 + DAY4 byte "TH",0 + DAY5 byte "FR",0 + DAY6 byte "SA",0 + DAY7 byte "SO",0 + + DAYS word @DAY1,@DAY2,@DAY3,@DAY4,@DAY5,@DAY6,@DAY7 + + '------------ Monate ---------------------------------- + MON1 byte "JAN",0 + MON2 byte "FEB",0 + MON3 byte "MAR",0 + MON4 byte "APR",0 + MON5 byte "MAY",0 + MON6 byte "JUN",0 + MON7 byte "JUL",0 + MON8 byte "AUG",0 + MON9 byte "SEP",0 + MON10 byte "OKT",0 + MON11 byte "NOV",0 + MON12 byte "DEC",0 + + MONS word @MON1,@MON2,@MON3,@MON4,@MON5,@MON6,@MON7,@MON8,@MON9,@MON10,@MON11,@MON12 + '------------- Menueeinträge --------------------------- + info byte "Info ",0 + show byte "Show ",0 + link byte "Link ",0 + paste byte "Paste ",0 + copy byte "Copy ",0 + rename byte "Rename ",0 + send byte "Send ",0 + receive byte "Receive",0 + newdir byte "New Dir",0 + delete byte "Delete ",0 + parameter byte "Param. ",0 + starts byte "Start ",0 + unmount byte "Unmount",0 + mounts byte "Mount ",0 + format byte "Format ",0 + empty byte "Empty ",0 + Files byte "Files ",0 + Help byte "Help ",0 + Dirs byte "Dirs ",0 + settings byte "Settings ",0 + Programs byte "Programs ",0 + reboots byte " -REBOOT- ",0 + baud_set byte "Baud ",0 + + on byte "on ",0 + off byte "off",0 + + + windowtile byte 146,148,147,114,116,6,4,2,0,129,1,5,77,3,124,124,124 'Fenster-Tiles für WIN-Funktion + +PUB main | i + + ios.start + ios.sdmount 'sd-card mounten + mountmarker:=1 'mount-marker + activate_dirmarker(0) 'Root Verzeichnis + '-------------------------------------------------------------------------------------- + rootdir:=get_dirmarker 'Dir-Marker für root Verzeichnis lesen + userdir:=rootdir 'User-Dir-Marker erst mal mit root vorbelegen + + 'Systemverzeichnis-marker lesen + ios.sdchdir(@system) 'System-Verzeichnis lesen + systemdir:=get_dirmarker 'Dir-Marker lesen + activate_dirmarker(rootdir) 'wieder zurüeck ins root-Verzeichnis + + + iniload 'Ini-Datei mit Farbwerten laden + win_set_tiles 'Fenster-Tiles in den Speicher laden + + repeat i from 0 to 2 + windownum[i]:=windowx[i]:=windowxx[i]:=windowy[i]:=windowyy[i]:=-1 'Windowwerte initialisieren + buttonx[i]:=buttony[i]:=-1 + '****************** Hauptbildschirm ****************************************** + ios.printBoxColor(7,act_color, shellhcol,winhcol) + ios.printchar(12) 'cls + ios.loadtilebuffer(SYS_FONT,2816) 'Systemfont aus E-Ram nach Bella laden + + Bildschirmaufbau + + Muelleimer_erstellen + + dmpfiles:=0 'Dmp-File-Zähler auf null + tmpplay:=1 'Titelnummer auf eins + tab_taste:=0 'Tab_Tasten-Zähler auf null setzen + Verzeichnis_counter:=0 'Verzeichnis-Tiefenzähler auf null + play:=0 'Player aus + activate_dirmarker(userdir) 'Usermarker setzen + ios.ram_wrbyte(235,START_FLAG) 'Warm-Start-Flag + buttonweg 'button-Werte resetten + change_marker:=0 'Dateiverzeichnis muss eingelesen werden + do_restore:=1 'Hintergrund wieder herstellen + Scan_Expansion_Card 'Erweiterungskarten scannen + return_merker:=ios.ram_rdbyte(RETURN_POINT) + if return_merker>0 + ios.ram_wrbyte(0,RETURN_POINT) 'Rückkehraktion löschen + userdir:=ios.ram_rdlong(MARKER_RAM) + Verzeichnis_counter:=ios.ram_rdbyte(RETURN_POINT+1) + ios.ram_wrbyte(0,RETURN_POINT+1) 'Verzeichnis_counter lesen und RAM-Platz danach löschen + + 'num.init + repeat + + os_cmdinput 'Hauptprogrammschleife + + +PRI Win_Set_Tiles|i,a 'Tiles, aus denen die Fenster bestehen, in den Ram schreiben + i:=WTILE_RAM + a:=0 + repeat 17 + ios.ram_wrbyte(windowtile[a++],i++) 'Standard-Wintiles in den Ram schreiben + ios.windel(9) 'alle Fensterparameter löschen und Win Tiles senden +CON '################################################### Hauptprogrammschleife #################################################################################################### + '############################################################################################################################################################################## + +PRI os_cmdinput | x,y ,i,col,dk,kb,b,kl,fst,term_aus,kn,bd,tmp + + lines:=21 'Zeilen im Dateifenster + zeilenanfang:=1 'erste Zeile im Dateifenster + playerstop 'Player stoppen, wenn läuft + term_aus:=0 'Terminal aus + copy_marker:=0 'Kopiermarker löschen + copy_all:=0 'Marker für alle Dateien-Operation löschen + muelleimer:=0 'Mülleimer-Marker + y_old:=3 'Initialwert für Hervorhebungsbalken + highlight:=0 'keine Hervorhebung + scr:=0 + pfeil:=baud+6 + if return_merker + keyboardscan(return_merker) +'##################################### Hier gehts los ############################################################################################################################# + repeat + time 'Zeit und Datum anzeigen + 'Bluetooth_Abfrage + ma:=ios.mouse_button(0) 'linke Maustaste + mb:=ios.mouse_button(1) 'rechte Maustaste + mz:=ios.mousez 'scrollrad + kb:=ios.key 'Tastenabfrage (für Zusatzfunktionen) + 'if kb + 'printdec_win(verzeichnis_counter,1,1) 'nur Test, um die Tastencodes zu erfahren + +'********************** Dmp_Player-Automatik -> spielt alle im Verzeichnis befindlichen Dmp-Dateien ab ****************************************************** + if play==1 + if ios.sid_dmppos<1 'Playerposition abfragen, Player stoppen, wenn Titel abgespielt wurde + playerstop + tmpplay++ 'und zum nächsten Titel springen, wenn vorhanden + if tmpplay>dmpfiles + tmpplay:=1 'wenn letzter Titel abgespielt wurde, zum ersten springen + selection:=1 'Selection zurücksetzen + scr:=0 'Scrollmarker löschen + if util==11 'Dateifenster sichtbar? + show_always 'Dateiliste neu aufbauen + selection:=2 + if util==11 and infomarker==0 and highlight==1 'Dateifenster nur scrollen, wenn kein Infofenster angezeigt wird + kb:=5 'nächsten Titel im Dateifenster hervorheben + getdmpname(tmpplay-1) 'Titelnamen holen + Player_sichtbar 'wenn Player sichtbar, dann Titel im Playerfenster anzeigen + + abspielen(Windownum[1]) 'Player starten (wenn Fenster da ist, balken löschen) + print_status(@dumpstring,7+platz,29) 'Titel in der Statusleiste anzeigen + +'**************************************** Globale Tasten-Abfrage ******************************************************************************************** + if kb + keyboardscan(kb) 'Tastatur auf Befehls-Tasten abfragen + case util + 2:i:=kb-"0" 'System-Info-Fenster + if i>0 and i<4 + show_tab(i) + + 7:i:=kb-"0" 'im Programms-Fenster per Nummerntaste Programm auswählen + do_restore~ + popup_info_weg 'Popup-Menues löschen + + case i + 1:RUN_SYS(@sepia_card,F3_KEY) + 2:RUN_SYS(@Venatrix_card,F3_KEY) + 3:RUN_SYS(@DOS_SHELL,F3_KEY) + 4:RUN_SYS(@DCF77,F3_KEY) + 5:RUN_SYS(@BLUETOOTH,F3_KEY) + +'************** DMP-Player-Fenster ******* Steuerung durch Mausbedienung ************************************************************************************ + if util==6 and windownum[1]==1 'Fenster sichtbar? + + + if ios.sid_dmppos>0 and play>0 + tmp:=dmplen/19 'anzahl Samples pro block + printdec_win(dmplen-ios.sid_dmppos,8,9) 'aktuelle Sampleposition anzeigen + playerposition:=(dmplen-ios.sid_dmppos)/tmp 'balkenposition + positionsbalken(playerposition,8,11) 'Fortschrittsbalken aktualisieren + printdec_titel(dmpfiles,6,25) 'Anzahl der gefundenen DMP-Files in der Titelleiste anzeigen + + if ma==255 'Mouse-Taste gedrückt + x:=ios.mousex 'x und y-Position der Maus beim drücken + y:=ios.mousey + repeat i from 10 to 12 + if x==iconx[i] and y==icony[i] and dmpfiles>0 'Playertasten gedrückt und mindestens eine Dmp-Datei im Verzeichnis + if i==11 and play==1 'icon stop, wenn Player läuft + iconnr[11]:=PLAY_PIC + else + iconnr[11]:=STOP_PIC 'icon Play anzeigen + iconpress(i,0) 'icon-drücken-Effekt + case i + 10:tmpplay:=wert_plusminus(2,tmpplay,1,dmpfiles) 'titel zurück + 11:if play==1 'play/stop + play:=0 + balkenleer 'Positionszähler auf Null setzen + else + play:=1 + 12:tmpplay:=wert_plusminus(1,tmpplay,1,dmpfiles) 'titel vor + playsong(tmpplay,1) + print_status(@dumpstring,7+platz,29) 'Titel in der Statusleiste anzeigen + dmp_name 'Titel und Samples im Playerfenster anzeigen + + + +'********************************************************************************************************************************************************************************* + +'**************************************** rechte Maustaste *********************************************************************************************************************** + if mb==255 + do_restore:=1 'bei Maus-Bedienung Hintergrund wieder herstellen + popup_info_weg + repeat while ios.mouse_button(1)>0 + x:=ios.mousex + y:=ios.mousey + + '--------------------------------------------- SD-Card-Symbol ----------------------------------------------------------------------------------- + if ((x=>36) and (x=<37) and (y=>4) and (y=<5)) 'SD-Card-Symbol mit der rechten Maustaste anklicken ( Mount/Unmount) + popup(33,6,39,9) 'feste Position, sonst sind Fehldarstellungen möglich + popup_entry(0,@info,0) + if mountmarker==1 'wenn SD-Card gemounted, unmount anzeigen + popup_entry(1,@unmount,0) + else + popup_entry(1,@mounts,0) 'Mount anzeigen, wenn SD-Card nicht gemounted ist + + popup_entry(2,@format,1) + menue_nr:=2 'Marker SD-Card-Popupmenue + '-------------------------------------------- Mülleimer-Symbol ---------------------------------------------------------------------------------- + if ((x=>36) and (x=<37) and (y=>23) and (y=<24)) 'Mülleimer-Symbol mit der rechten Maustaste anklicken ( Mount/Unmount) + popup(33,25,39,27) 'feste Position, sonst sind Fehldarstellungen möglich + popup_entry(0,@empty,0) + popup_entry(1,@show,1) + menue_nr:=3 'Marker Mülleimer-Popupmenue + + '-------------------------------------------- Link-Symbole --------------------------------------------------------------------------------------- + + if ((x==37) and ((y==8) or (y==13) or (y==18))) 'Link-Symbol mit der rechten Maustaste anklicken + i:=linkpos(y-8) 'erster Eintrag bei popupy=8+2 (da das Popupmenue 2 Zeilen unter dem Symbol angezeigt wird) + get_link(LINK_RAM,i) 'Link-Name holen + if strsize(@filestring)>1 'Link-Name gültig? 'sonst wird im zweifelsfall zuwenig wieder hergestellt + popup(33,y+2,39,y+5) 'feste Position, sonst sind Fehldarstellungen möglich + popup_entry(0,@starts,0) 'Link starten + popup_entry(1,@parameter,0) 'Startparameter für Link + popup_entry(2,@delete,1) 'Link löschen + menue_nr:=4 'Marker Link-Popupmenue + + '---------------------------------------- Dateifenster rechtsklick ------------------------------------------------------------------------------- + if ((x=>4) and (x=<16) and (y=>3) and (y=< 24)) + if util==11 + + selection:=y-3 'selektierte Datei nr + getfilename(selection+scrollanfang) + if y<>y_old and selection=0 and not ( strcomp(@filestring,@dirhoch)) 'Popupfenster soll nur im gültigen bereich auftauchen + + if y>19 'popupmenue passt nicht, wenn y>23 ist + popup(x,19,x+6,30) + else + popup(x,y,x+6,y+10) + popup_entry(0,@info,0) + popup_entry(1,@show,0) + popup_entry(2,@link,0) + if copy_marker==1 + popup_entry(3,@paste,1) + else + popup_entry(3,@copy,1) + popup_entry(5,@rename,0) + popup_entry(6,@newdir,0) + popup_entry(7,@send,0) + popup_entry(8,@receive,0) + popup_entry(9,@delete,1) + menue_nr:=1 'Marker-Dateifenster-Popupmenu + + +'******************************************** linke Maustaste ******************************************************************************************************************** + if ma==255 + + dk:=0 + x:=ios.mousex + y:=ios.mousey + kl:=ios.get_window//10 'Icon-Button-Nummer des Fensters + fst:=kl/10 'Nummer des Fensters + do_restore:=1 'bei Maus-Bedienung Hintergrund wieder herstellen +'------------------------------------------------- Fenster-Schließen ------------------------------------------------------------------------------------------------------------- + if kl==1 'Abfrage auf Fensterloeschen + if doppelklick + Close_Window(fst) + if attribut_fenster 'beim Schließen des Attribut-Fensters SD-Card neu einlese + mc:=SD_CARD + attribut_fenster:=0 + if kl==2 + Close_Window(fst) + if attribut_fenster + mc:=SD_CARD + attribut_fenster:=0 + + '----------- SD-Card-Symbol ------------------- + if (x==36 or x==37) 'SD-Card-Symbol druecken + if (y==4 or y==5) + keyboardscan(F2_KEY) 'Dateifenster anzeigen + + '----------- Mülleimer-Symbol ----------------- + elseif (y==23 or y==24) and (not popupmarker) 'Mülleimer-Symbol druecken, wenn kein Menue angezeigt wird + keyboardscan("T") 'Mülleimerfenster anzeigen + '********************** Desktopverknüpfungen starten ******************************************************** + if (x==37) and (y==8 or y==13 or y==18) + if doppelklick + i:=(y/5)-1 'Linknummer errechnen + LINK_START(i) + +'########################################################### Globale Funktionstasten ############################################################################################ + + '*********************** Mausklick in Titelleiste ******************************************************* + if y==0 'Beenden-Knopf + if x==39 + cmd_reboot + elseif x==0 'Beenden bei Doppelklick auf linke obere Ecke + if doppelklick + cmd_reboot + + '------------ Kalender aufrufen ----------------------------------- + elseif (x=>29) and (x=<38) + if doppelklick + keyboardscan(F11_Key) + + '------------ About-Box aufrufen ---------------------------------- + elseif x=>1 and x=<16 + if doppelklick + about + + '*********************** Mausklick in Statusleiste ****************************************************** + '------------ Zeit/Datum-Einstellungen ---------------------------- + if y==29 + if(x=>34) and (x=<38) + if doppelklick + keyboardscan(F7_Key) + + '------------ Start-Menue ----------------------------------------- + elseif (x=>0) and (x=<4) 'Start-Knopf + buttonpress(3) + do_restore:=1 + if menuemarker==1 + popup_info_weg + else + popup_info_weg + startmenue + + + '****************************** Globale Abfrage OK und Cancel-Button ***************************** + + if(x=>buttonx[4]) and (x=buttonx[1]) and (x=buttonx[2]) and (x=<(buttonx[2]+6)) and (y==buttony[2]) 'cancel + buttonpress(2) + keyboardscan(27) + + + +'*************************************************************************************************************** +'################################################################################################################################################################################## + +'############################################### Popup-Menues ##################################################################################################################### + + '********************** Popup-Menue-SD-Card abfragen ******************************************************** + if popupmarker==1 and menue_nr==2 + if x=>popupx and x=popupx) and (x=popupx) and (x=0 and x=<9 + case y + 18:popupselect(@Help,0,y) + keyboardscan(F1_Key) + + 20:popupselect(@baud_set,0,y) + keyboardscan(ALT_F5) + + 22:popupselect(@settings,0,y) + keyboardscan(ALT_F2) + + 24:popupselect(@programs,0,y) + keyboardscan(F3_Key) + + 27:popupselect(@reboots,0,y) + keyboardscan(F12_Key) + else + do_restore:=1 + popup_info_weg 'Menue loeschen, wenn man woanders hinklickt + + +'***************************************************************************************************************** +'########################################################################################################################################## + +'****************************** ICON-Regal-Funktionsaufruf ******************************************************** + ifnot popupmarker + repeat i from 0 to 6 + if (x=>iconx[i] and x=tabx[i] and x=7) and (x=<22) and (y=>4) and (y=<7) 'angeklickte farbe ermitteln + col:=((x-7)*4)+(((y-4)*16)*4) + print_win(string(" "),19,9) + printdec_win(col,9,19) 'Farbwert dezimal anzeigen + farbe(pfeil-9,col) + refreshpaint + + if (x=>7) and (x=<16) and (y=>9) and (y=<23) 'Auswahl Eintrag + pfeil:=y + WIN_TILE(16,pfeil_old,6) + WIN_TILE(46,pfeil,6) + print_win(string(" "),19,9) + printdec_win(get_farbe(pfeil-9),9,19) + pfeil_old:=pfeil + + '************** Ram-Monitor ************************************************** + 5: + if y==4 + if (x=>8) and (x=<13) + keyboardscan(TAB_KEY) 'Adresseingabe + + if x==23 'Auswahl Hub-Ram + keyboardscan("H") + + if x==31 'Auswahl E-Ram + keyboardscan("E") + + if (x=>8) and (x=<23) and (y=>6) and (y=<24) and dump_ram==1 'Werte poken nur im eram erlaubt + pokeram:=tmp_poke:=Poke_Ram(x,y) 'Adresse aus x/y-Koordinaten errechnen + bd:=x-8 + kn:=lookupz(bd:0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7) 'kn vorbelegen, damit nur bis zum 8.Byte in einer Zeile geschrieben wird + bd:=lookupz(bd:8,8,10,10,12,12,14,14,16,16,18,18,20,20,22,22) 'ungeraden x-wert korrigieren, damit immer an die richtige Byteposition geschrieben wird + x:=bd + printhex(ios.ram_rdbyte(pokeram),2,x,y,act_color,winhcol) 'Erste Adresse hervorheben + ram_input(bd,kn,x,y) 'Eingabe Daten + + 7: '****************** Programms-Fenster, noch nicht fertig ******************* + repeat i from 13 to 21 + if (x==iconx[i] or x==iconx[i]+1) and (icony[i]==y) + if i<13 or i>14 + iconpress(i,1) 'Icon-drücken-Effekt Zweitile-Icon anzeigen + else + iconpress(i,0) 'icon-drücken-Effekt Eintile-ICON + do_restore:=1 + popup_info_weg 'Popup-Menues löschen + case i + 13:RUN_SYS(@DCF77,F3_KEY) + 14:RUN_SYS(@BLUETOOTH,F3_KEY) + 19:RUN_SYS(@sepia_card,F3_KEY) + 20:RUN_SYS(@Venatrix_card,F3_KEY) + 21:RUN_SYS(@DOS_SHELL,F3_KEY) + + '********************************************************************************* + + '************** System-Settings ************************************************** + + 8:if x==18 + if y==8 'Settings tooglen + keyboardscan("S") 'Versteckte Dateien anzeigen oder nicht + elseif y==10 + Keyboardscan("U") 'Mülleimer benutzen oder nicht + if x==32 + if y==8 + keyboardscan("D") 'DCF-Empfang on/off + elseif y==10 + keyboardscan("B") 'HC05-Bluetooth-Module ja/nein + + '*************** Kalender ******************************************************** + 9:if y==5 + repeat i from 15 to 18 + if iconx[i]==x + iconpress(i,0) + case i + 15:Wert_Monat:=wert_plusminus(2,Wert_Monat,1,12) + 16:Wert_Monat:=wert_plusminus(1,Wert_Monat,1,12) + 17:Wert_Jahr:=wert_plusminus(2,Wert_Jahr,1600,2500) + 18:Wert_Jahr:=wert_plusminus(1,Wert_Jahr,1600,2500) + Zeichne_Kal(Wert_Monat,Wert_Jahr) + + '------------ Baud-Einstellung ____________________ + 10:pfeil_old:=baud+6 + if x=>13 and x=<18 and y=>6 and y=<14 + pfeil:=y + WIN_TILE(16,pfeil_old,12) + WIN_TILE(46,pfeil,12) + pfeil_old:=pfeil + baud:=pfeil-6 + +'******************************* Aktionen im Dateifenster ************************************************************************************************************************ + 11: + + '************************ Info-Fenster ****Dateiattribute setzen********************* + + if infomarker==1 + Mouse_Release + repeat i from 11 to 23 step 4 + + if (x==i) and (y==windowy[2]+6) + case i + 11:keyboardscan("R") + 15:keyboardscan("H") + 19:keyboardscan("S") + 23:keyboardscan("A") + + '************************ Popupmenue ************************************************ + if popupmarker==1 and menue_nr==1 + + if(x=>popupx) and x=2) and (x=<14) and (y=>3) and (y=< 24) and infomarker==0 + popup_info_weg + selection:=y-3 + kz:=selection + getfilename(selection+scrollanfang) 'selektierte Datei nr + if y<>y_old 'nur einmal hervorheben + highlight++ 'angeklickter Dateiname wird hervorgehoben + if highlight>0 'erster Klick hebt hervor, Popupmenueklick wird ignoriert da -1 + highlight_selection(y) + + if doppelklick and mountmarker==1 + keyboardscan(Return_Key) + + +'############################################################################################################################# + + +'**************************** Maus Scrollrad **************************************** + if mc>mz or (x==34 and y==3 and ma==255) 'hochscrollen + if util==11 and infomarker==0 'Dateifenster nur scrollen, wenn kein Infofenster angezeigt wird (byte kann keine -1 sein also 255) + if filenumber>21 'Dateianzahl höher als Zeilen im Dateifenster? + scrollrunter 'Bildschirm scrollen + if scr>0 + scr-- + Highlight_balken 'auf Gültigkeit der Balkenposition prüfen + mc:=mz + if util==5 'E-Ram-Monitor + adresseminus + scrolldown(startadresse) + mc:=mz + + if mc21 + scrollhoch 'Bildschirm scrollen + if scr9 'Farbeinstell-Fenster + pfeil-- + WIN_TILE(16,pfeil_old,6) + WIN_TILE(46,pfeil,6) + print_win(string(" "),19,9) + printdec_win(get_farbe(pfeil-9),9,19) + pfeil_old:=pfeil + + 5: 'E-Ram-Monitor + adresseminus + scrolldown(startadresse) + mc:=mz + 9: 'Kalender-Jahr zurückblättern + Wert_Jahr:=wert_plusminus(1,Wert_Jahr,1600,2500) + Zeichne_Kal(Wert_Monat,Wert_Jahr) + + 10:pfeil_old:=baud+6 'Baud-Setting-Fenster + if pfeil-6>0 + pfeil-- + WIN_TILE(16,pfeil_old,12) + WIN_TILE(46,pfeil,12) + pfeil_old:=pfeil + baud:=pfeil-6 + + 11:if infomarker==0 'Dateifenster nur scrollen, wenn kein Infofenster angezeigt wird (byte kann keine -1 sein also 255) + highlight:=1 + IF selection>1 + selection-- + getfilename(selection+scr) + + if selection==1 and scr>0 + scrollrunter + scr-- + highlight_selection(selection+3) + + + if kb==5 'runterscrollen + case util + 3: Date_Time(tab_taste,2) 'Datum-Zeit-Einstellung + + 4: 'Farbfenster + if pfeil<23 + pfeil++ + WIN_TILE(16,pfeil_old,6) + WIN_TILE(46,pfeil,6) + print_win(string(" "),19,9) + printdec_win(get_farbe(pfeil-9),9,19) + pfeil_old:=pfeil + + 5: 'E-Ram-Monitor + adresseplus + scrollup(endadresse) + mc:=mz + + 9: 'Kalender-Jahr weiterblättern + Wert_Jahr:=wert_plusminus(2,Wert_Jahr,1600,2500) + Zeichne_Kal(Wert_Monat,Wert_Jahr) + + 10:pfeil_old:=baud+6 + if (pfeil-6)<8 + pfeil++ + WIN_TILE(16,pfeil_old,12) + WIN_TILE(46,pfeil,12) + pfeil_old:=pfeil + baud:=pfeil-6 + + 11:if infomarker==0 'Dateifenster nur scrollen, wenn kein Infofenster angezeigt wird + highlight:=1 + if selection21 + if scr"0" and c=<"9" + c-="0" + m:=1 + until m==1 + +pri input_zahl(y,x,old_farbe)|k,sp,i,ok ,ad 'Eingabe von Zahlenwerten + sp:=x-1 + i:=0 + ad:=3 'anzahl Zeichen + repeat + k:=ios.key + ma:=ios.mouse_button(0) + + if k==13 'Return? dann neue Zeile + ok:=1 + textline[i++]:=0 + quit + if k==27 'Abbruch + ok:=0 + quit + if k==ios#CHAR_BS 'Backspace + if i>0 + WIN_TILE(16,y,sp+i) + i-- + if k=>"0" and k =< "9" 'Nur Zahlen 0-9 + textline[i++]:=k + WIN_TILE(k-16,y,sp+i) + if i==ad + textline[i++]:=0 + ok:=1 + quit + + if ok==1 + tp:= @textline + result:=getnumber + else + result:=old_farbe + +pri ram_input(bdn,knn,x,y)|i,k,zahl 'Eingabe in den RAM-Monitor + + i:=0 + + repeat 'Tasteneingabe + k:=ios.key + if i==2 'ein Byte geschrieben + textline[i++]:=0 'String abschliessen + tp:= @textline + zahl:=getHexnumber 'Hex-String in Zahl umwandeln + ios.ram_wrbyte(zahl,pokeram++) 'in ERam schreiben + i:=0 'Zeichen-Zähler auf null + knn++ 'Spaltenzähler erhöhen + if (k=>"0" and k =< "9") or (k=>"A"or k=>"a") and (k=<"F"or k=<"f") 'Nur Zahlen und A-F + WIN_TILE(k-16,y,x++) 'Zeichen ausgeben + textline[i++]:=k 'Zeichen in String schreiben + if k==27 or k==13 or knn==8 'ende bei esc oder enter oder Zeile voll + dump(tmp_poke-((bdn-8)/2),2,y,Dump_ram) 'geänderte Zeile anzeigen + quit + +con'***************************************** Tastatur-Abfragen ****************************************************************************************************************** +pri keyboardscan(k)|i,err,a,c,d,e,formatok 'Tastatur-Befehlsabfrage + do_restore~ 'bei Tastenbedienung, Hintergrund nicht herstellen + case k + 9:'Tab-Taste + case util + 3: 'Datum-Uhrzeit-Einstellung + c:=0 + d:=0 + e:=1 + print_win(string(" "),21,9+5) 'untere letzte Position löschen + print_win(string(" "),21,9) 'obere letzte Position löschen + tab_taste++ + if tab_taste>6 + tab_taste:=1 + if tab_taste>3 + c:=5 'Y-Position für Zeit-Einstellung + d:=3 + + a:=((tab_taste-d-1)*6)+9 'X-Position errechnen für ausgewählten Wert + print_win(string("*"),a,9+c) 'Auswahl markieren mit Stern + if tab_taste>1 + if tab_taste<>4 + print_win(string(" "),((tab_taste-d-e-1)*6)+9,9+c) 'alte Position Stern löschen (untere Reihe) + + + 4: 'Color-Setting-Fenster + a:=get_farbe(pfeil-9) 'Farbwert des der Auswahl holen + printdec_win_revers(a,9,19) 'Zahleneingabefeld hervorheben + c:=Input_Zahl(9,19,a) 'neue Zahl eingeben + farbe(pfeil-9,c) 'geänderte Farbe setzen + refreshpaint 'Ansicht aktualisieren + print_win(string(" "),19,9) 'Zahlenfeld löschen + printdec_win(c,9,19) 'Zahlenwert normal darstellen + + 5:Dumpadresse 'Adresseingabe RAM-Monitpr + + + 13:'Enter bzw.OK + case util 'Utilfenster, bei dem bei Druck auf OK etwas gespeichert werden muss + 0,2:close_all_win 'Cogs-Fenster, Systeminfo + 3:tab_taste:=0 + ios.setdate(tag) 'Systemuhr setzen + ios.setmonth(monat) + ios.setyear(jahr) + ios.sethours(stunde) + ios.setminutes(minute) + ios.setseconds(sekunde) + displaytime + close_all_win + 4:inisave 'Farbwerte saven + Bildschirmaufbau + util:=0 'neue Farbwerte für Windowloesch Routine + + 5:if dump_ram==1 'Werte poken nur im E-Ram + pokeram:=tmp_poke:=HEX_ADRESSE + printhex(ios.ram_rdbyte(pokeram),2,8,6,act_color,winhcol) 'Erste Adresse hervorheben + ram_input(8,0,8,6) + + + 8,10:inisave 'Baudrate saven,Systemsettings saven + Bildschirmaufbau + + 11:scanstr(@filestring,1) + '******************************Dateien starten oder Verzeichnis wechseln************* + if selection=0 'ist was im Mülleimer drin? + if display_error(31) 'fragen, ob endgültig löschen? 'Abfrage auf OK + SCAN_Trash(1) 'Inhalt löschen + "F","f":if util==0 'kein anderes Fenster offen + if display_error(28) 'Frage Format? anzeigen und abfragen + formatok:=ios.sdformat(string("PLEXUS")) 'SD-Card-Name + if formatok + display_error(formatok) 'Fehlerausgabe wenn erfolglos + else + Display_error(27) 'wenn geklappt -> Fertigstellungs-Fenster + mount 'sicherheitshalber unmounten + wait(80000) 'etwas warten + mount 'und wieder mounten + LINK_LOAD(0) + Bildschirmaufbau + inisave + Muelleimer_erstellen 'Trash-Verzeichnismarker aktualisieren + + "H","h":if util==5 + dump_ram:=0 + toogle_value(dump_ram,21,4,1) + toogle_value(1,29,4,1) + ramdump(hex_adresse) + if util==11 and infomarker==1 + attrmarker[1]:=toogle_value(attrmarker[1],7,14,2) + write_attrib + + "I","i":if util==11 'Nur im Dateifenster + infofenster(8,10,28,14,ram_txt(33),0) 'Infofenster hat jetzt feste Position + FILE_INFO_FENSTER + attribut_fenster:=1 + else + infofenster(12,10,27,20,ram_txt(32),1) 'SD-Card-Info-Fenster anzeigen + SD_CARD_INFO 'Fenster mit Info's füllen + + "L","l":if util==11 'Link erstellen + playerstop + getfilename(selection+scrollanfang) + if muelleimer==0 'Links aus dem Muelleimer sind nicht zulässig + Make_link(get_dirmarker) + else + i:=scan_number_key + if i=>0 and i=0 and i=0 and i=0 + case k + plus_key:tmpplay:=wert_plusminus(1,tmpplay,1,dmpfiles) 'titel vor + minus_key:tmpplay:=wert_plusminus(2,tmpplay,1,dmpfiles) 'titel zurück + Space_Key:if play==1 'play/stop + play:=0 + else + play:=1 + playsong(tmpplay,Windownum[1]) 'Player starten (wenn Fenster da ist, balken löschen) + print_status(@dumpstring,7+platz,29) 'Titel in der Statusleiste anzeigen + Player_sichtbar 'Titel und Samples im Playerfenster anzeigen + + + 159:about 'ALT_F1 About-Box + 158:util:=8 + setting_window 'ALT_F2 Setting-Window + 157:'ALT_F3 + 156:'ALT_F4 + 144:util:=10 'ALT_F5 Baud-Einstellfenster + baudselect(baud) + 145:'ALT_F6 + 146:'ALT_F7 + 147:'ALT_F8 + 151:'ALT_F9 + 150:'ALT_F10 + 149:'ALT_F11 + 148:'ALT_F12 + + + 208:Show_Help 'F1 Hilfe + 209:activate_dirmarker(userdir) 'Verzeichnismarker setzen + util:=11 + mc:=SD_Card 'F2 datei-fenster + if Verzeichnis_counter>0 + Get_Verz_Name + 210:util:=7 + Programms 'F3 Programms-Fenster + 211:util:=0 + CoreAnzeige 'F4 Belegung der Cogs anzeigen + 212:util:=1 + Terminal 'F5 serielles Terminal + bytefill(@inputline,0,80) + Text_Input(1,2,33,4,23,1,0,0) + + 213:util:=2 + Sysinfo 'F6 Systeminformationen anzeigen + print_info(vidnfo,6,8) + 214:util:=3 + Clock 'F7 Uhr-und Datums-Einstellfenster + 215:util:=4 + Color 'F8 Farb-Einstell-Fenster + pfeil:=9 + pfeil_old:=9 + 216:util:=5 + RamDump(HEX_ADRESSE) 'F9 Speichermonitor anzeigen + scrollanfang:=HEX_ADRESSE + startadresse:=HEX_ADRESSE + endadresse:=HEX_ADRESSE+144 + 217:util:=6 + Player(tmpplay-1) 'Sid-Dmp-Player anzeigen + 218:util:=9 + Kalender + 219:cmd_reboot + +pri YMODEM_Tool(mode)|a,i 'Aufruf der YMODEM-Routine + a:=YMODEM_RAM + i:=0 + if mode + repeat strsize(@filestring) + ios.ram_wrbyte(filestring[i++],a++) 'Dateiname merken + ios.ram_wrbyte(mode,YMODEM_RAM+15) 'was soll gemacht werden (senden/empfangen) + run_sys(@ymodem,F2_KEY) 'Rückkehraktion + +pri abfrage_Link_del(n) 'Abfrage, ob link gelöscht werden soll + + error(29) 'Messagebox-Link-löschen? + get_link(LINK_RAM,n) 'Link-Name holen + print_message(@filestring,15,13) 'Link-Name in Messagebox anzeigen + if abfrage 'OK-Taste abfragen + Delete_Link(n,(n*5)+8) 'Link löschen + +pri run_sys(str,mark) 'starten der eingebetteten Programme + playerstop + ios.ram_wrlong(userdir,MARKER_RAM) 'aktuellen Verzeichnismarker merken + ios.ram_wrbyte(mark,RETURN_POINT) 'Aktion nach Rückkehr setzen + ios.ram_wrbyte(verzeichnis_counter,RETURN_POINT+1) 'Verzeichnis-Tiefenzähler muss auch gemerkt werden + activate_dirmarker(systemdir) + + ifnot OPEN_FILE(str) + ios.ldbin(str) + +pri Highlight_balken 'ist der Hevorhebungsbalken außerhalb des Scrollbereiches, dann gemerkte Werte löschen + + if y_old<4 or y_old>24 'außerhalb Scrollbereich? + reset_Highlight 'Parameter für die Hervorhebung löschen + +pri reset_Highlight 'Hervorhebungsparameter löschen (z.Bsp.bei Aufruf eines Unterverzeichnisses) + + highlight:=0 'Hervorhebungsmarker löschen + bytefill(@filestring_old,0,12) 'Dateinamen-Puffer löschen + +PRI highlight_selection(position) 'Dateiname mit einem farbigen Balken hervorheben + if util==11 and position>3 'nur im Dateifenster ab position y==4 hervorheben + if highlight 'erstes mal Datei angeklickt(keine Old-Parameter) + + display_line(@filestring,position,winhcol,act_color) 'Dateiname mit Balken anzeigen + + if highlight and strsize(@filestring_old)>0 'Hervorhebung aktiv und String im Puffer? + + display_line(@filestring_old,y_old,old_color,winhcol) 'alter Dateiname an alter Position ohne Balken anzeigen + bytemove(@filestring_old,@filestring,12) 'neuen Dateinamen in den Puffer schreiben + y_old:=position 'y-Koordinate merken + + scanstr(@filestring,1) 'Datei auf Endung scannen + old_color:=act_color 'Farbe zurücksetzen (Standardschriftfarbe) + if strsize(@buff)<1 'Wenn Verzeichnis + old_color:=selectcol 'Select-Farbe verwenden + +con '*********************************** Datei-Handling ************************************************************************************************************************** +PRI OPEN_FILE(str):err + err:=ios.sdopen("R",str) + if err + error(err) + ios.sdclose + +pri start_file(mode) + + ifnot OPEN_FILE(@filestring) + + case mode + 1:ios.ldbin(@filestring) + 2:ios.belload(@filestring) + 3:ios.admload(@filestring) + 4:if venatrix + ios.venload(@filestring) + +PRI FILE_START|a,c,dirmark + + if mountmarker==1 + playerstop + dirmark:=get_dirmarker + '*****************Dateiname in der Statusleiste anzeigen****************************** + + print_status(@filestring,7+platz,29) 'Dateiname in der Statusleiste anzeigen + + '***************************** BIN-Dateien starten *********************************** + if strcomp(@buff,@binfile) 'BIN-Datei, Ext-Datei starten + start_file(1) + if strcomp(@buff,@belfile) 'BEL-Datei starten + start_file(2) + if strcomp(@buff,@admfile) 'ADM-Datei starten + start_file(3) + if strcomp(@buff,@venfile) + start_file(4) + '****************************** Maus-Pfeil laden ************************************** + if strcomp(@buff,@maus) + loadMouse(@filestring) + '****************************** SID-DMP-Dateien abspielen ***************************** + if strcomp(@buff,@dmpfile) 'Sid-Dmp-Dateien abspielen + 'playerstop + bytemove(@dumpstring,@filestring,12) + tmpplay:=dumpnummer 'Positionszähler aktualisieren + ifnot OPEN_FILE(@dumpstring) + ios.sid_sdmpplay(@dumpstring) + play:=1 + '***************************** Text-oder Basic-Dateien anzeigen ********************** + if strcomp(@buff,@txtfile) or strcomp(@buff,@basfile) 'Txt oder Bas Dateien anzeigen + windowloesch 'Dateifenster löschen + textfenster 'Textfenster öffnen + 'playerstop + Textdisplay(0) + + '************************************************************************************* + '***************************** Color-Schemen-Dateien laden *************************** + if strcomp(@buff,@colorfile) 'Farb-Einstellungs-Dateien laden + ifnot OPEN_FILE(@filestring) + '---- Farb-SETTINGS IN DEN RAM LADEN ------------- + repeat a from 0 to 14 + c:=ios.sdgetc + farbe(a,c) + ios.sdseek(69) + lmouse + + bytemove(@textline,@filestring,12) 'Backup von @filestring + Bildschirmaufbau 'Bildschirm mit den neuen Farben darstellen + mc:=SD_Card + bytemove(@filestring,@textline,12) 'restore von @filestring + '****************************** Verzeichnis öffnen *********************************** + + if filedir==255 or strcomp(@filestring,@dirhoch) or strcomp(@filestring,@root) or strsize(@buff)<1 'Verzeichnis? dann öffnen + highlight:=0 'Hervorhebung zurücksetzen + bytefill(@filestring_old,0,12) 'Dateinamepuffer löschen + ifnot(strcomp(@filestring,@trash)) + if dirmark<>trashdir 'Im Trashordner kann das Verzeichnis nicht gewechselt werden + dmpfiles:=0 'Dmp-List-Zähler zurücksetzen + change_marker:=0 'Merker, das Verzeichnis geändert wurde + + if strcomp(@filestring,@dirhoch) 'Ins Root-Verzeichnis + activate_dirmarker(rootdir) + Verzeichnis_counter:=0 + userdir:=rootdir + else + ios.sdchdir(@filestring) + userdir:=get_dirmarker 'User-Marker lesen + + if strcomp(@filestring,@root) 'Verzeichnis-tiefenzähler aktualisieren + Verzeichnis_counter-- + if Verzeichnis_counter>0 + Get_Verz_Name + else + Verzeichnis_counter++ + Put_Verz_Name + + Leerstellenweg(@filestring) 'Leerstellen im String entfernen für Pfadanzeige + + scrollanfang:=0 'Scrollparameter setzen + kz:=1 + scr:=0 + mc:=SD_Card + + if filenumber>lines + zeilenende:=lines + scrollende:=lines + else + zeilenende:=filenumber + scrollende:=filenumber + + + +Pri Get_Verz_Name + GET_LINK(Verz_Ram,Verzeichnis_counter) + +Pri Put_Verz_Name + WriteDmpToRam(Verz_RAM,@filestring,12,Verzeichnis_counter) + +pri Bildschirmaufbau + ios.printBoxSize(0,1, 0, 28, 39) + ios.printBoxColor(0,0,shellhcol,black) + ios.printchar(12) 'cls + ios.printcursorrate(0) + if mountmarker==1 + icon(1,1) 'sd-card-symbol + else + icon(1,0) + icon(2,1) 'mülleimer + Show_Trash 'Mülleimer anzeigen + + Shell + statusleiste 'Statusleiste anzeigen + panel 'Utilitiepanel + ios.printwindow(0) 'Hauptfenster 0 setzen + ios.Mousepointer(MOUSE_RAM) 'Maus-Pointer einlesen + ios.displaymouse(1,mousecol) 'Mousezeiger sichtbar + FILL_LINK 'Desktopverknüpfungen wiederherstellen + displaytime 'Zeit+Datum anzeigen + +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,titeltextcol,black) 'Anzeige des aktuellen Status in der Titelzeile + if venatrix==1 + ios.bus_putchar3(50) + bl_connect:=ios.bus_getchar3 + Status_extern(bl_connect,Bluetooth_on,169,25,0,blue,white) 'Anzeige des aktuellen Status in der Titelzeile + else + Status_extern(serial,Bluetooth_on,169,25,0,blue,white) 'Anzeige des aktuellen Status in der Titelzeile + if s<>tmptime + displaytime + 'printdec_win(bluetooth_on,1,1) + +PRI displaytime|h,m + + + h:=ios.gethours + m:=ios.getminutes + print_zehner(h,29,34,statustextcol,hcolstatus) + + ios.displaytile(42,hcolstatus,0,statustextcol,29,36) 'doppelpunkt + print_zehner(m,29,37,statustextcol,hcolstatus) + tmptime:=m + date + + +pri Status_extern(wert1,wert2,tnr_act,x,y,col,f3) + + if wert2==1 'Externe Komponente in Settingmenue ausgewählt? + if wert1==1 + ios.displaytile(tnr_act,Titelhcol,col,f3,y,x) 'Status ok-anzeigen + else + ios.displaytile(tnr_act,titelhcol,grey,0,y,x) 'Symbol grau + else + ios.displaytile(16,Titelhcol,titeltextcol,0,y,x) 'Ohne externe Komponente arbeiten (kein Symbol) + + +PRI date|t,m,j + t:=ios.getdate + m:=ios.getmonth + j:=ios.getyear + + print_zehner(t,0,29,titeltextcol,titelhcol) + TITEL_TILE(30,0,31) 'Punkt + + print_zehner(m,0,32,titeltextcol,titelhcol) + TITEL_TILE(30,0,34) 'Punkt + + printdec_titel(j,0,35) 'Jahr + +con'************************************ Kalender-Funktion ******************************************************************************************************************** +pri Kalender|i,day,x,y,f,tok','mo,tg + Wert_Monat:=ios.getmonth + Wert_Jahr:=ios.getyear + today:=ios.getdate + window(1,4,5,5,19,26,ram_txt(34)) + + Frame_Tile(133,4,4) + Frame_Tile(117,4,27) + Frame_Tile(133,6,4) + Frame_Tile(117,6,27) + + iconbutton(15,124,6,5) + iconbutton(16,123,10,5) + + iconbutton(17,124,20,5) + iconbutton(18,123,25,5) + + + + repeat i from 5 to 26 + Frame_Tile(130,4,i) + Frame_Tile(130,6,i) + + + day:=0 + x:=3 + y:=9 + i:=0 + f:=act_color + + repeat 7 + tok:=@@DAYS[i++] 'Tage anzeigen + if i==7 + f:=$80 'Sonntag rot + printfont(tok,winhcol,0,f,x+=3,y-2) + Win_Tile(130,y-1,x) + Win_Tile(130,y-1,x+1) + if i<7 + Win_Tile(130,y-1,x+2) + + Zeichne_Kal(ios.getmonth,ios.getyear) + + +pri Zeichne_Kal(mo,jr)|x,y,day,i,tag_anfang,tok,farb + + + day:=0 + x:=3 + y:=9 + i:=0 + + tok:=@@MONS[mo-1] + print_win(tok,7,y-4) 'Monat anzeigen + printdec_win(Wert_Jahr,5,21) 'Jahr anzeigen + + tag_anfang:=wochentag(1,mo,jr) + tag_zahl:=anzahl_tage(mo,jr) + x:=((tag_anfang)*3) + ios.display2dbox(winhcol,9,6,19,25,0) + repeat 6 + repeat 7 + day++ + farb:=act_color + if wochentag(day,mo,jr)//7==0 'Sonntage sind rot + farb:=$80 + if day==today and mo==ios.getmonth and jr==ios.getyear + print_zehner(day,y,x+=3,winhcol,act_color ) 'Heute hervorheben + else + print_zehner(day,y,x+=3,farb,winhcol) 'restliche Tage + + if day==tag_zahl + quit + if x>22 + quit + y+=2 + x:=3 + if day==tag_zahl + quit + +pri anzahl_tage(mon,jhr):anz + '------------------ Anzahl Tage im Monat --------------------------- + anz:=lookupz(mon:0,31,28,31,30,31,30,31,31,30,31,30,31) + + if mon==2 and (jhr//4)==0 'Schaltjahr + anz:=29 + + +pri wochentag(tg,mon,jr)|a,b,c,d,e,f + + a:= tg // 7 + '------------- Merkziffern für die Monate --------------------------- + b:=lookupz(mon:0,0,3,3,6,1,4,6,2,5,0,3,5) + + + c:=jr/100 'Jahrhundert + d:=jr-(c*100) 'Jahr + case c 'Jahrhundertziffer + 19, 23, 27:e:=0 + 18, 22, 26:e:=2 + 17, 21, 25:e:=4 + 16, 20, 24:e:=6 + + c:=(d + (d / 4)) // 7 'Jahresziffer + + '-------- Schaltjahrkorrektur -------------- + f:=0 + if (jr//4==0) and (mon<3) 'im Schaltjahr muss bei einem Datum vor dem 1.März eine 6 addiert werden + f:=6 + result:=(a + b + c + e + f) // 7 + if result==0 + result:=7 + + + 'Ergebnis ist der Wochentag + +con '***************************************************** Dateiattribute setzen ************************************************************************************************* + +PRI FILE_INFO_FENSTER + print_win(ram_txt(35),windowx[2]+1,windowy[2]+1) + print_win(@filestring,windowx[2]+1+9,windowy[2]+1) + print_win(ram_txt(36),windowx[2]+1,windowy[2]+2) + if filedir + print_win(ram_txt(37),windowx[2]+1+9,windowy[2]+2) + else + print_win(ram_txt(38),windowx[2]+1+9,windowy[2]+2) + print_win(ram_txt(39),windowx[2]+1+3,windowy[2]+4) + print_win(ram_txt(40),windowx[2]+3,windowy[2]+5) + + get_attrib(filerdonly,0,3,2) + + get_attrib(filehidden,1,7,2) + get_attrib(filesystem,2,11,2) + get_attrib(filearchiv,3,15,2) + +PRI get_attrib(atr,n,x,win) + if atr==255 + attrmarker[n]:=1 + Win_Tile(139,windowy[win]+6,windowx[win]+1+x) + else + attrmarker[n]:=0 + Win_Tile(140,windowy[win]+6,windowx[win]+1+x) + +PRI toogle_value(at,x,y,win) + Mouse_Release + if at==1 + Win_Tile(140,y,windowx[win]+1+x) + at:=0 + else + at:=1 + Win_Tile(139,y,windowx[win]+1+x) + return at + +PRI write_attrib|i,e + i:=0 + playerstop + bytefill(@attribute,0,4) 'Dateiattribute ändern + if attrmarker[0]==1 + attribute[i++]:="R" + if attrmarker[1]==1 + attribute[i++]:="H" + if attrmarker[2]==1 + attribute[i++]:="S" + if attrmarker[3]==1 + attribute[i++]:="A" + attribute[i]:=0 + e:=ios.sdchattrib(@filestring,@attribute) + if e + display_error(e) + change_marker:=0 'Verzeichnis neu in den Ram laden + +con '***************************************************** Diverse Texte in den E-Ram laden ************************************************************************************** + +PRI fileload(adr): cont + + cont:=ios.sdfattrib(0) + ios.sdxgetblk(adr,cont) + ios.sdclose + +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 + +con '***************************************************** Die einzelnen Fenster ************************************************************************************************* + +PRI SD_CARD_INFO|fr,us,pr,str + + ifnot Checkmount 'test ob medium gemounted ist + + fr:=ios.sdcheckfree/1024*512 + us:=ios.sdcheckused/1024*512 + print_win(string("Vol.:"),12,10) + str:=ios.sdvolname + printfont(str,winhcol,0,act_color,17,10) + print_win(string("Free Kb:"),12,13) + printdec(fr,13,20,winhcol,act_color) + print_win(string("Used Kb:"),12,14) + printdec(us,14,20,winhcol,act_color) + pr:=fr+us + print_win(string("All Kb:"),12,12) + printdec(pr,12,20,winhcol,act_color) + pr:=100*fr/pr + print_win(string("Free % :"),12,16) + printdec(pr,16,20,winhcol,act_color) + + +PRI SD_Card:msz|b + b:=0 + ifnot Checkmount + reset_Highlight 'Hervorhebungsparameter löschen + fensterweg + Programmfenster(6,ios.sdvolname) + ifnot change_marker 'Dir neu einlesen, wenn das Verzeichnis geändert wurde + playerstop 'Player stoppen + tmpplay:=0 'Song-Zähler auf null + cmd_dir + change_marker:=1 'Verzeichnis wurde geändert + print_titel(@files,22,2) + print_titel(@dirs,13,2) + printdec_titel(filenumber-dirnumber,2,28) + if (verzeichnis_counter>0) or (get_dirmarker==trashdir) 'im Unterverzeichnis oder Mülleimer wird 2 abgezogen da . und .. mitgezählt wurden + b:=2 + printdec_titel(dirnumber-b,2,18) + msz:=show_always 'Dateiliste aus dem E-Ram anzeigen + else + windowloesch + return +pri show_always:msz + scrollanfang:=0 + msz:=ios.mousez + selection:=3 + if filenumber>21 + zeilenende:=21 + scrollende:=21 + else + zeilenende:=filenumber + scrollende:=filenumber + display_list(zeilenanfang,zeilenende) + ios.display2dbox(hcolstatus,29,8,29,32,0) + platz:=status_show + util:=11 + scr:=0 + + +PRI status_show:p + + print_status(@dirname,7,29) + p:=strsize(@dirname) + +PRI textfenster + Programmfenster(4,ram_txt(41)) + +PRI Startmenue + 'ios.backup_area(0,16,9,28,BRAM) + popup(0,16,9,28) + print_titel(ram_txt(42),0,16) + separator(0,17,9) + print_message(@Help,0,18) + separator(0,19,9) + print_message(@baud_set,0,20) + separator(0,21,9) + print_message(@settings,0,22) + separator(0,23,9) + print_message(@programs,0,24) + separator(0,25,9) + print_message(@reboots,0,27) + menuemarker:=1 + +PRI Coreanzeige|c[4],i,cogs,loops + window(1,4,8,8,16,27,ram_txt(62)) + print_win(ram_txt(43),8,8) + print_win(ram_txt(44),8,10) + print_win(ram_txt(45),8,12) + + c[0]:=ios.admgetcogs + c[1]:=ios.belgetcogs + c[2]:=ios.reggetcogs + loops:=3 + Scan_Expansion_Card 'nach Venatrix-Karte scannen + if venatrix + c[3]:=ios.VEN_GETCOGS + print_win(ram_txt(58),8,14) + loops:=4 + + i:=0 + cogs:=1 + repeat loops + repeat 8 + if (cogs=<(8-c[i])) 'freie cogs = belegte cogs -8 + ios.displaytile(COG_PIC,winhcol,red,0,8+i+i,19+cogs-1) + else + ios.displaytile(COG_PIC,winhcol,green,0,8+i+i,19+cogs-1) + cogs++ + cogs:=1 + i++ + + button(1,@butOK,10,16) + button(2,@Abbr,20,16) + +PRI Setting_window + + window(1,4,6,2,20,33,ram_txt(46)) + rahmen(2,6,19,11) + print_win(ram_txt(47),3,8) 'Show-Hidden Files + print_win(ram_txt(48),3,10) 'Use Trash + print_win_rev(ram_txt(71),3,6) 'Explorer + WIN_TILE(140-Show_Hid_files,8,18) + WIN_TILE(140-Use_trash,10,18) + + rahmen(21,6,33,11) + print_win_rev(ram_txt(72),22,6) 'Option + print_win(ram_txt(69),22,8) 'Use DCF-Receiver + print_win(ram_txt(70),22,10) 'Use HC05-Bluetooth + WIN_TILE(140-dcf_on,8,32) + WIN_TILE(140-bluetooth_on,10,32) + WIN_TILE(170,8,30) 'DCF-Symbol + WIN_TILE(169,10,30) 'Bluetooth-Symbol + + rahmen(2,13,19,18) + print_win_rev(ram_txt(73),3,13) 'Detect-Hardware + print_win(ram_txt(60),3,15) 'Venatrix-BUS + print_win(ram_txt(61),3,17) 'Sepia-Card + Scan_Expansion_Card 'nach Sepia-und Venatrix-Karte scannen + Show_Card_ON_OFF 'anzeigen, ob die Karten da sind + + rahmen(21,13,33,18) 'noch leerer Rahmen + + button(1,@butOK,10,20) + button(2,@Abbr,20,20) + +PRI Scan_Expansion_Card|ackn,adr,counter_s,counter_V + +'###################################################################################################### +'# Durch diverse Versuche hat sich herausgestellt, das die Ping-Funktion allein nicht ausreicht um # +'# das Vorhandensein der Sepia oder Venatrix-Karte zu detektieren, da eine nicht angeschlossene # +'# eine Null zurückgibt, genauso wie ein angeschlossener I2C-Teilnehmer. Deshalb wird beim Scan die # +'# Anzahl Nullen mit der Gesamtanzahl der Adressen verglichen. Ist die Anzahl zurückgegebener Nullen# +'# mit der Anzahl Adressen identisch, so ist offensichtlich keine Karte vorhanden. Diese Methode # +'# verhindert Fehldetektionen und gerade in Verbindung mit der Venatrixkarte ein Festfahren des HIVE# +'# zum Beispiel bei Aufruf der Cog-Anzeige. # +'###################################################################################################### + + ios.plxHalt + Sepia:=0 + venatrix:=0 + counter_s:=0 + counter_v:=0 + repeat adr from 32 to 79 'standard-Sepia-Adressbereich $20-$4f + ackn := ios.plxping(adr) + + ifnot ackn + counter_s++ 'Anzahl der vorhandenen I2C-Teilnehmer + + repeat adr from 0 to 5 + if ios.plxping(adr) + counter_v++ + + ios.plxRun + if counter_s<48 + sepia:=1 + if counter_v==5 + Venatrix:=1 + +PRI Show_Card_ON_OFF + if sepia==0 + print_win(@off,16,17) + else + print_win(@on,16,17) + + if venatrix==0 + print_win(@off,16,15) + else + print_win(@on,16,15) + +con '********************************************** Verwaltung der Desktopverknüpfungen ****************************************************************************************** +PRI Make_link(dm)|i,n 'Desktopverknüpfung erzeugen + bytemove(@textline,@filestring,12) '@filestring merken + repeat i from 0 to 2 'Test auf freie Position + get_link(LINK_RAM,i) 'Link holen + if strsize(@filestring)<1 'Position frei? + link_pointer:=i 'dann diese Position verwenden + quit + bytemove(@filestring,@textline,12) 'Kopie von @filestring zurückschreiben + n:=link_pointer*13 'Stringposition in @link_string + SHOW_LINK(n) 'Link auf dem Desktop anzeigen + WriteDmpToRam(LINK_RAM,@filestring,dm,link_pointer) 'im Link_ram merken + link_marker[link_pointer]:=dm 'Verzeichnismarker speichern + inisave 'Link in Ini-Datei speichern + + link_pointer++ 'Link-Zähler erhöhen + link_counter++ + if link_counter>3 + link_counter:=3 + if link_pointer>2 'nur 3 Links sind gestattet (0-2) + link_pointer:=0 + + +PRI LINK_START(numm)|nu + ifnot Checkmount + nu:=0 + activate_dirmarker(link_marker[numm]) 'Verzeichnis öffnen + cmd_dir 'Verzeichnis einlesen + GET_LINK(LINK_RAM,numm) 'Link holen + ios.paracopy(PARA_RAM+(numm*64)) 'Parameter in den System-Parameter-Ram kopieren + scanstr(@filestring,1) 'Dateiendung scannen + + repeat dmpfiles 'Wenn Song, dann Songnummer ermitteln + getdmpname(nu++) + if strcomp(@dumpstring,@filestring) 'Dateiname mit Dumpfiles vergleichen + dumpnummer:=nu 'Nummer des Songs an dumpnummer übergeben + quit + if strsize(@filestring)>0 + FILE_START 'Link starten + +PRI LINK_PARAMETERS(i) + infofenster(2,10,31,15,ram_txt(59),1) 'Infofenster mit OK-Knopf anzeigen + printfont(@filestring,Titelhcol,0,Titeltextcol,20,8) 'verlinkte Datei in Titelleiste anzeigen + rahmen(2,9,31,13) + util:=13 + Display_Param(3,10,i) + +PRI DISPLAY_PARAM(tx,ty,n)|c,txtmp,a + txtmp:=tx + a:=PARA_RAM+(n*64) + repeat while c:=ios.ram_rdbyte(a++) + + if tx==30 or c==10 'zeilenumbruch bei spalte 30 oder bei linefeed + tx:=txtmp + ty+=1 + if c==10 or c==13 'return oder linefeed nicht als zeichen anzeigen + next + win_tile(c-16,ty,tx++) + +PRI FILL_LINK 'Link-Parameter füllen + + link_marker[0]:=ios.ram_rdlong(LINK_RAM+$0C) + link_marker[1]:=ios.ram_rdlong(LINK_RAM+$1D) + link_marker[2]:=ios.ram_rdlong(LINK_RAM+$2E) + Plot_Link + +PRI DISPLAY_LINK(numm) + GET_LINK(LINK_RAM,numm) 'string holen + if strsize(@filestring)>0 'Link gültig? + SHOW_LINK(numm*13) 'an entsprechender Position anzeigen + link_counter++ + +PRI PLOT_LINK|i + repeat i from 0 to 2 + DISPLAY_LINK(i) + +PRI GET_LINK(basis,numm)|n,c,adr,i 'Link-String aus e-ram holen + n:=numm*17 + link_pointer:=numm + adr:=basis+n + repeat i from 0 to 11 + c:=ios.ram_rdbyte(adr++) + filestring[i]:=c + +PRI SHOW_LINK(n)|p 'Link auf dem Desktop anzeigen + + scanstr(@filestring,1) + bytemove(@link_string[n],@filestring,5) + p:=get_pic(@buff) + ios.displaytile(p,Shellhcol,0,act_color,8+(link_pointer*5),37) + printfont(@link_string[n],shellhcol,0,act_color,35,9+(link_pointer*5)) + +PRI Delete_Link(n,y)|i,a + bytefill(@link_string[n*13],0,12) 'Link-String löschen + link_marker[n]:=-1 'Link-Verzeichnismarker löschen + ios.displaytile(16,shellhcol,0,0,y,37) 'Linksymbol auf dem Desktop löschen + printfont(string(" "),shellhcol,0,0,35,y+1) 'Linkname auf dem Desktop löschen + link_pointer:=n + a:=LINK_RAM+(n*17) 'Adresse im eRam + repeat i from a to a+16 + ios.ram_wrbyte(0,i) 'im Link_ram löschen + a:=PARA_RAM+(n*64) + repeat i from a to a+63 + ios.ram_wrbyte(0,i) + inisave 'in Ini-Datei speichern + link_counter-- + if link_counter<1 + link_counter:=0 + +pri LinkPos(p) 'Position des angeklickten Links ermitteln + if p>2 'ist i>2 dann ist entweder das 2. oder 3. Symbol angeklickt worden + p-=4 '4 abziehen + if p>2 'ist i jetzt immer noch grösser 2, dann wurde das 3.Symbol angeklickt + p-=4 '4 abziehen so ergibt sich eine Zahl von 0-2 für Link 0-2 + return p + +con '**************************************** Serielles Terminal ***************************************************************************************************************** +PRI Terminal + Programmfenster(4,ram_txt(49)) + ios.seropen(bdselect(baud))'(31, 30, 0, bdselect(baud)) + serial:=1 + +PRI baudselect(rate)|bd,i + window(1,4,5,10,17,22,ram_txt(50)) + button(1,@butOK,10,17) + button(2,@Abbr,17,17) + repeat i from 6 to 14 + bd:=bdselect(i-6) + printdec_win(bd,i,13) + WIN_TILE(46,6+rate,12) + +PRI bdselect(bauds):bd + bd:=lookupz(bauds:300,600,1200,4800,9600,19200,38400,57600,115200) + + +PRI Text_Input(ser,min_x,max_x,min_y,max_y,mode,adr,ch)|k,ii,x,y,serchar,blck,inp,adr_tmp,w,kl,tmp + {{####################################################### + ser=serielle Schnittstelle verwenden + mode=1 - Terminal mode=0 - Texteingabefeld + adr=Adresse Parameter-Ram adr=0 normales Textfeld + ch=maximale Anzahl Zeichen + ####################################################### + }} + ii:=0 + blck:=0 + adr_tmp:=adr+1 'Adresse merken + tmp:=adr + inp:=0 'Eingabe Merker, wird aktiviert, wenn was verändert wurde + zeile:=min_y + spalte:=min_x + do_restore:=1 'Hintergrund muss wieder hergestellt werden + 'if mode + ' WIN_TILE(46,zeile,2) 'print_win(@promt,spalte-3,zeile) 'Terminal-Promt + WIN_TILE(6,zeile,spalte) 'Eingabe-Cursor + + repeat + time 'Zeitaktualisierung + k:=ios.key + ma:=ios.mouse_button(0) + + if ser + serchar:=ios.serread'com.rxcheck 'Zeichen von der com. Schnittstelle lesen + if k==27 'Abbruch mit ESC + ios.serclose'com.stop + serial:=0 + Fensterweg + return + if mode 'Terminal-Modus + if k==13 or serchar==13 'Return? dann neue Zeile + zeile++ + 'WIN_TILE(46,zeile,2)'print_win(@promt,2,zeile) + spalte:=min_x + WIN_TILE(6,zeile,spalte) + if ser + if k==13 'Return von Tastatur? -> zur Schnittstelle senden + ios.sertx($0D)'com.tx($0D) + ios.sertx($0A)'com.tx($0A) 'manche Terminalprogramme brauchen das + else + if k==13 + quit + + + if k==ios#CHAR_BS or serchar==ios#CHAR_BS 'Backspace + if ii>0 + if spaltemin_x or (spalte==min_x and zeile==min_y) + WIN_TILE(6,zeile,spalte) 'Cursor einen Schritt zurück + else + WIN_TILE(16,zeile,spalte) 'Leerzeichen + ifnot mode 'Bei Texteingabefeld Zeichenanzahl verringern + adr-- + inp:=1 'Text wurde verändert + ii-- + if k>13 or (serchar>13 and ser==1) 'Alle Zeichen außer Return + ii++ + ifnot mode 'maximale Zeichenanzahl erreicht + if ii>ch-1 + ii:=ch 'Zeichenanzahl nicht mehr erhöhen + blck:=1 'feste Zeichenanzahl-merker + + if k 'Zeichen von Tastatur + WIN_TILE(k-16,zeile,spalte) + if spalte+10 'Zeichen in den Ram schreiben + ios.ram_wrbyte(k,adr) + else + textline[adr-1]:=k 'Text in String schreiben + if ser + ios.sertx(k)'com.tx(k) + elseif serchar 'Zeichen von der com. Schnittstelle + WIN_TILE(serchar-16,zeile,spalte++) 'Zeichen ausgeben + + + if spalte>max_x 'Zeilenumbruch bei Spalte max x + if tmp==0 and ser==0 'normale Texteingabe in String (Rename) + spalte:=max_x 'an letzter Position bleiben + else + spalte:=min_x 'Text in Ram schreiben (Parameter) + zeile++ 'neue Zeile + 'if mode + ' WIN_TILE(46,zeile,2)'print_win(@promt,2,zeile) 'Eingabepromt in neuer Zeile (Terminal) + + + if zeile==max_y+1 'letzte Zeile erreicht, dann eine Zeile hochscrollen + if mode + ios.scrollup(1,winhcol, min_y, min_x, max_y, max_x,1) + zeile:=max_y 'Zeilennummer wieder auf max_y setzen + + if ma 'Maustaste + x:=ios.mousex + y:=ios.mousey + kl:=ios.get_window//10 'Icon-Button-Nummer des Fensters + if kl==1 'Abfrage auf Fensterloeschen + if doppelklick + Close_Window(2) + return + if kl==2 + Close_Window(2) + return + if(x=>buttonx[4]) and (x=0 'Parameter-Modus + w:=64-ii + ios.ram_fill(adr_tmp+ii,w,0) 'rest löschen + else + textline[adr]:=0 'normaler Text-Modus, String abschliessen + return 13 + +con '************************************** Systeminfo-Programms-Fenster ******************************************************************************************************************* + +PRI Sysinfo + window(1,4,5,5,24,31,ram_txt(51)) + tab(1,5,6,6) 'tabnummer,textlänge,x-pos,y-pos) + bytemove(@buttontext[5*6],string("Video"),5) + button(5,@buttontext[5*6],7,6) + tab(2,5,13,6) + bytemove(@buttontext[6*6],string("Sound"),5) + button(6,@buttontext[6*6],14,6) + tab(3,4,20,6) + bytemove(@buttontext[7*6],string("Font"),4) + button(7,@buttontext[7*6],21,6) + tabframe(1,5,31,24) + button(1,@butOK,10,24) + button(2,@Abbr,20,24) + +PRI print_info(adr,x,y)|a,c 'Info-Texte aus dem Ram lesen und anzeigen + a:=x + repeat while (c:=ios.ram_rdbyte(adr++)) + if c==13 + y++ + x:=a + next + if c==10 + next + WIN_TILE(c-16,y,x++) + +PRI Programms 'Fenster für Zusatzprogramme + Programmfenster(4,@programs) +'####################################### 1.Zeile ############################# + printdec_win(1,4,3) + display_icon(19,162,winhcol,panelcol,4,4) + print_win(string("Sepia"),2,5) + print_win(string("I/O"),3,6) + printdec_win(2,4,10) + display_icon(20,162,winhcol,panelcol,4,11) + print_win(string("Venatrix"),8,5) + print_win(string("Test"),10,6) + printdec_win(3,4,17) + display_icon(21,160,winhcol,panelcol,4,18) + print_win(string("Shell"),17,5) + printdec_win(4,4,24) + iconbutton(13,170,25,4) + print_win(string("DCF77"),23,5) +'######################################## 2.Zeile ############################ + printdec_win(5,8,3) + iconbutton(14,169,4,8) + print_win(string("Blue-"),2,9) + print_win(string("tooth"),2,10) + +pri Show_Help 'Hilfefenster anzeigen + Programmfenster(4,@Help) + util:=12 + bytemove(@filestring,string("help.txt"),8) 'Dateiname für Textdisplay übergeben + playerstop 'eventuell laufenden Player stoppen + activate_dirmarker(systemdir) + textdisplay(0) + +PRI Programmfenster(mode,strg) + window(1,mode,4,2,24,33,strg) + +PRI tab(numm,l,x,y) 'Registerzunge anzeigen L ist die Textlänge + + tabx[numm]:=x + taby[numm]:=y + tabl[numm]:=x+1+l + + ios.displaytile(144,winhcol,buttonhcol,0,y,x) + ios.displaytile(145,winhcol,buttonhcol,0,y,x+1+l) + +PRI tabframe(numm,wx,xx,yy)|i 'Rahmen für Tabulatorfenster erstellen + + repeat i from taby[numm]+2 to yy-2 'rechter und linker Rand + FRAME_TILE(2,i,wx) + FRAME_TILE(114,i,xx) + FRAME_TILE(136,yy-1,wx) + FRAME_TILE(119,yy-1,xx) + + repeat i from wx+1 to xx-1 'oberer Rand bis Tab und ab Tab + if i=>tabx[numm] and i=< tabl[numm] + FRAME_TILE(16,taby[numm]+1,i) + else + FRAME_TILE(148,taby[numm]+1,i) + + FRAME_TILE(130,yy-1,i) + + FRAME_TILE(146,taby[numm]+1,wx) + FRAME_TILE(147,taby[numm]+1,xx) + +PRI clear_tabframe + ios.display2dbox(winhcol,windowy[1]+5,windowx[1]+2,windowyy[1]-3,windowxx[1]-2,0) + +con '************************************************ About-Box ****************************************************************************************************************** +PRI about + window(1,4,8,6,18,31,string("About")) + print_info(prgnfo,6,8) + button(1,@butOK,16,18) + util:=0 +con '************************************************ Clock-Settings ****************************************************************************************************************** + +PRI Clock|i + window(1,4,8,8,18,28,ram_txt(52)) + print_win(ram_txt(64),16,7) + tag:=ios.getdate + monat:=ios.getmonth + Jahr:=ios.getyear + stunde:=ios.gethours + minute:=ios.getminutes + sekunde:=ios.getseconds + i:=10 + repeat 3 + FRAME_TILE(5,9,i) + FRAME_TILE(5,14,i) + i+=3 + FRAME_TILE(3,9,i) + FRAME_TILE(3,14,i) + i+=3 + + + FRAME_TILE(3,9,27) + print_win(ram_txt(65),16,12) + + button(1,@butOK,10,18) + button(2,@Abbr,20,18) + Date_refresh + Clock_refresh + +PRI clock_refresh + print_zehner(Stunde,14,11,act_color,winhcol) + print_zehner(Minute,14,17,act_color,winhcol) + print_zehner(Sekunde,14,23,act_color,winhcol) + wait(20000) 'etwas warten, sonst ändern sich die Werte zu schnell + +PRI date_refresh + print_zehner(Tag,9,11,act_color,winhcol) + print_zehner(Monat,9,17,act_color,winhcol) + printdec_win(Jahr,9,23) + wait(20000) 'etwas warten, sonst ändern sich die Werte zu schnell + +pri print_zehner(wert,y,x,vor,hin)|a + a:=0 + if wert<10 + printdec(0,y,x,hin,vor) + a:=1 + printdec(wert,y,x+a,hin,vor) + +PRI wait(ms) + repeat ms +con '************************************************ Color-Einstell-Box ****************************************************************************************************************** + +PRI Color + window(1,4,4,6,24,23,ram_txt(53)) + ios.Displaypalette(7,4) + rahmen(18,8,22,10) + print_win(ram_txt(66),14,9) + printdec_win(shellhcol,9,19) + refreshpaint + WIN_TILE(46,9,6) + button(1,@butOK,8,24) + button(2,@Abbr,16,24) + +PRI farbe(i,c) + + case i + 0:shellhcol:=c + 1:act_color:=c + 2:winhcol:=c + 3:winframecol:=c + 4:titelhcol:=c + 5:titeltextcol:=c + 6:hcolstatus:=c + 7:statustextcol:=c + 8:buttonhcol:=c + 9:buttontextcol:=c + 10:messagehcol:=c + 11:messagetextcol:=c + 12:selectcol:=c + 13:mousecol:=c + 14:panelcol:=c + +pri get_farbe(n):c + c:=lookupz(n:shellhcol,act_color,winhcol,winframecol,titelhcol,titeltextcol,hcolstatus,statustextcol{ + },buttonhcol,buttontextcol,messagehcol,messagetextcol,selectcol,mousecol,panelcol) + +PRI refreshpaint + + printfont(string("Back"),shellhcol,0,act_color,7,9) + print_win(string("Text"),7,10) + print_win(string("Window"),7,11) + printfont(string("Winframe"),winhcol,0,winframecol,7,12) + print_titel(string("Title"),7,13) + print_titel(string("Titletext"),7,14) + print_status(string("Statusback"),7,15) + print_status(string("Statustext"),7,16) + Print_button(string("Button"),7,17) + Print_button(string("Buttontext"),7,18) + print_message(string("Message"),7,19) + print_message(string("Messagetext"),7,20) + printfont(string("Select"),winhcol,0,selectcol,7,21) + printfont(string("Mouse"),winhcol,0,mousecol,7,22) + printfont(string("Panel"),shellhcol,0,panelcol,7,23) + ios.DisplayMouse(1,mousecol) + + +con '************************************************ E-Ram-Monitor ****************************************************************************************************************** + +PRI RamDump(start)|i,a + Programmfenster(6,ram_txt(54)) + a:=start + print_win(@starts,2,4) + printhex(start,5,8,4,winhcol,act_color) + print_win(ram_txt(67),17,4) + print_win(ram_txt(68),25,4) + WIN_TILE(140,4,23) + WIN_TILE(140,4,31) + + if dump_ram==1 + WIN_TILE(139,4,31) + else + WIN_TILE(139,4,23) + + repeat i from 6 to 24 + dump(a,2,i,dump_ram) + a+=8 + +PRI Dump(adr,x,y,mode) |c[8],a,i 'adresse, anzahl zeilen,ram oder xram + + a:=25 + printhex(adr,adressraum+dump_ram,x,y,winhcol,act_color) + x+=5 + WIN_TILE(42,y,x) + x++ + + repeat i from 0 to 7 + if mode + c[i]:=ios.ram_rdbyte(adr++) + else + c[i]:=byte[adr++] + printhex(c[i],2,x++,y,winhcol,act_color) + if c[i]>175 or c[i]<16 + c[i]:=46 + WIN_TILE(c[i]-16,y,a++) + x++ + +PRI Dumpadresse|k,sp,i,ok ,ad '***********Adresseingabe im E-Ram-Monitor**************** + sp:=8 + i:=0 + ad:=adressraum+dump_ram + printhex(HEX_ADRESSE, ad,8,4,act_color,winhcol) 'Eingabe revers darstellen + 'WIN_TILE(26,4,8) 'Eingabestern + + repeat + k:=ios.key + ma:=ios.mouse_button(0) + sp:=i+8 + if k==13 'Return? dann neue Zeile + ok:=1 + textline[i++]:=0 + quit + if k==27 'Abbruch + ok:=0 + quit + if k==ios#CHAR_BS 'Backspace + if i>0 + 'WIN_TILE(26,4,sp) + WIN_TILE(16,4,sp+1) + i-- + if k=>"0" and k =< "9" or k=>"A" and k=<"F" or k=>"a" and k=<"f" 'Nur Zahlen 0-9 und A-F + WIN_TILE(k-16,4,sp)'sp++) + textline[i++]:=k + if i>ad 'Adressraum-Eingrenzung Hubram 4-stellig, E-Ram 5-stellig + i:=ad + 'WIN_TILE(26,4,i+8) + + + if ok==1 + tp:= @textline + HEX_ADRESSE:=gethexnumber + ramdump(HEX_ADRESSE) + startadresse:=HEX_ADRESSE + endadresse:=HEX_ADRESSE+144 + scrollanfang:=startadresse/8 + scrollende:=endadresse/8 + + +con '************************************************ Sid-Dmp-Player ************************************************************************************************************* +PRI Player(n)|a + window(1,4,8,8,13,27,ram_txt(55)) + iconbutton(10,BACK_PIC,8,13) + a:=PLAY_PIC + if play==1 + a:=STOP_PIC + iconbutton(11,a,10,13) + iconbutton(12,VOR_PIC,12,13) + rahmen(8,7,16,9) + rahmen(19,7,27,9) + line(8,10,27) + if ios.sid_dmppos>0 + dmp_name + if dmpfiles>0 + getdmpname(n) + dmp_name + +pri Player_sichtbar + if util==6 and windownum[1]==1 'Player sichtbar? + dmp_name 'Titelname anzeigen + +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) + +PRI positionsbalken(pos,x,y) + ios.display2dbox(act_color,y,x,y,x+pos,0) + +PRI balkenleer + ios.display2dbox(winhcol,11,9,11,27,0) + print_win(string("0 "),9,8) + +PRI abspielen(mode) + ios.sdopen("R",@dumpstring) + ios.sid_sdmpplay(@dumpstring) + play:=1 + if mode==1 and util==6 'Playerfenster sichtbar + balkenleer + +PRI playsong(nu,mode) + getdmpname(nu-1) + if play==1 + playerstop + abspielen(mode) + elseif play==0 + playerstop + +PRI playerstop + ios.sid_dmpstop + play:=0 + ios.sdclose + +PRI getdmpname(nummer)|adress,position,c,z 'Dmp Datei-Name aus dem E-Ram holen + position:=(nummer)*17 + adress:=DMP_RAM+position 'Adresse Dateiname im eRam + z:=0 + bytefill(@dumpstring,12,0) + repeat 12 + c:=ios.ram_rdbyte(adress++) 'Dateiname aus Dir-Ram lesen + dumpstring[z++]:=c + dumpstring[z]:=0 + dmplen:=ios.ram_rdlong(adress++)/25 + +PRI dmp_name + print_win(@dumpstring,15,13) + print_win(string(" "),20,8) + printdec_win(dmplen,8,20) + +con '***************************************************** Unterprogramme für die Fensterverwaltung ****************************************************************************** + +PRI icon(numm,mode)|a + if mode==1 + a:=panelcol + else + a:=grey + case numm + 1: icon_tile(10,a,4,36) 'SD-Card 'f1-30,f2-255,f3-0 + icon_tile(11,a,4,37) + icon_tile(12,a,5,36) + icon_tile(13,a,5,37) + 2: icon_tile(153,a,23,36) 'Mülleimer leer 'f1-30,f2-255,f3-0 + icon_tile(154,a,23,37) + icon_tile(151,a,24,36) 'Mülleimerunterteil + icon_tile(152,a,24,37) + 3: icon_tile(149,a,23,36) 'Mülleimer voll 'f1-30,f2-255,f3-0 + icon_tile(150,a,23,37) + +PRI icon_tile(numm,mode_farbe,y,x) + + ios.displaytile(numm,shellhcol,mode_farbe,0,y,x) + +PRI statusleiste + ios.display2dbox(hcolstatus,29,0,29,39,0) + print_status(@starts,0,29) + +PRI panel + regal(shellhcol,panelcol,26,11) + +PRI shell + ios.display2dbox(titelhcol,0,0,0,39,0) + FRAME_TILE(0,0,0) + print_titel(string(" PLEXUS Ver."),1,0) + print_titel(@Version,13,0) + FRAME_TILE(1,0,39) + +PRI Regal(f1,f2,y,x)|i,c + c:=x + x:=display_icon(9,112,f1,f2,y,x) + x:=display_icon(0,78,f1,f2,y,x) + x:=display_icon(1,108,f1,f2,y,x) + x:=display_icon(2,110,f1,f2,y,x) + x:=display_icon(3,126,f1,f2,y,x) + x:=display_icon(4,142,f1,f2,y,x) + x:=display_icon(5,158,f1,f2,y,x) + x:=display_icon(6,174,f1,f2,y,x) + ios.displaytile(113,f1,f2,0,y,x) + ios.displaytile(115,f1,f2,0,y,x+1) + + x:=display_icon(9,128,f1,f2,y+1,c) + + repeat i from c+1 to c+16 + ios.displaytile(132,f1,f2,0,y+1,i) + + ios.displaytile(131,f1,f2,0,y+1,c+17) + +PRI display_icon(ic,inr,f1,f2,y,x):xx + ios.displaytile(inr,f1,f2,0,y,x) + ios.displaytile(inr+1,f1,f2,0,y,x+1) + if ic<9 or ic>18 'Icon-Nr <9 und >18 werden die Koordinaten gemerkt + iconx[ic]:=x + icony[ic]:=y + iconnr[ic]:=inr + iconf1[ic]:=f1 + iconf2[ic]:=f2 + xx:=x+2 + +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 + + 'Nr,Vord,hint,curs,framecol + ios.window(numm,0,winhcol,0,winframecol,titelhcol,titeltextcol,hcolstatus,statustextcol,y-2,x-1,yy+1,xx+1,cntrl,0) + + ios.printcursorrate(0) + ios.printchar(12) 'cls + windownum[numm]:=1 + print_titel(strg,x+1,y-2) + + +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 und im LINK-Parameter-Fenster + if knopf==2 + button(2,@Abbr,((xx-x)/2)+x-2,yy) + infomarker:=1 + +con '*************************************************** Start- und Popup-Menue ************************************************************************************************************* + +PRI popup(x,y,xx,yy) + ios.backup_area(x,y,xx,yy,BRAM) + ios.display2dbox(messagehcol,y,x,yy,xx,0) + popupx:=x + popupy:=y + popupyy:=yy + popupxx:=xx + popupmarker:=1 + +PRI popup_entry(numm,strg,sep) + if sep==1 + separator(popupx,popupy+numm,popupx+6) + numm+=1 + print_message(strg,popupx,popupy+numm) + print_message(strg,popupx,popupy+numm) + +PRI Popup_Info_weg + + if infomarker==1 'Infofenster sichtbar? + if do_restore 'Infofensterhintergrund wieder herstellen? + ios.restore_area(windowx[2],windowy[2],windowxx[2],windowyy[2],bram) 'Hintergrund wiederherstellen + infomarker:=0 'Marker loeschen + windownum[2]:=windowx[2]:=windowy[2]:=windowxx[2]:=windowyy[2]:=-1 'Windowwerte loeschen + ios.windel(2) + if popupmarker==1 'Popupmenue sichtbar? + ios.restore_area(popupx,popupy,popupxx,popupyy,bram) 'Hintergrund wiederherstellen + popupmarker:=0 'Popupmarker loeschen + menuemarker:=0 + link_merker:=0 + +PRI popupselect(stri,x,y) + + printfont(stri,messagetextcol,0,messagehcol,x,y) + Mouse_Release + print_message(stri,x,y) + popup_info_weg + +PRI separator(x,y,xx)|i + repeat i from x to xx + ios.displaytile(6,Messagehcol,0,winframecol,y,i) + +con '************************************************** Button-Funktionen ******************************************************************************************************** + +PRI button(n,btext,x,y) + print_button(btext,x,y) + buttonx[n]:=x + buttony[n]:=y + +PRI buttonpress(n)|s + s:=0 + case n + 1: printfont(@butOK,250,0,0,buttonx[n],buttony[n]) + 2: printfont(@Abbr,250,0,0,buttonx[n],buttony[n]) + 3: printfont(@starts,250,0,0,0,29) + s:=1 + 4: printfont(@butOK,250,0,0,buttonx[n],buttony[n]) + + 5,6,7,8:ios.displaytile(144,winhcol,250,0,taby[n-4],tabx[n-4]) + printfont(@buttontext[n*6],250,0,0,buttonx[n],buttony[n]) + ios.displaytile(145,winhcol,250,0,taby[n-4],tabl[n-4]) + s:=2 + + Mouse_Release + case s + 1:print_status(@starts,0,29) + 2:ios.displaytile(144,winhcol,buttonhcol,0,taby[n-4],tabx[n-4]) 'tab wiederherstellen + print_button(@buttontext[n*6],buttonx[n],buttony[n]) + ios.displaytile(145,winhcol,buttonhcol,0,taby[n-4],tabl[n-4]) + +PRI abfrage:taste|a,x,y,k + repeat + a:=ios.mouse_button(0) + k:=ios.key + if a==255 or k==27 or k==13 + x:=ios.mousex + y:=ios.mousey + + if((x=>buttonx[1]) and (x=buttonx[2]) and (x=<(buttonx[2]+6)) and (y==buttony[2]))or k==27 'cancel + buttonpress(2) + taste:=0 + quit + fensterweg + ios.display2dbox(shellhcol, 10, 7, 17, messagex,0) +con '*********************************************** Fenster-Lösch-Funktionen **************************************************************************************************** +PRI windowloesch 'einzelnes Fenster löschen + + popup_info_weg 'Popup-oder Infofenster loeschen + ios.display2dbox(shellhcol, 1, 1, 25, 34,0) 'Fenster loeschen + windownum[1]:=windowx[1]:=windowy[1]:=windowxx[1]:=windowyy[1]:=-1 'Windowwerte loeschen + ios.windel(1) + 'printdec_win(util,1,1) + if util==4 + Load_ini_in_ram + 'iniload 'eventuell geänderte Farben wiederherstellen + bildschirmaufbau + muelleimer:=0 + util:=0 'Utilitie-Marker löschen + buttonweg 'Button-löschen + +PRI Close_window(win) + + if win==2 or infomarker==1 + popup_info_weg + else + windowloesch + copy_marker:=0 'Kopier-Marker beim Schließen löschen + ios.serclose'com.stop 'serielle Schnittstelle schliessen + serial:=0 + +PRI fensterweg 'alle gesetzten Fenster loeschen + windowloesch + Buttonweg + +pri Buttonweg|i + repeat i from 0 to 7 + buttonx[i]:=-1 + buttony[i]:=-1 + +con '************************************************* Textaus-und Eingabe *************************************************************************************************************** + +PRI textdisplay(mode)|tx,tt,c,x,adr,b '********* Text-oder Hex-Ausgabe + ios.sdopen("R",@filestring) + tx:=2 + tt:=4 + adr:=0 + repeat + + if mode==0 'Mode 0= Textausgabe + c:=ios.sdgetc + if tx==34 or c==10 'zeilenumbruch bei spalte 30 oder bei linefeed + tx:=2 + tt+=1 + if c==10 or c==13 'return oder linefeed nicht als zeichen anzeigen + next + + + if tt>24 'bis Zeile 24 + repeat + ma:=ios.mouse_button(0) + b:=ios.key + if ios.get_window//10==2 or b==27 + windowloesch 'Textfenster löschen + ios.sdclose + return + until ma==255 or b==32 'warten bis maustaste oder Space gedrückt + + ios.printchar(12) + tt:=4 + tx:=2 + if mode==1 'Mode=1 Ausgabe im Hexformat + printhex(adr,5,tx,tt,winhcol,act_color) + tx+=5 + WIN_TILE(42,tt,tx) + tx++ + x:=tx+17 + repeat 8 + c:=ios.sdgetc + printhex(c,2,tx++,tt,winhcol,act_color) + if c>175 or c<16 + c:=46 + WIN_TILE(c-16,tt,x++) + tx++ + adr++ + tx:=2 + tt+=1 + else + WIN_TILE(c-16,tt,tx) + tx++ + until ios.sdeof 'ausgabe bis eof + ios.sdclose + + + +{PRI texteingabe(y):ok|k,sp,i '************** Texteingabe im Dateifenster ****************** + sp:=3 + i:=0 + WIN_TILE(26,y,sp) + bytefill(@textline,12,0) 'Stringpuffer löschen + repeat + k:=ios.key + ma:=ios.mouse_button(0) + if k==13 'Return? dann neue Zeile + ok:=1 + textline[i++]:=0 + quit + if k==27 'Abbruch + ok:=0 + 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>12 + i:=12 'Zeichen von Tastatur + WIN_TILE(26,y,sp) + + if sp>14 + sp:=14 +} +PRI printfont(str1,a,b,c,d,e)|f + + repeat strsize(str1) + f:= byte[str1++]-16 + 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 + + 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) + xx++ + c:=value / i + "0" + value //= i + result~~ + elseif result or i == 1 + printfont(string("0"),hint,0,vor,xx,y) + xx++ + i /= 10 'nächste stelle + +PRI getHEXNumber | c, t + c := byte[tp] + if (t := hexDigit(c)) < 0 + return '("invalid hex character") + result := t + c := byte[++tp] + repeat until (t := hexDigit(c)) < 0 + result := result << 4 | t + c := byte[++tp] + +pri getnumber |c + c := byte[tp] + result := c - "0" + c := byte[++tp] + repeat while c => "0" and c =< "9" + result := result * 10 + c - "0" + c := byte[++tp] + +PRI hexDigit(c) + 'Convert hexadecimal character to the corresponding value or -1 if invalid. + if c => "0" and c =< "9" + return c - "0" + if c => "A" and c =< "F" + return c - "A" + 10 + if c => "a" and c =< "f" + return c - "a" + 10 + return -1 + +PRI printhex(value, digits,x,y,back,vor)|wert 'screen: hexadezimalen zahlenwert auf bildschirm ausgeben + + 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 '---------------------------------------------- Ausgaberoutinen --------------------------------------------------------------------------------------------------------------- +PRI Win_Tile(nu,ty,tx) + ios.displaytile(nu,winhcol,0,act_color,ty,tx) + +PRI FRAME_TILE(nu,ty,tx) + ios.displaytile(nu,winhcol,0,winframecol,ty,tx) + +PRI TITEL_TILE(nu,ty,tx) + ios.displaytile(nu,titelhcol,0,titeltextcol,ty,tx) + +PRI print_win(stradr,x,y) + printfont(stradr,winhcol,0,act_color,x,y) +PRI print_win_rev(stradr,x,y) 'reverse Darstellung + printfont(stradr,act_color,0,winhcol,x,y) + +PRI print_titel(stradr,x,y) + printfont(stradr,titelhcol,0,titeltextcol,x,y) + +PRI Print_button(stradr,x,y) + printfont(stradr,buttonhcol,0,buttontextcol,x,y) + +PRI print_status(stradr,x,y) + printfont(stradr,hcolstatus,0,statustextcol,x,y) + +PRI print_message(stradr,x,y) + printfont(stradr,messagehcol,0,messagetextcol,x,y) + +PRI printdec_win(n,y,x) + printdec(n,y,x,winhcol,act_color) + +PRI printdec_win_revers(n,y,x) + printdec(n,y,x,act_color,winhcol) + +PRI printdec_titel(n,y,x) + printdec(n,y,x,titelhcol,titeltextcol) + +con '**************************************************** diverse Hilfsunterprogramme ******************************************************************************************** + +PRI wert_plusminus(op,wertx,minwert,maxwert) 'op=operation +/- 1/2 ,aktueller wert, mindestwert,maxwert + case op + 1:wertx++ + if wertx>maxwert + wertx:=minwert + 2:wertx-- + if wertx0 + scrollanfang-- + ios.scrolldown(1, winhcol, 6, 2, 24, 32,1) + dump(adresse,2,6,dump_ram) + +PRI scrollrunter + + if scrollanfang<0 + scrollanfang:=0 + if scrollanfang>0 + ios.scrolldown(1, winhcol, 4, 2, 24, 32,1) + getfilename(scrollanfang) + Scan_File(4) + scrollanfang-- + scrollende-- + y_old++ + +PRI scrollhoch + if scrollendefilenumber + scrollende:=filenumber + scrollanfang:=filenumber-21 + +PRI doppelklick|click 'pseudo-doppelklick + click:=0 + popup_info_weg + Mouse_Release + + repeat 500 + if ios.mouse_button(0)==255 + click++ + + if click>1 + return 1 + +PRI Leerstellenweg(f)|i,c 'entfernt die Leerstellen im String + i:=0 + dirname[i++]:="\" + repeat while strsize(f) + c:=byte[f++] + if c==32 + quit + dirname[i++]:=c + dirname[i++]:="\" + dirname[i++]:=0 + +PRI Scan_File(y)|col 'scannt den Dateinamen nach erweiterung ->keine Erweiterung=Verzeichnis=andere Farbe + col:=act_color + if filedir==255 'verzeichnis + col:=selectcol + if filehidden==255 'versteckte Dateien werden grau dargestellt + col:=grey + display_filename(@filestring,y,col) + +PRI display_list(a,b)|n,tt 'Dateiliste aus dem Speicher lesen und anzeigen + tt:=4 + 'playerstop + repeat n from a to b + getfilename(n) + Scan_File(tt) + tt++ + +con '********************************************* Ausgabe von Fehlermeldungen *************************************************************************************************** +PRI error(err) + + messagebox(ram_txt(err),1) + '********************** Fehlermeldungen in Messageboxen ********************************************** +{ case err + 0: no error + 1: Filesys unmounted + 2: Filesys corrupted + 3: Filesys unsupported + 4: not found + 5: File not found + 6: Dir not found + 7: File read only + 8: End of File + 9: End of Directory + 10: End of Root + 11: Directory is full + 12: Directory is not empty + 13: Checksum Error + 14: Reboot Error + 15: bpb corrupt + 16: Filesys corrupt + 17: Dir already exist + 18: File already exist + 19: Out of Disk free Space + 20: Disk I/O Error + 21: Command not found + 22: Timeout + 23: Out of Memory Error + 24: Delete selected File? + 25: Reboot Hive-Computer? + 26: NO FILE SELECTED + 27: SD-CARD Format Ready + 28: Format SD-CARD ? + 29: Delete selected Link? + 30: Delete all Files? + 31: Trash to empty ? + '****************** ab hier werden die Texte mit -> ram_txt(nummer,TXT_RAM) aufgerufen ************** + 32: SD-Card-Info + 33: File-Info + 34: Calendar + 35: Filename: + 36: Filetype: + 37: Directory + 38: File + 39: - Attribute - + 40: R/O HID SYS ARC + 41: Textdisplay + 42: Startmenue + 43: Administra: + 44: Bellatrix : + 45: Regnatix : + 46: System-Settings + 47: Show hidden Files: + 48: Use Trash : + 49: Serial-Terminal + 50: Set Baudrate + 51: Systeminfo + 52: Clock-Settings + 53: Color-Settings + 54: Ram-Monitor + 55: Sid-Dmp-Player + 56: Copy : + 57: Delete: + 58: Venatrix : + 59: Start-Parameter (für Links) + 60: Venatrix-BUS: + 61: Sepia-Card : + 62: Cogs + 63: About + 64: Date + 65: Time + 66: Col: + 67: H-RAM: + 68: E-RAM: + +} +PRI display_error(er):r + if er + error(er) + r:=abfrage + ios.sdclose + +PRI messagebox(st,ok)|laenge,mindest + laenge:=strsize(st)+2 + mindest:= 20 + messagex:=10+laenge + ios.display3DBox(white, 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) + +con '************************************************** Dateioperationen ********************************************************************************************************* + +PRI mount + if mountmarker==1 + ifnot cmd_unmount + trashcounter:=0 'bei unmount, Mülleimer schliessen + util:=0 'Utils auf null + tmpplay:=0 'Song-Zähler auf null + Verzeichnis_counter:=0 + + elseif mountmarker==0 + ifnot cmd_mount + userdir:=rootdir 'Neu geöffnete SD-Karte beginnt immer im Root-Verzeichnis + +PRI cmd_mount :err + + 'repeat 16 + err:=ios.sdmount + ifnot err + mountmarker:=1 + icon(1,1) + ' quit + else + display_error(err) + 'quit +pri Checkmount:err + err:=0 + if mountmarker<1 + display_error(1) + err:=1 + icon(1,0) + +PRI cmd_unmount|err + ios.sdclose + err:=ios.sdunmount + ifnot err + mountmarker:=0 + icon(1,0) + else + display_error(err) + +PRI cmd_mkdir|e 'cmd: verzeichnis erstellen + + e:=ios.sdnewdir(@New_Dir) + + if e + display_error(e) + +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 File_All(mode)|n,stradr,dcopy + + n:=1 + ios.sddir 'kommando: verzeichnis öffnen + break:=0 + dcopy := get_dirmarker 'usermarker von administra holen + case mode + '---------------------------- Alle Dateien ins Zielverzeichnis kopieren ---------------------------------------------- + 0:repeat while (stradr<>0) + if break 'abbruch + quit + activate_dirmarker(userdir) 'Quellverzeichnis öffnen + + '###### diese 2.schleife ist nötig um die nächste Datei auszuwählen, da durch den Wechsel des Dirmarkers ############ + '###### jedes mal das Verzeichnis zurückgesetzt wird und der ios.sdnext-Befehl bei 1 anfängt ###################### + repeat n + stradr:=ios.sdnext + + if stradr<>0 'gültiger eintrag? + ifnot ios.sdfattrib(19) 'Verzeichnis? + copy_function(userdir,targetdir,stradr,0) 'Datei in den Zielordner kopieren + n++ 'Dateizähler erhöhen + activate_dirmarker(targetdir) 'Zielverzeichnis öffnen + '--------------------------- Alle Dateien in den Mülleimer verschieben ----------------------------------------------- + 1:repeat while (stradr <> 0) 'ist eintrag gültig? + if break 'abbruch + quit + stradr:=ios.sdnext 'einen eintrag holen + if stradr <> 0 'eintrag gültig? + if ios.sdfattrib(19) 'Verzeichnis?,dann ignorieren + next + if Use_Trash and dcopy<>trashdir 'wird der Mülleimer benutzt?,und nur kopieren, wenn nicht im Mülleimerverzeichnis + copy_function(dcopy,trashdir,stradr,1) 'Datei in den Muelleimer kopieren + activate_dirmarker(dcopy) 'Quellmarker setzen + ifnot break 'Abfrage Abbruchmarker + ios.sddel(stradr) 'Quelldatei loeschen + + scan_trash(0) 'Mülleimer scannen + if Use_Trash + activate_dirmarker(dcopy) 'Quellverzeichnis öffnen + +PRI cmd_del(strg)|e,dcopy 'cmd: datei auf sdcard löschen +{{sddel - datei auf sdcard löschen}} + break:=0 + error(24) 'Datei löschen? + print_message(@filestring,8,13) + e:=0 + ios.sdopen("R",@filestring) + e:=ios.sdfattrib(16) 'Datei schreibgeschützt + ios.sdclose + if abfrage 'OK gedrückt, Datei löschen + if e + display_error(7) 'schreibgeschützte Datei kann nicht gelöscht werden + return + ifnot filedir + if Use_Trash + dcopy := get_dirmarker 'usermarker von administra holen + copy_function(dcopy,trashdir,strg,1) 'Datei in den Muelleimer kopieren + scan_trash(0) + activate_dirmarker(dcopy) 'Quellmarker setzen + ifnot break 'wenn nicht Abbruch gedrückt wurde, + ios.sddel(strg) 'ursprüngliche Datei löschen + +PRI Copy_fenster(source,mode) + if mode==0 + infofenster(8,6,30,10,ram_txt(56),2) 'Kopierfenster oeffnen + else + infofenster(8,6,30,10,ram_txt(57),2) 'Delete-Fenster oeffnen + print_titel(source,16,4) + printdec_win(0,6,9) 'Null und + printdec_win(100,6,27) 'einhundert anzeigen + rahmen(9,7,29,9) 'Rahmen um den Fortschrittsbalken + +PRI copy_function(cm,pm,source,mode)|laenge,i,d,n,e,x,y + copy_fenster(source,mode) 'Kopier- oder Delete-Fenster anzeigen + activate_dirmarker(pm) 'Zielmarker setzen + break:=0 + e:=ios.sdnewfile(source) 'neue Datei erstellen + + if e 'Fehler? + if e==18 'Datei existiert schon + if mode==0 'im Kopiermodus wird gefragt, ob eine existierende Datei überschrieben werden soll + + if display_error(18) 'Anzeige-> Datei existiert schon 'OK angeklickt + copy_fenster(source,mode) 'Kopier- oder Delete-Fenster anzeigen + ios.sddel(source) 'dann löschen + ios.sdnewfile(source) 'neue Datei erstellen + else + ios.sdclose 'Cancel angeklickt + return 'ohne Aktion zurück + else 'im Delete-Modus wird überschrieben ohne zu fragen (Mülleimer) + ios.sddel(source) 'dann löschen + ios.sdnewfile(source) 'neue Datei erstellen + else + display_error(e) 'Fehlerausgabe, wenn erfolglos + ios.sdclose + return 'zurück + + ios.sdclose + activate_dirmarker(cm) 'wieder quellmarker setzen + ios.sdopen("R",source) 'zu kopierende Datei oeffnen + + laenge:=ios.sdfattrib(0) 'um Dateilänge zu lesen (für Fortschrittsbalken) + ios.sdclose + + ios.sdcopy(cm,pm,source) 'Datei kopieren + + repeat 'Fortschritt im Fortschrittsfenster anzeigen + ma:=ios.Mouse_Button(0) 'Maustastenabfrage + if ma==255 + x:=ios.mousex 'x und y-Position der Maus beim drücken + y:=ios.mousey + if(x=>buttonx[2]) and (x=<(buttonx[2]+6)) and (y==buttony[2]) 'Abbruch gedrückt? + buttonpress(2) + ios.bus_putchar1(1) 'Abbruchsignal an Administra senden + break:=1 'Abbruchmarker setzen + quit 'und raus + else + ios.bus_putchar1(0) 'Administra sagen, das nicht Abbruch gedrückt wurde + i:=ios.bus_getlong1 'Kopierfortschritt von Administra empfangen + d:=laenge/19 'Kopierbalken-Länge berechnen + n:=i/d + if n>-1 'bei Abbruch wird -1 von Administra gesendet + ios.display2dbox(act_color,8,10,8,10+n,0) 'Kopierbalken aktualisieren + + + until i<0 + + Popup_info_Weg 'Nach erfolgreicher Operation, Info-Fenster schliessen + infomarker:=0 'Info-Marker loeschen + + + +con '************************************************* Mülleimer ***************************************************************************************************************** + +PRI Muelleimer_erstellen + if ios.sdchdir(@trash) 'Trash-Verzeichnis nicht vorhanden + ios.sdnewdir(@TRASH) 'Trash-Verzeichnis erstellen + ios.sdchattrib(@TRASH,string("RHS")) 'Attribute setzen (R/O, Hidden,System) + ios.sdchdir(@trash) 'ins Trash-Verzeichnis wechseln + trashdir:=get_dirmarker 'Dir-Marker lesen + scan_trash(0) 'gucken, ob was im Mülleimer ist, wenn ja Icon Voll anzeigen + activate_dirmarker(rootdir) 'wieder zurüeck ins root-Verzeichnis + + + +PRI scan_trash(mode)|n,stradr 'Mülleimer auf Anzahl Einträge scannen + + if mountmarker<1 + return + playerstop + activate_dirmarker(trashdir) + + n:=0 + + if mode==1 'löschen? + n:=trashcounter + + ios.sddir 'kommando: verzeichnis öffnen + + repeat while (stradr <> 0) 'ist eintrag gültig? 'wiederhole bis verzeichnisende + + stradr:=ios.sdnext 'einen eintrag holen + if stradr <> 0 + if ios.sdfattrib(19) 'Verzeichnis?,dann ignorieren + next + if mode==0 'einträge nur lesen und zählen + n++ + + else 'einträge löschen (Mülleimer leeren) und rückwärts zählen + ios.sddel(stradr) + n-- + trashcounter:=n + Show_Trash + activate_dirmarker(userdir) 'Userverzeichnis setzen + +PRI Show_Trash + if trashcounter>0 + icon(3,1) 'Mülleimer voll anzeigen (Deckel weg) + else + icon(2,1) 'Mülleimer leer anzeigen (Deckel drauf) + +con '***************************************************** Reboot-Funktion ******************************************************************************************************* +PRI cmd_reboot 'cmd: reboot + ios.displaytile(1,250,0,0,0,39) 'Schliessen-Symbol + Mouse_Release + FRAME_TILE(1,0,39) + + if display_error(25) 'Frage Reboot anzeigen und abfragen + playerstop 'eventuell laufenden Player stoppen + ios.Clear_Bluetooth_Command_Mode 'Kommando-Mode ausschalten + + ios.ram_wrbyte(0,START_FLAG) + ios.admreset + ios.belreset + ios.venreset + + waitcnt(cnt+clkfreq*3) + reboot + +PRI Mouse_Release + repeat while ios.mouse_button(0) 'warten bis Maustaste losgelassen wird + +con '***************************************************** Directory anzeigen **************************************************************************************************** +PRI cmd_dir|stradr,n,d,c',sh 'cmd: verzeichnis anzeigen +{{sddir - anzeige verzeichnis}} + n:=0 + d:=0 + dmpfiles:=0 + + ios.sddir 'kommando: verzeichnis öffnen + + repeat while (stradr <> 0) 'Begrenzung der Einträge auf die mit DIR_ENTRY vereinbarte 'ist eintrag gültig? + 'wiederhole bis verzeichnisende + stradr:=ios.sdnext 'einen eintrag holen + if stradr <> 0 + if Show_Hid_Files==0 + if ios.sdfattrib(17) 'unsichtbare Dateien ausblenden + next + n++ + if (ios.sdfattrib(19)) + d++ + + + scanstr(stradr,1) + if strcomp(@buff,@dmpfile) + WriteDmpToRam(DMP_RAM,stradr,ios.sdfattrib(0),dmpfiles++) + c:=dmpfiles + WriteNameToRam(stradr,ios.sdfattrib(0),ios.sdfattrib(10),ios.sdfattrib(11),ios.sdfattrib(12),ios.sdfattrib(19),ios.sdfattrib(16),ios.sdfattrib(17),ios.sdfattrib(18),ios.sdfattrib(20),c,n) 'Dateiname zur spaeteren Verwendung in ERam speichern an adresse n + c:=0 + filenumber:=n + dirnumber:=d + ios.ram_fill(DIR_RAM+(n*28),$1BFF-(n*28),0) 'Variablen,Dir-Speicher,nach letzten Eintrag löschen + ios.ram_fill(DMP_RAM+(dmpfiles*17),$1FFF-(dmpfiles*17),0) 'Dmp-File-Speicher nach letztem Eintrag löschen + +PRI display_Filename(stradr,ty,col)|p 'Ausgabe Dateiname, Icon, Größe und Erstellungsdatum + scanstr(stradr,1) + + p:=get_pic(@buff) + + if strsize(stradr)>0 and ty<25 + ios.displaytile(p,winhcol,winframecol,col,ty,2) + display_line(stradr,ty,col,winhcol) + 'printfont(stradr,winhcol,0,col,3,ty) + if filedir + printfont(string("Dir"),winhcol,0,col,16,ty) + else + printdec(filelen,ty,16,winhcol,col) + printdec(fileday,ty,23,winhcol,col) + ios.displaytile(29,winhcol,0,col,ty,25) + printdec(filemonth,ty,26,winhcol,col) + ios.displaytile(29,winhcol,0,col,ty,28) + printdec(fileyear,ty,29,winhcol,col) + +PRI display_Line(stradr,ty,vor,hin) 'Ausgabe Dateiname, Icon, Größe und Erstellungsdatum + + printfont(stradr,hin,0,vor,3,ty) + +PRI get_pic(stradr):pic 'Icon für spezifische Dateiendung zuweisen + + pic:=ALL_PIC + if strcomp(stradr,@binfile) + pic:=BIN_PIC + elseif strcomp(stradr,@admfile) + pic:=ADM_PIC + elseif strcomp(stradr,@belfile) + pic:=BEL_PIC + elseif strcomp(stradr,@basfile) + pic:=BAS_PIC + elseif strcomp(stradr,@dmpfile) + pic:=DMP_PIC + elseif strcomp(stradr,@txtfile) + pic:=TXT_PIC + elseif strcomp(stradr,@sysfile) + pic:=SYS_PIC + elseif strcomp(stradr,@colorfile) + pic:=CLR_PIC + elseif strcomp(stradr,@extfile) + pic:=EXT_PIC + elseif filedir or strsize(stradr)<1 + pic:=DIR_PIC + +PRI scanstr(f,mode) | z ,c 'Dateiendung extrahieren + if mode==1 + repeat while strsize(f) + if c:=byte[f++] == "." 'bis punkt springen + quit + + z:=0 + repeat 3 'dateiendung lesen + c:=byte[f++] + buff[z++] := c + buff[z++] := 0 + return @buff + +con '*************************************************** Datei-Verwaltung im E-Ram *********************************************************************************************** + +PRI WriteNameToRam(st,laenge,t,m,j,dir,rdonly,hidden,sys,archiv,dpos,nummer)|adress,position,c 'Dateiliste in ERam schreiben + position:=(nummer-1)*28 + adress:=DIR_RAM+position + repeat strsize(st) + c:=byte[st++] + ios.ram_wrbyte(c,adress++) + ios.ram_wrlong(laenge,adress++) '4 + adress+=4 + ios.ram_wrword(dpos,adress++)'2 + adress++ + ios.ram_wrbyte(dir,adress++) '1 + ios.ram_wrbyte(rdonly,adress++) '1 + ios.ram_wrbyte(hidden,adress++) '1 + ios.ram_wrbyte(sys,adress++) '1 + ios.ram_wrbyte(archiv,adress++) '1 + ios.ram_wrbyte(t,adress++)'1 + ios.ram_wrbyte(m,adress++)'1 + ios.ram_wrword(j,adress++)'2 + +PRI WriteDmpToRam(basis,st,ln,n)|adress,position,c 'dmp-File-Liste in E-Ram schreiben + position:=n*17 + adress:=basis+position + repeat strsize(st) + c:=byte[st++] + ios.ram_wrbyte(c,adress++) + ios.ram_wrlong(ln,adress++) + +PRI getfilename(nummer)|adress,position,c,z',aus 'Dateiname aus dem E-Ram holen + position:=(nummer-1)*28 + adress:=DIR_RAM+position 'Adresse Dateiname im eRam + z:=0 + 'aus:=0 + bytefill(@filestring,12,0) + repeat 12 + c:=ios.ram_rdbyte(adress++) 'Dateiname aus Dir-Ram lesen + filestring[z++]:=c + + filestring[z]:=0 + filelen:=ios.ram_rdlong(adress++) + dmplen:=filelen/25 + adress+=4 + dumpnummer:=ios.ram_rdword(adress++) + adress++ + filedir:=ios.ram_rdbyte(adress++) + filerdonly:=ios.ram_rdbyte(adress++) + filehidden:=ios.ram_rdbyte(adress++) + filesystem:=ios.ram_rdbyte(adress++) + filearchiv:=ios.ram_rdbyte(adress++) + fileday:=ios.ram_rdbyte(adress++) + filemonth:=ios.ram_rdbyte(adress++) + fileyear:=ios.ram_rdword(adress++) + + +con '*********************************************** Icon-Buttons **************************************************************************************************************** +PRI iconbutton(n,t,x,y) + ios.displaytile(t,winhcol,panelcol,0,y,x) + iconx[n]:=x + icony[n]:=y + iconnr[n]:=t + iconf1[n]:=winhcol + iconf2[n]:=panelcol + iconf3[n]:=0 + + +PRI iconpress(n,mode) + ios.displaytile(iconnr[n],0,0,255,icony[n],iconx[n]) 'ein-Tile Icon + if mode + ios.displaytile(iconnr[n]+1,0,0,255,icony[n],iconx[n]+1) 'zwei-Tile Icon + + Mouse_Release + ios.displaytile(iconnr[n],iconf1[n],iconf2[n],iconf3[n],icony[n],iconx[n]) 'ein-Tile Icon + if mode + ios.displaytile(iconnr[n]+1,iconf1[n],iconf2[n],iconf3[n],icony[n],iconx[n]+1) 'zwei-Tile Icon + +con '********************************** Speicher und Laderoutinen als Binaerdateien ************************* +PRI binsave|i,a,b + b:=SETTING_RAM + repeat i from 0 to 14 + a:=get_farbe(i) + ios.sdputc(a) + ios.ram_wrbyte(a,b++) 'neue Farbwerte in den Ram schreiben + ios.ram_wrbyte(baud,b++) 'Übertragungsrate serielles Terminal in den Ram schreiben + ios.ram_wrbyte(Show_Hid_Files,b++) 'Anzeige unsichtbarer Dateien in den Ram schreiben + ios.ram_wrbyte(Use_Trash,b++) 'Verwendung Mülleimer in den Ram schreiben + ios.ram_wrbyte(DCF_ON,b++) 'Verwendung DCF-Empfänger in den Ram schreiben + ios.ram_wrbyte(Bluetooth_on,b++) 'Verwendung Bluetooth-Modul in den Ram schreiben + + ios.sdputc(baud) 'Übertragungsrate serielles Terminal in INI-Datei schreiben + ios.sdputc(Show_Hid_Files) 'Anzeige unsichtbarer Dateien in INI-Datei schreiben + ios.sdputc(Use_Trash) 'Verwendung Mülleimer in INI-Datei schreiben + + i:=LINK_RAM + repeat 51 'Links in INI-Datei schreiben + ios.sdputc(ios.ram_rdbyte(i++)) + + i:=mouse_Ram + repeat 64 + ios.sdputc(ios.ram_rdbyte(i++)) 'Maus-Pointer in INI-Datei schreiben + + i:=PARA_RAM + repeat 192 + ios.sdputc(ios.ram_rdbyte(i++)) 'Link-Parameter in INI-Datei schreiben + + ios.sdputc(dcf_on) 'Verwendung DCF-Empfänger + ios.sdputc(bluetooth_on) 'Verwendung Bluetooth-Modul + +PRI iniload|i,a + i:=SETTING_RAM + repeat a from 0 to 14 + farbe(a,ios.ram_rdbyte(i++)) 'Farbwerte einlesen + + baud:=ios.ram_rdbyte(i++) 'Übertragungsrate serielles Terminal + Show_Hid_Files:=ios.ram_rdbyte(i++) 'unsichtbare Dateien anzeigen? ja/nein + Use_Trash:=ios.ram_rdbyte(i++) 'Mülleimer verwenden? ja/nein + dcf_on:=ios.ram_rdbyte(i++) 'DCF-Empfänger benutzen + bluetooth_on:=ios.ram_rdbyte(i++) 'Bluetooth-Modul + + ios.Mousepointer(MOUSE_RAM) 'Maus-Pointer einlesen + dcf_onoff 'DCF-Ein/Aus + + +pri dcf_onoff + + if dcf_on and ios.dcf_status==0 'DCF nur einschalten, wenn es noch nicht läuft ' + ios.dcf_startup + if dcf_on==0 and ios.dcf_status==1 + ios.dcf_down + +pri load_ini_in_ram + change_marker:=0 + playerstop + activate_dirmarker(systemdir) + if ios.sdopen("R",@ini) 'INI-Datei laden + LINK_LOAD(0) + else + LINK_LOAD(1) + activate_dirmarker(userdir) + +PRI LINK_LOAD(mode)|i,c + + if mode==1 + i:=SETTING_RAM + repeat 18 + ios.ram_wrbyte(ios.sdgetc,i++) 'Farbwerte und Systemeinstellungen aus INI lesen + 'und anwenden + + i:=LINK_RAM + + repeat 51 + if mode==1 'INI-Datei vorhanden ->Links einlesen + c:=ios.sdgetc + else 'keine Ini-Datei vorhanden + c:=0 + ios.ram_wrbyte(c,i++) 'Linkspeicher mit Nullen füllen + + i:=Mouse_Ram + repeat 64 + if mode==1 'INI-Datei vorhanden ->Mauszeiger einlesen + c:=ios.sdgetc + ios.ram_wrbyte(c,i++) + + i:=PARA_RAM + repeat 192 + if mode==1 'INI-Datei vorhanden ->Links einlesen + c:=ios.sdgetc + else 'keine Ini-Datei vorhanden + c:=0 + ios.ram_wrbyte(c,i++) 'Linkspeicher mit Nullen füllen + + dcf_on:=ios.sdgetc 'Verwendung DCF-Empfänger + bluetooth_on:=ios.sdgetc 'Bluetooth-Modul + iniload + +PRI inisave + + if mountmarker==1 + playerstop + activate_dirmarker(systemdir) + ios.sddel(@ini) + ios.sdnewfile(@ini) + ios.sdopen("W",@ini) + binsave + ios.sdclose + activate_dirmarker(userdir) + +pri loadMouse(datei)|e + e:=ios.sdopen("R",datei) 'datei öffnen + ifnot e + lmouse +pri lmouse + ios.sdxgetblk(MOUSE_RAM,64) 'datei in den Speicher schreiben (der blockbefehl ist viel schneller als der char-Befehl) + ios.sdclose + ios.Mousepointer(MOUSE_RAM) + +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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} + diff --git a/source/Plexus-Start-Trios.spin b/source/Plexus-Start-Trios.spin new file mode 100644 index 0000000..cce56b1 --- /dev/null +++ b/source/Plexus-Start-Trios.spin @@ -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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} + diff --git a/source/VGA64_Engine.spin b/source/VGA64_Engine.spin new file mode 100644 index 0000000..582b510 --- /dev/null +++ b/source/VGA64_Engine.spin @@ -0,0 +1,1713 @@ +{{ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// VGA64 Tilemap Engine +// +// Author: Kwabena W. Agyeman +// Updated: 7/27/2010 +// Designed For: P8X32A +// Version: 1.0 +// +// Copyright (c) 2010 Kwabena W. Agyeman +// See end of file for terms of use. +// +// Update History: +// +// v1.0 - Original release - 7/27/2010. +// +// For each included copy of this object only one spin interpreter should access it at a time. +// +// Nyamekye, +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Video Circuit: +// +// 0 1 2 3 Pin Group +// +// 240OHM +// Pin 0, 8, 16, 24 ----R-------- Vertical Sync +// +// 240OHM +// Pin 1, 9, 17, 25 ----R-------- Horizontal Sync +// +// 470OHM +// Pin 2, 10, 18, 26 ----R-------- Blue Video +// | +// 240OHM | +// Pin 3, 11, 19, 27 ----R----- +// +// 470OHM +// Pin 4, 12, 20, 28 ----R-------- Green Video +// | +// 240OHM | +// Pin 5, 13, 21, 29 ----R----- +// +// 470OHM +// Pin 6, 14, 22, 30 ----R-------- Red Video +// | +// 240OHM | +// Pin 7, 15, 23, 31 ----R----- +// +// 5V +// | +// --- 5V +// +// --- Vertical Sync Ground +// | +// GND +// +// --- Hoirzontal Sync Ground +// | +// GND +// +// --- Blue Return +// | +// GND +// +// --- Green Return +// | +// GND +// +// --- Red Return +// | +// GND +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +}} + +CON + + #$FC, Light_Grey, #$A8, Grey, #$54, Dark_Grey + #$C0, Light_Red, #$80, Red, #$40, Dark_Red + #$30, Light_Green, #$20, Green, #$10, Dark_Green + #$0C, Light_Blue, #$08, Blue, #$04, Dark_Blue + #$F0, Light_Orange, #$A0, Orange, #$50, Dark_Orange + #$CC, Light_Purple, #$88, Purple, #$44, Dark_Purple + #$3C, Light_Teal, #$28, Teal, #$14, Dark_Teal + #$FF, White, #$00, Black + + #0, Cursor_Left, Cursor_Right, #10, Cursor_Down, Cursor_Up + '# -1, Focus + #8, Backspace, Tab, Line_feed, Vertical_Tab, Form_Feed, Carriage_Return + +VAR + + byte printRow, printColumn, printBoxFGColor[8], printBoxBGColor[8], printStartRow[8], printStartColumn[8], printEndRow[8], printEndColumn[8] + byte win + byte yendwin[8],xendwin[8],yanf[8],xanf[8],cursorx[8],cursory[8] + word puffer[12] + long bufferaddress[12] +{PUB printString(characters) '' 30 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Prints a string to the screen inside of the print box defined by the print settings. +'' // +'' // Characters - A pointer to a string of characters to be printed. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + repeat strsize(characters) + printCharacter(byte[characters++]) + } +pub printat(y,x) + printColumn:=x + printRow:=y +{pub PlotPixel(color,startColumn,startRow)|punkt + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Displays a Dot on screen. +'' // +'' // Color - A color byte (%RR_GG_BB_xx) to use. +'' // StartRow - The row to start drawing on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // StartColumn - The column to start drawing on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + color := computeFillColor(color) + drawingStart(startRow, startColumn, startRow, startColumn) + punkt := (startRow*40)+ startColumn + chromaBuffer[punkt]:=color + drawingStop +} +pub setx(x) + printColumn:=x +pub sety(y) + printRow:=y +pub getx + return printColumn +pub gety + return printRow +PUB printCharacter(character) '' 26 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Prints a character to the screen inside of the print box defined by the print settings. +'' // +'' // 0 - Move the cursor left one space. +'' // 1 - Move the cursor right one space. +'' // 8 - Backspace. Move the cursor back one space and delete the character underneath it. +'' // 9 - Tab. Move the cursor forward eight spaces. +'' // 10 - Line Feed. Move the cursor down. +'' // 11 - Vertical Tab. Move the cursor up. +'' // 12 - Form Feed. Move the cursor back to the start of the print box and clear the print box. +'' // 13 - Carriage Return. Move the cursor back to the start of the line. +'' // +'' // Character - A character to be printed. -1 to focus. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + if(printStartRow[win] =< printEndRow[win]) + if(character <> -1) + + case character + 4: printColumn :=0 + 5: printColumn -= 1 + 6: printColumn += 1 + 7: printColumn:=0 + printRow:=0 + 8: + printColumn -= 1 + character := " " + + 9: printColumn += (4 - (printColumn & $3)) + 10: printRow += 2 + 11: printRow -= 2 + + 12: + printRow := printStartRow[win] + printColumn := printStartColumn[win] + display2DBox(printBoxBGColor[win], printStartRow[win], printStartColumn[win], printEndRow[win], printEndColumn[win]) + + 13: printColumn := printStartColumn[win] + printRow += 2 + other: result := true + + if((~printColumn) < printStartColumn[win]) + printColumn := printEndColumn[win] + printRow -= 2 + + if((~printRow) < printStartRow[win]) + printRow := printStartRow[win] + scrollDown(2, printBoxBGColor[win], printStartRow[win], printStartColumn[win], printEndRow[win], printEndColumn[win],1) + + repeat 2 + + if((~printColumn) > printEndColumn[win]) + printColumn := printStartColumn[win] + printRow += 2 + + if((~printRow) => printEndRow[win]) + printRow := (printEndRow[win] - 1) + scrollUp(2, printBoxBGColor[win], printStartRow[win], printStartColumn[win], printEndRow[win], printEndColumn[win],1) + + if(result or (character == " ")) + displayCharacter(character~, printBoxFGColor[win], printBoxBGColor[win], printRow, printColumn) + + printColumn -= result~ + printPosition := @chromaBuffer[computeIndex(printRow, printColumn)] +PUB printqChar(character) '' 26 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Prints a character to the screen inside of the print box defined by the print settings. +'' // +'' // 0 - Move the cursor left one space. +'' // 1 - Move the cursor right one space. +'' // 8 - Backspace. Move the cursor back one space and delete the character underneath it. +'' // 9 - Tab. Move the cursor forward eight spaces. +'' // 10 - Line Feed. Move the cursor down. +'' // 11 - Vertical Tab. Move the cursor up. +'' // 12 - Form Feed. Move the cursor back to the start of the print box and clear the print box. +'' // 13 - Carriage Return. Move the cursor back to the start of the line. +'' // +'' // Character - A character to be printed. -1 to focus. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + if(printStartRow[win] < printEndRow[win]) + if(character <> -1) + + result := true + + if((~printColumn) < printStartColumn[win]) + printColumn := printEndColumn[win] + printRow -= 2 + + if((~printRow) < printStartRow[win]) + printRow := printStartRow[win] + scrollDown(2, printBoxBGColor[win], printStartRow[win], printStartColumn[win], printEndRow[win], printEndColumn[win],1) + + repeat 2 + + if((~printColumn) > printEndColumn[win]) + printColumn := printStartColumn[win] + printRow += 2 + + if((~printRow) => printEndRow[win]) + printRow := (printEndRow[win] - 1) + scrollUp(2, printBoxBGColor[win], printStartRow[win], printStartColumn[win], printEndRow[win], printEndColumn[win],1) + + if(result or (character == " ")) + displayCharacter(character~, printBoxFGColor[win], printBoxBGColor[win], printRow, printColumn) + + printColumn -= result~ + printPosition := @chromaBuffer[computeIndex(printRow, printColumn)] + +PUB printBoxColor(fenster,fore, back) '' 5 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Changes the print box colors. +'' // +'' // ForegroundColor - A color byte (%RR_GG_BB_xx) for the foreground character color. +'' // BackgroundColor - A color byte (%RR_GG_BB_xx) for the background character color. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + win:=fenster + printBoxFGColor[win] := fore + printBoxBGColor[win] := back + +PUB printBoxSize(fenster,startRow, startColumn, endRow, endColumn) '' 31 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Changes the print box size and position. +'' // +'' // StartRow - The row to start printing on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // StartColumn - The column to start printing on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndRow - The row to end printing on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // EndColumn - The column to end printing on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + win:=fenster + yendwin[win]:=endrow + xendwin[win]:=endColumn + yanf[win]:=startRow + xanf[win]:=startColumn + printEndRow[win]:= limitRow(yendwin[win]) + printEndColumn[win] := limitColumn(xendwin[win]) + printStartRow[win] := computeLimit(yanf[win], printEndRow[win]) + printStartColumn[win] := computeLimit(xanf[win], printEndColumn[win]) + 'printEndRow += (not((printEndRow - printStartRow) & 1)) + 'printCharacter(12) + printRow := printStartRow[win] + printColumn := printStartColumn[win] + display2DBox(printBoxBGColor[win], printStartRow[win], printStartColumn[win], printEndRow[win], printEndColumn[win]) + +pub printwindow(fenster) + cursorx[win]:=printCursorColumn + cursory[win]:=printCursorRow + win:=fenster + 'printEndRow[win]:= limitRow(yendwin[win]) + 'printEndColumn[win] := limitColumn(xendwin[win]) + 'printStartRow[win] := computeLimit(yanf[win], printEndRow[win]) + 'printStartColumn[win] := computeLimit(xanf[win], printEndColumn[win]) + printrow:=cursory[win]'printStartrow + printcolumn:=cursorx[win]'printStartColumn + +pub del_win(fenster) +printStartRow[fenster] :=printStartRow[0] +printStartColumn[fenster]:=printStartColumn[0] +printEndRow[fenster] :=printEndRow[0] +printEndColumn[fenster] :=printEndColumn[0] +printBoxBGColor[fenster] :=printBoxBGColor[0] +printBoxFGColor[fenster] :=printBoxFGColor[0] +cursory[fenster] :=cursory[0] +cursorx[fenster] :=cursorx[0] +win:=0 +printwindow(0) + +PUB printCursorColor(color) '' 8 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Changes the print cursor color. +'' // +'' // Color - A color byte (%RR_GG_BB_xx) describing the print cusor color. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + printColor := computeFillColor(color) + +PUB printCursorRate(rate) '' 8 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Changes the print cursor (blink) rate. +'' // +'' // Rate - A blink rate for the print cursor. 0=0Hz, 1=0.46875Hz, 2=0.9375Hz, 3=1.875Hz, 4=3.75Hz, 5=7.5Hz, 6=15Hz, 7=30Hz. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + printRate := ($100 >> computeLimit(rate, 7)) + +PUB printCursorRow '' 3 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Returns the current row the print cursor is on. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + return ~printRow + +PUB printCursorColumn '' 3 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Returns the current column the print cursor is on. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + return ~printColumn + +PUB scrollUp(lines, color, startRow, startColumn, endRow, endColumn,rate) '' 24 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Scrolls the contents of whatever is in the specified area up and scrolls in blank space of the selected color. +'' // +'' // Color - A color byte (%RR_GG_BB_xx) to use for the background color being scrolled in. +'' // Lines - Number of rows to scroll up. This function will do nothing if this value is invalid. +'' // StartRow - The row to start scrolling on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // StartColumn - The column to start scrolling on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndRow - The row to end scrolling on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // EndColumn - The column to end scrolling on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + color := computeFillColor(color) + endRow := limitRow(endRow) + endColumn := limitColumn(endColumn) + startRow := computeLimit(startRow, endRow) + startColumn := computeLimit(startColumn, endColumn) + lines := (computeLimit(lines, (endRow - startRow + 1)) * 40) + + if(lines) + drawingStart(startRow, startColumn, endRow, endColumn) + startRow := computeIndex(startRow, startColumn) + endRow := computeIndex(endRow, startColumn) + endColumn -= --startColumn + + if(lines =< (endRow - startRow)) + repeat result from startRow to (endRow - lines) step 40 + wordmove(@lumaBuffer[result], @lumaBuffer[result + lines], endColumn) + longmove(@chromaBuffer[result], @chromaBuffer[result + lines], endColumn) + if rate>0 + waitcnt( cnt+=clkfreq / (1000/rate)) + repeat result from (endRow + 40 - lines) to endRow step 40 + longfill(@chromaBuffer[result], color, endColumn) + if rate >0 + waitcnt( cnt+=clkfreq / (1000/rate)) + drawingStop + +PUB scrollDown(lines, color, startRow, startColumn, endRow, endColumn,rate) '' 24 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Scrolls the contents of whatever is in the specified area down and scrolls in blank space of the selected color. +'' // +'' // Color - A color byte (%RR_GG_BB_xx) to use for the background color being scrolled in. +'' // Lines - Number of rows to scroll down. This function will do nothing if this value is invalid. +'' // StartRow - The row to start scrolling on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // StartColumn - The column to start scrolling on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndRow - The row to end scrolling on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // EndColumn - The column to end scrolling on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + color := computeFillColor(color) + endRow := limitRow(endRow) + endColumn := limitColumn(endColumn) + startRow := computeLimit(startRow, endRow) + startColumn := computeLimit(startColumn, endColumn) + lines := (computeLimit(lines, (endRow - startRow + 1)) * 40) + + if(lines) + drawingStart(startRow, startColumn, endRow, endColumn) + startRow := computeIndex(startRow, startColumn) + endRow := computeIndex(endRow, startColumn) + endColumn -= --startColumn + + if(lines =< (endRow - startRow)) + repeat result from endRow to (startRow + lines) step 40 + wordmove(@lumaBuffer[result], @lumaBuffer[result - lines], endColumn) + longmove(@chromaBuffer[result], @chromaBuffer[result - lines], endColumn) + if rate>0 + waitcnt( cnt+=clkfreq / (1000/rate)) + repeat result from startRow to (startRow - 40 + lines) step 40 + longfill(@chromaBuffer[result], color, endColumn) + if rate>0 + waitcnt( cnt+=clkfreq / (1000/rate)) + drawingStop + +PUB display3DTextBox(characters, textColor, topColor, centerColor, bottomColor, row, column) '' 35 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Displays a 3D text box on screen. +'' // +'' // Characters - A string to display using the internal ROM font. Each character is 1 tile wide and 2 tiles tall. +'' // TextColor - Text color byte (%RR_GG_BB_xx) to use. +'' // TopColor - Top edge and side color byte (%RR_GG_BB_xx) to use. +'' // CenterColor - Center color byte (%RR_GG_BB_xx) to use. +'' // BottomColor - Bottom edge and side color byte (%RR_GG_BB_xx) to use. +'' // Row - Top right corner row of the text box. The box will be 4 rows tall and 2 + string size wide. +'' // Column - Top right corner column of the text box. The box will be 4 rows tall and 2 + string size wide. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + displayString(characters, textColor, centerColor, ++row, ++column) + display3DFrame(topColor, centerColor, bottomColor, --row, --column, (row + 3), (++column + strsize(characters))) + +{PUB display3DpressedTextBox(characters, textColor, topColor, centerColor, bottomColor, row, column) '' 35 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Displays a 3D text box on screen. +'' // +'' // Characters - A string to display using the internal ROM font. Each character is 1 tile wide and 2 tiles tall. +'' // TextColor - Text color byte (%RR_GG_BB_xx) to use. +'' // TopColor - Top edge and side color byte (%RR_GG_BB_xx) to use. +'' // CenterColor - Center color byte (%RR_GG_BB_xx) to use. +'' // BottomColor - Bottom edge and side color byte (%RR_GG_BB_xx) to use. +'' // Row - Top right corner row of the text box. The box will be 4 rows tall and 2 + string size wide. +'' // Column - Top right corner column of the text box. The box will be 4 rows tall and 2 + string size wide. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + displayString(characters, textColor, centerColor, ++row, ++column) + display3DFrame(topColor, centerColor, bottomColor, --row, --column, (row + 3), (++column + strsize(characters))) +} +'PUB display2DTextBox(characters, forgroundColor, backgroundColor, row, column) '' 31 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Displays a 2D text box on screen. +'' // +'' // Characters - A string to display using the internal ROM font. Each character is 1 tile wide and 2 tiles tall. +'' // ForegroundColor - The color to use for the foreground of the text box. +'' // BackgroundColor - The color to use for the background of the text box. +'' // Row - Top right corner row of the text box. The box will be 4 rows tall and 2 + string size wide. +'' // Column - Top right corner column of the text box. The box will be 4 rows tall and 2 + string size wide. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +' displayString(characters, forgroundColor, backgroundColor, ++row, ++column) +' display2DFrame(backgroundColor, --row, --column, (row + 3), (++column + strsize(characters))) + +PUB display3DBox(topColor, centerColor, bottomColor, startRow, startColumn, endRow, endColumn) '' 35 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Displays a 3D box on screen. +'' // +'' // TopColor - Top edge and side color byte (%RR_GG_BB_xx) to use. +'' // CenterColor - Center color byte (%RR_GG_BB_xx) to use. +'' // BottomColor - Bottom edge and side color byte (%RR_GG_BB_xx) to use. +'' // StartRow - The row to start drawing on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // StartColumn - The column to start drawing on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndRow - The row to end drawing on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // EndColumn - The column to end drawing on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + display2DBox(centerColor, startRow, startColumn, endRow, endColumn) + display3DFrame(topColor, centerColor, bottomColor, startRow, startColumn, endRow, endColumn) + +PUB display3DFrame(topColor, centerColor, bottomColor, startRow, startColumn, endRow, endColumn) '' 25 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Displays a 3D frame on screen. +'' // +'' // TopColor - Top edge and side color byte (%RR_GG_BB_xx) to use. +'' // CenterColor - Center color byte (%RR_GG_BB_xx) to use. +'' // BottomColor - Bottom edge and side color byte (%RR_GG_BB_xx) to use. +'' // StartRow - The row to start drawing on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // StartColumn - The column to start drawing on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndRow - The row to end drawing on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // EndColumn - The column to end drawing on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + centerColor := computeTileColor(centerColor, bottomColor, topColor) + endRow := limitRow(endRow) + endColumn := limitColumn(endColumn) + startRow := computeLimit(startRow, endRow) + startColumn := computeLimit(startColumn, endColumn) + drawingStart(startRow, startColumn, endRow, endColumn) + + startRow := computeIndex(startRow, startColumn) + endRow := computeIndex(endRow, startColumn) + endColumn -= startColumn + + longfill(@chromaBuffer[startRow], centerColor, ++endColumn) + wordfill(@lumaBuffer[startRow], $83_00, endColumn) + longfill(@chromaBuffer[endRow], centerColor, endColumn) + wordfill(@lumaBuffer[endRow], $83_40, endColumn--) + + repeat result from startRow to endRow step 40 + lumaBuffer[result] := $82_80 + chromaBuffer[result] := centerColor + lumaBuffer[result + endColumn] := $82_C0 + chromaBuffer[result + endColumn] := centerColor + + lumaBuffer[endRow] := $80_40 + lumaBuffer[endRow + endColumn] := $82_40 + lumaBuffer[startRow] := $80_00 + lumaBuffer[startRow + endColumn] := $82_00 + + drawingStop +pub plot(color,row,column) + color := computeFillColor(color) + longfill(@chromaBuffer[(row*40)+column], color, 1) + +PUB display2DBox(color, startRow, startColumn, endRow, endColumn) '' 23 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Displays a 2D box on screen. +'' // +'' // Color - A color byte (%RR_GG_BB_xx) to use. +'' // StartRow - The row to start drawing on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // StartColumn - The column to start drawing on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndRow - The row to end drawing on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // EndColumn - The column to end drawing on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + color := computeFillColor(color) + endRow := limitRow(endRow) + endColumn := limitColumn(endColumn) + startRow := computeLimit(startRow, endRow) + startColumn := computeLimit(startColumn, endColumn) + drawingStart(startRow, startColumn, endRow, endColumn) + + startRow := computeIndex(startRow, startColumn) + endRow := computeIndex(endRow, startColumn) + endColumn -= --startColumn + + repeat result from startRow to endRow step 40 + longfill(@chromaBuffer[result], color, endColumn) + wordfill(@lumabuffer[result],32,endcolumn) 'Ergänzung um BS-Speicher zu löschen -> für Tileabfragen + drawingStop + +'PUB display2DFrame(color, startRow, startColumn, endRow, endColumn) '' 23 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Displays a 2D frame on screen. +'' // +'' // Color - A color byte (%RR_GG_BB_xx) to use. +'' // StartRow - The row to start drawing on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // StartColumn - The column to start drawing on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndRow - The row to end drawing on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // EndColumn - The column to end drawing on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +' color := computeFillColor(color) +' endRow := limitRow(endRow) +' endColumn := limitColumn(endColumn) +' startRow := computeLimit(startRow, endRow) +' startColumn := computeLimit(startColumn, endColumn) +' drawingStart(startRow, startColumn, endRow, endColumn) + +' startRow := computeIndex(startRow, startColumn) +' endRow := computeIndex(endRow, startColumn) +' endColumn -= startColumn + +' longfill(@chromaBuffer[startRow], color, ++endColumn) +' longfill(@chromaBuffer[endRow], color, endColumn--) +' repeat result from startRow to endRow step 40 +' chromaBuffer[result] := color +' chromaBuffer[result + endColumn] := color + +' drawingStop +Pub Change_Backup(tilenr,f1,f2,f3) + puffer[9]:=tilenr + BufferAddress[9]:=computeTileColor(f1, f2, f3) + +PUB dispBackup(startRow, startColumn,wordBufferAddress)', longBufferAddress) '' 24 Stack Longs +'original displayBackup(startRow, startColumn,endRow, endColumn, wordBufferAddress, longBufferAddress) +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Backups a section of the screen to the provided buffers. +'' // +'' // The word buffer contains the 16 bit addresses of the backedup tiles. +'' // +'' // The word buffer should be ((endRow - startRow + 1) * (endColumn - startColumn + 1)) words in size. +'' // +'' // The long buffer contains the 32 bit colors of the backedup tiles. (4 Colors Per Tile - 1 Bytes Per Color). +'' // +'' // The long buffer should be ((endRow - startRow + 1) * (endColumn - startColumn + 1)) longs in size. +'' // +'' // StartRow - The row to start on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // StartColumn - The column to start on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndRow - The row to end on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // EndColumn - The column to end on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + puffer[wordBufferAddress]:= lumaBuffer[(startrow*40)+(startcolumn)] + BufferAddress[wordBufferAddress]:= chromaBuffer[(startrow*40)+startcolumn] + +pub getblock(nummer) + return lumaBuffer[nummer] + +PUB dispRestore(startRow, startColumn,wordBufferAddress)' '' 24 Stack Longs +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Restores a section of the screen from the provided buffers. +'' // +'' // The word buffer contains the 16 bit addresses of the restored tiles. +'' // +'' // The word buffer should be ((endRow - startRow + 1) * (endColumn - startColumn + 1)) words in size. +'' // +'' // The long buffer contains the 32 bit colors of the restored tiles. (4 Colors Per Tile - 1 Bytes Per Color). +'' // +'' // The long buffer should be ((endRow - startRow + 1) * (endColumn - startColumn + 1)) longs in size. +'' // +'' // StartRow - The row to start on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // StartColumn - The column to start on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndRow - The row to end on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // EndColumn - The column to end on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + lumaBuffer[(startrow*40)+startcolumn]:=puffer[wordBufferAddress] + chromaBuffer[(startrow*40)+startcolumn]:=BufferAddress[wordBufferaddress] + +pub Backup_luma(x,y):wert + wert:=lumaBuffer[(y*40)+x] + +pub backup_chroma(x,y):wert + wert:=chromaBuffer[(y*40)+x] + +pub restore_luma(x,y,wert) + lumaBuffer[(y*40)+x]:=wert +pub restore_chroma(x,y,wert) + chromaBuffer[(y*40)+x]:=wert +PUB displayBackup(startRow, startColumn,endRow, endColumn, wordBufferAddress, longBufferAddress)', longBufferAddress) '' 24 Stack Longs +'original displayBackup(startRow, startColumn,endRow, endColumn, wordBufferAddress, longBufferAddress) +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Backups a section of the screen to the provided buffers. +'' // +'' // The word buffer contains the 16 bit addresses of the backedup tiles. +'' // +'' // The word buffer should be ((endRow - startRow + 1) * (endColumn - startColumn + 1)) words in size. +'' // +'' // The long buffer contains the 32 bit colors of the backedup tiles. (4 Colors Per Tile - 1 Bytes Per Color). +'' // +'' // The long buffer should be ((endRow - startRow + 1) * (endColumn - startColumn + 1)) longs in size. +'' // +'' // StartRow - The row to start on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // StartColumn - The column to start on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndRow - The row to end on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // EndColumn - The column to end on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + endRow := limitRow(endRow) + endColumn := limitColumn(endColumn) + startRow := computeLimit(startRow, endRow) + startColumn := computeLimit(startColumn, endColumn) + drawingStart(startRow, startColumn, endRow, endColumn) + + startRow := computeIndex(startRow, startColumn) + endRow := computeIndex(endRow, startColumn) + endColumn -= --startColumn + + repeat result from startRow to endRow step 40 + wordmove(wordBufferAddress, @lumaBuffer[result], endColumn) + wordBufferAddress += (endColumn << 1) + longmove(longBufferAddress, @chromaBuffer[result], endColumn) + longBufferAddress += (endColumn << 2) + + drawingStop +PUB displayRestore(startRow, startColumn,endRow, endColumn, wordBufferAddress, longBufferAddress)' '' 24 Stack Longs +'original displayRestore(startRow, startColumn,endRow, endColumn, wordBufferAddress, longBufferAddress) +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Restores a section of the screen from the provided buffers. +'' // +'' // The word buffer contains the 16 bit addresses of the restored tiles. +'' // +'' // The word buffer should be ((endRow - startRow + 1) * (endColumn - startColumn + 1)) words in size. +'' // +'' // The long buffer contains the 32 bit colors of the restored tiles. (4 Colors Per Tile - 1 Bytes Per Color). +'' // +'' // The long buffer should be ((endRow - startRow + 1) * (endColumn - startColumn + 1)) longs in size. +'' // +'' // StartRow - The row to start on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // StartColumn - The column to start on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndRow - The row to end on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // EndColumn - The column to end on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + endRow := limitRow(endRow) + endColumn := limitColumn(endColumn) + startRow := computeLimit(startRow, endRow) + startColumn := computeLimit(startColumn, endColumn) + drawingStart(startRow, startColumn, endRow, endColumn) + + startRow := computeIndex(startRow, startColumn) + endRow := computeIndex(endRow, startColumn) + endColumn -= --startColumn + + repeat result from startRow to endRow step 40 + wordmove(@lumaBuffer[result], wordBufferAddress, endColumn) + wordBufferAddress += (endColumn << 1) + longmove(@chromaBuffer[result], longBufferAddress, endColumn) + longBufferAddress += (endColumn << 2) + + drawingStop + +PUB scrollString(characters, characterRate, foregroundColor, backgroundColor, row, startColumn, endColumn) '' 34 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Scrolls a string of characters from right to left across a specified area. Will not display box characters. +'' // +'' // Characters - A string to display using the internal ROM font. Each character is 1 tile wide and 2 tiles tall. +'' // CharacterRate - The number of frames to wait before scrolling out the next character. 0=16.66ms, 1=33.33ms, 2=50ms, etc. +'' // ForegroundColor - The color to use for the foreground of the string. +'' // BackgroundColor - The color to use for the background of the string. +'' // Row - Row to scroll the string on, row 29 is not valid to use. Each row is 16 pixels tall. (0 - 29). +'' // StartColumn - Column to scroll the string to. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndColumn - Column to scroll the string from. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + endColumn := limitColumn(endColumn) + startColumn := computeLimit(startColumn, endColumn) + repeat (strsize(characters) + (endColumn - startColumn) + 1) + + result := " " + if(byte[characters]) + result := byte[characters++] + + displayWait(characterRate) + scrollCharacter(result, foregroundColor, backgroundColor, row, startColumn, endColumn) + +PUB scrollCharacter(character, foregroundColor, backgroundColor, row, startColumn, endColumn) '' 24 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Scrolls a character from right to left across a specified area. Will not display box characters. +'' // +'' // Character - A character to display using the internal ROM font. Each character is 1 tile wide and 2 tiles tall. +'' // ForegroundColor - The color to use for the foreground of the character. +'' // BackgroundColor - The color to use for the background of the character. +'' // Row - Row to scroll the string on, row 29 is not valid to use. Each row is 16 pixels tall. (0 - 29). +'' // StartColumn - Column to scroll the string to. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' // EndColumn - Column to scroll the string from. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + endColumn := limitColumn(endColumn) + startColumn := computeLimit(startColumn, endColumn) + row := computeLimit(row, 28) + + result := computeIndex(row, startColumn) + startColumn := (endColumn - startColumn) + drawingStart(row, startColumn, row + 1, endColumn) + + repeat 2 + wordmove(@lumaBuffer[result], @lumaBuffer[++result], startColumn) + longmove(@chromaBuffer[--result], @chromaBuffer[++result], startColumn) + result += 39 + + drawingStop + displayCharacter(character, foregroundColor, backgroundColor, row, endColumn) + +PUB displayString(characters, foregroundColor, backgroundColor, row, column) '' 21 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Displays a string of characters starting at the specified column on the specified row. Will not display box characters. +'' // +'' // Characters - A string to display using the internal ROM font. Each character is 1 tile wide and 2 tiles tall. +'' // ForegroundColor - The color to use for the foreground of the string. +'' // BackgroundColor - The color to use for the background of the string. +'' // Row - Row to display the string on, row 29 is not valid to use. Each row is 16 pixels tall. (0 - 29). +'' // Column - Column to start displaying the string on. Each column is 16 pixels wide. (0 - 39). +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + column #>= 0 + repeat while(byte[characters] and (column =< 39)) + displayCharacter(byte[characters++], foregroundColor, backgroundColor, row, column++) + +PUB displayCharacter(character, foregroundColor, backgroundColor, row, column) '' 13 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Displays a character at the specified column on the specified row. Will not display box characters. +'' // +'' // Character - A character to display using the internal ROM font. Each character is 1 tile wide and 2 tiles tall. +'' // ForegroundColor - The color to use for the foreground of the character. +'' // BackgroundColor - The color to use for the background of the character. +'' // Row - Row to display the string on, row 29 is not valid to use. Each row is 16 pixels tall. (0 - 29). +'' // Column - Column to start displaying the string on. Each column is 16 pixels wide. (0 - 39). +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + if((character =< 1) or ((8 =< character) and (character =< 13)) or (256 =< character)) + character := " " + + result := (character & 1) + backgroundColor.byte[1 + result] := foregroundColor + backgroundColor.byte[2 - result] := backgroundColor + backgroundColor.byte[3] := foregroundColor + character := (((character >> 1) << 7) + $80_00) '$8000 ist der Ort, wo der Propeller-Font steht + result := computeIndex(computeLimit(row, 28), limitColumn(column)) + + repeat while(lockset(lockNumber - 1)) + + repeat 2 + lumaBuffer[result] := character + chromaBuffer[result] := backgroundColor + result += 40 + character += $40 + + lockclr(lockNumber - 1) + + +PUB displayTile(address, primaryColor, secondaryColor, tertiaryColor, row, column) '' 15 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Displays a standard three colored tile. +'' // +'' // A tile should be formated in this way, example below: +'' // +'' // address long %%1111111111111112 +'' // long %%1111111111111122 +'' // long %%1111111111111232 +'' // long %%1111111111112332 +'' // long %%1111111111123332 +'' // long %%1111111111233332 +'' // long %%1111111112333332 +'' // long %%1111111123333332 +'' // long %%1111111233333332 +'' // long %%1111112333333332 +'' // long %%1111123333333332 +'' // long %%1111222222223332 +'' // long %%1111111111112332 +'' // long %%1111111111111232 +'' // long %%1111111111111122 +'' // long %%1111111111111112 +'' // +'' // The tile image should be reversed to display properly. +'' // +'' // The address of the first long is the address of the mouse tile. +'' // +'' // Each tile has has 16 longs and each long has 16 pixels. Each pixel has a value of 1 - 3 using quaternary encoding. +'' // +'' // A pixel of 0 maps to nothing and a pixel of 1, 2, or 3 maps to the color byte (%RR_GG_BB_xx). +'' // +'' // Address - The address of the tile to display. +'' // PrimaryColor - The color mapping to pixels that have a value of 1 in quaternary. +'' // SecondaryColor - The color mapping to pixels that have a value of 2 in quaternary. +'' // TertiaryColor - The color mapping to pixels that have a value of 3 in quaternary. +'' // Row - The row to display the tile on. Each row is 16 pixels tall so there are 30 rows numbered 0 - 29. +'' // Column - The column to display the tile on. Each column is 16 pixels wide so there are 40 columns numbered 0 - 39. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + result := computeIndex(limitRow(row), limitColumn(column)) + repeat while(lockset(lockNumber - 1)) + lumaBuffer[result] := address + chromaBuffer[result] := computeTileColor(primaryColor, secondaryColor, tertiaryColor) + lockclr(lockNumber - 1) + +PUB displayCursor '' 3 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Returns the address of the standard mouse cursor tile. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + return @mousePointer + +PUB mouseCursorTile(address) '' 4 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Changes the mouse cursor tile. +'' // +'' // A mouse cusor tile should be formated in this way, example below: +'' // +'' // address long %%0000000000000003 +'' // long %%0000000000000033 +'' // long %%0000000000000333 +'' // long %%0000000000003333 +'' // long %%0000000000033333 +'' // long %%0000000000333333 +'' // long %%0000000003333333 +'' // long %%0000000033333333 +'' // long %%0000000333333333 +'' // long %%0000003333333333 +'' // long %%0000033333333333 +'' // long %%0000333333333333 +'' // long %%0000000000003333 +'' // long %%0000000000000333 +'' // long %%0000000000000033 +'' // long %%0000000000000003 +'' // +'' // The tile image should be reversed to display properly. +'' // +'' // The address of the first long is the address of the mouse tile. +'' // +'' // Each tile has has 16 longs and each long has 16 pixels. Each pixel has a value of 0 - 3 using quaternary encoding. +'' // +'' // A pixel of 0 maps to nothing and a pixel of 1, 2, or 3 maps to the color byte (%RR_GG_BB_xx). +'' // +'' // Address - The address of the tile to display, null to disable. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + mouseLuma := address + if address>0 + longmove(@mousepointer,address,16) 'neuen Mauszeiger verwenden +PUB mouseCursorColor(color) '' 4 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Changes the mouse cursor color. +'' // +'' // Color - A color byte (%RR_GG_BB_xx) describing the mouse cursor color. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + mouseChroma := color + +PUB mouseRowBounds(startRow, endRow) '' 8 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Returns true if the mouse is on or between the two provided rows and false if not. +'' // +'' // StartRow - The row to check to see if the mouse is on or after. +'' // EndRow - The row to check to see if the mouse is on or before. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + result := mouseTileRow + return ((startRow =< result) and (result =< endRow)) + +PUB mouseColumnBounds(startColumn, endColumn) '' 8 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Returns true if the mouse is on or between the two provided columns and false if not. +'' // +'' // StartColumn - The column to check to see if the mouse is on or after. +'' // EndColumn - The column to check to see if the mouse is on or before. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + result := mouseTileColumn + return ((startColumn =< result) and (result =< endColumn)) + +PUB mouseTileRow '' 3 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Return the current row the mouse is on. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + return (word[mouseYAddress] >> 4) + +PUB mouseTileRowOffset '' 3 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Return pixel offset from the current row the mouse is on. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + return (word[mouseYAddress] & $F) + +PUB mouseTileColumn '' 3 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Return the current column the mouse is on. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + return (word[mouseXAddress] >> 4) + +PUB mouseTileColumnOffset '' 3 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Return pixel offset from the current column the mouse is on. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + return (word[mouseXAddress] & $F) + +PUB displayState(state) '' 4 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Enables or disables the TMP Driver's video output - turning the monitor off or putting it into standby mode. +'' // +'' // State - True for active and false for inactive. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + displayIndicator := state + +'PUB displayRate(rate) '' 8 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Returns true or false depending on the time elasped according to a specified rate. +'' // +'' // Rate - A display rate to return at. 0=0.234375Hz, 1=0.46875Hz, 2=0.9375Hz, 3=1.875Hz, 4=3.75Hz, 5=7.5Hz, 6=15Hz, 7=30Hz. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +' result or= (($80 >> computeLimit(rate, 7)) & syncIndicator) + +PUB displayWait(frames) '' 4 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Waits for the display vertical refresh. +'' // +'' // Frames - Number of vertical refresh frames to wait for. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + repeat (frames #> 0) + result := syncIndicator + repeat until(result <> syncIndicator) + +'PUB displayColor(redAmount, greenAmount, blueAmount) '' 6 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Builds a color byte (%RR_GG_BB_xx) from red, green, and blue componets. +'' // +'' // RedAmount - The amount of red to add to the color byte. Between 0 and 3. +'' // GreenAmount - The amount of green to add to the color byte. Between 0 and 3. +'' // BlueAmount - The amount of blue to add to the color byte. Between 0 and 3. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +' return ( (computeLimit(redAmount, 3) << 6) | (computeLimit(greenAmount, 3) << 4) | (computeLimit(blueAmount, 3) << 2) | $3) + +PUB TMPEngineStart(pinGroup, axisXAddress, axisYAddress) '' 9 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Starts up the TMP driver running on a cog and checks out a lock for the driver. +'' // +'' // Returns true on success and false on failure. +'' // +'' // PinGroup - Pin group to use to drive the video circuit. Between 0 and 3. +'' // AxisXAddress - Address of the mouse x axis position variable. Must be a word address and not zero. +'' // AxisYAddress - Address of the mouse y axis position variable. Must be a word address and not zero. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + TMPEngineStop + + pinGroup := ((pinGroup <# 3) #> 0) + directionState := ($FF << (8 * pinGroup)) + videoState := ($30_00_00_FF | (pinGroup << 9)) + pinGroup := constant((25_175_000 + 1_600) / 4) + frequencyState := 1 + + repeat 32 + pinGroup <<= 1 + frequencyState <-= 1 + if(pinGroup => clkfreq) + pinGroup -= clkfreq + frequencyState += 1 + + mouseXAddress := axisXAddress + mouseYAddress := axisYAddress + chromaBufferAddress := @chromaBuffer + lumaBufferAddress := @lumaBuffer + printColorAddress := @printColor + printPositionAddress := @printPosition + printRateAddress := @printRate + mouseChromaAddress := @mouseChroma + mouseLumaAddress := @mouseLuma + displayIndicatorAddress := @displayIndicator + syncIndicatorAddress := @syncIndicator + + lockNumber := locknew + cogNumber := cognew(@initialization, @mouseCache) + if((++lockNumber) and (++cogNumber) and (chipver == 1) and axisXAddress and axisYAddress) + return true + + TMPEngineStop + +PUB TMPEngineStop '' 3 Stack Longs + +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +'' // Shuts down the TMP driver running on a cog and returns the lock used by the driver. +'' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + if(cogNumber) + cogstop(-1 + cogNumber~) + + if(lockNumber) + lockret(-1 + lockNumber~) + +PRI limitRow(row) ' 4 Stack Longs + + return ((row <# 29) #> 0) + +PRI limitColumn(column) ' 4 Stack Longs + + return ((column <# 39) #> 0) + +PRI computeFillColor(color) ' 4 Stack Longs + + repeat 3 + color.byte[++result] := color + + return color + +Pub computeTileColor(primaryColor, secondaryColor, tertiaryColor) ' 6 Stack Longs + + primaryColor.byte[1] := primaryColor + primaryColor.byte[2] := secondaryColor + primaryColor.byte[3] := tertiaryColor + return primaryColor + +PRI computeLimit(value, limit) ' 5 Stack Longs + + return ((value <# limit) #> 0) + +PRI computeIndex(row, column) ' 5 Stack Longs + + return ((row * 40) + column) + +PRI drawingStart(startRow, startColumn, endRow, endColumn) ' 15 Stack Longs + + repeat while(lockset(lockNumber - 1)) + + if(mouseRowBounds((startRow - 2), endRow) and mouseColumnBounds((startColumn - 2), endColumn)) + mouseLumaBackup := mouseLuma~ + + displayWait(1) + +PRI drawingStop ' 3 Stack Longs + + if(mouseLumaBackup) + mouseLuma := mouseLumaBackup~ + + lockclr(lockNumber - 1) + +DAT + +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +' TMP Driver +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + org + +' //////////////////////Initialization///////////////////////////////////////////////////////////////////////////////////////// +'chromaBuffer +initialization mov vcfg, videoState ' Setup video hardware. + mov frqa, frequencyState ' + movi ctra, #%0_00001_101 ' + + mov mouseAddCaches, par ' Setup mouse buffer. + mov mouseAddCaches + 1, par ' + mov mouseAddCaches + 2, par ' + mov mouseAddCaches + 3, par ' + add mouseAddCaches + 1, #128 ' + add mouseAddCaches + 2, #64 ' + add mouseAddCaches + 3, #192 ' + +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +' Active Video +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +loop mov tilesCounter, #30 ' Set/Reset tiles fill counter. + +tilesDisplay mov tileCounter, #16 ' Set/Reset tile fill counter. + mov activeCounter, #0 ' + + test tilesCounter, #1 wc ' Set/Reset invisible video. +if_c movd lumaCacheUpdate, #lumaCache ' +if_c movd chromaCacheUpdate, #chromaCache ' +if_nc movd lumaCacheUpdate, #lumaCache + 40 ' +if_nc movd chromaCacheUpdate, #chromaCache + 40 ' + +tileDisplay mov vscl, visibleScale ' Set/Reset the video scale. + mov counter, #40 ' + + test tilesCounter, #1 wc ' Set/Reset visible video. +if_nc movs lumaUpdate, #lumaCache ' +if_nc movd chromaUpdate, #chromaCache ' +if_c movs lumaUpdate, #lumaCache + 40 ' +if_c movd chromaUpdate, #chromaCache + 40 ' + +' //////////////////////Visible Video////////////////////////////////////////////////////////////////////////////////////////// + +lumaUpdate mov buffer, 0 ' Update display pixles. + add lumaUpdate, #1 ' + + add buffer, activeCounter ' Add in offset and get pixels. + rdlong buffer, buffer ' + +chromaUpdate waitvid 0, buffer ' Update display colors. + add chromaUpdate, destinationIncrement ' + + djnz counter, #lumaUpdate ' Repeat. + +' //////////////////////Invisible Video//////////////////////////////////////////////////////////////////////////////////////// + + mov vscl, invisibleScale ' Set/Reset the video scale. + add activeCounter, #4 ' + + waitvid HSyncColors, syncPixels ' Horizontal sync. + + mov inactiveCounter, #3 ' Update the cache. + cmp tileCounter, #3 wc, wz ' +if_z mov inactiveCounter, #1 ' +if_nc call #cacheUpdate ' + +' //////////////////////Repeat///////////////////////////////////////////////////////////////////////////////////////////////// + + djnz tileCounter, #tileDisplay ' Repeat. + djnz tilesCounter, #tilesDisplay ' + +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +' Inactive Video +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + mov mousePC, #displayMouse ' Setup display and mouse PC. + +' //////////////////////Update Cursor////////////////////////////////////////////////////////////////////////////////////////// + + rdword printTopPlace, printPositionAddress ' Update print cursor places. + mov printBottomPlace, printTopPlace ' + add printBottomPlace, #160 ' + + rdlong printColorControl, printColorAddress ' Update print cursor settings. + rdbyte printRateControl, printRateAddress ' + + add refreshCounter, #1 ' Update sync indicator. + wrbyte refreshCounter, syncIndicatorAddress ' + +' //////////////////////Set/Reset Cache Pointers/////////////////////////////////////////////////////////////////////////////// + + mov displayCounter, #4 ' Reset loader. + movs loadCheck, #mouseAddresses ' + movs loadPixels, #mouseAddCaches ' + movs loadColors, #mouseAddColors ' + + movd lumaCacheUpdate, #lumaCache ' Setup to update the cache. + movd chromaCacheUpdate, #chromaCache ' + mov lumaPointer, lumaBufferAddress ' + mov chromaPointer, chromaBufferAddress ' + +' //////////////////////Front Porch//////////////////////////////////////////////////////////////////////////////////////////// + + mov counter, #11 ' Set loop counter. + +frontPorch mov vscl, blankPixels ' Invisible lines. + waitvid HSyncColors, #0 ' + + jmpret displayPC, mousePC ' Do mouse stuff. + + mov vscl, invisibleScale ' Horizontal sync. + waitvid HSyncColors, syncPixels ' + + jmpret displayPC, mousePC ' Do mouse stuff. + + djnz counter, #frontPorch ' Repeat # times. + +' //////////////////////Vertical Sync////////////////////////////////////////////////////////////////////////////////////////// + + mov counter, #(2 + 2) ' Set loop counter. + +verticalSync mov vscl, blankPixels ' Invisible lines. + waitvid VSyncColors, #0 ' + + mov inactiveCounter, #(17 - 9) ' Update the cache. + call #cacheUpdate ' + + mov vscl, invisibleScale ' Vertical sync. + waitvid VSyncColors, syncPixels ' + + mov inactiveCounter, #(3 - 1) ' Update the cache. + call #cacheUpdate ' + + djnz counter, #verticalSync ' Repeat # times. + +' //////////////////////Back Porch///////////////////////////////////////////////////////////////////////////////////////////// + + mov counter, #31 ' Set loop counter. + +backPorch mov vscl, blankPixels ' Invisible lines. + waitvid HSyncColors, #0 ' + + jmpret displayPC, mousePC ' Do mouse stuff. + + mov vscl, invisibleScale ' Horizontal sync. + waitvid HSyncColors, syncPixels ' + + jmpret displayPC, mousePC ' Do mouse stuff. + + djnz counter, #backPorch ' Repeat # times. + +' //////////////////////Update Display Settings//////////////////////////////////////////////////////////////////////////////// + + rdbyte buffer, displayIndicatorAddress wz ' Update display settings. + muxnz dira, directionState ' + +' //////////////////////Loop/////////////////////////////////////////////////////////////////////////////////////////////////// + + jmp #loop ' Loop. + +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +' Cache Update +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +cacheUpdate rdword lumaCacheBuffer, lumaPointer ' Update luma cache. + +loadCheck cmpsub lumaPointer, 0 wz, wc, nr ' Load up mouse overlays on hit or miss. +if_c cmpsub displayCounter, #1 wc ' +loadPixels if_z_and_c mov lumaCacheBuffer, 0 ' +loadColors if_z_and_c mov chromaCacheBuffer, 0 ' +if_c add loadCheck, #1 ' +if_c add loadPixels, #1 ' +if_c add loadColors, #1 ' + +lumaCacheUpdate mov 0, lumaCacheBuffer ' Update luma pointers. + add lumaCacheUpdate, destinationIncrement ' + add lumaPointer, #2 ' + +if_nz rdlong chromaCacheBuffer, chromaPointer ' Update chroma cache. + + cmp chromaPointer, printTopPlace wz ' Check cursor places. +if_nz cmp chromaPointer, printBottomPlace wz ' +if_z test refreshCounter, printRateControl wc ' +if_z_and_c mov chromaCacheBuffer, printColorControl ' + + or chromaCacheBuffer, HVSyncColors ' Update chroma pointers. +chromaCacheUpdate mov 0, chromaCacheBuffer ' + add chromaCacheUpdate, destinationIncrement ' + add chromaPointer, #4 ' + + djnz inactiveCounter, #cacheUpdate ' Repeat. + +cacheUpdate_ret ret ' Return. + +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +' Display Mouse +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +displayMouse rdword mouseRowOffset, mouseYAddress ' Compute mouse Y pixel. + max mouseRowOffset, #479 ' + + rdword mouseColumnOffset, mouseXAddress ' Compute mouse X pixel. + max mouseColumnOffset, sixHundredAndThirtyNine ' + + mov mouseBuffer, mouseRowOffset ' Compute mouse row. + shr mouseBuffer, #4 ' + + mov mouseCounter, mouseColumnOffset ' Compute mouse column. + shr mouseCounter, #4 ' + + and mouseRowOffset, #$F ' Compute pixel offsets. + and mouseColumnOffset, #$F ' + + rdbyte mouseColors, mouseChromaAddress ' Get mouse color. + + mov mouseAddresses, #0 ' Clear triggers. + mov mouseAddresses + 1, #0 ' + mov mouseAddresses + 2, #0 ' + mov mouseAddresses + 3, #0 ' + + rdword mousePixels, mouseLumaAddress wz ' Get mouse pixel. +if_z jmp #displayMouseRet ' + + mov mouseAddresses, mouseBuffer ' Compute left upper mouse address in luma. + mov buffer, mouseBuffer ' + shl mouseAddresses, #5 ' + shl buffer, #3 ' + add mouseAddresses, mouseCounter ' + add mouseAddresses, buffer ' + shl mouseAddresses, #1 ' + add mouseAddresses, lumaBufferAddress ' + + cmp mouseCounter, #39 wc ' Compute right upper mouse address in luma. +if_c mov mouseAddresses + 1, mouseAddresses ' +if_c add mouseAddresses + 1, #2 ' + + cmp mouseBuffer, #29 wc ' Compute left lower mouse address in luma. +if_c mov mouseAddresses + 2, mouseAddresses ' +if_c add mouseAddresses + 2, #80 ' + +if_c cmp mouseCounter, #39 wc ' Compute right lower mouse address in luma. +if_c mov mouseAddresses + 3, mouseAddresses ' +if_c add mouseAddresses + 3, #82 ' + +' //////////////////////Cache Pixel Pointers and Colors//////////////////////////////////////////////////////////////////////// + + movs storeBackup, #mouseAddresses ' Reset. + movd storeColors, #mouseAddColors ' + movd storePixels, #mouseAddPixels ' + movs storePixels, #mouseAddresses ' + + mov mouseCounter, #4 ' Setup counter. + +storeBackup mov buffer, 0 wz ' Cache colors and pixels. +if_nz sub buffer, lumaBufferAddress ' +if_nz shl buffer, #1 ' +if_nz add buffer, chromaBufferAddress ' +storeColors if_nz rdlong 0, buffer ' +storePixels if_nz rdword 0, 0 ' + + add storeBackup, #1 ' Point to next. + add storeColors, destinationIncrement ' + add storePixels, destinationIncrement ' + add storePixels, #1 ' + + djnz mouseCounter, #storeBackup ' Repeat. + +' //////////////////////Draw Background//////////////////////////////////////////////////////////////////////////////////////// + + mov mouseBuffer, mouseAddColors ' Draw left upper pixels and colors. + mov mousePixelsGet, mouseAddPixels ' + mov mousePixelsPut, mouseAddCaches ' + movd drawBackgroundLoad, #mouseAddColors ' + call #drawBackground ' + + mov mouseBuffer, mouseAddColors + 1 ' Draw right upper pixels and colors. + mov mousePixelsGet, mouseAddPixels + 1 ' + mov mousePixelsPut, mouseAddCaches + 1 ' + movd drawBackgroundLoad, #mouseAddColors + 1 ' + call #drawBackground ' + + mov mouseBuffer, mouseAddColors + 2 ' Draw left lower pixels and colors. + mov mousePixelsGet, mouseAddPixels + 2 ' + mov mousePixelsPut, mouseAddCaches + 2 ' + movd drawBackgroundLoad, #mouseAddColors + 2 ' + call #drawBackground ' + + mov mouseBuffer, mouseAddColors + 3 ' Draw right lower pixels and colors. + mov mousePixelsGet, mouseAddPixels + 3 ' + mov mousePixelsPut, mouseAddCaches + 3 ' + movd drawBackgroundLoad, #mouseAddColors + 3 ' + call #drawBackground ' + +' //////////////////////Draw Foreground//////////////////////////////////////////////////////////////////////////////////////// + + mov mouseCounter, #16 ' Setup counter. + + mov mouseLeftPointer, mouseAddCaches ' Setup loading addresses. + mov mouseRightPointer, mouseAddCaches + 1 ' + + shl mouseRowOffset, #2 ' Setup loading offsets. + add mouseLeftPointer, mouseRowOffset ' + add mouseRightPointer, mouseRowOffset ' + +drawForegroundLoop rdlong mouseLeftPixels, mousePixels ' Get mouse pixels. + add mousePixels, #4 ' + + mov buffer, mouseLeftPixels ' Promote %01 to %11. + or buffer, pixelAMask ' + and buffer, pixelNAMask ' + shl buffer, #1 ' + or mouseLeftPixels, buffer ' + + mov buffer, mouseLeftPixels ' Promote %10 to %11. + or buffer, pixelNAMask ' + and buffer, pixelAMask ' + shr buffer, #1 ' + or mouseLeftPixels, buffer ' + + mov mouseBuffer, mouseColumnOffset ' Compute column pixel offset. + shl mouseBuffer, #1 ' + + neg buffer, #1 ' Compute column pixel mask. + shr buffer, mouseBuffer ' + + mov mouseRightPixels, mouseLeftPixels ' Backup shift pixels. + andn mouseRightPixels, buffer ' + + shl mouseLeftPixels, mouseBuffer ' Build left pixels and right pixels. + rol mouseRightPixels, mouseBuffer ' + + rdlong buffer, mouseLeftPointer ' Load left pixels. + andn buffer, mouseLeftPixels ' + wrlong buffer, mouseLeftPointer ' + add mouseLeftPointer, #4 ' + + rdlong buffer, mouseRightPointer ' Load right pixels. + andn buffer, mouseRightPixels ' + wrlong buffer, mouseRightPointer ' + add mouseRightPointer, #4 ' + + jmpret mousePC, displayPC ' + + djnz mouseCounter, #drawForegroundLoop ' Repeat. + +' //////////////////////Return///////////////////////////////////////////////////////////////////////////////////////////////// + +displayMouseRet jmpret mousePC, displayPC ' Setup to return to display PC. + jmp displayPC ' + +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +' Draw Background +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +drawBackground mov buffer, mouseBuffer ' Check if color is... ABABCDCD - lower part. + mov mouseCounter, mouseBuffer ' + and mouseCounter, #$FF ' + shr buffer, #8 ' + and buffer, #$FF ' + cmp buffer, mouseCounter wz ' + +if_z mov buffer, mouseBuffer ' Check if color is... ABABCDCD - upper part. +if_z mov mouseCounter, mouseBuffer ' +if_z shr mouseCounter, #24 ' +if_z shr buffer, #16 ' +if_z and buffer, #$FF ' +if_z cmp buffer, mouseCounter wz ' + + muxz drawBackgroundPixels, #1 ' Change pixel affector. + +if_z shl mouseBuffer, #8 ' Edit color. + + mov buffer, mouseBuffer ' Check if color is of the form ABCDABCD. + mov mouseCounter, mouseBuffer ' + shl buffer, #16 ' + shr buffer, #16 ' + shr mouseCounter, #16 ' + cmp mouseCounter, buffer wz ' + + muxz drawBackgroundPixels, #2 ' Change pixel affector. + + andn mouseBuffer, #$FF ' Edit color. + or mouseBuffer, mouseColors ' +drawBackgroundLoad mov 0, mouseBuffer ' + + mov mouseCounter, #16 ' Setup counter. + +drawBackgroundLoop rdlong mouseBuffer, mousePixelsGet ' Get source pixels. + add mousePixelsGet, #4 ' + + test drawBackgroundPixels, #1 wc ' Change pixels for interleaved characters. +if_c shr mouseBuffer, #1 ' +drawBackgroundPixels test drawBackgroundPixels, #3 wz ' +if_nz or mouseBuffer, pixelAMask ' + +if_z mov buffer, mouseBuffer ' Promote pixels %00 to %01. +if_z xor buffer, pixelXORMask ' +if_z and buffer, pixelAMask ' +if_z shr buffer, #1 ' +if_z or mouseBuffer, buffer ' + + wrlong mouseBuffer, mousePixelsPut ' Put modified source pixels. + add mousePixelsPut, #4 ' + + test mouseCounter, #$3 wz ' Do display stuff every 4 cycles. +if_z jmpret mousePC, displayPC ' + + djnz mouseCounter, #drawBackgroundLoop ' Repeat. + +drawBackground_ret ret ' Return. + +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +' Data +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +destinationIncrement long $2_00 ' Destination incrementor. +sixHundredAndThirtyNine long 639 ' Six hundred and thirty nine. + +visibleScale long (1 << 12) + 16 ' Visible pixel scale for scan line. +invisibleScale long (16 << 12) + 160 ' Invisible pixel scale for horizontal sync. + +blankPixels long 640 ' Blank scanline pixel length. +syncPixels long $00_00_3F_FC ' FP, HS, & BP Pixels. +HSyncColors long $01_01_03_03 ' Horizontal sync color mask. +VSyncColors long $00_00_02_02 ' Vertical sync color mask. +HVSyncColors long $03_03_03_03 ' Horizontal and vertical sync colors. +pixelAMask long $AA_AA_AA_AA ' To select every 2nd pixel. +pixelNAMask long $55_55_55_55 ' To modify every 2nd pixel. +pixelXORMask long $FF_FF_FF_FF ' To invert every 2nd pixel. + +' //////////////////////Configuration Settings///////////////////////////////////////////////////////////////////////////////// + +directionState long 0 ' Direction state configuration. +videoState long 0 ' Video state configuration. +frequencyState long 0 ' Frequency state configuration. + +' //////////////////////Addresses////////////////////////////////////////////////////////////////////////////////////////////// + +mouseXAddress long 0 +mouseYAddress long 0 +chromaBufferAddress long 0 +lumaBufferAddress long 0 +printColorAddress long 0 +printPositionAddress long 0 +printRateAddress long 0 +mouseChromaAddress long 0 +mouseLumaAddress long 0 +displayIndicatorAddress long 0 +syncIndicatorAddress long 0 + +' //////////////////////Cache Variables//////////////////////////////////////////////////////////////////////////////////////// + +mouseAddCaches res 4 +mouseAddresses res 4 +mouseAddPixels res 4 +mouseAddColors res 4 + +' //////////////////////Run Time Variables///////////////////////////////////////////////////////////////////////////////////// + +counter res 1 +buffer res 1 +displayPC res 1 +mousePC res 1 +refreshCounter res 1 +displayCounter res 1 + +' //////////////////////Display Variables////////////////////////////////////////////////////////////////////////////////////// + +tileCounter res 1 +tilesCounter res 1 + +activeCounter res 1 +inactiveCounter res 1 + +lumaPointer res 1 +chromaPointer res 1 + +lumaCacheBuffer res 1 +chromaCacheBuffer res 1 + +lumaCache res 80 +chromaCache res 80 + +' //////////////////////Print Variables//////////////////////////////////////////////////////////////////////////////////////// + +printTopPlace res 1 +printBottomPlace res 1 + +printRateControl res 1 +printColorControl res 1 + +' //////////////////////Mouse Variables//////////////////////////////////////////////////////////////////////////////////////// + +mouseRowOffset res 1 +mouseColumnOffset res 1 + +mousePixels res 1 +mouseColors res 1 + +mouseBuffer res 1 +mouseCounter res 1 + +mousePixelsGet res 1 +mousePixelsPut res 1 + +mouseLeftPointer res 1 +mouseRightPointer res 1 + +mouseLeftPixels res 1 +mouseRightPixels res 1 + +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + fit 496 + +DAT + +' //////////////////////Variable Array///////////////////////////////////////////////////////////////////////////////////////// + +mouseCache long 0[64] ' Mouse overlay display buffer. +'chromaBuffer_tail long 0[1_200-(@chromaBuffer_tail-@chromaBuffer)/4] 'Trick von Kuroneko um Speicher zu sparen +chromaBuffer long 0[1_200] ' Display chroma buffer. +lumaBuffer word 0[1_200] ' Display luma buffer. +printColor long 0 ' Print cursor color control. +printPosition word 0 ' Print cursor position control. +printRate byte 0 ' Print curor rate control. +mouseChroma byte 0 ' Mouse color control. +mouseLuma word 0 ' Mouse pixel control. +mouseLumaBackup word 0 ' Mouse pixel control backup. +displayIndicator byte 1 ' Video output control. +syncIndicator byte 0 ' Video update control. +cogNumber byte 0 ' Cog ID. +lockNumber byte 0 ' Lock ID. + +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +DAT + +' //////////////////////Mouse Pointer////////////////////////////////////////////////////////////////////////////////////////// + +mousePointer long %%0000000000000001 + long %%0000000000000011 + long %%0000000000000121 + long %%0000000000001221 + long %%0000000000012321 + long %%0000000000123321 + long %%0000000001233321 + long %%0000000012333321 + long %%0000000123333321 + long %%0000001233333321 + long %%0000012222222221 + long %%0000111111221221 + long %%0000000001221221 + long %%0000000012210121 + long %%0000000012100011 + long %%0000000111100001 + +' ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +{{ + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// 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. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +}} diff --git a/source/Venatrix-Bus.spin b/source/Venatrix-Bus.spin new file mode 100644 index 0000000..edde4b2 --- /dev/null +++ b/source/Venatrix-Bus.spin @@ -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 diff --git a/source/Venatrix-Test.spin b/source/Venatrix-Test.spin new file mode 100644 index 0000000..2c279bd --- /dev/null +++ b/source/Venatrix-Test.spin @@ -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=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 + diff --git a/source/Venatrix.spin b/source/Venatrix.spin new file mode 100644 index 0000000..f8c2387 --- /dev/null +++ b/source/Venatrix.spin @@ -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][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][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 +} diff --git a/source/YMODEM-Dll.spin b/source/YMODEM-Dll.spin new file mode 100644 index 0000000..8300046 --- /dev/null +++ b/source/YMODEM-Dll.spin @@ -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[2]) and (x=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) + diff --git a/source/bel-keyb.spin b/source/bel-keyb.spin new file mode 100644 index 0000000..88b27b2 --- /dev/null +++ b/source/bel-keyb.spin @@ -0,0 +1,1163 @@ +''*************************************** +''* PS/2 Keyboard Driver v1.0.1 * +''* Author: Chip Gracey * +''* Copyright (c) 2004 Parallax, Inc. * +''* See end of file for terms of use. * +''*************************************** + +{-----------------REVISION HISTORY--------------------------------- + v1.0.1 - Updated 6/15/2006 to work with Propeller Tool 0.96 + ------------------------------------------------------------------} + +{-----------------KEYBOARD LAYOUT HISTORY-------------------------- + 2009-08-31 (Y-M-D) + Patch for german keyboard layout + Author: oog + Added german keyboard layout. + Original layout is commented as keyboard-us-en (US-English). + German layout is commented as keyboard-de (de = deutsch = "german"). + + Now there are two tables for keys with and without SHIFT-Key. + It should be easier to implement different international layouts. + However, it's bigger now and uses more memory. + + 2009-09-05 (Y-M-D) + Fixed bugs + - code bug on home-key fixed + new replace-codes for de_ae, de_ou and de_ue + + New + - Documentation of control-key bits + This should be helpful for translatíons of this driver into + different languages. + - table_alt_r + This table contains characters for the german "AltGr" key. + - AltGr+F1..F12 + Returns line-characters, selected from $90..$9f + + 2009-09-06 (Y-M-D) + Fixed bugs + - patch table_shift for "?" + + Differences to Parallax driver: + - Different codes for NumLock, CapsLock and ScrLock to avoid + conflict with german "ß" + Codes are defined as constants and easy to change + - Easy Cursor codes implemented to avoit conflict with the "Ä"-key + Easy Cursor codes are easy to understand, + for example "Cursor Left" is the character "←" + + ------------------------------------------------------------------} + +con + de_ae = $A6 'replace code - not used on keyboard + de_oe = $A7 'replace code - not used on keyboard + de_ue = $A8 'replace code - not used on keyboard + lock = $BC 'Parallax used codes $DD, $DE and $DF + 'There was a conflict between $DF=NumLock="ß" + ScrLk = lock + CpsLk = lock+1 + NumLk = lock+2 + +' +'Uncomment one of the next constant blocks +' +' + +{{Parallax cursor codes start}} +{{ + CrsLt = $C0E4 + CrsRt = $C1E6 + CrsUp = $C2E8 + CrsDn = $C3E2 + CrsHm = $C4E7 'Conflict with key "Ä" ($C4) + CrsEn = $C5E1 + PgUp = $C6E9 + PgDn = $C7E3 + Bksp = $00C8 + Del = $C9EA + Ins = $CAE0 + Esc = $00CB + Apps = $CC00 + Power = $CD00 + Sleep = $CE00 + WkUp = $CF00 +}} +{{Parallax cursor codes end}} + + +{{Easy cursor codes start}} + + CrsLt = $02E4 '← + CrsRt = $03E6 '→ + CrsUp = $04E8 '↑ + CrsDn = $05E2 '↓ + CrsHm = $06E7 '◀ + CrsEn = $07E1 '▶ + PgUp = $A0E9 ' + PgDn = $A2E3 ' + Bksp = $00C8 'È + Del = $BAEA ' + Ins = $BBE0 ' + Esc = $001B ' + Apps = $CC00 'Ì + Power = $CD00 'Í + Sleep = $CE00 'Î + WkUp = $CF00 'Ï + +{{Easy cursor codes end}} + +VAR + + long cog + + long par_tail 'key buffer tail read/write (19 contiguous longs) + long par_head 'key buffer head read-only + long par_present 'keyboard present read-only + long par_states[8] 'key states (256 bits) read-only + long par_keys[8] 'key buffer (16 words) read-only (also used to pass initial parameters) + byte taste +PUB start(dpin, cpin) : okay + +'' Start keyboard 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 +'' +'' all lock-keys will be enabled, NumLock will be initially 'on', +'' and auto-repeat will be set to 15cps with a delay of .5s + + okay := startx(dpin, cpin, %0_000_000, %01_01000) + + +PUB startx(dpin, cpin, locks, auto) : okay + +'' Like start, but allows you to specify lock settings and auto-repeat +'' +'' locks = lock setup +'' bit 6 disallows shift-alphas (case set soley by CapsLock) +'' bits 5..3 disallow toggle of NumLock/CapsLock/ScrollLock state +'' bits 2..0 specify initial state of NumLock/CapsLock/ScrollLock +'' (eg. %0_001_100 = disallow ScrollLock, NumLock initially 'on') +'' +'' auto = auto-repeat setup +'' bits 6..5 specify delay (0=.25s, 1=.5s, 2=.75s, 3=1s) +'' bits 4..0 specify repeat rate (0=30cps..31=2cps) +'' (eg %01_00000 = .5s delay, 30cps repeat) + + stop + longmove(@par_keys, @dpin, 4) + okay := cog := cognew(@entry, @par_tail) + 1 + + +PUB stop + +'' Stop keyboard driver - frees a cog + + if cog + cogstop(cog~ - 1) + longfill(@par_tail, 0, 19) + + +PUB present : truefalse + +'' Check if keyboard present - valid ~2s after start +'' returns t|f + + truefalse := -par_present + + +PUB key : keycode + +'' Get key (never waits) +'' returns key (0 if buffer empty) + + if par_tail <> par_head + keycode := par_keys.word[par_tail] + par_tail := ++par_tail & $F + taste:=keycode + +PUB getkey : keycode + +'' Get next key (may wait for keypress) +'' returns key + + repeat until (keycode := key) + +pub taster:b + b:=Taste + taste:=0 + +PUB newkey : keycode + +'' Clear buffer and get new key (always waits for keypress) +'' returns key + + par_tail := par_head + keycode := getkey + + +PUB gotkey : truefalse + +'' Check if any key in buffer +'' returns t|f + + truefalse := par_tail <> par_head + + +PUB clearkeys + +'' Clear key buffer + + par_tail := par_head + Taste:=0 + +PUB keystate(k) : state + +'' Get the state of a particular key +'' returns t|f + + state := -(par_states[k >> 5] >> k & 1) + + +DAT + +'****************************************** +'* Assembly language PS/2 keyboard driver * +'****************************************** + + org +' +' +' Entry +' +entry movd :par,#_dpin 'load input parameters _dpin/_cpin/_locks/_auto + mov x,par + add x,#11*4 + mov y,#4 +:par rdlong 0,x + add :par,dlsb + add x,#4 + djnz y,#:par + + 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 + + mov _head,#0 'reset output parameter _head +' +' +' Reset keyboard +' +reset mov dira,#0 'reset directions + mov dirb,#0 + + movd :par,#_present 'reset output parameters _present/_states[8] + mov x,#1+8 +:par mov 0,#0 + add :par,dlsb + djnz x,#:par + + mov stat,#8 'set reset flag +' +' +' Update parameters +' +update movd :par,#_head 'update output parameters _head/_present/_states[8] + mov x,par + add x,#1*4 + mov y,#1+1+8 +:par wrlong 0,x + add :par,dlsb + add x,#4 + djnz y,#:par + + test stat,#8 wc 'if reset flag, transmit reset command + if_c mov data,#$FF + if_c call #transmit +' +' +' Get scancode +' +newcode mov stat,#0 'reset state + +:same call #receive 'receive byte from keyboard + + cmp data,#$83+1 wc 'scancode? + + if_nc cmp data,#$AA wz 'powerup/reset? + if_nc_and_z jmp #configure + + if_nc cmp data,#$E0 wz 'extended? + if_nc_and_z or stat,#1 + if_nc_and_z jmp #:same + + if_nc cmp data,#$F0 wz 'released? + if_nc_and_z or stat,#2 + if_nc_and_z jmp #:same + + if_nc jmp #newcode 'unknown, ignore +' +' +' Translate scancode and enter into buffer +' + test stat,#1 wc 'lookup code with extended flag + rcl data,#1 + mov data_s,data 'keyboard-de: store scancode for next table lookup with shift + call #look + + cmp data,#0 wz 'if unknown, ignore + if_z jmp #newcode + + mov t,_states+6 'remember lock keys in _states + + mov x,data 'set/clear key bit in _states + shr x,#5 + add x,#_states + movd :reg,x + mov y,#1 + shl y,data + test stat,#2 wc +:reg muxnc 0,y + + if_nc cmpsub data,#$F0 wc 'if released or shift/ctrl/alt/win, done + if_c jmp #update + + mov y,_states+7 'get shift/ctrl/alt/win bit pairs + shr y,#16 + + cmpsub data,#$E0 wc 'translate keypad, considering numlock + if_c test _locks,#%100 wz + if_c_and_z add data,#@keypad1-@table + if_c_and_nz add data,#@keypad2-@table + if_c call #look + if_c jmp #:flags + + 'for keyboard-de changed #$DD to #lock + 'in next code segment + + cmpsub data,#lock wc 'handle scrlock/capslock/numlock + if_c mov x,#%001_000 + if_c shl x,data + if_c andn x,_locks + if_c shr x,#3 + if_c shr t,#29 'ignore auto-repeat + if_c andn x,t wz + if_c xor _locks,x + if_c add data,#lock + if_c_and_nz or stat,#4 'if change, set configure flag to update leds + +{{ for keyboard-us-en start }} +{{ + + test y,#%11 wz 'get shift into nz +' +'Translate scan-codes $5B..$60 with characters from table "shift1" +' + if_nz cmp data,#$60+1 wc 'check shift1 + if_nz_and_c cmpsub data,#$5B wc + if_nz_and_c add data,#@shift1-@table + if_nz_and_c call #look + if_nz_and_c andn y,#%11 + +' +'Translate scan-codes $27..$3D with characters from table "shift2" +' + if_nz cmp data,#$3D+1 wc 'check shift2 + if_nz_and_c cmpsub data,#$27 wc + if_nz_and_c add data,#@shift2-@table + if_nz_and_c call #look + if_nz_and_c andn y,#%11 + + test _locks,#%010 wc 'check shift-alpha, considering capslock + muxnc :shift,#$20 + test _locks,#$40 wc + if_nz_and_nc xor :shift,#$20 + cmp data,#"z"+1 wc + if_c cmpsub data,#"a" wc +:shift if_c add data,#"A" + if_c andn y,#%11 +}} +{{ for keyboard-us-en end }} + +{{ for keyboard-de start }} + + cmp data,#de_ae wz 'replace ae + if_z mov data,#"ä" + cmp data,#de_oe wz 'replace oe + if_z mov data,#"ö" + cmp data,#de_ue wz 'replace ue + if_z mov data,#"ü" + +' +'Documentation of control-key bits +' +' test y,#%00000011 wz 'get SHIFT into nz +' test y,#%00000100 wz 'get CTRL-L into nz +' test y,#%00001000 wz 'get CTRL-R into nz +' test y,#%00010000 wz 'get ALT-L into nz +' test y,#%00100000 wz 'get ALT-R into nz +' test y,#%01000000 wz 'get WIN-L into nz +' test y,#%10000000 wz 'get WIN-R into nz + + +' +'Translate scan-codes with characters from "table_shift" +' + + test y,#%00000011 wz 'get shift into nz + test _locks,#$40 wc + if_nz_and_nc mov data,data_s 'reload scancode + if_nz_and_nc call #look_shift 'translate by table_shift + + +' +'Translate scan-codes with characters from "table_alt_r" +' + + test y,#%00100000 wz 'get ALT-R (AltGr) into nz + if_nz mov data,data_s 'reload scancode + if_nz call #look_alt_r 'translate by table_alt_r + + +{{ for keyboard-de end }} + + +:flags ror data,#8 'add shift/ctrl/alt/win flags + mov x,#4 '+$100 if shift +:loop test y,#%11 wz '+$200 if ctrl + shr y,#2 '+$400 if alt + if_nz or data,#1 '+$800 if win + ror data,#1 + djnz x,#:loop + rol data,#12 + + rdlong x,par 'if room in buffer and key valid, enter + sub x,#1 + and x,#$F + cmp x,_head wz + if_nz test data,#$FF wz + if_nz mov x,par + if_nz add x,#11*4 + if_nz add x,_head + if_nz add x,_head + if_nz wrword data,x + if_nz add _head,#1 + if_nz and _head,#$F + + test stat,#4 wc 'if not configure flag, done + if_nc jmp #update 'else configure to update leds +' +' +' Configure keyboard +' +configure mov data,#$F3 'set keyboard auto-repeat + call #transmit + mov data,_auto + and data,#%11_11111 + call #transmit + + mov data,#$ED 'set keyboard lock-leds + call #transmit + mov data,_locks + rev data,#-3 & $1F + test data,#%100 wc + rcl data,#1 + and data,#%111 + call #transmit + + mov x,_locks 'insert locks into _states + and x,#%111 + shl _states+7,#3 + or _states+7,x + ror _states+7,#3 + + mov _present,#1 'set _present + + jmp #update 'done + +{{ for keyboard-de start }} +' +' Lookup byte in table_shift +' +look_shift ror data,#2 'perform lookup + movs :reg,data + add :reg,#table_shift + shr data,#27 + mov x,data +:reg mov data,0 + shr data,x + and data,#$FF 'isolate byte +look_shift_ret ret + +' +' Lookup byte in table_alt_r +' +look_alt_r ror data,#2 'perform lookup + movs :reg,data + add :reg,#table_alt_r + shr data,#27 + mov x,data +:reg mov data,0 + shr data,x + and data,#$FF 'isolate byte +look_alt_r_ret ret + +{{ for keyboard-de end }} + +' +' +' Lookup byte in table +' +look ror data,#2 'perform lookup + movs :reg,data + add :reg,#table + shr data,#27 + mov x,data +:reg mov data,0 + shr data,x + + jmp #rand 'isolate byte +' +' +' Transmit byte to keyboard +' +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 x,#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 x,#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 keyboard + if_nz jmp #reset + +transmit_ret ret +' +' +' Receive byte from keyboard +' +receive test _cpin,#$20 wc 'wait indefinitely for initial clock low + waitpne cmask,cmask +receive_ack + mov x,#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 x,#receive_bit 'another bit? + + shr data,#22 'align byte + test data,#$1FF wc 'if parity error, reset keyboard + if_nc jmp #reset +rand and data,#$FF 'isolate byte + +look_ret +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 y,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 y,#wloop '(replaced with c0/c1/c0d0/c1d1) + + tjz y,#reset 'if timeout, reset keyboard +wait_ret +wait_c0_ret ret + + +c0 if_c djnz y,#wloop '(if_never replacements) +c1 if_nc djnz y,#wloop +c0d0 if_c_or_nz djnz y,#wloop +c1d1 if_nc_or_z djnz y,#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 +' +' +' Lookup table +' ascii scan extkey regkey ()=keypad +' + +{{keyboard-us-en start}} +{{ +table + ' + '$00 --- F9 --- F5 F3 F1 F2 F12 + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$00D8,$0000,$00D4,$00D2,$00D0,$00D1,$00DB + + ' + '$08 --- F10 F8 F6 F4 TAB ` --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$00D9,$00D7,$00D5,$00D3,$0009,$0060,$0000 + + ' ALT-R Left CTRL-R + '$10 --- ALT-L SHIFT --- CTRL_L q 1 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$F5F4,$00F0,$0000,$F3F2,$0071,$0031,$0000 + + ' WIN-L + '$18 --- --- z s a w 2 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$007A,$0073,$0061,$0077,$0032,$F600 + + ' WIN-R + '$20 --- c x d e 4 3 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0063,$0078,$0064,$0065,$0034,$0033,$F700 + + ' Apps + '$28 --- Spc v f t r 5 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0020,$0076,$0066,$0074,$0072,$0035,$CC00 + + ' Power + '$30 --- n b h g y 6 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$006E,$0062,$0068,$0067,$0079,$0036,$CD00 + + ' Sleep + '$38 --- --- m j u 7 8 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$006D,$006A,$0075,$0037,$0038,$CE00 + + ' + '$40 --- , k i o 0 9 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$002C,$006B,$0069,$006F,$0030,$0039,$0000 + + ' (/) + '$48 --- . / l } p + --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$002E,$EF2F,$006C,$003B,$0070,$002D,$0000 + + ' + '$50 --- --- { --- [ = --- --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$0027,$0000,$005B,$003D,$0000,$0000 + + ' CAPS Right (ENTER) Wk.up + '$58 LOCK SHIFT ENTER ] --- \ --- --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $00DE,$00F1,$EB0D,$005D,$0000,$005C,$CF00,$0000 + + ' + '$60 --- --- --- --- --- --- BkSpc --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$0000,$0000,$0000,$0000,$00C8,$0000 + + ' End Left Home + '$68 --- (1) --- (4) (7) --- --- --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$C5E1,$0000,$C0E4,$C4E7,$0000,$0000,$0000 + + ' Ins Del Down --- Right Up + '$70 (0) (.) (2) (5) (6) (8) Esc NumLock + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $CAE0,$C9EA,$C3E2,$00E5,$C1E6,$C2E8,$00CB,$00DF + + ' PgDn PrScr PgUp + '$78 F11 (+) (3) (-) (*) (9) ScrLock --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $00DA,$00EC,$C7E3,$00ED,$DCEE,$C6E9,$00DD,$0000 + + ' + '$80 --- --- --- F7 + ' ===== ===== ===== ===== + word $0000,$0000,$0000,$00D6 + + +keypad1 byte $CA, $C5, $C3, $C7, $C0, 0, $C1, $C4, $C2, $C6, $C9, $0D, "+-*/" + +keypad2 byte "0123456789.", $0D, "+-*/" + +' +'Table "shift1" for scan-codes $5B..$60 +' +shift1 byte "{|}", 0, 0, "~" + +' +'Table "shift1" for scan-codes $27..$3D +' +shift2 byte $22, 0, 0, 0, 0, "<_>?)!@#$%^&*(", 0, ":", 0, "+" +}} +{{keyboard-us-en end}} + + +{{keyboard-de start}} + +table + ' + '$00 --- F9 --- F5 F3 F1 F2 F12 + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$00D8,$0000,$00D4,$00D2,$00D0,$00D1,$00DB + + ' + '$08 --- F10 F8 F6 F4 TAB _^_ --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$00D9,$00D7,$00D5,$00D3,$0009,$005E,$0000 + + ' ALT-R Left CTRL-R + '$10 --- ALT-L SHIFT --- CTRL_L q 1 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$F5F4,$00F0,$0000,$F3F2,$0071,$0031,$0000 + + ' WIN-L + '$18 --- --- _y_ s a w 2 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$0079,$0073,$0061,$0077,$0032,$F600 + + ' WIN-R + '$20 --- c x d e 4 3 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0063,$0078,$0064,$0065,$0034,$0033,$F700 + + ' Apps + '$28 --- Spc v f t r 5 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0020,$0076,$0066,$0074,$0072,$0035,Apps + + ' Power + '$30 --- n b h g _z_ 6 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$006E,$0062,$0068,$0067,$007A,$0036,Power + + ' Sleep + '$38 --- --- m j u 7 8 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$006D,$006A,$0075,$0037,$0038,Sleep + + ' + '$40 --- , k i o 0 9 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$002C,$006B,$0069,$006F,$0030,$0039,$0000 + + ' (/) + '$48 --- . _-_ l _oe_ p _sz_ --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$002E,$EF2D,$006C,de_oe,$0070,$00DF,$0000 + + ' + '$50 --- --- _ae_ --- _ue_ _'_ --- --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,de_ae,$0000,de_ue,$0060,$0000,$0000 + + ' CAPS Right (ENTER) Wk.up + '$58 LOCK SHIFT ENTER _+_ --- # --- --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word CpsLk,$00F1,$EB0D,$002B,$0000,$0023,WkUp ,$0000 + + ' + '$60 --- _<_ --- --- --- --- BkSpc --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$003C,$0000,$0000,$0000,$0000,BkSp ,$0000 + + ' End Left Home + '$68 --- (1) --- (4) (7) --- --- --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,CrsEn,$0000,CrsLt,CrsHm,$0000,$0000,$0000 + + ' Ins Del Down --- Right Up + '$70 (0) (.) (2) (5) (6) (8) Esc NumLock + ' ===== ===== ===== ===== ===== ===== ===== ===== + word Ins , Del ,CrsDn,$00E5,CrsRt,CrsUp, Esc ,NumLk + + ' PgDn PrScr PgUp + '$78 F11 (+) (3) (-) (*) (9) ScrLock --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $00DA,$00EC,PgDn ,$00ED,$DCEE,PgUp ,ScrLk,$0000 + + ' + '$80 --- --- --- F7 + ' ===== ===== ===== ===== + word $0000,$0000,$0000,$00D6 + + +keypad1 byte $CA, $C5, $C3, $C7, $C0, 0, $C1, $C4, $C2, $C6, $C9, $0D, "+-*/" + +keypad2 byte "0123456789.", $0D, "+-*/" + + +table_shift + ' + '$00 --- F9 --- F5 F3 F1 F2 F12 + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$00D8,$0000,$00D4,$00D2,$00D0,$00D1,$00DB + + ' + '$08 --- F10 F8 F6 F4 TAB _°_ --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$00D9,$00D7,$00D5,$00D3,$0009,$00B0,$0000 + + ' ALT-R Left CTRL-R + '$10 --- ALT-L SHIFT --- CTRL_L Q ! --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$F5F4,$00F0,$0000,$F3F2,$0051,$0021,$0000 + + ' WIN-L + '$18 --- --- _Y_ S A W " --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$0059,$0053,$0041,$0057,$0022,$F600 + + ' WIN-R + '$20 --- C X D E $ SHF+3 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0043,$0058,$0044,$0045,$0024,$0014,$F700 + + ' Apps + '$28 --- Spc V F T R % --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0020,$0056,$0046,$0054,$0052,$0025,Apps + + ' Power + '$30 --- N B H G _Z_ & --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$004E,$0042,$0048,$0047,$005A,$0026,Power + + ' Sleep + '$38 --- --- M J U / ( --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$004D,$004A,$0055,$002F,$0028,Sleep + + ' + '$40 --- ; K I O _=_ ) --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$003B,$004B,$0049,$004F,$003D,$0029,$0000 + + ' (/) + '$48 --- : ___ L _OE_ P _sz_ --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$003A,$EF5F,$004C,$00D6,$0050,$003F,$0000 + + ' + '$50 --- --- _AE_ --- _UE_ _'_ --- --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$00C4,$0000,$00DC,$0060,$0000,$0000 + + ' CAPS Right (ENTER) Wk.up + '$58 LOCK SHIFT ENTER _*_ --- _'_ --- --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word CpsLk,$00F1,$EB0D,$002A,$0000,$0027,WkUp ,$0000 + + ' + '$60 --- _>_ --- --- --- --- BkSpc --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$003E,$0000,$0000,$0000,$0000,BkSp ,$0000 + + ' End Left Home + '$68 --- (1) --- (4) (7) --- --- --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,CrsEn,$0000,CrsLt,CrsHm,$0000,$0000,$0000 + + ' Ins Del Down --- Right Up + '$70 (0) (.) (2) (5) (6) (8) Esc NumLock + ' ===== ===== ===== ===== ===== ===== ===== ===== + word Ins , Del ,CrsDn,$00E5,CrsRt,CrsUp, Esc ,NumLk + + ' PgDn PrScr PgUp + '$78 F11 (+) (3) (-) (*) (9) ScrLock --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $00DA,$00EC,PgDn ,$00ED,$DCEE,PgUp ,ScrLk,$0000 + + ' + '$80 --- --- --- F7 + ' ===== ===== ===== ===== + word $0000,$0000,$0000,$00D6 + + + +table_alt_r + ' + '$00 --- F9 --- F5 F3 F1 F2 F12 + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0097,$0000,$0090,$009D,$009F,$009E,$0094 + + ' + '$08 --- F10 F8 F6 F4 TAB _^_ --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0096,$0093,$0091,$009C,$0009,$0000,$0000 + + ' ALT-R Left CTRL-R + '$10 --- ALT-L SHIFT --- CTRL_L q 1 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$F5F4,$00F0,$0000,$F3F2, "@", "¹", $0000 + + ' WIN-L + '$18 --- --- _y_ s a w 2 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$0000,$0000,$0000, "√", "²", $F600 + + ' WIN-R + '$20 --- c x d e 4 3 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$0000,$0000, "€", $0000, "³", $F700 + + ' Apps + '$28 --- Spc v f t r 5 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$0000,$0000,$0000,$0000,$0000,Apps + + ' Power + '$30 --- n b h g _z_ 6 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$0000,$0000,$0000,$0000,$0000,Power + + ' Sleep + '$38 --- --- m j u 7 8 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000, "µ", $0000,$0000, "{" , "[" ,Sleep + + ' + '$40 --- , k i o 0 9 --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$0000,$0000,$0000, "}", "]", $0000 + + ' (/) + '$48 --- . _-_ l _oe_ p _sz_ --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$0000,$0000,$0000, "π", "\", $0000 + + ' + '$50 --- --- _ae_ --- _ue_ _'_ --- --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 + + ' CAPS Right (ENTER) Wk.up + '$58 LOCK SHIFT ENTER _+_ --- # --- --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word CpsLk,$00F1,$EB0D, "~", $0000,$0000,WkUp ,$0000 + + ' + '$60 --- _<_ --- --- --- --- BkSpc --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000, "|", $0000,$0000,$0000,$0000,BkSp ,$0000 + + ' End Left Home + '$68 --- (1) --- (4) (7) --- --- --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0000,CrsEn,$0000,CrsLt,CrsHm,$0000,$0000,$0000 + + ' Ins Del Down --- Right Up + '$70 (0) (.) (2) (5) (6) (8) Esc NumLock + ' ===== ===== ===== ===== ===== ===== ===== ===== + word Ins , Del ,CrsDn,$00E5,CrsRt,CrsUp, Esc ,NumLk + + ' PgDn PrScr PgUp + '$78 F11 (+) (3) (-) (*) (9) ScrLock --- + ' ===== ===== ===== ===== ===== ===== ===== ===== + word $0095,$00EC,PgDn ,$00ED,$DCEE,PgUp ,ScrLk,$0000 + + ' + '$80 --- --- --- F7 + ' ===== ===== ===== ===== + word $0000,$0000,$0000,$0092 + + +{{keyboard-de end}} + +' +' +' Uninitialized data +' +dmask res 1 +cmask res 1 +stat res 1 +data res 1 +data_s res 1 'Scancode-Storage (for keyboard-de) +x res 1 +y res 1 +t res 1 + +_head res 1 'write-only +_present res 1 'write-only +_states res 8 'write-only +_dpin res 1 'read-only at start +_cpin res 1 'read-only at start +_locks res 1 'read-only at start +_auto res 1 'read-only at start + +'' +'' +'' _________ +'' Key Codes +'' +'' 00..DF = keypress and keystate +'' E0..FF = keystate only +'' +'' +'' 09 Tab +'' 0D Enter +'' 20 Space +'' 21 ! +'' 22 " +'' 23 # +'' 24 $ +'' 25 % +'' 26 & +'' 27 ' +'' 28 ( +'' 29 ) +'' 2A * +'' 2B + +'' 2C , +'' 2D - +'' 2E . +'' 2F / +'' 30 0..9 +'' 3A : +'' 3B ; +'' 3C < +'' 3D = +'' 3E > +'' 3F ? +'' 40 @ +'' 41..5A A..Z +'' 5B [ +'' 5C \ +'' 5D ] +'' 5E ^ +'' 5F _ +'' 60 ` +'' 61..7A a..z +'' 7B { +'' 7C | +'' 7D } +'' 7E ~ +'' +'' 80-BF (future international character support) +'' +'' C0 Left Arrow +'' C1 Right Arrow +'' C2 Up Arrow +'' C3 Down Arrow +'' C4 Home +'' C5 End +'' C6 Page Up +'' C7 Page Down +'' C8 Backspace +'' C9 Delete +'' CA Insert +'' CB Esc +'' CC Apps +'' CD Power +'' CE Sleep +'' CF Wakeup +'' +'' D0..DB F1..F12 +'' DC Print Screen +'' DD Scroll Lock +'' DE Caps Lock +'' DF Num Lock +'' +'' E0..E9 Keypad 0..9 +'' EA Keypad . +'' EB Keypad Enter +'' EC Keypad + +'' ED Keypad - +'' EE Keypad * +'' EF Keypad / +'' +'' F0 Left Shift +'' F1 Right Shift +'' F2 Left Ctrl +'' F3 Right Ctrl +'' F4 Left Alt +'' F5 Right Alt +'' F6 Left Win +'' F7 Right Win +'' +'' FD Scroll Lock State +'' FE Caps Lock State +'' FF Num Lock State +'' +'' +100 if Shift +'' +200 if Ctrl +'' +400 if Alt +'' +800 if Win +'' +'' eg. Ctrl-Alt-Delete = $6C9 +'' +'' +'' Note: Driver will buffer up to 15 keystrokes, then ignore overflow. + +{{ + +┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ 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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} diff --git a/source/belsVGA64.spin b/source/belsVGA64.spin new file mode 100644 index 0000000..97e023c --- /dev/null +++ b/source/belsVGA64.spin @@ -0,0 +1,1289 @@ +{{ VGA-64Farben +┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Autor: Ingo Kripahle,Reinhard Zielinski │ +│ Copyright (c) 2013 Ingo Kriphale,Reinhard Zielinski │ +│ 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 : VGA-Tile-Treiber 640x480 Pixel, 40x30 Zeichen +Chip : Bellatrix +Typ : Treiber +Version : 01 +Subversion : 00 +Funktion : Standard VGA-Text- und Tastatur-Treiber + +Dieser Bellatrix-Code kann als Stadardcode im EEPROM gespeichert werden Tilebasierten-Textbildschirm +und Tastaturfunktionen. Mit dem integrierten Loader kann Bellatrix +mit einem beliebigen anderen Code geladen werden. + +Komponenten : VGA64 Tilemap Engine // Author: Kwabena W. Agyeman + PS/2 Keyboard Driver v1.0.1 Chip Gracey, ogg MIT + +COG's : MANAGMENT 1 COG + VGA 1 COG's + KEYB 1 COG + ------------------- + 3 COG's + +Logbuch : + +23-10-2008-dr235 - erste funktionsfähige version erstellt + - cursor eingebaut +06-11-2008-dr235 - keyb auf deutsche zeichenbelegung angepasst (ohne umlaute) +24-11-2008-dr235 - tab, setcur, pos1, setx, sety, getx, gety, setcol, sline, screeninit + curon, curoff + - beltest +13-03-2009-dr235 - LF als Zeichencode ausgeblendet +22-03-2009-dr235 - abfrage für statustasten eingefügt +05-09-2009-dr235 - abfrage der laufenden cogs eingefügt + - deutschen tastaturtreiber mit vollständiger belegung! von ogg eingebunden +22-03-2010-dr235 - anpassung trios +01-05-2010-dr235 - scrollup/scrolldown eingebunden & getestet +03-05-2010-dr235 - settab/getcols/getrows/getresx/getresy eingefügt & getestet + - hive-logo eingefügt +------------------- +26-01-2011-dr235 - übernahme und anpassung des treibers aus trios +31-01-2011-dr235 - backspace als direktes steuerzeichen ($C8) eingefügt +01-02-2011-dr235 - multiscreenfähigkeit implementiert + - 88 - mgr_wscr: steuert, in welchen screen zeichen geschrieben werden + - 89 - mgr_dscr: steuert welcher screen angezeigt wird +05-02-2011-dr235 - umwandlung backspace $c8 --> $08 +06-03-2011-dr235 - revision der steuercodes; nur noch funktionen mit parameter + werden über eine 0-sequenz aufgerufen, alle anderen steuerzeichen + werden auf 1-byte-zeichen abgebildet +20-04-2011-dr235 - integration einer kompatiblen loaderroutine, damit kann der treiber + jetzt direkt aus dem rom gestartet und dennoch bella-code nachgeladen + werden kann +31.12.2011-dr235 - anpassung für verschiedene zeilenumbrüche in print_char eingefügt + +02-04-2013-zille9 - Kompletter Umbau durch Einbindung eines anderen Grafiktreibers + +02-06-2013-zille9 - Startbild ala Amiga eingebunden, fordert zum Einlegen einer SD-Card mit TRIOS auf + +28-12-2013-zille9 - Fensterfunktionen für 8 Windows mit 8 verschiedenen Stilen geschaffen + - Button-Funktionen auf Abfrage der Mauskoordinaten beschränkt, grafische Funktionen werden wieder von Regnatix erledigt + - dadurch Code gespart, da nur noch die Koordinaten-Puffer und die Button-Nummer benötigt werden +05-01-2014-zille9 - Fensterverwaltung überarbeitet, bei Klick auf ein Fensterbutton wird die Fensternummer*10+Buttonnummer zurückgegeben + - Beispiel:Schließen Symbol im Fenster 2 gibt 22 zurück (20 für Fenster 2 und 2 für Fensterbutton 2) + - dadurch wird es möglich, mehrere Fenster auf Funktionen abzufragen + - 234 Longs frei + +Notizen: + +}} + + +CON + +_CLKMODE = XTAL1 + PLL16X +_XINFREQ = 5_000_000 + +'signaldefinitionen bellatrixix + +#0, D0,D1,D2,D3,D4,D5,D6,D7 'datenbus +#8, BEL_VGABASE 'vga-signale (8pin) +#16, BEL_KEYBC,BEL_KEYBD 'keyboard-signale +#18, BEL_MOUSEC,BEL_MOUSED 'maus-signale +#20, BEL_VIDBASE 'video-signale(3pin) +#23, BEL_SELECT 'belatrix-auswahlsignal +#24, HBEAT 'front-led + BUSCLK 'bustakt + BUS_WR '/wr - schreibsignal + BUS_HS ' '/hs - quittungssignal +#41, RTC_GETSECONDS 'Returns the current second (0 - 59) from the real time clock. + RTC_GETMINUTES 'Returns the current minute (0 - 59) from the real time clock. + RTC_GETHOURS 'Returns the current hour (0 - 23) from the real time clock. +' +---------- +' | +------- system +' | | +---- version (änderungen) +' | | | +- subversion (hinzufügungen) +'CHIP_VER = $00_01_02_01 +' +' +---------- +' | +-------- +' | |+------- vektor +' | ||+------ grafik +' | |||+----- text +' | ||||+---- maus +' | |||||+--- tastatur +' | ||||||+-- vga +' | |||||||+- tv +CHIP_SPEC = %00000000_00000000_00000000_00011110 + + +KEYB_DPORT = BEL_KEYBD 'tastatur datenport +KEYB_CPORT = BEL_KEYBC 'tastatur taktport +mouse_dport = BEL_MOUSED +mouse_cport = BEL_MOUSEC + +' hbeat --------+ +' clk -------+| +' /wr ------+|| +' /hs -----+||| +------------------------- /cs +' |||| | -------- d0..d7 +DB_IN = %00001001_00000000_00000000_00000000 'maske: dbus-eingabe +DB_OUT = %00001001_00000000_00000000_11111111 'maske: dbus-ausgabe + +M1 = %00000010_00000000_00000000_00000000 +M2 = %00000010_10000000_00000000_00000000 'busclk=1? & /cs=0? + +M3 = %00000000_00000000_00000000_00000000 +M4 = %00000010_00000000_00000000_00000000 'busclk=0? + +_pinGroup = 1 +_startUpWait = 3 + + +buttonbuff=33 'Buttonanzahl 1-32 Textbutton oder icon + +Bel_Treiber_Ver=88 'Bellatrix-Treiberversion + +OBJ + vga : "VGA64_Engine" + keyb : "bel-keyb" + mouse : "mouse64" + +VAR + + long keycode 'letzter tastencode + + long plen 'länge datenblock loader + byte proghdr[16] 'puffer für objektkopf + byte mouseshow 'Mouse-Pfeil anzeigen oder nicht + byte strkette[40] 'stringpuffer fuer Scrolltext + word tnr,XPos,YPos + byte bnumber[buttonbuff],bx[buttonbuff],by[buttonbuff],bxx[buttonbuff] 'buttonvariable fuer 64 Buttons + word xbound,ybound,xxbound,yybound 'x und y bereich der Mouse eingrenzen + long mousetile[16] 'User-Mousetilebuffer + byte hintergr + byte actor[5] 'Actor-Sprite [Tilenr,col1,col2,col3,x,y] Spielerfigur + byte action_x,old_action_x + byte action_y,old_action_y + byte sprite_x[8],sprite_y[8],sprite_old_x[8],sprite_old_y[8] 'x,y-Parameter der Sprites + byte spritenr[16] 'Tilenr der Sprites+Alternativ-Sprites + byte spritef1[8],spritef2[8],spritef3[8] 'farben der Sprites + byte sprite_dir[8] 'Bewegungsrichtung der Sprites + byte action_key[5] + byte sprite_start[8] + byte sprite_end[8] + byte Sprite_Move + byte collision + byte block_tile[10] + byte sp_alter + byte wind[112] + byte wint[17] 'Tilenummern für die Fenster + +CON ''------------------------------------------------- BELLATRIX + +PUB main | zeichen,n,i,x,y ,speed 'chip: kommandointerpreter +''funktionsgruppe : chip +''funktion : kommandointerpreter +''eingabe : - +''ausgabe : - + + init_subsysteme 'bus/vga/keyboard/maus initialisieren + n:=0 + speed:=30 + + repeat + if mouseshow==1 'Mauspfeil anzeigen + x+=mouse.delta_x + if x=xxbound'639 + x:=xxbound'639 + y+= -mouse.delta_y + if y=yybound'479 + y:=yybound'479 + XPos :=x + YPos :=y + '++++++++++++++++++++++++ Sprite-Bewegung ++++++++++++++++++++++++++++++++++++++++++++++++++ + if Sprite_Move==1 + repeat i from 0 to 7 + if(spritenr[i]<176) and collision==0 'sprite definiert? und noch keine Kollision passiert + if (sprite_x[i]==action_x) and (sprite_y[i]==action_y) 'sprite an Player-Position? + collision:=1 + quit + n++ + if n==speed + Set_Sprite_XY + if n>speed+1 + n:=0 + '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + + + + zeichen := bus_getchar '1. zeichen empfangen + if zeichen ' > 0 + + vga.printCharacter(zeichen) + + else + zeichen := bus_getchar '2. zeichen kommando empfangen + case zeichen + 1: key_stat '1: Tastaturstatus senden + 2: key_code '2: Tastaturzeichen senden + 3: vga.sety(bus_getchar) + 4: key_spec '4: Statustasten ($100..$1FF) abfragen + 5: displaymouse '5: Mousezeiger anzeigen + 6: pchar(bus_getchar) '6: zeichen ohne steuerzeichen ausgeben + 7: bus_putchar(keyb.taster) + keyb.clearkeys + 8: vga.setx(bus_getchar) '8: x-position setzen + 9: mousebound '9: mousebereich eingrenzen + 10: mousex '10:abfrage absulute x-position + 11: mousey '11:abfrage absulute y-position + 12: mousez '12:abfrage absulute z-position (Scrollrad) + 13: keyb.clearkeys 'tastaturpuffer loeschen + 14: mouse_button(bus_getchar) '14:abfrage Mouse Button + 15: BoxSize '15:BoxSize +' 16: vga.printCursorColor(bus_getchar) + 17: vga.printCursorRate(bus_getchar) + 18: PrintBoxColor + 19: destroy_Button + 20: scrollup + 21: scrolldown + 22: display3DBox + 23: display3DFrame + 24: display2DBox + 25: Get_Button_Param + 26: scrollString + 27: displayString + 30: mousepointer + 31: vga.printat(bus_getchar,bus_getchar) + 32: displayTile + 33: vga.printwindow(bus_getchar) + 35: loadtile 'Tiledatei in Puffer laden + 36: displaypic 'komplette Tile-Datei anzeigen + 37: getx 'Cursor-X-Position abfragen + 38: gety 'Cursor-Y-Position abfragen + 39: line(bus_getchar,bus_getchar,bus_getchar,bus_getchar,bus_getchar) 'x,y,xx,yy,farbe + 40: vga.Plot(bus_getchar,bus_getchar,bus_getchar) + 41: Sprite_Parameter 'Sprite-Parameter + 42: Set_Sprite_XY 'Sprite bewegen + 43: Actor_Parameter 'Player-Parameter + 44: Set_Actor_XY 'Player bewegen + 45: Set_Action_Key 'spielertasten + 46: Reset_Sprite 'Sprite anhalten/loeschen + 47: SpriteMove 'spritebewegung aktivieren/deaktivieren + 48: speed:=bus_getchar 'spritegeschwindigkeit + 49: bus_putchar(collision) 'Kollisionsflag abfragen + collision:=0 + 50: Get_Actor_Pos 'Playerposition + 51: Get_Block 'Tile lesen +' 52: Fire_Parameter +' 53: Fire + 54: Displaypalette 'Farbpalette anzeigen + 55: Del_Window 'Fensterparameter löschen + 56: Set_Titel_Status 'Titeltext oder Statustext in einem Fenster setzen + 57: backup_area 'Bildschirmbereich sichern + 58: restore_area 'Bildschirmbereich wiederherstellen + 59: Window 'Fensterstil erstellen + 60: get_window 'Tastendruck im Fenster abfragen + 61: Change_Backuptile 'Backuptile unter dem Player ändern (Itemsammeln) + 62: PrintFont 'Text mit Tilefont darstellen + +' ---------------------------------------------- CHIP-MANAGMENT + 96: mgr_getcogs 'freie cogs abfragen + 87: mgr_load 'neuen bellatrix-code laden + 98: mgr_bel 'Rückgabe Grafiktreiber 64 + 99: reboot 'bellatrix neu starten + +PUB init_subsysteme|i',x,y,tn,tmp 'chip: initialisierung des bellatrix-chips +''funktionsgruppe : chip +''funktion : - initialisierung des businterface +'' : - vga & keyboard-treiber starten +''eingabe : - +''ausgabe : - + repeat i from 0 to 7 'evtl. noch laufende cogs stoppen + ifnot i == cogid + cogstop(i) + + + dira := db_in 'datenbus auf eingabe schalten + outa[bus_hs] := 1 'handshake inaktiv + + keyb.start(keyb_dport, keyb_cport) 'tastaturport starten + + ifnot vga.TMPEngineStart(_pinGroup, @XPos, @YPos) + reboot + waitcnt((clkfreq * _startUpWait) + cnt) + mouse.start(BEL_MOUSED, BEL_MOUSEC) + + mouseshow:=0 'Mousezeiger aus + xbound:=1 'Mouse-Bereich Grundeinstellung + xxbound:=639 + ybound:=1 + yybound:=479 + repeat i from 0 to 7 + spritenr[i]:=255 'sprites abschalten + + + action_key[0]:=2 'action-tasten vorbelegen + action_key[1]:=3 + action_key[2]:=4 + action_key[3]:=5 + action_key[4]:=32 + sp_alter:=0 + collision:=0'viereck:=1 + + vga.printwindow(0) + vga.printBoxSize(0,0, 0, 29, 39) + vga.printBoxColor(0,0,255) + vga.printCharacter(12) 'cls + vga.printCursorRate(0) + '##### Fensterparameter ##### + wind[0]:=0 + wind[1]:=1 + wind[2]:=0 + wind[3]:=0 + wind[4]:=39 + wind[5]:=29 + wind[6]:=0 + wind[7]:=255 + wind[8]:=0 + +PUB bus_putchar(zeichen) 'chip: ein byte an regnatix senden +''funktionsgruppe : chip +''funktion : ein byte an regnatix senden +''eingabe : byte +''ausgabe : - + + waitpeq(M1,M2,0) 'busclk=1? & prop2=0? + dira := db_out 'datenbus auf ausgabe stellen + outa[7..0] := zeichen 'daten ausgeben + outa[bus_hs] := 0 'daten gültig + waitpeq(M3,M4,0) 'busclk=0? + dira := db_in 'bus freigeben + outa[bus_hs] := 1 'daten ungültig + +PUB bus_getchar : zeichen 'chip: ein byte von regnatix empfangen +''funktionsgruppe : chip +''funktion : ein byte von regnatix empfangen +''eingabe : - +''ausgabe : byte + outa[hbeat]~~ + waitpeq(M1,M2,0) 'busclk=1? & prop2=0? + zeichen := ina[7..0] 'daten einlesen + outa[bus_hs] := 0 'daten quittieren + waitpeq(M3,M4,0) 'busclk=0? + outa[bus_hs] := 1 + outa[hbeat]~ + +CON ''------------------------------------------------- SUBPROTOKOLL-FUNKTIONEN + +PUB sub_putlong(wert) 'sub: long senden +''funktionsgruppe : sub +''funktion : subprotokoll um einen long-wert an regnatix zu senden +''eingabe : 32bit wert der gesendet werden soll +''ausgabe : - +''busprotokoll : [put.byte1][put.byte2][put.byte3][put.byte4] +'' : [ hsb ][ ][ ][ lsb ] + + bus_putchar(wert >> 24) '32bit wert senden hsb/lsb + bus_putchar(wert >> 16) + bus_putchar(wert >> 8) + bus_putchar(wert) + +PUB sub_getlong:wert 'sub: long empfangen +''funktionsgruppe : sub +''funktion : subprotokoll um einen long-wert von regnatix zu empfangen +''eingabe : - +''ausgabe : 32bit-wert der empfangen wurde +''busprotokoll : [get.byte1][get.byte2][get.byte3][get.byte4] +'' : [ 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 sub_putword(wert) 'sub: long senden +''funktionsgruppe : sub +''funktion : subprotokoll um einen long-wert an regnatix zu senden +''eingabe : 32bit wert der gesendet werden soll +''ausgabe : - +''busprotokoll : [put.byte1][put.byte2][put.byte3][put.byte4] +'' : [ hsb ][ ][ ][ lsb ] + + bus_putchar(wert >> 8) + bus_putchar(wert) + +PUB sub_getword:wert 'sub: long empfangen +''funktionsgruppe : sub +''funktion : subprotokoll um einen long-wert von regnatix zu empfangen +''eingabe : - +''ausgabe : 32bit-wert der empfangen wurde +''busprotokoll : [get.byte1][get.byte2][get.byte3][get.byte4] +'' : [ hsb ][ ][ ][ lsb ] + + wert := bus_getchar << 8 + wert := wert + bus_getchar + +CON ''------------------------------------------------- CHIP-MANAGMENT-FUNKTIONEN + +pub mgr_bel + sub_putlong(Bel_Treiber_Ver) 'rückgabe 65 für tile-driver 64 farben stark geänderte Version + +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 : [0][096][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 + bus_putchar(cogs) + +PUB mgr_load|i 'cmgr: bellatrix-loader +''funktionsgruppe : cmgr +''funktion : funktion um einen neuen code in bellatrix zu laden +'' +''bekanntes problem: einige wenige bel-dateien werden geladen aber nicht korrekt gestartet +''lösung: diese datei als eeprom-image speichern + +' 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 + + +' hbeat --------+ +' clk -------+| +' /wr ------+|| +' /hs -----+|||+------------------------- /cs +' ||||| -------- d0..d7 +DINP long %00001001000000000000000000000000 'constant dinp hex \ bus input +DOUT long %00001001000000000000000011111111 'constant dout hex \ bus output + +M_0 long %00001000000000000000000000000000 'bus inaktiv + +M_1 long %00000010000000000000000000000000 +M_2 long %00000010100000000000000000000000 '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 + + + +CON ''------------------------------------------------- KEYBOARD-FUNKTIONEN + +PUB key_stat 'key: tastaturstatus abfragen + + bus_putchar(keyb.gotkey) + +PUB key_code 'key: tastencode abfragen + + keycode := keyb.key + case keycode + $c8: keycode := $08 'backspace wandeln + bus_putchar(keycode) + +PUB key_spec 'key: statustaten vom letzten tastencode abfragen + + bus_putchar(keycode >> 8) +CON ''------------------------------------------------- SCREEN-FUNKTIONEN + +pub Window|win,f1,f2,f3,f4,f5,f6,f7,f8,x,y,xx,yy,modus,a,b,c,d,posi,shd + + win:=bus_getchar 'fensternummer + f1:=bus_getchar 'farbe1 'vordergrund + f2:=bus_getchar 'farbe2 'hintergrund + f3:=bus_getchar 'farbe3 'titel + f4:=bus_getchar 'farbe4 'frame + f5:=bus_getchar 'farbe5 'titelhintergrund + f6:=bus_getchar 'farbe6 'titeltext + f7:=bus_getchar 'farbe7 'statusback + f8:=bus_getchar 'farbe8 'statustext + y:=bus_getchar 'y + x:=bus_getchar 'x + yy:=bus_getchar 'yy + xx:=bus_getchar 'xx + modus:=bus_getchar 'art des Fensters (mit oder ohne Titel,rahmen,Pfeiltasten,Statusleiste) + shd :=bus_getchar 'Schatten + a:=b:=c:=d:=0 + if shd + vga.display2DBox($56, y+1, x+1, yy+1, xx+1) 'Fensterschatten + if modus==2 or modus>3 + rahmen(y,x,yy,xx,modus,f1,f2,f4) + a:=b:=c:=d:=1 + if modus==3 or modus==4 or modus>5 + titel(y,x,xx,f1,f2,f5,f4) + a:=1 + if modus==5 or modus==6 or modus==8 + pfeile(y,yy,xx,f1,f2,f4,modus) + if modus>6 + status(yy,x,xx,f1,f2,f7) + + + vga.printBoxColor(win,f1,f2) 'fenster vorder und hintergrundfarbe setzen + vga.printCursorColor(f3) + vga.printBoxSize(win,y+a, x+b, yy-c, xx-d) 'virtuelles Fenster erstellen + posi:=win*14 + wind[posi++]:=win + wind[posi++]:=modus + wind[posi++]:=x + wind[posi++]:=y + wind[posi++]:=xx + wind[posi++]:=yy + wind[posi++]:=f1 + wind[posi++]:=f2 + wind[posi++]:=f3 + wind[posi++]:=f4 + wind[posi++]:=f5 + wind[posi++]:=f6 + wind[posi++]:=f7 + wind[posi++]:=f8 + + +pub PrintFont|win,f1,f2,f3,x,y,offset,posi,len,c,of,off + win:=bus_getchar 'fensternummer + f1:=bus_getchar 'farbe1 'vordergrund + f2:=bus_getchar 'farbe2 'hintergrund + f3:=bus_getchar 'farbe3 'titel und statusfarbe,cursorfarbe + y:=bus_getchar 'y + x:=bus_getchar 'x + offset:=bus_getchar 'offset für Zeichensätze, wo die Buchstaben vor der Nummer 32 anfangen + len:=bus_getchar + of:=1 + off:=1 + posi:=win*14 + if wind[posi+1]==1 or wind[posi+1]==3 'Fenster ohne Rahmen benutzen keinen x-Offset, dh.man kann bis an den Rand schreiben + of:=0 + if wind[posi+1]==1 'Fenstertyp 1 benutzt auch keinen y-Offset + off:=0 + x:=x+wind[posi+2]+of + y:=y+wind[posi+3]+off + repeat len + c:=bus_getchar-offset + if y>wind[posi+5]-of + y:=wind[posi+5]-of + vga.displaytile(@tileset[c*16],f1,f2,f3, y, x) + x++ + if x>wind[posi+4]-of + x:=wind[posi+2]+of + y++ + +pri Set_Titel_Status|win,Tit_Stat,len,posi,x,y 'Titel-oder Statustext in einem Fenster setzen + + win :=bus_getchar 'fensternummer + Tit_Stat:=bus_getchar 'Titel oder Statustext + len :=bus_getchar 'stringlänge + + posi:=win*14 + x:=wind[posi+2] + + if (wind[posi+1]==3 or wind[posi+1]==4 or wind[posi+1]>5) and Tit_Stat==1 and wind[posi] + y:=wind[posi+3] 'Titeltext + bus_getstr_plot(posi,len, y, x+1,1,0) + elseif wind[posi+1]>6 and Tit_Stat==2 and wind[posi] + y:=wind[posi+5] 'Statustext + bus_getstr_plot(posi,len,y, x+1,1,2) + else + bus_getstr_plot(posi,len,y, x+1,0,0) 'keine Bildschirmausgabe + +pri bus_getstr_plot(win,len,y,x,m,b)|c + + repeat len + c:=bus_getchar + if x>4 + y:=ypos>>4 + + repeat i from 1 to 7 + b:=i*14 + if wind[b] + a:=wind[b+1] 'Art des Fensters + + case a + 'Titelleiste linke und rechte obere ecke + 3,4,6,7,8:if x==wind[b+2] and y==wind[b+3] 'linke obere ecke + sd:=1 + if x==wind[b+4] and y==wind[b+3] 'rechte obere ecke + sd:=2 + if a==6 or a==8 + if x==wind[b+4] and y==wind[b+3]+1 'oberer pfeil + sd:=3 + if a==6 + if x==wind[b+4] and y==wind[b+5] 'unterer pfeil + sd:=4 + if a==8 + if x==wind[b+4] and y==wind[b+5]-1 'unterer pfeil + sd:=4 + + if sd + klick_action(x,y,sd,i) + sd+=i*10 'Fensternummer*10+Button + quit + + 5: if x==wind[b+4] and y==wind[b+3] 'oberer pfeil + sd:=3 + if x==wind[b+4] and y==wind[b+5] 'unterer pfeil + sd:=4 + if sd + klick_action(x,y,sd,i) + sd+=i*10 'Fensternummer*10+Button + quit + + + + bus_putchar(sd) + +pri klick_action(x,y,sd,w)|tinr,f1,f2,f3,ff,a + a:=w*14 + f1:=wind[a+6] + f2:=wind[a+7] + ff:=wind[a+9]'f4 + f3:=wind[a+10]'f5 + case sd + 1:tinr:=wint[8]'128 + 2:tinr:=wint[10]'129 + 3:tinr:=wint[11]'133 + 4:tinr:=wint[13]'131 + vga.displaytile(@tileset[tinr*16],ff,f2,f1, y, x) 'rechte obere ecke + repeat while mouse.button(0) 'warten, bis Maustaste losgelassen wird + if sd==1 or sd==2 'Titelleistensymbole + vga.displaytile(@tileset[tinr*16],f2,f1,ff, y, x) 'rechte obere ecke + else 'Pfeilsymbole + vga.displaytile(@tileset[tinr*16],f2,f1,ff, y, x) 'normal darstellen + +pri Del_Window|wnr,i,a + i:=0 + wnr:=bus_getchar + repeat 17 'neue Tilewerte für die Fenster lesen + wint[i++]:=bus_getchar + + if wnr==9 + repeat i from 1 to 7 + wind[i*10]:=0 + else + a:=wnr*14 + vga.del_win(wnr) + wind[a]:=0 + + +pri titel(y,x,xx,f1,f2,f3,ff) + vga.displaytile(@tileset[wint[8]*16],f2,f1,ff, y, x) 'linke obere ecke + + W_line(wint[9],x+1, y, xx-1,f2,f1,f3) + vga.displaytile(@tileset[wint[10]*16],f2,f1,ff, y, xx) 'rechte obere ecke + +pri status(y,x,xx,f1,f2,f3) + vga.displaytile(@tileset[wint[15]*16],f2,f1,f3, y, x) 'linke untere ecke + + W_line(wint[14],x+1, y, xx-1,f2,f1,f3) + vga.displaytile(@tileset[wint[16]*16],f2,f1,f3, y, xx) 'rechte untere ecke + +pri W_line(tinr,x,y,xx,f1,f2,f3)|i + repeat i from x to xx + vga.displaytile(@tileset[tinr*16],f1,f2,f3, y, i) + +pri rahmen(y,x,yy,xx,modus,f1,f2,f3)|i + if modus==2 or modus==5 + vga.displaytile(@tileset[wint[0]*16],f2,f1,f3, y, x) 'links oben + repeat i from x+1 to xx-1 + vga.displaytile(@tileset[wint[1]*16],f2,f1,f3, y, i) 'oberer rand + + vga.displaytile(@tileset[wint[2]*16],f2,f1,f3, y, xx) 'rechts oben + + repeat i from y+1 to yy-1 + vga.displaytile(@tileset[wint[7]*16],f2,f1,f3, i, x) 'linker rand + if modus==2 or modus==4 or modus==7 + vga.displaytile(@tileset[wint[3]*16],f2,f1,f3, i, xx) 'rechter rand ohne pfeile + if modus==5 or modus==6 or modus==8 + vga.displaytile(@tileset[wint[12]*16],f2,f1,f3, i, xx) 'rechter rand mit pfeilen + + repeat i from x+1 to xx-1 + vga.displaytile(@tileset[wint[5]*16],f2,f1,f3, yy, i) 'unterer rand + vga.displaytile(@tileset[wint[6]*16],f2,f1,f3, yy, x) 'linke untere ecke + vga.displaytile(@tileset[wint[4]*16],f2,f1,f3, yy, xx) 'rechte untere ecke + +pri pfeile(y,yy,xx,f1,f2,f3,modus) + if modus==6 or modus==8 + y+=1 + if modus==8 + yy-=1 + vga.displaytile(@tileset[wint[11]*16],f2,f1,f3, y, xx) + vga.displaytile(@tileset[wint[13]*16],f2,f1,f3, yy, xx) 'unterer pfeil + + +pub Backup_Area|x,y,xx,yy,a,b + x:=bus_getchar + y:=bus_getchar + xx:=bus_getchar + yy:=bus_getchar + repeat b from y to yy + repeat a from x to xx + sub_putlong(vga.backup_chroma(a,b)) + sub_putword(vga.backup_luma(a,b)) +pub Restore_area|x,y,xx,yy,a,b + x:=bus_getchar + y:=bus_getchar + xx:=bus_getchar + yy:=bus_getchar + repeat b from y to yy + repeat a from x to xx + vga.restore_chroma(a,b,sub_getlong) + vga.restore_luma(a,b,sub_getword) + +pub mousebound + xbound :=sub_getlong + ybound:=sub_getlong + xxbound :=sub_getlong + yybound:=sub_getlong + +pub getx |x + x:=vga.getx + bus_putchar(x) +pub gety |y + y:=vga.gety + bus_putchar(y) + +pub mousex + + bus_putchar(XPOS>>4) + +pub mousey + + bus_putchar(YPos>>4) + +pub mousez + sub_putlong(mouse.abs_z) + +pub mouse_button(b)|i,knopf,xp,yp,c + knopf:=0 + xp:=XPOS>>4 + yp:=YPOS>>4 + c:=mouse.button(b) + if mouse.button(0) 'linke mousetaste gedrueckt? + repeat i from 1 to buttonbuff-1 'alle Buttonparameter durchsuchen + if bnumber[i] + if xp=>bx[i] and xp=< bxx[i] and yp==by[i] 'abfrage auf Buttonposition + c:=i 'gefunden ! + quit + bus_putchar(c) 'ansonsten 255 senden + +pub BoxSize|win,y,x,yy,xx + win:=bus_getchar + y:=bus_getchar + x:=bus_getchar + yy:=bus_getchar + xx:=bus_getchar + vga.printBoxSize(win,y,x,yy,xx) + +pub PrintBoxColor|w,v,h,cur + w:=bus_getchar + v:=bus_getchar + h:=hintergr:=bus_getchar + cur:=bus_getchar + vga.printBoxColor(w,v,h) 'fenster vorder und hintergrundfarbe setzen + vga.printCursorColor(cur) 'Cursorfarbe setzen + +pub setpos(y,x) + y:=bus_getchar + x:=bus_getchar + vga.printat(y,x) + +PUB pchar(c) 'screen: zeichen auf bildschirm ausgeben +{{zeichen auf bildschirm ausgeben}} + vga.printqChar(c) + +PUB scrollup | lines,farbe,y,x,yy,xx,rate + lines:=bus_getchar + farbe:=bus_getchar + y :=bus_getchar + x :=bus_getchar + yy :=bus_getchar + xx :=bus_getchar + rate :=bus_getchar + vga.scrollup(lines,farbe,y,x,yy,xx,rate) 'screen: scrollt den screen nach oben + +PUB scrolldown | lines,farbe,y,x,yy,xx,rate + lines:=bus_getchar 'screen: scrollt den screen nach unten + farbe:=bus_getchar + y :=bus_getchar + x :=bus_getchar + yy :=bus_getchar + xx :=bus_getchar + rate :=bus_getchar + vga.scrolldown(lines,farbe,y,x,yy,xx,rate) + +pub display3DBox|top,center,bott,y,x,yy,xx + top:=bus_getchar + center:=bus_getchar + bott:=bus_getchar + y :=bus_getchar + x :=bus_getchar + yy :=bus_getchar + xx :=bus_getchar + + vga.display3DBox(top, center, bott, y,x,yy,xx) + +pub display3DFrame|top,center,bott,y,x,yy,xx + top:=bus_getchar + center:=bus_getchar + bott:=bus_getchar + y :=bus_getchar + x :=bus_getchar + yy :=bus_getchar + xx :=bus_getchar + + vga.display3DFrame(top, center, bott, y,x,yy,xx) + +pub Get_Button_Param|number,y,x,xx + number:=bus_getchar + x :=bus_getchar + y :=bus_getchar + xx :=bus_getchar + + bx[number] :=x + by[number] :=y + bxx[number] :=xx + bnumber[number]:=number + +pub destroy_Button|number + number:=bus_getchar + vga.display2DBox(hintergr,by[number],bx[number],by[number],bxx[number]) + bnumber[number]:=0 + +pub display2DBox|farbe,y,x,yy,xx,shd + farbe:=bus_getchar + y :=bus_getchar + x :=bus_getchar + yy :=bus_getchar + xx :=bus_getchar + shd :=bus_getchar + if shd + vga.display2DBox($56,y+1,x+1,yy+1,xx+1) + vga.display2DBox(farbe,y,x,yy,xx) + +pub scrollString|rate,vorder,hinter,y,x,xx,i,len',dir + rate :=bus_getchar + vorder:=bus_getchar + hinter:=bus_getchar + y :=bus_getchar + x :=bus_getchar + xx :=bus_getchar + len :=bus_getchar + repeat len + byte[@strkette][i++]:=bus_getchar + vga.scrollstring(@strkette,rate, vorder, hinter, y, x, xx) + bytefill(@strkette,0,40) 'stringbuffer wieder loeschen + +pub displayString|vorder,hinter,y,x,c,len + vorder:=bus_getchar + hinter:=bus_getchar + y :=bus_getchar + x :=bus_getchar + len :=bus_getchar + repeat len + c:=bus_getchar + vga.displaycharacter(c, vorder, hinter, y, x) + x++ + +pub displayTile|pcol,scol,tcol,y,x 'einzelnes Tile anzeigen + tnr:=bus_getchar + pcol:=bus_getchar + scol:=bus_getchar + tcol:=bus_getchar + y:=bus_getchar + x:=bus_getchar + + vga.displaytile(@tileset[tnr*16],pcol,scol,tcol, y, x) + +pub loadtile|anzahl,i 'Tileset in buffer laden + + anzahl:=sub_getlong + repeat i from 0 to anzahl-1 + tileset[i]:=sub_getlong + +pub mousepointer|i + repeat i from 0 to 15 + mousetile[i]:=sub_getlong + vga.mouseCursorTile(@mousetile) + +pub displaypic|pcol,scol,tcol,y,x,ytile,xtile,xx,c 'komplettes Tileset anzeigen + pcol:=bus_getchar + scol:=bus_getchar + tcol:=bus_getchar + y:=bus_getchar + x:=bus_getchar + ytile:=bus_getchar + xtile:=bus_getchar + xx:=x + c:=0 + repeat ytile '9 + repeat xtile '11 + + vga.displayTile(@tileset[c], pcol, scol, tcol, y, xx++) + c+=16 + y++ + xx:=x +pub displaymouse |on,farbe,i + on:=bus_getchar + farbe:=bus_getchar + if on==1 + vga.mouseCursorColor(farbe) + vga.mouseCursorTile(vga.displayCursor) + mouseshow :=1 + repeat i from 0 to buttonbuff-1 'buttonanzahl zuruecksetzen + bnumber[i]:=0 + + else + vga.mouseCursorTile(0) + mouseshow :=0 + +PUB line(x0, y0, x1, y1, frbe) | dX, dY, x, y, err, stp + result := ((||(y1 - y0)) > (||(x1 - x0))) + if(result) + swap(@x0, @y0) + swap(@x1, @y1) + if(x0 > x1) + swap(@x0, @x1) + swap(@y0, @y1) + dX := (x1 - x0) + dY := (||(y1 - y0)) + err := (dX >> 1) + stp := ((y0 => y1) | 1) + y := y0 + repeat x from x0 to x1 + if(result) + vga.Plot(frbe,x,y) + else + vga.Plot(frbe,y,x) + err -= dY + if(err < 0) + y += stp + err += dX + +PRI swap(x, y) + result := long[x] + long[x] := long[y] + long[y] := result +con '************************************************ Spriteparameter ********************************************************** +pub Actor_Parameter|i + + repeat 4 + actor[i++]:=bus_getchar 'tilenr1 +' actor[1]:=bus_getchar 'farbe1 +' actor[2]:=bus_getchar 'farbe2 +' actor[3]:=bus_getchar 'farbe3 + action_x:=bus_getchar + action_y:=bus_getchar + + vga.dispBackup(action_y, action_x,9) + vga.displaytile(@tileset[actor[0]*16],actor[1],actor[2],actor[3], action_y, action_x) + old_action_x:=action_x + old_action_y:=action_y +pub Change_Backuptile|tinr,f1,f2,f3 'Backuptile unter dem Player ändern (für eingesammelte Items) + + tinr:=bus_getchar + f1:=bus_getchar + f2:=bus_getchar + f3:=bus_getchar + + vga.Change_Backup(@tileset[tinr*16],f1,f2,f3) + +pub Get_Actor_Pos|a + a:=bus_getchar + case a + 1:bus_putchar(action_x) + 2:bus_putchar(action_y) + +pub Set_Actor_XY|k + k:=bus_getchar + actorxy(k) + +pub actorxy(k)|b + + case k + action_key[0]:action_x-- + b:=1 + action_key[1]:action_x++ + b:=1 + action_key[2]:action_y-- + b:=1 + action_key[3]:action_y++ + b:=1 + + if action_x<1 + action_x:=0 + if action_x>39 + action_x:=39 + if action_y<1 + action_y:=0 + if action_y>29 + action_y:=29 + + if b==1 + playermove + +pri playermove + vga.dispRestore(old_action_y, old_action_x,9) + vga.dispBackup(action_y, action_x,9)', farbe) + vga.displaytile(@tileset[actor[0]*16],actor[1],actor[2],actor[3], action_y, action_x) + old_action_x:=action_x + old_action_y:=action_y + +pub Sprite_Parameter|nur + nur:=bus_getchar + nur-=1 + spritenr[nur]:=bus_getchar + spritenr[nur+8]:=bus_getchar + spritef1[nur]:=bus_getchar + spritef2[nur]:=bus_getchar + spritef3[nur]:=bus_getchar + sprite_dir[nur]:=bus_getchar 'richtung + sprite_start[nur]:=bus_getchar 'startposition + sprite_end[nur]:=bus_getchar 'endposition + sprite_x[nur]:=bus_getchar 'x + sprite_y[nur]:=bus_getchar 'y + + vga.dispBackup(sprite_y[nur], sprite_x[nur],nur) + vga.displaytile(@tileset[spritenr[nur]*16],spritef1[nur],spritef2[nur],spritef3[nur], sprite_y[nur], sprite_x[nur]) + sprite_old_y[nur]:=sprite_y[nur] + sprite_old_x[nur]:=sprite_x[nur] + +pub SpriteMove|nur + nur:=bus_getchar + case nur + 0:Sprite_move:=0 + 1:Sprite_move:=1 + 2:Reset_Sprite +pub get_block|a,b + a:=bus_getchar + b:=bus_getchar + block_tile[a]:=b + +pub Set_sprite_XY|num,vx,vy,p,b + if sp_alter==0 'zweites Sprite-Tile + sp_alter:=8 + else + sp_alter:=0 'erstes Sprite-Tile + + repeat num from 0 to 7 + + if spritenr[num]<175 'sprite belegt? + case sprite_dir[num] + 1:sprite_x[num]-- + if sprite_x[num]sprite_end[num] 'endpos erreicht dann richtung umkehren + sprite_dir[num]:=1 + 3:sprite_y[num]-- + if sprite_y[num]sprite_end[num] 'endpos erreicht dann richtung umkehren + sprite_dir[num]:=3 + 5:'einfacher verfolgermodus + vx:=(action_x-sprite_x[num]) 'Abstand zur Spielerfigur x-Richtung + vy:=(action_y-sprite_y[num]) 'Abstand zur Spielerfigur y-Richtung + + if vy<0 + p:=((sprite_y[num]-1)*40)+sprite_x[num] + b:=position(p) + if b==0 + sprite_y[num]-- + if sprite_y[num]<1 + sprite_y[num]:=1 + if vy>0 + p:=((sprite_y[num]+1)*40)+sprite_x[num] + b:=position(p) + if b==0 + sprite_y[num]++ + if sprite_y[num]>29 + sprite_y[num]:=29 + if vx<0 + p:=(sprite_y[num]*40)+(sprite_x[num]-1) + b:=position(p) + if b==0 + sprite_x[num]-- + if sprite_x[num]<1 + sprite_x[num]:=1 + if vx>0 + p:=(sprite_y[num]*40)+(sprite_x[num]+1) + b:=position(p) + if b==0 + sprite_x[num]++ + if sprite_x[num]>29 + sprite_x[num]:=29 + vga.dispRestore(sprite_old_y[num], sprite_old_x[num],num) + vga.dispBackup(sprite_y[num], sprite_x[num],num) + vga.displaytile(@tileset[spritenr[num+sp_alter]*16],spritef1[num],spritef2[num],spritef3[num], sprite_y[num], sprite_x[num]) + sprite_old_x[num]:=sprite_x[num] + sprite_old_y[num]:=sprite_y[num] + +pub position(tr):bl|i,block + block:=read_block(tr) + bl:=0 + repeat i from 0 to 9 + if block==block_tile[i] + bl:=1 + +pub read_block(num):wert|i + wert:=vga.getblock(num) + repeat i from 0 to 175 'Tiles im Tileset mit Wert vergleichen + if wert== @tileset[i*16] + quit + +pub Reset_Sprite|i + repeat i from 0 to 7 + if spritenr[i]<177 + vga.dispRestore(sprite_old_y[i], sprite_old_x[i],i) 'sprite reset + spritenr[i]:=255 + vga.dispRestore(old_action_y, old_action_x,9) 'Player reset + Sprite_move:=0 'spritebewegung deaktivieren + collision:=0 + +pub Set_Action_Key|i + repeat 5 + action_key[i++]:=bus_getchar +{ action_key[1]:=bus_getchar + action_key[2]:=bus_getchar + action_key[3]:=bus_getchar + action_key[4]:=bus_getchar +} +pub Displaypalette|farbe,hy,hx,a + hx:=bus_getchar + hy:=bus_getchar + a:=hx + farbe:=0 + repeat 4 + repeat 16 + vga.plot(farbe,hy,hx) + hx++ + farbe+=4 + hx:=a + hy++ + +DAT + + + org +' +' Entry: dummy-assemblercode fuer cogtest +' +entry jmp entry 'just loops + + +tileset long 0[2816] + + +DAT + +{{ + +┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ TERMS OF USE: MIT License │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation │ +│files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, │ +│modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│ +│is furnished to do so, subject to the following conditions: │ +│ │ +│The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│ +│ │ +│THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE │ +│WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR │ +│COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, │ +│ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} diff --git a/source/dos-shell.spin b/source/dos-shell.spin new file mode 100644 index 0000000..95a1fa7 --- /dev/null +++ b/source/dos-shell.spin @@ -0,0 +1,1919 @@ +{{ +┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Autor: Ingo Kripahle │ +│ Copyright (c) 2010 Ingo Kripahle │ +│ See end of file for terms of use. │ +│ Die Nutzungsbedingungen befinden sich am Ende der Datei │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────┘ + +Informationen : hive-project.de +Kontakt : drohne235@googlemail.com +System : TriOS +Name : Regime +Chip : Regnatix +Typ : Programm +Version : 00 +Subversion : 02 + +Funktion : "Regime" ist ein einfacher Kommandozeileninterpreter. + +Logbuch : + +22-03-2010-dr235 - anpassung trios +10-04-2010-dr235 - alternatives dir-marker-system eingefügt +17-04-2010-dr235 - dm-user wird jetzt auch beim start aus dem aktuellen dir gesetzt +30-04-2010-dr235 - mount robuster gestaltet +19-09-2010-dr235 - integration ramdisk + - kommandos: xdir, xdel, xrename, xload, xsave, xtype +20-09-2010-dr235 - blocktransfer für xload/xsave (wesentlich bessere geschwindigkeit!!!) +Kommandoliste: +- siehe regime.txt + +25-02-2014 - Integration von Regime in Plexus begonnen -> soll die DOS-Shell von Plexus werden + +28-02-2014 - optische Anpassung an Plexus, Handling entsprechend angepasst (Fenster und Menues) + - Ram-Disk-Funktionen entfernt (Plexus benutzt den Ram, daher keine Ram-Disk Funktion möglich) + - Funktionen aus Perplex (Sepia-Karten-Funktionen) übernommen und an die neuen Administra-Sepia-Funktionen angepasst + - 4528 Longs frei + +16-03-2014 -DCF-Indikator in Titelleiste eingebaut + -4501 Longs frei + +29-03-2014 -Fehler im Aufruf der Hilfe-Funktion behoben, durch das Plexus-Verzeichnis wurde die Hilfe-Datei nicht mehr gefunden + -dies wurde durch Setzen des Systemdirmarkers behoben + -4473 Longs frei +}} + +OBJ + ios: "reg-ios-64" + str: "glob-string" + numm: "glob-numbers" + +CON + +_CLKMODE = XTAL1 + PLL16X +_XINFREQ = 5_000_000 + +OS_TIBLEN = 64 'größe des inputbuffers +OS_MLEN = 8 +ERAM = 1024 * 512 * 2 'größe eram +HRAM = 1024 * 32 'größe hram + +RMON_ZEILEN = 16 'speichermonitor - angezeigte zeilen +RMON_BYTES = 8 'speichermonitor - zeichen pro byte + + TILE_RAM = $40000 '....$67FFF ' hier beginnt der Tile-Speicher fuer 10 Tiledateien + SYS_FONT = $66800 '....$693FF ' ab hier liegt der System-Font 16kb + MOUSE_RAM = $69400 '....$6943F ' User-Mouse-Pointer 64byte + 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 + +'------------- 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 + +'----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 +'systemvariablen + byte tib[OS_TIBLEN] 'tastatur-input-buffer + byte cmdstr[OS_TIBLEN] 'kommandostring für interpreter + byte token1[OS_TIBLEN] 'parameterstring 1 für interpreter + byte token2[OS_TIBLEN] 'parameterstring 2 für interpreter + byte tibpos 'aktuelle position im tib + byte rows 'aktuelle anzahl der nutzbaren zeilen + byte cols 'aktuelle Anzahl der nutzbaren spalten + byte cog[8] 'array for free-cog counter +' byte act_color 'Speicher für gewählte zeichenfarbe + long startadresse[16] 'startadresse des tiles im eram + byte xtiles[16] 'xtiles fuer tilenr ' + byte ytiles[16] 'ytiles fuer tilenr + byte str0 'String fuer Fontfunktion in Fenstern + byte aktuellestileset 'nummer des aktuellen tilesets + byte mountmarker,tmptime + 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 + + long rootdir 'root-Dirmarker + long userdir 'user-Dirmarker + byte colors[15] 'Farbwerte + byte ma,mb 'Maus-Tasten + byte infomarker + byte buttonx[5],buttony[5] + byte util + '----------- Venatrix Variablen ------------------------------- + byte venatrix 'Venatrix-Marker + '----------- Sepia Variablen ---------------------------------- + byte sepia 'Sepia-Marker + + byte device 'adresse des geöffneten devices + byte polling 'status polling + byte open 'status device + + long systemdir 'system-Dirmarker + byte timezaehler + + '----------- DCF-Indikator ------------------------------------ + byte dcf_on + +dat + root byte "..",0 + 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 | flag ,a,x,y,i,d + + ios.start + ios.sdmount 'sd-card mounten + activate_dirmarker(0) 'ins root + ios.sdchdir(@system) 'System-Verzeichnis lesen + systemdir:=get_dirmarker 'Dir-Marker lesen + + iniload + testfenster + ios.printCursorRate(3) + + + mountmarker:=1 + ios.sddmact(ios#DM_ROOT) 'wieder in userverzeichnis wechseln + rows := 30'ios.belgetrows 'zeilenzahl bei bella abfragen + cols := 40'ios.belgetcols 'spaltenzahl bei bella abfragen + + ios.setpos(28,0) + ios.print(@prompt1) + repeat + + os_cmdinput 'kommandoeingabe + os_cmdint 'kommandozeileninterpreter + +pri testfenster|i,y,a + + window(1,3,2,1,27,38,string("DOS-Shell")) + +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) + ios.printBoxColor(1,colors[act_color],colors[winhcol],0) + + +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 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 + +PRI Print_win(strg,x,y) + printfont(strg,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 Display_Info + infofenster(9,10,33,15,string("Program-Info"),1) 'Info-Fenster anzeigen + Print_win(string("Plexus-DOS-Shell for Hive"),9,10) + Print_win(string("Version 1.0 - 02/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) +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("Info - 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.printCursorRate(0) + 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.printwindow(1) + ios.setpos(28,0) + ios.printCursorRate(3) + +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) +PRI Mouse_Release + repeat while ios.mouse_button(0) 'warten bis Maustaste losgelassen wird + +con '---------------------------------------------- Ausgaberoutinen --------------------------------------------------------------------------------------------------------------- +PRI Win_Tile(nu,ty,tx) + ios.displaytile(nu,colors[winhcol],0,colors[act_color],ty,tx) + +CON ''------------------------------------------------- INTERPRETER + +PUB os_cmdinput | charc ,a,status,k,dk,x,y,i 'sys: stringeingabe eine zeile +''funktionsgruppe : sys +''funktion : stringeingabe eine zeile +''eingabe : - +''ausgabe : - +''variablen : tib - eingabepuffer zur string +'' : tibpos - aktuelle position im tib + + ios.print(@prompt3) + tibpos := 0 + repeat 'tibposition auf anfang setzen + + ma:=ios.mouse_button(0) + time + charc:=ios.key + if charc + if charc==F12_Key + cmd_exit + if charc==F1_Key + cmd_help + charc:=return_key + if charc==F2_Key + Display_Info + + if charc==ESC_KEY or charc==RETURN_KEY + if infomarker==1 + popup_info_weg + charc:=return_key + + ifnot infomarker 'keine Eingabe bei Anzeige des Info-Fensters + if (tibpos + 1) < OS_TIBLEN 'zeile noch nicht zu lang? + case charc + ios#CHAR_BS: 'backspace + if tibpos > 0 'noch nicht anfang der zeile erreeicht? + tib[tibpos--] := 0 'ein zeichen aus puffer entfernen + ios.printbs 'backspace an terminal senden + other: 'zeicheneingabe + if charc==$0D + quit + else + tib[tibpos++] := charc 'zeichen speichern + ios.printchar(charc) 'zeichen ausgeben + +'***************************** 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 + 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("Info - F2"),menuey[i]) + Display_Info + 1:menueselect(string("Help - F1"),menuey[i]) + cmd_help + 2:menueselect(string("-EXIT- F12"),menuey[i]) + cmd_exit + + + +'****************************** Globale Funktionstasten ******************************************************** + if(x=>buttonx[4]) and (x=1 + popup_info_weg + + if y==windowy[2] and x==windowxx[2] and Infomarker==1 + ios.get_window + popup_info_weg + + 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 + cmd_exit + + if (x==0) 'Beenden bei Doppelklick auf linke obere Ecke + if doppelklick>1 + cmd_exit + 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 + ios.printwindow(1) + + else + if infomarker==1 + popup_info_weg + startmenue + popupmarker:=1 + + ios.printnl + tib[tibpos] := 0 'string abschließen + tibpos := charc := 0 'werte rücksetzen + +con'****************************************************** Datum und Zeitanzeige ************************************************************************************************* + +PRI time|s 'Zeitanzeige in der Statusleiste + timezaehler++ + if timezaehler>150 + timezaehler:=0 + show_time + +pri show_time |s + 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'****************************************************** Perplex-Funktionen ************************************************************************************************* +PRI plx_map|ack,adr,n,i + + ios.plxHalt + n := 0 + i := 0 + ios.printcursorrate(0) + ios.printcls + repeat + ios.setpos(0,0) + ios.printnl + ios.print(string(" 0123456789ABCDEF")) + ios.printnl + show_time + repeat adr from 0 to 127 + + ack := ios.plxping(adr) + if n == 0 + ios.printhex(adr,2) + ios.printchar(" ") + if ack + ios.printqchar("┼") + else + ios.printqchar("•") + if n++ == 15 + ios.printnl + n := 0 + ios.printnl + ios.print(string("Scan : ")) + ios.printdec(i++) + until ios.key + ios.printnl + ios.printcursorrate(3) + ios.plxRun + +PRI plx_scan|ack,adr + + ios.plxHalt + ios.printnl + repeat adr from 0 to 127 + ack := ios.plxping(adr) + ifnot ack + ios.print(string("Ping : $")) + ios.printhex(adr,2) + ios.print(string(" : ")) + ios.printdec(adr) + ios.printnl + ios.printnl + ios.plxRun + +PRI plx_put|wert + + 'if open + device:=numm.FromStr(os_nxtoken1,numm#HEX) + wert := numm.FromStr(os_nxtoken2,numm#HEX) + ios.plxOut(device,wert) + 'else + ' ios.print(string("Kein Device geöffnet!")) + ' ios.printnl + +PRI plx_get + '################## das funktioniert noch nicht ?! #################### + 'if open + device:=numm.FromStr(os_nxtoken1,numm#HEX) + ios.print(string("Get : ")) + ios.printhex(ios.plxIn(device),2) + ios.printnl + 'else + ' ios.print(string("Kein Device geöffnet!")) + ' ios.printnl + +PRI plx_test + + 'ios.plxHalt + ios.printcursorrate(0) + ios.printcls + repeat + ios.setpos(0,0) + ios.printnl + print_port(1,ios.getreg(4)) + print_port(2,ios.getreg(5)) + print_port(3,ios.getreg(6)) + ios.printnl + print_chan(0,ios.getreg(0)) + print_chan(1,ios.getreg(1)) + print_chan(2,ios.getreg(2)) + print_chan(3,ios.getreg(3)) + 'ios.plxout($3A,!(cnt>>23)) + show_time + until ios.key + ios.printnl + ios.printcursorrate(3) + 'ios.plxRun + +PRI print_chan(cnr,wert) + + ios.print(string("A/D")) + ios.printdec(cnr) + ios.printchar(" ") + ios.printhex(wert,2) + 'ios.printchar(" ") + ios.printchar("[") + repeat wert>>3 + ios.printqchar("‣") + repeat (255-wert)>>3 + ios.printqchar(" ") + ios.printchar("]") + ios.printnl + +PRI print_port(pnr,wert) + + ios.print(string("Port ")) + ios.printdec(pnr) + ios.print(string(" [")) + + repeat 8 + if wert & 1 + ios.printqchar("‣") + else + ios.printqchar(" ") + wert := wert >> 1 + ios.printchar("]") + ios.printnl +{PRI print_paddle(cnr,wert) + + ios.print(string("Paddle ")) + ios.printdec(cnr) + ios.printchar(" ") + ios.printhex(wert,2) + ios.printchar(" ") + ios.printchar("[") + repeat wert>>3 + ios.printqchar("‣") + repeat (255-wert)>>3 + ios.printqchar(" ") + ios.printchar("]") + ios.printnl + +PRI print_joystick(wert) + + ios.print(string("Joystick ")) + ios.print(string(" [")) + + repeat 8 + if wert & 1 + ios.printqchar("‣") + else + ios.printqchar(" ") + wert := wert >> 1 + ios.printchar("]") + ios.printnl + } +con'****************************************************** Befehlstoken lesen ************************************************************************************************* + +PUB os_nxtoken1: stradr 'sys: token 1 von tib einlesen +''funktionsgruppe : sys +''funktion : nächsten token im eingabestring suchen und stringzeiger übergeben +''eingabe : - +''ausgabe : stradr - adresse auf einen string mit dem gefundenen token +''variablen : tib - eingabepuffer zur string +'' : tibpos - aktuelle position im tib +'' : token - tokenstring + + stradr := os_tokenize(@token1) + +PUB os_nxtoken2: stradr 'sys: token 2 von tib einlesen +''funktionsgruppe : sys +''funktion : nächsten token im eingabestring suchen und stringzeiger übergeben +''eingabe : - +''ausgabe : stradr - adresse auf einen string mit dem gefundenen token +''variablen : tib - eingabepuffer zur string +'' : tibpos - aktuelle position im tib +'' : token - tokenstring + + stradr := os_tokenize(@token2) + +PUB os_tokenize(token):stradr | i 'sys: liest nächsten token aus tib + + i := 0 + if tib[tibpos] <> 0 'abbruch bei leerem string + repeat until tib[tibpos] > ios#CHAR_SPACE 'führende leerzeichen ausbenden + tibpos++ + repeat until (tib[tibpos] == ios#CHAR_SPACE) or (tib[tibpos] == 0) 'wiederholen bis leerzeichen oder stringende + byte[token][i] := tib[tibpos] + tibpos++ + i++ + byte[token][i] := 0 + stradr := token + +PUB os_nextpos: tibpos2 'sys: setzt zeiger auf nächste position +''funktionsgruppe : sys +''funktion : tibpos auf nächstes token setzen +''eingabe : - +''ausgabe : tibpos2 - position des nächsten tokens in tib +''variablen : tib - eingabepuffer zur string +'' : tibpos - aktuelle position im tib + + if tib[tibpos] <> 0 + repeat until tib[tibpos] > ios#CHAR_SPACE 'führende leerzeichen ausbenden + tibpos++ + return tibpos + +PUB os_cmdint 'sys: kommandointerpreter +''funktionsgruppe : sys +''funktion : kommandointerpreter; zeichenkette ab tibpos wird als kommando interpretiert +'' : tibpos wird auf position hinter token gesetzt +''eingabe : - +''ausgabe : - +''variablen : tib - eingabepuffer zur string +'' : tibpos - aktuelle position im tib + + repeat 'kommandostring kopieren + cmdstr[tibpos] := tib[tibpos] + tibpos++ + until (tib[tibpos] == ios#CHAR_SPACE) or (tib[tibpos] == 0) 'wiederholen bis leerzeichen oder stringende + cmdstr[tibpos] := 0 'kommandostring abschließen + os_cmdexec(@cmdstr) 'interpreter aufrufen + tibpos := 0 'tastaturpuffer zurücksetzen + tib[0] := 0 + +DAT ' Kommandostrings + +cmd1 byte "help",0 +cmd2 byte "mount",0 +cmd3 byte "dir",0 +cmd4 byte "type",0 +cmd5 byte "rload",0 +cmd6 byte "cls",0 +cmd7 byte "bload",0 +cmd8 byte "del",0 +cmd9 byte "unmount",0 +cmd10 byte "free",0 +cmd11 byte "attrib",0 +cmd12 byte "cd",0 +cmd13 byte "aload",0 +cmd14 byte "mkdir",0 +cmd15 byte "rename",0 +cmd16 byte "format",0 +cmd17 byte "reboot",0 +cmd18 byte "sysinfo",0 +cmd19 byte "color",0 +cmd20 byte "cogs",0 +cmd21 byte "dm",0 +cmd22 byte "dmset",0 +cmd23 byte "dmclr",0 +cmd24 byte "dmlist",0 +cmd25 byte "debug",0 +cmd26 byte "xload",0 +cmd27 byte "xsave",0 +cmd28 byte "xdir",0 +cmd29 byte "xrename",0 +cmd30 byte "xdel",0 +cmd31 byte "xtype",0 +cmd32 byte "forth",0 +cmd33 byte "admdmp",0 +cmd34 byte "beldmp",0 +cmd35 byte "regdmp",0 +cmd36 byte "ramdmp",0 +cmd37 byte "exit",0 +'cmd38 byte "plxadr",0 +'cmd39 byte "plxclose",0 +cmd40 byte "plxput",0 +cmd41 byte "plxget",0 +cmd42 byte "plxmap",0 +cmd43 byte "plxscan",0 +cmd44 byte "plxtest",0 + +PUB os_cmdexec(stradr) |fehler 'sys: kommando ausführen +{{os_smdexec - das kommando im übergebenen string wird als kommando interpretiert + stradr: adresse einer stringvariable die ein kommando enthält}} +fehler:=0 + +if strcomp(stradr,@cmd14) 'mkdir - verzeichnis erstellen + cmd_mkdir +elseif strcomp(stradr,@cmd15) 'rename - datei/verzeichnis umbenennen + cmd_rename +elseif strcomp(stradr,@cmd16) 'format - sd-card formatieren + cmd_format +elseif strcomp(stradr,@cmd17) 'reboot + cmd_reboot +elseif strcomp(stradr,@cmd18) 'sysinfo + cmd_sysinfo +elseif strcomp(stradr,@cmd19) 'color + cmd_color +elseif strcomp(stradr,@cmd20) 'cogs + cmd_cogs +elseif strcomp(stradr,@cmd21) 'dm + cmd_dm +elseif strcomp(stradr,@cmd22) 'dmset + cmd_dmset +elseif strcomp(stradr,@cmd23) 'dmclr + cmd_dmclr +elseif strcomp(stradr,@cmd24) 'dmlist + cmd_dmlist +'elseif strcomp(stradr,@cmd25) 'debug +' cmd_debug +elseif strcomp(stradr,@cmd1) 'help + cmd_help +elseif strcomp(stradr,@cmd2) 'mount - sd-card mounten + cmd_mount(0) +elseif strcomp(stradr,@cmd3) 'dir - verzeichnis anzeigen + cmd_dir +elseif strcomp(stradr,@cmd4) 'type - textdatei auf bildschirm ausgeben + cmd_type +elseif strcomp(stradr,@cmd5) 'rload - lade regnatix-code + os_load +elseif strcomp(stradr,@cmd6) 'cls - bildschirm löschen + ios.printcls + ios.setpos(28,0) +elseif strcomp(stradr,@cmd7) 'bload - lade bellatrix-code + cmd_bload +elseif strcomp(stradr,@cmd8) 'del - datei löschen + cmd_del +elseif strcomp(stradr,@cmd9) 'unmount - medium abmelden + cmd_unmount +elseif strcomp(stradr,@cmd10) 'free - anzeige datenträgerbelegung + cmd_free +elseif strcomp(stradr,@cmd11) 'attrib - attribute ändern + cmd_attrib +elseif strcomp(stradr,@cmd12) 'cd - verzeichnis wechseln + cmd_cd +elseif strcomp(stradr,@cmd13) 'aload - lade administra-code + cmd_aload +'elseif strcomp(stradr,@cmd26) 'xload +' rd_load +'elseif strcomp(stradr,@cmd27) 'xsave +' rd_save +'elseif strcomp(stradr,@cmd28) 'xdir +' rd_dir +'elseif strcomp(stradr,@cmd29) 'xrename +' rd_rename +'elseif strcomp(stradr,@cmd30) 'xdel +' rd_del +'elseif strcomp(stradr,@cmd31) 'xtype +' rd_type +elseif strcomp(stradr,@cmd32) 'forth + reboot +elseif strcomp(stradr,@cmd33) 'admdmp + cmd_admdmp +elseif strcomp(stradr,@cmd34) 'beldmp + cmd_beldmp +elseif strcomp(stradr,@cmd35) 'regdmp + cmd_regdmp +elseif strcomp(stradr,@cmd36) 'ramdmp + cmd_ramdmp +elseif strcomp(stradr,@cmd37) + cmd_exit +elseif os_testbin(stradr) '.bin +elseif os_testadm(stradr) '.adm +elseif os_testbel(stradr) '.bel +'elseif strcomp(stradr,@cmd38) +' plx_open +'elseif strcomp(stradr,@cmd39) +' plx_close +elseif strcomp(stradr,@cmd40) + plx_put +elseif strcomp(stradr,@cmd41) + plx_get +elseif strcomp(stradr,@cmd42) + plx_map +elseif strcomp(stradr,@cmd43) + plx_scan +elseif strcomp(stradr,@cmd44) + plx_test +else 'kommando nicht gefunden + ios.print(stradr) 'Text mit aktuellen Font darstellen(stradr) + ios.print(@msg3) + fehler:=1 + +ios.print(@prompt1) 'Text mit aktuellen Font darstellen(@prompt1) + + +PUB os_error(err):error 'sys: fehlerausgabe + + if err + ios.printnl + ios.print(@err_s1) + ios.printdec(err) + ios.print(string(" : $")) + ios.printhex(err,2) + ios.printnl + ios.print(@err_s2) + case err + 0: ios.print(@err0) + 1: ios.print(@err1) + 2: ios.print(@err2) + 3: ios.print(@err3) + 4: ios.print(@err4) + 5: ios.print(@err5) + 6: ios.print(@err6) + 7: ios.print(@err7) + 8: ios.print(@err8) + 9: ios.print(@err9) + 10: ios.print(@err10) + 11: ios.print(@err11) + 12: ios.print(@err12) + 13: ios.print(@err13) + 14: ios.print(@err14) + 15: ios.print(@err15) + 16: ios.print(@err16) + 17: ios.print(@err17) + 18: ios.print(@err18) + 19: ios.print(@err19) + 20: ios.print(@err20) + OTHER: ios.print(@errx) + ios.printnl + error := err + +PUB os_load | len,i,stradr1,stradr2 'sys: startet bin-datei über loader +{{ldbin - startet bin-datei über loader}} + ios.paraset(@tib + os_nextpos) 'parameterstring kopieren +' ios.belreset + ios.ldbin(os_nxtoken1) + +PUB os_testbin(stradr): flag | status,i,len 'sys: testet ob das kommando als bin-datei vorliegt +{{testbin(stradr): flag - testet ob das kommando als bin-datei vorliegt + - string bei stradr wird um .bin erweitert + - flag = TRUE - kommando gefunden}} + + flag := FALSE + len := strsize(stradr) + repeat i from 0 to 3 '.bin anhängen + byte[stradr][len + i] := byte[@ext1][i] + byte[stradr][len + i] := 0 + +' im aktuellen dir suchen + ios.sddmset(ios#DM_USER) 'u-marker setzen + status := ios.sdopen("r",stradr) 'datei vorhanden? + if status == 0 'datei gefunden +' ios.belreset + flag := TRUE + ios.paraset(@tib + os_nextpos) 'parameterstring kopieren + + ios.ldbin(stradr) 'anwendung starten + ios.sdclose + +'im system-dir suchen + ios.sddmset(ios#DM_USER) 'u-marker setzen + ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren + status := ios.sdopen("r",stradr) 'datei vorhanden? + if status == 0 'datei gefunden +' ios.belreset + flag := TRUE + ios.paraset(@tib + os_nextpos) 'parameterstring kopieren + + ios.ldbin(stradr) 'anwendung starten + ios.sdclose + ios.sddmact(ios#DM_USER) 'u-marker aktivieren + +'vorbereiten für suche nach anderen dateien + byte[stradr][len] := 0 'extender wieder abschneiden + +PUB os_testadm(stradr): flag | status,i,len 'sys: test ob kommando als adm-datei vorliegt + + flag := FALSE + len := strsize(stradr) + repeat i from 0 to 3 '.adm anhängen + byte[stradr][len + i] := byte[@ext2][i] + byte[stradr][len + i] := 0 + +' im aktuellen dir suchen + status := ios.sdopen("r",stradr) 'datei vorhanden? + if status == 0 'datei gefunden + flag := TRUE + ios.admload(stradr) 'administra-code laden + else 'datei nicht gefunden + ios.sdclose + +'im system-dir suchen + ios.sddmset(ios#DM_USER) 'u-marker setzen + ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren + status := ios.sdopen("r",stradr) 'datei vorhanden? + if status == 0 'datei gefunden + flag := TRUE + ios.admload(stradr) 'administra-code laden + else 'datei nicht gefunden + ios.sdclose + ios.sddmact(ios#DM_USER) 'u-marker aktivieren + + byte[stradr][len] := 0 'extender wieder abschneiden + +PUB os_testbel(stradr): flag | status,i,len 'sys: test ob kommando als bel-datei vorliegt + + flag := FALSE + len := strsize(stradr) + repeat i from 0 to 3 '.bel anhängen + byte[stradr][len + i] := byte[@ext3][i] + byte[stradr][len + i] := 0 + +' im aktuellen dir suchen + status := ios.sdopen("r",stradr) 'datei vorhanden? + if status == 0 'datei gefunden + flag := TRUE + ios.belload(stradr) 'bellatrix-code laden + 'ios.screeninit(0,1) 'systemmeldung + else 'datei nicht gefunden + ios.sdclose + +'im system-dir suchen + ios.sddmset(ios#DM_USER) 'u-marker setzen + ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren + status := ios.sdopen("r",stradr) 'datei vorhanden? + if status == 0 'datei gefunden + flag := TRUE + ios.belload(stradr) 'bellatrix-code laden + 'ios.screeninit(0,1) 'systemmeldung + else 'datei nicht gefunden + ios.sdclose + ios.sddmact(ios#DM_USER) 'u-marker aktivieren + + byte[stradr][len] := 0 'extender wieder abschneiden + +PRI os_printstr(strptr1,strptr2):strptr3 + + ios.print(strptr1) + ios.print(strptr2) + ios.printnl + strptr3 := strptr2 + +PRI os_printdec(strptr, wert):wert2 + + ios.print(strptr) + ios.printdec(wert) + ios.printnl + wert2 := wert + +CON ''------------------------------------------------- KOMMANDOS + +{PRI rd_dir | stradr,len 'rd: dir anzeigen + +if ios.ram_rdbyte(ios#RAMDRV) + 'ios.rd_dir + repeat + 'len := ios.rd_dlen + 'stradr := ios.rd_next + if stradr + ios.print(stradr) + 'ios.printtab + ios.printdec(len) + ios.printnl + until stradr == 0 +else + ios.os_error(1) + +PRI rd_load | stradr,len,fnr,i 'rd: datei in ramdisk laden + +{ stradr := os_nxtoken1 'dateinamen von kommandozeile holen + ifnot ios.os_error(ios.sdopen("r",stradr)) 'datei öffnen + len := ios.sdfattrib(ios#F_SIZE) + ios.rd_newfile(stradr,len) 'datei erzeugen + fnr := ios.rd_open(stradr) + ios.rd_seek(fnr,0) + ios.print(string("Datei laden... ")) + i := 0 + ios.sdxgetblk(fnr,len) 'daten als block direkt in ext. ram einlesen + ios.sdclose + ios.rd_close(fnr) +} +PRI rd_save | stradr,fnr,len,i 'rd: datei aus ramdisk speichern +{ + stradr := os_nxtoken1 + fnr := ios.rd_open(stradr) + ifnot fnr == -1 + len := ios.rd_len(fnr) + ifnot ios.os_error(ios.sdnewfile(stradr)) + ifnot ios.os_error(ios.sdopen("W",stradr)) + ios.print(string("Datei schreiben... ")) + i := 0 + ios.sdxputblk(fnr,len) 'daten als block schreiben + ios.sdclose + ios.printnl + ios.rd_close(fnr) +} +PRI rd_rename 'rd: datei in ramdisk umbenennen + +' ios.os_error(ios.rd_rename(os_nxtoken1,os_nxtoken2)) + +PRI rd_del | adr 'rd: datei löschen + +' ios.os_error(ios.rd_del(os_nxtoken1)) + +PRI rd_type | stradr,len,fnr 'rd: text ausgeben + +{ stradr := os_nxtoken1 'dateinamen von kommandozeile holen + fnr := ios.rd_open(stradr) 'datei öffnen + ifnot fnr == -1 + len := ios.rd_len(fnr) + ios.rd_seek(fnr,0) + repeat len + ios.printchar(ios.rd_get(fnr)) + ios.rd_close(fnr) +} +} +{PUB cmd_debug|stradr,len,fnr,i,x 'cmd: temporäre debugfunktion + + ios.print(string("Debug : ")) + ios.printnl + stradr := os_nxtoken1 'dateinamen von kommandozeile holen + ifnot ios.os_error(ios.sdopen("r",stradr)) 'datei öffnen + len := ios.sdfattrib(ios#F_SIZE) + ios.rd_newfile(stradr,len) 'datei erzeugen + fnr := ios.rd_open(stradr) + ios.rd_seek(fnr,0) + ios.print(string("Datei laden... ")) + i := 0 + x := ios.curgetx + ios.curoff + ios.sdxgetblk(fnr,len) 'daten als block direkt in ext. ram einlesen + ios.print(string("ok")) + ios.curon + ios.sdclose + ios.rd_close(fnr) +} +PUB cmd_dm|wert 'cmd: dir-marker aktivieren + + ios.os_error(ios.sddmact(cmd_dm_nr)) + +PUB cmd_dmset 'cmd: dir-marker setzen + + ios.sddmset(cmd_dm_nr) + +PUB cmd_dmclr 'cmd: dir-marker löschen + + ios.sddmclr(cmd_dm_nr) + +PUB cmd_dmlist 'cmd: dir-marker auflisten + + ios.printBoxColor(1,colors[act_color],colors[winhcol],0) + ios.print(@msg25) + cmd_dm_status(ios#DM_ROOT) + ios.print(@msg24) + cmd_dm_status(ios#DM_SYSTEM) + ios.print(@msg26) + cmd_dm_status(ios#DM_USER) + ios.printBoxColor(1,colors[act_color],colors[winhcol],0) + ios.print(@msg27) + cmd_dm_status(ios#DM_A) + ios.print(@msg28) + cmd_dm_status(ios#DM_B) + ios.print(@msg29) + cmd_dm_status(ios#DM_C) + +PRI cmd_dm_status(markernr) + + if ios.sddmget(markernr) == TRUE + ios.print(@msg31) + else + ios.print(@msg30) + +PRI cmd_dm_nr:wert + + case byte[os_nxtoken1] + "r": wert := 0 'root + "s": wert := 1 'system + "u": wert := 2 'user + "a": wert := 3 'marker a + "b": wert := 4 'marker b + "c": wert := 5 'marker c + other: wert := 0 + +PUB cmd_color 'cmd: zeichenfarbe wählen + + 'ios.setcolor(str.decimalToNumber(colors[act_color] := os_nxtoken1)) + ios.printBoxColor(1,str.decimalToNumber(colors[act_color]:= os_nxtoken1),colors[winhcol],0) + 'str.decimalToNumber(colors[act_color] := os_nxtoken1) + +PUB cmd_sysinfo 'cmd: systeminformationen anzeigen + + ios.printnl + os_printstr(@msg22,@syst) + os_printstr(@msg14,@prog) + os_printstr(@msg23,@copy) + if ios.sdcheckmounted 'test ob medium gemounted ist + os_printstr(@msg21,ios.sdvolname) + 'ios.printnl +' os_printstr(@msg15,str.numberToBinary(ios#CHIP_VER,32)) + os_printstr(@msg16,str.numberToBinary(ios#CHIP_SPEC,32)) +' os_printstr(@msg17,str.numberToBinary(ios.admgetver,32)) + os_printstr(@msg18,str.numberToBinary(ios.admgetspec,32)) +' os_printstr(@msg19,str.numberToBinary(ios.belgetver,32)) + os_printstr(@msg20,str.numberToBinary(ios.belgetspec,32)) + os_printstr(@msg32,string("40x15"))'str.numberToDecimal(40,4)) + 'os_printstr(@msg33,str.numberToDecimal(15,4)) + ' + os_printstr(@msg34,string("640x480"))'str.numberToDecimal(640,4)) + 'os_printstr(@msg35,str.numberToDecimal(480,4)) + + +PUB cmd_mount(mode) | err 'cmd: mount + + repeat 16 + err := ios.sdmount + ifnot err + mountmarker:=1 + quit + ios.os_error(err) + ifnot err + ifnot mode + ios.print(@msg4) + ios.print(ios.sdvolname) + ios.printnl + ios.print(@msg25) + cmd_dm_status(ios#DM_ROOT) + ios.print(@msg24) + cmd_dm_status(ios#DM_SYSTEM) + ios.printnl + + 'ios.setcolor(colors[act_color]) + +PUB cmd_unmount 'cmd: unmount + + ios.os_error(ios.sdunmount) + mountmarker:=0 + ios.print(string("SD-Card unmounted")) +PUB cmd_free | wert 'cmd: anzeige freier speicher + + os_printstr(@msg5,ios.sdvolname) + wert := os_printdec(@msg6,ios.sdcheckfree*512/1024) + wert += os_printdec(@msg7,ios.sdcheckused*512/1024) + os_printdec(@msg8,wert) + + ios.printnl + ios.print(string("RBAS : $")) + ios.printhex(ios.ram_rdlong(ios#RAMBAS),8) + ios.printnl + ios.print(string("REND : $")) + ios.printhex(ios.ram_rdlong(ios#RAMEND),8) + ios.printnl + ios.print(string("USER : $")) + wert := ios.ram_rdlong(ios#RAMEND) + wert := wert - ios.ram_rdlong(ios#RAMBAS) + ios.printhex(wert,8) + ios.printnl + ios.print(string("RAMDRV : $")) + ios.printhex(ios.ram_rdbyte(ios#RAMDRV),2) + ios.printnl + ios.print(string("SYSVAR : $")) + ios.printhex(ios#SYSVAR,8) + ios.printnl + +PUB cmd_attrib 'cmd: dateiattribute ändern + + ios.os_error(ios.sdchattrib(os_nxtoken1,os_nxtoken2)) + +PUB cmd_rename 'cmd: datei/verzeichnis umbenennen + + ios.os_error(ios.sdrename(os_nxtoken1,os_nxtoken2)) + +PUB cmd_cd 'cmd: verzeichnis wechseln + + ifnot ios.os_error(ios.sdchdir(os_nxtoken1)) + userdir:=get_dirmarker +PUB cmd_mkdir 'cmd: verzeichnis erstellen + + ios.os_error(ios.sdnewdir(os_nxtoken1)) + +PUB cmd_del | stradr,char 'cmd: datei auf sdcard löschen +{{sddel - datei auf sdcard löschen}} + + stradr := os_nxtoken1 'dateinamen von kommandozeile holen + ios.print(@msg2) + if ios.keywait == "j" + ios.os_error(ios.sddel(stradr)) + +PUB cmd_format | stradr 'cmd: sd-card formatieren + + stradr := os_nxtoken1 'dateinamen von kommandozeile holen + ios.print(@msg12) + if ios.keywait == "j" + ios.os_error(ios.sdformat(stradr)) + +PUB cmd_reboot | key, stradr 'cmd: reboot + + ios.print(@msg13) + key := ios.keywait + case key + "c": ios.ram_wrbyte(0,ios#MAGIC) + ios.ram_wrbyte(0,ios#RAMDRV) + ios.admreset + ios.belreset + waitcnt(cnt+clkfreq*3) + reboot + "w": ios.ram_wrbyte(0,ios#SIFLAG) + reboot +pri cmd_exit + + 'ios.display3DBox(255, colors[winhcol], 0, 12, 8, 14, 28) + 'Print_win(string("Return to Plexus..."),9,13) + ios.mousepointer(hour_glass) + cmd_mount(1) + activate_dirmarker(systemdir) 'System-Verzeichnis lesen + ios.sdopen("r",@regsys) + ios.ldbin(@regsys) + +PUB cmd_aload|status,stradr 'cmd: administra-code laden + + stradr := os_nxtoken1 + status := ios.sdopen("r",stradr) + if status == 0 + ios.admload(stradr) 'administra-code laden + else + ios.os_error(status) + +PUB cmd_bload | stradr,status 'cmd: bellatrix-code laden +{{bload - treiber für bellatrix laden}} + + stradr := os_nxtoken1 + status := ios.sdopen("r",stradr) + if status == 0 + ios.belload(stradr) 'treiberupload + 'ios.screeninit(0,1) 'systemmeldung + ios.print(@prog) 'programmversion + else + ios.os_error(status) + +PUB cmd_type | stradr,char,n 'cmd: textdatei ausgeben +{{sdtype - textdatei ausgeben}} + + stradr := os_nxtoken1 'dateinamen von kommandozeile holen + n := 1 + ifnot ios.os_error(ios.sdopen("r",stradr)) 'datei öffnen + repeat 'text ausgeben + if ios.printchar(ios.sdgetc) == ios#CHAR_NL 'zeilenzahl zählen und stop + if ++n == 10 + n := 1 + if ios.keywait == 27 + ios.sdclose + return + until ios.sdeof 'ausgabe bis eof + ios.sdclose 'datei schließen + +PUB cmd_help | i,char,n ,x,y ,stradr,c ,a,b 'cmd: textdatei ausgeben +'ios.printwindow(2) + stradr := @help1 'dateinamen von kommandozeile holen + n := 1 + b:=0 + activate_dirmarker(systemdir) + ifnot ios.os_error(ios.sdopen("r",stradr)) 'datei öffnen + ios.printcls + x:=1 + y:=5 + repeat + c:=ios.sdgetc + + if x==38 or c==10 'zeilenumbruch bei spalte 38 + x:=1 + y+=1 + if y==27 + repeat + a:=ios.key + if a==27 + b:=1 + quit + until a==13 or a==32 'solange bis button 10 gedrückt wurde + if b==1 + ios.sdclose + ios.printcls + ios.setpos(28,0) + return + y:=5 + ios.printcls + if c==10 or c==13 'return oder linefeed nicht als zeichen anzeigen + next + if c>96 + c-=32 + ios.displayTile(c-16,colors[winhcol],0,colors[act_color],y,x) 'text mit systemfont anzeigen + x++ + + until ios.sdeof 'ausgabe bis eof + ios.setpos(28,0) + ios.sdclose + activate_dirmarker(userdir) + +PUB cmd_dir|fcnt,stradr,hflag 'cmd: verzeichnis anzeigen +{{sddir - anzeige verzeichnis}} + + if ios.sdcheckmounted 'test ob medium gemounted ist + + hflag := 1 + stradr := os_nxtoken1 'parameter einlesen + ios.print(@msg10) + ios.print(@msg5) + ios.print(ios.sdvolname) + ifnot ios.os_error(ios.sddir) 'verzeichnis öffnen + if str.findCharacter(stradr,"h") + hflag := 0 + if str.findCharacter(stradr,"w") + fcnt := cmd_dir_w(hflag) + else + fcnt := cmd_dir_l(hflag) 'dir l + ios.printnl + ios.print(@msg10) + ios.print(@msg9) + ios.printdec(fcnt) + else + ios.os_error(1) + +PRI cmd_dir_w(hflag):fcnt|stradr,lcnt,wcnt,a,b,k + + fcnt := 0 + lcnt := (rows - 6)/2 + wcnt := 3 + ios.printnl + repeat while (stradr := ios.sdnext) + ifnot ios.sdfattrib(ios#F_HIDDEN) & hflag 'versteckte dateien anzeigen? + if ios.sdfattrib(ios#F_DIR) 'verzeichnisname + ios.setx(1) + ios.printBoxColor(1,colors[selectcol],colors[winhcol],0) + ios.printchar("*") + ios.print(stradr) + elseif ios.sdfattrib(ios#F_HIDDEN) + ios.setx(2) + ios.printBoxColor(1,colors[messagetextcol],colors[winhcol],0) + str.charactersToLowerCase(stradr) + ios.print(stradr) + else 'dateiname + ios.setx(2) + ios.printBoxColor(1,colors[act_color],colors[winhcol],0) + str.charactersToLowerCase(stradr) + ios.print(stradr) + ifnot wcnt-- + wcnt := 3 + ios.printnl + else + fcnt++ + ifnot --lcnt + lcnt := (rows - 6) /2 + b:=0 + + repeat + a:=ios.mouse_button(0) + k:=ios.key + if a==255 or k == 27 + b:=1 + quit + + until a==1 or k==32 or k==13 + if b==1 + return + +PRI cmd_dir_l(hflag):fcnt|stradr,lcnt,a,b,tmp,k + + fcnt := 0 + lcnt := (rows - 6)/2 + repeat while (stradr := ios.sdnext) + ifnot ios.sdfattrib(ios#F_HIDDEN) & hflag 'versteckte dateien anzeigen? + ios.printnl + if ios.sdfattrib(ios#F_DIR) 'verzeichnisname + ios.setx(1) + ios.printBoxColor(1,colors[selectcol],colors[winhcol],0) + ios.printchar("*") + ios.print(stradr) + elseif ios.sdfattrib(ios#F_HIDDEN) + ios.setx(2) + ios.printBoxColor(1,colors[messagetextcol],colors[winhcol],0) + str.charactersToLowerCase(stradr) + ios.print(stradr) + else 'dateiname + ios.setx(2) + ios.printBoxColor(1,colors[act_color],colors[winhcol],0) + str.charactersToLowerCase(stradr) + ios.print(stradr) + + ios.print(str.numberToDecimal(ios.sdfattrib(ios#F_SIZE),6)) 'dateigröße + + ios.setx(22) 'attribute + if ios.sdfattrib(ios#F_READONLY) + ios.printchar("r") + else + ios.printchar("-") + if ios.sdfattrib(ios#F_HIDDEN) + ios.printchar("h") + else + ios.printchar("-") + if ios.sdfattrib(ios#F_SYSTEM) + ios.printchar("s") + else + ios.printchar("-") + if ios.sdfattrib(ios#F_ARCHIV) + ios.printchar("a") + else + ios.printchar("-") + + ios.setx(27) 'änderungsdatum + ios.print(str.numberToDecimal(ios.sdfattrib(ios#F_CDAY),2)) + ios.printchar(".") + ios.print(str.numberToDecimal(ios.sdfattrib(ios#F_CMONTH),2) + 1) + ios.printchar(".") + ios.print(str.numberToDecimal(ios.sdfattrib(ios#F_CYEAR),4) + 1) + fcnt++ + ifnot --lcnt + lcnt := (rows - 6)/2 + b:=0 + repeat + a:=ios.mouse_button(0) + k:=ios.key + if a==255 or k == 27 + b:=1 + quit + until a==1 or k==32 or k==13 + if b==1 + return +PRI Scan_Expansion_Card|ack,adr,counter_s,counter_V + +'###################################################################################################### +'# Durch diverse Versuche hat sich herausgestellt, das die Ping-Funktion allein nicht ausreicht um # +'# das Vorhandensein der Sepia oder Venatrix-Karte zu detektieren, da eine nicht angeschlossene # +'# eine Null zurückgibt, genauso wie ein angeschlossener I2C-Teilnehmer. Deshalb wird beim Scan die # +'# Anzahl Nullen mit der Gesamtanzahl der Adressen verglichen. Ist die Anzahl zurückgegebener Nullen# +'# mit der Anzahl Adressen identisch, so ist offensichtlich keine Karte vorhanden. Diese Methode # +'# verhindert Fehldetektionen und gerade in Verbindung mit der Venatrixkarte ein Festfahren des HIVE# +'# zum Beispiel bei Aufruf der Cog-Anzeige. # +'###################################################################################################### + + ios.plxHalt + Sepia:=0 + venatrix:=0 + counter_s:=0 + counter_v:=0 + repeat adr from 32 to 79 'standard-Sepia-Adressbereich $20-$4f + ack := ios.plxping(adr) + + ifnot ack + counter_s++ 'Anzahl der vorhandenen I2C-Teilnehmer + + repeat adr from 0 to 5 + if ios.plxping(adr) + counter_v++ + + ios.plxRun + if counter_s<48 + sepia:=1 + if counter_v==5 + Venatrix:=1 +PUB cmd_cogs | i,l 'cmd: belegung der cogs anzeigen + + ios.print(@cogs4) + ios.printnl + + i := ios.reggetcogs 'regnatix + cmd_cogs_print(8-i,i,@cogs1) + + i := ios.admgetcogs 'administra + cmd_cogs_print(8-i,i,@cogs2) + + i := ios.belgetcogs 'bellatrix + cmd_cogs_print(8-i,i,@cogs3) + + Scan_Expansion_Card 'nach Venatrix-Karte scannen + if venatrix + i := ios.VEN_GETCOGS + cmd_cogs_print(8-i,i,@cogs6) + + ios.printBoxColor(1,colors[act_color],colors[winhcol],0) + ios.print(@cogs4) + ios.printnl + ios.print(string(" (")) + ios.printBoxColor(1,$80,colors[winhcol],0) + ios.print(string("•")) + ios.printBoxColor(1,colors[act_color],colors[winhcol],0) + ios.print(@cogs5) + ios.printnl + +PRI cmd_cogs_print(used,free,stradr) + + ios.print(stradr) + if used > 0 + repeat + ios.printBoxColor(1,$80,colors[winhcol],0) + ios.print(string("•")) + used-- + until used == 0 + if free > 0 + repeat + ios.printBoxColor(1,green,colors[winhcol],0) + ios.print(string("•")) + free-- + until free == 0 + + ios.printBoxColor(1,colors[act_color],colors[winhcol],0) + ios.printnl +pri cmd_admdmp |stradr + ifnot (stradr := getanynumber(os_nxtoken1)) + ' ios.beldmp(stradr) + +pri cmd_beldmp |stradr + if (stradr := getanynumber(os_nxtoken1))> -1 + ' ios.beldmp(stradr) + +pri cmd_regdmp|stradr + if (stradr := getanynumber(os_nxtoken1))> -1 + ios.Dump(stradr,100,0) +pri cmd_ramdmp|stradr + + if (stradr := getanynumber(os_nxtoken1))> -1 + ios.Dump(stradr,100,1) +pri cmd_ramdmp1|stradr + Dump(0,$1F400,1) + +PUB Dump(adr,lines,mod) |zeile ,a,b 'adresse, anzahl zeilen,ram oder xram + zeile:=0 + repeat lines + ios.printnl + ios.printhex(adr,5) + ios.printchar(":") + 'printchar(" ") + + repeat 8 + if mod>0 + ios.printhex(ios.ram_rdbyte(adr++),2) + else + ios.printhex(byte[adr++],2) + ios.printchar(" ") + + adr := adr - 8 + repeat 8 + if mod>0 + ios.printqchar(ios.ram_rdbyte(adr++)) + else + ios.printqchar(byte[adr++]) + zeile++ + if zeile == 12 + ios.printnl + ios.print(string("")) + b:=0 + repeat + a:=ios.mouse_button(0) + if a==255 'ios.keywait == 27 + b:=1 + quit + ' if a==6 + ' quit + until a==6 + if b==1 + quit + zeile:=0 + +PRI getAnyNumber(tp) | c, t,fnumber,i,count,quote + 'quote:=34 + count:=0 + case c := byte[tp] + 'quote: + ' if result := byte[++tp] + ' if byte[++tp] == quote + ' tp++ + ' else + ' abort @msg3'string("missing closing quote") + ' else + ' abort @msg3'string("end of line in string") + "$": + c := byte[++tp] + if (t := hexDigit(c)) < 0 + ios.print(@msg3) + result:=-1 + + result := t + c := byte[++tp] + repeat until (t := hexDigit(c)) < 0 + result := result << 4 | t + c := byte[++tp] + "%": + c := byte[++tp] + if not (c == "0" or c == "1") + result:=-1 + ios.print( @msg3) + + result := c - "0" + c := byte[++tp] + repeat while c == "0" or c == "1" + result := result << 1 | (c - "0") + c := byte[++tp] + + "0".."9": 'Originalcode + result := c - "0" + c := byte[++tp] + repeat while c => "0" and c =< "9" + result := result * 10 + c - "0" + c := byte[++tp] + other: + result:=-1 + ios.print(@msg3) + + +PRI hexDigit(c) +'' Convert hexadecimal character to the corresponding value or -1 if invalid. + if c => "0" and c =< "9" + return c - "0" + if c => "A" and c =< "F" + return c - "A" + 10 + if c => "a" and c =< "f" + return c - "a" + 10 + return -1 + +DAT 'strings +'system1 byte "▶Hive: Regime", 0 +syst byte "Plexus",0 +prog byte "DOS-Shell",0 +copy byte "20-02-2014 • zille9",0 +prompt1 byte "ok", $0D,0 +prompt2 byte "~ ", 0 +prompt3 byte "∞ ", 0 +msg1 byte "Datei nicht gefunden!",0 +msg2 byte "Datei löschen? : ",0 +msg3 byte " ? ",0 +msg4 byte "Volume : ",0 +msg5 byte "Datenträger : ",0 +msg6 byte "Frei : ",0 +msg7 byte "Belegt : ",0 +msg8 byte "Gesamt : ",0 +msg9 byte "Anzahl der Dateien : ",0 +msg10 byte "• ",0 +msg11 byte " KB",0 +msg12 byte "SD-Card formatieren? : ",0 +msg13 byte "Neu starten? <[c]old/[w]arm/*> : ",0 +msg14 byte "CLI : ",0 +msg15 byte "RegVer:",0 +msg16 byte "RegSpc:",0 +msg17 byte "AdmVer:",0 +msg18 byte "AdmSpc:",0 +msg19 byte "BelVer:",0 +msg20 byte "BelSpc:",0 +msg21 byte "Medium : ",0 +msg22 byte "OS : ",0 +msg23 byte "Copyright : ",0 +msg24 byte "[S]ystem : ",0 +msg25 byte "[R]oot : ",0 +msg26 byte "[U]ser : ",0 +msg27 byte "Marker [A] : ",0 +msg28 byte "Marker [B] : ",0 +msg29 byte "Marker [C] : ",0 +msg30 byte "gesetzt",13,0 +msg31 byte "frei",13,0 +msg32 byte "Bellatrix Spalten/Zeilen: ",0 +'msg33 byte "Bellatrix Textzeilen : ",0 +msg34 byte "Bellatrix Auflösung : ",0 +'msg35 byte "Bellatrix Auflösung Y : ",0 +ext1 byte ".BIN",0 +ext2 byte ".ADM",0 +ext3 byte ".BEL",0 +wait1 byte "",0 + +cstr byte "••••••••",0 +cogs1 byte "Regnatix : ",0 +cogs2 byte "Administra: ",0 +cogs3 byte "Bellatrix : ",0 +cogs6 byte "Venatrix : ",0 +cogs4 byte "────────────────────",0 +cogs5 byte " = running cog)",0 + +help1 byte "dos.txt",0 +'gdriver byte "bel.sys", 0 'name des grafiktreibers + +{ +help1 file "regime.txt" + byte 13,0 +} + + + + +con '********************************* Unterprogramme zur Tile-Verwaltung ********************************************************************************************************* +{pri LoadTiletoRam(datei)|c,adress ,count 'tile:=tilenr,dateiname,xtile-zahl,ytilezahl + + count:=11264 '(16*11*64 (64 byte sind 16longs)) + adress:=$66800 'Systemfont-Bereich (Basic verwendet den gleichen Bereich) + ios.sddmset(ios#DM_ROOT) + os_error(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|c,adress,anzahl 'tileset aus eram in bella laden + + anzahl:=2816 'anzahl longs '(16*11*16longs) + ios.loadtilebuffer($66800,anzahl) 'laden 'Systemfont-Bereich (Basic verwendet den gleichen Bereich) +} +{pri printfont(str1,a,b,c,d,e)|f,n + + repeat strsize(str1) + f:= byte[str1++] + if d>39 'wenn Bildschirmrand erreicht, neue Zeile + d:=0 + e++ + if f>96 + f-=32 + ios.displayTile(f,a,b,c,e,d) 'einzelnes Tile anzeigen ('displayTile(tnr,pcol,scol,tcol, row, column)) + + d++ + } +{pri close + sdset(0) 'ins root + ios.sdclose + ios.sdunmount +PRI mount + ios.sdmount + sdset(0) +pri sdset(str1) 'Verzeichniswechsel + ios.sdchdir(str1) + ios.sddmset(str1) + } +DAT 'systemfehler +err_s1 byte "Fehlernummer : ",0 +err_s2 byte "Fehler : ",0 + +err0 byte "no error",0 +err1 byte "fsys unmounted",0 +err2 byte "fsys corrupted",0 +err3 byte "fsys unsupported",0 +err4 byte "not found",0 +err5 byte "file not found",0 +err6 byte "dir not found",0 +err7 byte "file read only",0 +err8 byte "end of file",0 +err9 byte "end of directory",0 +err10 byte "end of root",0 +err11 byte "dir is full",0 +err12 byte "dir is not empty",0 +err13 byte "checksum error",0 +err14 byte "reboot error",0 +err15 byte "bpb corrupt",0 +err16 byte "fsi corrupt",0 +err17 byte "dir already exist",0 +err18 byte "file already exist",0 +err19 byte "out of disk free space",0 +err20 byte "disk io error",0 +err21 byte "command not found",0 +err22 byte "timeout",0 +errx byte "undefined",0 + +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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} + diff --git a/source/m-glob-con.spin b/source/m-glob-con.spin new file mode 100644 index 0000000..d448639 --- /dev/null +++ b/source/m-glob-con.spin @@ -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 + diff --git a/source/mouse64.spin b/source/mouse64.spin new file mode 100644 index 0000000..a971c0d --- /dev/null +++ b/source/mouse64.spin @@ -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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} diff --git a/source/ram.spin b/source/ram.spin new file mode 100644 index 0000000..b57fbf4 --- /dev/null +++ b/source/ram.spin @@ -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 diff --git a/source/reg-ios-64.spin b/source/reg-ios-64.spin new file mode 100644 index 0000000..1d132ec --- /dev/null +++ b/source/reg-ios-64.spin @@ -0,0 +1,3015 @@ +{{ +┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Autor: Ingo Kripahle │ +│ Copyright (c) 2010 Ingo Kripahle │ +│ See end of file for terms of use. │ +│ Die Nutzungsbedingungen befinden sich am Ende der Datei │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────┘ + +Informationen : hive-project.de +Kontakt : drohne235@googlemail.com +System : TriOS +Name : [I]nput-[O]utput-[S]ystem - System-API +Chip : Regnatix +Typ : Objekt +Version : 01 +Subversion : 1 +Funktion : System-API - Schnittstelle der Anwendungen zu allen Systemfunktionen + +Regnatix + system : Systemübergreifende Routinen + loader : Routinen um BIN-Dateien zu laden + ramdisk : Strukturierte Speicherverwaltung: Ramdisk + eram : Einfache Speicherverwaltung: Usermem + bus : Kommunikation zu Administra und Bellatrix + +Administra + sd-card : FAT16 Dateisystem auf SD-Card + scr : Screeninterface + hss : Hydra-Soundsystem + sfx : Sound-FX + +Bellatrix + key : Keyboardroutinen + screen : Bildschirmsteuerung + g0 : grafikmodus 0,TV-Modus 256 x 192 Pixel, Vektorengine + +Venatrix diverse Buserweiterungen + + +Komponenten : - +COG's : - +Logbuch : + +13-03-2009-dr235 - string für parameterübergabe zwischen programmen im eram eingerichtet +19-11-2008-dr235 - erste version aus dem ispin-projekt extrahiert +26-03-2010-dr235 - errormeldungen entfernt (mount) +05-08-2010-dr235 - speicherverwaltung für eram eingefügt +18-09-2010-dr235 - fehler in bus_init behoben: erste eram-zelle wurde gelöscht durch falsche initialisierung +25-11-2011-dr235 - funktionsset für grafikmodus 0 eingefügt +28-11-2011-dr235 - sfx_keyoff, sfx_stop eingefügt +01-12-2011-dr235 - printq zugefügt: ausgabe einer zeichenkette ohne steuerzeichen +25-01-2012-dr235 - korrektur char_ter_bs +15-09-2013-zille9 - erste Venatrix-Routinen bus_getchar3 und bus_putchar3 ,put/getword,long hinzugefügt + +Notizen : + + --------------------------------------------------------------------------------------------------------- }} + +CON 'Signaldefinitionen +'signaldefinition regnatix +#0, D0,D1,D2,D3,D4,D5,D6,D7 'datenbus +#8, A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10 'adressbus +#19, REG_RAM1,REG_RAM2 'selektionssignale rambank 1 und 2 +#21, REG_PROP1,REG_PROP2 'selektionssignale für administra und bellatrix +#23, REG_AL 'strobesignal für adresslatch +#24, REG_PROP3 'Venatrix-Chipselect Signal + BUSCLK 'bustakt + BUS_WR '/wr - schreibsignal + BUS_HS ' '/hs - quittungssignal + +CON 'Zeichencodes +'zeichencodes +CHAR_RETURN = $0D 'eingabezeichen +CHAR_NL = $0D 'newline +CHAR_SPACE = $20 'leerzeichen +CHAR_BS = $08 'tastaturcode backspace +CHAR_TER_BS = $08 'terminalcode backspace +CHAR_ESC = $1B +CHAR_LEFT = $02 +CHAR_RIGHT = $03 +CHAR_UP = $0B +CHAR_DOWN = $0A +KEY_CTRL = $02 +KEY_ALT = $04 +KEY_OS = $08 + +CON 'Systemvariablen +'systemvariablen +LOADERPTR = $0FFFFB '4 Byte 'Zeiger auf Loader-Register im hRAM +MAGIC = $0FFFFA '1 Byte 'Warmstartflag +SIFLAG = $0FFFF9 '1 byte 'Screeninit-Flag +BELDRIVE = $0FFFED '12 Byte 'Dateiname aktueller Grafiktreiber +PARAM = $0FFFAD '64 Byte 'Parameterstring +RAMDRV = $0FFFAC '1 Byte 'Ramdrive-Flag +RAMEND = $0FFFA8 '4 Byte 'Zeiger auf oberstes freies Byte (einfache Speicherverwaltung) +RAMBAS = $0FFFA4 '4 Byte 'Zeiger auf unterstes freies Byte (einfache Speicherverwaltung) + +SYSVAR = $0FFFA3 'Adresse des obersten freien Bytes, darüber folgen Systemvariablen + +CON 'Sonstiges +'CNT_HBEAT = 5_000_0000 'blinkgeschw. front-led +DB_IN = %00000111_11111111_11111111_00000000 'maske: dbus-eingabe +DB_OUT = %00000111_11111111_11111111_11111111 'maske: dbus-ausgabe + +OS_TIBLEN = 64 'größe des inputbuffers +ERAM = 1024 * 512 * 2 'größe eram +HRAM = 1024 * 32 'größe hram + +RMON_ZEILEN = 16 'speichermonitor - angezeigte zeilen +RMON_BYTES = 8 'speichermonitor - zeichen pro byte + +STRCOUNT = 64 'größe des stringpuffers + +CON 'ADMINISTRA-FUNKTIONEN -------------------------------------------------------------------------- + +'chip-managment +#92, AMGR_SETSOUND + AMGR_GETSPEC + AMGR_SETSYSSOUND + AMGR_GETSOUNDSYS + AMGR_ALOAD + AMGR_GETCOGS + AMGR_GETVER + AMGR_REBOOT + + AMGR_DEBUG = 255 + +'soundeinstellungen +#0, SND_HSSOFF + SND_HSSON + SND_WAVOFF + SND_WAVON + +'sdcard-funktionen +#0, OPT + SD_MOUNT + SD_DIROPEN + SD_NEXTFILE + SD_OPEN + SD_CLOSE + SD_GETC + SD_PUTC + SD_GETBLK + SD_PUTBLK + SD_SEEK + SD_FATTRIB + SD_VOLNAME + SD_CHECKMOUNTED + SD_CHECKOPEN + SD_CHECKUSED + SD_CHECKFREE + SD_NEWFILE + SD_NEWDIR + SD_DEL + SD_RENAME + SD_CHATTRIB + SD_CHDIR + SD_FORMAT + SD_UNMOUNT + SD_DMACT + SD_DMSET + SD_DMGET + SD_DMCLR + SD_DMPUT + SD_EOF + SD_POS + SD_COPY + SD_SIZE + SD_WR_VOLNAME + +#35, Bluetooth_Command + Bluetooth_Normal + +'RTC - Datums und Zeitfunktionen +#41, RTC_GETSECONDS 'Returns the current second (0 - 59) from the real time clock. + RTC_GETMINUTES 'Returns the current minute (0 - 59) from the real time clock. + RTC_GETHOURS 'Returns the current hour (0 - 23) from the real time clock. + RTC_GETDAY 'Returns the current day (1 - 7) from the real time clock. + RTC_GETDATE 'Returns the current date (1 - 31) from the real time clock. + RTC_GETMONTH 'Returns the current month (1 - 12) from the real time clock. + RTC_GETYEAR 'Returns the current year (2000 - 2099) from the real time clock. + RTC_SETSECONDS 'Sets the current real time clock seconds. + RTC_SETMINUTES 'Sets the current real time clock minutes. + RTC_SETHOURS 'Sets the current real time clock hours. + RTC_SETDAY 'Sets the current real time clock day. + RTC_SETDATE 'Sets the current real time clock date. + RTC_SETMONTH 'Sets the current real time clock month. + RTC_SETYEAR 'Sets the current real time clock year. + RTC_SETNVSRAM 'Sets the NVSRAM to the selected value (0 - 255) at the index (0 - 55). + RTC_GETNVSRAM 'Gets the selected NVSRAM value at the index (0 - 55). + RTC_PAUSEFORSECONDS 'Pauses execution for a number of seconds. + RTC_PAUSEFORMILLISECONDS 'Pauses execution for a number of milliseconds. + RTC_TIME + DCF_SYNC_GET 'Status des DCF-Empfängers + DCF_UPDATE_SET 'RTC mit den DCF-Daten updaten + DCF_ERROR 'DCF-Error-Byte + DCF_DATACOUNT + DCF_BITNUMBER + DCF_BITLEVEL + DCF_TIMEZONE + DCF_ACTIVE + DCF_START 'DCF-Empfang starten + DCF_STOP 'DCF-Empfang stoppen + DCF_GETSTATUS 'DCF-Empfängerstatus (on/off) + DCF_SECONDS + DCF_MINUTES + DCF_HOURS + DCF_WEEKDAY + DCF_DAY + DCF_MONTH + DCF_YEAR + + + +#0, NVRAM_LANG +#0, LANG_DE + LANG_EN + +#1, NVRAM_DATEFORMAT +#0, DATEFORMAT_DE 'DD.MM.YYY (DE DIN 1355-1) + DATEFORMAT_CANONICAL 'YYYY-MM-DD (ISO 8601) + DATEFORMAT_UK 'DD/MM/YYYY + DATEFORMAT_US 'MM/DD/YYYY + +#2, NVRAM_TIMEFORMAT +#0, TIMEFORMAT_24 'HH:MM:SS + TIMEFORMAT_12 'HH:MM:SS[PM|AM] + TIMEFORMAT_12UK 'HH.MM.SS[PM|AM] + +'dateiattribute +#0, F_SIZE + F_CRDAY + F_CRMONTH + F_CRYEAR + F_CRSEC + F_CRMIN + F_CRHOUR + F_ADAY + F_AMONTH + F_AYEAR + F_CDAY + F_CMONTH + F_CYEAR + F_CSEC + F_CMIN + F_CHOUR + F_READONLY + F_HIDDEN + F_SYSTEM + F_DIR + F_ARCHIV +'dir-marker +#0, DM_ROOT + DM_SYSTEM + DM_USER + DM_A + DM_B + DM_C + +'hss-funktionen +{#100, CHSS_LOAD + CHSS_PLAY + CHSS_STOP + CHSS_PAUSE + CHSS_PEEK + CHSS_INTREG + CHSS_VOL + CSFX_FIRE + CSFX_SETSLOT + CSFX_KEYOFF + CSFX_STOP +'GM-synth-funktionen +#120, SYNTH_NOTEON + SYNTH_NOTEOFF + SYNTH_PRGCHANGE + SYNTH_VOLUME + SYNTH_PAN + SYNTH_ALLOFF +} +'wav-funktionen +{#150, SDW_START 'wav direkt von sdcard abspielen + SDW_STOP + SDW_STATUS + SDW_LVOL + SDW_RVOL + SDW_PAUSE + SDW_POS +} +'sidcog-funktionen +#156, SCOG_DMPLEN + SCOG_MDMPPLAY 'dmp auf sid2 von sdcard abspielen + SCOG_SDMPPLAY + SCOG_DMPSTOP + SCOG_DMPPAUSE + SCOG_DMPSTATUS + SCOG_DMPPOS + SCOG_MUTE + SCOG1_setRegister + SCOG1_updateRegisters + SCOG1_setVolume + SCOG1_play + SCOG1_noteOn + SCOG1_noteOff + SCOG1_setFreq + SCOG1_setWaveform + SCOG1_setPWM + SCOG1_setADSR + SCOG1_setResonance + SCOG1_setCutoff + SCOG1_setFilterMask + SCOG1_setFilterType + SCOG1_enableRingmod + SCOG1_enableSynchronization + SCOG2_setRegister + SCOG2_updateRegisters + SCOG2_setVolume + SCOG2_play + SCOG2_noteOn + SCOG2_noteOff + SCOG2_setFreq + SCOG2_setWaveform + SCOG2_setPWM + SCOG2_setADSR + SCOG2_setResonance + SCOG2_setCutoff + SCOG2_setFilterMask + SCOG2_setFilterType + SCOG2_enableRingmod + SCOG2_enableSynchronization + SCOG2_RESETREGISTER + SCOG1_RESETREGISTER + SCOG_BEEP + +{#200, AYCOG_Start + AYCOG_Stop + AYCOG_UpdateRegisters + AYCOG_sdmpplay + } +'interface zum hss-player +#0, iEndFlag 'Repeat oder Ende wurde erreicht + iRowFlag 'Flag das Songzeile fertig ist + iEngineC 'Patternzähler + iBeatC 'Beatzähler + iRepeat 'zähler für loops +#5, iChannel +#5, iChannel1 +#10, iChannel2 +#15, iChannel3 +#20, iChannel4 +#0, iNote + iOktave + iVolume + iEffekt + iInstrument + +'screeninterface +#60, SCR_OPEN 'containerdatei öffnen + SCR_FILL 'screenpuffer mit zeichen füllen + SCR_READ 'screen in den puffer laden + SCR_WRITE 'screen auf disk schreiben + SCR_GETNR 'nummer des aktuellen screens abfragen + SCR_SETPOS 'zeiger auf position im puffer setzen + SCR_GETPOS 'aktuelle position im puffer abfragen + SCR_GETC 'zeichen wird aus dem puffer gelesen + SCR_PUTC 'zeichen wird in den puffer geschrieben + SCR_FLUSH 'aktuellen puffer auf disk schreiben + SCR_ERR 'fehlerstatus abfragen + SCR_MAXSCR 'anzahl screens des containers abfragen + +' ---------------------------------------------- PLX-Funktionen +#120, a_plxRun 'plx-bus freigeben + a_plxHalt 'plx-bus anfordern + a_plxIn 'port einlesen + a_plxOut 'port ausgeben + a_plxCh 'ad-wandler auslesen + a_plxGetReg 'poller-register lesen + a_plxSetReg 'poller-register setzen + a_plxStart 'i2c-dialog starten + a_plxStop 'i2c-dialog beenden + a_plxWrite 'i2c byte senden + a_plxRead 'i2c byte empfangen + a_plxPing 'abfrage ob device vorhanden ist + a_plxSetAdr 'adressen adda/ports für poller setzen +' ---------------------------------------------- GAMEDEVICES + a_Joy 'Joystick abfragen (1 x 8bit Port) + a_Paddle 'Paddle abfragen (1 x 8bit Port 1 x Analog) + a_Pad 'Pad abfragen (1 x 8bit Port 2 x Analog) + a_SetJoy 'Port für Joystick setzen + a_SetPad '137 'Chan für Pad setzen + 'Adresse der Port-Register setzen +CON 'BELLATRIX-FUNKTIONEN -------------------------------------------------------------------------- + +' einzeichen-steuercodes + +#$0, BEL_CMD 'esc-code für zweizeichen-steuersequenzen + BEL_LEFT + BEL_HOME + BEL_POS1 + BEL_CURON + BEL_CUROFF + BEL_SCRLUP + BEL_SCRLDOWN + BEL_BS + BEL_TAB + +' zweizeichen-steuersequenzen +' [BEL_CMD][...] + +#$1, BEL_KEY_STAT + BEL_KEY_CODE + BEL_DPL_SETY'SCRCMD 'esc-code für dreizeichen-sequenzen + BEL_KEY_SPEC + BEL_DPL_MOUSE + BEL_SCR_CHAR + BEL_BLKTRANS + BEL_DPL_SETX + BEL_LD_MOUSEBOUND + BEL_MOUSEX + BEL_MOUSEY + BEL_MOUSEZ + BEL_MOUSE_PRESENT + BEL_MOUSE_BUTTON + BEL_BOXSIZE + BEL_CURSORCOLOR + BEL_CURSORRATE + BEL_BOXCOLOR + BEL_ERS_3DBUTTON + BEL_SCOLLUP + BEL_SCOLLDOWN + BEL_DPL_3DBOX + BEL_DPL_3DFRAME + BEL_DPL_2DBOX + BEL_Send_BUTTON + BEL_SCROLLSTRING + BEL_DPL_STRING + BEL_DPL_SETXalt + BEL_DPL_SETYalt + BEL_LD_MOUSEPOINTER + BEL_DPL_SETPOS + BEL_DPL_TILE + BEL_DPL_WIN + BEL_DPL_TCOL + BEL_LD_TILESET + BEL_DPL_PIC + BEL_GETX + BEL_GETY + BEL_DPL_LINE + BEL_DPL_PIXEL + BEL_SPRITE_PARAM + BEL_SPRITE_POS + BEL_ACTOR + BEL_ACTORPOS + BEL_ACT_KEY + BEL_SPRITE_RESET + BEL_SPRITE_MOVE + BEL_SPRITE_SPEED + BEL_GET_COLLISION + BEL_GET_ACTOR_POS + BEL_SEND_BLOCK + BEL_FIRE_PARAM + BEL_FIRE + BEL_DPL_PALETTE + BEL_DEL_WINDOW + BEL_SET_TITELSTATUS + BEL_BACK + Bel_REST + BEL_WINDOW + BEL_GET_WINDOW + BEL_CHANGE_BACKUP + BEL_PRINTFONT + BEL_WINDOW_ATTR + + +#$50, BMGR_WIN_DEFINE + BMGR_FREI + BMGR_WIN_SET + BMGR_FREI2 + BMGR_WIN_GETCOLS + BMGR_WIN_GETROWS + BMGR_WIN_OFRAME + BMGR_LOAD + BMGR_WSCR + BMGR_DSCR + BMGR_GETCOLOR + BMGR_SETCOLOR + BMGR_GETRESX + BMGR_GETRESY + BMGR_GETCOLS + BMGR_GETROWS + BMGR_GETCOGS + BMGR_GETSPEC + BMGR_GETVER + BMGR_REBOOT + +' dreizeichen-steuersequenzen +' [BEL_CMD][BEL_SCRCMD][...] + +#$1, BEL_SETCUR + BEL_SETX + BEL_SETY + BEL_GETXalt + BEL_GETYalt + BEL_SETCOL + BEL_SLINE + BEL_ELINE + BEL_SINIT + BEL_TABSET + +CON 'Venatrix-Funktionen ------------------------------------- +#$0, VEN_CMD +#96, VEN_GETCGS + VEN_LOAD + VEN_GETVER + VEN_REBOOT + +#220, VEN_PORT_RESET + VEN_PORT_WR + VEN_PORT_RD + VEN_JOYSTICK + +' +---------- +' | +------- system +' | | +---- version (änderungen) +' | | | +- subversion (hinzufügungen) +CHIP_VER = $00_01_01_01 +' +' +---------- +' | +-------- +' | |+------- +' | ||+------ +' | |||+----- +' | ||||+---- +' | |||||+--- +' | ||||||+-- multi +' | |||||||+- loader +CHIP_SPEC = %00000000_00000000_00000000_00000001 + +LIGHTBLUE = 0 +YELLOW = 1 +RED = 2 +GREEN = 3 +BLUE_REVERSE = 4 +WHITE = 5 +RED_INVERSE = 6 +MAGENTA = 7 + +' konstante parameter für die sidcog's + +scog_pal = 985248.0 +scog_ntsc = 1022727.0 +scog_maxf = 1031000.0 +scog_triangle = 16 +scog_saw = 32 +scog_square = 64 +scog_noise = 128 + +obj + ram_rw :"ram" + ser :"FullDuplexSerialExtended"'"SerialMirror" "RS232_ComEngine" + gc :"glob-con" + +VAR + long lflagadr 'adresse des loaderflag + byte strpuffer[STRCOUNT] 'stringpuffer + byte tmptime + byte serial 'serielle Schnittstelle geöffnet? + byte parapos + +PUB start: wflag 'system: ios initialisieren +''funktionsgruppe : system +''funktion : ios initialisieren +''eingabe : - +''ausgabe : wflag - 0: kaltstart +'' : 1: warmstart +''busprotokoll : - + + bus_init 'bus initialisieren + ram_rw.start + serial:=0 'serielle Schnittstelle geschlossen + + ram_wrlong($7f54,$FFFFB) + 'ram_wrbyte(0,$7f,$FFFFC) + sddmact(DM_USER) 'wieder in userverzeichnis wechseln + lflagadr := ram_rdlong(LOADERPTR) 'adresse der loader-register setzen + + if ram_rdbyte(MAGIC) == 235 + 'warmstart + wflag := 1 + + else + 'kaltstart + ram_wrbyte(235,MAGIC) + ' ram_wrlong(sysmod,SYSVAR,RAMEND) 'Zeiger auf letzte freie Speicherzelle setzen + ' ram_wrlong(sysmod,$80000,RAMBAS) 'Zeiger auf erste freie Speicherzelle setzen + wflag := 0 + ram_wrbyte(0,RAMDRV) 'Ramdrive ist abgeschaltet + + 'rbas := ram_rdlong(sysmod,RAMBAS) + 'rend := ram_rdlong(sysmod,RAMEND) + 'rd_init + +PUB stop 'loader: beendet anwendung und startet os +''funktionsgruppe : system +''funktion : beendet die laufende anwendung und kehrt zum os (reg.sys) zurück +''eingabe : - +''ausgabe : - +''busprotokoll : - + ram_rw.stop + ser.stop + 'sd_mount + sddmact(DM_ROOT) + sdopen("r",@regsys) + ldbin(@regsys) + repeat + +'PUB startram 'system: initialisierung des systems bei ram-upload +''funktionsgruppe : system +''funktion : ios initialisieren - wenn man zu testzwecken das programm direkt in den ram +'' : überträgt und startet, bekommen alle props ein reset, wodurch bellatrix auf +'' : einen treiber wartet. für testzwecke erledigt diese routine den upload des +'' : standard-vga-treibers. +''eingabe : - +''ausgabe : - +''busprotokoll : - + +' sdmount 'sd-karte mounten +' bload(@belsys) 'vga-treiber zu bellatrix übertragen + +PUB paraset(stradr) | i,c 'system: parameter --> eram +''funktionsgruppe : system +''funktion : parameter --> eram - werden programme mit dem systemloader gestartet, so kann +'' : mit dieser funktion ein parameterstring im eram übergeben werden. das gestartete +'' : programm kann diesen dann mit "parastart" & "paranext" auslesen und verwenden +''eingabe : - +''ausgabe : stradr - adresse des parameterstrings +''busprotokoll : - + + paradel 'parameterbereich löschen + repeat i from 0 to 63 'puffer ist mx. 64 zeichen lang + c := byte[stradr+i] + ram_wrbyte(c,PARAM+i) + if c == 0 'bei stringende vorzeitig beenden + return + +pub paracopy(adr)|i,c + paradel 'parameterbereich löschen + repeat i from 0 to 63 'puffer ist mx. 64 zeichen lang + c := ram_rdbyte(adr++) + ram_wrbyte(c,PARAM+i) + if c == 0 'bei stringende vorzeitig beenden + return +PUB paradel | i 'system: parameterbereich löschen +''funktionsgruppe : system +''funktion : parameterbereich im eram löschen +''eingabe : - +''ausgabe : - +''busprotokoll : - + + repeat i from 0 to 63 + ram_wrbyte(0,PARAM+i) + +PUB parastart 'system: setzt den zeiger auf parameteranfangsposition +''funktionsgruppe : system +''funktion : setzt den index auf die parameteranfangsposition +''eingabe : - +''ausgabe : - +''busprotokoll : - + + parapos := 0 + +PUB paranext(stradr): err | i,c 'system: überträgt den nächsten parameter in stringdatei +''funktionsgruppe : system +''funktion : überträgt den nächsten parameter in stringdatei +''eingabe : stradr - adresse einer stringvariable für den nächsten parameter +''ausgabe : err - 0: kein weiterer parameter +'' : 1: parameter gültig +''busprotokoll : - + + if ram_rdbyte(PARAM+parapos) <> 0 'stringende? + repeat until ram_rdbyte(PARAM+parapos) > CHAR_SPACE 'führende leerzeichen ausblenden + parapos++ + i := 0 + repeat 'parameter kopieren + c := ram_rdbyte(PARAM + parapos++) + if c <> CHAR_SPACE 'space nicht kopieren + byte[stradr++] := c + until (c == CHAR_SPACE) or (c == 0) + byte[stradr] := 0 'string abschließen + return 1 + else + return 0 + +PUB reggetcogs:regcogs |i,c,cog[8] 'system: fragt freie cogs von regnatix ab +''funktionsgruppe : system +''funktion : fragt freie cogs von regnatix ab +''eingabe : - +''ausgabe : regcogs - anzahl der belegten cogs +''busprotokoll : - + + regcogs := 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 + regcogs := i + repeat 'unloads the cogs and updates the string + i-- + if i=>0 + cogstop(cog[i]) + while i=>0 + +PUB ldbin(stradr) | len,i,stradr2 'loader: startet bin-datei über loader +''funktionsgruppe : system +''funktion : startet bin-datei über den systemloader +''eingabe : stradr - adresse eines strings mit dem dateinamen der bin-datei +''ausgabe : - +''busprotokoll : - + + len := strsize(stradr) + stradr2 := lflagadr + 1 'adr = flag, adr + 1 = string + repeat i from 0 to len - 1 'string in loadervariable kopieren + byte[stradr2][i] := byte[stradr][i] + byte[stradr2][++i] := 0 'string abschließen + byte[lflagadr][0] := 1 'loader starten + +PUB os_error(err):error 'sys: fehlerausgabe + + {if err + printnl + print(string("Fehlernummer : ")) + printdec(err) + print(string(" : $")) + printhex(err,2) + printnl + print(string("Fehler : ")) + case err + 0: print(string("no error")) + 1: print(string("fsys unmounted")) + 2: print(string("fsys corrupted")) + 3: print(string("fsys unsupported")) + 4: print(string("not found")) + 5: print(string("file not found")) + 6: print(string("dir not found")) + 7: print(string("file read only")) + 8: print(string("end of file")) + 9: print(string("end of directory")) + 10: print(string("end of root")) + 11: print(string("dir is full")) + 12: print(string("dir is not empty")) + 13: print(string("checksum error")) + 14: print(string("reboot error")) + 15: print(string("bpb corrupt")) + 16: print(string("fsi corrupt")) + 17: print(string("dir already exist")) + 18: print(string("file already exist")) + 19: print(string("out of disk free space")) + 20: print(string("disk io error")) + 21: print(string("command not found")) + 22: print(string("timeout")) + 23: print(string("out of memory")) + OTHER: print(string("undefined"))} + 'printnl + error := err + +OBJ' SERIAL-FUNKTIONEN +CON' -------------------------------------------------- Funktionen der seriellen Schnittstelle ----------------------------------------------------------- +pub seropen(baud) 'ser. Schnittstelle virtuell öffnen + ser.start(31, 30, 0, baud) 'serielle Schnittstelle starten + serial:=1 + +pub serclose 'ser. Schnittstelle virtuell schliessen + serial:=0 + ser.stop +pub serget:c 'warten bis Zeichen an ser. Schnittstelle anliegt + c:=ser.rx +pub serread:c ' Zeichen von ser. Schnittstelle lesen ohne zu warten -1 wenn kein Zeichen da ist + c:=ser.rxcheck + +pub sertx(c) + ser.tx(c) + +pub serdec(c) + ser.dec(c) + +pub serstr(strg) + ser.str(strg) + +pub serflush + ser.rxflush + +OBJ '' A D M I N I S T R A + +CON ''------------------------------------------------- CHIP-MANAGMENT + +PUB admsetsound(sndfunktion):sndstat 'chip-mgr: soundsubsysteme verwalten +''funktionsgruppe : cmgr +''funktion : soundsubsysteme an- bzw. abschalten +''busprotokoll : [150][put.funktion][get.sndstat] +'' : funktion - 0: hss-engine abschalten SND_HSSOFF +'' : 1: hss-engine anschalten SND_HSSON +'' : 2: dac-engine abschalten SND_WAVOFF +'' : 3: dac-engine anschalten SND_WAVON +'' : sndstat - status/cognr startvorgang + + bus_putchar1(AMGR_SETSOUND) + bus_putchar1(sndfunktion) + sndstat := bus_getchar1 + +PUB admsetsyssnd(status) 'chip-mgr: systemklänge ein/ausschalten +''funktionsgruppe : cmgr +''funktion : systemklänge steuern +''busprotokoll : [094][put.fl_syssnd] +'' : fl_syssnd - flag zur steuerung der systemsounds +'' : 0 - systemtöne aus +'' : 1 - systemtöne an + + bus_putchar1(AMGR_SETSYSSOUND) + bus_putchar1(status) + +PUB admgetsndsys: status 'chip-mgr: status des soundsystems abfragen +''funktionsgruppe : cmgr +''funktion : abfrage welches soundsystem aktiv ist +''busprotokoll : [095][get.status] +'' : status - status des soundsystems +'' : 0 - sound aus +'' : 1 - hss +'' : 2 - wav + + bus_putchar1(AMGR_GETSOUNDSYS) + status := bus_getchar1 + +PUB admload(stradr) 'chip-mgr: neuen administra-code booten +''funktionsgruppe : cmgr +''funktion : administra mit neuem code booten +''busprotokoll : [096][sub_putstr.fn] +'' : fn - dateiname des neuen administra-codes + + bus_putchar1(AMGR_ALOAD) 'aktuelles userdir retten + bus_putstr1(stradr) + waitcnt(cnt + clkfreq*3) 'warte bis administra fertig ist + +PUB admgetver:ver 'chip-mgr: version abfragen +''funktionsgruppe : cmgr +''funktion : abfrage der version und spezifikation des chips +''busprotokoll : [098][sub_getlong.ver] +'' : ver - version +'' +---------- +'' | +------- system +'' | | +---- version (änderungen) +'' | | | +- subversion (hinzufügungen) +''version : $00_00_00_00 +'' + + bus_putchar1(AMGR_GETVER) + ver := bus_getlong1 + +PUB admgetspec:spec 'chip-mgr: spezifikation abfragen +''funktionsgruppe : cmgr +''funktion : abfrage der version und spezifikation des chips +''busprotokoll : [089][sub_getlong.spec] +'' : spec - spezifikation +'' +'' +---------- com +'' | +-------- i2c +'' | |+------- rtc +'' | ||+------ lan +'' | |||+----- sid +'' | ||||+---- wav +'' | |||||+--- hss +'' | ||||||+-- bootfähig +'' | |||||||+- dateisystem +''spezifikation : %00000000_00000000_00000000_01001111 + + bus_putchar1(AMGR_GETSPEC) + spec := bus_getlong1 + +PUB admgetcogs:cogs 'chip-mgr: verwendete cogs abfragen +''funktionsgruppe : cmgr +''funktion : abfrage wie viele cogs in benutzung sind +''busprotokoll : [097][get.cogs] +'' : cogs - anzahl der belegten cogs + + bus_putchar1(AMGR_GETCOGS) + cogs := bus_getchar1 + +PUB admreset 'chip-mgr: administra reset +''funktionsgruppe : cmgr +''funktion : reset im administra-chip auslösen - loader aus dem eeprom wird neu geladen +''busprotokoll : - + + bus_putchar1(AMGR_REBOOT) + +PUB admdebug: wert 'chip-mgr: debug-funktion + + bus_putchar1(AMGR_DEBUG) + wert := bus_getlong1 + +CON ''------------------------------------------------- SD_LAUFWERKSFUNKTIONEN + +PUB sdmount: err 'sd-card: mounten +''funktionsgruppe : sdcard +''funktion : eingelegtes volume mounten +''busprotokoll : [001][get.err] +'' : err - fehlernummer entspr. list + + bus_putchar1(SD_MOUNT) + err := bus_getchar1 + +PUB sddir 'sd-card: verzeichnis wird geöffnet +''funktionsgruppe : sdcard +''funktion : verzeichnis öffnen +''busprotokoll : [002] + + bus_putchar1(SD_DIROPEN) + +PUB sdnext: stradr | flag 'sd-card: nächster dateiname aus verzeichnis +''funktionsgruppe : sdcard +''funktion : nächsten eintrag aus verzeichnis holen +''busprotokoll : [003][get.status=0] +'' : [003][get.status=1][sub_getstr.fn] +'' : status - 1 = gültiger eintrag +'' : 0 = es folgt kein eintrag mehr +'' : fn - verzeichniseintrag string + + bus_putchar1(SD_NEXTFILE) 'kommando: nächsten eintrag holen + flag := bus_getchar1 'flag empfangen + if flag + return bus_getstr1 + else + return 0 + +PUB sdopen(modus,stradr):err | len,i 'sd-card: datei öffnen +''funktionsgruppe : sdcard +''funktion : eine bestehende datei öffnen +''busprotokoll : [004][put.modus][sub_putstr.fn][get.error] +'' : modus - "A" Append, "W" Write, "R" Read (Großbuchstaben!) +'' : fn - name der datei +'' : error - fehlernummer entspr. list + + bus_putchar1(SD_OPEN) + bus_putchar1(modus) + len := strsize(stradr) + bus_putchar1(len) + repeat i from 0 to len - 1 + bus_putchar1(byte[stradr++]) + err := bus_getchar1 + +PUB sdclose:err 'sd-card: datei schließen +''funktionsgruppe : sdcard +''funktion : die aktuell geöffnete datei schließen +''busprotokoll : [005][get.error] +'' : error - fehlernummer entspr. list + + bus_putchar1(SD_CLOSE) + err := bus_getchar1 + +PUB sdgetc: char 'sd-card: zeichen aus datei lesen +''funktionsgruppe : sdcard +''funktion : zeichen aus datei lesen +''busprotokoll : [006][get.char] +'' : char - gelesenes zeichen + + bus_putchar1(SD_GETC) + char := bus_getchar1 + +PUB sdputc(char) 'sd-card: zeichen in datei schreiben +{{sdputc(char) - sd-card: zeichen in datei schreiben}} + bus_putchar1(SD_PUTC) + bus_putchar1(char) + +PUB sdgetstr(stringptr,len) 'sd-card: eingabe einer zeichenkette + repeat len + byte[stringptr++] := bus_getchar1 + +PUB sdputstr(stringptr) 'sd-card: ausgabe einer zeichenkette (0-terminiert) +{{sdstr(stringptr) - sd-card: ausgabe einer zeichenkette (0-terminiert)}} + repeat strsize(stringptr) + sdputc(byte[stringptr++]) + +PUB sddec(value) | i 'sd-card: dezimalen zahlenwert auf bildschirm ausgeben +{{sddec(value) - sd-card: dezimale bildschirmausgabe zahlenwertes}} + if value < 0 'negativer zahlenwert + -value + sdputc("-") + i := 1_000_000_000 + repeat 10 'zahl zerlegen + if value => i + sdputc(value / i + "0") + value //= i + result~~ + elseif result or i == 1 + sdputc("0") + i /= 10 'n?chste stelle + +PUB sdeof: eof 'sd-card: eof abfragen +''funktionsgruppe : sdcard +''funktion : eof abfragen +''busprotokoll : [030][get.eof] +'' : eof - eof-flag + + bus_putchar1(SD_EOF) + eof := bus_getchar1 +pub sdpos:c + bus_putchar1(SD_POS) + c:=bus_getlong1 + +pub sdcopy(cm,pm,source) + bus_putchar1(SD_COPY) + bus_putlong1(cm) + bus_putlong1(pm) + + bus_putstr1(source) + + +PUB sdgetblk(count,bufadr) | i 'sd-card: block lesen +''funktionsgruppe : sdcard +''funktion : block aus datei lesen +''busprotokoll : [008][sub_putlong.count][get.char(1)]..[get.char(count)] +'' : count - anzahl der zu lesenden zeichen +'' : char - gelesenes zeichen + + i := 0 + bus_putchar1(SD_GETBLK) + bus_putlong1(count) + repeat count + byte[bufadr][i++] := bus_getchar1 + +PUB sdputblk(count,bufadr) | i 'sd-card: block schreiben +''funktionsgruppe : sdcard +''funktion : zeichen in datei schreiben +''busprotokoll : [007][put.char] +'' : char - zu schreibendes zeichen + + i := 0 + bus_putchar1(SD_PUTBLK) + bus_putlong1(count) + repeat count + bus_putchar1(byte[bufadr][i++]) +con'************************************************ Blocktransfer test modifizieren fuer Tiledateien und Datendateien (damit es schneller geht ;-) ************************************** +PUB sdxgetblk(adr,count)|i 'sd-card: block lesen --> eRAM +''funktionsgruppe : sdcard +''funktion : block aus datei lesen und in ramdisk speichern +''busprotokoll : [008][sub_putlong.count][get.char(1)]..[get.char(count)] +'' : count - anzahl der zu lesenden zeichen +'' : char - gelesenes zeichen + + i := 0 + bus_putchar1(SD_GETBLK) + bus_putlong1(count) 'laenge der Datei in byte + repeat count + 'rd_put(fnr,bus_getchar1) + ram_wrbyte(bus_getchar1,adr++) + +'PUB rd_put(adr,wert) | adr,fix 'ramdisk: nächstes byte in datei schreiben +'********** muss modifiziert werden ******************** + 'fix := fnr * FTCNT + 'adr := ftab[fix+0] + ftab[fix+2] +' ram_wrbyte(0,wert,adr) + 'rd_seek(fnr,ftab[fix+2]+1) + +con '*********************************************** Blocktransfer test ************************************************************************************************** +PUB sdxputblk(adr,count) 'sd-card: block schreiben <-- eRAM +''funktionsgruppe : sdcard +''funktion : zeichen aus ramdisk in datei schreiben +''busprotokoll : [007][put.char] +'' : char - zu schreibendes zeichen + + bus_putchar1(SD_PUTBLK) + bus_putlong1(count) + repeat count + bus_putchar1(ram_rdbyte(adr++))'rd_get(fnr)) + +PUB sdseek(wert) 'sd-card: zeiger auf byteposition setzen +''funktionsgruppe : sdcard +''funktion : zeiger in datei positionieren +''busprotokoll : [010][sub_putlong.pos] +'' : pos - neue zeichenposition in der datei + + bus_putchar1(SD_SEEK) + bus_putlong1(wert) + +PUB sdfattrib(anr): attrib 'sd-card: dateiattribute abfragen +''funktionsgruppe : sdcard +''funktion : dateiattribute abfragen +''busprotokoll : [011][put.anr][sub_getlong.wert] +'' : anr - 0 = Dateigröße +'' : 1 = Erstellungsdatum - Tag +'' : 2 = Erstellungsdatum - Monat +'' : 3 = Erstellungsdatum - Jahr +'' : 4 = Erstellungsdatum - Sekunden +'' : 5 = Erstellungsdatum - Minuten +'' : 6 = Erstellungsdatum - Stunden +'' : 7 = Zugriffsdatum - Tag +'' : 8 = Zugriffsdatum - Monat +'' : 9 = Zugriffsdatum - Jahr +'' : 10 = Änderungsdatum - Tag +'' : 11 = Änderungsdatum - Monat +'' : 12 = Änderungsdatum - Jahr +'' : 13 = Änderungsdatum - Sekunden +'' : 14 = Änderungsdatum - Minuten +'' : 15 = Änderungsdatum - Stunden +'' : 16 = Read-Only-Bit +'' : 17 = Hidden-Bit +'' : 18 = System-Bit +'' : 19 = Direktory +'' : 20 = Archiv-Bit +'' : wert - wert des abgefragten attributes + + + bus_putchar1(SD_FATTRIB) + bus_putchar1(anr) + attrib := bus_getlong1 + + +PUB sdvolname: stradr 'sd-card: volumelabel abfragen +''funktionsgruppe : sdcard +''funktion : name des volumes überragen +''busprotokoll : [012][sub_getstr.volname] +'' : volname - name des volumes +'' : len - länge des folgenden strings + + bus_putchar1(SD_VOLNAME) 'kommando: volumelabel abfragen + return bus_getstr1 + +PUB sdcheckmounted: flag 'sd-card: test ob volume gemounted ist +''funktionsgruppe : sdcard +''funktion : test ob volume gemounted ist +''busprotokoll : [013][get.flag] +'' : flag - 0: unmounted +'' : 1: mounted + + bus_putchar1(SD_CHECKMOUNTED) + return bus_getchar1 + +PUB sdcheckopen: flag 'sd-card: test ob datei geöffnet ist +''funktionsgruppe : sdcard +''funktion : test ob eine datei geöffnet ist +''busprotokoll : [014][get.flag] +'' : flag - 0: not open +'' : 1: open + + bus_putchar1(SD_CHECKOPEN) + return bus_getchar1 + +PUB sdcheckused 'sd-card: abfrage der benutzten sektoren +''funktionsgruppe : sdcard +''funktion : anzahl der benutzten sektoren senden +''busprotokoll : [015][sub_getlong.used] +'' : used - anzahl der benutzten sektoren + + bus_putchar1(SD_CHECKUSED) + return bus_getlong1 + +PUB sdcheckfree 'sd_card: abfrage der freien sektoren +''funktionsgruppe : sdcard +''funktion : anzahl der freien sektoren senden +''busprotokoll : [016][sub_getlong.free] +'' : free - anzahl der freien sektoren + + bus_putchar1(SD_CHECKFREE) + return bus_getlong1 + +PUB sdnewfile(stradr):err 'sd_card: neue datei erzeugen +''funktionsgruppe : sdcard +''funktion : eine neue datei erzeugen +''busprotokoll : [017][sub_putstr.fn][get.error] +'' : fn - name der datei +'' : error - fehlernummer entspr. liste + + bus_putchar1(SD_NEWFILE) + bus_putstr1(stradr) + err := bus_getchar1 + +PUB sdnewdir(stradr):err 'sd_card: neues verzeichnis erzeugen +''funktionsgruppe : sdcard +''funktion : ein neues verzeichnis erzeugen +''busprotokoll : [018][sub_putstr.fn][get.error] +'' : fn - name des verzeichnisses +'' : error - fehlernummer entspr. liste + + bus_putchar1(SD_NEWDIR) + bus_putstr1(stradr) + err := bus_getchar1 + +PUB sddel(stradr):err 'sd_card: datei/verzeichnis löschen +''funktionsgruppe : sdcard +''funktion : eine datei oder ein verzeichnis löschen +''busprotokoll : [019][sub_putstr.fn][get.error] +'' : fn - name des verzeichnisses oder der datei +'' : error - fehlernummer entspr. liste + + bus_putchar1(SD_DEL) + bus_putstr1(stradr) + err := bus_getchar1 + +PUB sdrename(stradr1,stradr2):err 'sd_card: datei/verzeichnis umbenennen +''funktionsgruppe : sdcard +''funktion : datei oder verzeichnis umbenennen +''busprotokoll : [020][sub_putstr.fn1][sub_putstr.fn2][get.error] +'' : fn1 - alter name +'' : fn2 - neuer name +'' : error - fehlernummer entspr. liste + + bus_putchar1(SD_RENAME) + bus_putstr1(stradr1) + bus_putstr1(stradr2) + err := bus_getchar1 + +PUB sdchattrib(stradr1,stradr2):err 'sd-card: attribute ändern +''funktionsgruppe : sdcard +''funktion : attribute einer datei oder eines verzeichnisses ändern +''busprotokoll : [021][sub_putstr.fn][sub_putstr.attrib][get.error] +'' : fn - dateiname +'' : attrib - string mit attributen (AHSR) +'' : error - fehlernummer entspr. liste + + bus_putchar1(SD_CHATTRIB) + bus_putstr1(stradr1) + bus_putstr1(stradr2) + err := bus_getchar1 + +PUB sdchdir(stradr):err 'sd-card: verzeichnis wechseln +''funktionsgruppe : sdcard +''funktion : verzeichnis wechseln +''busprotokoll : [022][sub_putstr.fn][get.error] +'' : fn - name des verzeichnisses +'' : error - fehlernummer entspr. list + + bus_putchar1(SD_CHDIR) + bus_putstr1(stradr) + err := bus_getchar1 + +PUB sdformat(stradr):err 'sd-card: medium formatieren +''funktionsgruppe : sdcard +''funktion : medium formatieren +''busprotokoll : [023][sub_putstr.vlabel][get.error] +'' : vlabel - volumelabel +'' : error - fehlernummer entspr. list + + bus_putchar1(SD_FORMAT) + bus_putstr1(stradr) + err := bus_getchar1 + +PUB sdunmount:err 'sd-card: medium abmelden +''funktionsgruppe : sdcard +''funktion : medium abmelden +''busprotokoll : [024][get.error] +'' : error - fehlernummer entspr. list + + bus_putchar1(SD_UNMOUNT) + err := bus_getchar1 + +PUB sddmact(marker):err 'sd-card: dir-marker aktivieren +''funktionsgruppe : sdcard +''funktion : ein ausgewählter dir-marker wird aktiviert +''busprotokoll : [025][put.dmarker][get.error] +'' : dmarker - dir-marker +'' : error - fehlernummer entspr. list + + bus_putchar1(SD_DMACT) + bus_putchar1(marker) + err := bus_getchar1 + +PUB sddmset(marker) 'sd-card: dir-marker setzen +''funktionsgruppe : sdcard +''funktion : ein ausgewählter dir-marker mit dem aktuellen verzeichnis setzen +''busprotokoll : [026][put.dmarker] +'' : dmarker - dir-marker + + bus_putchar1(SD_DMSET) + bus_putchar1(marker) + +PUB sddmget(marker):status 'sd-card: dir-marker abfragen +''funktionsgruppe : sdcard +''funktion : den status eines ausgewählter dir-marker abfragen +''busprotokoll : [027][put.dmarker][sub_getlong.dmstatus] +'' : dmarker - dir-marker +'' : dmstatus - status des markers + + bus_putchar1(SD_DMGET) + bus_putchar1(marker) + status := bus_getlong1 + +PUB sddmclr(marker) 'sd-card: dir-marker löschen +''funktionsgruppe : sdcard +''funktion : ein ausgewählter dir-marker löschen +''busprotokoll : [028][put.dmarker] +'' : dmarker - dir-marker + + bus_putchar1(SD_DMCLR) + bus_putchar1(marker) + +PUB sddmput(marker,status) 'sd-card: dir-marker status setzen +''funktionsgruppe : sdcard +''funktion : dir-marker status setzen +''busprotokoll : [027][put.dmarker][sub_putlong.dmstatus] +'' : dmarker - dir-marker +'' : dmstatus - status des markers + + bus_putchar1(SD_DMPUT) + bus_putchar1(marker) + bus_putlong1(status) + +con'--------------------------------------------------- DCF77-Funktionen -------------------------------------------------------------------------------------------------------- +pub dcf_sync:on + bus_putchar1(DCF_SYNC_GET) + on:=bus_getchar1 + +pub dcf_update + bus_putchar1(DCF_UPDATE_SET) + +pub dcf_geterror:on + bus_putchar1(DCF_ERROR) + on:=bus_getchar1 +pub dcf_getdatacount:on + bus_putchar1(DCF_DATACOUNT) + on:=bus_getchar1 +pub dcf_getbitnumber:on + bus_putchar1(DCF_BITNUMBER) + on:=bus_getchar1 +pub dcf_getbitlevel:on + bus_putchar1(DCF_BITLEVEL) + on:=bus_getchar1 +pub dcf_gettimezone:on + bus_putchar1(DCF_TIMEZONE) + on:=bus_getchar1 +pub dcf_getactive:on + bus_putchar1(DCF_ACTIVE) + on:=bus_getchar1 +pub dcf_startup + bus_putchar1(DCF_START) + +pub dcf_down + bus_putchar1(DCF_STOP) + +pub dcf_status:on + bus_putchar1(DCF_GETSTATUS) + on:=bus_getchar1 + +pub dcf_getseconds:on + bus_putchar1(DCF_SECONDS) + on:=bus_getchar1 +pub dcf_getminutes:on + bus_putchar1(DCF_MINUTES) + on:=bus_getchar1 +pub dcf_gethours:on + bus_putchar1(DCF_HOURS) + on:=bus_getchar1 +pub dcf_getweekday:on + bus_putchar1(DCF_WEEKDAY) + on:=bus_getchar1 +pub dcf_getday:on + bus_putchar1(DCF_DAY) + on:=bus_getchar1 +pub dcf_getmonth:on + bus_putchar1(DCF_MONTH) + on:=bus_getchar1 +pub dcf_getyear:on + bus_putchar1(DCF_YEAR) + on:=bus_getword1 +con'--------------------------------------------------- Bluetooth-Funktionen ----------------------------------------------------------------------------------------------------- +pub Set_Bluetooth_Command_Mode + bus_putchar1(Bluetooth_Command) +pub Clear_Bluetooth_Command_Mode + bus_putchar1(Bluetooth_Normal) +CON ''------------------------------------------------- DATE TIME FUNKTIONEN +pub time(x,y)|h,m,s + bus_putchar1(RTC_GETSECONDS) + setpos(y,x) + + s:=bus_getlong1 + if s<>tmptime + bus_putchar1(RTC_GETHOURS) + h:=bus_getlong1 + bus_putchar1(RTC_GETMINUTES) + m:=bus_getlong1 + + if h<10 + printchar("0") + printdec(h) + printchar(":") + if m<10 + printchar("0") + printdec(m) + printchar(":") + if s<10 + printchar("0") + printdec(s) + tmptime:=s + +PUB getSeconds 'Returns the current second (0 - 59) from the real time clock. + bus_putchar1(RTC_GETSECONDS) + return bus_getlong1 + +PUB getMinutes 'Returns the current minute (0 - 59) from the real time clock. + bus_putchar1(RTC_GETMINUTES) + return bus_getlong1 + +PUB getHours 'Returns the current hour (0 - 23) from the real time clock. + bus_putchar1(RTC_GETHOURS) + return bus_getlong1 + +PUB getDay 'Returns the current day (1 - 7) from the real time clock. + bus_putchar1(RTC_GETDAY) + return bus_getlong1 + +PUB getDate 'Returns the current date (1 - 31) from the real time clock. + bus_putchar1(RTC_GETDATE) + return bus_getlong1 + +PUB getMonth 'Returns the current month (1 - 12) from the real time clock. + bus_putchar1(RTC_GETMONTH) + return bus_getlong1 + +PUB getYear 'Returns the current year (2000 - 2099) from the real time clock. + bus_putchar1(RTC_GETYEAR) + return bus_getlong1 + +PUB setSeconds(seconds) 'Sets the current real time clock seconds. + 'seconds - Number to set the seconds to between 0 - 59. + if seconds => 0 and seconds =< 59 + bus_putchar1(RTC_SETSECONDS) + bus_putlong1(seconds) + +PUB setMinutes(minutes) 'Sets the current real time clock minutes. + 'minutes - Number to set the minutes to between 0 - 59. + if minutes => 0 and minutes =< 59 + bus_putchar1(RTC_SETMINUTES) + bus_putlong1(minutes) + +PUB setHours(hours) 'Sets the current real time clock hours. + 'hours - Number to set the hours to between 0 - 23. + + if hours => 0 and hours =< 23 + bus_putchar1(RTC_SETHOURS) + bus_putlong1(hours) + +PUB setDay(day) 'Sets the current real time clock day. + 'day - Number to set the day to between 1 - 7. + if day => 1 and day =< 7 + bus_putchar1(RTC_SETDAY) + bus_putlong1(day) + +PUB setDate(date) 'Sets the current real time clock date. + 'date - Number to set the date to between 1 - 31. + if date => 1 and date =< 31 + bus_putchar1(RTC_SETDATE) + bus_putlong1(date) + +PUB setMonth(month) 'Sets the current real time clock month. + 'month - Number to set the month to between 1 - 12. + if month => 1 and month =< 12 + bus_putchar1(RTC_SETMONTH) + bus_putlong1(month) + +PUB setYear(year) 'Sets the current real time clock year. + 'year - Number to set the year to between 2000 - 2099. + if year => 2000 and year =< 2099 + bus_putchar1(RTC_SETYEAR) + bus_putlong1(year) + +{PUB setNVSRAM(index, value) 'Sets the NVSRAM to the selected value (0 - 255) at the index (0 - 55). + 'index - The location in NVRAM to set (0 - 55). + 'value - The value (0 - 255) to change the location to. + if index => 0 AND index =< 55 AND value => 0 AND value =< 255 + bus_putchar1(RTC_SETNVSRAM) + bus_putlong1(index) + bus_putlong1(value) + +PUB getNVSRAM(index) 'Gets the selected NVSRAM value at the index (0 - 55). + 'Returns the selected location's value (0 - 255). + 'index - The location in NVRAM to get (0 - 55). + bus_putchar1(RTC_GETNVSRAM) + bus_putlong1(index) + return bus_getlong1 +} +{PUB pauseForSeconds(number) 'Pauses execution for a number of seconds. + 'number - Number of seconds to pause for between 0 and 2,147,483,647. + bus_putchar1(RTC_PAUSEFORSECONDS) + return bus_getlong1 + +PUB pauseForMilliseconds(number) 'Pauses execution for a number of milliseconds. + 'Returns a puesdo random value derived from the current clock frequency and the time when called. + 'number - Number of milliseconds to pause for between 0 and 2,147,483,647. + bus_putchar1(RTC_PAUSEFORMILLISECONDS) + return bus_getlong1 + +} + + + +con'--------------------------------------------------- AY-DMP-Player-------------------------------------------------------------------------------------------------------------- +{PUB ay_sdmpplay(stradr): err 'sid: dmp-datei stereo auf beiden sid's abspielen +''funktionsgruppe : sid +''funktion : sid: dmp-datei stereo auf beiden sid's abspielen +''busprotokoll : [158][sub.putstr][get.err] +'' : err - fehlernummer entspr. liste + + bus_putchar1(AYCOG_SDMPPLAY) + bus_putstr1(stradr) + err := bus_getchar1 +} +CON ''------------------------------------------------- SIDCog DMP-Player + +'PUB sid_mdmpplay(stradr): err 'sid: dmp-datei mono auf sid2 abspielen +''funktionsgruppe : sid +''funktion : dmp-datei auf sid2 von sd-card abspielen +''busprotokoll : [157][sub.putstr][get.err] +'' : err - fehlernummer entspr. liste + +' bus_putchar1(SCOG_MDMPPLAY) +' bus_putstr1(stradr) +' err := bus_getchar1 + +PUB sid_sdmpplay(stradr): err 'sid: dmp-datei stereo auf beiden sid's abspielen +''funktionsgruppe : sid +''funktion : sid: dmp-datei stereo auf beiden sid's abspielen +''busprotokoll : [158][sub.putstr][get.err] +'' : err - fehlernummer entspr. liste + + bus_putchar1(SCOG_SDMPPLAY) + bus_putstr1(stradr) + err := bus_getchar1 + +PUB sid_dmpstop + bus_putchar1(SCOG_DMPSTOP) + +PUB sid_dmppause + bus_putchar1(SCOG_DMPPAUSE) + +PUB sid_dmpstatus: status + bus_putchar1(SCOG_DMPSTATUS) + status := bus_getchar1 + +PUB sid_dmppos: wert + bus_putchar1(SCOG_DMPPOS) + wert := bus_getlong1 + + +PUB sid_dmplen: wert + bus_putchar1(SCOG_DMPLEN) + ' bus_getlong1 + wert := bus_getlong1 + +PUB sid_mute(sidnr) 'sid: chips stummschalten + bus_putchar1(SCOG_MUTE) + bus_putchar1(sidnr) + +pub sid_resetRegisters + bus_putchar1(196) + bus_putchar1(197) + +PUB sid_dmpreg: stradr | i 'sid: dmp-register empfangen +' daten im puffer +' word frequenz kanal 1 +' word frequenz kanal 2 +' word frequenz kanal 3 +' byte volume + + i := 0 + bus_putchar1(199) + repeat 7 + byte[@strpuffer + i++] := bus_getchar1 + return @strpuffer +CON ''------------------------------------------------- SIDCog1-Funktionen + +PUB sid1_setRegister(reg,val) + bus_putchar1(SCOG1_setRegister) + bus_putchar1(reg) + bus_putchar1(val) + +PUB sid1_updateRegisters(regadr) + bus_putchar1(SCOG1_setRegister) + repeat 25 + bus_putchar1(byte[regadr++]) + +PUB sid1_setVolume(vol) + bus_putchar1(SCOG1_setVolume) + bus_putchar1(vol) + +PUB sid1_play(channel, freq, waveform, attack, decay, sustain, release) + bus_putchar1(SCOG1_play) + bus_putchar1(channel) + bus_putchar1(freq) + bus_putchar1(waveform) + bus_putchar1(attack) + bus_putchar1(decay) + bus_putchar1(sustain) + bus_putchar1(release) + +PUB sid1_noteOn(channel, freq) + bus_putchar1(SCOG1_noteOn) + bus_putchar1(channel) + bus_putlong1(freq) + +PUB sid1_noteOff(channel) + bus_putchar1(SCOG1_noteOff) + bus_putchar1(channel) + +PUB sid1_setFreq(channel,freq) + bus_putchar1(SCOG1_setFreq) + bus_putchar1(channel) + bus_putlong1(freq) + +PUB sid1_setWaveform(channel,waveform) + bus_putchar1(SCOG1_setWaveform) + bus_putchar1(channel) + bus_putchar1(waveform) + +PUB sid1_setPWM(channel, val) + bus_putchar1(SCOG1_setPWM) + bus_putchar1(channel) + bus_putlong1(val) + +PUB sid1_setADSR(channel, attack, decay, sustain, release ) + bus_putchar1(SCOG1_setADSR) + bus_putchar1(channel) + bus_putchar1(attack) + bus_putchar1(decay) + bus_putchar1(sustain) + bus_putchar1(release) + +PUB sid1_setResonance(val) + bus_putchar1(SCOG1_setResonance) + bus_putchar1(val) + +PUB sid1_setCutoff(freq) + bus_putchar1(SCOG1_setCutoff) + bus_putlong1(freq) + +PUB sid1_setFilterMask(ch1,ch2,ch3) + bus_putchar1(SCOG1_setFilterMask) + bus_putchar1(ch1) + bus_putchar1(ch2) + bus_putchar1(ch3) + +PUB sid1_setFilterType(lp,bp,hp) + bus_putchar1(SCOG1_setFilterType) + bus_putchar1(lp) + bus_putchar1(bp) + bus_putchar1(hp) + +PUB sid1_enableRingmod(ch1,ch2,ch3) + bus_putchar1(SCOG1_enableRingmod) + bus_putchar1(ch1) + bus_putchar1(ch2) + bus_putchar1(ch3) + +PUB sid1_enableSynchronization(ch1,ch2,ch3) + bus_putchar1(SCOG1_enableSynchronization) + bus_putchar1(ch1) + bus_putchar1(ch2) + bus_putchar1(ch3) +pub sid_beep(n) + bus_putchar1(SCOG_BEEP) + bus_putchar1(n) + +CON ''------------------------------------------------- SIDCog2-Funktionen + +PUB sid2_setRegister(reg,val) + bus_putchar1(SCOG2_setRegister) + bus_putchar1(reg) + bus_putchar1(val) + +PUB sid2_updateRegisters(regadr) + bus_putchar1(SCOG2_setRegister) + repeat 25 + bus_putchar1(byte[regadr++]) + +PUB sid2_setVolume(vol) + bus_putchar1(SCOG2_setVolume) + bus_putchar1(vol) + +PUB sid2_play(channel, freq, waveform, attack, decay, sustain, release) + bus_putchar1(SCOG2_play) + bus_putchar1(channel) + bus_putchar1(freq) + bus_putchar1(waveform) + bus_putchar1(attack) + bus_putchar1(decay) + bus_putchar1(sustain) + bus_putchar1(release) + +PUB sid2_noteOn(channel, freq) + bus_putchar1(SCOG2_noteOn) + bus_putchar1(channel) + bus_putlong1(freq) + +PUB sid2_noteOff(channel) + bus_putchar1(SCOG2_noteOff) + bus_putchar1(channel) + +PUB sid2_setFreq(channel,freq) + bus_putchar1(SCOG2_setFreq) + bus_putchar1(channel) + bus_putlong1(freq) + +PUB sid2_setWaveform(channel,waveform) + bus_putchar1(SCOG2_setWaveform) + bus_putchar1(channel) + bus_putchar1(waveform) + +PUB sid2_setPWM(channel, val) + bus_putchar1(SCOG2_setPWM) + bus_putchar1(channel) + bus_putlong1(val) + +PUB sid2_setADSR(channel, attack, decay, sustain, release ) + bus_putchar1(SCOG2_setADSR) + bus_putchar1(channel) + bus_putchar1(attack) + bus_putchar1(decay) + bus_putchar1(sustain) + bus_putchar1(release) + +PUB sid2_setResonance(val) + bus_putchar1(SCOG2_setResonance) + bus_putchar1(val) + +PUB sid2_setCutoff(freq) + bus_putchar1(SCOG2_setCutoff) + bus_putlong1(freq) + +PUB sid2_setFilterMask(ch1,ch2,ch3) + bus_putchar1(SCOG2_setFilterMask) + bus_putchar1(ch1) + bus_putchar1(ch2) + bus_putchar1(ch3) + +PUB sid2_setFilterType(lp,bp,hp) + bus_putchar1(SCOG2_setFilterType) + bus_putchar1(lp) + bus_putchar1(bp) + bus_putchar1(hp) + +PUB sid2_enableRingmod(ch1,ch2,ch3) + bus_putchar1(SCOG2_enableRingmod) + bus_putchar1(ch1) + bus_putchar1(ch2) + bus_putchar1(ch3) + +PUB sid2_enableSynchronization(ch1,ch2,ch3) + bus_putchar1(SCOG2_enableSynchronization) + bus_putchar1(ch1) + bus_putchar1(ch2) + bus_putchar1(ch3) + + +OBJ '' B E L L A T R I X + +CON ''------------------------------------------------- CHIP-MANAGMENT + +PUB belgetcogs:belcogs 'chip-mgr: verwendete cogs abfragen + + bus_putchar2(BEL_CMD) 'kommandosequenz einleiten + bus_putchar2(BMGR_GETCOGS) 'code 5 = freie cogs + belcogs := bus_getchar2 'statuswert empfangen +pub bel_get:vers + bus_putchar2(BEL_CMD) 'kommandosequenz einleiten + bus_putchar2(BMGR_GETVER) 'code 95 = tiledriver 64 farben + vers := bus_getlong2 'statuswert empfangen + +PUB belgetspec:spec 'chip-mgr: spezifikationen abfragen +''funktionsgruppe : cmgr +''funktion : abfrage der version und spezifikation des chips +''busprotokoll : [089][sub_getlong.spec] +'' : spec - spezifikation +'' +'' +'' +---------- +'' | +-------- +'' | |+------- vektor +'' | ||+------ grafik +'' | |||+----- text +'' | ||||+---- maus +'' | |||||+--- tastatur +'' | ||||||+-- vga +'' | |||||||+- tv +''spezifikation = %00000000_00000000_00000000_00010110 + + bus_putchar2(BEL_CMD) 'kommandosequenz einleiten + bus_putchar2(BMGR_GETSPEC) + spec := bus_getlong2 + +PUB belreset 'chip-mgr: bellatrix reset +{{breset - bellatrix neu starten}} + + bus_putchar2(BEL_CMD) 'kommandosequenz einleiten + bus_putchar2(BMGR_REBOOT) 'code 99 = reboot + +PUB belload(stradr) 'chip-mgr: neuen bellatrix-code booten + + bus_putchar2(BEL_CMD) 'kommandosequenz einleiten + bus_putchar2(BMGR_LOAD) 'code 87 = code laden + waitcnt(cnt + 2_000_000) 'warte bis bel fertig ist + bload(stradr) + waitcnt(cnt + 2_000_000) 'warte bis bel fertig ist + +PUB bload(stradr) | n,rc,ii,plen 'system: bellatrix mit grafiktreiber initialisieren +{{bload(stradr) - bellatrix mit grafiktreiber initialisieren + wird zusätzlich zu belload gebraucht, da situationen auftreten, in denen bella ohne reset (kaltstart) mit + einem treiber versorgt werden muß. ist der bella-loader aktiv, reagiert er nicht auf das reset-kommando. + stradr - adresse eines 0-term-strings mit dem dateinamen des bellatrixtreibers +}} + +' kopf der bin-datei einlesen ------------------------------------------------------ + rc := sdopen("r",stradr) 'datei öffnen + repeat ii from 0 to 15 '16 bytes header --> bellatrix + n := sdgetc + bus_putchar2(n) + sdclose 'bin-datei schießen + +' objektgröße empfangen + plen := bus_getchar2 << 8 'hsb empfangen + plen := plen + bus_getchar2 'lsb empfangen + +' bin-datei einlesen ------------------------------------------------------ + sdopen("r",stradr) 'bin-datei öffnen + repeat ii from 0 to plen-1 'datei --> bellatrix + n := sdgetc + bus_putchar2(n) + sdclose + + +CON ''------------------------------------------------- KEYBOARD + +PUB key:wert 'key: holt tastaturcode +{{key:wert - key: übergibt tastaturwert}} + bus_putchar2($0) 'kommandosequenz einleiten + bus_putchar2($2) 'code 2 = tastenwert holen + wert := bus_getchar2 'tastenwert empfangen + +PUB keyspec:wert 'key: statustasten zum letzten tastencode + bus_putchar2($0) 'kommandosequenz einleiten + bus_putchar2($4) 'code 2 = tastenwert holen + wert := bus_getchar2 'wert empfangen + + +PUB keystat:status 'key: übergibt tastaturstatus +{{keystat:status - key: übergibt tastaturstatus}} + bus_putchar2($0) 'kommandosequenz einleiten + bus_putchar2($1) 'code 1 = tastaturstatus + status := bus_getchar2 'statuswert empfangen + +PUB keywait:n 'key: wartet bis taste gedrückt wird +{{keywait: n - key: wartet bis eine taste gedrückt wurde}} + repeat + until keystat > 0 + return key + +pub inkey:n + bus_putchar2($0) 'kommandosequenz einleiten + bus_putchar2($7) 'code 2 = tastenwert holen + n := bus_getchar2 'wert empfangen + +pub clearkey + bus_putchar2($0) + bus_putchar2($D) +CON ''------------------------------------------------- SCREEN +'var byte globalcolor 'gesetzte hintergrundfarbe +PUB print(stringptr)|c 'screen: bildschirmausgabe einer zeichenkette (0-terminiert) +{{print(stringptr) - screen: bildschirmausgabe einer zeichenkette (0-terminiert)}} + repeat strsize(stringptr) + c:=byte[stringptr++] + bus_putchar2(c) + if serial==1 + ser.tx(c) +{pub ser_print(strptr)|c + repeat strsize(strptr) + c:=byte[strptr++] + ser.tx(c) +} +pub get_window:a + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_Get_Window) + a:=bus_getchar2 + +pub windel(num)|i,c + i:=$7E500 + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_Del_Window) + bus_putchar2(num) + repeat 17 + c:=ram_rdbyte(i++) + bus_putchar2(c) + +pub window(win,farbe1,farbe2,farbe3,farbe4,farbe5,farbe6,farbe7,farbe8,y,x,yy,xx,modus,shd)',frm) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_Window) + bus_putchar2(win) + bus_putchar2(farbe1) + bus_putchar2(farbe2) + bus_putchar2(farbe3) + bus_putchar2(farbe4) + bus_putchar2(farbe5) + bus_putchar2(farbe6) + bus_putchar2(farbe7) + bus_putchar2(farbe8) + bus_putchar2(y) + bus_putchar2(x) + bus_putchar2(yy) + bus_putchar2(xx) + bus_putchar2(modus) + bus_putchar2(shd) + +pub printfont(win,str,f1,f2,f3,y,x,offset) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_PRINTFONT) + bus_putchar2(win) + bus_putchar2(f1) + bus_putchar2(f2) + bus_putchar2(f3) + bus_putchar2(y) + bus_putchar2(x) + bus_putchar2(offset) + bus_putstr2(str) + +pub Set_Titel_Status(win,modus,char) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_SET_TITELSTATUS) + bus_putchar2(win) 'Fensternummer + bus_putchar2(modus) 'titel oder statustext + bus_putstr2(char) 'String + +pub printBoxSize(win,y, x,yy, xx) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_BoxSize) + bus_putchar2(win) + bus_putchar2(y) + bus_putchar2(x) + bus_putchar2(yy) + bus_putchar2(xx) +pub printwindow(win) 'wieder hauptfenster setzen + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_WIN) + bus_putchar2(win) +pub printBoxColor(win,vor, hinter,cursor) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_BOXCOLOR) + bus_putchar2(win) + bus_putchar2(vor) + bus_putchar2(hinter) + bus_putchar2(cursor) + +pub printCursorRate(rate) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_CursorRate) + bus_putchar2(rate) + +pub display2dbox(farbe, y, x, yy, xx,shd) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_2DBOX) + bus_putchar2(farbe) + bus_putchar2(y) + bus_putchar2(x) + bus_putchar2(yy) + bus_putchar2(xx) + bus_putchar2(shd) + +pub scrollup(lines, farbe, y, x, yy, xx,rate) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_SCOLLUP) + bus_putchar2(lines) + bus_putchar2(farbe) + bus_putchar2(y) + bus_putchar2(x) + bus_putchar2(yy) + bus_putchar2(xx) + bus_putchar2(rate) + +pub scrolldown(lines, farbe, y, x, yy, xx,rate) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_SCOLLDOWN) + bus_putchar2(lines) + bus_putchar2(farbe) + bus_putchar2(y) + bus_putchar2(x) + bus_putchar2(yy) + bus_putchar2(xx) + bus_putchar2(rate) + +pub display3DBox(topColor, centerColor, bottomColor, y, x, yy, xx) + + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_3DBOX) + bus_putchar2(topColor) + bus_putchar2(centerColor) + bus_putchar2(bottomColor) + bus_putchar2(y) + bus_putchar2(x) + bus_putchar2(yy) + bus_putchar2(xx) + +pub display3DFrame(topColor, centerColor, bottomColor, y, x, yy, xx) + + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_3DFRAME) + bus_putchar2(topColor) + bus_putchar2(centerColor) + bus_putchar2(bottomColor) + bus_putchar2(y) + bus_putchar2(x) + bus_putchar2(yy) + bus_putchar2(xx) + +pub send_button_param(number,x,y,xx) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_Send_BUTTON) + bus_putchar2(number) + bus_putchar2(x) + bus_putchar2(y) + bus_putchar2(xx) + +pub destroy3dbutton(number) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_ERS_3DBUTTON) + bus_putchar2(number) + +pub Plot_Line(x, y, xx, yy,farbe) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_LINE) + bus_putchar2(x) + bus_putchar2(y) + bus_putchar2(xx) + bus_putchar2(yy) + bus_putchar2(farbe) + +pub PlotPixel(farbe,x,y) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_PIXEL) + bus_putchar2(farbe) + bus_putchar2(y) + bus_putchar2(x) +pub Actorset(tnr1,col1,col2,col3,x,y) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_ACTOR) + bus_putchar2(tnr1) + bus_putchar2(col1) + bus_putchar2(col2) + bus_putchar2(col3) + bus_putchar2(x) + bus_putchar2(y) +pub setactor_xy(k) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_ACTORPOS) + bus_putchar2(k) + 'bus_putchar2(y) +pub setactionkey(k1,k2,k3,k4,k5) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_ACT_KEY) + bus_putchar2(k1) + bus_putchar2(k2) + bus_putchar2(k3) + bus_putchar2(k4) + bus_putchar2(k5) +pub reset_sprite + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_SPRITE_RESET) +pub set_sprite(num,tnr,tnr2,f1,f2,f3,dir,strt,end,x,y) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_SPRITE_PARAM) + bus_putchar2(num) + bus_putchar2(tnr) 'tilenrnummer + bus_putchar2(tnr2) 'tilenrnummer2 + bus_putchar2(f1) 'farben 1-3 + bus_putchar2(f2) + bus_putchar2(f3) + bus_putchar2(dir) 'richtung + bus_putchar2(strt) 'startposition + bus_putchar2(end) 'endposition + bus_putchar2(x) 'x und y parameter + bus_putchar2(y) +pub Sprite_Move(on) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_SPRITE_MOVE) + bus_putchar2(on) +pub set_sprite_speed(wert) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_SPRITE_SPEED) + bus_putchar2(wert) +pub get_Collision + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_GET_COLLISION) + return bus_getchar2 +pub get_actor_pos(n) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_GET_ACTOR_POS) + bus_putchar2(n) + return bus_getchar2 +pub send_block(n,tnr) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_SEND_BLOCK) + bus_putchar2(n) + bus_putchar2(tnr) +pub Change_Backuptile(tnr,f1,f2,f3) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_CHANGE_BACKUP) + bus_putchar2(tnr) + bus_putchar2(f1) + bus_putchar2(f2) + bus_putchar2(f3) + +{pub set_ersatz_item(tnr,f1,f2,f3) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_ERSATZ_ITEM) + bus_putchar2(tnr) + bus_putchar2(f1) + bus_putchar2(f2) + bus_putchar2(f3) +} +{pub fire_parameter(tnr,f1,f2,f3,dir,range) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_FIRE_PARAM) + bus_putchar2(tnr) + bus_putchar2(f1) + bus_putchar2(f2) + bus_putchar2(f3) + bus_putchar2(dir) + bus_putchar2(range) + } +{pub fire(x,y) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_FIRE) + bus_putchar2(x) + bus_putchar2(y) +} +{ +pub action(on) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_ACTION) + bus_putchar2(on) + +pub getactor_x :wert + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_ACTX) + wert:=bus_getchar2 + +pub getactor_y :wert + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_ACTY) + wert:=bus_getchar2 +} +pub displayString(char,foregroundColor, backgroundColor, y, x) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_STRING) + bus_putchar2(foregroundColor) + bus_putchar2(backgroundColor) + bus_putchar2(y) + bus_putchar2(x) + bus_putstr2(char) +' bus_putchar2(strsize(char)) + +' repeat strsize(char) +' bus_putchar2(byte[char++])'(byte[char++]) + + +pub scrollString(str,characterRate, foregroundColor, backgroundColor, y, x, xx) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_SCROLLSTRING) + bus_putchar2(characterRate) + bus_putchar2(foregroundColor) + bus_putchar2(backgroundColor) + bus_putchar2(y) + bus_putchar2(x) + bus_putchar2(xx) + 'bus_putchar2(dir) + bus_putstr2(str) + 'bus_putchar2(strsize(str)) + +' repeat strsize(str) +' bus_putchar2(byte[str++]) + + + +pub setpos(y,x) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_SETPOS) + bus_putchar2(y) + bus_putchar2(x) +pub setx(x) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_SETX) + bus_putchar2(x) +pub sety(y) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_SETY) + bus_putchar2(y) + +pub displayTile(tnr,pcol,scol,tcol, row, column) + + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_TILE) + bus_putchar2(tnr) + bus_putchar2(pcol) + bus_putchar2(scol) + bus_putchar2(tcol) + bus_putchar2(row) + bus_putchar2(column) + +pub Mousepointer(adr)|c + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_LD_MOUSEPOINTER) + + repeat 16 + c:=ram_rdlong(adr) + bus_putlong2(c) + adr+=4 +pub mousebound(x,y,xx,yy) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_LD_MOUSEBOUND) + bus_putlong2(x) + bus_putlong2(y) + bus_putlong2(xx) + bus_putlong2(yy) + +pub loadtilebuffer(adr,anzahl)|c + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_LD_TILESET) + bus_putlong2(anzahl) + + repeat anzahl + c:=ram_rdlong(adr) + bus_putlong2(c) + adr+=4 +pub displaypic(pcol,scol,tcol,y,x,ytile,xtile) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_PIC) + bus_putchar2(pcol) + bus_putchar2(scol) + bus_putchar2(tcol) + bus_putchar2(y) + bus_putchar2(x) + bus_putchar2(ytile) + bus_putchar2(xtile) + +pub getx |x + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_GETX) + x:=bus_getchar2 + return x +pub gety |y + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_GETY) + y:=bus_getchar2 + return y + +pub DisplayMouse(on,color) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_MOUSE) + bus_putchar2(on) + bus_putchar2(color) +pub Displaypalette(x,y) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_DPL_PALETTE) + bus_putchar2(x) + bus_putchar2(y) +{pub Backup(x,y,xx,yy) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_BACKUP) + bus_putchar2(x) + bus_putchar2(y) + bus_putchar2(xx) + bus_putchar2(yy) + +pub restore(x,y,xx,yy) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_RESTORE) + bus_putchar2(x) + bus_putchar2(y) + bus_putchar2(xx) + bus_putchar2(yy) +} +pub Backup_Area(x,y,xx,yy,adr)|a,b,d + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_BACK) + bus_putchar2(x) + bus_putchar2(y) + bus_putchar2(xx) + bus_putchar2(yy) + repeat a from y to yy + repeat b from x to xx + d:=bus_getlong2 + ram_wrlong(d,adr) + adr+=4 + ram_wrword(bus_getword2,adr) + adr+=2 + +pub restore_Area(x,y,xx,yy,adr)|a,b + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_REST) + bus_putchar2(x) + bus_putchar2(y) + bus_putchar2(xx) + bus_putchar2(yy) + repeat a from y to yy + repeat b from x to xx + bus_putlong2(ram_rdlong(adr)) + adr+=4 + bus_putword2(ram_rdword(adr)) + adr+=2 + +PUB printq(stringptr) 'screen: zeichenkette ohne steuerzeichen (0-terminiert) +{{print(stringptr) - screen: bildschirmausgabe einer zeichenkette (0-terminiert)}} + repeat strsize(stringptr) + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_SCR_CHAR) + bus_putchar2(byte[stringptr]) + if serial==1 + ser.tx(byte[stringptr++]) +{PUB printcstr(eadr) | i,len 'screen: bildschirmausgabe einer zeichenkette im eram! (mit längenbyte) +{{printcstr(eadr) - screen: bildschirmausgabe einer zeichenkette im eram (mit längenbyte)}} + len := ram_rdbyte(1,eadr) + repeat i from 1 to len + eadr++ + bus_putchar2(ram_rdbyte(1,eadr)) +} +PUB printdec(value) | 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" + printchar(x) + c:=value / i + "0" + value //= i + result~~ + elseif result or i == 1 + printchar("0") + i /= 10 'nächste stelle + +PUB printhex(value, digits) 'screen: hexadezimalen zahlenwert auf bildschirm ausgeben +{{hex(value,digits) - screen: hexadezimale bildschirmausgabe eines zahlenwertes}} + value <<= (8 - digits) << 2 + repeat digits + printchar(lookupz((value <-= 4) & $F : "0".."9", "A".."F")) + if serial==1 + ser.tx(lookupz((value <-= 4) & $F : "0".."9", "A".."F")) + +PUB printbin(value, digits) |c 'screen: binären zahlenwert auf bildschirm ausgeben + + value <<= 32 - digits + repeat digits + c:=(value <-= 1) & 1 + "0" + printchar(c) + if serial==1 + ser.tx(c) + +PUB printchar(c):c2 'screen: einzelnes zeichen auf bildschirm ausgeben +{{printchar(c) - screen: bildschirmausgabe eines zeichens}} + bus_putchar2(c) + + if serial==1 + ser.tx(c) + c2 := c + +PUB printqchar(c):c2 'screen: zeichen ohne steuerzeichen ausgeben +{{printqchar(c) - screen: bildschirmausgabe eines zeichens}} + bus_putchar2(BEL_CMD) + bus_putchar2(BEL_SCR_CHAR) + bus_putchar2(c) + c2 := c + if serial==1 + ser.tx(c) +PUB printnl 'screen: $0D - CR ausgeben +{{printnl - screen: $0D - CR ausgeben}} + bus_putchar2(CHAR_NL) + if serial==1 + ser.tx($0D) + ser.tx($0A) + +PUB printcls 'screen: screen löschen +{{printcls - screen: screen löschen}} + printchar(12) + if serial==1 + ser.tx(16) + +PUB printbs 'screen: backspace +{{curon - screen: backspace senden}} + printchar(BEL_BS) + if serial==1 + ser.tx(BEL_BS) + +pub printleft + printchar(5) +pub printright + printchar(6) +pub mousex + bus_putchar2(BEL_CMD) 'kommandosequenz einleiten + bus_putchar2(BEL_MOUSEX) 'MOUSE-X-Position abfragen + return bus_getchar2 +pub mousey + bus_putchar2(BEL_CMD) 'kommandosequenz einleiten + bus_putchar2(BEL_MOUSEY) 'MOUSE-Y-Position abfragen + 'y:=bus_getchar2 + + return bus_getchar2 'y-signal invertieren sonst geht der Mauszeiger hoch, wenn man runterscrollt + +pub mousez + bus_putchar2(BEL_CMD) 'kommandosequenz einleiten + bus_putchar2(BEL_MOUSEZ) 'MOUSE-Z-Position abfragen + return bus_getlong2 + +pub mouse_button(b) + bus_putchar2(BEL_CMD) 'kommandosequenz einleiten + bus_putchar2(BEL_MOUSE_BUTTON) 'MOUSE-Button abfragen + bus_putchar2(b) + return bus_getchar2 +'pub getblock(nummer):wert +' bus_putchar2(BEL_CMD) 'kommandosequenz einleiten +' bus_putchar2(BEL_READ_BLOCK) 'Tile auf Pos-nummer abfragen +' bus_putword2(nummer) +' wert:=bus_getchar2 +OBJ ''################################################## V E N A T R I X ############################################################################################################# +CON ''------------------------------------------------- CHIP MANAGEMENT + +PUB VEN_GET:vers +' bus_putchar3(VEN_CMD) + bus_putchar3(VEN_GETVER) + vers := bus_getlong3 'statuswert empfangen +PUB VEN_GETCOGS:cogs +' bus_putchar3(VEN_CMD) + bus_putchar3(Ven_getcgs) + cogs:=bus_getchar3 +PUB Venreset 'chip-mgr: bellatrix reset +{{breset - Venatrix neu starten}} +' bus_putchar3(VEN_CMD) + bus_putchar3(VEN_REBOOT) 'code 99 = reboot + +PUB venload(stradr) 'chip-mgr: neuen Venatrix-code booten +' bus_putchar3(VEN_CMD) + bus_putchar3(VEN_LOAD) 'code 97 = code laden + waitcnt(cnt + 2_000_000) 'warte bis ven fertig ist + vload(stradr) + +PUB vload(stradr) | n,rc,ii,plen 'system: venatrix mit neuen Code versorgen + +' kopf der bin-datei einlesen ------------------------------------------------------ + rc := sdopen("r",stradr) 'datei öffnen + repeat ii from 0 to 15 '16 bytes header --> Venatrix + n := sdgetc + bus_putchar3(n) + sdclose 'bin-datei schießen + +' objektgröße empfangen + plen := bus_getchar3 << 8 'hsb empfangen + plen := plen + bus_getchar3 'lsb empfangen + +' bin-datei einlesen ------------------------------------------------------ + sdopen("r",stradr) 'bin-datei öffnen + repeat ii from 0 to plen-1 'datei --> bellatrix + n := sdgetc + bus_putchar3(n) + sdclose + + +CON ''------------------------------------------------- Plexbus und Gamedevices + +PUB plxrun 'plx: bus freigeben, poller starten + + bus_putchar1(gc#a_plxRun) + +PUB plxhalt 'plx: bus anfordern, poller anhalten + + bus_putchar1(gc#a_plxHalt) + +PUB plxin(adr):wert 'plx: port einlesen + + bus_putchar1(gc#a_plxIn) + bus_putchar1(adr) + wert := bus_getchar1 + +PUB plxout(adr,wert) 'plx: port ausgeben + + bus_putchar1(gc#a_plxOut) + bus_putchar1(adr) + bus_putchar1(wert) + +PUB joy(chan):wert 'game: joystick abfragen + + bus_putchar1(gc#a_Joy) + bus_putchar1(chan) + wert := bus_getchar1 + +PUB paddle:wert 'game: paddle abfrage + + bus_putchar1(gc#a_Paddle) + wert := wert + bus_getchar1 << 8 + wert := wert + bus_getchar1 + +PUB pad:wert 'game: pad abfrage + + bus_putchar1(gc#a_Pad) + wert := wert + bus_getchar1 << 16 + wert := wert + bus_getchar1 << 8 + wert := wert + bus_getchar1 + +pub getreg(reg):wert + bus_putchar1(gc#a_plxGetReg) + bus_putchar1(reg) + wert:=bus_getchar1 + +pub set_plxAdr(adda,Port) + bus_putchar1(gc#a_plxSetAdr) 'adressen adda/ports für poller setzen + bus_putchar1(adda) + bus_putchar1(port) + +pub plxping(adr):wert + bus_putchar1(gc#a_plxPing) 'adressen adda/ports für poller setzen + bus_putchar1(adr) + wert:=bus_getchar1 + +pub plxstart + bus_putchar1(gc#a_plxStart) 'I2C Start-Befehl + +pub plxstop + bus_putchar1(gc#a_plxStop) 'I2C Stop-Befehl + +pub plxwrite(data):wert + bus_putchar1(gc#a_plxWrite) 'I2C Write + bus_putchar1(data) 'Daten + wert:=bus_getchar1 'ack bit + +pub plxread(ack):wert + bus_putchar1(gc#a_plxRead) 'I2C Read + bus_putchar1(ack) 'ack Bit + wert:=bus_getchar1 'Rückgabewert + +OBJ '' R E G N A T I X + +CON ''------------------------------------------------- BUS +'prop 1 - administra (bus_putchar1, bus_getchar1) +'prop 2 - bellatrix (bus_putchar2, bus_getchar2) +'prop 3 - venatrix (bus_putchar3, bus_getchar3) +PUB bus_init 'bus: initialisiert bussystem +{{bus_init - bus: initialisierung aller bussignale }} + outa[bus_wr] := 1 ' schreiben inaktiv + outa[reg_ram1] := 1 ' ram1 inaktiv + outa[reg_ram2] := 1 ' ram2 inaktiv + outa[reg_prop1] := 1 ' prop1 inaktiv + outa[reg_prop2] := 1 ' prop2 inaktiv + outa[reg_prop3] := 1 ' prop3 inaktiv ->Venatrix + outa[busclk] := 0 ' busclk startwert + outa[reg_al] := 0 ' strobe aus + dira := db_in ' datenbus auf eingabe schalten + outa[18..8] := 0 ' adresse a0..a10 auf 0 setzen + outa[23] := 1 ' obere adresse in adresslatch übernehmen + outa[23] := 0 + + +PUB bus_getword1: wert 'bus: 16 bit von administra empfangen hsb/lsb + + wert := bus_getchar1 << 8 + wert := wert + bus_getchar1 + +PUB bus_putword1(wert) 'bus: 16 bit an administra senden hsb/lsb + + bus_putchar1(wert >> 8) + bus_putchar1(wert) + +PUB bus_getlong1: wert 'bus: long von administra empfangen hsb/lsb + + wert := bus_getchar1 << 24 '32 bit empfangen hsb/lsb + wert := wert + bus_getchar1 << 16 + wert := wert + bus_getchar1 << 8 + wert := wert + bus_getchar1 + +PUB bus_putlong1(wert) 'bus: long zu administra senden hsb/lsb + + bus_putchar1(wert >> 24) '32bit wert senden hsb/lsb + bus_putchar1(wert >> 16) + bus_putchar1(wert >> 8) + bus_putchar1(wert) + +PUB bus_getstr1: stradr | len,i 'bus: string von administra empfangen + + len := bus_getchar1 'längenbyte empfangen + repeat i from 0 to len - 1 '20 zeichen dateinamen empfangen + strpuffer[i] := bus_getchar1 + strpuffer[i] := 0 + return @strpuffer + +PUB bus_putstr1(stradr) | len,i 'bus: string zu administra senden + + len := strsize(stradr) + bus_putchar1(len) + repeat i from 0 to len - 1 + bus_putchar1(byte[stradr++]) + +PUB bus_putstr2(stradr) | len,i 'bus: string zu bellatrix senden + + len := strsize(stradr) + bus_putchar2(len) + repeat i from 0 to len - 1 + bus_putchar2(byte[stradr++]) + +PUB bus_getstr2: stradr | len,i 'bus: string von administra empfangen + + len := bus_getchar2 'längenbyte empfangen + repeat i from 0 to len - 1 '20 zeichen dateinamen empfangen + strpuffer[i] := bus_getchar2 + strpuffer[i] := 0 + return @strpuffer + +PUB bus_putchar1(c) 'bus: byte an administra senden +{{bus_putchar1(c) - bus: byte senden an prop1 (administra)}} + + 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 + +PUB bus_getchar1: wert 'bus: byte vom administra empfangen +{{bus_getchar1:wert - bus: byte empfangen von prop1 (administra)}} + outa := %00000111_01011000_00000000_00000000 'prop1=0, wr=1, busclk=1 + waitpeq(%00000000_00000000_00000000_00000000,%00001000_00000000_00000000_00000000,0) 'hs=0? + wert := ina[7..0] 'daten einlesen + outa := %00000101_01111000_00000000_00000000 'prop1=1, busclk=0 + +PUB bus_putchar2(c) 'bus: byte an prop1 (bellatrix) senden +{{bus_putchar2(c) - bus: byte senden an prop2 (bellatrix)}} + outa := %00001001_00111000_00000000_00000000 'prop2=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, prop2=1, busclk=0 + + 'ram_rw.putchar2(c) +PUB bus_getchar2: wert 'bus: byte vom prop1 (bellatrix) empfangen +{{bus_getchar2:wert - bus: byte empfangen von prop2 (bellatrix)}} + outa := %00000111_00111000_00000000_00000000 'prop2=0, wr=1, busclk=1 + waitpeq(%00000000_00000000_00000000_00000000,%00001000_00000000_00000000_00000000,0) 'hs=0? + wert := ina[7..0] 'daten einlesen + outa := %00000101_01111000_00000000_00000000 'prop2=1, busclk=0 + +PUB bus_putchar3(c) 'bus: byte an prop1 (bellatrix) senden +{{bus_putchar2(c) - bus: byte senden an prop3 (venatrix)}} +' outa := %00001000_01011000_00000000_00000000 'prop1=0, wr=0 +' outa := %00001000_00111000_00000000_00000000 'prop2=0, wr=0 +' outa := %00001000_01111000_00000000_00000000 'prop3=0, wr=0 + + outa := %00001000_01111000_00000000_00000000 'prop3=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, prop3=1, busclk=0 + + 'ram_rw.putchar2(c) +PUB bus_getchar3: wert 'bus: byte vom prop1 (bellatrix) empfangen +{{bus_getchar3:wert - bus: byte empfangen von prop3 (venatrix)}} + outa := %00000110_01111000_00000000_00000000 'prop3=0, wr=1, busclk=1 + waitpeq(%00000000_00000000_00000000_00000000,%00001000_00000000_00000000_00000000,0) 'hs=0? + wert := ina[7..0] 'daten einlesen + outa := %00000101_01111000_00000000_00000000 'prop3=1, busclk=0 + +PUB bus_getword2: wert 'bus: 16 bit von bellatrix empfangen hsb/lsb + + wert := bus_getchar2 << 8 + wert := wert + bus_getchar2 + +PUB bus_putword2(wert) 'bus: 16 bit an bellatrix senden hsb/lsb + + bus_putchar2(wert >> 8) + bus_putchar2(wert) + +PUB bus_getlong2: wert 'bus: long von bellatrix empfangen hsb/lsb + + wert := bus_getchar2 << 24 '32 bit empfangen hsb/lsb + wert := wert + bus_getchar2 << 16 + wert := wert + bus_getchar2 << 8 + wert := wert + bus_getchar2 + +PUB bus_putlong2(wert) 'bus: long an bellatrix senden hsb/lsb + + bus_putchar2(wert >> 24) '32bit wert senden hsb/lsb + bus_putchar2(wert >> 16) + bus_putchar2(wert >> 8) + bus_putchar2(wert) +PUB bus_getword3: wert 'bus: 16 bit von venatrix empfangen hsb/lsb + + wert := bus_getchar3 << 8 + wert := wert + bus_getchar3 + +PUB bus_putword3(wert) 'bus: 16 bit an venatrix senden hsb/lsb + + bus_putchar3(wert >> 8) + bus_putchar3(wert) + +PUB bus_getlong3: wert 'bus: long von venatrix empfangen hsb/lsb + + wert := bus_getchar3 << 24 '32 bit empfangen hsb/lsb + wert := wert + bus_getchar3 << 16 + wert := wert + bus_getchar3 << 8 + wert := wert + bus_getchar3 + +PUB bus_putlong3(wert) 'bus: long an venatrix senden hsb/lsb + + bus_putchar3(wert >> 24) '32bit wert senden hsb/lsb + bus_putchar3(wert >> 16) + bus_putchar3(wert >> 8) + bus_putchar3(wert) +PUB bus_getstr3: stradr | len,i 'bus: string von administra empfangen + + len := bus_getchar3 'längenbyte empfangen + repeat i from 0 to len - 1 '20 zeichen dateinamen empfangen + strpuffer[i] := bus_getchar3 + strpuffer[i] := 0 + return @strpuffer + +PUB bus_putstr3(stradr) | len,i 'bus: string zu administra senden + + len := strsize(stradr) + bus_putchar3(len) + repeat i from 0 to len - 1 + bus_putchar3(byte[stradr++]) + +CON ''------------------------------------------------- eRAM/SPEICHERVERWALTUNG +{ + +Und so funktioniert es: Der Speicher (hier geht es nur um den eRAM!) ist in drei Teile gesplittet: + + 1. Ramdisk + 2. Heap + 3. Systemvariablen + +Wofür ist das jetzt gut? + +Das unkomlizierte Speichermodell: Wenn man in seinem Programm unkompliziert Speicher braucht, der nicht resident +gehalten werden braucht, nutzt man einfach die Routinen ram_* um auf diesen zuzugreifen. Nach dem Beenden +des Programms ist dieser Speicher (Heap) aber dann vogelfrei. Für die Adressierung mit diesen Routinen gibt es +zwei Modis: + + 1. sysmod - Hier entspricht die Adresse 0 auch der wirklichen physischen Adresse 0. + 2. usrmod - Hier entspricht die Adresse 0 dem Wert von "rbas" - ist also virtuell. + +In einem normalen Programm wird man den usrmod verwenden und nur auf den freien Speicher (Heap) zwischen rbas +und rend zugreifen. Das klingt im ersten Moment kompliziert, ist aber ganz einfach: wenn es einfach sein soll, +arbeite ich im usrmod und bekomme von Adresse 0000..nnnn den Bereich zwischen Ramdisk und den Systemvariablen +(rbas..rend) zu "sehen". Möchte aber ein Systemprogramm zum Beispiel auf die Systemvariablen oder die Internas +der Ramdisk zugreifen, so ist der sysmod gefragt. In diesem Modus wird der eRAM direkt adressiert. + +Die Ramdisk: Braucht die Anwendung aber residenten Speicher, so kann man sich einen Speicherblock als +Datei in der Ramdisk erzeugen und auf den Inhalt auch per direkter Adressierung mit rd_rdbyte/rd_wrbyte +zugreifen. In der Kommandozeile Regime ist es dann möglich, per xdir/xload und xsave auf diesen Speicher +bzw. Dateien zuzugreifen. + +Ach ja: Mit der Ramdisk ist es auch möglich mehrere Dateien zu öffnen und zu verwenden - rd_open liefert dafür +eine Filenummer fnr, die man bei allen Operationen benutzen muss! :) + +Wichtig ist es nur zu verstehen, dass der freie Speicher bei Verwendung der Ramdisk vogelfrei ist, +wenn die Anwendung beendet wird: Speichert ein Programm dort Daten und kehrt zur Kommandozeile zurück, +wird zum Beispiel durch laden oder speichern einer Datei in der Ramdisk die Variable "rbas" und +damit der freie Bereich in seiner Größe verändert ---> unsere Daten im freien Bereich befinden sich also nun +im usrmod an einer anderen Stelle oder sind überschrieben. + + + memory-map: + + 0000 --> datei 1 'ab adresse 0 liegen die dateien der ramdisk als + datei 2 'verkettete liste. das erste freie byte hinter der + ... 'wird mit der variable "rbas" definiert. + datei n + + rbas --> usermem start 'zwischen rbas und rend liegt der freie ram. + ... + rend --> usermen ende + + sysvar --> systemvariablen 'ab dieser adresse befinden sich die systemvariablem im eram + + + aufbau datei ramdisk: + + 1 long zeiger auf nächste datei (oder 0 bei letzter datei) + 1 long datenlänge + 12 byte dateiname 8+3-string + nn byte daten + + aufbau ftab: + + fnr dateinummer + + fnr 0 usermem + fnr 1..7 dateien + + fix := fnr * FCNT index in ftab + + ftab[fix+0] startadresse daten + ftab[fix+1] endadresse daten + ftab[fix+2] position in datei +} + +CON + + STARTRD = $80000 'startadresse der ramdisk + FILES = 8 'maximale anzahl von RAMDisk-Dateien, die gleichzeitig geöffnet werden können + FTCNT = 3 'anzahl longs pro eintrag + + sysmod = 0 + usrmod = 1 + + RDHLEN = 20 ' 4+4+12 - headerlänge + +VAR + +' long ftab[(files)*FTCNT] 'filedeskriptortabelle + '1. long = startadresse daten + '2. long = endadresse daten + '3. long = position in der datei +' long dpos 'position im dir (dir/next) +' byte dstr[13] 'string für dateinamen + + +PUB ram_rdbyte(adresse):wert 'eram: liest ein byte vom eram +{{ram_rdbyte(adresse):wert - eram: ein byte aus externem ram lesen}} +'rambank 1 000000 - 07FFFF +'rambank 2 080000 - 0FFFFF +'sys = 0 - systemmodus, keine virtualisierung +'sys = 1 - usermodus, virtualisierte adresse +'sysmodus: der gesamte speicher (2 x 512 KB) werden durchgängig adressiert +'usermodus: adresse 0 = rambas +' adresse max = ramend + wert:=ram_rw.rd_value(adresse,ram_rw#JOB_PEEK)'ram_rw.peek(adresse) +{ if sys 'usermodus? + adresse += rbas 'adresse virtualisieren + if adresse > rend 'adressbereich überschritten? + return 0 + + outa[15..8] := adresse >> 11 'höherwertige adresse setzen + outa[23] := 1 'obere adresse in adresslatch übernehmen + outa[23] := 0 + outa[18..8] := adresse 'niederwertige adresse setzen + if adresse < $080000 'rambank 1? + outa[reg_ram1] := 0 'ram1 selektieren (wert wird geschrieben) + wert := ina[7..0] 'speicherzelle einlesen + outa[reg_ram1] := 1 'ram1 deselektieren + else + outa[reg_ram2] := 0 'ram2 selektieren (wert wird geschrieben) + wert := ina[7..0] 'speicherzelle einlesen + outa[reg_ram2] := 1 'ram2 deselektieren +} +pub ram_fill(adresse,adresse2,wert) + ram_rw.ram_fill(adresse,adresse2,wert) +{pub getadr:wert + wert:=ram_rw.getadr +} +'pub ram_readline(adresse):line + +' line:=ram_rw.read(adresse) + +PUB ram_wrbyte(wert,adresse) 'eram: schreibt ein byte in eram +{{ram_wrbyte(wert,adresse) - eram: ein byte in externen ram schreiben}} +'rambank 1 000000 - 07FFFF +'rambank 2 080000 - 08FFFF +'sys = 0 - systemmodus, keine virtualisierung +'sys = 1 - usermodus, virtualisierte adresse +'sysmodus: der gesamte speicher (2 x 512 KB) werden durchgängig adressiert +'usermodus: adresse 0 = rambas +' adresse max = ramend +' +ram_rw.wr_value(adresse,wert,ram_rw#JOB_POKE) +{ if sys 'usermodus? + adresse += rbas 'adresse virtualisieren + if adresse > rend 'adressbereich überschritten? + return + + outa[bus_wr] := 0 'schreiben aktivieren + dira := db_out 'datenbus --> ausgang + outa[7..0] := wert 'wert --> datenbus + outa[15..8] := adresse >> 11 'höherwertige adresse setzen + outa[23] := 1 'obere adresse in adresslatch übernehmen + outa[23] := 0 + outa[18..8] := adresse 'niederwertige adresse setzen + if adresse < $080000 'rambank 1? + outa[reg_ram1] := 0 'ram1 selektieren (wert wird geschrieben) + outa[reg_ram1] := 1 'ram1 deselektieren + else + outa[reg_ram2] := 0 'ram2 selektieren (wert wird geschrieben) + outa[reg_ram2] := 1 'ram2 deselektieren + dira := db_in 'datenbus --> eingang + outa[bus_wr] := 1 'schreiben deaktivieren +} +PUB ram_rdlong(eadr): wert 'eram: liest long ab eadr +{{ram_rdlong - eram: liest long ab eadr}} +'sys = 0 - systemmodus, keine virtualisierung +'sys = 1 - usermodus, virtualisierte adresse +wert:=ram_rw.rd_value(eadr,ram_rw#JOB_RDLONG)'ram_rw.rd_long(eadr) +{ wert := ram_rdbyte(eadr) + wert += ram_rdbyte(eadr + 1) << 8 + wert += ram_rdbyte(eadr + 2) << 16 + wert += ram_rdbyte(eadr + 3) << 24 +} +PUB ram_rdword(eadr): wert 'eram: liest word ab eadr +{{ram_rdlong(eadr):wert - eram: liest word ab eadr}} +'sys = 0 - systemmodus, keine virtualisierung +'sys = 1 - usermodus, virtualisierte adresse +wert:=ram_rw.rd_value(eadr,ram_rw#JOB_RDWORD)'ram_rw.rd_word(eadr) +{ wert := ram_rdbyte(eadr) + wert += ram_rdbyte(eadr + 1) << 8 +} +PUB ram_wrlong(wert,eadr) 'eram: schreibt long ab eadr +{ram_wrlong(wert,eadr) - eram: schreibt long ab eadr} +'sys = 0 - systemmodus, keine virtualisierung +'sys = 1 - usermodus, virtualisierte adresse + ram_rw.wr_value(eadr,wert,ram_rw#JOB_WRLONG) +{ n := wert & $FF + ram_wrbyte(n,eadr) + n := (wert >> 8) & $FF + ram_wrbyte(n,eadr + 1) + n := (wert >> 16) & $FF + ram_wrbyte(n,eadr + 2) + n := (wert >> 24) & $FF + ram_wrbyte(n,eadr + 3) +} +PUB ram_wrword(wert,eadr) 'eram: schreibt word ab eadr +{{wr_word(wert,eadr) - eram: schreibt word ab eadr}} +'sys = 0 - systemmodus, keine virtualisierung +'sys = 1 - usermodus, virtualisierte adresse + ram_rw.wr_value(eadr,wert,ram_rw#JOB_WRWORD) +{ n := wert & $FF + ram_wrbyte(n,eadr) + n := (wert >> 8) & $FF + ram_wrbyte(n,eadr + 1) +} +{pub tokrd(adr) + return ram_rw.tokenrd(adr) +} + +CON ''------------------------------------------------- TOOLS + +{PUB hram_print(adr,rows) + + repeat rows + printnl + printhex(adr,4) + printchar(":") + printchar(" ") + repeat 8 + printhex(byte[adr++],2) + printchar(" ") + adr := adr - 8 + repeat 8 + printqchar(byte[adr++]) +} +PUB Dump(adr,line,mod) |zeile ,c[8] ,p,i 'adresse, anzahl zeilen,ram oder xram + zeile:=0 + p:=getx+23 + repeat line + printnl + printhex(adr,5) + printchar(":") + + repeat i from 0 to 7 + if mod>0 + c[i]:=ram_rdbyte(adr++) + else + c[i]:=byte[adr++] + printhex(c[i],2) + printchar(" ") + + repeat i from 0 to 7 + printqchar(c[i]) + + zeile++ + if zeile == 12 + printnl + print(string("")) + if keywait == 27 + printnl + quit + zeile:=0 + +DAT + org 0 +' +' Entry +' +entry jmp #entry 'just loops + + +regsys byte "reg.sys",0 +'belsys byte "bel.sys",0 +'admsys byte "adm.sys",0 + + +{{ + +┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ 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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} + + diff --git a/source/sepia-test.spin b/source/sepia-test.spin new file mode 100644 index 0000000..d9aed21 --- /dev/null +++ b/source/sepia-test.spin @@ -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=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 +