terug.gif
#include <stdlib.h>
#include <conio.h>
#include <stdio.h>
#include "datom.h"
#include <windows.h>
unsigned int count[5];
// int count1, count2, count3, count4, count5;
// variabelen tbv terminal programma
unsigned char regels; // aantal afgedrukte regels in pagemode
unsigned char schermstatus; // controle voor tekst naar scherm sturen
unsigned char printerstatus; // controle voor teken naar printer sturen
unsigned char pagemode; // controle voor pagemode aan/uit
unsigned char capsstatus; // status van de caps lock toets
unsigned char commandonr; // gebruikt voor opslag van commando nummer
unsigned char msb = 0xff; // controle bit voor bit7 wel of niet strippen
unsigned char kleur = 7; // tekst atribuut bij opstarten
unsigned char venster_xlo; // coordinaten tekstvenster
unsigned char venster_ylo; //
unsigned char venster_xrb; //
unsigned char venster_yrb; //
unsigned int gwindow_xlo = 0; // coordinaten grafisch venster
unsigned int gwindow_ylo = 0; //
unsigned int gwindow_xrb = -1; //
unsigned int gwindow_yrb = -1; //
unsigned int oorsprong_x = 0; // offset voor grafische oorsprong
unsigned int oorsprong_y = 0; //
unsigned char schermpag = 0; // schermpagina nummer voor bewerking
unsigned char resettoets = 83; // code voor reset toets
unsigned char prnnr = 0; // nummer van geselecteerde printerpoort
unsigned char cenr; // critical errornummer
unsigned char adres_b000; // emulatie adres
unsigned char bEnd = FALSE; // nee, we zijn nog niet klaar
unsigned char bCursor = TRUE; // default wel een cursor
unsigned char scale_x=1, scale_y=1; // default vergroting
unsigned char videomem[13000]; // video memory
int xco=0, yco=0; // actuele cursor positie
char scherm[90][90];
BOOL bKey, bShift, bCaps, bCtrl;
void main()
{
int result;
reset();
while (bEnd == FALSE) {
result=readbyte();
if ((result & 0xff00) == 0xff00) {
result &= 255;
Process(result);
}
}
}
void Process(char result)
{
int result1;
int x,y;
switch (result) {
case 0:
result1=readbytew();
switch (result1) {
case DRUKAF:
drukaf();
break;
case KEY:
keyb();
gotoxy(xco+1, yco+1);
break;
case COPY:
copy();
break;
case GPLOT:
gplot();
break;
case IGRAPH:
igraph();
break;
case SIMULATE4:
simulate4();
break;
case RAMFNT:
ramfnt();
break;
case SCHRIJF:
schrijf();
break;
case SCHAAL:
schaal();
break;
case CURSOR_ON:
cursor_on();
break;
case CURSOR_OFF:
cursor_off();
break;
case LOADFILE:
loadfile();
break;
case SAVEFILE:
savefile();
break;
case CAT:
cat();
break;
case ACHDIR:
achdir();
break;
case ARMDIR:
armdir();
break;
case AMKDIR:
amkdir();
break;
case DELETE:
delete();
break;
case LOCK:
alock();
break;
case UNLOCK:
aunlock();
break;
case ADRIVE:
adrive();
break;
case MSDOS:
msdos();
break;
case HIDE:
hide();
break;
case UNHIDE:
unhide();
break;
case INFO:
info();
break;
case GELUID:
geluid();
break;
case BLIEP:
bliep();
break;
case ERRMSG:
errmsg();
break;
case KNAAGDIER:
knaagdier();
break;
case DEFMUISMASKER:
defmuismasker();
break;
case CURSORPOS:
cursorpos();
break;
case VIDEO:
video();
break;
case SERPORT:
serport();
break;
case PRINTIT:
printit();
break; 
case DOSFUNCTIE:
dosfunctie();
break;
case PORT_IN:
port_in();
break;
case PORT_OUT:
port_out();
break;
case UDS:
uds();
break;
case MOUSE_MOT:
mouse_mot();
break;
case WHOAMI:
whoami();
break;
case CLEAR0:
clear0();
break;
case PALET:
palet();
break;
case CLEAR1:
clear1();
break;
case CLEAR1A:
clear1a();
break;
case CLEAR2:
clear2();
break;
case CLEAR2A:
clear2a();
break;
case CLEAR3:
clear3();
break;
case CLEAR3A:
clear3a();
break;
case CLEAR4:
clear4();
break;
case CLEAR4A:
clear4a();
break;
case VIDEOMOD:
videomod();
break;
case VIDEOCOL:
videocol();
break;
case SCHRIJFPIX:
schrijfpix();
break;
case WINDOW:
windowd();
break;
case WINDOW_OFF:
window_off();
break;
case JOYSTICK:
joystick();
break;
case CALLIBRATE:
callibrate();
break;
case BIT7:
bit7();
break;
case BIOSKEY:
bioskey();
break;
case SHELL:
shell();
break;
case ZOEKFILE:
zoekfile();
break;
case ZOEKNEXT:
zoeknext();
break;
case LPT:
lpt();
break;
case RAF_OPEN:
raf_open();
break;
case RAF_SLUIT:
raf_sluit();
break;
case RAF_SCHRIJF:
raf_schrijf();
break;
case RAF_LEZEN:
raf_lezen();
break;
case RAF_MOVE_PTR:
raf_move_ptr();
break;
case RAF_LEES_EXT:
raf_lees_ext();
break;
case MOUSEKAR:
mousekar();
break;
case VERSIE:
versie();
break;
case TEKEN2LPT:
teken2lpt();
break;
case CGABITMAP:
cgabitmap();
break;
case HFILL:
hfill();
break;
case VFILL:
vfill();
break;
case ROEP61:
roep61();
break;
case GWINDOW:
gwindow();
break;
case GWOFF:
gwoff();
break;
case OORSPRONG:
oorsprong();
break;
case VIEWSCHERM:
viewscherm();
break;
case WERKSCHERM:
werkscherm();
break;
case CURSORDEF:
cursordef();
break;
case READ_B001:
read_b001(0x00);
break;
case READ_B002:
read_b002();
break;
case WRITE_B000:
write_b000();
break;
case EGAFONT:
egafont();
break;
case EGA8X14:
ega8x14();
break;
case EGA8X8:
ega8x8();
break;
default:
error(result);
break;
}
break;
case CTRL_A:
teken2lpt();
break;
case CTRL_B:
printerstatus = TRUE;
break;
case CTRL_C:
printerstatus = FALSE;
break;
case CTRL_D:
viewscherm();
break;
case CTRL_E:
werkscherm();
break;
case CTRL_F:
schermstatus = TRUE;
break;
case CTRL_G:
break;
case CTRL_H:
// STAPJE TERUG
if (xco > venster_xlo)
xco--;
break;
case CTRL_I:
// stapje naar rechts
if (xco < venster_xrb) {
xco++;
break;
}
// fall through
case CTRL_J:
// stapje naar beneden
if (yco < venster_ylo)
yco++;
else {
if (pagemode == TRUE) {
if (regels == venster_ylo - venster_yrb) {
getch();
regels=0;
}
}
for (y=venster_ylo; y>0; y++)
strcpy(scherm[y+1], scherm[y]);
strcpy(scherm[venster_ylo], LEEG);
}
break;
case CTRL_K:
// stapje naar boven
if (yco < venster_yrb)
yco--;
else {
// scrollup
}
break;
case CTRL_L:
// wash my window
for (y=0; y<venster_ylo; y++)
strcpy(scherm[y], " ");
venster_xrb = 80;
yco = venster_yrb = 0;
xco = venster_xlo = 0;
venster_ylo = 24;
regels=0;
break;
case CTRL_M:
// next line
xco=venster_xlo;
break;
case CTRL_N:
// pagemode aan
pagemode = TRUE;
regels = 0;
break;
case CTRL_O:
// pagemode uit
pagemode = FALSE;
break;
case CTRL_P:
xco = venster_xlo;
yco = venster_ylo;
break;
case CTRL_Q:
videocol();
break;
case CTRL_U:
// scherm uit
schermstatus = FALSE;
break;
case CTRL_V:
videomod();
break;
case CTRL_W:
cgabitmap();
break;
case CTRL_X:
gwindow();
break;
case CTRL_Z:
// gwindowoff();
windowd();
break;
case CTRL_KM:
windowd();
break;
case CTRL_MN:
oorsprong();
break;
case HOME:
xco=venster_xlo;
yco=venster_ylo;
break;
case CTRL_SL:
// heel verhaal
// zetcursor();
break;
default:
scherm[yco][xco] = result;
gotoxy(1,1);
for (y=0; y<venster_ylo; y++)
printf("%s", scherm[y]);
Process(CTRL_I);
break;
}
}
terug.gif