Code: Select all
int _di_ = 0;
void pokeb(int a, int b, char c)
{
asm mov ax, [a];
asm mov es, ax;
asm mov di, [b];
asm mov al, [c];
asm mov [es:di], al;
}
char peekb(int a, int b)
{
char c;
asm mov ax, [a];
asm mov es, ax;
asm mov di, [b];
asm mov al, [es:di];
asm mov [c], al;
return c;
}
void outp(int a, char b)
{
asm mov dx, [a];
asm mov al, [b];
asm out dx, al;
}
char inp(int a)
{
char b;
asm mov dx, [a];
asm in al, dx;
asm mov [b], al;
return b;
}
void gotoxy(int a)
{
char b;
char c;
_di_ = a * 2;
asm mov ax, [a];
asm mov [b], al;
asm mov [c], ah;
outp(0x3d4, 0xf);
outp(0x3d5, b);
outp(0x3d4, 0xe);
outp(0x3d5, c);
}
void clrscr()
{
int a;
for (a = 0x0; a <= 0xf00;)
{
pokeb(0xb800, a, ' ');
a++;
pokeb(0xb800, a, 0x1f);
a++;
}
gotoxy(_di_ / 2);
}
void putch(char a)
{
int b;
if (_di_ == 0xfa0)
{
for (b = 0x0; b <= 0xf00; b++)
{
pokeb(0xb800, b, peekb(0xb800, b + 0xa0));
}
for (b = 0xf00; b <= 0xfa0;)
{
pokeb(0xb800, b, 0x20);
b++;
pokeb(0xb800, b, 0x1f);
b++;
}
_di_ = 0xf00;
}
if (a == '\n')
{
_di_ = _di_ - _di_ % 0xa0 + 0xa0;
}
else if ((a >= 0x20) && (a <= 0x7e))
{
pokeb(0xb800, _di_, a);
_di_++;
pokeb(0xb800, _di_, 0x1f);
_di_++;
}
gotoxy(_di_ / 2);
}
void puts(char *a)
{
while (*a != 0)
{
putch(*a);
a++;
}
}
void main(void)
{
clrscr();
gotoxy(988);
puts("Matias Sebastian Beretta");
asm mov ah, 0x0;
asm int 0x16;
}