Metropoli BBS
VIEWER: func.txt MODE: TEXT (ASCII)
Functions i've made:
--------------------
  All functions are built automatically into EXE unless
other wise stated.


-----------
getint,vec:byte
  - get PMODE int vector
setint,vec:byte,sel:word,off:dword
  - set it
malloc,siz:dword
  - alloc RAM (just like in C)  (NULL if none avail)
cmalloc,siz1:dword,siz2:dword  ;total size= siz1*siz2
  - alloc RAM (just like in C)  (NULL if none avail)
  - also clears alloc RAM to 0
qfree
  - query largest free RAM avail.  (eax=largest free)
coreleft
  - query total free RAM avail.    (eax=free ram)
free,blk:dword
  - free a block alloc from malloc or calloc
getenv,nam:dword
  - get an enviroment string ptr  (NULL if not found)
exit,errorcode:byte
  - exits to DOS (func will do cleanup)
  - DO NOT CALL int 21h/ah=4c00 directly

DATA avail from QLIB
--------------------
  selcode dw - code selector
  seldata dw - data selector
  selzero dw - zero selector
  _environ dd - ptr to enviroment table
  _psp dd - ptr to PSP
  _pmmode db - current PM mode = (SRV_RAW, SRV_XMS, SRV_VCPI or SRV_DPMI)
  _dta dd - ptr to DTA area (default = _psp+80h)
  plus other unimportant stuff...

string
------

str2num,str:dword
  - convert a string to a number  (always returned in eax)
  - string may start with + or - and leading spaces etc.

num2str,n:dword,str:dword,radix:byte
 - convert # to string (unsigned)
num2strc,n:dword,str:dword,radix:byte
 - convert # to string (unsigned and capitals)
num2strs,n:dword,str:dword,radix:byte
 - convert # to string (signed)
num2strsc,n:dword,str:dword,radix:byte
 - convert # to string (signed and capitals)

print,str:dword
  - simply print string
printxy,x:word,y:word,str:dword
  - print at screen pos x,y
gotoxy,x:word,y:word
  - change cursor pos x,y
wherex
  - get current X cursor pos
wherey
  - get current Y cursor pos

clrscr
  - clears screen

setcursor,scan:word
  - sets cursor start/stop scan lines  (a value of 512 removes cursor)

strcpy , strcat, strlen ,strcmp
strccpy, stricmp, strcspn, etc.  (all string functions as in C)
printf, sprintf, sscanf, scanf - all as in C

file I/O
--------
open,file:dword,access:byte    ;0=read 1=read/write  (directly given to DOS)
  - open a file
close,h:word
read,h:word,buf:dword,len:dword
write,h:word,buf:dword,len:dword
lseek,h:word,pos:dword,typ:byte   ;0=from start  1=relative  2=from end

keyboard services
-----------------
getch
  - reads one key.  AH=scan code  AL=char
  NOTE: if al<32 or al>128 then it's a special code (see key.txt)
getchw
  - same but does not wait for a key (returns 0 if there is no key)
kbhit
  - detects if key is avail

text.asm   (not linked in automatically - you must include it)
--------
NOTE: to add this just include it.  It's in the INC directory.
backfill,x:word,xl:word,y:word,yl:word
  - fills background with char
box,x:word,xl:word,y:word,yl:word
  - fills a solid BOX
box1,x:word,xl:word,y:word,yl:word
  - draws a single-line box
box2,x:word,xl:word,y:word,yl:word
  - draws a double-line box
bar,x:word,y:word,xl:word,col:byte
  - draws a bar underneath text


Please also see
 video.txt
 pack.txt
 dma.txt
 callback.txt

[ RETURN TO DIRECTORY ]