home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / ASMBAR.ZIP / AMAG0289.TXT next >
Text File  |  1989-02-21  |  51KB  |  1,281 lines

  1.  
  2.  
  3.  
  4. THE ASSEMBLY LANGUAGE "MAGAZINE"                  VOL1 NUMBER1
  5.                                                   FEBRUARY 20,1989
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.   ##     ####    ####   ####### ##   ## ######  ####    ##  ##
  24.  ####   ##  ##  ##  ##   ##   # ### ###  ##  ##  ##     ##  ##
  25. ##  ##  ###     ###      ## #   #######  ##  ##  ##     ##  ##
  26. ##  ##   ###     ###     ####   #######  #####   ##      ####
  27. ######     ###     ###   ## #   ## # ##  ##  ##  ##   #   ##
  28. ##  ##  ##  ##  ##  ##   ##   # ##   ##  ##  ##  ##  ##   ##
  29. ##  ##   ####    ####   ####### ##   ## ######  #######  ####
  30.   
  31.         ####      ##    ##   ##   ####  ##  ##    ##      ####  #######
  32.          ##      ####   ###  ##  ##  ## ##  ##   ####    ##  ##  ##   #
  33.          ##     ##  ##  #### ## ##      ##  ##  ##  ##  ##       ## #
  34.          ##     ##  ##  ## #### ##      ##  ##  ##  ##  ##       ####
  35.          ##   # ######  ##  ### ##  ### ##  ##  ######  ##  ###  ## #
  36.          ##  ## ##  ##  ##   ##  ##  ## ##  ##  ##  ##   ##  ##  ##   #
  37.         ####### ##  ##  ##   ##   ##### ######  ##  ##    ##### #######
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. Written by and for assembly language programmers.
  57.  
  58.  
  59.  
  60. The Assembly Language "MAGAZINE"                        vol. 1, #1
  61. (send in your title suggestions!)
  62.  
  63.  
  64. For the month of February 1989, we have:
  65.  
  66. Introduction..................................3
  67. Article Suggestions...........................4
  68. What Started It...............................5
  69. Review of the A86 Assembler...................7
  70. FAST Memory Moves.............................8
  71.      Source code..............................8
  72. A Few Good Programs..........................11
  73. Keyboard Trapping-How When and Where.........13
  74.      Source code.............................15
  75. Book Reviews.................................24
  76. Guidelines for Contributors..................26
  77.  
  78.  
  79. NOTE:  *** WE NEED CONTRIBUTORS! ***  Read Article Suggestions and 
  80. Guidelines and start sending those articles in!
  81.  
  82.  
  83.  
  84.                         Special to Electronic Magazines                       
  85.  
  86.  
  87. The source files included here are complete asm files and you only need to 
  88. edit them out with a text editor and then assemble them.
  89.  
  90.  
  91. Produced by Patrick & David O'Riva
  92. Edited, arranged, sent, etc. by same
  93.  
  94. Always available at:  The AsmLang & CFS BBS
  95.                         (408) 259-2223 (woof! 143/37)
  96.                         2726 Hostetter Rd, San Jose, CA 95132
  97.  
  98.                         Assembly Language 'Magazine'
  99.  
  100.         In this, the first issue, the only editorial you are going to get is
  101. this short introduction to the magazine and an even shorter one to myself.
  102.         This is to be a publication devoted to Assembly language programming
  103. and to the Assembly language programmer. At first look it might appear that
  104. it is to be a pclone only forum, but that is not the intention or the desire.
  105. My current system is pclone and therefore where I have begun, but the same
  106. needs exist on other systems as well:  6502, 6800, 68000 and so forth.
  107. If there is to be any restriction it would be in the direction away from
  108. pure operating systems and into user visible applications, but that line is
  109. far too hazy to consider.
  110.         The hope is to present this 'magazine' monthly with a transmission
  111. date of the 15th. If YOUR interest is not communicated to me by way of 
  112. comments and article submissions this publication will evaporate immediately.
  113.         Your editor is no one you would have heard about. My first program-
  114. ming was done by setting toggle switches on the front of the machine and
  115. hitting the enter button.  I have worked on operating systems and interfaces
  116. on the 8088, Z80, 6800 and 6502.  I am currently disabled and some months my
  117. productive time approaches  0 but with the cooperation of my son (an excellent
  118. programmer) I hope to coordinate this far into the future.
  119.  
  120.  
  121.  
  122.                              Policy on Piracy
  123.  
  124.         As you well know programming is not easy. It is always time consum-
  125. ing and often very tedious.  A good program is as creative as a book or a work
  126. of art.  Even a bad program entails many man hours of effort.  This time 
  127. should not be stolen from the authors.  With conventional marketing piracy is 
  128. illegal.In Shareware the same moral obligations exist.  If we use it we should 
  129.  
  130.  
  131. pay for it.  Many of the programs to be discussed I expect to be in this 
  132. category.
  133.         I don't generally recommend publication of source code unless it is
  134. your intention to put it in the public domain, however illustrative pieces
  135. in an article could be of benefit to us all.  No code not wholly written by
  136. the author should be submitted.
  137.  
  138.  
  139.  
  140.  
  141.                  Suggestions for articles to be submitted
  142.  
  143. Reviews of programs- Reviews are always interesting because they can save
  144.                 someone a great deal of time in checking out something that
  145.                 will not meet their needs.
  146.  
  147. Bugs and idiosyncrasies- Undocumented facts about common tools
  148.  
  149. COM vs EXE
  150.  
  151. How to write a good TSR
  152.  
  153. Math libraries- All about
  154.  
  155. What is a good user interface
  156.  
  157. Public key signatures and Encryption- no viruses in Shareware
  158.  
  159. Most anything else of interest to you
  160.  
  161.  
  162.                                  The Beginning                                
  163. This was sent out on the FidoNet 80XXX echo in December 1988. Enough favorable
  164. replies were received to continue the project.
  165.  
  166.         I am interested in starting a national magazine devoted to the use of
  167. assembly language. The principle aims would be as follows:
  168.  
  169.                 Improving the skills and knowledge of us all
  170.  
  171.                 Widening the awareness of the benefits of assembly
  172.  
  173.                 Provide reviews of new tools
  174.  
  175. Is there a need for such a publication? In terms of mass readership, probably
  176. not. But in the desires of the select group of people who program in assembly
  177. I feel that there is.
  178.         Magazine is really the wrong term. I don't think there is a term for
  179. what this would likely have to be. If there was a large enough market for a
  180. normal publication I'm sure one of the major publishers would have done it.
  181. I foresee an electronic distribution possibly carried on the 80xx Echo then
  182. those interested could print it out, copy it, and make it available to others
  183. who would be interested. Eventually a more formal distribution might be
  184. arranged if there were enough interest. If anyone reading this is interested
  185. in contributing articles or just making comments I would like to hear from
  186. you.
  187.  
  188.  
  189.                        EDITORIAL (JUST TO SPARK CONTROVERSY)
  190.  
  191.         Higher level languages are primarily a method of producing software
  192. useful for corporations, because it can be written and understood by pro-
  193. grammers with little knowledge of the equipment. This work can then be
  194. passed on to another after he leaves, and little is lost. This same work
  195. can also be moved to another environment simply by changing compilers.
  196. Complex programs can be written quickly (This may be a fiction) and sent to
  197. market.
  198.         This all sounds pretty good, right? No. The price that we have to
  199. pay for this is far too high. The size of these programs is becoming absurd.
  200. This forces users (and that's what we all are) into a continual quest for
  201. larger memory. The major debugging programs available leave no room in a
  202. 512k pclone to fit the program being debugged. Spreadsheet and database
  203. programs are as bad and get worse with every new release of an 'improved'
  204. version.
  205.         The main program we use continuously is a major offender this way.
  206. DOS has grown almost geometrically and has come to occupy a significant
  207. fraction of available memory while adding few (if any) improvements since
  208. version 2.0 (the continuing standard of compatibility).
  209.         This situation is bad enough, but it is just the tip of the real
  210. damage done by the NECESSARY use of high level language by the leading
  211. software companies. Speed-- the magic word in computing is so thoroughly
  212. compromised that the hardware industry is just holding its head above the
  213. morass.
  214.         Within the last year I have tried the latest release of the
  215. assembler package from a major software company. I'm sure you know which
  216. one I mean, but I'd rather not use names at this time so I don't have to
  217. strictly document my figures. It was significantly larger than the previous
  218. version (though somewhat faster 35 seconds as opposed to 50 seconds on the
  219. program I tested it with). It would not assemble my source code from the
  220. previous version without a number of silly modifications. The involved
  221. syntax this package has traditionally used has annoyed me since the first
  222. version I purchased. About this same time I tried a shareware assembler that
  223. supports largely the same functions though in slightly differing form to
  224. reflect the preference of the author. I won't say that it was without
  225. flaws. No program is. After *removing* the instructions that have so irritated 
  226.  
  227.  
  228. me in the other I assembled the same program with this. It is a fraction
  229. of the size (about 20k). It loaded itself, loaded and assembled my program,
  230. delivered a complete COM file, and inserted some trivial error messages *into*
  231. a copy of my original source file in ** 4 ** seconds. This is around the
  232. same length of time it took the other assembler to load itself.
  233.        The editor contained in the commercial package while very versatile, 
  234. and using some very clever techniques to speed up the usage, the first
  235. time I tried to load a file in I thought my poor machine had bombed and
  236. I reset it, but then I noticed that the disk was being accessed and it even-
  237. tually displayed my file. The same situation occurred when I asked it to
  238. show me it's help file. The shareware editor I am using now allows me even
  239. greater versatility, only occupies about 15% of the memory and I can be
  240. editing my file long before the other one would have loaded itself. And it's
  241. not even completely written in assembly.
  242.         In summation, while high level language may have its place, it is
  243. not in programs expected to have high usage or when speed or size are
  244. significant factors. The end users need to be given a choice and shown the
  245. difference between quality programming and the corporate programming (much
  246. of it vaporware) that they are now being offered.
  247.  
  248.  
  249.  
  250.  
  251.                             A86 Assembler Review
  252.  
  253. A86 is a full featured Assembler for the 8088 80286 8087 80287 v20 and v30
  254. microprocessors. It is not fully MASM compatible, though it comes close 
  255. (except in the area of macros - its macro support is quite strong but entirely 
  256.  
  257.  
  258.  
  259. different from MASM).  Some of its unique features are support of entirely 
  260. local variables so that a new and unique name need not be thought up for each 
  261. local jump. It synthesizes the move segment register to segment register moves 
  262.  
  263.  
  264.  
  265. with pushes and pops and has some interesting commands to jmp far on 
  266. condition,using the inverse jshort instruction and a local label. This saves a 
  267.  
  268.  
  269.  
  270. good amount of typing and actually makes the code more readable. It is a tiny
  271. program, less than 24k and the assembly speed is astounding. The claim is
  272. 1000 lines per second. It will directly produce a COM file, usually so quick-
  273. ly you don't even need to pause in your typing. EXE files are also supported
  274. but as the COM format is so simple I haven't really checked that out too
  275. well, and the support is not complete. The documentation is good for the
  276. operation of the assembler but it is not a tutorial in assembly language
  277. programming.
  278.          So much for the advantages. It is not MASM compatible. While it will
  279. work with most MASM source files without macros, MASM will not accept an A86
  280. file. Most of the formatting commands of MASM (the proc and assume statements)
  281. are more or less ignored. The segment end statements are ignored, as a seg-
  282. ment statement closes the current segment. This simplified syntax can greatly
  283. reduce the amount of typing necessary in a program, but somewhat more care is
  284. needed by the programmer.
  285.          One of the worst flaws as I see it is the lack of support for in-
  286. clude files though its acceptance of multiple command line modules and libr-
  287. ary files partially makes up for this.
  288.          Overall, this is a very high quality program but not to be con-
  289. sidered if you require MASM compatibility. This is a shareware offering by
  290. Eric Isaccson, available from most BBS's.
  291.          There is a companion symbolic debugger D86 also available. 
  292.  
  293.  
  294. MASM is a trademark of Microsoft Corporation
  295.  
  296.  
  297.  
  298.  
  299.                       DMA Transfers for FAST Memory Moves                     
  300.  
  301. If you ever have the need for super fast moves of blocks of memory and you
  302. can put up with a lot of restrictions in order to gain the speed there is a
  303. method in the PC environment to move bytes at the rate of one every 3 clock
  304. cycles. Compare that to the clocks for a rep movsb and then say that isn't
  305. fast. This isn't for every programmer and it certainly isn't for every time
  306. you need to move a few bytes.
  307.          The DMA chip is a four channel device. Channel 0 is reserved for
  308. refresh of memory that requires at least 256 consecutive bytes be read some-
  309. where in memory at intervals less than about 4ms. The other three channels
  310. are available for such things as transferring information to and from the
  311. disk drives or the ports. Interesting trivia so far, but not very useful in
  312. moving memory around. It gets worse. The 8259 DMA doesn't know anything about
  313. segments. It only knows a 64k universe. This is where the Page registers come
  314. in. The page registers decide which page (on 64k boundaries) the 8259 will
  315. look at for any operation. There are not, as you might guess, 4 page 
  316. registers,but only 2 plus a default. If it is not channel 1 or 2 then it uses 
  317. the default register programmed as channel 3.
  318.          A careful reading of the data sheet of the 8259 discloses that it is
  319. capable of doing a memory to memory transfer but only between channels 0 and
  320. 1. That is why this method is a little tricky to use. In order to set up your
  321. own parameters you have to disable the timer from asking for a DMA from chan-
  322. nel 0 every x milliseconds and reconfigure the 8259 and assume the respon-
  323. sibility for doing the memory refresh. It actually sounds worse than it is.
  324. The configuring and re configuring of the 8259 doesn't take all that long, so
  325. the time is made up after only moving a few tens of bytes, and if you move at
  326. least 256 CONSECUTIVE bytes the memory refresh requirement is met for another
  327. 2 or 3 milliseconds. The page registers are taken care of by setting channels
  328. 1 and 3 to the same value.
  329.          Given below is an example of a program I wrote just to test the
  330. idea.  A lot of the setup is too complex to explain in this short article, but
  331. if you are interested in checking it all out you will need a data sheet on
  332. the 8259.  This worked nicely on my machine and should on most compatibles 
  333. just the way it is.  With the not-so-compatible it may very well not.  I hope 
  334. this listing is well enough commented so you can figure it out and make use of 
  335.  
  336.  
  337. it sometime. 
  338.  
  339. `                                DMA SOURCE
  340.  
  341. PAGE 60,132
  342. TITLE DMA MEMORY TO MEMORY
  343. DMA      EQU 0
  344. STACK       SEGMENT PUBLIC 'STACK'
  345.      DB  32 DUP('STACK')
  346. STACK       ENDS
  347. DATA     SEGMENT PUBLIC 'DATA'
  348. SOURCE      DW   08000H
  349. TARGET      DW   09000H
  350. NUMBER      DW   800H
  351. INCDEC      DB   0
  352. PAGER       DB   0BH    ;PAGE (O TO F)
  353. FILL     DB 0    ;2 IF A FILL OP
  354. DATA     ENDS
  355. ASSUME      CS:CODE,DS:DATA,ES:DATA
  356. CODE     SEGMENT PUBLIC 'CODE'
  357. START:
  358.      MOV AX,DATA
  359.      MOV DS,AX
  360.      MOV AX,0B800H
  361.      MOV ES,AX
  362. PAGE:
  363.      MOV AL,PAGER ;PAGE TO OPERATE IN
  364.      OUT 83H,AL
  365. UNDMA:
  366.      OUT 0DH,AL   ;MASTER RESET OF DMA
  367.      MOV DX,03D8H
  368.      MOV AL,1
  369.      OUT DX,AL
  370.      MOV AX,SOURCE     ;WHERE IS IT COMING FROM
  371.      OUT 0H,AL
  372.      MOV AL,AH
  373.      OUT 0H,AL
  374.      MOV AX,TARGET     ;WHERE TO PUT IT
  375.      OUT 2H,AL
  376.      MOV AL,AH
  377.      OUT 2H,AL
  378.      MOV AX,NUMBER     ;HOW MANY
  379.      OUT 3H,AL
  380.      MOV AL,AH
  381.      OUT 3H,AL
  382.      MOV AL,009H  ;ENABLE M TO M,COMPRESSED
  383.      OR  AL,FILL  ;WILL BE 2 IF FILL OP
  384.      OUT 8H,AL
  385.      MOV AL,088H  ;BLOCK MODE, INC, READ
  386.      OR  AL,INCDEC     ;WILL BE 20H IF DEC
  387.      OUT 0BH,AL
  388.      MOV AL,85H   ;BLOCK MODE, INC, WRITE
  389.      OR  AL,INCDEC     ;WILL BE 20H IF DEC
  390.      OUT 0BH,AL
  391.      MOV AL,4    ;THIS IS THE REQUEST
  392.      OUT 9,AL    ;DO IT
  393.      MOV AL,9
  394.      OUT DX,AL
  395. RESET:      OUT  0DH,AL  ;THIS IS A MASTER RESET
  396.      OUT 0CH,AL   ;RESET F/L F/F
  397.      MOV AL,01
  398.      OUT 0,AL
  399.      OUT 0,AL
  400. REINIT:  
  401.      MOV AL,0
  402.      OUT 83H,AL   ;MOVES REFRESH TO BASE PAGE
  403.      MOV AL,0FFH
  404.      OUT 1,AL
  405.      PUSH   AX
  406.      OUT 1,AL
  407.      OUT 0BH,AL
  408.      INC AL  ;MODE CHAN3
  409.      OUT 0BH,AL
  410.      PUSH   AX
  411.      POP AX
  412.      POP AX
  413.      POP AX
  414.      MOV AH,4CH
  415.      INT 21H
  416. CODE     ENDS
  417. END      START
  418. `
  419.  
  420.  
  421.  
  422.  
  423.                         All Programs Small and Fast
  424.                         ---------------------------
  425.  
  426.         The programs mentioned here are ones that I use regularly or have been
  427. recommended to me by those whose opinion I trust. In the later case, I have
  428. tried them but they just don't fit with the way I do things. You will notice
  429. some obvious holes in this list. These are cases where I have found nothing
  430. that I am pleased enough to pass on. Not all of them are written in assembly
  431. but they still work well in an assembly programming environment. Most of them
  432. are Shareware products, and while this is not by design on my part it is not
  433. by chance either. They were written by talented programmers in a non-corporate
  434. setting.
  435.  
  436. Xhelp
  437.  
  438. This is a TSR pop-up. It comes with a file containing the DOS 3.2 instruction
  439. set (about 50 pages worth) and an IBM/ascii table. It will also accept and
  440. integrate any other documents that you care to enter. It implements searches,
  441. index, and table of contents. Place marker is maintained between pop-ups.
  442. I resent its size, but it is fast and well implemented.
  443.  
  444.         Exwells Software Company
  445.         7677 Oakport St Suite 110
  446.         Oakland,CA 94621
  447.  
  448. CED
  449.  
  450. One of the command line editors. It has extended functions to make DOS com-
  451. mands resident and other programs can be invoked with arguments as though
  452. from a batch file with a specified synonym. Small and fast. Also works inside
  453. programs that strictly use DOS editing functions keeping internal and external
  454. commands separate. Shareware.
  455.  
  456.  
  457. List
  458.  
  459. Version 6.3+. I don't think this needs much said. It is by Vern Buerg,is small
  460. and fast. If you don't have it, get it! Shareware
  461.  
  462.  
  463. TSR
  464.  
  465. A collection of TSR handling programs. The Mark records the machine state,
  466. including vectors, environment, and most anything else it can. Release, looks
  467. for the latest Mark and restores that machine state, then erases the Mark.
  468. Thus any TSR's are removed completely. This is very useful for development
  469. work.  Shareware.
  470.  
  471.  
  472. Qedit
  473.  
  474. This is a full screen editor. It is small, super fast, has too many features
  475. to begin to list. You can configure the keyboard any way you like it very
  476. quickly and easily. 10 file concurrent editing, 99 nameable buffers etc.
  477. One of the finest pieces of software available. Shareware.
  478.  
  479.  
  480. Microspell
  481.  
  482. A spelling checker. Unbelievable speed, compatible with most word processors.
  483. Supports auxiliary dictionaries and allows entries into the main dictionary.
  484.  
  485.         Trigram systems
  486.         5840 Northumberland St.
  487.         Pittsburgh,PA 15217
  488.         412-422-8976
  489.  
  490.  
  491. Assemblers
  492.  
  493. This is a blank entry. A86 comes very close to qualifying; it is small, fast
  494. but is lacking some useful tools such as include files. I am still using
  495. grudgingly predominantly MASM 4 but may switch over. TASM from Borland is
  496. receiving some interesting comments, but is still large 97k, and not as fast
  497. as it might be. I've also heard of PASM. A review of it would be greatly
  498. appreciated.  Late break: OPTASM may be reasonable as well...
  499.  
  500.  
  501. Word Processors
  502.  
  503. This is also a blank entry. ChiWriter by Horstman Software is decent. It
  504. is versatile, easy, but large and slow. The big NAMES I've tried I have thrown
  505. away in disgust. Target size: <40k, plus fonts. Should scroll at typematic
  506. rate. 100k search <1 sec. Configurable command keys(!).
  507.  
  508.  
  509.  
  510.  
  511.                          Getting User Input, Part One                         
  512.                     
  513.                                 by David O'Riva                               
  514.  
  515.         Most of you are familiar with the various ways to read the
  516. keyboard.  One can ask DOS, through interrupt 21H, and get keystrokes
  517. coming from the keyboard (or from whatever device or file the user told DOS
  518. to use instead of the keyboard).
  519.         Alternatively, if you want to be sure that you're getting actual
  520. *keyboard* input, and/or you want more information than DOS is willing to
  521. provide, you can go through INT 16H:
  522.  
  523.                 MOV     AH,0
  524.                 INT     016H                    ;get a key & scancode
  525.                 MOV     DX,AX                   ;save keystroke in DX
  526.                 MOV     AH,2
  527.                 INT     016H                    ;get shift state in AL
  528.  
  529. ...would give you the key pressed, it's scan code, and the shift states in
  530. effect at the time of the press.  Information on all the INT 16H modes is
  531. available from many references, and we will not delve any deeper into that
  532. here.
  533.         Now, if you NEED to know exactly what the keyboard state is, or to
  534. get a keystroke the micro-second it is pressed, or to interpret and act on
  535. multiple keystrokes (for example: you're writing a game, and you want one
  536. half of the keyboard to be controls for player 1, and the other half to be
  537. controls for player two.) then you need an IRQ 1 trap.
  538.         The following sequence of events occurs for every key that is
  539. pressed:
  540.  
  541. * KEYPRESS *
  542. IRQ 1 is pulled high
  543. The 8259 interrupt controller halts the system and does an INT 09H
  544. The BIOS code for INT 09H polls the keyboard for the scan code, converts
  545.    the code into an IBM scan code, which is for the most part identical to
  546.    the scan codes from the keyboard.
  547. If the CTRL-ALT-DEL sequence was pressed, control is given to the warm boot
  548.    code.  Other special keys are serviced (i.e. SYSREQ on ATs, soft turbo
  549.    mode switches, etc...)
  550. The keystroke is placed in the buffer, if there is room.
  551. The INT 09H code resets the 8259 and leaves.
  552. INT 16H (when called) pulls the keystroke out of the buffer and hands it to
  553. the application, or to DOS, which hands it to the application.
  554.  
  555.         Note that the INT 09H code in BIOS will only respond to a
  556. keyboard MAKE code, except for shift keys.  The keyboard itself handles
  557. typematic repeating, except on PCjrs.
  558.  
  559.         An IRQ 1 server needs to be installed BEFORE the BIOS code, and
  560. can respond in varying ways to keystrokes.  Here are some examples of IRQ 1
  561. servers for specific tasks:
  562.   
  563. 1. For HOT-KEY popup
  564.   a) poll the keyboard, find out whether it's a MAKE or BREAK code
  565.   b) if it's a BREAK code
  566.     b1) is it the BREAK code for our hot-key?
  567.     b2) if so, did we trap the make code?
  568.     b3) if we did, clear the keyboard latch, reset the 8259, and leave.
  569.   c) if it's a MAKE code
  570.     c1) is it the MAKE code for our hot-key?
  571.     c2) if so, are we allowed to pop up now? (you don't want to start
  572.           multiple iterations of your popup program...)
  573.     c3) if we are, set a flag to wait for the BREAK code, clear the
  574.           keyboard latch and 8259, and start the popup.
  575.   d) if it wasn't acted upon before, leave the keyboard latch and
  576.      interrupt mask as they are and continue down the INT 09H chain.
  577.  
  578. 2. For multiple-key trapping
  579.    First, set up an array that corresponds to the keys you want to trap.
  580.  
  581.   a) poll the keyboard, find out whether it's a MAKE or BREAK code.
  582.   b) if it's a MAKE code
  583.     b1) is it one of the keys we want to know about?
  584.     b2) if so, set the element in the array that corresponds to this key.
  585.     b3) You will *usually* want to clear the KB latch and 8259 to prevent
  586.           the BIOS keyboard buffer from overflowing...
  587.   c) if it's a BREAK code
  588.     c1) is it one of the keys we want to know about?
  589.     c2) if so, clear the element in the array that corresponds to this key.
  590.     c3) if you prevented the MAKE code from reaching BIOS, do the same for
  591.           this BREAK code.
  592.   d) if it wasn't acted upon, continue down the INT 09H chain
  593.        (alternatively, you can trap a key other keys here, like your "end
  594.        the game" key, and prevent ANY keystrokes from reaching BIOS.  This
  595.        would prevent a CTRL-C from invoking DOS's critical-error handler,
  596.        a CTRL-ALT-DEL from blowing the game if files are open, etc...)
  597.  
  598.   e) in your game's code, use the array to determine which keys are pressed
  599.        and what to do.
  600.  
  601.         As you can see, this sort of trap can be extremely powerful.  The
  602. only caveat is that this requires a very-compatible PClone.  And this may
  603. not be that bad, since I know that at least two very large game companies
  604. are using a method similar to this for their games.
  605.         Included with this article is a program called SHOWKEY.ASM, which
  606. installs an IRQ 1 trap and prints on the screen the scan code that it
  607. received from polling the keyboard, the current shift state, and the key
  608. and scan code that a call to INT 16H returned (dashes are printed if the
  609. key was not passed to the buffer).  The only thing I ask in relation to
  610. this code is that if you distribute it unmodified, you leave my copyright
  611. message in.  The code should be commented well enough that it is
  612. understandable.
  613.  
  614.         Next month:  Pop-up TSR'S.  How to write, how to invoke, how to run,
  615. how to remove from memory.  Watch for it!
  616.  
  617.         NOTE:  This is my first effort at writing an article for
  618. programmers on a complicated subject.  Any comments or suggestions on
  619. writing style or clarity of explanation would be welcomed.  Send to FidoNet
  620. node 143/37 - Dave.
  621.  
  622.  
  623. `               PAGE    60,132
  624.                 TITLE   SHOWKEY - Shows key codes
  625. ;
  626. ;
  627. COMMENT~*********************************************************************
  628. *  --++**> All code in this file is Copyright 1989 by David O'Riva <**++--  *
  629. *****************************************************************************
  630. *                                                                           *
  631. * Written for the Microsoft Macro Assembler version 5.1                     *
  632. *                                                                           *
  633. *  MUST BE CONVERTED INTO A .COM FILE BEFORE RUNNING!!!                     *
  634. *                                                                           *
  635. *                                                                           *
  636. * Short advertisement - use QEdit!  Get it from 143/37!                     *
  637. *                                                                           *
  638. ****************************************************************************~
  639. .XLIST
  640. ;
  641. ; Macros used by this program
  642. ;
  643.  
  644. ?PLevel         =       0
  645.  
  646. PNPROC          MACRO   PNAME           ;;declare near public procedure
  647.                 IF2
  648.                 %OUT    Routine: &PNAME
  649.                 ENDIF
  650.                 PUBLIC  &PNAME
  651. &PNAME          PROC    NEAR
  652. ?PLevel         =       ?PLevel+1       ;;next level of nesting
  653. @@SAVE_NAME     &PNAME,%?PLevel
  654.                 ENDM
  655.  
  656. ENDPROC         MACRO
  657. @@REC_NAME      %?PLevel
  658. @@EP1           %@@TEMP
  659. ?PLevel         =       ?PLevel-1
  660.                 ENDM
  661.  
  662. @@SAVE_NAME     MACRO   PNAME,LVL
  663. ?PN&LVL         EQU     <&PNAME>
  664.                 ENDM
  665.  
  666. @@REC_NAME      MACRO   LVL
  667. @@TEMP          EQU     <?PN&LVL>
  668.                 ENDM
  669.  
  670. @@EP1           MACRO   PNAME
  671. &PNAME          ENDP
  672.                 ENDM
  673.  
  674. PUSHM           MACRO   LST
  675. IRP             REG,<&LST&>
  676.                 PUSH    REG
  677.                 ENDM
  678.                 ENDM
  679.  
  680. POPM            MACRO   LST
  681. IRP             REG,<&LST&>
  682.                 POP     REG
  683.                 ENDM
  684.                 ENDM
  685.  
  686. @CHANGE_VECT    MACRO   INUM,GARB,NEW,GARB2,SAVEAREA
  687.                 MOV     AX,0
  688.                 MOV     ES,AX
  689.                 MOV     AX,ES:[INUM*4]
  690.                 MOV     DX,ES:[INUM*4+2]
  691.                 MOV     WPTR CS:[SAVEAREA],AX
  692.                 MOV     WPTR CS:[SAVEAREA+2],DX
  693.                 MOV     AX,OFFSET CS:NEW
  694.                 CLI
  695.                 MOV     ES:[INUM*4],AX
  696.                 MOV     ES:[INUM*4+2],CS
  697.                 STI
  698.                 ENDM
  699.  
  700. @RESTORE_VECT   MACRO   INUM,GARB,SAVEAREA
  701.                 MOV     AX,0
  702.                 MOV     ES,AX
  703.                 MOV     AX,WPTR CS:[SAVEAREA]
  704.                 MOV     DX,WPTR CS:[SAVEAREA+2]
  705.                 CLI
  706.                 MOV     ES:[INUM*4],AX
  707.                 MOV     ES:[INUM*4+2],DX
  708.                 STI
  709.                 ENDM
  710.  
  711. BPTR            EQU     <BYTE PTR>
  712. WPTR            EQU     <WORD PTR>
  713. DPTR            EQU     <DWORD PTR>
  714. CR              EQU     <13>
  715. LF              EQU     <10>
  716. JR              EQU     <JMP     SHORT>
  717.  
  718. INT_CTRL        EQU     020H    ;Interrupt control port
  719. EOI             EQU     020H    ;Reset interrupt controller command
  720. KB_DATA         EQU     060H    ;Keyboard data port
  721. KB_CTRL         EQU     061H    ;Keyboard control port
  722. ;
  723. ;****************************************************************************
  724. ;
  725. BIOSDATA        SEGMENT AT 00040H
  726.  
  727. ;----------------------------------------------------------------------------
  728. ;Keyboard Data Area
  729. ;----------------------------------------------------------------------------
  730.  
  731.                 ORG     00017H
  732. KB_FLAG         LABEL   BYTE
  733.  
  734. ;----- Shift flag equates within KB_FLAG
  735.  
  736.         INS_STATE       EQU     80H     ;INSERT state is active
  737.         CAPS_STATE      EQU     40H     ;CAPS LOCK state toggled
  738.         NUM_STATE       EQU     20H     ;NUM LOCK state toggled
  739.         SCROLL_STATE    EQU     10H     ;SCROLL LOCK state toggled
  740.         ALT_SHIFT       EQU     08H     ;ALT key depressed
  741.         CTRL_SHIFT      EQU     04H     ;CTRL key depressed
  742.         LEFT_SHIFT      EQU     02H     ;left SHIFT key depressed
  743.         RIGHT_SHIFT     EQU     01H     ;right SHIFT key depressed
  744.  
  745.                 ORG     00018H
  746. KB_FLAG_1       LABEL   BYTE
  747.  
  748. ;----- Shift flag equates within KB_FLAG_1
  749.  
  750.         INS_SHIFT       EQU     80H     ;INSERT key depressed
  751.         CAPS_SHIFT      EQU     40H     ;CAPS LOCK key depressed
  752.         NUM_SHIFT       EQU     20H     ;NUM LOCK key depressed
  753.         SCROLL_SHIFT    EQU     10H     ;SCROLL LOCK key depressed
  754.         HOLD_STATE      EQU     08H     ;suspend key has been toggled
  755.  
  756.                 ORG     00019H
  757. ALT_INPUT       LABEL   BYTE            ;storage for alternate keypad entry
  758.  
  759.                 ORG     0001AH
  760. BUFFER_HEAD     LABEL   WORD            ;pointer to head of keyboard buffer
  761.  
  762.                 ORG     0001CH
  763. BUFFER_TAIL     LABEL   WORD            ;pointer to tail of keyboard buffer
  764.  
  765.                 ORG     0001EH
  766. KB_BUFFER       LABEL   WORD            ;keyboard buffer
  767.  
  768.                 ORG     0003EH
  769. KB_BUFFER_END   LABEL   WORD
  770.  
  771. ;----- HEAD = TAIL indicates that the buffer is empty
  772.  
  773.         NUM_KEY         EQU     69      ;scan code for NUM LOCK
  774.         SCROLL_KEY      EQU     70      ;sc for SCROLL LOCK
  775.         ALT_KEY         EQU     56      ;sc for ALT key
  776.         CTL_KEY         EQU     29      ;sc for CTRL key
  777.         CAPS_KEY        EQU     58
  778.         LEFT_KEY        EQU     42
  779.         RIGHT_KEY       EQU     54
  780.         INS_KEY         EQU     82
  781.         DEL_KEY         EQU     83
  782.  
  783. BIOSDATA        ENDS
  784.  
  785.  
  786. .LIST
  787. .SALL
  788. ;
  789. ;****************************************************************************
  790. ;
  791. CODE            SEGMENT PARA PUBLIC 'CODE'
  792.                 ASSUME  CS:CODE,DS:CODE,ES:CODE,SS:CODE
  793.  
  794. MAIN            PROC    FAR
  795.                 ORG     100H
  796.  
  797. ENTRY:          JMP     INSTALL
  798.  
  799. ;============================================================================
  800. ;
  801. ; MY LOCAL DATA
  802. ;
  803. ;
  804. ;
  805. OLD9            DD      ?       ;old INT 9 vector
  806. ;
  807. ;
  808. LAST_KEY        DB      ?       ;make code from key trap
  809. LAST_SHIFT      DB      ?       ;shift state on trap
  810. KEYPRESSED      DB      ?       ;TRAP flag - non-zero = key was trapped
  811. LINECOUNT       DB      ?       ;current count of lines on screen
  812. SHIFTOVL        DB      'RLCA'  ;
  813.  
  814. NOTICE          LABEL   BYTE
  815. DB CR,LF
  816. DB 'SHOWKEY  v1.0  12-01-1988',CR,LF
  817. DB 'COPYRIGHT 1988 ORIVATION',CR,LF
  818. DB CR,LF
  819. DB 'SHOWKEY shows the incoming scan codes from the keyboard hardware',CR,LF
  820. DB '    and from the BIOS, and the shifts in effect at the press.',CR,LF
  821. DB '    Type a "Q" to quit.',CR,LF
  822.  
  823. LINE0           DB      '+INCOMING CODES--+------+------+------+',CR,LF
  824.                 DB      '| ASCII | SHIFTS | KEYB | BIOS | EXTD |',CR,LF
  825.                 DB      '| CHAR  |  RLCA  | CODE | CODE | CODE |',CR,LF
  826.                 DB      '+-------+--------+------+------+------+',CR,LF,'$'
  827.  
  828. ILINE           DB      '|   '
  829. ACHAR           DB      ' '
  830.                 DB      '   |  '
  831. SHIFTS          DB      'RLCA'
  832.                 DB      '  |  '
  833. KBC             DB      '00'
  834.                 DB      '  |  '
  835. BIOSC           DB      '00'
  836.                 DB      '  |  '
  837. EXTC            DB      '00'
  838.                 DB      '  |',CR,LF,'$'
  839. ;
  840. ;
  841. ;============================================================================
  842.  
  843.  
  844.                 PAGE
  845. ;****************************************************************************
  846. ; START - main program loop
  847. ;
  848. ;
  849. ;     ENTRY:    from command line
  850. ;
  851. ;      EXIT:    ???
  852. ;
  853. ; DESTROYED:    ALL
  854. ;
  855. ;----------------------------------------------------------------------------
  856. PNPROC          START
  857.  
  858.                 PUSHM   <CS,CS>
  859.                 POPM    <ES,DS>
  860. ;----------------------------------------------------------------------------
  861. ; print copyright notice
  862. ;----------------------------------------------------------------------------
  863.                 MOV     AH,9
  864.                 MOV     DX,OFFSET NOTICE
  865.                 INT     021H
  866.                 MOV     LINECOUNT,20
  867. ;----------------------------------------------------------------------------
  868. ;
  869. ;
  870. ; MAIN LOOP
  871. ;
  872. ;
  873. ;----------------------------------------------------------------------------
  874. NEXT_CHAR_IN:   DEC     LINECOUNT
  875.                 JNZ     S_1
  876. ;
  877. ; reprint column headers if scrolled off screen
  878. ;
  879.                 MOV     DX,OFFSET LINE0
  880.                 MOV     AH,9
  881.                 INT     021H
  882.                 MOV     LINECOUNT,20
  883. ;----------------------------------------------------------------------------
  884. ; wait until our trap finds something
  885. ;----------------------------------------------------------------------------
  886. S_1:            CMP     CS:KEYPRESSED,0
  887.                 JZ      S_1
  888. ;----------------------------------------------------------------------------
  889. ; reset trap and get 'make' code of key pressed
  890. ;----------------------------------------------------------------------------
  891.                 MOV     CS:KEYPRESSED,0
  892.                 MOV     AL,LAST_KEY
  893.                 MOV     SI,OFFSET KBC
  894.                 CALL    REGISTERTOTEXT
  895. ;----------------------------------------------------------------------------
  896. ; did BIOS pick up on the key?
  897. ;----------------------------------------------------------------------------
  898.                 MOV     AH,1
  899.                 INT     016H
  900. S_2:            JNZ     S_3
  901. ;----------------------------------------------------------------------------
  902. ; if BIOS didn't get it, print dashes instead
  903. ;----------------------------------------------------------------------------
  904.                 MOV     WPTR BIOSC,('-'*256+'-')
  905.                 MOV     WPTR EXTC,('-'*256+'-')
  906.                 MOV     ACHAR,' '
  907.                 JR      S_6
  908. ;----------------------------------------------------------------------------
  909. ; print the key BIOS found
  910. ;----------------------------------------------------------------------------
  911. S_3:            MOV     AH,0
  912.                 INT     016H
  913.                 PUSH    AX
  914.                 MOV     ACHAR,AL
  915. ;
  916. ; since we're using cooked console output, only print chars > 32
  917. ;
  918.                 CMP     AL,' '
  919.                 JAE     S_5
  920.  
  921.                 MOV     ACHAR,' '
  922. ;
  923. ; get ASCII code of character
  924. ;
  925. S_5:            MOV     SI,OFFSET BIOSC
  926.                 CALL    REGISTERTOTEXT
  927. ;
  928. ; and get extended (scan) code from BIOS
  929. ;
  930.                 MOV     SI,OFFSET EXTC
  931.                 POP     AX
  932.                 MOV     AL,AH
  933.                 CALL    REGISTERTOTEXT
  934. ;----------------------------------------------------------------------------
  935. ; read shift states in effect at the time of the press
  936. ;----------------------------------------------------------------------------
  937. S_6:            MOV     AX,WPTR SHIFTOVL        ;* restore shift characters to
  938.                 MOV     WPTR SHIFTS,AX          ;|   output string
  939.                 MOV     AX,WPTR SHIFTOVL+2      ;|
  940.                 MOV     WPTR SHIFTS+2,AX        ;*
  941.                 MOV     SI,OFFSET SHIFTS        ;SI -> shift info to display
  942.                 MOV     AL,LAST_SHIFT           ;AL = shift codes in BIOSDATA
  943.                 MOV     CX,4                    ;CX = # of shifts to check
  944.  
  945. S_7:            SHR     AL,1                    ;shift bit -> carry flag
  946.                 JC      S_8                     ;if set, bypass this one
  947.                 MOV     BPTR [SI],' '           ;clear this shift character
  948. S_8:            INC     SI                      ;SI -> next shift character
  949.                 LOOP    S_7                     ;check it
  950. ;----------------------------------------------------------------------------
  951. ; print a line of information about the keypress
  952. ;----------------------------------------------------------------------------
  953.                 MOV     AH,9
  954.                 MOV     DX,OFFSET ILINE
  955.                 INT     021H
  956. ;----------------------------------------------------------------------------
  957. ; if this character was a 'Q', then leave now
  958. ;----------------------------------------------------------------------------
  959.                 MOV     AL,ACHAR
  960.                 CMP     AL,'Q'
  961.                 JZ      S_OUT
  962. ;----------------------------------------------------------------------------
  963. ; more characters in BIOS buffer?
  964. ;----------------------------------------------------------------------------
  965.                 MOV     AH,1
  966.                 INT     016H
  967.                 JNZ     S_2
  968. ;----------------------------------------------------------------------------
  969. ; do next key
  970. ;----------------------------------------------------------------------------
  971.                 JMP     NEXT_CHAR_IN
  972.  
  973. ;----------------------------------------------------------------------------
  974. ; leave
  975. ;----------------------------------------------------------------------------
  976. S_OUT:          JMP     UNLOAD
  977.  
  978. ENDPROC
  979.  
  980.          
  981. ;****************************************************************************
  982. ; REGISTERTOTEXT - Converts AL into ASCII hex digits in CS:[SI]
  983. ;
  984. ;
  985. ;     ENTRY:    AL = register to translate
  986. ;               SI = place to put translated digits
  987. ;
  988. ;      EXIT:    AX = hex digits
  989. ;
  990. ; DESTROYED:    AX
  991. ;
  992. ;----------------------------------------------------------------------------
  993. ASSUME ds:NOTHING,es:NOTHING
  994. PNPROC          REGISTERTOTEXT
  995. ;----------------------------------------------------------------------------
  996. ; split AL into two nibbles
  997. ;----------------------------------------------------------------------------
  998.                 MOV     AH,AL
  999.                 SHR     AH,1
  1000.                 SHR     AH,1
  1001.                 SHR     AH,1
  1002.                 SHR     AH,1
  1003.                 AND     AL,0FH
  1004. ;----------------------------------------------------------------------------
  1005. ; convert AL into a hex digit
  1006. ;----------------------------------------------------------------------------
  1007.                 ADD     AL,'0'                  ;AL = actual digit
  1008.                 CMP     AL,'9'
  1009.                 JBE     R_1
  1010.                 ADD     AL,'A'-'0'-10
  1011. ;----------------------------------------------------------------------------
  1012. ; convert AH into a hex digit
  1013. ;----------------------------------------------------------------------------
  1014. R_1:            ADD     AH,'0'                  ;AH = actual digit
  1015.                 CMP     AH,'9'
  1016.                 JBE     R_2
  1017.                 ADD     AH,'A'-'0'-10
  1018. ;----------------------------------------------------------------------------
  1019. ; store hex number in [SI]
  1020. ;----------------------------------------------------------------------------
  1021. R_2:            MOV     CS:[SI],AH
  1022.                 MOV     CS:[SI+1],AL
  1023.                 RET
  1024. ENDPROC
  1025.  
  1026.  
  1027.                 PAGE
  1028. ;****************************************************************************
  1029. ; TRAPPER9 - Intercepts the incoming keyboard scan code
  1030. ;
  1031. ;       This routine intercepts the keyboard hardware interrupt, looking
  1032. ; for a valid "make" code.  If such a code is found, it is stored in local
  1033. ; data along with the current shift state, and a flag is set indicating that
  1034. ; a keypress was trapped.
  1035. ;
  1036. ;     ENTRY:    from IRQ 1, machine state is ???
  1037. ;
  1038. ;      EXIT:    continues KB interrupt chain
  1039. ;
  1040. ; DESTROYED:    none
  1041. ;
  1042. ;----------------------------------------------------------------------------
  1043. ASSUME ds:BIOSDATA,es:NOTHING
  1044. PNPROC          TRAPPER9
  1045.  
  1046.                 STI                     ;since the keyboard interrupt mask
  1047.                                         ;is never cleared within this routine,
  1048.                                         ;there is no chance of accidental
  1049.                                         ;re-entry with interrupts enabled
  1050.                 PUSHM   <AX,BX,DS>      ;save everthing I use
  1051.  
  1052.                 MOV     AX,SEG BIOSDATA ;DS-> BIOS's data seg
  1053.                 MOV     DS,AX
  1054.  
  1055.                 IN      AL,KB_DATA      ;Poll keyboard controller
  1056.                 TEST    AL,080H         ;See if we got a 'make' code
  1057.                 JNZ     T_ChainOn       ;If it's a 'break' code, ignore it...
  1058. ;----------------------------------------------------------------------------
  1059. ; ignore the four shift keys (CTRL, ATL, L-SHIFT, R-SHIFT)
  1060. ;----------------------------------------------------------------------------
  1061.                 CMP     AL,038H
  1062.                 JZ      T_ChainOn
  1063.                 CMP     AL,02AH
  1064.                 JZ      T_ChainOn
  1065.                 CMP     AL,01DH
  1066.                 JZ      T_ChainOn
  1067.                 CMP     AL,036H
  1068.                 JZ      T_ChainOn
  1069. ;----------------------------------------------------------------------------
  1070. ; save info about this key
  1071. ;----------------------------------------------------------------------------
  1072.                 MOV     CS:LAST_KEY,AL  ;save key make code
  1073.                 MOV     AL,KB_FLAG
  1074.                 MOV     CS:LAST_SHIFT,AL;save current shift state
  1075.                 MOV     CS:KEYPRESSED,1 ;set 'TRAPPED' flag
  1076.  
  1077. ;----------------------------------------------------------------------------
  1078. ; Continue down the KB handler chain...
  1079. ;----------------------------------------------------------------------------
  1080. T_chainon:      POPM    <DS,BX,AX>
  1081.                 JMP     DWORD PTR CS:OLD9
  1082. ENDPROC
  1083.  
  1084.                 PAGE
  1085. ;****************************************************************************
  1086. ; UNLOAD - Unhooks all vectors and exits
  1087. ;
  1088. ;
  1089. ;     ENTRY:    nothing
  1090. ;
  1091. ;      EXIT:    never exits.
  1092. ;
  1093. ; DESTROYED:    this program.
  1094. ;
  1095. ;----------------------------------------------------------------------------
  1096. ASSUME ds:CODE,es:CODE
  1097. PNPROC          UNLOAD
  1098.  
  1099.                 @RESTORE_VECT 9 FROM OLD9       ;Restore keyboard vector
  1100.                 MOV     AX,04C00H               ;Exit w/ERRORLEVEL 0
  1101.                 INT     021H
  1102. ENDPROC
  1103.  
  1104.  
  1105.                 PAGE
  1106. ;****************************************************************************
  1107. ; INSTALL - Installs traps, then runs the program.
  1108. ;
  1109. ;
  1110. ;     ENTRY:    called on entry to the program
  1111. ;
  1112. ;      EXIT:    starts running main code
  1113. ;
  1114. ; DESTROYED:    assume ALL but DS
  1115. ;
  1116. ;----------------------------------------------------------------------------
  1117. ASSUME ds:CODE,es:CODE
  1118. PNPROC          INSTALL
  1119. ;----------------------------------------------------------------------------
  1120. ; install our keyboard hardware interrupt trap
  1121. ;----------------------------------------------------------------------------
  1122.                 @CHANGE_VECT 9 TO TRAPPER9 SAVEIN OLD9
  1123. ;----------------------------------------------------------------------------
  1124. ; continue program execution
  1125. ;----------------------------------------------------------------------------
  1126.                 JMP     START
  1127. ENDPROC
  1128.  
  1129.  
  1130. MAIN            ENDP
  1131. ;
  1132. ;****************************************************************************
  1133. ;
  1134. CODE            ENDS
  1135.                 END     ENTRY`
  1136.  
  1137.  
  1138.  
  1139.                          Book Reviews - February
  1140.  
  1141.  
  1142. With the wide assortment of books available for the IBM PC series and the
  1143. greatly differing quality some sort of review is desirable before
  1144. entering the bookstore. It is all too likely that you will come out
  1145. poorer by $100.00 or more. It is also important to purchase a book that
  1146. matches your level of experience.
  1147.  
  1148. Novice:
  1149.  
  1150. This is the most important of the levels. The basic information must be
  1151. complete, practical and be presented in a manner that informs without
  1152. confusing. The books that accomplish this are few indeed.
  1153.  
  1154.  
  1155. 8088 Assembler Language Programming: The IBM PC
  1156.         written by David C. Willen & Jeffery I. Krantz
  1157.         published by Howard W. Sams & Co., Inc.
  1158.  
  1159. This book is a well-written introduction to the 8088 instruction set and
  1160. some of the hardware on a standard PC.  Has a complete explanation of
  1161. hexadecimal & binary numbering systems, an explanation of what assembly
  1162. language is and what it's good for.  Has chapters on keyboard, joystick,
  1163. monitor text modes, sound, interrupts, a bit about file handling and
  1164. more.  Includes programming examples.  Slightly outdated, uses DOS 1
  1165. functions and assumes MASM v1.0, but worth the price.
  1166.  
  1167.  
  1168. IBM PC-DOS Handbook
  1169.         written by Richard Allen King
  1170.         published by Sybex
  1171.  
  1172. This is a complementary book to the one above. They really contain different
  1173. material and together make a good starting point. This volume deals with the
  1174. interface to DOS versions 1 and 2.  Designed so that you can focus on
  1175. one thing you want to do, and look up everything DOS will do for you
  1176. towards that.  No programming examples.
  1177.  
  1178.  
  1179.  
  1180.  
  1181. Advanced:
  1182.  
  1183. These are books that assume a reasonable knowledge of assembly language and
  1184. delve deeply into the topics they cover.
  1185.  
  1186.  
  1187. Writing MSDOS device drivers
  1188.         written by Robert S. Lai
  1189.         published by The Waite Group (Addison-Wesley Publishing Company)
  1190.  
  1191. Quite possibly the definitive book on device drivers.  Assumes that you
  1192. are comfortable with assembly language.  Explains device drivers
  1193. completely, with lots(!!) of examples.  The most in-depth and complete
  1194. reference on the subject I've seen.
  1195. Includes a Console, Printer, Clock, and RAM Disk driver.
  1196.  
  1197.  
  1198. Programmer's Guide to PC & PS/2 Video Systems
  1199.         written by Richard Wilton
  1200.         published by the Microsoft Press
  1201.  
  1202. The best book I've seen for video.  Assumes complete knowledge of
  1203. assembly language and the ability to interpret hardware terms.
  1204. Unfortunately, the examples are written such that they interface with C,
  1205. but that could be easily changed.  Has complete information on MDA, HGC,
  1206. CGA, EGA, VGA, and MCGA adapters.  Includes line, arc, area-fill, and
  1207. adapter identification routines to name a few, along with complete port
  1208. programming information.  A must for graphics programmers.
  1209.  
  1210.  
  1211. DOS Programmer's reference
  1212.         written by Terry R. Dettmann
  1213.         published by QUE Corporation
  1214.  
  1215. The front of this book isn't that impressive (contains basic info about
  1216. DOS, BIOS, screen handling, memory etc.) but the last 400 pages are a
  1217. VERY impressive reference to all the BIOS interrupts, DOS interrupts
  1218. (including more undocumented functions than I've seen anywhere else),
  1219. Microsoft Mouse interrupt functions, which aren't documented in the
  1220. mouse package anymore, and the EMS interrupt functions (version 3.2).
  1221. If you need a good all-in-one reference, this is it.
  1222.  
  1223.  
  1224.  
  1225. NOTE:   I am positive that I overlooked a number of extremely good books
  1226. here.  We need you (the readers) to write reviews of books that deal
  1227. with assembly language and/or hardware for IBM PC's or any other system.
  1228. Since our main work is done on PClones and we don't really have access
  1229. to any other sort of system, we need reviews of books for 680x0, 6502,
  1230. and whatever else you're using.  Send all reviews in ASCII text form to
  1231. FidoNet node 143/37.  Thanx. - Dave
  1232.  
  1233.  
  1234.  
  1235.               GUIDE LINES FOR CONTRIBUTORS AND 'ADVERTISERS'
  1236.  
  1237.  
  1238. Name and address must be included with all articles and files
  1239.  
  1240. Executable file size and percent of assembly code (when available) should
  1241. be included when a program is mentioned and is required from an author or
  1242. publisher.
  1243.  
  1244. Any article of interest to Assembly language programmers will be considered
  1245. for inclusion. Quality of writing will not be a factor, but I reserve the 
  1246. right to try and correct spelling errors and minor mistakes in grammar. 
  1247. Non-exclusive copyright must be given. No monetary compensation will be made.
  1248.  
  1249. Outlines of projects that might be undertaken jointly are welcome. For 
  1250. example:
  1251. One person who is capable with hardware needs support from a user friendly
  1252. programmer and a math whiz.
  1253.  
  1254. Advertisements as such are not acceptable. Authors and publishers wishing to
  1255. contribute reviews of their own products will be considered and included as
  1256. space and time permit. These must include executable file size, percent of
  1257. assembly code and time comparisons.
  1258.  
  1259. Your editor would like information on math libraries, and reviews of such.
  1260.  
  1261. Articles must be submitted in pclone readable format or sent E-mail.
  1262.          Address: Patrick O'Riva
  1263.                   2726 Hostetter Rd
  1264.                   San Jose, CA 95132
  1265.  
  1266. Money: Your editor has none. Therefore no compensation can be made for 
  1267. articles included. Subscription fees obviously don't exist. Publication costs 
  1268. I expect to be nil (NUL). Small contributions will be accepted to support the 
  1269. BBS where back issues are available as well as files and programs mentioned in 
  1270.  
  1271.  
  1272. articles(if PD or Shareware ONLY).
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.