Mail Archives: djgpp-workers/1996/06/12/18:34:15
===============================================================================
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 -