home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / PASTUT34 / ASSEMBLY.TXT < prev    next >
Text File  |  1990-03-24  |  3KB  |  44 lines

  1.                    ASSEMBLY LANGUAGE EXAMPLE.
  2.                    --------------------------
  3.  
  4. This simple example shows how to place numerical values into a chosen
  5. part of the data segment of memory. The offset values, starting at 
  6. 0400, are seen below in the MOV WORD PTR [0400] statement.
  7.  
  8. The whole process is controlled from the DEBUG utility.
  9.  
  10. A:>debug
  11. -a 0100
  12. 4DFC:0100 mov word ptr [0400],1234   {                                           
  13. 4DFC:0106 mov word ptr [0402],5678   {  Four lines for placing words                                         
  14. 4DFC:010C mov byte ptr [0404],90     {  or byte in consecutive memory                                         
  15. 4DFC:0111 mov word ptr [0405],abcd   {  locations.                                         
  16. 4DFC:0117 int 20                     {  Interrupt to terminate program.                                           
  17. 4DFC:0119                                                                       
  18. -r cx                                {  To check value in CX register.                                           
  19. CX 0000                                                                         
  20. :19                                  {  New value of 19 entered.                                           
  21. -n assem.com                         {  Program named ASSEM.COM                                           
  22. -w                                   {  Program written to disk.                                           
  23. Writing 0019 bytes                                                              
  24. -g                                   {  Program run.                                           
  25.                                                                                 
  26. Program terminated normally                         
  27.                             
  28. -d ds:0400                           {  'Dump' of part of data segment.
  29.                                            
  30. 4DFC:0400  34 12 78 56 90 CD AB 00-00 00 00 00 00 00 00 00   4.xV............   
  31. 4DFC:0410  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................   
  32. 4DFC:0420  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................   
  33. 4DFC:0430  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................   
  34. 4DFC:0440  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................   
  35. 4DFC:0450  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................   
  36. 4DFC:0460  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................   
  37. 4DFC:0470  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................   
  38. -q
  39.  
  40. It can clearly be seen that the appropriate numerical values have been
  41. placed in memory. Note that the low byte always appears first, so that 
  42. 1234 appears as 34 12. Note also that debug dump attempts to interpret
  43. the contents of memory. 34 is the ASCII value for decimal value 4 and
  44. 78 is ASCII value for x, etc.