X-Git-Url: https://git.sur5r.net/?p=rgb2r-2017;a=blobdiff_plain;f=relfile.c;h=a4e8f4c6159a1db3a1e6a0ab3788e329352a5bfd;hp=6a2fac74c6939ca230dba64d2cda6d0d7c25eb88;hb=HEAD;hpb=5a4dc909a6d38b1153e908e77ee87c48bc159aa9 diff --git a/relfile.c b/relfile.c index 6a2fac7..a4e8f4c 100644 --- a/relfile.c +++ b/relfile.c @@ -2,20 +2,10 @@ #include #include #include -#include #include #include -#include "bcd2dec.h" - -struct relfile -{ - uint8_t fd; - uint8_t cmdfd; - uint8_t devnr; - uint8_t sa; - uint8_t recsize; -}; +#include "relfile.h" #define RELFILENAME_MAX (FILENAME_MAX + 4) // FOO,L,\xFF\0 @@ -80,135 +70,3 @@ void relfile_close(struct relfile *rf) cbm_close(rf->fd); } -void c128_perror(uint8_t c, char *msg) { - cprintf("\r\nError (Code %d) while: %s\r\nOS Error = %d\r\n", c, msg, - _oserror); -} - -int main(void) -{ - char bla[25]; - struct relfile rf; - uint8_t c=0; - uint8_t start_sec, start_tenth; - uint8_t end_sec, end_tenth; - uint8_t i,j; - - videomode(VIDEOMODE_80x25); - fast(); - - __asm__("jsr initsystime"); - - rf.fd=2; - rf.devnr=8; - rf.sa=3; - rf.recsize=16; - - if(relfile_open(&rf, "reldata")) - { - c128_perror(c, "relfile_open"); - return 1; - } - - start_tenth = CIA1.tod_10; - start_sec = CIA1.tod_sec; - - for(i=1;i<=50;i++) - { - //cgetc(); - /* - cprintf("P%d\r",i); - if(relfile_pos(&rf, i, 0)) - { - c128_perror(c, "relfile_pos1"); - return 2; - } - */ - if(relfile_is_split_record(&rf, i)) - { - cprintf("\r\nSPLIT: %d!\r\n",i); - } - /* - if(relfile_pos(&rf, i, 0)) - { - c128_perror(c, "relfile_pos2"); - return 2; - } - cprintf("C%d\r",i); - if(relfile_clear(&rf)) - { - c128_perror(c, "relfile_clear"); - return 2; - } - */ - srand(i); - for(j=0;j %d.%d\r\n",start_sec,start_tenth,end_sec,end_tenth); - - - if(relfile_open(&rf, "reldata")) - { - c128_perror(0, "relfile_open"); - return 3; - } - start_tenth = CIA1.tod_10; - start_sec = CIA1.tod_sec; - - for(i=1;i<=50;i++) - { - cprintf("P%d\r",i); - if(relfile_pos(&rf, i, 0)) - { - c128_perror(0, "relfile_pos"); - return 1; - } - if(relfile_is_split_record(&rf, i)) - { - cprintf("\r\nSPLIT!\r\n"); - } - cprintf("R%d\r",i); - if(relfile_read(&rf, bla)) - { - c128_perror(0, "relfile_read"); - return 1; - } - - cprintf("?%d\r",i); - srand(i); - for(j=0;j %d.%d\r\n",start_sec,start_tenth,end_sec,end_tenth); - - return 0; -} -