home *** CD-ROM | disk | FTP | other *** search
- /* ╓≈╠Γú║╣Γ▒Ω┐╪╓╞ */
- /*
- 1 SetCursorShape ╔Φ╓├╣Γ▒Ω╨╬╫┤ AH=01H
- 2 GotoXY ╔Φ╓├╣Γ▒Ω╬╗╓├ AH=02H
- 3 SaveCursor ╢┴╣Γ▒Ω╬╗╓├/╨╬╫┤ AH=03H
- 4 EnableCursor ╘╩╨φ╣Γ▒Ω╧╘╩╛ AX=FF01H,BL=01H
- 5 DisableCursor ╜√╓╣╣Γ▒Ω╧╘╩╛ ..
- 6 GetCursorStatus ╢┴╣Γ▒Ω╩╟╖±╘╩╨φ AX=FF01H,BL=11H
- 7 EnableGraphCursor ╘╩╨φ═╝╨╬─ú╩╜╣Γ▒Ω AX=FF01H,BL=02H
- 8 DisableGraphCursor ╜√╓╣═╝╨╬─ú╩╜╣Γ▒Ω ..
- 9 GetCursorBlinkTime ╢┴╣Γ▒Ω╔┴╦╕╦┘┬╩ AX=FF01H,BL=10H
- 10 SetCursorBlinkTime ╓├╣Γ▒Ω╔┴╦╕╦┘┬╩ AX=FF01H,BL=00H
- */
- #include "dos.h"
- #include "stdio.h"
-
- typedef unsigned char BYTE;
- typedef unsigned int WORD;
-
- void SetCursorShape(int FirstLine,int LastLine)
- {
- union REGS regs;
-
- regs.h.ah = 1;
- regs.h.ch = FirstLine;
- regs.h.cl = LastLine;
- int86(0x10,®s,®s);
-
- }
-
- void GotoXY(int Row,int Col)
- {
- union REGS regs;
-
- regs.h.ah = 2;
- regs.h.bh = 0;
- regs.h.dh = Row;
- regs.h.dl = Col;
- int86(0x10,®s,®s);
- }
-
- void SaveCursor(int * Row, int * Col, int * FirstLine, int * LastLine)
- {
- union REGS regs;
-
- regs.h.ah = 3;
- int86(0x10,®s,®s);
- *Row = (int)regs.h.dh;
- *Col = (int)regs.h.dl;
- *FirstLine = (int)regs.h.ch;
- *LastLine = (int)regs.h.cl;
- }
-
- void EnableCursor(void)
- {
- union REGS regs;
-
- regs.x.ax = 0xff01;
- regs.h.bl = 1;
- regs.h.bh = 1;
- int86(0x10,®s,®s);
- }
-
- void DisableCursor(void)
- {
- union REGS regs;
-
- regs.x.ax = 0xff01;
- regs.h.bl = 1;
- regs.h.bh = 0;
- int86(0x10,®s,®s);
- }
-
- int GetCursorStatus(void)
- {
- union REGS regs;
-
- regs.x.ax = 0xff01;
- regs.h.bl = 0x11;
- int86(0x10,®s,®s);
- return regs.h.al;
- }
-
- void EnableGraphCursor(void)
- {
- union REGS regs;
-
- regs.x.ax = 0xff01;
- regs.h.bl = 2;
- regs.h.bh = 1;
- int86(0x10,®s,®s);
- }
-
- void DisableGraphCursor(void)
- {
- union REGS regs;
-
- regs.x.ax = 0xff01;
- regs.h.bl = 2;
- regs.h.bh = 0;
- int86(0x10,®s,®s);
- }
-
- int GetCursorBlinkTime(void)
- {
- union REGS regs;
-
- regs.x.ax = 0xff01;
- regs.h.bl = 0x10;
- int86(0x10,®s,®s);
- return regs.h.al;
- }
-
- void SetCursorBlinkTime(int BlinkCount)
- {
- union REGS regs;
-
- regs.x.ax = 0xff01;
- regs.h.bl = 0x00;
- regs.h.bh = BlinkCount;
- int86(0x10,®s,®s);
- }
-
- void SetDisplayMode(BYTE Mode)
- {
- union REGS regs;
-
- regs.h.ah = 0;
- regs.h.al = Mode;
- int86(0x10,®s,®s);
- }
-
- void main()
- {
- int SaveCursorEnable;
- int x,y,BeginLine,EndLine;
- int CurBlinkTime;
- char ch;
-
- SetDisplayMode(0x3);
- GotoXY(2,0);
- SaveCursorEnable = GetCursorStatus();
- EnableCursor();
- SetCursorShape(0x6,0x7);
- printf("╣Γ▒Ω┤ª╙┌╘╩╨φ╫┤╠¼ú¼░┤╚╬╥Γ╝ⁿ╣╪▒╒╣Γ▒Ω\n");
- getch();
- DisableCursor();
- printf("╣Γ▒Ω▒╗╣╪▒╒ú¼░┤╚╬╥Γ╝ⁿ┐¬╞⌠╣Γ▒Ω\n");
- getch();
- EnableCursor();
- SaveCursor(&x,&y,&BeginLine,&EndLine);
- printf("╣Γ▒Ω╞≡╩╝╔¿├Φ╧▀ = %d, ╜ß╩°╔¿├Φ╧▀ = %d\n",BeginLine,EndLine);
- printf("░┤╚╬╥Γ╝ⁿ╔Φ╓├╣Γ▒Ω╬¬┤≤╣Γ▒Ω\n");
- getch();
- SetCursorShape(0x0,0x7);
- printf("░┤╚╬╥Γ╝ⁿ╗╓╕┤╣Γ▒Ω╬¬╨í╣Γ▒Ω\n");
- getch();
- SetCursorShape(0x6,0x7);
- SetCursorBlinkTime(8);
- CurBlinkTime = GetCursorBlinkTime();
- printf("╡▒╟░╣Γ▒Ω╔┴╦╕╦┘┬╩╬¬ %d,░┤╚╬╥Γ╝ⁿ╜√╓╣╣Γ▒Ω╔┴╦╕\n",CurBlinkTime);
- getch();
- SetCursorBlinkTime(0);
- printf("░┤╚╬╥Γ╝ⁿ╜°╚δ═╝╨╬╖╜╩╜ú¼╔Φ╓├╣Γ▒Ω╬¬╘╩╨φ╫┤╠¼\n");
- getch();
- SetCursorBlinkTime(3);
- SetDisplayMode(0x12);
- EnableGraphCursor();
- printf("░┤╚╬╥Γ╝ⁿ╜√╓╣╣Γ▒Ω╧╘╩╛\n");
- getch();
- DisableGraphCursor();
- printf("░┤╚╬╥Γ╝ⁿ═╦│÷\n");
- getch();
- SetDisplayMode(0x3);
- if (SaveCursorEnable == 0) DisableCursor();
- }