UMBC CMSC 313 -- Assembly Language Segment  


datatypes.asm

;; 	 [ The .data section ]		
	
section .data
junkb:    db    -2
junkw:    dw	-1
junkd:    dd    -4
junkq:    dq    -8.0  
junk1:    dw    10h
junk2:    dw    0x10

;; [ The .bss section ]
section .bss
foob:	resb	1
foow:	resw 	1
food:	resd	1
fooq:	resq	1

;; [ The .text section ]
section .text
    global main                       ;must be declared for linker (ld)
;; just like main in C -- if linking with gcc, must be main, otherwise does not have to.

main:                                 ;tell linker entry point

;; put your code here

	nop
	mov	eax, 5
	inc	eax
	mov	[foow], eax
	mov	[foow], word 10h
	mov	[food], dword 0x20
	mov	[foob], byte 48
 	mov	bx, [junkw]
	dec	bx
	mov	[junkw], bx








;; The final part of the program must be a call to the operating system to exit
;;; the program.
        mov     ebx,0   ;successful termination of program
        mov     eax,1   ;system call number (sys_exit)
        int     0x80    ;call kernel

;; Notice the file just ends.


Lecture Schedule | CMSC313 page

©2004, Gary L. Burt