home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / nasmide.zip / examples / BINTEST.ASM < prev    next >
Assembly Source File  |  1997-12-28  |  2KB  |  59 lines

  1. ; Information
  2. ; ▀▀▀▀▀▀▀▀▀▀▀
  3. ;
  4. ;  Program Title : NASM-IDE .COM executable file demo
  5. ;  External name : BINTEST.COM
  6. ;  Version       : 1.0
  7. ;  Start date    : 21/12/1997
  8. ;  Last update   : 21/12/1997
  9. ;  Author        : Rob Anderton
  10. ;  Description   : A simple example of a DOS .COM file programmed using
  11. ;                  NASM-IDE 1.1 and NASM 0.95.
  12.  
  13.  
  14. [BITS 16]                    ; Set 16 bit code generation
  15. [ORG 0x0100]                 ; Set code start address to 100h (COM file)
  16.  
  17. [SECTION .text]              ; Section containing code
  18.  
  19.     jmp    START             ; Jump to label 'START' in .text section
  20.  
  21. END:                         ; Define label 'END'
  22.  
  23.     mov    ax, $4C00         ; This function exits the program
  24.     int    $21               ; and returns control to DOS.
  25.  
  26. START:    
  27.  
  28.     mov    BYTE [bss_sym], 'I'   ; Reference a symbol in the .bss section
  29.     mov    bx, [bssptr]             ; Reference a symbol in the .data section
  30.     mov    al, [bx]
  31.     mov    bx, [DATAPTR]    
  32.     mov    [bx], al
  33.     mov    cx, 2
  34.  
  35. .LOOP:                           ; Define a local label
  36.  
  37.     mov    dx, datasym    
  38.     mov    ah, 9
  39.     push   cx
  40.     int    $21
  41.     pop    cx
  42.     loop   .LOOP        
  43.     mov    bx, [textptr]    
  44.     jmp    bx
  45.  
  46.  
  47. [SECTION .data]                 ; Section containing initialised data
  48.  
  49. datasym      db 'NASM-EDE!', 13, 10, '$'
  50. bssptr      dw bss_sym        
  51. DATAPTR      dw datasym + 5    
  52. textptr      dw END            ; Pointer to a label in the .text section
  53.  
  54.  
  55. [SECTION .bss]                  ; Section containing unitialised data
  56.  
  57. bss_sym      resb 1        ; Reserve 1 byte of data
  58.  
  59.