/* devideo.c - special video routines for diskedit.c */
/* lrs - 2/13/89 */

#include "video.h"

void ErrorMessage(char mess[])
  {
  at(screenrows()-1,0);
  cprintf(mess);
  cleareol();
  }    /* ErrorMessage */

void ClearErrorMessage()
  {
  at(screenrows()-1,0);
  cleareol();
  }    /* ClearErrorMessage */

void ShowWriteAllowed(int writeallowed)
  {
  at(14,0);
  if (writeallowed)
    cprintf("Write Ok  ");
  else
    cprintf("Write Prot");
  }

void DisplayFrame()
  {
  int ct, linect;
  
  in(REVERSE); at(0,79-42);
  cprintf(" Laine's Mighty Disk Editor  v0.0 02/13/89 ");
  in(DIM);
  at(2,0); cprintf("  CURRENT");
  at(3,0); cprintf("Drive:");
  at(4,0); cprintf("  Cyl:");
  at(5,0); cprintf(" Head:");
  at(6,0); cprintf("  Sec:");
  at(8,0); cprintf("  MAXIMUM");
  at(9,0); cprintf("  Cyl:");
  at(10,0); cprintf(" Head:");
  at(11,0); cprintf("  Sec:");
  ShowWriteAllowed(0);
  at(1,11);
  cprintf("彬頬様様様様様様様様様様様様様様様様様様様様様様様曜様様様様様様様様�");
  at(2,11);
  cprintf("摸旅 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F�0123456789ABCDEF�");
  at(3,11);
  cprintf("綿蔑様様様様様様様様様様様様様様様様様様様様様様様洋様様様様様様様様�");
  linect = (screenrows() >= 43) ? 32 : 16;
  for (ct = 0; ct < linect; ct++)
    {
    at(ct+4,11);
    cprintf("�  �                       -                       �                �");
    }
  at(ct+4,11);
  cprintf("藩擁様様様様様様様様様様様様様様様様様様様様様様様擁様様様様様様様様�");
  at(ct+5,4); in(NORMAL);
  cprintf("PgUp/PgDn - Prev/Next Sector,  F10 Updates Sector (alt+F10 enables update)");
  at(ct+6,2);
  cprintf("G - Goto Sec, M - Modify byte, R/W - Read/Write Sec to/from File, ESC to quit");
  } /* DisplayFrame */
/*-----------------------------------------------------------------------*/
void ShowMaxes(int maxcyl, int maxhead, int maxsec)
  {
  in(DIM);
  at(9,7); cprintf("%3d",maxcyl);
  at(10,7); cprintf("%3d",maxhead);
  at(11,7); cprintf("%3d",maxsec);
  }
/*-----------------------------------------------------------------------*/
void DisplaySector (int drive, int cyl, int head, int sec,
		    long *buf, int offs)
  {
  int ct, linect;
  at(3,8); cprintf("%02x",drive);
  at(4,7); cprintf("%3d",cyl);
  at(5,7); cprintf("%3d",head);
  at(6,7); cprintf("%3d",sec);
  linect = (screenrows() >= 43) ? 32 : 16;
  buf += offs*16;
  for(ct = 0;  ct < linect; ct++)
    {
    at(ct+4,12); in(DIM); cprintf("%02X",ct+offs);
    at(ct+4,15); in(NORMAL);
    Write16Bytes(buf);
    buf+=16;
    }    /* for(ct = 0  to linect */
  at(screenrows()-2,0);
  } /* DisplaySector */

/*---- end of devideo.c ----*/
