home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_100
/
153_01
/
newslet.216
< prev
next >
Wrap
Text File
|
1985-03-10
|
9KB
|
187 lines
PC-SIG #216
Thi≤ flopp∙ contain≤ ß se⌠ oµ utilit∙ routines¼ batcΦ files¼ ì
anΣ program≤ tha⌠ ╔ wrotσ whilσ learninτ abou⌠ thσ IBM-P├ anΣ thσ ì
"Có programminτ lanquage« Sincσ thi≤ wa≤ ß learninτ experiencσ ì
fo≥ mσ ╔ wil∞ no⌠ guaranteσ tha⌠ the∙ arσ efficien⌠ o≥ buτ freσ ì
thougΦ ╔ havσ trieΣ ver∙ harΣ t∩ makσ theφ tha⌠ way« ╔ woulΣ ì
bσ mos⌠ interesteΣ iε an∙ addition≤ o≥ improvement≤ tha⌠ anyonσ ì
migh⌠ makσ t∩ thesσ routines.
Als∩ notσ tha⌠ thesσ routine≤ werσ writteε iε thσ followinτ ì
environment:
IBM-PC 256K Monochrome screen
Epson MX-100 parallel printer
2 Serial ports
2 DS/SD floppy disk drives
Somσ oµ thesσ routine≤ havσ beeε porteΣ t∩ thσ IBM-P├ azteπ ì
"Có unde≥ Concurren⌠ CP/═ anΣ t∩ ß VA╪ 11/78░ unde≥ VM╙ witΦ ì
minima∞ modifications« Obviousl∙ thσ DO╙ function≤ anΣ 808╕ ì
assemble≥ routine≤ didn'⌠ por⌠ wel∞ bu⌠ thσ "Có codσ needeΣ ì
almos⌠ n∩ changes.
LEIG╚ CUTHBERTSON
1868 S. PERRY WAY
DENVER, CO 80219
April 1984
notes about some of the files on this disk -
*.C and *.ASM files
The∙ arσ utilit∙ subroutine≤ writteε iε MICROSOF╘ "C"« ì
Thesσ utilitie≤ includσ ß men⌡ system¼ curso≥ anΣ screeε contro∞ ì
(usinτ DO╙ o≥ direc⌠ t∩ BIOS)¼ juliaε anΣ gregoriaε date/timσ ì
routines¼ anΣ "Có callablσ assemble≥ routine≤ tha⌠ issuσ BIO╙ ì
interrupts« NOT┼ - thσ DO╙ curso≥ anΣ screeε contro∞ utilitie≤ ì
requirσ DEVICE=ANSI.SY╙ commanΣ linσ bσ iε thσ CONFIG.SY╙ file« ì
Thσ BIO╙ curso≥ anΣ screeε control≤ d∩ no⌠ requirσ this.
communications program (IBMTTY.C)
Thi≤ prograφ i≤ ß termina∞ emulation/communication≤ prograφ ì
writteε iε MICROSOF╘ "C"« I⌠ i≤ usablσ bu⌠ no⌠ recommendeΣ fo≥ ì
usσ becousσ oµ use≥ unfriendlynes≤ anΣ ß higΦ erro≥ rate« It≤ ì
maiε reasoε fo≥ inclusioε i≤ a≤ aε examplσ oµ usσ oµ thσ variou≤ ì
utilit∙ subroutine≤ iε thσ \uti∞ subdirectory« I⌠ als∩ provide≤ ì
aε examplσ oµ direc⌠ contro∞ oµ thσ IB═ seria∞ communication≤ ì
board.
è
Batch files (*.BAT)
Thesσ batcΦ file≤ emulatσ somσ oµ thσ mos⌠ commoε UNI╪ ì
command≤ oε thσ IBM-PC« Thσ compile≥ anΣ linke≥ batcΦ file≤ arσ ì
se⌠ u≡ fo≥ thσ MICROSOF╘ "Có compile≥ anΣ linker« T∩ usσ thesσ ì
batcΦ file≤ i⌠ i≤ recommendeΣ t∩ se⌠ u≡ ß PAT╚ commanΣ iε ì
AUTOEXEC.BA╘ t∩ includσ thi≤ subdirector∙ anΣ thσ compile≥ ì
subdirector∙ iε thσ searcΦ path«
ex« (A╛ PAT╚ a:\;a:\unix;a:\compiler).
**¬ biosio.asφ ***
MICROSOF╘ "Có callablσ 808╕ assembl∙ routine≤ tha⌠ interfacσ ì
directl∙ witΦ thσ basiπ I/╧ systeφ (BIOS).
**¬ KEYBOAR─ I/╧ ***
π ╜ keyrd()╗ ReaΣ ß keyboarΣ entr∙ - wai⌠ fo≥ entr∙ iµ onσ no⌠ ready.
iret ╜ keyhit()╗ Seσ iµ therσ i≤ ß characte≥ iε thσ keyboarΣ buffer.
iret = keyshif(); See what the shift key status is.
*** VIDEO I/O ***
biosini(stype); Initialize screen I/O using the BIOS set mode call
biosset(irow,icol); Set the current cursor position.
iret = biospos(); Return the current cursor postion.
biosup(numlines,trow,tlcol,brow,brcol,fchar);
ááááááááááááScroll the screen up within a defined window.
biosdwn(numlines,trow,tlcol,brow,brcol,fchar);
ááááááááááááScroll the screen down within a defined window.
iret=biosrca(); ááááRead the contents of a given screen cell.
bioswca(char,count,att)╗ Writσ ß characte≥ t∩ thσ screeε - witΦ attributes.
bioswc(char,count);áWrite a character to the screen - no attributes.
bioswd(irow,icol);ááWrite a dot in graphics mode.
biostty(c); ááááWritσ ß characte≥ t∩ thσ screeε usinτ thσ BIO╙ asciΘ ì
ááááááááááááááááááááteletypσ call« Thσ teletypσ cal∞ wil∞ senΣ cr/lµ iµ ì
áááááááááááááááááááácolumε 7╣ i≤ writteε t∩ (0-79)« I⌠ wil∞ scrol∞ thσ screeε ì
ááááááááááááááááááááu≡ iµ ro≈ 2┤ (0-24⌐ columε 7╣ i≤ writteε to« I⌠ wil∞ als∩ ì
áááááááááááááááááááábee≡ thσ bel∞ iµ ^τ i≤ receiveΣ anΣ providσ ß destructivσ ì
áááááááááááááááááááábackspace.
iret = bioscur();áááReturn the current video state of the screen.
*** communications port ***
iret = comini(port,params); Initialize the communications port.
iret = comout(port,c); Write a character to the communications port.
c = comin(port);ááááReaΣ ß characte≥ froφ thσ communication≤ port« Wait≤ fo≥ ì
áááááááááááááááááááácharacte≥ iµ onσ i≤ no⌠ ready« Seσ \comm\ibmtty.π fo≥ ì
ááááááááááááááááááááexamplσ oµ pollinτ comφ por⌠ fo≥ characte≥ withou⌠ wait.
iret = comstat(port)╗ Checδ thσ linσ anΣ modeφ status
è
*** io.asm ***
IBM-P├ 808╕ assembl∙ fo≥ interfacσ witΦ microsof⌠ "Có unde≥ ì
PC-DO╙ "Có callablσ subroutine≤ tha⌠ providσ absolutσ pointe≥ ì
addressing« Pointer≤ withiε ß IBM-P├ microsof⌠ "Có prograφ arσ ì
relativσ t∩ thσ star⌠ oµ thσ program≤ datß segment« Thesσ ì
subroutine≤ providσ ß mechanisφ t∩ addres≤ absolutσ memor∙ ì
locations« SupplieΣ b∙ microsof⌠ - commenteΣ b∙ L« Cuthbertson¼ ì
Apri∞ 1984
c = readabs(loc); Read an absolute memory location.
writeabs(loc,c); Write an absolute memory location.
scontrol.Φ Heade≥ filσ useΣ b∙ thσ screeε anΣ keyboarΣ contro∞ librar∙ ì
ááááátha⌠ define≤ thσ variou≤ commands« Thσ extendeΣ screeε anΣ keyboarΣ ì
ááááádevicσ drive≥ mus⌠ bσ configureΣ int∩ DO╙ beforσ thesσ command≤ wil∞ ì
áááááwork« */
curup.c Moves the cursor up y relative lines.
curdown.π Movσs thσ curso≥ dowε ∙ relativσ lines«ì
curfor.c Moves the cursor forward x relative columns.
curback.π Movσs thσ curso≥ backwarΣ ° relativσ columns«
cursor.π Movσs thσ curso≥ t∩ ß specifiπ r,π co-ordinate«
reads.π Read≤ ß strinτ froφ stdin« Return≤ thσ numbe≥ oµ character≤ ì
áááááentereΣ includinτ thσ NUL╠ byte«
readc.π Read≤ ß characte≥ t∩ thσ screeε usinτ ß DO╙ function«
writec.π Write≤ ß characte≥ t∩ thσ screeε usinτ ß DO╙ function«
writes.π Writσs ß strinτ t∩ stdout«
eline.c Erases a line of the screen.
ááááá 0 = Erase from cursor to end of line.
ááááá 1 = Erase from start of screen to cursor.
ááááá 2 = Erase entire line containing cursor.
scrinit.π Initialize≤ thσ screeε anΣ keyboarΣ contro∞ arrays« Currentl∙ ì
ááááái≤ onl∙ ß dumm∙ functioε gettinτ it≤ informatioε froφ ß heade≥ filσ ì
ááááá(scontrol.h).
scratt.π Turn≤ oε anΣ ofµ iε ß togglσ switcΦ manne≥ variou≤ screeε ì
áááááattribute≤ sucΦ a≤ BOLD¼ blink¼ reversσ video¼ etc« ì
frame.π Draw≤ ß bo° giveε thσ uppe≥ lef⌠ corne≥ anΣ thσ lowe≥ righ⌠ ì
ááááácorner« Use≤ thσ extendeΣ characte≥ se⌠ - graphic≤ boarΣ no⌠ needed« ì
áááááUse≤ direc⌠ BIO╙ calls« ì
getline.π Read≤ ß recorΣ froφ ß filσ int∩ ß string« Return≤ thσ lengtΦ ì
áááááoµ thσ strinτ includinτ thσ NULL¼ aε EO╞ iµ EO╞ i≤ reached¼ o≥ ß -▒ iµ aε ì
áááááerro≥ occured.
dosdate.asφ Microsof⌠ "Có callablσ 808╕ assembl∙ routinσ tha⌠ use≤ ß DO╙ ì
áááááfunctioε cal∞ t∩ obtaiε anΣ returε thσ month¼ day¼ anΣ yea≥ a≤ integers.
jtog.π Convert≤ ß juliaε datσ (▒ ╜ 1s⌠ da∙ AD⌐ int∩ ß gregoriaε datσ ì
áááááiε thσ forma⌠ mm/dd/yy«
jtoj.π Return≤ thσ juliaε datσ (▒ ╜ 1s⌠ da∙ AD⌐ associateΣ witΦ thσ ì
ááááájuliaε datσ iε thσ forφ (yddd)«
gtoj.π Return≤ thσ juliaε datσ (▒ ╜ 1s⌠ da∙ AD⌐ associateΣ witΦ ß ì
ááááágregoriaε datσ iε thσ forφ mm/dd/yy«
weekday.π Determine≤ thσ da∙ oµ thσ weeδ ß giveε gregoriaε datσ fall≤ on« ìècvtdate.π Check≤ anΣ convert≤ ß "packedó gregoriaε datσ (1/1/83⌐ int∩ it≤ ì
ááááá"expandedó forφ (01/01/83)« ì
ibmtty.π Termina∞ emulatioε prograφ witΦ filσ uploaΣ anΣ downloaΣ ì
ááááácapabilities« OptimizeΣ t∩ communicatσ witΦ ß DE├ VA╪ 11/780«
mencon.π Open≤ ß men⌡ filσ anΣ displa∙ i⌠ oε thσ screen« Return≤ thσ ì
ááááánumbe≥ oµ entr∙ field≤ founΣ oε thσ men⌡ (nfield⌐ o≥ -▒ iµ aε erro≥ ì
áááááoccured« Place≤ thσ r,π coordinate≤ oµ thσ entr∙ field≤ withiε thσ ì
ááááágloball∙ declareΣ rπ array.
ááááá T∩ builΣ ß menu¼ usσ thσ tex⌠ edito≥ t∩ creatσ ß filσ calleΣ ì
áááááxxxx.mn⌡ Thi≤ filσ contain≤ thσ men⌡ tes⌠ a≤ i⌠ shoulΣ appea≥ oε thσ ì
áááááscreen« Thσ screeε i≤ no⌠ automaticall∙ eraseΣ wheε menu≤ arσ displayeΣ ì
ááááát∩ allo≈ fo≥ overlaying« CommanΣ line≤ contro∞ thσ variou≤ displa∙ ì
áááááparameters« Seσ \comm\comm.mn⌡ fo≥ ß men⌡ tex⌠ examplσ anΣ ì
ááááá\comm\ibmtty.π fo≥ ß men⌡ cal∞ example«
chosit.π Display≤ ß menu¼ promp⌠ fo≥ ß response¼ anΣ validate« Call≤ ì
áááááfunctioε mencoε t∩ displa∙ thσ menu« ì
pause.π Cause≤ ß prograφ t∩ appea≥ t∩ pausσ fo≥ ß giveε perioΣ oµ time« ì
áááááUse≤ thσ systeφ clocδ fo≥ timing« Accuratσ t∩ 1/100'≤ oµ ß second.