Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Commodore » Commodore 8-bit » Help needed debugging TmpCreat128!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Help needed debugging TmpCreat128! [message #389520] Mon, 23 December 2019 14:32
Harry Potter is currently offline  Harry Potter
Messages: 1301
Registered: March 2012
Karma: 0
Senior Member
Hi! I have yet to find the bug with my Template Creator 128 program. The Add Template module seems to work up to the call to Fields. The debug code I placed just after the call seems to run. But then, it does not display the New Format prompt--even though it is supposed to, as it is a new template disk--and displays an Insert Templates Disk message. I insert it and get the C128 Monitor. The PC is at F4433, where there is no code there. Following is the erroneous code:
void tmp_add_main (void)
//unsigned char i;
//unsigned char /*i,*/ j;
//char c;
//struct dbentry* cur;
//bzero (&tmp_db, sizeof(tmp_db));
//bzero (&input, sizeof(input));
//cleardb ();
//bordercolor (0);cgetc ();
//bzero (&input, sizeof(input));
//bordercolor (1);cgetc ();

tmpdb_open ();
//bgcolor (2);
//bgcolor (3);
for (; i<8; ++i) {
//if (tmp_db.usedfmts&(1<<i)) {
if ((tmp_db.usedfmts>>i)&1) {
//*getfmt( (usedfmtsnums[]=i);
usedfmts[]=tmp_db.fmts[ (usedfmtsnums[]=i)];
//bgcolor (4);
if (<8) {
//cclearxy(i=0,23,39); cclearxy(0,24,39);
//clearline (23); clearline (24);

//gotoxy (0,24); prints ("Insert template disk...");
//promptdisk (instmpdisk);
//for (; i<32 && (tmp_db.usedentries[i>>3]&(1<<(i&7))); ++i);
//for (; i<32 && *(unsigned long*)(&tmp_db.usedentries)&(1<<i); ++i);
//bgcolor (1);

for (; j<32 && (*(unsigned long*)(&tmp_db.usedentries)>>j)&1; ++j);
if (j==32) {
//gotoxy (0, 23); printscr ("Template disk full!\n"
// "Press any key to continue...");
///cgetc(); return;
promptdisk ("Template disk full!"); return;
//bgcolor (1);

if (dialog(&fInTemp)) return;

bgcolor (3); cgetc ();

//strcpy (cur->name, input.tmp);
//bgcolor (3); cgetc ();
if (!strcmp(usedfmts[input.fmtnum], snone))
//if (usedfmts[input.fmtnum]==snone)
//bgcolor (4); cgetc ();
for (i=0; (tmp_db.usedfmts>>i)&1; ++i);
//bgcolor (5); cgetc ();
gotoy (17);
//bgcolor (6); cgetc ();
printf ("\nNew format name");
GetInput (getfmt(i), 17);
} else {
//for (; strcmp(getfmt(i), getfmt(input.fmtnum)); ++i);
} cur->fmt=i;
//gotoxy (0,24); prints ("Insert input disk... ");
promptdisk ("Insert input disk...");
//strcpy (, input.tmp);
//strcpy (curtemplate.fmt, input.fmt);
//sprintf (fi,"0:%s,%c,r",, filetypes[input.type][0]);
//strcpy (, input.tmp);
//strcpy (curtemplate.fmt, input.fmt);
//sprintf (fi,"%s,%c",, filetypes[input.type][0]);
//sprintf (fi, "%s,%c",, j=filetypes[input.type][0]);
//sprintf (fi, &qfilename[2],, j=filetypes[cur->filetype=input.type][0]);
//cputsxy (0,1, fi); cgetc();
//cbm_open (filenum, 8, CBM_READ, fi);
//openfile (CBM_READ);
//openfile (, CBM_READ);
//openfile (cur->name, CBM_READ);
//promptdisk (input.tmp);
bgcolor (4); cgetc();//
openfile (input.out, CBM_READ);
bgcolor (2);
#ifdef __C128__
cur->size=/*curtemplate.size=*/bank1_cbm_read(filenum, 0x400, 0xF000);
cur->size=/*curtemplate.size=*/h_cbm_read(filenum, templatedata, 0x9800);
//cur->size=h_cbm_read(filenum,, 32767);
//curtemplate.size=cbm_read(filenum,, 32767);
bgcolor (3);
cbm_close (filenum);
//clrscr(); printf ("size = %d\n", curtemplate.size); cgetc();
//if ((signed) curtemplate.size<0) {
if ((signed) cur->size==-1) {
//gotobottom (); puts ("Error loading template!");
//cgetc(); return;
promptdisk ("Error loading template!");
//if (curtemplate.size==32767) {
//if ((int)curtemplate.size<0) {
if (!cbm_k_readst()&0x40) {
//gotobottom (); puts ("Template too large!");
//cgetc(); return;
promptdisk ("Template too large!");

//strcpy (tmp_db.entry[i].name,;
strcpy (cur->name, input.tmp);
//strcpy (cur->name, input.tmp);
__asm__ ("\tlda\t_j\n"
//*(unsigned long*)(&tmp_db.usedentries)|=(1<<i);

//gotoxy (0,24); prints ("Insert template disk...");
//promptdisk (instmpdisk);
instmpdiskp ();
//sprintf (fi, "@:%s,%c", input.tmp, j);
//sprintf (fi, qfilename, input.tmp, j);
//cputsxy (0,1, fi); cgetc();
//cbm_open (filenum, 8, CBM_WRITE, fi);
//openfile (CBM_WRITE);

openfile (cur->name, CBM_WRITE);
//printf ("ST: %d\n", (unsigned) cbm_k_readst()); cgetc();
//h_cbm_write (filenum,, cur->size=curtemplate.size);
#ifdef __C128__
bank1_cbm_write (filenum, 0x400, cur->size);
h_cbm_write (filenum, templatedata, cur->size);
//cbm_write (filenum,, curtemplate.size);
cbm_close (filenum);
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Official FAQ comp.binaries.cbm (semimonthly posting)
Next Topic: Service manual for 1520 plotter
Goto Forum:

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Mon Jan 24 20:01:55 EST 2022

Total time taken to generate the page: 0.00677 seconds