Asmlib is a library of Linux functions for X86
processors. All code was written in assembler.
In general, functions do not preserve registers
or check for errors. The CLD flag is assumed
to be set. Also, some functions assume other
functions are called first. For example, the
functions mouse_enable, read_window_size are
setup functions usually called at beginning of
programs.

Copyrighted by the GNU public liscense.
----------------------------------------------

TABLE OF CONTENTS
-----------------

-- blk --
1 bit_set - set bit in array
2 bit_set_list - set bits in array
3 bit_test - test array of bits
4 blk_bmove - move large block bytes
5 blk_clear - clear array of bytes
6 blk_del_bytes - delete area from block of data
7 blk_dmove - move large block of dwords
8 blk_fdel_bytes - delete area from block of data
9 blk_find - search block of text for string
10 blk_finsert_bytes - insert data into block
11 blk_fmake_hole - make hole and fill with zeros
12 blk_freplace - replace first match in buffer
13 blk_freplace_all - replace all matches in buffer
14 blk_insert_bytes - insert data into block
15 blk_make_hole - make hole in data block for insert
16 blk_move - move block of data
17 blk_replace - replace first match in buffer
18 blk_replace_all - replace all matches in buffer
19 blk_replace_table - replace strings using table
20 margins - sets margins for paragraph function
21 paragraph - formats one paragraph

-- char --
22 is_alpha - check if alpha 20h -> 7eh
23 is_number - check if ascii number

-- compress --
24 decrypt - move ascii data and decrypt
25 encrypt - simple string encryption
26 lz_compress - Lempel-Ziv data compressor
27 lz_decompress - Lempel-Ziv data uncompressor
28 pak - move ascii data and compress
29 upak - move ascii data and uncompress

-- crt --
30 color_cursor - place a colored cursor on the screen
31 crt_char_at - display one colored char at location.
32 crt_clear - clear the screen
33 crt_close
34 crt_color_at - move cursor and display colored line
35 crt_horizontal - repeat display character
36 crt_line - display line with embedded color codes
37 crt_open - get crt parameters and setup termios
38 crt_set_color - set color mode for display
39 crt_str - display asciiz string at curent cursor position
40 crt_table - display screen of data using table
41 crt_table_loc - use table ptr to find crt row/col
42 crt_vbar - display vertical bar lenght of window
43 crt_vertical - repeat char vertically
44 crt_win_from_ptrs - display window using ptrs to lines
45 crt_window - display one window/page of data
46 crt_window2 - display window with embedded color
47 crt_write - display block of data
48 cursor_hide - hide the cursor
49 cursor_to_table - find table location from cursor row/col
50 cursor_unhide - unhide the cursor
51 mov_color - copy vt100 string to buffer
52 move_cursor - move cursor
53 reset_soft - terminal soft reset
54 reset_terminal - output vt-100 setup strings
55 restore_cursor - restore cursor position
56 save_cursor - save current cursor position

-- database --
57 database_close - close currently active database
58 database_copy_record - copy record to buffer
59 database_extract - extract record (cut) and save copy
60 database_insert - insert record into open database
61 database_open - open or create a database file
62 database_record_size - compute size of record in database
63 database_search - scan the database for string

-- date --
64 ascii2days - convert ascii year,month,day to days since 1970
65 ascii2regs - convert ascii year,month,day to bin year,month,day
66 bins2ascii - format date
67 day_name - lookup name for day
68 days2ascii - convert days to week,day,month, etc.
69 days2dateregs - convert days to week,day,month, etc.
70 days_in_month - returns number of days in month
71 get_raw_time - get raw time from kernel
72 leap_check - check for leap year
73 leap_count - count leap years from 1970 till target
74 month_name - lookup name for month
75 raw2ascii - apply zone adjustment to raw system time
76 raw2seconds - apply zone adjustment to raw system time
77 regs2ascii - format date
78 regs2days - convert day,month,year to days since 1970
79 seconds2bins - convert seconds to year,month,day,hr, etc.
80 seconds2dateregs - convert seconds to week,day,month, etc.
81 seconds2timeregs - seconds to hour,min,sec registers

