Quantasm Power Lib (QPL) is an assembly language library of over 600 routines. QPL includes two menu and windowing systems and a forms package for creating dialog boxes as well as hundreds of low-level routines that are independent of the user interface. The library contains string handling functions, extended precision integer math, date/time functions, file name and command line parsing, sound control and more. Because of its compactness, QPL is ideal for use in programming memory resident programs, or TSR's. Every routine is hand-crafted in assembly language for compactness and speed. The user-interface routines support a mouse, any text mode screen size and DOS extenders.
Unlike other libraries, that make you conform to their programming style, QPL is easy to program with. You write your code as you normally would, adding calls to the QPL library as needed. For example, one call to WIN_INIT initializes the menu and windowing system. Then you can call routines to popup a window, display and scroll text or popup a menu as desired. And the menu and window system only use 4K of code. (Compact versions of many menu and window routines are also available that use only 2K of code).
The system is very granular. That means that routines are linked into your code only if you use them. For example, to add mouse support to the menu system you call MOUSE_INIT before or after calling WIN_INIT. The automatic setup code installs a mouse handler for the menus. Since the system is so modular, you could write your own mouse handler and have it installed instead.
The QPL routines can easily be interfaced to C, BASIC, Pascal or FORTRAN.
The following is a list of the functional groups in the library and the number of procedures in each group:
Group Description # Procedures
BIT Bit Manipulation 9
CHAR Char 17
CLI Command Line Parsing 10
COMM Communications Port 4
CUR Cursor 10
DOS DOS 59
DRAW Line Drawing 24
DT Date and Time 35
FN File name parsing 5
FORM Forms 46
KEY Keyboard 22
MENU Menu 25
MEM Memory Block 50
MOUSE Mouse 35
NUM Numeric 33
PRNT Printer Port 3
SCR Screen 57
SOUND Sound 3
STR String 78
SYS System 29
WIN Window 58
.model small
include qplstruc.inc ; includes QPL structure definitions
.stack 200 ; reserve stack space
.code
EXTRN win_init : proc
EXTRN win_popup : proc
EXTRN win_remove : proc
EXTRN key_read_char : proc
main proc
mov ax, @data ; init DS segment
mov ds, ax
lea si, init_data ; load near ptr to init data
mov al, 0 ; select auto setup
call win_init ; initialize window system
lea si, popup1 ; load near ptr to win_struc
call win_popup ; popup the window
call key_read_char ; wait for a key
call win_remove ; restore the screen
mov ax, 4c00h ; DOS terminate
int 21h
main endp
.data
init_data db size win_init_struc dup(0)
popup1 label byte ; (window_struc)
db 10, 8, 12, 40 ; col, row, height, width
db 0, 8 ; box type, drop shadow bit
dw mono_attr, color_attr ; mono, color attribute ptrs
db 1, 0, 0, 0 ; indents
dw window_data ; ptr to list of ASCIIZ strings
db 32 dup(0) ; defaults
mono_attr db 7
color_attr db 70h
window_data db 'Hello',0
db 'World',0, 0
end main
WIN_INPUT
-------------------------------------------------
Get user input in a window
inputs: DS:SI pointer to window input structure
outputs: entered data
AX len
CF set if ESCAPE
-------------------------------------------------
This routine (optionally) pops up a window and requests user keyboard input in a specified area of the window. When the input is finished, the window (optionally) is removed. A window structure may be used for its column and row coordinate position only. The user may edit the data using the following keys: home, end, right arrow, left arrow, delete, backspace and insert.
The initial data may be blank or a string may be used that is in the buffer pointed to by the inp_data_ptr field in the inp_struc structure. The inp_len field indicates the maximum length of the string to use and returns with the final length of the edited string.
MENU_PICK_LIST
-------------------------------------------------
Display, setup, operate and remove text for a vertical pick list menu
inputs: DS:SI pointer to window structure
(with nested menu structure, scroll structure)
AL initial light bar position
outputs: CF set if escape
AX menu item number (starts at zero)
-------------------------------------------------
This routine is the same as MENU_VERTICAL, except that the menu is in scrolling window or a pick list. The win_scroll_ptr field in the window structure must point to a scroll structure. This will automatically be placed after the menu structure if win_scroll_ptr is a null pointer.
The menu item number that is returned is relative to the beginning of the list of items in the menu. The first item in the list is item 0.
Bit_clear Bit_clear_fwd Bit_clear_rev Bit_count_fwd Bit_count_rev Bit_scan_fwd Bit_scan_rev Bit_set Bit_test Char_icompare Char_in_range Char_is_alpha Char_is_digit Char_is_lower Char_is_upper Char_is_white Char_to_lower Char_to_upper Cli_auto_parse Cli_get_parameter Cli_get_switch Cli_parse Cli_setup Cli_switch_setup Com_get_status Com_init_port Com_read_char Com_write_char Cur_get_pos_type Cur_restore Cur_restore_all Cur_save Cur_set_off Cur_set_pos Cur_set_rel_pos Draw_alpha Draw_box Draw_cont Draw_hline Draw_set_line_type Draw_stream Draw_vline Dt_ascii_to_date Dt_ascii_to_time Dt_check_date Dt_check_for_holiday Dt_check_leap Dt_check_time Dt_date_add Dt_date_diff Dt_date_sub Dt_date_time_diff Dt_date_to_ascii Dt_day_of_the_week Dt_get_century Dt_get_current_date Dt_get_current_time Dt_holiday_string Dt_set_century Dt_set_date Dt_set_date_format Dt_set_time Dt_time_add Dt_time_diff Dt_time_sub Dt_time_to_ascii Fn_check_syntax Fn_parse Fn_parse_merge Fn_search_list Fn_unparse Form_button Form_check_box Form_date Form_edit Form_file_name Form_number Form_number_edit Form_buttons Form_pick_list Form_string Form_string_edit Key_get_hotkey Key_get_status Key_line_edit Key_push_char Key_read_char Key_set_repeat_rate Mem_bit_scan_fwd Mem_bit_scan_rev Mem_bit_shift_left Mem_bit_shift_right Mem_compare Mem_compress Mem_copy Mem_copy_to Mem_copy_up_to Mem_decrypt Mem_encrypt Mem_fill Mem_huffman_decode Mem_huffman_encode Mem_icompare Mem_ilocate Mem_locate Mem_replace_byte Mem_replace_word Mem_reverse Mem_scan Mem_scan_by_white Mem_scan_to_white Mem_shift Mem_shift_left Mem_shift_right Mem_to_lower Mem_to_upper Mem_uncompress Mem_xlat Menu_horizontal Menu_light_bar Menu_operate Menu_pick_list Menu_pulldown Menu_quick_key Menu_vertical Mouse_disable Mouse_enable Mouse_exists Mouse_hide Mouse_init Mouse_read_pos_status Mouse_reset Mouse_restore Mouse_save Mouse_set_mickeys Mouse_set_shape Mouse_set_xy Mouse_show_ptr Num_ascii_to_byte Num_ascii_to_int Num_ascii_to_long Num_byte_to_ascii Num_byte_to_buffer Num_hex Num_int_to_ascii Num_long_add Num_long_cmp Num_long_div Num_long_mult Num_long_sub Num_long_to_ascii Num_ulong_to_ascii Num_word_to_ascii Prn_get_status Prn_init_port Prn_write_char Scr_blank_screen Scr_change_attributes Scr_change_background Scr_change_foreground Scr_cmp_screen_string Scr_disable_print_screen Scr_display_screen Scr_display_screen_text Scr_display_string Scr_fill_screen Scr_find_string Scr_get_bios_row_col Scr_get_border_color Scr_get_max_col Scr_get_max_row Scr_get_max_size Scr_get_palette Scr_get_video_mode Scr_get_video_type Scr_init Scr_read_char Scr_rev_attributes Scr_scroll Scr_set_border_color Scr_set_color Scr_set_max_col Scr_set_max_row Scr_set_palette Scr_set_screen_lines Scr_set_video_mode Scr_set_video_seg Scr_vchange_attributes Scr_vchange_background Scr_vchange_foreground Scr_vfill_screen Scr_vrev_attributes Sound_beep Sound_note Sound_play_notes Str_add Str_build_from_bits Str_build_index Str_center Str_compare Str_copy Str_copy_n Str_copy_strings Str_copy_to Str_copy_up_to Str_copy_word Str_count_char Str_count_strings Str_crlf_to_null Str_get_env_var Str_icompare Str_ilocate Str_insert Str_item Str_len Str_locate Str_ltrim Str_ltrim_char Str_pad_left Str_pad_right Str_point_n Str_point_n_asciizz Str_repeat_char Str_replace_char Str_replace_substring Str_rev_scan_by_white Str_rev_scan_to Str_rev_scan_to_white Str_reverse Str_rtrim Str_scan_by_white Str_scan_to Str_scan_to_white Str_shift Str_shift_left Str_shift_right Str_sub_char Str_to_lower Str_to_upper Str_trim Sys_check_append Sys_check_assign Sys_check_net Sys_check_share Sys_check_win Sys_model Sys_wait Win_arrow Win_border_text Win_buffer_keys Win_buffer_scroll Win_clear_line Win_cursor_position Win_display_char Win_display_line Win_display_line_attr Win_display_window Win_do_move Win_do_scroll Win_error_window Win_file_scroll Win_fill_attr Win_fill_window Win_finish Win_form Win_grab Win_init Win_input Win_move Win_popup Win_read_char Win_recall Win_refresh Win_remove Win_restore_window Win_save_window Win_scroll Win_x_move Win_y_move and more