[Self-made simple operating system] 5. Miscellaneous (high resolution and keyboard input) and miscellaneous (High Resolution)

Source: Internet
Author: User

[Self-made simple operating system] 5. Miscellaneous (high resolution and keyboard input) and miscellaneous (High Resolution)

 

 

Preface:

>_<"These days, I have been studying a piece of fun. I am going to write "soft and hardware integration Article 3-The course class can still repair computers". However, I have encountered a technical difficulty-WHDI, so the operating system is slowing down! But with the idea of operating system multi-task, I feel like taking this process with a low priority and doing it! After all, technical difficulties sometimes require inspiration ~ (But does anyone know the communication principle of the VGA Interface? Please give me a better link !). Back to the topic, what I learned this time is a little complicated, mainly because of high resolution and keyboard input ~ The former has many relationships with the compilation and hardware (you can check the VBE Video Electronics Standards Association BIOS extension). The latter is mainly a ing relationship, which is not difficult ~

Effect display:

>_<"Increase the resolution to see a wider picture. At the same time, add a text input box to the WINDOW. Note that the English letters entered here must be in upper case. In addition, some special buttons may also have errors and will be optimized in the future ~

Some procedures:

>_< "Resolution control (in asmhead. nas)

1; haribote-OS boot asm 2; TAB = 4 3 4 [sorted set "i486p"]; must be added !!! 5 6 vbemode equ 0x101; 1024x768 x 8bit // display mode 7 botpak equ 0x00280000; bootpack memory first address 8 dskcac equ 0x00100000; 9 DSKCAC0 EQU 0x00008000; 10 11; BOOT_INFO related 12 cyls equ 0x0ff0; set the startup zone 13 leds equ 0x0ff114 vmode equ 0x0ff2; color information about the number of digits 15 scrnx equ 0x0ff4; resolution: X16 scrny equ 0x0ff6; resolution: Y17 vram equ 0x0ff8; Image Buffer start address: 18 19 ORG 0xc200; position of the program, go to the location 20 at the end of the ipl10 drive; --------------------------------------------- set the image mode to 21; check whether the VBE has [display mode protocol BOOS] 22; to AX, ES, after DI is assigned a value, int Is called. If AX is not changed to 0x004f, no VBE will be available, and the 320*200 resolution will be used for 23; JMP scrn320; for debugging, we can still use the old display mode directly, therefore, the 24 mov ax, 0x900025 mov es, AX26 mov di, 027 mov ax, 0x4f0028 INT 0x1029 cmp ax, 0x004f30 JNE scrn32031; check VBE versions 32 mov ax, [ES: DI + 4] 33 cmp ax, 0x020034 JB scrn320; if (AX <0x0200) goto scrn320 35; obtain image mode 36 mov cx, VBEMODE37 mov ax, 0x4f0138 INT 0x1039 cmp ax, 0x004f40 JNE scrn32041; image mode information validation 42 cmp byte [ES: DI + 0x19], 843 JNE scrn32044 cmp byte [ES: DI + 0x1b], 445 JNE scrn32046 mov ax, [ES: DI + 0x00] 47 and ax, 0x008048 JZ scrn320 49; screen mode switch 50 mov bx, VBEMODE + 0x400051 mov ax, 0x4f0252 INT 0x1053 mov byte [VMODE], 8; write down the screen mode 54 mov ax, [ES: DI + 0x12] 55 MOV [SCRNX], AX56 mov ax, [ES: DI + 0x14] 57 MOV [SCRNY], AX58 mov eax, [ES: DI + 0x28] 59 MOV [VRAM], EAX60 JMP keystatus 61 scrn320: 62 mov al, 0x13; VGA diagram, 320x200x8bit color, if the High-Resolution mode fails, you can only use the low-resolution mode 63 mov ah, 0x0064 INT 0x1065 mov byte [VMODE], 8; write down the screen mode 66 mov word [SCRNX], 32067 mov word [SCRNY], 20068 mov dword [VRAM], 0x000a000069 70, QEMU cannot directly use the following method} 71; 0x101 640 480 8bit72; 0x103 800 600 8bit73; 0x105 1024 768 8bit74; 0x107 1280 1024 8bit75; mov bx, 0x410176; mov ax, 0x4f0277; INT 0x1078; mov byte [VMODE], 879; mov word [SCRNX], 64080; mov word [SCRNY], 48081; mov dword [VRAM], 0xe000000082; ----------------------------------------------- set the image mode
  • Line 3 must be added; otherwise, it cannot be displayed normally. The assembly language of the High-version processor is used.
  • Line 3 VBEMODE controls the display mode. For details, refer to 71 ~ 74 rows
  • Line 3: If you directly jump to scrn320, the old screen display mode will be executed. Here, the Section after scrn32 is the original display mode section, if you change the old display mode to 70 rows, the high resolution can also be displayed, but the last mode cannot be displayed on the modulo, in fact, there are so many lines above to check whether high resolution can be enabled on the real machine. Because VESA does not unify all the display modes, high resolution can be enabled only when VBSA-BIOS extension protocols are observed ~

>_< "Keyboard input

  • The keyboard input here creates a ing table based on the ing rules:
1 static char keytable[0x54] = {2         0,   0,   '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^', 0,   0,3         'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '@', '[', 0,   0,   'A', 'S',4         'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', ':', 0,   0,   ']', 'Z', 'X', 'C', 'V',5         'B', 'N', 'M', ',', '.', '/', 0,   '*', 0,   ' ', 0,   0,   0,   0,   0,   0,6         0,   0,   0,   0,   0,   0,   0,   '7', '8', '9', '-', '4', '5', '6', '+', '1',7         '2', '3', '0', '.'8 };
  • Then, use the ing table to read the key information in the message processing part of the keyboard. Note that the putfonts8_asc_sht function is used to display the string, so s [1] = 0;
  • Here, sht_win is a new window (which is also the original display counting window, but only changed the name), so that the input text is displayed on it, each time you input cursor_x, the cursor position needs to be moved back.
1 if (I <0x54 + 256) {2 if (keytable [I-256]! = 0 & cursor_x <144) {// general character 3/* move forward the cursor one time after display */4 s [0] = keytable [I-256]; 5 s [1] = 0; 6 putfonts8_asc_sht (sht_win, cursor_x, 28, COL8_000000, COL8_FFFFFF, s, 1); 7 cursor_x + = 8; // record the cursor position 8} 9}
  • Of course, the Return key must be specially processed as follows:
1 if (I = 256 + 0x0e & cursor_x> 8) {/* backspace key */2/* after the cursor is cleared with the Space key, move the cursor one time behind */3 putfonts8_asc_sht (sht_win, cursor_x, 28, COL8_000000, COL8_FFFFFF, "", 1); 4 cursor_x-= 8; 5}
  • In addition, the text editing area is actually the interface drawn like a window:
 1 void make_textbox8(struct SHEET *sht, int x0, int y0, int sx, int sy, int c) 2 { 3     int x1 = x0 + sx, y1 = y0 + sy; 4     boxfill8(sht->buf, sht->bxsize, COL8_848484, x0 - 2, y0 - 3, x1 + 1, y0 - 3); 5     boxfill8(sht->buf, sht->bxsize, COL8_848484, x0 - 3, y0 - 3, x0 - 3, y1 + 1); 6     boxfill8(sht->buf, sht->bxsize, COL8_FFFFFF, x0 - 3, y1 + 2, x1 + 1, y1 + 2); 7     boxfill8(sht->buf, sht->bxsize, COL8_FFFFFF, x1 + 2, y0 - 3, x1 + 2, y1 + 2); 8     boxfill8(sht->buf, sht->bxsize, COL8_000000, x0 - 1, y0 - 2, x1 + 0, y0 - 2); 9     boxfill8(sht->buf, sht->bxsize, COL8_000000, x0 - 2, y0 - 2, x0 - 2, y1 + 0);10     boxfill8(sht->buf, sht->bxsize, COL8_C6C6C6, x0 - 2, y1 + 1, x1 + 0, y1 + 1);11     boxfill8(sht->buf, sht->bxsize, COL8_C6C6C6, x1 + 1, y0 - 2, x1 + 1, y1 + 1);12     boxfill8(sht->buf, sht->bxsize, c,           x0 - 1, y0 - 1, x1 + 0, y1 + 0);13     return;14 }

>_< "Move the mouse over the window and flash the cursor

  • Moving the mouse is actually very simple, it is to determine whether to exit the screen, then control the border, and finally call the window moving function to locate again
1/* move the mouse */2 mx + = mdec. x; 3 my + = mdec. y; 4 if (mx <0) {5 mx = 0; 6} 7 if (my <0) {8 my = 0; 9} 10 if (mx> binfo-> scrnx-1) {11 mx = binfo-> scrnx-1; 12} 13 if (my> binfo-> scrny-1) {14 my = binfo-> scrny-1; 15} 16 sprintf (s, "(% 3d, % 3d)", mx, my); 17 putfonts8_asc_sht (sht_back, 0, 0, COL8_FFFFFF, COL8_008484, s, 10); // clear, show, brush 18 sheet_slide (sht_mouse, mx, my); 19 // move the window to calculate 20 if (mdec. btn & 0 X01 )! = 0) {21 sheet_slide (sht_win, mx-80, my-80); 22} // press the left button to move sht_win
  • The blinking cursor uses the timer to directly paste the code.
1 else if (I <= 1) {// use Timer 2 if (I! = 0) {3 timer_init (timer3, & fifo, 0);/* wait until 0 then */4 cursor_c = COL8_000000; 5} else {6 timer_init (timer3, & fifo, 1);/* required bytes 1 bytes */7 cursor_c = COL8_FFFFFF; 8} 9 timer_settime (timer3, 50); 10 boxfill8 (sht_win-> buf, sht_win-> bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43); 11 sheet_refresh (sht_win, cursor_x, 28, cursor_x + 8, 44); 12}

 

Link:Http://pan.baidu.com/s/1m2a1C

 


A MP4 or MP5 model. To support wifi, it supports more formats, a 5-inch touch screen, high resolution, and Android smart operating system, cost-effective

If it is MP5, it mainly refers to products below 5 inch (more than 7 inch of SMART system products are traditionally called mid)
One-to-one recommendation (standard for built-in wifi wireless Internet access)
5 inch recommended, price around 490, android2.2 System
1. Onda vx580w, RK2818 chip, LTPS screen is the highlight, and the best display in products of the same level
2. Original N5TOp, RK2818 chip, two-point touch screen is a bright spot
7 inch product recommendations, price 810 RMB, android2.2 System
· 1. Blue Magic w10, cortex A9 kernel, resistance screen, good configuration, good cost performance
8 inch product recommendations, this basic product is basically the latest Android 990 system, the price of Yuan
1. Blue Magic w12, cortex A9 kernel, Capacitive Screen
2. Blue Magic w15, cortex A8 kernel, and ips hard screen display
3. Aino novo8, cortex A9 kernel, Capacitive Screen
4. Original n10, cortex A8 kernel, Capacitive Screen
5. T760, cortex A8 kernel, Capacitive Screen
6. Cobi cube u9gt, cortex A8 kernel, Capacitive Screen
 

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.