-- dir --
82 dir_access - check if file can be accessed
83 dir_change - change current working directory
84 dir_close - close a open directory and release memory
85 dir_close_file - close a open directory, retain memory
86 dir_close_memory - release memory allocated by dir_open
87 dir_create - create a new directory
88 dir_current - get current working directory
89 dir_delete - delete an empty directory
90 dir_index - index an open directory
91 dir_open - allocate memory and read directory
92 dir_open_indexed - open a directory and index
93 dir_open_sorted - open a directory, index, and sort
94 dir_read - open, read, close a directory structure
95 dir_read_grow - allocate memory and read directory
96 dir_sort - sort a opened and indexed directory
97 dir_sort_by_name - sort a opened and indexed directory
98 dir_sort_by_type - sort a opened and indexed directory
99 dir_status - check if directory exists
100 dir_type - Add type information to indexed directory
101 dir_walk - traverse directory and return selected paths

-- draw --
102 draw_box - use line drawing characters to draw a box
103 draw_off - disable line drawing characters
104 draw_on - enable line drawing characters
105 draw_table - draw using table of actions

-- env --
106 env_exec - search executable path for program
107 env_home - search the enviornment for $HOME
108 env_home2 - search /proc for $HOME
109 env_shell - search enviornment for SHELL=
110 env_stack - find stack ptrs to enviornment
111 find_env_variable - search enviornment for variable name
112 lib_data - common data used by crt functions

-- file --
113 build_current_path - build path using current dir
114 build_file_open - build path and open file
115 build_homepath - build path using $HOME
116 build_write_open - build path and open write file
117 file_access - check if file can be accessed
118 file_close - close opened file
119 file_copy - copy one file
120 file_delete - delete file
121 file_exec_path - build full path to executable
122 file_length_handle - get length of file using descriptor
123 file_length_name - get length of named file
124 file_list_copy - copy files on list
125 file_open - open named file
126 file_open_rd - open named file
127 file_read - read n bytes from open file
128 file_read_all - open,read entire file,close
129 file_read_grow - open and read entire file, expand buffer if necessary
130 file_rename - rename a file
131 file_simple_read - open & read file to buffer, then close
132 file_status_handle - check filename exists and get status
133 file_status_name - check filename exists and get status
134 file_write - write n bytes to open file
135 file_write_close - open,write, and close file
136 filename_extract - extract filename from full path
137 filepath_extract - extract path from path + name
138 get_current_path - get default (current) dir
139 mmap_close - close memory mapped file and release memory
140 mmap_open_ro - returns a read only pointer to file data
141 mmap_open_rw - map file into memory for read/write

-- file2 --
142 block_close - close file
143 block_open_append - open file for appended writes
144 block_open_home_append - open file at $HOME for appended writes
145 block_open_home_read - open existing file as read-only
146 block_open_home_update - open file at $HOME for reading/writing records
147 block_open_home_write - open truncated file in $HOME dir for read/write
148 block_open_read - open existing file as read-only
149 block_open_update - open file for reading/writing records
150 block_open_write - open truncated file for read/write
151 block_read - read file
152 block_read_all - read file and close it
153 block_read_home_all - read file and close it
154 block_seek - seek to location in file
155 block_write - write file
156 block_write_all - write file and close it
157 block_write_home_all - write file to $HOME and close it

-- hash --
158 hash_add - add entries to hash table
159 hash_lookup - search data entries for match
160 hash_lookup_next - search for another match
161 hash_remove - remove one entry from data set
162 hash_setup - prepare hash table for use
163 hashfile_archive - write current hash data to open file
164 hashfile_restore - read open hash file into buffer
165 record_add - add entries to record table
166 record_archive - write current hash data to open file
167 record_lookup - search records for key
168 record_restore - read open hash file into buffer
169 record_setup - prepare record table for use
170 string_add - add entries to string table
171 string_archive - write current hash data to open file
172 string_lookup - search strings for key
173 string_restore - read open hash file into buffer
174 string_setup - prepare string table for use

