944,205 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 900
  • Assembly RSS
Nov 6th, 2009
0

Noob looking for guidance

Expand Post »
Hi, I was using C++ to try to write objects to the screen, and decided to try this in a lower level language. I have searched the web and found some sample code:

Assembly Syntax (Toggle Plain Text)
  1. name "vga"
  2.  
  3. ; this program draws a tiny rectangle in vga mode.
  4.  
  5. org 100h
  6.  
  7. jmp code
  8.  
  9. ; dimensions of the rectangle:
  10. ; width: 10 pixels
  11. ; height: 5 pixels
  12.  
  13. w equ 10
  14. h equ 5
  15.  
  16.  
  17. ; set video mode 13h - 320x200
  18.  
  19. code: mov ah, 0
  20. mov al, 13h
  21. int 10h
  22.  
  23.  
  24. ; draw upper line:
  25.  
  26. mov cx, 100+w ; column
  27. mov dx, 20 ; row
  28. mov al, 15 ; white
  29. u1: mov ah, 0ch ; put pixel
  30. int 10h
  31.  
  32. dec cx
  33. cmp cx, 100
  34. jae u1
  35.  
  36. ; draw bottom line:
  37.  
  38. mov cx, 100+w ; column
  39. mov dx, 20+h ; row
  40. mov al, 15 ; white
  41. u2: mov ah, 0ch ; put pixel
  42. int 10h
  43.  
  44. dec cx
  45. cmp cx, 100
  46. ja u2
  47.  
  48. ; draw left line:
  49.  
  50. mov cx, 100 ; column
  51. mov dx, 20+h ; row
  52. mov al, 15 ; white
  53. u3: mov ah, 0ch ; put pixel
  54. int 10h
  55.  
  56. dec dx
  57. cmp dx, 20
  58. ja u3
  59.  
  60.  
  61. ; draw right line:
  62.  
  63. mov cx, 100+w ; column
  64. mov dx, 20+h ; row
  65. mov al, 15 ; white
  66. u4: mov ah, 0ch ; put pixel
  67. int 10h
  68.  
  69. dec dx
  70. cmp dx, 20
  71. ja u4
  72.  
  73.  
  74. ; pause the screen for dos compatibility:
  75.  
  76. ;wait for keypress
  77. mov ah,00
  78. int 16h
  79.  
  80. ; return to text mode:
  81. mov ah,00
  82. mov al,03 ;text mode 3
  83. int 10h
  84.  
  85. ret
Again, I did not write this, I found it at http://www.emu8086.com/dr/asm2html/a...phics.asm.html

My question is how would I go about compiling said code?
Similar Threads
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
dylank is offline Offline
66 posts
since Oct 2009
Nov 6th, 2009
0
Re: Noob looking for guidance
This is assembly language.

See these links for more information
Reputation Points: 13
Solved Threads: 19
Junior Poster
jomanlk is offline Offline
103 posts
since Oct 2009
Nov 6th, 2009
0

Yea, well, thanks

Click to Expand / Collapse  Quote originally posted by jomanlk ...
This is assembly language.

See these links for more information
Well, thanks for the help. Better than an STFW or RTFM i guess, I found a compiler (and emu) called emu8086.
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
dylank is offline Offline
66 posts
since Oct 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Needing some guidance
Next Thread in Assembly Forum Timeline: C and Assembly Mixed-Mode Hex comparison program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC