The text of a manual · part 2 of 9
PT630 Portable Terminal Programming Reference Guide: BIOS and System Functions, pages 5 to 13
Pages 5 to 13 of 73, from PT630 Portable Terminal Programming Reference Guide
The original document is the PDF (2.0 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Unitech PT630
Page 5
PT630 Programming Reference Guide Page 5 of 59 ------------------------------------------------------------------------------------------------------------------
Chapter 1.
BIOS and System Functions
The PT630 operating system supports DOS/BIOS function calls that a programmer can access when developing an application for the portable. 1.1
Interrupt Vector Assignment for I/Os Vector 09 H 0F H 10 H 21 H 22 H 31 H 33 H
BIOS Function Display Font Kermit Server LCD Control System Functions Power Manager Beeper Control RS232 Control
1.2
Display Font Functions
1.2.1
Select Large Font Entry Parameter: AH = 0 Return Value:
( INT 09H ) ; select 8*16-dot character font (4 lines * 16 ; columns display)
None void TL_font(int status) { regs.h.ah = (unsigned char)status; int86(0x09,®s,®s); } 1.2.2
Select Small Font Entry Parameter: AH = 1 Return Value: None
; select 6*8-dot character font (8 lines * 20 columns display)
void TL_font(int status) { regs.h.ah = (unsigned char)status; int86(0x09,®s,®s); }
Page 6
PT630 Programming Reference Guide Page 6 of 59 -----------------------------------------------------------------------------------------------------------------1.2.3
Set Font Type Entry Parameter: AH= 2 AL= 0/1 ; set to large/small font Return Value: None void TL_font(int status) { regs.h.ah = (unsigned char)status; regs.h.al = 2; int86(0x09,®s,®s); }
1.2.4
Get Font Type Entry Parameter: AH= 3 Return Value: AL= 0/1 ; large/small font int TL_get_font_type() { regs.h.ah = 3; int86(0x09,®s,®s); return(regs.h.al); }
1.2.5
Set User-Defined Font for All Characters Entry Parameter: AH= 4 AL= 0/1 ; large/small font DS:DX ; pointer to the buffer with font data ; ( for large font: buffer size = 16*256 =4096 bytes ; for small font: buffer size = 6*256 =1536 bytes ) Return Value: None void TL_change_all_ASCII_font(int type,unsigned char *str) { regs.h.ah=4; regs.h.al=(unsigned char)type; segregs.ds = FP_SEG(str); regs.x.dx = FP_OFF(str); int86x(0x9,®s,®s,&segregs); }
Page 7
PT630 Programming Reference Guide Page 7 of 59 -----------------------------------------------------------------------------------------------------------------1.2.6
Get Font Data for All Characters Entry Parameter: AH= 5 AL= 0/1 ; large/small font DS:DX ; pointer to the buffer ; ( for large font: buffer size = 16*256 =4096 bytes ; for small font: buffer size = 6*256 =1536 bytes ) Return Value: Font data in the buffer Example: void TL_get_all_ASCII_font(int type,unsigned char *str) { regs.h.ah=5; regs.h.al=(unsigned char)type; segregs.ds = FP_SEG(str); regs.x.dx = FP_OFF(str); int86x(0x9,®s,®s,&segregs); }
1.2.7
Set User-Defined Font for One Character Entry Parameter: AH= 6 AL= 0/1 ; large/small font CL =0 - 255 ; character DS:DX ; pointer to the buffer with font data ; ( for large font: buffer size = 16 bytes ; for small font: buffer size = 6 bytes ) Return Value: None Example: void TL_change_one_ASCII_font(int type,int ascii_code,unsigned char *str) { regs.h.ah=6; regs.h.al=(unsigned char)type; regs.h.cl=(unsigned char)ascii_code; segregs.ds = FP_SEG(str); regs.x.dx = FP_OFF(str); int86x(0x9,®s,®s,&segregs); }
1.2.8
Reverse character display (only available on small font mode) Use printf or character display to output “%c7r[“ to force PT600 to display reverse character display. E.x printf("%c7r[",27); ---- show REVERSE character Use printf or character display to output “%c8r[“ to force PT600 to show normal character. E.x printf("%c0r[",27); ---- show normal character
Page 8
PT630 Programming Reference Guide Page 8 of 59 -----------------------------------------------------------------------------------------------------------------1.2.9
Get Font Data for One Characters Entry Parameter: AH= 7 AL= 0/1 ; large/small font CL =0 - 255 ; character DS:DX ; pointer to the buffer ; ( for large font: buffer size = 16 bytes ; for small font: buffer size = 6 bytes ) Return Value: Font data in the buffer Example: void TL_get_one_ASCII_font(int type,int ascii_code,unsigned char *str) { regs.h.ah=7; regs.h.al=(unsigned char)type; regs.h.cl=(unsigned char)ascii_code; segregs.ds = FP_SEG(str); regs.x.dx = FP_OFF(str); int86x(0x9,®s,®s,&segregs); }
1.3
Kermit Server Function ( INT 0FH ) Entry Parameter: Return Value:
None None
When INT 0FH is called in user application, PT630 will enter Kermit server. Pressing [CMD] key then [Exit] key to leave it and return to user application. Example : void TC_kermit_mode() { int86(0x0F,®s,®s); }
Page 9
PT630 Programming Reference Guide Page 9 of 59 -----------------------------------------------------------------------------------------------------------------1.4
LCD Control Functions ( INT 10H )
1.4.1 Clear LCD Screen Entry Parameter: AH = Return Value: None
0
Example: void TL_clrscr() { regs.h.ah= 0; int86(0x10,®s,®s); } 1.4.2
Enable/Disable Screen Scroll Entry Parameter: AH = 1 AL = 0/1 ; disable/enable screen scroll Return Value: None Example: void TL_scroll(int status) { regs.h.ah = 1; regs.h.al = (unsigned char)status; int86(0x10,®s,®s); }
1.4.3
Set Cursor Position Entry Parameter: AH = 2 DH = Row DL = Column Row Column
PT630 6x8 0~7 0~19
Return Value: None Example : void TL_gotoxy(int x,int y) { regs.h.ah = 2; regs.h.dh = (unsigned char)y; regs.h.dl = (unsigned char)x; int86(0x10,®s,®s); }
8x16 0~3 0~15
Page 10
PT630 Programming Reference Guide Page 10 of 59 -----------------------------------------------------------------------------------------------------------------1.4.4
Get Cursor Position Entry Parameter: AH = 3 ; Return Value: DH = Row DL = Column Example : void TL_getxy(int *x,int *y) { regs.h.ah = 3; int86(0x10,®s,®s); *y = regs.h.dh; *x = regs.h.dl; }
1.4.5
Display 16x16 Bitmap Entry Parameter: AH = 4 DH = Row DL = Column DS:BX ; pointer to bitmap ( 32-bytes pattern data ) Return Value: None Note: This function is available only in large font. Example : void TL_display_16x16_location(int x,int y,unsigned char *str) { regs.h.ah=4; regs.h.dh=(unsigned char)y; regs.h.dl=(unsigned char)x; segregs.ds = FP_SEG(str); regs.x.bx = FP_OFF(str); int86x(0x10,®s,®s,&segregs); }
Page 11
PT630 Programming Reference Guide Page 11 of 59 -----------------------------------------------------------------------------------------------------------------Sample C program to display 16x16 graphic pattern. 1 content
Bit Count
7 6 5 4 3 2 1 0
2
3
4
5
6
7
8
9 10 11 12 13 14 15 16
FF FF 3E 1C C9 E3 F7 FF FF FF FF FF FF FF FF FF █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █
█ █ █ █ █ █
█ █ █
█
█ █
█ █ █
█
█ █
█ █ █
█ █ █ █
█ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █
7 █ █ █ █ █ █ █ █ █ █ █ █ █ █ 6 █ █ █ █ █ █ █ █ █ █ █ █ █ Bit 5 █ █ █ █ █ █ █ █ █ █ █ Count 4 █ █ █ █ █ █ █ █ █ █ 3 █ █ █ █ █ █ █ █ █ █ 2 █ █ █ █ █ █ █ █ █ █ █ █ █ 1 █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ 0 █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ Byte count 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Content
FF FF FF FE FC F9 F3 E7 CF CF E7 F3 F9 F3 E7 CF
#include <stdio.h> #include <stdlib.h> #include <dos.h> #include <conio.h> unsigned char logo[32]={0xFF,0xFF,0x3E,0x1C,0xC9,0xE3,0xF7,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFE,0xFC,0xF9,0xF3,0xE7, 0xCF,0xCF,0xE7,0xF3,0xF9,0xF3,0xE7,0xCF}; void main() { void far *buff; union REGS regs; struct SREGS sregs; regs.h.ah=0; int86(0x10, ®s, ®s);
/* clear screen */ regs.h.ah=0; int86(0x9, ®s, ®s);
/* set large font */
Page 12
PT630 Programming Reference Guide Page 12 of 59 -----------------------------------------------------------------------------------------------------------------regs.h.ah=5; regs.h.al=0; int86(0x10, ®s, ®s); /* set cursor off */ buff=logo; regs.h.ah=4; regs.h.dh=1; /* Row */ regs.h.dl=2; /* Column */ regs.x.bx=FP_OFF(buff); sregs.ds=FP_SEG(buff); int86x(0x10, ®s, ®s, &sregs); getch(); } 1.4.6
Set Cursor On/Off Entry Parameter:
AH = 5 AL = 0/1 ; set cursor OFF/ON Return Value: None Example : void TL_cursor_type(int status) { regs.h.ah = 5; regs.h.al = (unsigned char)status; int86(0x10,®s,®s); }
1.4.7
Enable/Disable Power-on Logo Display Entry Parameter: AH = 6 AL = 0/1 ; disable/enable Return Value: None Example void TL_cursor_type(int status) { regs.h.ah = 5; regs.h.al = (unsigned char)status; int86(0x10,®s,®s); }
Page 13
PT630 Programming Reference Guide Page 13 of 59 -----------------------------------------------------------------------------------------------------------------1.4.8
Display Character Entry Parameter:
AH = 0AH AL = 0 - 255 ; character to display Return Value: None
Example regs.h.ah = 0x0A; regs.h.al = cc; int86(0x10,®s,®s); 1.4.9
Display 16*16 Bitmap at Current Cursor Position Entry Parameter: AH = 4FH DS:BX ; pointer to bitmap (32-bytes pattern data) Return Value: None Note: This function is available only in large font. Example : void TL_display_16x16(unsigned char *str) { regs.h.ah=0x4F; segregs.ds = FP_SEG(str); regs.x.bx = FP_OFF(str); int86x(0x10,®s,®s,&segregs); }
1.4.10 Read Pixel from screen Entry Parameter: INT 0x10 AH= 0x40 Return DH=row ; 0-63 DL=column ; 0-127 AL= 0 ; No Pixel 1 ; With Pixel Example: int TL_get_pixel(int x, int y) { regs.h.ah= 0x40; regs.h.dl= (unsigned char)x; regs.h.dh= (unsigned char)y; int86(0x10,®s,®s); return(regs.h.al); }