-- list --
175 list_check_end - check list end, do not remove
176 list_check_front - check list top, do not remove entry
177 list_get_from_end - return last list entry
178 list_get_from_front - return entry from top of list
179 list_put_at_end - add entry to end of list
180 list_put_at_front - add entry to front of list
181 pop_dword - remove dwort from top of list
182 pop_string - return string at top of list
183 put_dword - add dword to top of list
184 put_pop_dword_setup - setup dword list
185 put_pop_string_setup - setup string list
186 put_string - add string to top of list

-- log-error --
187 buffer_hex - build hex line plus ascii in buffer
188 buffer_hex_line - dump hex line to buffer
189 err_msg - display error messages
190 err_number - display error number
191 hex_dump_file - dump hex to file
192 hex_dump_stdout - dump hex to stdout
193 install_signals - install signals
194 log_eol - write eol (end of line) to "log"
195 log_fd - log status of file descriptor
196 log_hex - write hex to file called "log"
197 log_num - write number to file called "log"
198 log_process_info - log process pid,ppid,gid,pgid
199 log_regtxt - write string in -eax- to file called "log"
200 log_signals - install signal logging
201 log_str - write string to file called "log"
202 log_terminal_0 - log termios and win size for stdin
203 log_terminal_x - log termios and win size for stdin
204 show_hex - display assorted hex numbers using control table
205 write_char_to_file - write byte to open fd
206 write_char_to_stdout - display ascii char
207 write_hex_byte_stdout - display hex char
208 write_hex_byte_to_file - write hex for byte to file
209 write_hex_line_stdout - dump hex line to stdout
210 write_hex_line_to_file - dump hex line to file

-- math --
211 dword_divide - divide 32 bit values
212 quad_add - add 64 bit values
213 quad_compare - unsigned 64 bit compare
214 quad_divide - divide 64 bit values
215 quad_multiply - multiply 64 bit values
216 quad_negate - negate 64 bit values
217 quad_subtract - subtract 64 bit values

-- memory --
218 chain_double - chain (add) to doubly linked list
219 chain_single - chain (add) link to singly linked list
220 m_allocate - provide memory to caller
221 m_close - release memory and disable memory manager
222 m_release - release previously allocated memory
223 m_setup - setup for memory manager use
224 memory_init - get top of allocated memory
225 set_memory - adjust memory end point
226 shared_attach - attach to a shared memory segment
227 shared_close - close a shared memory segment
228 shared_open - open a shared memory segment
229 unchain_double - unchain (remove) link from doubly link list
230 unchain_single - unchain (remove) link from singly linked list

-- menu --
231 crt_mouse_line - display line in mouse_decode format
232 key_decode1 - decode non-aplha key strings and get process
233 key_decode2 - decode aplha key strings and get process
234 key_decode3 - decode non-aplha key strings and get process
235 menu_decode - decode menu key/mouse event
236 menu_display - display menu specified by structure
237 mouse_line_decode - find mouse process from display line text

-- process --
238 change_tty_group - assign tty to new group
239 check_process - get process status from /proc
240 create_group - make our process a new group leader
241 get_group - get group id for process (x)
242 get_our_group - get group id for our process
243 get_our_process_id - get our process id
244 get_parent_process_id - get our process id
245 get_proc_info - extract info from kernel /proc/./stat
246 get_tty_group - get group controling the tty
247 join_group - join a process to (existing) group
248 kill_process - send kill signal to process
249 process_info_pid - get information for process (x)
250 process_info_pidn - get information for process (x)
251 process_info_us - get our process information
252 process_search - search names of active process's
253 process_walk - walk through active process's
254 process_walk_cleanup - close all walk files

