UMBC | CMSC 313 -- Assembly Language Segment | Previous | Next |
;; [ The .data section ] ;; This section is for defining constants, such as filenames or buffer sizes, ;; It includes the initialized variables :: They look something like this: ;; ;; var1 db 31 ;; var2 dw -1 section .data ;; [ The .bss section ] ;; This section is where you declare your uninitialized variables. ;; They look something like this: ;; ;; filename: resb 255 ; REServe 255 Bytes ;; number: resb 1 ; REServe 1 Byte section .bss ;; [ The .text section ] ;; ;; This is where the actual assembly code is written. 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 ;; 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.