Turboc Graphical Interface Learning

Source: Internet
Author: User

In fact, I was asked to use the TC interface I was refused, because the TC so primitive tools made out of the interface can look good, this is my appearance the party will be quite hit. However, when I began to follow the example to achieve the first small program, my heart is still small excited. Different from taking Qt lightly can make smarty pants frame, TC so primitive tool The advantage is interesting, really not the same.

http://www.zhihu.com/question/29403861/answer/44441261

Happy to live in the present, but also look forward to the struggle of their predecessors.

Using books: Advanced programming techniques (well-generalized names ...) ) http://read.pudn.com/downloads105/ebook/432600/TC%B8%DF%BC%B6%B1%E0%B3%CC.pdf

Actually say get TC do and take now the framework software do, different place is like the latter like 50 pieces of puzzle, and TC is 1000 block.

At the end of the program design work feel completely off the class, 20 days to complete a similar schedule of applications, TC compiled, DOS interface, I can imagine how ugly this thing ... I try my best. Unfortunately, I would like to complete the evaluation of the studio, Rogue May too many things, the final exam, Cheng project, assessment project, orchestra performance, it meow I also added a community turn to the department ... no Zuo no die. It is not always the people who will plan the time, this attempt to succeed (not successful I have any face to talk about dreams).

1.void TextMode (int newmode);

2.void window (int left, int top, int. right, int bottom);

Defines a rectangular field on the screen as a window. For example, to define a window in the upper-left corner at the screen (20,5), a window with a size of 30 columns and 15 rows can be written as: Windows (5,);

PS: The current window can only have one (because DOS is a single-tasking operating system).

3. Set the background color function:void textbackground (int color);
Set character color function:void textcolor (int color);

Turbo C also provides a function to set the character and background color of the text, which is the Text property setting function:void textattr (int attr);

If you want to set a blue yellow word: textattr (yellow+ (blue<<4));

If a character flicker is required, the definition becomes: textattr (128+yellow+ (blue<<4);

Attention:

(1) for the background only 0 to 7 a total of eight colors, take greater than 7 less than 15 of the number, the color is the same as the value minus 7 corresponds to the same color;

(2) After setting the background and character color of the window with the Textbackground () and TextColor () functions, the color does not change until the window is cleared with the CLRSCR () function, until the function clrscr () is used. The entire window and subsequent text characters that are output to the window will become the new color.

(3) When using the Textattr () function, the background color should be shifted to the left 4 bits to move the 3-bit background color to the correct position;

4. State query function:void gettextinfo (struct text_info *f);

5. Keyboard input

When we press a key on the keyboard, how does the system know that a key is being pressed? Its secret is that the computer keyboard is an intelligent keyboard, in the keyboard has a microprocessor, which is used to scan and detect the press and pick up status of each key. It then communicates with the host in the form of a program interrupt (INT 9). ROM in the BIOS of the keyboard interrupt handler, will be a byte of the key scanning code (scan code 0~6 bit identifies each key on the keyboard position, the highest bit identifies the state of the key, 0 pairs should be the key is pressed; 1 corresponds to loosen. It does not distinguish between uppercase and lowercase letters, and some special keys, such as Printscreen, do not generate a scan code that directly causes interrupt calls to be translated into corresponding ASCII codes.

Since the ASCII code only has 256 (28), it can not be all the keys on the PC keyboard are included, so some control keys such as Ctrl,alt,end,home,del and so on with the expanded ASCII code, the expansion code is represented by a two-byte number. The first byte is 0, the second byte is the number of 0~255, and the keyboard interrupt handler stores the converted expansion code in the AX register, as shown in table 3-3. For a character key, its extension code is its ASCII code.

If there is a key press, Hejian Press, the simple application can be used in two ways: one is directly using the Turbo C keyboard operation function Bioskey () to identify, second, through Chapter 1.2.4.3 describes the int86 () function, call the BIOS INT 16H, function number 0 interrupt 。 It stores the key's scan code in the high-byte of the AX register.

Keyboard operation function Bioskey ():int bioskey (int cmd);

It is described in the Bios.h header file, which is used by parameter cmd to determine how Bioskey () operates:

"Keep =w= and Treasure Tonight"

Turboc Graphical Interface Learning

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.