-- random --
255 random_dword - generate random dword
256 random_seed - get low clock bits to use as random number
257 scale_dword - adjust random number to fit in range

-- signal --
258 signal_handler_default - set default handler for signal
259 signal_handler_none - set no handler for signal
260 signal_handler_status - check if our signal handler installed
261 signal_install - install signal
262 signal_install_list - install signals
263 signal_mask_block - block signal handler (OR) into mask
264 signal_mask_get - get current signal mask
265 signal_mask_set - set signal mask (store) bits
266 signal_mask_unblock - unblock signal handler (AND) with mask
267 signal_send - send signal
268 signal_wait - wait for signals
269 signal_wait_blind - wait for any signal that is handled.
270 signal_wait_child - wait for child termination signal
271 signal_wait_setup - optional setup for signal_wait function
272 signals_ending - get mask for pending signals

-- sort --
273 sort_bubble - bubble sort a list of ptr to text blocks
274 sort_dword_array - use bubble sort on array of dwords
275 sort_dword_array2 - use selection sort on array of dwords
276 sort_dword_array3 - use selection sort with ptr list
277 sort_merge - merge sort buffer using index
278 sort_merge_lines - merge sort buffer using index
279 sort_selection - use selection sort with ptr list

-- sound --
280 close_sound_device - close /dev/dsp
281 compute_samples_per_wave - compute samples per wave
282 compute_wave_count - compute number of waves
283 flush_sound_device - write remaining bytes
284 make_sound - play square wave
285 metronome - repeat tone until done or key press
286 open_sound_device - open /dev/dsp
287 set_sound_device - mono mode, byte data, samp rate 22050
288 write_sound_device - write to /dev/dsp

-- str --
289 str_end - scan to end of string
290 str_index - index into list of asciiz string
291 str_insert - inserts string into string
292 str_join - join two strings
293 str_len - find length of asciiz string
294 str_move - move asciiz string
295 strlen1 - get lenght of esi string
296 strlen2 - get lenght of edi string

-- str_cmp --
297 compare_mask - compare string to masked template
298 scan_buf - fast scan of sequential buffers for string
299 scan_buf_open - setup for scan buffer for string
300 str_compare - compare two strings, use case
301 str_match - compare asciiz string to buffer data, use case
302 str_replace - replace first occurance of str1 in str2
303 str_replace_all - replace all occurances of str1 in str2
304 str_search - search string for match

-- str_conv --
305 ascii_to_dword - convert decimal ascii string to binary
306 byte2ascii - convert binary 1-255 to 3 ascii chars
307 byte2hexascii - convert one byte to hex ascii and store
308 byte2hexstr - convert one byte to hex ascii and store
309 byte2octalascii - convert one byte to octal ascii and store
310 byte_to_ascii - convert binary byte to left justified ascii string
311 byte_to_hexascii - binary byte to hex ascii
312 byteto_hexascii - convert one byte to hex ascii and store
313 dword2hexascii - convert dword to hex ascii and store
314 dword2hexstr - convert one dword to hex ascii and store
315 dword2octalascii - convert one dword to octal ascii and store
316 dword_to_ascii - convert binary dword to left justified ascii string
317 dword_to_hexascii - binary byte to hex ascii
318 dword_to_l_ascii - convert binary dword to left justified ascii string
319 dword_to_lpadded_ascii - binary dword to left justified ascii string
320 dword_to_r_ascii - convert bin dword to right just ascii str
321 dwordto_hexascii - convert one dword to hex ascii and store
322 fdword_to_ascii - convert dword float to ascii string
323 fqword_to_ascii - convert qword float to ascii string
324 fst0_to_ascii - convert fst0 to ascii string
325 ftword_to_ascii - convert tword float to ascii string
326 hexascii2byte - convert two hex ascii char to byte
327 hexascii2dword - convert eight hex ascii char to dword
328 hexascii2nibble - convert one hex ascii char to nibble
329 hexascii2word - convert four hex ascii char to word
330 hexascii_to_byte - convert up to 2 hexascii to bin
331 hexascii_to_dword - convert up to 8 hexascii to bin
332 hexascii_to_nibble - convert hexascii char to bin
333 nibble2ascii - convert binary 1-99 to 2 ascii chars
334 nibble2hexascii - convert one nibble to hex ascii and store
335 nibble2hexstr - convert 4-bits to hex ascii and store
336 nibble2octalascii - convert 3-bits to octal ascii and store
337 nibbleto_hexascii - convert 4-bits to hex ascii and store
338 octalascii2dword - convert asciiz octal string to dword
339 word2hexascii - convert one word to hex ascii and store
340 word2hexstr - convert one word to hex ascii and store
341 word2octalascii - convert one word to octal ascii and store
342 word_to_ascii - convert binary word to left justified ascii string
343 wordto_hexascii - convert one word to hex ascii and store

