Localization, Support Hives without RTC (save to SD Card)

This commit is contained in:
Jörg Deckert 2014-02-02 19:59:02 +01:00
parent 7db2adf562
commit 24cbdc35c2
7 changed files with 596 additions and 186 deletions

View File

@ -161,7 +161,8 @@ A_AYS = %00000000_00000000_00000010_00000000
a_rtcSetNVSRAM 'Sets the NVSRAM to the selected value (0 - 255) at the index (0 - 55). a_rtcSetNVSRAM 'Sets the NVSRAM to the selected value (0 - 255) at the index (0 - 55).
a_rtcGetNVSRAM 'Gets the selected NVSRAM value at the index (0 - 55). a_rtcGetNVSRAM 'Gets the selected NVSRAM value at the index (0 - 55).
a_rtcPauseForSec 'Pauses execution for a number of seconds. Returns a puesdo random value derived from the current clock frequency and the time when called. Number - Number of seconds to pause for between 0 and 2,147,483,647. a_rtcPauseForSec 'Pauses execution for a number of seconds. Returns a puesdo random value derived from the current clock frequency and the time when called. Number - Number of seconds to pause for between 0 and 2,147,483,647.
a_rtcPauseForMSec '58 '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. a_rtcPauseForMSec '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.
a_rtcTest '59 'Test if RTC Chip is available
' ---------------------------------------------- LAN-FUNKTIONEN ' ---------------------------------------------- LAN-FUNKTIONEN
#71, a_lanStart 'Start Network #71, a_lanStart 'Start Network

View File

