home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / asm_programming / ASSEMDOC.DOC < prev    next >
Text File  |  1989-01-18  |  24KB  |  786 lines

  1. 3/50: Assembly Langauge Programming
  2. Name: Lazerith #1
  3. Date: Mon Dec 12 20:33:46 1988
  4.  
  5. Okay, gents, here's the deal.  I'm going to begin a series of posts on the
  6. hows and whys of assembly langauge programming.  Now, because I've got so many
  7. open projects right now I'll generally be slow to respond, so don't lose track
  8. of what I've already said, because I do not wish to repeat it too often.
  9.  
  10. Here's what you have to have:
  11.     Turbo Assembler 1.0 by Borland  -OR-   Microsoft version 5.10
  12.          (I prefer Microsoft and will use it as my default langauge.)
  13.     Enough free disk space (or floppy disks) to hold the assembler AND about
  14.          two hundred thousand free bytes or MUCH MORE.
  15.     8087 will not be necessary for now, and I'll be starting with 8088/8086
  16.       CPUs, so IBM users are the only one's likely to benefit.
  17.     80286 and 80386 are completely compatible and will be individually
  18.  explored later.
  19.     IBM CGA (or better) is preferred, because I know most of you will be more
  20.         interested in graphics than anything else, HOWEVER, the first
  21.          project will be strictly text.
  22.     DOS 3.30 is preferred, although it will be a long time before the DOS
  23.          version will make a difference.
  24.  
  25. Here's the project:
  26.     We will begin by collectively writting a program I will call DataComm (if
  27.    anyone knows of a project already called this, then I need to hear about
  28.  it soon!)  It will be a modem program specifically designed for use with
  29.     MBBS (Which is our future BBS written in both OS/2 and DOS).  Eventually
  30.   you'll all have completed copies about the same time the new BBS is ready.
  31.  
  32. Ok, the next post and any following will be titled "DataComm - Lesson 1", etc.
  33. Please E-mail me if your interested and I'll keep it going.  Otherwise, I'll
  34. can the whole idea.  Thanks,
  35.  
  36.                              Lazerith
  37.  
  38.  
  39. 4/50: DataComm - Lesson 1: "Basic Skeleton"
  40. ||||> Permanent Message
  41. Name: Lazerith #1
  42. Date: Mon Dec 12 20:56:38 1988
  43.  
  44. The basic structure of all of my assembly language projects is the same.  In
  45. assembly, one quickly learns to be consistant.  To fail to do so is to insure
  46. Never Ending Project from Hell and Everlasting Work! (NEPHEW).  Therefore this
  47. is the basic structure of ALL assembly language I'll show you:
  48.  
  49. .Model Small            <- The .Model directive specifies the default style of
  50.                            your code in Masm 5.10.  A "SMALL" indicates that
  51.                            you expect your code to all reside within 1 block
  52.                            of 64k memory and that each of you code segments
  53.                            will themselves take up only 64k. (Information on
  54.                            segments will follow).
  55.  
  56. .8086                   <- Tells assembly to code ONLY for 8086 (Unnecessary)
  57.  
  58. .data                   <- Tells assembler that an initialized data segment
  59.                            follows.
  60.  
  61. txtCOPYR  db  "Copyright (C) 1988 - By the Möebius Group"
  62.  
  63.                            Defines a location called "txtCOPYR" which will
  64.                            contain the string "Copyright...Group"
  65.  
  66. .code                   <- Tells assembler that a code segment follows
  67.  
  68. Main Proc Far           <- Tells assembler that a procedure called "Main"
  69.                            follows which is in a "Far" segment (later).
  70.     push ds             <- Pushes the value of register DS on to stack
  71.                    (again, I'll explain these later).
  72.     mov  ax,0           <- Moves a zero into register AX.
  73.     push ax             <- Pushes a zero (in AX) onto stack.
  74.  
  75. ; Program starts here
  76.     nop                 <- Does nothing "No OPeration"
  77.  
  78. ; Program ends here
  79.     ret                 <- Return to previous routine (DOS)
  80.  
  81. Main Endp               <- Tells assembler that this is the end of "Main"
  82.  
  83. .stack                  <- Tells assembler to make a stack and put it here
  84.  
  85. End Main                <- Tells assembler that this is the end of the file
  86.                            and that execution should begin with the routine
  87.                            called "Main"
  88.  
  89. Now, enter the yellow words into the file exactly as is and run it.  Don't ask
  90. questions, I'll explain everything in time.  This should work as is.
  91.  
  92. The commands are "MASM DataComm.asm;"  followed by "LINK DataComm;"  This
  93. should work, if not, let me know.
  94.  
  95. Lazerith
  96.  
  97.  
  98.  
  99. Read:(1-50,^4),? :
  100.  
  101. 9/50: ASSEMBLY
  102. Name: White Knight #124
  103. Date: Wed Dec 21 10:31:05 1988
  104.  
  105.  
  106.    I have a few questions.  Some of them may sound dumb, but please bear
  107. through with me.  They are:
  108.  
  109. 1. How do I know if my CPU is 8088/8086 or Other?
  110.  
  111. 2. What is Masm 5.10?
  112.  
  113. 3. What is the difference between Move and Push?
  114.  
  115. 4. Could I d/l MicroSoft 5.10 and Brief?
  116.  
  117. I would appreciate any help.  This is a great sub and I hope Lazerith
  118. continues in it.
  119.  
  120. Later.
  121.  
  122.  
  123.  
  124. Read:(1-50,^9),? :
  125.  
  126. 10/50: Answers
  127. ||||> Permanent Message
  128. Name: Lazerith #1
  129. Date: Wed Dec 21 15:15:17 1988
  130.  
  131. 1. How can I tell what CPU I have?
  132.    Easiest way is to run Norton's SI.EXE (System Information) or similar
  133. program.  As to 8086 vs 8088, I don't think there's any way to tell except
  134. to look at the serial number on the chip.
  135.  
  136. 2. What is MASM 5.10?
  137.    That's the name of Microsoft's Macro Assembler version 5.10, the latest and
  138.    greatest assembler available (from Microsoft).  This latest version adds a
  139.   whole series of simplifications for quicker programming.
  140.  
  141. 3. What is Move vs. Push?
  142.    In assembler a MOV instruction (Move) copies a value from one place to
  143. another - usually between registers and memory. It's very general purpose
  144. and can be used to copy from anywhere to anywhere.  PUSH on the other hand
  145.    is a very SPECIALIZED type of move.  It copies the value "onto the stack."
  146.    The stack is a specialized area of memory used by the cpu to remember
  147. things that go on between your various subroutines and programs.  For
  148. instance, when you call, say, a Print routine, the cpu must remember where
  149. you called from (in order to return there).  Also the stack is often used
  150.    to pass parameters.  In our example, you could push the string to be
  151. written onto the stack, to be read by the next subroutine.
  152.       The stack operates like (the classic example) a stack of plates at a
  153. cafeteria.  That is, as you push plates onto the stack, each new plate is
  154.    at the top.  When you call to pull then off the stack, you receive them in
  155.   the LAST PUSHED FIRST POPPED order (better known as LAST IN FIRST OUT or
  156. LIFO).  The command in assembler to recover the last pushed is "POP".
  157.  
  158. Lazerith
  159.  
  160.  
  161.  
  162. 12/50: Help...
  163. Name: Dr. Poison #46
  164. Date: Fri Dec 23 17:59:19 1988
  165.  
  166. I am writing a program using Turbo Pascal 4.0 and I am looking for a way to
  167. determine what character is located at a specific position on the screen.
  168.  
  169. For example, I would like a way to figure out what character is at position
  170. 15,3; which should return some sort of ascii equivalent at fifteen units
  171. across and three units down (or something similar).
  172.  
  173. Any help would be greatly apreciated.
  174.  
  175. Dr. Poison
  176.  
  177.  
  178. 13/50: ...
  179. Name: Def Jim #54
  180. Date: Sat Dec 24 13:29:40 1988
  181.  
  182. There's two basic ways to do it.
  183.  
  184. You can directly check screen memory to get the value.  This involves
  185. computing the address in screen memory where you want to check and then simply
  186. reading it.  You can accomplish this through the mem[] array of Turbo Pascal
  187. (if it still exists past TP 3.0).  The only drawback to this method is that
  188. the computation formula will change depending if you have a CGA, a MCA, a EGA,
  189. or what have you.  These all arrange their screen memory differently.
  190.  
  191. The second way gets around the problems with different screen types.  You use
  192. a particular INT 10H function to get the contents of the screen.  I don't have
  193. any books here at home for it, but I think you have to set the cursor position
  194. to the location you want (using INT 10H) and then read the contents at the
  195. cursor position (using INT 10H).  This method is the 'portable' one working
  196. across all display types.  I'm sure someone will post the details on this
  197. method.
  198.  
  199.  
  200. 14/50: READING the screen.
  201. Name: Lazerith #1
  202. Date: Sat Dec 24 14:18:05 1988
  203.  
  204. In assembly langauge the ONLY efficient way to it is to use the Int 10h
  205. function to read the characters off the screen.  This routine figures out
  206. which mode your in and on which card and reads it as appropriate.  IT EVEN
  207. READS OFF OF GRAPHICS SCREENS.
  208.  
  209. Now Pascal VERY probably has the same routine, but I don't have the chance to
  210. go check now.  So in a little bit I'll either post an INLINE function (that
  211. is, using assembly INSIDE dos) or the appropriate pascal routine.
  212.  
  213. -Lazerith
  214.  
  215.  
  216.  
  217. Read:(1-50,^14),? :
  218.  
  219. 15/50: Thanks,
  220. Name: Dr. Poison #46
  221. Date: Sat Dec 24 23:28:30 1988
  222.  
  223. Please elaborate on INT 10h when you get a chance.
  224.  
  225. Dr. Poison
  226.  
  227.  
  228.  
  229. Read:(1-50,^15),? :
  230.  
  231. 16/50: Reading the Screen using BIOS
  232. Name: Gryps Rex #2
  233. Date: Sun Dec 25 23:02:35 1988
  234.  
  235. there are several BIOS functions that allow a programmer to read from the
  236. screen. They are:
  237.  
  238.     function 3: read cursor position
  239.  
  240.          AH = 3
  241.          BH = video page number (0-7)
  242.  
  243.     function 8: read attribute/character at cursor position
  244.  
  245.          AH = 8
  246.          BH = video page number (0-7)
  247.     return:
  248.          AL = character read
  249.          AH = attribute of character (in alphga modes only)
  250.  
  251. (IBM BIOS Tech Ref Apr87)
  252.  
  253. -Gryps Rex
  254.  
  255.  
  256.  
  257. 17/50: That
  258. Name: Megaton Man #61
  259. Date: Sun Dec 25 23:20:16 1988
  260.  
  261.  
  262.  
  263. in Turbo Pascal 3.0 they have a procedure MsDOS (var);
  264.  
  265. In turbo Pascal 4.0 it dont have it...
  266.  
  267. I was wondering how to do Assembly INterrupt or Dos Calls in TP...
  268.  
  269. Teach me how to do INLINE in tp...
  270.  
  271. meg
  272.  
  273.  
  274. 18/50: DOS/BIOS Interrupts
  275. Name: Gryps Rex #2
  276. Date: Mon Dec 26 10:51:08 1988
  277.  
  278. You CAN use the INTR() procedure in Turbo Pascal 4.0/5.0 and it has the
  279. following syntax:
  280.  
  281.     Intr( IntNo : byte; var Regs : Registers )
  282.  
  283. example:
  284.  
  285.     { set the cursor position using BIOS }
  286.     procedure locate(row, column : integer)
  287.     var
  288.          regs : registers;
  289.     begin
  290.          regs.ax = $200;
  291.          regs.bx = 0;
  292.          regs.dx = (row * 256) + column;
  293.          Intr($10,regs)
  294.     end; { locate }
  295.  
  296. to access the Registers type, you must include the Dos unit in the uses
  297. statement at the top of your code (i.e. Uses Crt, Dos; )
  298.  
  299.  
  300. -Gryps Rex
  301.  
  302.  
  303.  
  304. 19/50: DataComm - Lesson 2: "Out1"
  305. ||||> Permanent Message
  306. Name: Lazerith #1
  307. Date: Mon Dec 26 17:48:34 1988
  308.  
  309. Ok, if you're not keeping up with this feedback!
  310.  
  311. The most important (and usually first) routine is always the "Out1" routine
  312. which will output 1 character to the screen.  Later on, we'll make this into a
  313. wonderfully complicated routine, but for now, it'll just be DOS.
  314.  
  315. Immediately ahead of "Main Proc Far" insert:
  316.  
  317. Out1          Proc Near           <-Indicates a "Near" routine (Within 64k)
  318.  
  319.     push      dx                  <-Store DX, because we're screwing with it.
  320.     push      ax                  <-Store AX, ditto
  321.     mov       dl,al               ; dl=Character to Output (Passed in AL)
  322.     mov       ah,6                ; ah="DOS: Direct I/O"
  323.     int       21h                 ; Call DOS service AH (6) Outputs to Screen
  324.     pop       ax                  <-Restores AX
  325.     pop       ax                  <-Restores DX (Note the reverse order)
  326.     ret                           <-Return to caller
  327.  
  328. Out1          Endp                <-End of procedure
  329.  
  330. Inside Main (after "mov ds,ax") add:
  331.  
  332.     mov       al,"H"              ; al="H"
  333.     call      Out1                ; Output "H"
  334.     mov       al,"e"              ; al="e"
  335.     call      Out1                ; Output "e"
  336.     mov       al,"l"              ; al="l"
  337.     call      Out1                ; Output "l"
  338.     call      Out1                ; Output "l"
  339.     mov       al,"o"              ; al="o"
  340.     call      Out1                ; Output "o"
  341.     mov       al,0Dh              ; al=Carriage Return
  342.     call      Out1                ; Output CR
  343.     mov       al,0Ah              ; al=Linefeed
  344.     call      Out1                ; Output LF
  345.  
  346. File it, Compile it, Run it.
  347.  
  348. Lazerith
  349.  
  350.  
  351.  
  352. 20/50: DataComm - OOPS!
  353. ||||> Permanent Message
  354. Name: Lazerith #1
  355. Date: Mon Dec 26 18:12:03 1988
  356.  
  357. Uh, rather than inserting the second stuff after "mov ds,ax" (which isn't in
  358. the code anywhere ... heh); replace the line "nop" with the code...
  359.  
  360. To keep things straight, the whole asm file is now in the TEXT dload section!
  361.  
  362. -Lazerith
  363.  
  364.  
  365.  
  366. 21/50: A Question bout 'C' and WWIV
  367. Name: Jolly Green Giant #5
  368. Date: Wed Dec 28 11:51:32 1988
  369.  
  370.  
  371.     If someone istalls one of the mods called the FROM mod how can you make it
  372. so you change it in the UEDIT instead of just viewing it?
  373.  
  374.  
  375.  
  376.  
  377. Read:(1-50,^21),? :
  378.  
  379. 22/50: ...
  380. Name: Def Jim #54
  381. Date: Wed Dec 28 23:22:41 1988
  382.  
  383. I assume "we're" going to be moving past OUT1 and have a OUTSTR function
  384. posted, right?
  385.  
  386.  
  387.  
  388. Read:(1-50,^22),? :
  389.  
  390. 23/50: DataComm - Lesson 3: "Out$" (aka OutStr)
  391. ||||> Permanent Message
  392. Name: Lazerith #1
  393. Date: Thu Dec 29 03:39:03 1988
  394.  
  395. As Def Jim predicted, calling Out1 with every letter in your messages is
  396. extremely inefficient, so we'll need a string handling routine.  There are
  397. three popular methods of string handling: Asciiz, Highbit, and Count.
  398. Asciiz:  Strings are terminated by a null (ascii 00h) like this:
  399.               "This is an asciiz string",0
  400.          This method is unquestionably the most flexible allowing 65535
  401.          characters in a string and allow 255 (all except 00) as characters.
  402.  
  403. Highbit: Strings are terminated by the last character having the highbit set
  404.          like this:
  405.               "This is a highbit strin","g"+128
  406.          This method is common among programs with space restrictions because
  407.          it saves one byte per string.  Strings can be 65536 characters long
  408.          like in asciiz, but are limited to characters 00-7F (0-127).
  409.  
  410. Count:   Strings are preceded by a count like this:
  411.               24,"This is a highbit string"
  412.          This method allows for FAST string manipulation (like centering,
  413.          windowing, etc. It also allows all 256 characters to be in the
  414.   string.  The major limitation, however, is that strings can only be
  415.          as long as the count will allow (here we've used bytes which would
  416.          limit our strings to 255 characters in length).
  417. Dos:     Oh yeah, then there's the way DOS does it:
  418.               "This is a dos string$"
  419.          It is the same basic method as asciiz except that some moron
  420. somewhere decided to use a displayable character ("$") as a
  421.          terminating character.  It's just fine it you never have to use
  422.          a dollar-sign...  (Here that Lotus?)
  423.  
  424. Naturally, we'll be using Asciiz.  This is because, A) we don't have a space
  425. limitation, B) it allows us to display the range of characters 01-FE (FF is
  426. undisplayable thanks to a limitation of our Out1 routine handed down from DOS,
  427. but is not a problem because both 00 and FF display as spaces anyway), and C)
  428. it is not very complicated (or indeed very slow) to count the length of our
  429. strings using 8086 string functions.
  430.  
  431. The following post will include the routine, if you're falling behind, tell me.
  432.  
  433. -Lazerith
  434.  
  435.  
  436. 24/50: DataComm - Lesson 3: "Out$"
  437. ||||> Permanent Message
  438. Name: Lazerith #1
  439. Date: Thu Dec 29 04:07:59 1988
  440.  
  441. Remove all the code insert previously between the ";code begins here" and
  442. ";code ends here" and replace it with:
  443.  
  444.     lea  si,txtCOPYRIGHT               ; ds:si>"Copyright..."
  445.     call Out$
  446.  
  447. And AFTER Out1 and BEFORE Main add this procedure:
  448.  
  449. Out$     Proc Near
  450.  
  451.     push si
  452.     push ax
  453. @@: lodsb                              ; al=character from string
  454.     or   al,al                         ; Is character end-of-line?
  455.     jz   @f                            ; If so, exit
  456.     call Out1                          ; Display character
  457.     jmp  short @b                      ; Loop thru string
  458. @@: pop  ax
  459.     pop  si
  460.     ret
  461.  
  462. Out$     Endp
  463.  
  464. Explanations of all the new commands will follow this post.
  465.  
  466. -Lazerith
  467.  
  468.  
  469. 25/50: DataComm - Lesson 3: Out$ ----- Commentary
  470. ||||> Permanent Message
  471. Name: Lazerith #1
  472. Date: Thu Dec 29 04:15:08 1988
  473.  
  474. A lot of new commands have popped up I need to explain:
  475.  
  476. push     Tells the CPU to push the word onto the stack to be popped off later.
  477. pop      Recovers a previously pushed word into target register.
  478.  
  479. @@:      Under Masm 5.10, this is a local label to which the next two refer.
  480. jmp @b   References the previous ("back") @@ label.
  481. jmp @f   References the next ("forward") @@ label.
  482. (These instructions take up no symbol space by always using the same label.)
  483.  
  484. lodsb    A 8086 command the Loads from DS:SI into AL and increments SI.
  485. or al,al A neat trick. By "or'ing" a reg with itself, sets ZF if reg is zero.
  486. jmp SHORT label
  487.          The short tells the processor that the jump is within 127 bytes.
  488.  
  489. I can explain further any questions you have.  Indeed, I'm being intentionally
  490. obscure so I know if any of this is helping!
  491.  
  492. -Lazerith
  493.  
  494.  
  495.  
  496. 26/50: @@:
  497. Name: Megaton Man #61
  498. Date: Fri Dec 30 15:57:00 1988
  499.  
  500.  
  501. @@: dont work with Turbo Assembler right? Cause I tried it.
  502. The rest.... well.... review to me... But keep going.... Very interesting!
  503.  
  504. Oh, How can you change Colors in Assembly!
  505. wait wait!!!! GRYPS!!
  506.  
  507. When you showed the INTR(xxx) for TP 4.0 adn 5.0 what about DOS FUNCTIONS!
  508.  
  509. You only showed BIOS Interrupts!
  510.  
  511. Meg
  512.  
  513.  
  514.  
  515. Read:(1-50,^26),? :
  516.  
  517. 27/50: DOS Interrupts ...
  518. Name: Gryps Rex #2
  519. Date: Fri Dec 30 16:08:14 1988
  520.  
  521. Basically they follow the same approach with the exception that the interrupt
  522. number is 21 hex (33 dec). Use of the OFS() and SEG() functions are permitted
  523. when using registers. Example:
  524.  
  525.     var regs : registers;
  526.  
  527.     begin
  528.          regs.ax = $1a00;
  529.          regs.bx = ofs(data);
  530.          regs.es = seg(data);
  531.          intr($21,regs)
  532.  
  533. and so forth...
  534.  
  535.  
  536. -Gryps Rex
  537.  
  538.  
  539.  
  540. Read:(1-50,^27),? :
  541.  
  542. 28/50: Also ...
  543. Name: Gryps Rex #2
  544. Date: Fri Dec 30 16:15:45 1988
  545.  
  546. Just checking the manual, page 448, regarding the MsDos function. The
  547. interrupt number is not required in this case.
  548.  
  549.     var regs : registers;
  550.  
  551.     begin
  552.          regs.ax := $1A00;
  553.          regs.bx := ofs(data);
  554.          regs.es := seg(data);
  555.          msdos(regs);
  556.     end;
  557.  
  558. same as above.
  559.  
  560.  
  561. -Gryps Rex
  562.  
  563.  
  564.  
  565. Read:(1-50,^28),? :
  566.  
  567. 29/50: Procedure Locate
  568. Name: Dr. Poison #46
  569. Date: Fri Dec 30 20:32:35 1988
  570.  
  571. The procedure Locate works fine, but for those of us who aren't very good at
  572. assembly, how would I find what character/atrribute is at that location?
  573. (Using Turbo Pascal 4.0).
  574.  
  575. Dr. Poison
  576.  
  577.  
  578.  
  579. 32/50: Turbo Tutor
  580. Name: Gryps Rex #2
  581. Date: Sat Dec 31 01:25:26 1988
  582.  
  583. program readscreen;
  584.  
  585. uses crt, dos;
  586.  
  587. var
  588.     screen_segment : word;
  589.  
  590. function ReadCharAttrAtCursor : word;
  591. var
  592.     regs : registers;
  593. begin
  594.     regs.ax := $0800;
  595.     regs.bx := $0000;
  596.     intr($10,regs);
  597.     ReadCharAttrAtCursor := regs.ax;
  598. end;
  599.  
  600. function FasterRead : word;
  601. var
  602.     regs : registers;
  603. begin
  604.     regs.ax := $0300;
  605.     regs.bx := $0000;   { this is the video page, in lo byte }
  606.     intr($10,regs);     { read the current cursor position }
  607.     FasterRead := mem[screen_segment:(lo(regs.dx)*2+hi(regs.dx)*160)];
  608. end;
  609.  
  610. var
  611.     regs : registers;
  612. begin
  613.     intr($11,regs);
  614.     if (regs.ax and $30) then screen_segment := $B000
  615.     else screen_segment := $B800;
  616.     .
  617.     .
  618.     writeln('Character/attribute at 10,10 is: ',FasterRead);
  619.     .
  620.     .
  621. end.
  622.  
  623. or something like that, but the 'FasterRead' is faster.
  624.  
  625. -Gryps Rex
  626.  
  627.  
  628.  
  629. 34/50: ...
  630. Name: Def Jim #54
  631. Date: Sat Dec 31 16:48:37 1988
  632.  
  633. Some routines and services from other operating systems store the strings
  634. delimted by C/Rs.  The ASCIIZ method is the preferred method considering the
  635. fact that you probably want to write the routine to handle arguments from your
  636. HLL C program.  ASCIIZ is the method used in C/Unix.  The len+string method is
  637. used in BASIC and TP.
  638.  
  639. I didn't read the code, but are you using BIOS functions for the I/O, or are
  640. you going straight to the port?
  641.  
  642.  
  643.  
  644. Read:(1-50,^37),? :
  645.  
  646.  
  647.  
  648. 44/50: VGA test
  649. Name: Gryps Rex #2
  650. Date: Mon Jan 09 23:59:13 1989
  651.  
  652. from the C:\> prompt type the following:
  653.  
  654. debug <CR>
  655. a
  656. mov ax,13
  657. int 10
  658. <CR>
  659. p=100
  660. p
  661.  
  662. now, if nothing happens, then you don't have TRUE VGA.
  663.  
  664.  
  665. 46/50: Assembling MASM 5.10 code with TASM ...
  666. Name: Gryps Rex #2
  667. Date: Wed Jan 11 15:57:28 1989
  668.  
  669. tasm /jMASM51 /jQUIRKS [options] filename
  670.  
  671. this enables the Turbo Assembler to assemble the code that you use with
  672. Microsoft Macro Assembler 5.10
  673.  
  674.  
  675. -Gryps Rex
  676.  
  677.  
  678. 47/50: Um, a Question.
  679. Name: Io Lisp #113
  680. Date: Tue Jan 17 14:54:39 1989
  681.  
  682.  
  683.     In Assembly, how do you display Graphics ? I.e., how would you put a
  684. single dot on the screen at location 1,1 ?
  685.  
  686. ═╦═╔═╗  ╔  ═╦═╔═╔═╗
  687. ═╩═╚═╝  ╚═══╩═╝ ║═╝
  688.  
  689.  
  690.  
  691. 48/50: Okay.
  692. Name: Lazerith #1
  693. Date: Wed Jan 18 11:08:30 1989
  694.  
  695. To perform graphics, understand the screen first:
  696.  
  697. In AlphaNumeric mode (That would be modes 0-3...) Data stored at B800:0000
  698. thru B800:1000 (approximately) is used to display characters (and no graphics)
  699. on the screen, like this:
  700.  
  701. B800:0000
  702.    41 07 42 07 43 07 44 07 45 07
  703.    ^     ^     ^     ^     ^
  704.    "A"   "B"   "C"   "D"   "E"
  705.  
  706. The "07" represents "White Characters on a Black Background".
  707.  
  708. In a Graphics mode, data stored at B800:0000 now represents pixel information.
  709. In mode 6 (Black and White 640x200) the pixel information is like this:
  710.  
  711. 47h = 01000111b = " .   ..." pixels (white on black).
  712. 6Ch = 01101100b = " .. ..  " p
  713. 98h = 10011000b = ".  ..   " p
  714.  
  715. As you can see (I hope) every bit in the hex number equals a bit on the
  716. screen.  To put it more simply: In either graphics or alphanumeric mode, the
  717. display interprets the data stored at B800:0000 to form either characters or
  718. graphics.
  719.  
  720. In some modes the base paragraph is not B800, but A000 or B000 or something
  721. like that.
  722. In some modes every other pixel might be color information like:
  723.    00b = Black (or Background)
  724.    01b = Color 1
  725.    10b = Color 2
  726.    11b = White (or Color 3)
  727. Etc...
  728.  
  729. More?
  730. -Lazerith
  731.  
  732.  
  733.  
  734.  
  735. 49/50: I'm hoping this isn't very long,
  736. Name: Io Lisp #113
  737. Date: Wed Jan 18 16:42:59 1989
  738.  
  739.  
  740.     But how do you change screen modes then?
  741.  
  742.     The Beginner,                IoLisp
  743.  
  744.  
  745.  
  746.  
  747. Read:(1-50,^49),? :
  748.  
  749. 50/50: Video Modes
  750. Name: Lazerith #1
  751. Date: Wed Jan 18 18:57:35 1989
  752.  
  753. Video Modes are numbered by IBM and can be engaged by BIOS.  They are:
  754.  
  755. 0 - Alpha/Numeric 40x25 Black & White
  756. 1 - Alpha/Numeric 40x25 Color
  757. 2 - Alpha/Numeric 80x25 Black & White
  758. 3 - Alpha/Numeric 80x25 Color
  759. 4 - Graphics 320x200 4-Color
  760. 5 - Graphics 320x200 4-Black & White
  761. 6 - Graphics 640x200 2-Black & White
  762. 7 - Monochrome Alpha/Numeric 80x25
  763. 13 - Graphics 320x200 16-Color
  764. 14 - Graphics 640x200 16-Color
  765. 15 - Graphics 640x350 2-Black & White
  766. 16 - Graphics 640x350 16-Color
  767. 17 - Graphics 640x480 2-Color
  768. 18 - Graphics 640x480 16-Color
  769. 19 - Graphics 320x200 256-Color
  770.  
  771. The number of modes available to you is directly dependant on which video card
  772. you have.  For instance CGA only allows you to use modes 0 thru 6.
  773.  
  774. To engage the mode use BIOS call 10h (<- That's 16 in decimal...) like this:
  775.  
  776. mov al,VideoMode        ; al=Video Mode number
  777. xor ah,ah               ; ah=BIOS Service 00
  778. int 10h                 ; Call BIOS to set mode.
  779.  
  780. It's that easy.
  781.  
  782. -Lazerith
  783.  
  784.  
  785.  
  786.