-- str_parse --
344 lookup_token - check if token on list
345 parse_token - scan buffer for next token
346 read_setup - read config file and move data
347 write_setup - write config file

-- sys --
348 delay - delay microseconds or seconds
349 is_executable_on_path - check if executable available
350 launch_app - wrap app and setup for feed with launch_feed
351 launch_feed - feed data to process started by launch_app
352 launch_kill - kill a process started by launch_app
353 poll_fd - check if data avail.
354 sys_fork_run - fork and execute program
355 sys_pipe_capture - launch program and capture its stdout
356 sys_pipe_feed - launch program and pipe to it's STDIN
357 sys_run_die - launches executable then dies
358 sys_run_wait - execute program and wait for completiion
359 sys_shell - launches local shell
360 sys_shell_alt - launches local shell in alternate window
361 sys_shell_cmd - launches local shell
362 sys_shell_plus - execute shell and restore terminal state
363 sys_win_alt - switches to Vt100 alt windows
364 sys_win_normal - selects normal Vt100 windows
365 sys_wrap - wrap around an executable and capture in/out
366 sys_wrap_plus - wrap around an executable and capture in/out
367 sys_wrap_shell - launches command in wrapped shell
368 wait_event - poll fd input/output status
369 wait_pid - wait for a process to change state

-- terminal --
370 alt_screen - switch to alt terminal screen
371 get_string - get string in scrolled window line
372 get_text - get string in scrolled window line
373 is_raw_term - check if stdin is in raw mode
374 key_flush - remove keys from stdin
375 key_mouse1 - flush and read one key string or mouse click
376 key_poll - check if key avail.
377 key_string1 - get string (preloaded string in buffer)
378 key_string2 - get string (no preloaded string displayed)
379 mouse_check - reformat keyboard data if mouse click info
380 mouse_enable - enable mouse on x terminals
381 normal_screen - switch to normal terminal screen
382 output_term_info_0 - output stdin window size and settings
383 output_term_info_x - output terminal structure "termios"
384 output_termios_0 - output stdin terminal structure "termios"
385 output_termios_x - output terminal structure "termios"
386 output_winsize_0 - output stdin window size
387 output_winsize_x - output terminal structure "termios"
388 raw_set1 - switch stdin to raw mode
389 raw_set2 - switch stdin to raw mode
390 raw_unset1 - restore termios saved with raw_set1
391 raw_unset2 - restore termios saved with raw_set2
392 read_one_byte - read one byte from stdin
393 read_stdin - read one key string or mouse click
394 read_term_info_0 - save stdin window size and settings
395 read_term_info__x - save terminal structure "termios"
396 read_termios_0 - save stdin terminal structure "termios"
397 read_termios_x - save terminal structure "termios"
398 read_window_size - set global window size info
399 read_winsize_0 - save stdin window size
400 read_winsize_x - read (fd) window size
401 restore_alt_cursor - restore cursor for alt window
402 restore_cursor_from - restore cursor position
403 restore_norm_cursor - restore cursor for normal window
404 save_alt_cursor - save cursor and assume alt window active
405 save_cursor_at - save cursor position
406 save_norm_cursor - save cursor and assume normal window active
407 scroll_region - set scroll limits for terminal
408 set_screen_size - set scroll limits for terminal
409 stdout_str - display asciiz string at cursor position
410 terminal_report - get report using screen codes
411 terminal_type - check if console or xterm
412 terminfo_decode_setup - setup to decode keyboard keys

