i am trying to learn assembly language but I have to spent a dozen of hours to get a .asm code run on my intel core i5 win 7 laptop with nasm. the problem is most books of assembly code have .Section,.Data in it.and when i compile it it always give error,no matter even it is hello world rogram.
program which run (nasm)
org 100h
mov dx,string
mov ah,9
int 21h
mov ah,4Ch
int 21h
string db 'Hello, World!',0Dh,0Ah,'$'
program with this format dont run
%include  "io.mac"
.STACK 100H
.DATA
number_prompt  db  "Please type a number (<11 digits): ",0
out_msg        db  "The sum of individual digits is: ",0
.UDATA
number         resb  11
.CODE
        .STARTUP
        PutStr  number_prompt  ; request an input number
        GetStr  number,11    ; read input number as a string
        nwln
        mov     EBX,number   ; EBX = address of number
        sub     DX,DX        ; DX = 0 -- DL keeps the sum
repeat_add:
        mov     AL,[EBX]     ; move the digit to AL
        cmp     AL,0         ; if it is the NULL character
        je      done         ;  sum is done
        and     AL,0FH       ; mask off the upper 4 bits
        add     DL,AL        ; add the digit to sum
        inc     EBX          ; update EBX to point to next digit
        jmp     repeat_add   
done:
        PutStr  out_msg
        PutInt  DX           ; write sum
        nwln
        .EXIT
please help as books come only with later format.
 
     
     
     
    