@ -1025,6 +1025,13 @@ PUB pauseForMilliseconds(number) 'Pauses execution for a
bus_putchar1(gc#a_rtcPauseForMSec) bus_putchar1(gc#a_rtcPauseForMSec)
return bus_getlong1 return bus_getlong1
PUB rtcTest: available 'Test if RTC Chip is available
''funktionsgruppe : rtc
''busprotokoll : [059][get.avaliable]
'' : Returns TRUE if RTC is available, otherwise FALSE
bus_putchar1(gc#a_rtcTest)
available := bus_getchar1
available := ~available
CON ''------------------------------------------------- LAN_FUNKTIONEN CON ''------------------------------------------------- LAN_FUNKTIONEN

27
make.sh
View File

@ -1,6 +1,9 @@
#! /bin/sh #! /bin/sh
date # Definitionen
##D="-D __DEBUG -D __LANG_EN"
##D="-D __LANG_EN"
D="-D __LANG_DE"
# Pfade # Pfade
##bin="../Bin" ##bin="../Bin"
@ -22,18 +25,18 @@ mkdir ${flash}
# Flashdateien erzeugen # Flashdateien erzeugen
# --> bin/flash # --> bin/flash
${BSTC} -L ${libpath} -b -O a flash/administra/admflash.spin ${BSTC} -L ${libpath} ${D} -b -O a flash/administra/admflash.spin
cp admflash.binary ${flash} cp admflash.binary ${flash}
mv admflash.binary ${sdsys}/admsys.adm mv admflash.binary ${sdsys}/admsys.adm
${BSTC} -L ${libpath} -D __VGA -b -O a flash/bellatrix/belflash.spin ${BSTC} -L ${libpath} ${D} -D __VGA -b -O a flash/bellatrix/belflash.spin
cp belflash.binary ${flash} cp belflash.binary ${flash}
mv belflash.binary ${sdsys}/vga.bel mv belflash.binary ${sdsys}/vga.bel
${BSTC} -L ${libpath} -D __TV -b -O a flash/bellatrix/belflash.spin ${BSTC} -L ${libpath} ${D} -D __TV -b -O a flash/bellatrix/belflash.spin
mv belflash.binary ${sdsys}/tv.bel mv belflash.binary ${sdsys}/tv.bel
${BSTC} -L ${libpath} -b -O a flash/regnatix/regflash.spin ${BSTC} -L ${libpath} ${D} -b -O a flash/regnatix/regflash.spin
mv regflash.binary ${flash} mv regflash.binary ${flash}
# ---------------------------------------------------------------- # ----------------------------------------------------------------
@ -41,7 +44,7 @@ mv regflash.binary ${flash}
# reg.sys (Regime) # reg.sys (Regime)
# --> bin/sdcard\ # --> bin/sdcard\
${BSTC} -L ${libpath} -b -O a system/regnatix/regime.spin ${BSTC} -L ${libpath} ${D} -b -O a system/regnatix/regime.spin
mv regime.binary ${sd}/reg.sys mv regime.binary ${sd}/reg.sys
# ---------------------------------------------------------------- # ----------------------------------------------------------------
@ -49,16 +52,16 @@ mv regime.binary ${sd}/reg.sys
# admsid, admay, admnet # admsid, admay, admnet
# htxt, g0key # htxt, g0key
${BSTC} -L ${libpath} -b -O a system/administra/admsid/admsid.spin ${BSTC} -L ${libpath} ${D} -b -O a system/administra/admsid/admsid.spin
mv admsid.binary ${sdsys}/admsid.adm mv admsid.binary ${sdsys}/admsid.adm
${BSTC} -L ${libpath} -b -O a system/administra/admay/admay.spin ${BSTC} -L ${libpath} ${D} -b -O a system/administra/admay/admay.spin
mv admay.binary ${sdsys}/admay.adm mv admay.binary ${sdsys}/admay.adm
${BSTC} -L ${libpath} -b -O a system/administra/admnet/admnet.spin ${BSTC} -L ${libpath} ${D} -b -O a system/administra/admnet/admnet.spin
mv admnet.binary ${sdsys}/admnet.adm mv admnet.binary ${sdsys}/admnet.adm
${BSTC} -L ${libpath} -b -O a system/bellatrix/bel-htext/htext.spin ${BSTC} -L ${libpath} ${D} -b -O a system/bellatrix/bel-htext/htext.spin
mv htext.binary ${sdsys}/htext.bel mv htext.binary ${sdsys}/htext.bel
${BSTC} -L ${libpath} -b -O a system/bellatrix/bel-g0/g0key.spin ${BSTC} -L ${libpath} ${D} -b -O a system/bellatrix/bel-g0/g0key.spin
mv g0key.binary ${sdsys}/g0key.bel mv g0key.binary ${sdsys}/g0key.bel
# ---------------------------------------------------------------- # ----------------------------------------------------------------
@ -68,7 +71,7 @@ mv g0key.binary ${sdsys}/g0key.bel
# --> bin/sdcard/system/ # --> bin/sdcard/system/
for FILE in system/regnatix/*.spin ; do for FILE in system/regnatix/*.spin ; do
${BSTC} -L ${libpath} -b -O a ${FILE} ${BSTC} -L ${libpath} ${D} -b -O a ${FILE}
BASE="`basename ${FILE} .spin`" BASE="`basename ${FILE} .spin`"
mv "${BASE}.binary" "${sdsys}/${BASE}.bin" mv "${BASE}.binary" "${sdsys}/${BASE}.bin"
done done

View File

@ -204,6 +204,10 @@ OBJ
gc : "glob-con" 'globale konstanten gc : "glob-con" 'globale konstanten
num : "glob-numbers" 'Number Engine num : "glob-numbers" 'Number Engine
DAT
strNVRAMFile byte "nvram.sav",0 'contains the 56 bytes of NVRAM, if RTC is not available
VAR VAR
long dmarker[6] 'speicher für dir-marker long dmarker[6] 'speicher für dir-marker
@ -288,6 +292,7 @@ PUB main | cmd,err 'chip: kommandointerpret
gc#a_rtcGetNVSRAM: rtc_getNVSRAM 'Gets the selected NVSRAM value at the index (0 - 55). gc#a_rtcGetNVSRAM: rtc_getNVSRAM 'Gets the selected NVSRAM value at the index (0 - 55).
gc#a_rtcPauseForSec: rtc_pauseForSeconds 'Pauses execution for a number of seconds. Returns a puesdo random value derived from the current clock frequency and the time when called. Number - Number of seconds to pause for between 0 and 2,147,483,647. gc#a_rtcPauseForSec: rtc_pauseForSeconds 'Pauses execution for a number of seconds. Returns a puesdo random value derived from the current clock frequency and the time when called. Number - Number of seconds to pause for between 0 and 2,147,483,647.
gc#a_rtcPauseForMSec: rtc_pauseForMilliseconds '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. gc#a_rtcPauseForMSec: rtc_pauseForMilliseconds '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.
gc#a_rtcTest: rtc_test 'Test if RTC Chip is available
' ---------------------------------------------- LAN-FUNKTIONEN ' ---------------------------------------------- LAN-FUNKTIONEN
gc#a_lanStart: lan_start 'Start Network gc#a_lanStart: lan_start 'Start Network
@ -1109,9 +1114,27 @@ PRI rtc_pauseForMilliseconds 'rtc: Pauses execution f
'' : Returns a puesdo random value derived from the current clock frequency and the time when called. '' : Returns a puesdo random value derived from the current clock frequency and the time when called.
sub_putlong(rtc.pauseForMilliseconds(sub_getlong)) sub_putlong(rtc.pauseForMilliseconds(sub_getlong))
PRI probeRTC | hiveid
hiveid := rtc.getNVSRAM(NVRAM_HIVE) 'read first byte of hive id
rtc.setNVSRAM(NVRAM_HIVE, hiveid ^ $F) 'write back to NVRAM with flipped all bits
if rtc.getNVSRAM(NVRAM_HIVE) == hiveid ^ $F 'flipped bits are stored?
rtc.setNVSRAM(NVRAM_HIVE, hiveid) 'restore first byte of hive id
return(TRUE) 'RTC found
else
rtc.setNVSRAM(NVRAM_HIVE, hiveid) 'still restore first byte of hive id
return(FALSE) 'no RTC found
PRI rtc_test 'rtc: Test if RTC Chip is available
''funktionsgruppe : rtc
''busprotokoll : [059][put.avaliable]
'' : Returns TRUE if RTC is available, otherwise FALSE
bus_putchar(probeRTC)
CON ''------------------------------------------------- LAN-FUNKTIONEN CON ''------------------------------------------------- LAN-FUNKTIONEN
PRI lan_start | hiveid, hivestr, strpos, macpos, i PRI lan_start | hiveid, hivestr, strpos, macpos, i, a
''funktionsgruppe : lan ''funktionsgruppe : lan
''funktion : Netzwerk starten ''funktion : Netzwerk starten
''eingabe : - ''eingabe : -
@ -1126,30 +1149,30 @@ PRI lan_start | hiveid, hivestr, strpos, macpos, i
bufidx[i++] := $FF '0xFF: nicht zugewiesen bufidx[i++] := $FF '0xFF: nicht zugewiesen
'IP-Parameter setzen 'IP-Parameter setzen
ip_addr := rtc.getNVSRAM(NVRAM_IPADDR) if probeRTC
ip_addr[1] := rtc.getNVSRAM(NVRAM_IPADDR+1) repeat a from 0 to 15
ip_addr[2] := rtc.getNVSRAM(NVRAM_IPADDR+2) ip_addr[a] := rtc.getNVSRAM(NVRAM_IPADDR+a) ' fill addresses
ip_addr[3] := rtc.getNVSRAM(NVRAM_IPADDR+3)
ip_subnet := rtc.getNVSRAM(NVRAM_IPMASK)
ip_subnet[1] := rtc.getNVSRAM(NVRAM_IPMASK+1)
ip_subnet[2] := rtc.getNVSRAM(NVRAM_IPMASK+2)
ip_subnet[3] := rtc.getNVSRAM(NVRAM_IPMASK+3)
ip_gateway := rtc.getNVSRAM(NVRAM_IPGW)
ip_gateway[1] := rtc.getNVSRAM(NVRAM_IPGW+1)
ip_gateway[2] := rtc.getNVSRAM(NVRAM_IPGW+2)
ip_gateway[3] := rtc.getNVSRAM(NVRAM_IPGW+3)
ip_dns := rtc.getNVSRAM(NVRAM_IPDNS)
ip_dns[1] := rtc.getNVSRAM(NVRAM_IPDNS+1)
ip_dns[2] := rtc.getNVSRAM(NVRAM_IPDNS+2)
ip_dns[3] := rtc.getNVSRAM(NVRAM_IPDNS+3)
hiveid := rtc.getNVSRAM(NVRAM_HIVE) hiveid := rtc.getNVSRAM(NVRAM_HIVE)
hiveid := hiveid + rtc.getNVSRAM(NVRAM_HIVE+1) << 8 hiveid += rtc.getNVSRAM(NVRAM_HIVE+1) << 8
hiveid := hiveid + rtc.getNVSRAM(NVRAM_HIVE+2) << 16 hiveid += rtc.getNVSRAM(NVRAM_HIVE+2) << 16
hiveid := hiveid + rtc.getNVSRAM(NVRAM_HIVE+3) << 24 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])
hivestr := num.ToStr(hiveid, num#DEC) hivestr := num.ToStr(hiveid, num#DEC)
strpos := strsize(hivestr) strpos := strsize(hivestr)
macpos := 5 macpos := 5

View File

@ -53,6 +53,10 @@ CON 'NVRAM Konstanten ----------------------------------------------------------
#20, NVRAM_IPBOOT #20, NVRAM_IPBOOT
#24, NVRAM_HIVE ' 4 Bytes #24, NVRAM_HIVE ' 4 Bytes
DAT
strNVRAMFile byte "nvram.sav",0 'contains the 56 bytes of NVRAM, if RTC is not available
VAR VAR
long ip_addr long ip_addr
@ -78,7 +82,7 @@ PUB main
ios.start ios.start
ifnot (ios.admgetspec & LANMASK) ifnot (ios.admgetspec & LANMASK)
ios.print(string(10,"Administra stellt keine Netzwerk-Funktionen zur Verfügung!",10,"Bitte admnet laden.",10)) ios.print(@strNoNetwork)
ios.stop ios.stop
ios.printnl ios.printnl
ios.parastart 'parameterübergabe starten ios.parastart 'parameterübergabe starten
@ -86,10 +90,10 @@ PUB main
if byte[@parastr][0] == "/" 'option? if byte[@parastr][0] == "/" 'option?
case byte[@parastr][1] case byte[@parastr][1]
"?": ios.print(@help) "?": ios.print(@help)
"f": if ios.paranext(@parastr) "h": if ios.paranext(@parastr)
setaddr(@parastr) setaddr(@parastr)
"v": ios.paranext(@remdir) "d": ios.paranext(@remdir)
"d": ios.paranext(@filename) "f": ios.paranext(@filename)
"u": ios.paranext(@username) "u": ios.paranext(@username)
"p": ios.paranext(@password) "p": ios.paranext(@password)
"s": save2card := TRUE "s": save2card := TRUE
@ -98,11 +102,11 @@ PUB main
ifnot byte[@filename][0] == 0 ifnot byte[@filename][0] == 0
ifnot ftpconnect ifnot ftpconnect
ifnot ftplogin ifnot ftplogin
ftpcwd ifnot ftpcwd
if ftppasv if ftppasv
ftpretr ftpretr
else else
ios.print(string("Keine Datei zum Downloaden angegeben, beende...",10)) ios.print(@strNoFile)
ftpclose ftpclose
@ -111,27 +115,43 @@ PUB main
PRI ftpconnect PRI ftpconnect
ifnot (ip_addr) ' Adresse 0.0.0.0 ifnot (ip_addr) ' Adresse 0.0.0.0
ios.print(string("FTP-Server nicht angegeben (Parameter /s)",10)) ios.print(@strNoHost)
if ios.rtcTest 'RTC chip available?
ip_addr := ios.getNVSRAM(NVRAM_IPBOOT) << 24 ip_addr := ios.getNVSRAM(NVRAM_IPBOOT) << 24
ip_addr += ios.getNVSRAM(NVRAM_IPBOOT+1) << 16 ip_addr += ios.getNVSRAM(NVRAM_IPBOOT+1) << 16
ip_addr += ios.getNVSRAM(NVRAM_IPBOOT+2) << 8 ip_addr += ios.getNVSRAM(NVRAM_IPBOOT+2) << 8
ip_addr += ios.getNVSRAM(NVRAM_IPBOOT+3) ip_addr += ios.getNVSRAM(NVRAM_IPBOOT+3)
else
ios.sddmset(ios#DM_USER) 'u-marker setzen
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
ifnot ios.sdopen("R",@strNVRAMFile)
ios.sdseek(NVRAM_IPBOOT)
ip_addr := ios.sdgetc << 24
ip_addr += ios.sdgetc << 16
ip_addr += ios.sdgetc << 8
ip_addr += ios.sdgetc
ios.sdclose
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
if (ip_addr) if (ip_addr)
ios.print(string("Verwende Boot-Server (mit ipconfig gesetzt).",10)) ios.print(@strUseBoot)
else else
return(-1) return(-1)
ios.print(string("Starte LAN...",10)) #ifdef __DEBUG
ios.print(@strStartLAN)
#endif
ios.lanstart ios.lanstart
ios.print(string("Verbinde mit FTP-Server...",10)) ios.print(@strConnect)
if (handleidx_control := ios.lan_connect(ip_addr, 21)) == $FF if (handleidx_control := ios.lan_connect(ip_addr, 21)) == $FF
ios.print(string("Kein Socket frei...",10)) ios.print(@strErrorNoSock)
return(-1) return(-1)
ifnot (ios.lan_waitconntimeout(handleidx_control, 2000)) ifnot (ios.lan_waitconntimeout(handleidx_control, 2000))
ios.print(string("Verbindung mit FTP-Server konnte nicht aufgebaut werden.",10)) ios.print(@strErrorConnect)
return(-1) return(-1)
ios.print(string("Verbindung mit FTP-Server hergestellt, warte auf Antwort...",10)) #ifdef __DEBUG
ios.print(@strConnected)
#endif
ifnot getResponse(string("220 ")) ifnot getResponse(string("220 "))
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10)) ios.print(@strError220)
return(-1) return(-1)
return(0) return(0)
@ -157,9 +177,11 @@ PRI ftplogin | pwreq, respOK, hiveid
sendStr(string("anonymous",13,10)) sendStr(string("anonymous",13,10))
repeat until readLine == -1 repeat until readLine == -1
#ifdef __DEBUG
ios.print(string(" < ")) ios.print(string(" < "))
ios.print(@strTemp) ios.print(@strTemp)
ios.printnl ios.printnl
#endif
strTemp[4] := 0 strTemp[4] := 0
if strcomp(@strTemp, string("230 ")) if strcomp(@strTemp, string("230 "))
respOk := TRUE respOk := TRUE
@ -169,7 +191,7 @@ PRI ftplogin | pwreq, respOK, hiveid
respOk := TRUE respOk := TRUE
quit quit
ifnot respOK ifnot respOK
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10)) ios.print(@strErrorLogin)
return(-1) return(-1)
ifnot pwreq ifnot pwreq
@ -180,16 +202,28 @@ PRI ftplogin | pwreq, respOK, hiveid
sendStr(@password) sendStr(@password)
sendStr(string(13,10)) sendStr(string(13,10))
else else
if ios.rtcTest 'RTC chip available?
hiveid := ios.getNVSRAM(NVRAM_HIVE) hiveid := ios.getNVSRAM(NVRAM_HIVE)
hiveid += ios.getNVSRAM(NVRAM_HIVE+1) << 8 hiveid += ios.getNVSRAM(NVRAM_HIVE+1) << 8
hiveid += ios.getNVSRAM(NVRAM_HIVE+2) << 16 hiveid += ios.getNVSRAM(NVRAM_HIVE+2) << 16
hiveid += ios.getNVSRAM(NVRAM_HIVE+3) << 24 hiveid += ios.getNVSRAM(NVRAM_HIVE+3) << 24
else
ios.sddmset(ios#DM_USER) 'u-marker setzen
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
ifnot ios.sdopen("R",@strNVRAMFile)
ios.sdseek(NVRAM_HIVE)
hiveid := ios.sdgetc
hiveid += ios.sdgetc << 8
hiveid += ios.sdgetc << 16
hiveid += ios.sdgetc << 24
ios.sdclose
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
sendStr(string("anonymous@hive")) sendStr(string("anonymous@hive"))
sendStr(str.trimCharacters(num.ToStr(hiveid, num#DEC))) sendStr(str.trimCharacters(num.ToStr(hiveid, num#DEC)))
sendStr(string(13,10)) sendStr(string(13,10))
ifnot getResponse(string("230 ")) ifnot getResponse(string("230 "))
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10)) ios.print(@strErrorPass)
return(-1) return(-1)
return(0) return(0)
@ -201,10 +235,13 @@ PRI ftpcwd | i
else else
i := sendStr(string("CWD ")) || sendStr(@remdir) || sendStr(string(13,10)) i := sendStr(string("CWD ")) || sendStr(@remdir) || sendStr(string(13,10))
if i if i
ios.print(string("Fehler beim Senden des Verzeichnisses",10)) ios.print(@strErrorCWD)
return(-1) return(-1)
ifnot getResponse(string("250 ")) ifnot getResponse(string("250 "))
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10)) ios.print(@strError250)
ios.printchar("(")
ios.print(@strTemp+4)
ios.print(string(")",13))
return(-1) return(-1)
return(0) return(0)
@ -219,9 +256,11 @@ PRI ftppasv : port | i, k, port256, port1
return(0) return(0)
repeat until readLine == -1 repeat until readLine == -1
#ifdef __DEBUG
ios.print(string(" < ")) ios.print(string(" < "))
ios.print(@strTemp) ios.print(@strTemp)
ios.printnl ios.printnl
#endif
strTemp[4] := 0 strTemp[4] := 0
if strcomp(@strTemp, string("227 ")) if strcomp(@strTemp, string("227 "))
repeat i from 5 to 126 repeat i from 5 to 126
@ -241,44 +280,53 @@ PRI ftppasv : port | i, k, port256, port1
quit quit
if (port == 0) if (port == 0)
ios.print(string("FTP-Server-Fehler beim Öffnen des Passiv-Ports",10)) ios.print(@strErrorPasvPort)
return(0) return(0)
ios.print(string("Öffne Verbindung zu Passiv-Port ")) #ifdef __DEBUG
ios.print(@strOpenPasv)
ios.print(num.ToStr(port, num#DEC)) ios.print(num.ToStr(port, num#DEC))
ios.printnl ios.printnl
#endif
if (handleidx_data := ios.lan_connect(ip_addr, port)) == $FF if (handleidx_data := ios.lan_connect(ip_addr, port)) == $FF
ios.print(string("Kein Socket frei...",10)) ios.print(@strErrorSockPasv)
return(0) return(0)
ifnot (ios.lan_waitconntimeout(handleidx_data, 2000)) ifnot (ios.lan_waitconntimeout(handleidx_data, 2000))
ios.print(string("Verbindung mit FTP-Server konnte nicht aufgebaut werden.",10)) ios.print(@strErrorPasvConn)
return(0) return(0)
PRI ftpretr | len, respOK PRI ftpretr | len, respOK
if sendStr(string("TYPE I",13,10)) if sendStr(string("TYPE I",13,10))
ios.print(string("Fehler beim Senden des Types",10)) ios.print(@strErrorSendType)
return(-1) return(-1)
ifnot getResponse(string("200 ")) ifnot getResponse(string("200 "))
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10)) ios.print(@strErrorChType)
return(-1) return(-1)
if sendStr(string("SIZE ")) || sendStr(@filename) || sendStr(string(13,10)) if sendStr(string("SIZE ")) || sendStr(@filename) || sendStr(string(13,10))
ios.print(string("Fehler beim Senden des SIZE-Kommandos",10)) ios.print(@strErrorSendSize)
return(-1) return(-1)
ifnot getResponse(string("213")) ifnot getResponse(string("213"))
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10)) ios.print(@strErrorSize)
ios.printchar("(")
ios.print(@strTemp+4)
ios.print(string(")",13))
return(-1) return(-1)
ifnot(len := num.FromStr(@strTemp+4, num#DEC)) ifnot(len := num.FromStr(@strTemp+4, num#DEC))
ios.print(@strErrorGetSize)
return(-1) return(-1)
ios.print(@strGetFile)
if sendStr(string("RETR ")) || sendStr(@filename) || sendStr(string(13,10)) if sendStr(string("RETR ")) || sendStr(@filename) || sendStr(string(13,10))
ios.print(string("Fehler beim Senden des Filenamens",10)) ios.print(@strErrorSendFN)
return -1 return -1
respOK := FALSE respOK := FALSE
repeat until readLine == -1 repeat until readLine == -1
#ifdef __DEBUG
ios.print(string(" < ")) ios.print(string(" < "))
ios.print(@strTemp) ios.print(@strTemp)
ios.printnl ios.printnl
#endif
strTemp[4] := 0 strTemp[4] := 0
if strcomp(@strTemp, string("150 ")) if strcomp(@strTemp, string("150 "))
respOk := TRUE respOk := TRUE
@ -287,20 +335,23 @@ PRI ftpretr | len, respOK
respOk := TRUE respOk := TRUE
quit quit
ifnot respOK ifnot respOK
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10)) ios.print(@strErrorRetr)
ios.printchar("(")
ios.print(@strTemp+4)
ios.print(string(")",13))
return(-1) return(-1)
if ios.lan_rxdata(handleidx_data, @filename, len) if ios.lan_rxdata(handleidx_data, @filename, len)
ios.print(string("Fehler beim Empfang der Datei.",10)) ios.print(@strErrorRXData)
return(-1) return(-1)
ifnot getResponse(string("226 ")) ifnot getResponse(string("226 "))
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10)) ios.print(@strErrorRetrOK)
return(-1) return(-1)
if save2card if save2card
ios.print(@strWrite2SD)
writeToSDCard writeToSDCard
ios.print(string("Speichere auf SD-Card...",10))
PRI writeToSDCard | fnr, len, i PRI writeToSDCard | fnr, len, i
@ -311,7 +362,7 @@ PRI writeToSDCard | fnr, len, i
ifnot ios.sdnewfile(@filename) ifnot ios.sdnewfile(@filename)
ifnot ios.sdopen("W",@filename) ifnot ios.sdopen("W",@filename)
i := 0 i := 0
ios.sdxputblk(fnr,len) 'daten als block schreiben ios.sdxputblk(fnr,len) 'Daten als Block schreiben
ios.sdclose ios.sdclose
ios.rd_del(@filename) ios.rd_del(@filename)
ios.rd_close(fnr) ios.rd_close(fnr)
@ -333,9 +384,11 @@ PRI getResponse (strOk) : respOk | len
respOk := FALSE respOk := FALSE
repeat until readLine == -1 repeat until readLine == -1
#ifdef __DEBUG
ios.print(string(" < ")) ios.print(string(" < "))
ios.print(@strTemp) ios.print(@strTemp)
ios.printnl ios.printnl
#endif
strTemp[strsize(strOk)] := 0 strTemp[strsize(strOk)] := 0
if strcomp(@strTemp, strOk) if strcomp(@strTemp, strOk)
respOk := TRUE respOk := TRUE
@ -359,27 +412,112 @@ PRI readLine | i, ch
PRI sendStr (strSend) : error PRI sendStr (strSend) : error
#ifdef __DEBUG
ios.print(string(" > ")) ios.print(string(" > "))
ios.print(strSend) ios.print(strSend)
ios.printnl ios.printnl
#endif
error := ios.lan_txdata(handleidx_control, strSend, strsize(strSend)) error := ios.lan_txdata(handleidx_control, strSend, strsize(strSend))
DAT DAT ' Locale
#ifdef __LANG_EN
'locale: english
defdir byte "/hive/sdcard/system",0 defdir byte "/hive/sdcard/system",0
help byte "/? : Hilfe",10
byte "/f <a.b.c.d> : FTP-Server-Adresse",10 strNoNetwork byte 13,"Administra doesn't provide network functions!",13,"Please load admnet.",13,0
byte " (default: mit ipconfig gesetzter Boot-Server)",10 strNoFile byte "No file to download specified, exit...",13,0
byte "/v <verzeichnis>: in entferntes Verzeichnis wechseln",10 strNoHost byte "No host (ftp server) specified (parameter /h)",13,0
byte " (default: /hive/sdcard/system)",10 strUseBoot byte "Using boot server (set with ipconfig).",13,0
byte "/d <dateiname> : Download <dateiname>",10 strStartLAN byte "Starting LAN...",13,0
byte "/u <username> : Benutzername am FTP-Server",10 strConnect byte "Connecting to ftp server...",13,0
byte " (default: anonymous)",10 strErrorNoSock byte "No free socket.",13,0
byte "/p <password> : Paßwort am FTP-Server",10 strErrorConnect byte "Couldn't connect to ftp server.",13,0
byte " (default: anonymous@hive<Hive-Id>)",10 strConnected byte "Connected to ftp server, waiting for answer...",13,0
byte "/s : Datei auf SD-Card speichern",10 strError220 byte "Ftp server doesn't acknowledge the connection (220).",13,0
strErrorLogin byte "Ftp server doesn't acknowledge the login (230/331)",13,0
strErrorPass byte "Ftp server doesn't acknowledge the password (230)",13,0
strErrorCWD byte "Error sendig remote directory",13,0
strError250 byte "Ftp server doesn't acknowledge the directory change (250).",13,0
strErrorPasvPort byte "Couldn't get the passive port.",13,0
strOpenPasv byte "Open Connection to passive port ",0
strErrorSockPasv byte "No free socket fpr passive connection.",13,0
strErrorPasvConn byte "Couldn't connect to passive port.",13,0
strErrorSendType byte "Error sending file type",13,0
strErrorChType byte "Ftp serve couldn't change file type (200).",13,0
strErrorSendSize byte "Error sending SIZE command",13,0
strErrorSize byte "Ftp server couldn't send file size (213).",13,"File not found? SIZE not supported?",13,0
strErrorGetSize byte "Couldn't get file size.",13,0
strGetFile byte "Retrieve file, please wait...",13,0
strErrorSendFN byte "Error sending file name.",13,0
strErrorRetr byte "Ftp server couldn't send file (150/125).",13,0
strErrorRXData byte "Error retrieving file.",13,0
strErrorRetrOK byte "Ftp server doesn't acknowledge sending of file (226).",13,0
strWrite2SD byte "Saving to sd card...",13,0
help byte "/? : Help",13
byte "/h <a.b.c.d> : host ip address (ftp server)",13
byte " (default: boot server from ipconfig)",13
byte "/d <directory>: change to remote directory",13
byte " (default: /hive/sdcard/system)",13
byte "/f <filename> : download <filename>",13
byte "/u <username> : Username at ftp server",13
byte " (default: anonymous)",13
byte "/p <password> : password at ftp server",13
byte " (default: anonymous@hive<hive id>)",13
byte "/s : save file to sd card",13
byte 0 byte 0
#else
'default locale: german
defdir byte "/hive/sdcard/system",0
strNoNetwork byte 13,"Administra stellt keine Netzwerk-Funktionen zur Verfügung!",13,"Bitte admnet laden.",13,0
strNoFile byte "Keine Datei zum Downloaden angegeben, beende...",13,0
strNoHost byte "FTP-Server nicht angegeben (Parameter /h)",13,0
strUseBoot byte "Verwende Boot-Server (mit ipconfig gesetzt).",13,0
strStartLAN byte "Starte LAN...",13,0
strConnect byte "Verbinde mit FTP-Server...",13,0
strErrorNoSock byte "Kein Socket frei...",13,0
strErrorConnect byte "Verbindung mit FTP-Server konnte nicht aufgebaut werden.",13,0
strConnected byte "Verbindung mit FTP-Server hergestellt, warte auf Antwort...",13,0
strError220 byte "FTP-Server bestätigt den Verbindungsaufbau nicht (220).",13,0
strErrorLogin byte "FTP-Server hat Login nicht bestätigt (230/331)",13,0
strErrorPass byte "FTP-Server hat das Paßwort nicht bestätigt (230)",13,0
strErrorCWD byte "Fehler beim Senden des Verzeichnisses",13,0
strError250 byte "FTP-Server hat den Verzeichniswechsel nicht bestätigt (250).",13,0
strErrorPasvPort byte "Konnte zu öffnenden Passiv-Port nicht ermitteln.",13,0
strOpenPasv byte "Öffne Verbindung zu Passiv-Port ",0
strErrorSockPasv byte "Kein Socket für Passiv-Verbindung frei...",13,0
strErrorPasvConn byte "Passiv-Verbindung mit FTP-Server konnte nicht aufgebaut werden.",13,0
strErrorSendType byte "Fehler beim Senden des Types",13,0
strErrorChType byte "FTP-Server konnte Übertragungs-Typ nicht ändern (200).",13,0
strErrorSendSize byte "Fehler beim Senden des SIZE-Kommandos",13,0
strErrorSize byte "FTP-Server kann die Datei-Größe nicht übermitteln (213).",13,"Datei nicht vorhanden? SIZE nicht unterstützt?",13,0
strErrorGetSize byte "Konnte Filegröße nicht ermitteln.",13,0
strGetFile byte "Empfange Datei, bitte warten...",13,0
strErrorSendFN byte "Fehler beim Senden des Filenamens.",13,0
strErrorRetr byte "FTP-Server kann die Datei nicht senden (150/125).",13,0
strErrorRXData byte "Fehler beim Empfang der Datei.",13,0
strErrorRetrOK byte "FTP-Server hat den Empfang durch den Client nicht bestätigt (226).",13,0
strWrite2SD byte "Speichere auf SD-Card...",13,0
help byte "/? : Hilfe",13
byte "/h <a.b.c.d> : FTP-Server-Adresse (Host)",13
byte " (default: mit ipconfig gesetzter Boot-Server)",13
byte "/d <verzeichnis>: in entferntes Verzeichnis wechseln",13
byte " (default: /hive/sdcard/system)",13
byte "/f <dateiname> : Download <dateiname>",13
byte "/u <username> : Benutzername am FTP-Server",13
byte " (default: anonymous)",13
byte "/p <password> : Paßwort am FTP-Server",13
byte " (default: anonymous@hive<Hive-Id>)",13
byte "/s : Datei auf SD-Card speichern",13
byte 0
#endif
DAT 'lizenz DAT 'lizenz
{{ {{

View File

@ -51,16 +51,43 @@ CON 'NVRAM Konstanten ----------------------------------------------------------
#20, NVRAM_IPBOOT #20, NVRAM_IPBOOT
#24, NVRAM_HIVE ' 4 Bytes #24, NVRAM_HIVE ' 4 Bytes
DAT
strNVRAMFile byte "nvram.sav",0 'contains the 56 bytes of NVRAM, if RTC is not available
VAR VAR
byte parastr[64] byte parastr[64]
byte rtcAvailable
PUB main PUB main | i
ios.start 'ios initialisieren ios.start 'ios initialisieren
ios.printnl ios.printnl
ifnot (ios.admgetspec & LANMASK) ifnot (ios.admgetspec & LANMASK)
ios.print(string("WARNUNG!",10,"Administra stellt keine Netzwerk-Funktionen zur Verfügung!",10,"Bitte admnet laden.",10,"(ipconfig funktioniert trotzdem)",10)) ios.print(@strNoNetwork)
ios.stop
if ios.rtcTest 'RTC chip available?
rtcAvailable := TRUE
else 'use configfile
rtcAvailable := FALSE
ios.print(@strNoRTC)
ios.sddmset(ios#DM_USER) 'u-marker setzen
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
if ios.sdopen("R",@strNVRAMFile) 'config file available
ios.sdnewfile(@strNVRAMFile) 'no, create it
if ios.sdopen("W",@strNVRAMFile)
ios.print(@strErrorOpen)
ios.stop
else
repeat i from 0 to 55 'set default value for pseudo NVRAM Bytes 0 - 55
ios.sdputc(0)
ios.sdclose
else
ios.sdclose
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
ios.parastart 'parameterübergabe starten ios.parastart 'parameterübergabe starten
repeat while ios.paranext(@parastr) 'parameter einlesen repeat while ios.paranext(@parastr) 'parameter einlesen
if byte[@parastr][0] == "/" 'option? if byte[@parastr][0] == "/" 'option?
@ -84,77 +111,168 @@ PUB main
PRI cmd_listcfg | hiveid 'nvram: IP-Konfiguration anzeigen PRI cmd_listcfg | hiveid 'nvram: IP-Konfiguration anzeigen
ios.print(string(" IP-Adresse: ")) ifnot rtcAvailable
ios.sddmset(ios#DM_USER) 'u-marker setzen
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
if ios.sdopen("R",@strNVRAMFile)
ios.print(@strErrorOpen)
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
return
ios.print(@strAddr)
listaddr(NVRAM_IPADDR) listaddr(NVRAM_IPADDR)
ios.print(string("/")) ios.print(string("/"))
listaddr(NVRAM_IPMASK) listaddr(NVRAM_IPMASK)
ios.printnl ios.printnl
ios.print(string(" Gateway: ")) ios.print(@strGw)
listaddr(NVRAM_IPGW) listaddr(NVRAM_IPGW)
ios.printnl ios.printnl
ios.print(string(" DNS-Server: ")) ios.print(@strDNS)
listaddr(NVRAM_IPDNS) listaddr(NVRAM_IPDNS)
ios.printnl ios.printnl
ios.print(string(" Boot-Server: ")) ios.print(@strBoot)
listaddr(NVRAM_IPBOOT) listaddr(NVRAM_IPBOOT)
ios.printnl ios.printnl
ios.print(string(" Hive-Id: ")) ios.print(@strHive)
if rtcAvailable
hiveid := ios.getNVSRAM(NVRAM_HIVE) hiveid := ios.getNVSRAM(NVRAM_HIVE)
hiveid += ios.getNVSRAM(NVRAM_HIVE+1) << 8 hiveid += ios.getNVSRAM(NVRAM_HIVE+1) << 8
hiveid += ios.getNVSRAM(NVRAM_HIVE+2) << 16 hiveid += ios.getNVSRAM(NVRAM_HIVE+2) << 16
hiveid += ios.getNVSRAM(NVRAM_HIVE+3) << 24 hiveid += ios.getNVSRAM(NVRAM_HIVE+3) << 24
else
ios.sdseek(NVRAM_HIVE)
hiveid := ios.sdgetc
hiveid += ios.sdgetc << 8
hiveid += ios.sdgetc << 16
hiveid += ios.sdgetc << 24
ios.print(str.trimCharacters(num.ToStr(hiveid, num#DEC))) ios.print(str.trimCharacters(num.ToStr(hiveid, num#DEC)))
ios.printnl ios.printnl
ifnot rtcAvailable
ios.sdclose
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
PRI listaddr (nvidx) | count 'IP-Adresse anzeigen PRI listaddr (nvidx) | count 'IP-Adresse anzeigen
ifnot rtcAvailable
ios.sdseek(nvidx)
repeat count from 0 to 3 repeat count from 0 to 3
if(count) if(count)
ios.print(string(".")) ios.print(string("."))
if rtcAvailable
ios.print(str.trimCharacters(num.ToStr(ios.getNVSRAM(nvidx+count), num#DEC))) ios.print(str.trimCharacters(num.ToStr(ios.getNVSRAM(nvidx+count), num#DEC)))
else
ios.print(str.trimCharacters(num.ToStr(ios.sdgetc, num#DEC)))
PRI cmd_setaddr (nvidx, ipaddr) | pos, count 'IP-Adresse setzen PRI cmd_setaddr (nvidx, ipaddr) | pos, count 'IP-Adresse setzen
ifnot rtcAvailable
ios.sddmset(ios#DM_USER) 'u-marker setzen
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
if ios.sdopen("W",@strNVRAMFile)
ios.print(@strErrorOpen)
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
return
else
ios.sdseek(nvidx)
count := 0 count := 0
repeat while ipaddr repeat while ipaddr
pos := str.findCharacter(ipaddr, ".") pos := str.findCharacter(ipaddr, ".")
if(pos) if(pos)
byte[pos++] := 0 byte[pos++] := 0
if rtcAvailable
ios.setNVSRAM(nvidx+count++, num.FromStr(ipaddr, num#DEC)) ios.setNVSRAM(nvidx+count++, num.FromStr(ipaddr, num#DEC))
else
ios.sdputc(num.FromStr(ipaddr, num#DEC))
ipaddr := pos ipaddr := pos
if(count == 4) if(count == 4)
quit quit
ifnot rtcAvailable
ios.sdclose
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
ios.lanstop ios.lanstop
ios.lanstart ios.lanstart
PRI cmd_sethive (hiveid) 'Hive-Id setzen PRI cmd_sethive (hiveid) 'Hive-Id setzen
if rtcAvailable
ios.setNVSRAM(NVRAM_HIVE, hiveid & $FF) ios.setNVSRAM(NVRAM_HIVE, hiveid & $FF)
ios.setNVSRAM(NVRAM_HIVE+1, (hiveid >> 8) & $FF) ios.setNVSRAM(NVRAM_HIVE+1, (hiveid >> 8) & $FF)
ios.setNVSRAM(NVRAM_HIVE+2, (hiveid >> 16) & $FF) ios.setNVSRAM(NVRAM_HIVE+2, (hiveid >> 16) & $FF)
ios.setNVSRAM(NVRAM_HIVE+3, (hiveid >> 24) & $FF) ios.setNVSRAM(NVRAM_HIVE+3, (hiveid >> 24) & $FF)
else
ios.sddmset(ios#DM_USER) 'u-marker setzen
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
if ios.sdopen("W",@strNVRAMFile)
ios.print(@strErrorOpen)
else
ios.sdseek(NVRAM_HIVE)
ios.sdputc(hiveid & $FF)
ios.sdputc((hiveid >> 8) & $FF)
ios.sdputc((hiveid >> 16) & $FF)
ios.sdputc((hiveid >> 24) & $FF)
ios.sdclose
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
ios.lanstop ios.lanstop
ios.lanstart ios.lanstart
DAT 'sys: helptext DAT 'sys: helptext
#ifdef __LANG_EN
'locale: english
help byte "/? : Hilfe",10 strNoNetwork byte "Administra doesn't provide network functions!",13,"Please load admnet.",13,0
byte "/l : Konfiguration anzeigen",10 strNoRTC byte "RTC/NVRAM not found",13,"using configuration in /system/nvram.sav",13,0
byte "/a <a.b.c.d> : IP-Adresse setzen",10 strAddr byte " Ip address: ",0
byte "/m <x.x.x.x> : Netzwerk-Maske setzen",10 strGw byte " Gateway: ",0
byte "/g <e.f.g.h> : Gateway setzen",10 strDNS byte " DNS server: ",0
byte "/d <i.j.k.l> : DNS-Server setzen",10 strBoot byte " Boot server: ",0
byte "/b <m.n.o.p> : Boot-Server setzen",10 strHive byte " Hive ID: ",0
byte "/i <Id> : Hive-Id setzen",10 strErrorOpen byte "Can't open configuration file",13,0
help byte "/? : Help",13
byte "/l : List configuration",13
byte "/a <a.b.c.d> : Set ip address",13
byte "/m <x.x.x.x> : Set network mask",13
byte "/g <e.f.g.h> : Set default gateway",13
byte "/d <i.j.k.l> : Set DNS server",13
byte "/b <m.n.o.p> : Set boot server",13
byte "/i <Id> : Set Hive ID",13
byte 0 byte 0
#else
'default locale: german
strNoNetwork byte "Administra stellt keine Netzwerk-Funktionen zur Verfügung!",13,"Bitte admnet laden.",13,0
strNoRTC byte "RTC/NVRAM nicht vorhanden",13,"nutze Konfiguration in /system/nvram.sav",13,0
strAddr byte " IP-Adresse: ",0
strGw byte " Gateway: ",0
strDNS byte " DNS-Server: ",0
strBoot byte " Boot-Server: ",0
strHive byte " Hive-Id: ",0
strErrorOpen byte "Kann Konfigurationsdatei nicht öffnen.",13,0
help byte "/? : Hilfe",13
byte "/l : Konfiguration anzeigen",13
byte "/a <a.b.c.d> : IP-Adresse setzen",13
byte "/m <x.x.x.x> : Netzwerk-Maske setzen",13
byte "/g <e.f.g.h> : Gateway setzen",13
byte "/d <i.j.k.l> : DNS-Server setzen",13
byte "/b <m.n.o.p> : Boot-Server setzen",13
byte "/i <Id> : Hive-Id setzen",13
byte 0
#endif
DAT 'lizenz DAT 'lizenz
{{ {{

View File

@ -84,6 +84,10 @@ CON 'NVRAM Konstanten ----------------------------------------------------------
#20, NVRAM_IPBOOT #20, NVRAM_IPBOOT
#24, NVRAM_HIVE ' 4 Bytes #24, NVRAM_HIVE ' 4 Bytes
DAT
strNVRAMFile byte "nvram.sav",0 'contains the 56 bytes of NVRAM, if RTC is not available
VAR VAR
long t1char 'Empfangs-Zeitpunkt des 1. Zeichen einer Zeile long t1char 'Empfangs-Zeitpunkt des 1. Zeichen einer Zeile
@ -157,14 +161,14 @@ PRI init
ios.start 'ios initialisieren ios.start 'ios initialisieren
ifnot (ios.admgetspec & LANMASK) ifnot (ios.admgetspec & LANMASK)
ios.print(string(13,"Administra stellt keine Netzwerk-Funktionen zur Verfügung!",13,"Bitte admnet laden.",13)) ios.print(@strNoNetwork)
ios.stop ios.stop
ios.print(string(13,"Initialisiere, bitte warten...",13)) ios.print(@strInitWait)
setscreen setscreen
conf_load conf_load
if ip_addr == 0 if ip_addr == 0
ifnot f_setconf ifnot f_setconf
handleStatusStr(string("Bitte Konfiguration neu starten (F2)"), 2, FALSE) handleStatusStr(@strRestartConf, 2, FALSE)
PRI f_focus PRI f_focus
@ -262,7 +266,7 @@ PRI f_connect
PRI f_join PRI f_join
if joined if joined
handleStatusStr(string("Kanal bereits betreten, vorher mit F5 (/part) verlassen"), 2, FALSE) handleStatusStr(@strAlreadyJoined, 2, FALSE)
else else
confChannel confChannel
win_contentRefresh win_contentRefresh
@ -283,13 +287,13 @@ PRI f_user
confUser confUser
win_contentRefresh win_contentRefresh
handleStatusStr(string("User geändert, zum Anwenden neu verbinden"), 2, FALSE) handleStatusStr(@strUserChanged, 2, FALSE)
PRI f_pass PRI f_pass
confPass confPass
win_contentRefresh win_contentRefresh
handleStatusStr(string("Paßwort geändert, zum Anwenden neu verbinden"), 2, FALSE) handleStatusStr(@strPassChanged, 2, FALSE)
PRI f_close PRI f_close
@ -329,15 +333,15 @@ PRI confServer
temp_str[0] := 0 temp_str[0] := 0
else else
IpPortToStr(ip_addr, ip_port) IpPortToStr(ip_addr, ip_port)
input(string("IRC-Server angeben (IP:Port):"),@temp_str ,21) input(@strInputSrv,@temp_str ,21)
ifnot strToIpPort(@input_str, @ip_addr, @ip_port) ifnot strToIpPort(@input_str, @ip_addr, @ip_port)
handleStatusStr(string("Fehlerhafte Eingabe von IP-Adresse und Port des Servers."), 2, FALSE) handleStatusStr(@strErrorAddr, 2, FALSE)
return (FALSE) return (FALSE)
return(TRUE) return(TRUE)
PRI confPass | i,n PRI confPass | i,n
input(string("Paßwort eingeben:"),@password,LEN_PASS) input(@strInputPass,@password,LEN_PASS)
n := 1 n := 1
repeat i from 0 to LEN_PASS repeat i from 0 to LEN_PASS
if n == 0 if n == 0
@ -348,7 +352,7 @@ PRI confPass | i,n
PRI confNick | i,n PRI confNick | i,n
input(string("Nickname eingeben:"),@nickname,LEN_NICK) input(@strInputNick,@nickname,LEN_NICK)
n := 1 n := 1
repeat i from 0 to LEN_NICK repeat i from 0 to LEN_NICK
if n == 0 if n == 0
@ -359,7 +363,7 @@ PRI confNick | i,n
PRI confUser | i,n PRI confUser | i,n
input(string("Username eingeben:"),@username,LEN_USER) input(@strInputUser,@username,LEN_USER)
n := 1 n := 1
repeat i from 0 to LEN_USER repeat i from 0 to LEN_USER
if n == 0 if n == 0
@ -370,7 +374,7 @@ PRI confUser | i,n
PRI confChannel | i,n PRI confChannel | i,n
input(string("Channel eingeben:"),@channel,LEN_CHAN) input(@strInputChannel,@channel,LEN_CHAN)
n := 1 n := 1
repeat i from 0 to LEN_CHAN repeat i from 0 to LEN_CHAN
if n == 0 if n == 0
@ -406,7 +410,7 @@ PRI confSave | i
ios.sddmact(ios#DM_USER) 'u-marker aktivieren ios.sddmact(ios#DM_USER) 'u-marker aktivieren
handleStatusStr(string("Konfiguration gespeichert."), 2, TRUE) handleStatusStr(@strConfigSaved, 2, TRUE)
PRI conf_load | i PRI conf_load | i
@ -434,25 +438,37 @@ PRI conf_load | i
ios.sddmact(ios#DM_USER) 'u-marker aktivieren ios.sddmact(ios#DM_USER) 'u-marker aktivieren
if ios.rtcTest 'RTC chip available?
hiveid := ios.getNVSRAM(NVRAM_HIVE) hiveid := ios.getNVSRAM(NVRAM_HIVE)
hiveid += ios.getNVSRAM(NVRAM_HIVE+1) << 8 hiveid += ios.getNVSRAM(NVRAM_HIVE+1) << 8
hiveid += ios.getNVSRAM(NVRAM_HIVE+2) << 16 hiveid += ios.getNVSRAM(NVRAM_HIVE+2) << 16
hiveid += ios.getNVSRAM(NVRAM_HIVE+3) << 24 hiveid += ios.getNVSRAM(NVRAM_HIVE+3) << 24
else
ios.sddmset(ios#DM_USER) 'u-marker setzen
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
ifnot ios.sdopen("R",@strNVRAMFile)
ios.sdseek(NVRAM_HIVE)
hiveid := ios.sdgetc
hiveid += ios.sdgetc << 8
hiveid += ios.sdgetc << 16
hiveid += ios.sdgetc << 24
ios.sdclose
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
PRI ircConnect | t PRI ircConnect | t
joined := FALSE joined := FALSE
handleStatusStr(string("Verbinde mit IRC-Server..."), 2, TRUE) handleStatusStr(@strConnect, 2, TRUE)
ios.lanstart ios.lanstart
if (handleidx := ios.lan_connect(ip_addr, ip_port)) == $FF if (handleidx := ios.lan_connect(ip_addr, ip_port)) == $FF
handleStatusStr(string("Kein Socket frei!"), 2, TRUE) handleStatusStr(@strErrorNoSocket, 2, TRUE)
return(-1) return(-1)
ifnot (ios.lan_waitconntimeout(handleidx, 2000)) ifnot (ios.lan_waitconntimeout(handleidx, 2000))
handleStatusStr(string("Verbindung mit IRC-Server konnte nicht aufgebaut werden."), 2, TRUE) handleStatusStr(@@strErrorConnect, 2, TRUE)
ircClose ircClose
return(-1) return(-1)
handleStatusStr(string("Verbunden, warte auf Bereitschaft..."), 2, TRUE) handleStatusStr(@strWaitConnect, 2, TRUE)
t := cnt t := cnt
repeat until (cnt - t) / clkfreq > 1 '1s lang Meldungen des Servers entgegennehmen repeat until (cnt - t) / clkfreq > 1 '1s lang Meldungen des Servers entgegennehmen
@ -463,19 +479,19 @@ PRI ircClose
ifnot handleidx == $FF ifnot handleidx == $FF
ios.lan_close(handleidx) ios.lan_close(handleidx)
handleidx := $FF handleidx := $FF
handleStatusStr(string("Verbindung mit IRC-Server getrennt..."), 2, TRUE) handleStatusStr(@strDisconnect, 2, TRUE)
title_draw title_draw
PRI ircPass PRI ircPass
if handleidx == $FF if handleidx == $FF
handleStatusStr(string("Kann Paßwort nicht setzen (keine Verbindung zum Server)"), 2, FALSE) handleStatusStr(@strErrorPassConn, 2, FALSE)
return(-1) return(-1)
else else
handleStatusStr(string("Sende Paßwort..."), 2, TRUE) handleStatusStr(@strSendPass, 2, TRUE)
if sendStr(string("PASS ")) or sendStr(@password) or sendStr(string(13,10)) if sendStr(string("PASS ")) or sendStr(@password) or sendStr(string(13,10))
handleStatusStr(string("Fehler beim Senden des Paßwortes"), 2, TRUE) handleStatusStr(@strErrorSendPass, 2, TRUE)
return(-1) return(-1)
PRI ircNick PRI ircNick
@ -483,21 +499,21 @@ PRI ircNick
if handleidx == $FF if handleidx == $FF
return(-1) return(-1)
if sendStr(string("NICK ")) or sendStr(@nickname) or sendStr(string(13,10)) if sendStr(string("NICK ")) or sendStr(@nickname) or sendStr(string(13,10))
handleStatusStr(string("Fehler beim Senden des Nicknamens"), 2, TRUE) handleStatusStr(@strErrorSendNick, 2, TRUE)
return(-1) return(-1)
PRI ircReg | t PRI ircReg | t
if handleidx == $FF if handleidx == $FF
handleStatusStr(string("Anmeldung nicht möglich (keine Verbindung zum Server)"), 2, FALSE) handleStatusStr(@strErrorRegConn, 2, FALSE)
return(-1) return(-1)
handleStatusStr(string("Sende Nickname und Benutzerinformationen..."), 2, TRUE) handleStatusStr(@strSendNickReg, 2, TRUE)
ircNick ircNick
if sendStr(string("USER ")) or sendStr(@username) or sendStr(string(" 8 * :Hive #")) or sendStr(str.trimCharacters(num.ToStr(hiveid, num#DEC))) or sendStr(string(13,10)) if sendStr(string("USER ")) or sendStr(@username) or sendStr(string(" 8 * :Hive #")) or sendStr(str.trimCharacters(num.ToStr(hiveid, num#DEC))) or sendStr(string(13,10))
handleStatusStr(string("Fehler beim Senden der Benutzerinformationen"), 2, TRUE) handleStatusStr(@strErrorSendReg, 2, TRUE)
return(-1) return(-1)
t := cnt t := cnt
@ -508,7 +524,7 @@ PRI ircJoin
if strsize(@channel) > 0 and handleidx <> $FF if strsize(@channel) > 0 and handleidx <> $FF
if sendStr(string("JOIN ")) or sendStr(@channel) or sendStr(string(13,10)) if sendStr(string("JOIN ")) or sendStr(@channel) or sendStr(string(13,10))
handleStatusStr(string("Fehler beim Verbinden mit Channel"), 2, TRUE) handleStatusStr(@strErrorSendJoin, 2, TRUE)
return(-1) return(-1)
joined := TRUE joined := TRUE
@ -567,7 +583,9 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
byte[msgstr][i] := byte[x][i] byte[msgstr][i] := byte[x][i]
handleChatStr(string("<priv>"), nickstr, msgstr, 2) handleChatStr(string("<priv>"), nickstr, msgstr, 2)
elseif str.startsWithCharacters(commandstr, string("PING :")) 'PING elseif str.startsWithCharacters(commandstr, string("PING :")) 'PING
handleStatusStr(string("PING erhalten, sende PONG"), 2, TRUE) #ifdef __DEBUG
handleStatusStr(@strPingPong, 2, TRUE)
#endif
byte[commandstr][1] := "O" byte[commandstr][1] := "O"
sendStr(commandstr) sendStr(commandstr)
sendStr(string(13,10)) sendStr(string(13,10))
@ -575,7 +593,7 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
if (str.replaceCharacter(prefixstr, "!", 0)) if (str.replaceCharacter(prefixstr, "!", 0))
repeat x from 0 to strsize(prefixstr) - 1 repeat x from 0 to strsize(prefixstr) - 1
temp_str[x] := byte[prefixstr][x] temp_str[x] := byte[prefixstr][x]
msgstr := string(" hat den Kanal betreten") msgstr := @strJoin
repeat i from 0 to strsize(msgstr) - 1 repeat i from 0 to strsize(msgstr) - 1
temp_str[x++] := byte[msgstr][i] temp_str[x++] := byte[msgstr][i]
temp_str[x] := 0 temp_str[x] := 0
@ -584,7 +602,7 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
if (str.replaceCharacter(prefixstr, "!", 0)) if (str.replaceCharacter(prefixstr, "!", 0))
repeat x from 0 to strsize(prefixstr) - 1 repeat x from 0 to strsize(prefixstr) - 1
temp_str[x] := byte[prefixstr][x] temp_str[x] := byte[prefixstr][x]
msgstr := string(" hat den Kanal verlassen") msgstr := @strPart
repeat i from 0 to strsize(msgstr) - 1 repeat i from 0 to strsize(msgstr) - 1
temp_str[x++] := byte[msgstr][i] temp_str[x++] := byte[msgstr][i]
temp_str[x] := 0 temp_str[x] := 0
@ -593,7 +611,7 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
if (str.replaceCharacter(prefixstr, "!", 0)) if (str.replaceCharacter(prefixstr, "!", 0))
repeat x from 0 to strsize(prefixstr) - 1 repeat x from 0 to strsize(prefixstr) - 1
temp_str[x] := byte[prefixstr][x] temp_str[x] := byte[prefixstr][x]
msgstr := string(" hat den Server verlassen") msgstr := @strLeaveServer
repeat i from 0 to strsize(msgstr) - 1 repeat i from 0 to strsize(msgstr) - 1
temp_str[x++] := byte[msgstr][i] temp_str[x++] := byte[msgstr][i]
temp_str[x] := 0 temp_str[x] := 0
@ -604,7 +622,7 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
if (str.replaceCharacter(prefixstr, "!", 0)) if (str.replaceCharacter(prefixstr, "!", 0))
repeat x from 0 to strsize(prefixstr) - 1 repeat x from 0 to strsize(prefixstr) - 1
temp_str[x] := byte[prefixstr][x] temp_str[x] := byte[prefixstr][x]
msgstr := string(":Nickname geändert in ") msgstr := @strChangeNick
repeat i from 0 to strsize(msgstr) - 1 repeat i from 0 to strsize(msgstr) - 1
temp_str[x++] := byte[msgstr][i] temp_str[x++] := byte[msgstr][i]
msgstr := commandstr + 5 msgstr := commandstr + 5
@ -620,7 +638,7 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
msgstr := str.replaceCharacter(nickstr, " ", 0) msgstr := str.replaceCharacter(nickstr, " ", 0)
case num.FromStr(commandstr, num#DEC) case num.FromStr(commandstr, num#DEC)
1: if prefixstr 1: if prefixstr
msgstr := string("Verbunden mit ") msgstr := @strConnected
repeat x from 0 to strsize(msgstr) - 1 repeat x from 0 to strsize(msgstr) - 1
temp_str[x] := byte[msgstr][x] temp_str[x] := byte[msgstr][x]
repeat i from 0 to LEN_IRCSRV repeat i from 0 to LEN_IRCSRV
@ -658,7 +676,7 @@ PRI ircPutLine | i
elseif str.startsWithCharacters(@send_str, string("/srv")) 'mit Server verbinden elseif str.startsWithCharacters(@send_str, string("/srv")) 'mit Server verbinden
if send_str[4] == " " and send_str[5] <> " " and send_str[5] <> 0 'Nick als Parameter angegeben if send_str[4] == " " and send_str[5] <> " " and send_str[5] <> 0 'Nick als Parameter angegeben
ifnot strToIpPort(@send_str[5], @ip_addr, @ip_port) ifnot strToIpPort(@send_str[5], @ip_addr, @ip_port)
handleStatusStr(string("Fehlerhafte Eingabe von IP-Adresse und Port des IRC-Servers."), 2, TRUE) handleStatusStr(@strErrorAddr, 2, TRUE)
return (FALSE) return (FALSE)
else else
ifnot confServer 'Eingabefenster ifnot confServer 'Eingabefenster
@ -675,7 +693,7 @@ PRI ircPutLine | i
elseif str.startsWithCharacters(@send_str, string("/pass")) 'Paßwort ändern elseif str.startsWithCharacters(@send_str, string("/pass")) 'Paßwort ändern
confPass confPass
win_contentRefresh win_contentRefresh
handleStatusStr(string("Paßwort geändert, zum Anwenden neu verbinden"), 2, FALSE) handleStatusStr(@strPassChanged, 2, FALSE)
elseif str.startsWithCharacters(@send_str, string("/nick")) 'Nickname ändern elseif str.startsWithCharacters(@send_str, string("/nick")) 'Nickname ändern
if send_str[5] == " " and send_str[6] <> " " and send_str[6] <> 0 'Nick als Parameter angegeben if send_str[5] == " " and send_str[6] <> " " and send_str[6] <> 0 'Nick als Parameter angegeben
repeat i from 0 to LEN_NICK repeat i from 0 to LEN_NICK
@ -690,10 +708,10 @@ PRI ircPutLine | i
elseif str.startsWithCharacters(@send_str, string("/user")) 'User ändern elseif str.startsWithCharacters(@send_str, string("/user")) 'User ändern
confUser confUser
win_contentRefresh win_contentRefresh
handleStatusStr(string("User geändert, zum Anwenden neu verbinden"), 2, FALSE) handleStatusStr(@strUserChanged, 2, FALSE)
elseif str.startsWithCharacters(@send_str, string("/join")) 'mit Channel verbinden elseif str.startsWithCharacters(@send_str, string("/join")) 'mit Channel verbinden
if joined if joined
handleStatusStr(string("Kanal bereits betreten, vorher mit /part verlassen"), 2, FALSE) handleStatusStr(@strAlreadyJoined, 2, FALSE)
else else
if send_str[5] == " " and send_str[6] == "#" 'Channel als Parameter angegeben if send_str[5] == " " and send_str[6] == "#" 'Channel als Parameter angegeben
repeat i from 0 to LEN_CHAN repeat i from 0 to LEN_CHAN
@ -1266,13 +1284,114 @@ PRI ledTwinkle(rate)
repeat brightness from 100 to 0 repeat brightness from 100 to 0
led.LEDBrightness(brightness,gc#HBEAT) 'Adjust LED brightness led.LEDBrightness(brightness,gc#HBEAT) 'Adjust LED brightness
waitcnt(rate + cnt) 'Wait a moment waitcnt(rate + cnt) 'Wait a moment
DAT DAT ' Locale
#ifdef __LANG_EN
'locale: english
strConfFile byte "irc.cfg",0
strWin1 byte "Chat",0
strWin2 byte "State",0
strWin3 byte "Input",0
strNoNetwork byte 13,"Administra doesn't provide network functions!",13,"Please load admnet.",13,0
strInitWait byte 13,"Initialiasing, please wait...",13,0
strRestartConf byte "Please restart configuration (F2)",0
strAlreadyJoined byte "Already joined, please leave channel before with F5 (/part)",0
strUserChanged byte "User changed, please reconnect to use it",0
strPassChanged byte "Password changed, please reconnect to use it",0
strInputSrv byte "IRC-Server (ip:port):",0
strErrorAddr byte "Error in ip address or port of server.",0
strInputPass byte "Password:",0
strInputNick byte "Nickname:",0
strInputUser byte "Username:",0
strInputChannel byte "Channel:",0
strConfigSaved byte "Configuration saved.",0
strConnect byte "Connecting to IRC server...",0
strErrorNoSocket byte "No free socket.",0
strErrorConnect byte "Error connecting to IRC server.",0
strWaitConnect byte "Connected, waiting for readyness...",0
strDisconnect byte "Disconnected from IRC server...",0
strErrorPassConn byte "Error setting password (no connection)",0
strSendPass byte "Sending password...",0
strErrorSendPass byte "Error sending password",0
strErrorSendNick byte "Error sending nickname",0
strErrorRegConn byte "No registration possible (no connection)",0
strSendNickReg byte "Sending registration (nick, user, password)...",0
strErrorSendReg byte "Error sending user information",0
strErrorSendJoin byte "Error joining to channel",0
strPingPong byte "PING received, send PONG",0
strJoin byte " has joined the channel",0
strPart byte " has leaved the channel",0
strLeaveServer byte " has leaved the server",0
strChangeNick byte " is now known as ",0
strConnected byte "Connected to ",0
' |------------------------------------------------------------|
strHelp byte "Internal commands:"
byte $0d,"================="
byte $0d
byte $0d,"F1 This Help"
byte $0d,"F2 /set Edit and save all settings"
byte $0d,"F3 Connect to server, login and join"
byte $0d,"F4 /join Join to channel (/join #<channel>)"
byte $0d,"F5 /part Leave current channel (/part <message>)"
byte $0d,"F6 /nick Change nickname (/nick <new nickname>)"
byte $0d,"F7 /user Change username"
byte $0d,"F8 /pass Change password"
byte $0d,"F9 /quit Disconnect from server"
byte $0d,"F10 Exit irc client"
byte $0d," /msg Private Message (/msg <recipient> <text>)"
byte $0d," /srv connect to server and login (srv <ip:port>)"
byte $0d," /save Save settings"
byte $0d,"Tab Switch windows, scroll with cursor up/down"
byte $0d
byte $0d,"All other input beginning with '/' is a direct command to the"
byte $0d,"server. All input that doesn't begin with '/' is a public"
byte $0d,"message to the current channel",$0
#else
'default locale: german
strConfFile byte "irc.cfg",0
strWin1 byte "Chat",0 strWin1 byte "Chat",0
strWin2 byte "Status",0 strWin2 byte "Status",0
strWin3 byte "Eingabe",0 strWin3 byte "Eingabe",0
strConfFile byte "irc.cfg",0 strNoNetwork byte 13,"Administra stellt keine Netzwerk-Funktionen zur Verfügung!",13,"Bitte admnet laden.",13,0
strInitWait byte 13,"Initialisiere, bitte warten...",13,0
strRestartConf byte "Bitte Konfiguration neu starten (F2)",0
strAlreadyJoined byte "Kanal bereits betreten, vorher mit F5 (/part) verlassen",0
strUserChanged byte "User geändert, zum Anwenden neu verbinden",0
strPassChanged byte "Paßwort geändert, zum Anwenden neu verbinden",0
strInputSrv byte "IRC-Server angeben (IP:Port):",0
strErrorAddr byte "Fehlerhafte Eingabe von IP-Adresse und Port des Servers.",0
strInputPass byte "Paßwort eingeben:",0
strInputNick byte "Nickname eingeben:",0
strInputUser byte "Username eingeben:",0
strInputChannel byte "Channel eingeben:",0
strConfigSaved byte "Konfiguration gespeichert.",0
strConnect byte "Verbinde mit IRC-Server...",0
strErrorNoSocket byte "Kein Socket frei!",0
strErrorConnect byte "Verbindung mit IRC-Server konnte nicht aufgebaut werden.",0
strWaitConnect byte "Verbunden, warte auf Bereitschaft...",0
strDisconnect byte "Verbindung mit IRC-Server getrennt...",0
strErrorPassConn byte "Kann Paßwort nicht setzen (keine Verbindung zum Server)",0
strSendPass byte "Sende Paßwort...",0
strErrorSendPass byte "Fehler beim Senden des Paßwortes",0
strErrorSendNick byte "Fehler beim Senden des Nicknamens",0
strErrorRegConn byte "Anmeldung nicht möglich (keine Verbindung zum Server)",0
strSendNickReg byte "Sende Nickname und Benutzerinformationen...",0
strErrorSendReg byte "Fehler beim Senden der Benutzerinformationen",0
strErrorSendJoin byte "Fehler beim Verbinden mit Channel",0
strPingPong byte "PING erhalten, sende PONG",0
strJoin byte " hat den Kanal betreten",0
strPart byte " hat den Kanal verlassen",0
strLeaveServer byte " hat den Server verlassen",0
strChangeNick byte ":Nickname geändert in ",0
strConnected byte "Verbunden mit ",0
' |------------------------------------------------------------| ' |------------------------------------------------------------|
strHelp byte "Interne Befehle:" strHelp byte "Interne Befehle:"
@ -1291,11 +1410,12 @@ strHelp byte "Interne Befehle:"
byte $0d," /msg Private Mitteilung (/msg <Empfänger> <Text>)" byte $0d," /msg Private Mitteilung (/msg <Empfänger> <Text>)"
byte $0d," /srv Mit Server verbinden und anmelden (srv <IP:Port>)" byte $0d," /srv Mit Server verbinden und anmelden (srv <IP:Port>)"
byte $0d," /save Einstellungen speichern" byte $0d," /save Einstellungen speichern"
byte $0d,"Tab Fenster umschalten, scrollen mit Corsor hoch/runter" byte $0d,"Tab Fenster umschalten, scrollen mit Cursor hoch/runter"
byte $0d byte $0d
byte $0d,"Alle anderen mit '/' beginnenden Eingaben sind Befehle an den" byte $0d,"Alle anderen mit '/' beginnenden Eingaben sind Befehle an den"
byte $0d,"Server. Alle Eingaben, welche nicht mit '/' beginnen, sind" byte $0d,"Server. Alle Eingaben, welche nicht mit '/' beginnen, sind"
byte $0d,"eine öffentliche Mitteilung an den aktuellen Kanal.",$0 byte $0d,"eine öffentliche Mitteilung an den aktuellen Kanal.",$0
#endif
DAT 'lizenz DAT 'lizenz