-- terminfo --
413 terminfo_extract_flag - get boolean from terminfo
414 terminfo_extract_key - get value from terminfo
415 terminfo_extract_number - get value from terminfo
416 terminfo_key_decode1 - decode non-aplha key strings and get process
417 terminfo_key_decode2 - decode key strings and get process
418 terminfo_read - search for terminfo and read into memory

-- timer --
419 timer_create - create posix timer
420 timer_delete - delete posix timer
421 timer_getoverrun - get timer overrun count
422 timer_gettime - get timer state
423 timer_settime - arm a dynamic timer

-- trace --
424 dis_one - disassemble one instruction
425 trace_attach - attach to a running process
426 trace_continue - restart a stopped process or send signal
427 trace_detach - detach from a process
428 trace_fregsget - get registers of traced process
429 trace_fregsset - set registers of traced process
430 trace_fxregsget - get registers of traced process
431 trace_fxregsset - set registers of traced process
432 trace_kill - kill a process being traced
433 trace_peek - get data from traced process memory
434 trace_peek_bytes - get string from traced process memory
435 trace_poke - store data into traced process menory
436 trace_poke_bytes - store string into traced process
437 trace_regsget - get registers of traced process
438 trace_regsset - set registers of traced process
439 trace_step - continue execution for one instruction
440 trace_syscall - continue execution till system call
441 trace_upeek - get data from kernel(user) memory
442 trace_upeek_bytes - get string from kernel memory
443 trace_upoke - store data into kernel menory
444 trace_upoke_bytes - store string into kernel memory
445 trace_wait - wait for any child to stop
446 traceme - enable trace for this process

-- widget --
447 browse_dir - display and traverse directories
448 browse_dir_left - browse directories in left half of display
449 browse_dir_right - browse directories in right half of display
450 dir_browse - display and traverse directories
451 dir_browse_left - browse directories in left half of display
452 dir_browse_right - browse directories in right half of display
453 edit_file_in_box - edit small file inside box
454 edit_text_in_box - edit supplied string in a box
455 form - display and accept user inputs to fill form
456 form2_input - get string data for form
457 form2_show - show form for input of data
458 make_box - display box outline
459 message_box - display message and wait for key press
460 popup_menu - popup menu box and wait for key/click
461 select_1up_list_centered - display select window in center, fit to data size
462 select_1up_list_full - display selection list as full screen window
463 select_1up_list_left - display selection list on left half of screen
464 select_1up_list_right - display selection list on right half of screen
465 select_buffer_line - view a buffer and select line
466 select_file_line - view a buffer and select line
467 select_list_engine - display a list and wait for selection
468 select_list_setup - setup the select list database
469 show_box - display boxed message with optional boarder
470 string_form - get string data for form
471 view_buffer - display,search,scroll text
472 view_file - display,search,scroll text file

-- xterm --
473 screen_size - report screen size in pixels
474 win_deiconify - return window to prevous size
475 win_font - set window font 3,4,5,6 sizes
476 win_iconify - convert window to icon
477 win_lines - resize window to x lines
478 win_lower - lower window to bottom of stack (behind other windows)
479 win_maximize - fill screen with window
480 win_move - move window to pixel location
481 win_posn - report window position in pixels
482 win_raise - raise window to top of stack (make visible)
483 win_refresh - redisplay screen
484 win_resize - resize window to x,y pixels
485 win_restore - return window to prevous size
486 win_size - report window size excluding title
487 win_title - set window title
488 win_txt_resize - resize text area to rows/columns
489 win_txt_size - report window size excluding titlebar