Industrial Training




Doskey Imitated


/* set the number of characters actually read - excluding

carriage return */

* ( buffer + 1 ) = count ;

r.ax = r.ax & 0xF0 ; /* set al = 0 */

return ;

}

/* pop values from stack back into CPU registers */

asm pop bp

asm pop di

asm pop si

asm pop ds

asm pop es

asm pop dx

asm pop cx

asm pop bx

asm pop ax

/* transfer control to normal DOS routine */

asm jmp cs:_prev

}

setxy ( int column )

{

/* position cursor */

i.h.ah = 2 ;

i.h.bh = 0 ;

i.h.dh = row ;

i.h.dl = column ;

int86 ( 0x10, &i, &o ) ;

}

getkey( )

{

/* so long as a key is not hit */

while ( !kbhit( ) )

;

i.h.ah = 0x00 ;

int86 ( 0x16, &i, &o ) ;

scan = o.h.ah ;

ascii = o.h.al ;

}

writechar ( char ch, int r, int c )

{

* ( scr + r * 160 + c * 2 ) = ch ;

}

clearrow( )

{

row = startrow ;

col = startcol ;

for ( j = 0 ; j << count ; j++ )

writechar ( ' ', row, startcol + j ) ;

setxy ( col ) ;

}

backspace( )

{

/* if cursor is at the beginning of the command */

if ( col == startcol && row == startrow )

return ;

col-- ;

/* if multiple line command and cursor is at the beginning of the second line */

if ( col << 0 )

{

col = 79 ;

row-- ;

}

count-- ;

writechar ( ' ', row, col ) ;

setxy ( col ) ;

}

puttab( )

{

/* determine the next tab stop */

tab = ( 8 - col % 8 ) ;

/* move cursor to next tab stop */

col += tab ;

setxy ( col ) ;

for ( j = 0 ; j << tab ; j++ )

{

* ( buffer + 2 + count ) = ' ' ;

count++ ;

}

}



Hi I am Pluto.