Path: utzoo!utgpu!watmath!clyde!att!pacbell!ames!xanth!nic.MR.NET!tank!uxc!deimos!ksuvax1!kuhub.cc.ukans.edu!dougm From: dougm@kuhub.cc.ukans.edu (Douglas Miller) Newsgroups: comp.sys.ibm.pc Subject: Re: Cursor question Message-ID: <2021@kuhub.cc.ukans.edu> Date: 4 Dec 88 00:01:27 GMT Organization: University of Kansas Academic Computing Services Lines: 82 Here is an improve version of the cursor program. It is set up as an assembly procedure to be linked (see DEMO) during compilation of your TURBO 4.0 program. I have tested it on both an IBM and a ZENITH and it works. You should run MASM on CURSOR.asm and then place CURSOR.obj in the subdirectory where you plan to compile. I suppose it will also work with TURBO C but I can't say for sure. Doug ****************************************************************************** ASSEMBLY PROCEDURE TO SET THE CURSOR ****************************************************************************** -------cut here-------- ; CURSOR.asm ; ; This program will turn on the cursor at the 6845 CRT controller. ; ; Constants ; ADDRPORT = 03D4H DATAPORT = 03D5H ; CODE SEGMENT BYTE PUBLIC 'CODE' ASSUME CS:CODE PUBLIC CURSOR CURSOR PROC NEAR MOV BX,SP MOV AL,SS:[BX+2] ;Get byte passed by pascal CMP AL,0 JE OFF CMP AL,1 JE ON JMP SHORT TERM OFF: MOV DX,ADDRPORT MOV AL,10 ;10d sent to the address port OUT DX,AL ; sets up the cursor start reg. MOV DX,DATAPORT MOV AL,20H ;Cursor off code OUT DX,AL JMP SHORT TERM ON: MOV DX,ADDRPORT MOV AL,10 OUT DX,AL MOV DX,DATAPORT MOV AL,6H ;Standard DOS 2-line cursor OUT DX,AL ; starts at 6 and ends at 7 MOV DX,ADDRPORT ;Insert other values depending on MOV AL,11 ; your desires and the demands OUT DX,AL ; of your system. I haven't tried MOV DX,DATAPORT ; on anything other than CGA. MOV AL,7H ;11d sent to the addr port sets OUT DX,AL ; up the cursor end reg. TERM: RET 2 CURSOR ENDP CODE ENDS END CURSOR ---------cut here-------- ***************************************************************************** PASCAL DEMO PROGRAM (uses TURBO 4.0) ***************************************************************************** ---------cut here-------- program cursor1; uses Crt; var c : Char; {$L CURSOR.OBJ} procedure cursor(off_on : Byte); external; {[0=off, 1=on]} begin writeln('Turning cursor off'); cursor(0); c := ReadKey; writeln('Turning cursor on'); cursor(1); c := ReadKey; end.