Example Using C or Assembly to Scroll Text for FORTRANLast reviewed: July 17, 1995Article ID: Q62885 |
The information in this article applies to:
SUMMARYWith an OUTTEXT call, it is not possible to embed CR/LF characters to enforce scrolling of text on the screen. To scroll the text, an assembler or C routine may be used as follows:
MORE INFORMATIONThe following code sample illustrates the use of the assembly routine:
Sample Code (.for)
interface to subroutine scroll_line() end include 'fgraph.fi' include 'fgraph.fd' record/rccoord/curposc call settextposition (10,20,curpos) call outtext('Hello1')c call scroll_line()c call settextposition (10,20,curpos) call outtext ('Hello2') endThe following is the code segment of the assembly module:
Sample Code (.asm).model large,fortran .code scroll_line proc far push bp mov bp, sp mov ah,6 ;function 6H mov al,1 ;number of lines to scroll mov ch,0 ;row of top left corner mov cl,0 ;col of top left corner mov dh,24 ;row of bottom right corner mov dl,79 ;col of bottom right corner mov bh,7 ;attribute of line int 10h ;interrupt 10h pop bp retscroll_line endp endTo use the C subroutine, only the interface statement of the FORTRAN module should be modified to read as follows:
interface to subroutine scroll_line [FAR,C] () endThe following is the code segment of the C module:
Sample Code (C)
#include <stdio.h> #include <dos.h>union REGS reg;
void scroll_line(){
/* * The registers have the same significance as those in * the assembly-language routine above. */ reg.h.ah = 6; // function 6H reg.h.al = 1; // number of lines to scroll reg.h.bh = 0x7; // attribute of line reg.h.ch = 0; // row of top left corner reg.h.cl = 0; // column of top left corner reg.h.dh = 24; // row of bottom right corner reg.h.dl = 79; // row of top right corner int86(0x10, ®, ®); return;} The following is the MAKE file when the assembly module subroutine is used:
Makefile (Assembly)all=1.obj 2.obj update: 1.for fl /Zi /c 1.forupdate: 2.asm masm /Zi 2.asm;update: $(all) link /co $(all),,,/nod graphics llibfer; The following is the MAKE file when the C module subroutine is used:
Makefile (C)all=1.obj 2.obj update: 1.for fl /Zi /c 1.forupdate: 2.c cl /AL /Zi /c 2.cupdate: $(all) link $(all)/co,,,/nod /noe graphics llibfer llibcer; |
Additional reference words: kbinf 5.00 5.10 mixed language
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |