TriOS-alt/system/regnatix/admtest.spin

321 lines
20 KiB
Plaintext
Raw Normal View History

2010-04-03 15:37:42 +02:00
<EFBFBD><EFBFBD>{{
2010-03-22 21:49:23 +01:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 : Administra-Test
Chip : Regnatix
Typ : Programm
Version : 01
Subversion : 01
Funktion : Testroutinen f<00>r die Administra-Funktionen
Komponenten : -
COG's : -
Logbuch :
21-03-2010-dr235 - erste version
Kommandoliste :
Notizen :
}}
OBJ
ios: "ios"
CON
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000
2010-04-03 15:37:42 +02:00
PUB main
2010-03-22 21:49:23 +01:00
ios.start
' ios.startram 'code f<00>r test im ram, sollte bei bin-datei auskommentiert werden
ios.screeninit(string("<00>% Hive: Administra-Test"),1)
2010-04-03 15:37:42 +02:00
repeat
fTest1
fTest2
fTest3
DAT 'test 1: mount & unmount
t1_s1 byte "Test1: Volume mounten",0
t1_s2 byte "[sdmount]",0
t1_s3 byte "[sdvolname] = ",0
t1_s4 byte "[sdcheckmounted] = ",0
t1_s5 byte "[sdcheckused] = ",0
t1_s6 byte "[sdcheckfree] = ",0
PRI fTest1 | err
fPause(@t1_s1)
repeat
ios.print(@t1_s2) 'sdmount
err := ios.sdmount
fError(err)
fPrintResultDec(@t1_s4,ios.sdcheckmounted)
ifnot err
fPrintResultStr(@t1_s3,ios.sdvolname)
fPrintResultDec(@t1_s5,ios.sdcheckused)
fPrintResultDec(@t1_s6,ios.sdcheckfree)
until fAktion
DAT 'test 2: daten schreiben & lesen
t2_s1 byte "Test2: Daten schreiben und lesen ",0
t2_s2 byte "[sdopen-w]",0
t2_s3 byte "[sdputc] = ",0
t2_s4 byte "[sdclose]",0
t2_s5 byte "[sdnewfile]",0
t2_s6 byte "[sdgetc] = ",0
t2_s7 byte "[sdopen-r]",0
t2_s8 byte "Daten lesen...",0
t2_fn byte "admtest.dat",0
PRI fTest2 | err,i
fPause(@t2_s1)
repeat
ios.print(@t1_s2) 'sdmount
err := ios.sdmount
fError(err)
ios.print(@t2_s5) 'sdnewfile
err := ios.sdnewfile(@t2_fn)
fError(err)
ios.print(@t2_s2)
err := ios.sdopen("W",@t2_fn) 'sdopen
fError(err)
ifnot err
ios.print(@t2_s3)
ios.printnl
i := 0
repeat 256
ios.printchar(i)
ios.sdputc(i++) 'sdputc
ios.printnl
ios.print(@t2_s4)
fError(ios.sdclose) 'sdclose
fPause(@t2_s8)
ios.print(@t2_s7)
err := ios.sdopen("R",@t2_fn) 'sdopen
fError(err)
ifnot err
ios.print(@t2_s6)
ios.printnl
repeat 256
ios.printchar(ios.sdgetc) 'sdgetc
ios.printnl
ios.print(@t2_s4)
fError(ios.sdclose) 'sdclose
until fAktion
DAT 'test 3:
t3_s1 byte "Test3: Block schreiben & lesen",0
t3_s2 byte "[sdnewfile]",0
t3_s3 byte "[sdopen-w]",0
t3_s4 byte "[sdopen-r]",0
t3_s5 byte "[sdclose]",0
t3_s6 byte "[sdputblk]",0
t3_s7 byte "[sdgetblk]",0
t3_s8 byte "Puffer mit Werten f<00>llen...",0
t3_s9 byte "Puffer l<00>schen...",0
t3_s10 byte "Puffer = ",0
t3_fn byte "admtest.dat",0
CON
blkcount = 256
VAR
byte buffer[blkcount]
PRI fTest3 | i,err
fPause(@t3_s1)
repeat
i := 0
ios.print(@t3_s8) 'puffer mit werten f<00>llen
ios.printnl
repeat blkcount
byte[@buffer][i++] := i
i := 0
ios.print(@t3_s10) 'puffer anzeigen
repeat blkcount
ios.printhex(byte[@buffer][i++],2)
ios.printchar(":")
fPause(@t3_s8)
ios.print(@t3_s3) 'puffer --> datei
err := ios.sdopen("W",@t3_fn)
fError(err)
ifnot err
ios.print(@t3_s6)
ios.printnl
ios.sdputblk(blkcount,@buffer)
ios.print(@t3_s5)
ios.sdclose
ios.printnl
i := 0
ios.print(@t3_s9) 'puffer l<00>schen
repeat blkcount
byte[@buffer][i++] := 0
ios.print(@t3_s4) 'puffer <-- datei
err := ios.sdopen("R",@t3_fn)
fError(err)
ifnot err
ios.print(@t3_s6)
ios.printnl
ios.sdgetblk(blkcount,@buffer)
ios.print(@t3_s5)
ios.sdclose
ios.printnl
i := 0
ios.print(@t3_s10) 'puffer anzeigen
repeat blkcount
ios.printhex(byte[@buffer][i++],2)
ios.printchar(":")
until fAktion
DAT 'fAktion: Aktion abfragen
a_s1 byte "<E>nde, <N>ochmal, <W>eiter : ",0
PRI fAktion: aktion
ios.printnl
ios.print(@a_s1)
case ios.keywait
"e": ios.stop
"w": aktion := 1
"n": aktion := 0
ios.printnl
DAT 'fPause: Printausgabe und Pause
p_s1 byte "Weiter? <*> :",0
PRI fPause(strptr)
ios.print(strptr)
ios.printnl
ios.print(@p_s1)
ios.keywait
ios.printnl
DAT 'fPrintResultStr: Testanzeige von Stringresultaten
PRI fPrintResultStr(strptr1,strptr2)
ios.print(strptr1)
ios.print(strptr2)
ios.printnl
DAT 'fPrintResultDec: Testanzeige von Dezimalwerten
PRI fPrintResultDec(strptr, wert)
ios.print(strptr)
ios.printdec(wert)
ios.printnl
DAT 'fError: Fehler ausgeben
f_s1 byte "Fehlernummer : ",0
f_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
PRI fError(err)
ios.printnl
ios.print(@f_s1)
ios.printdec(err)
ios.print(string(" : $"))
ios.printhex(err,2)
ios.printnl
ios.print(@f_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)
ios.printnl
2010-03-22 21:49:23 +01:00
DAT
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. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}}