delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/06/12/18:34:15

From: k3040e4 AT c210 DOT edvz DOT uni-linz DOT ac DOT at (Oberhumer Markus)
Message-Id: <199606122225.AAA11214@c210.edvz.uni-linz.ac.at>
Subject: some trivial co80 changes
To: djgpp-workers AT delorie DOT com
Date: Thu, 13 Jun 1996 00:25:52 -0200 (MET DST)
Return-Read-To: markus DOT oberhumer AT jk DOT uni-linz DOT ac DOT at

===============================================================================
Markus F.X.J. Oberhumer <markus DOT oberhumer AT jk DOT uni-linz DOT ac DOT at>

Subject: some trivial co80 changes
To: djgpp-workers AT delorie DOT com
===============================================================================


/***********************************************************************
// patch 1 - <pc.h>
************************************************************************/

*** pc.org	Thu Jul 06 06:34:04 1995
--- pc.h	Mon Jun 10 20:26:46 1996
***************
*** 42,51 ****
  int	ScreenCols(void);
  void	ScreenPutChar(int _ch, int _attr, int _x, int _y);
  void	ScreenPutString(const char *_ch, int _attr, int _x, int _y);
  void	ScreenSetCursor(int  _row, int  _col);
  void	ScreenGetCursor(int *_row, int *_col);
  void	ScreenClear(void);
! void	ScreenUpdate(void *_virtual_screen);
! void	ScreenUpdateLine(void *_virtual_screen_line, int _row);
  void	ScreenRetrieve(void *_virtual_screen);
  void	ScreenVisualBell(void);
--- 42,52 ----
  int	ScreenCols(void);
  void	ScreenPutChar(int _ch, int _attr, int _x, int _y);
+ void	ScreenGetChar(int *_ch, int *_attr, int _x, int _y);
  void	ScreenPutString(const char *_ch, int _attr, int _x, int _y);
  void	ScreenSetCursor(int  _row, int  _col);
  void	ScreenGetCursor(int *_row, int *_col);
  void	ScreenClear(void);
! void	ScreenUpdate(const void *_virtual_screen);
! void	ScreenUpdateLine(const void *_virtual_screen_line, int _row);
  void	ScreenRetrieve(void *_virtual_screen);
  void	ScreenVisualBell(void);



/***********************************************************************
// src/libc/pc_hw/co80/scgetch.c
************************************************************************/

/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
#include "sc.h"

void	
ScreenGetChar(int *_ch, int *_attr, int _x, int _y)
{
  int s;

  if ((_x < 0) || (_y < 0))
    return;
  if ((_x >= ScreenCols()) || (_y >= ScreenRows()))
    return;
  s = _farpeekw(dossel, co80 + (_x+_y*ScreenCols())*2);
  if (_ch)
    *_ch = s & 0xff;
  if (_attr)
    *_attr = (s >> 8) & 0xff;
}


/***********************************************************************
// tests/libc/pc_hw/co80/delline.c
************************************************************************/

#include <stdio.h>
#include <conio.h>

int
main(void)
{
  int y;
  struct text_info ti;

  gettextinfo(&ti);
  clrscr();
  for (y = 1; y <= ti.winbottom; y++)
  {
    gotoxy(1,y);
    cprintf("line %3d",y);
  }
  while (getch() != 27)
  {
    gotoxy(1,1);
    delline();
  }
  return 0;
}


/***********************************************************************
// tests/libc/pc_hw/co80/scputc.c
************************************************************************/

#include <pc.h>

char str[] = "This is a test";

int
main(void)
{
  int i,j;
  ScreenClear();
  for (i=0; i<20; i++)
    for (j=0; j<sizeof(str); j++)
      ScreenPutChar(str[j], i, i+j, i);
  return 0;
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019