Difference between revisions of "CSC231 skel.asm"

From dftwiki3
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
;;;
 
;;;
 
;;;    nasm -f elf -F  stabs program.asm
 
;;;    nasm -f elf -F  stabs program.asm
;;;    ld -o program program.o
+
;;;    ld -melf_i386  -o program program.o
 
;;;    ./program
 
;;;    ./program
 
;;; -------------------------------------------------------------------
 
;;; -------------------------------------------------------------------
Line 16: Line 16:
 
;%include files here...
 
;%include files here...
  
EXIT    equ            1
+
   
WRITE  equ            4
 
STDOUT equ            1
 
 
          
 
          
 
       ;; ------------------------------------------------------------
 
       ;; ------------------------------------------------------------
Line 44: Line 42:
 
;; exit()
 
;; exit()
  
mov eax,EXIT
+
mov eax,1
 
mov ebx,0
 
mov ebx,0
 
int 0x80 ; final system call
 
int 0x80 ; final system call

Latest revision as of 08:30, 2 September 2014

--D. Thiebaut 19:56, 7 September 2010 (UTC)


;;; program_name.asm
;;; your name
;;; 
;;; a description of the program
;;;
;;; to assemble and run:
;;;
;;;     nasm -f elf -F  stabs program.asm
;;;     ld -melf_i386  -o program program.o
;;;     ./program
;;; -------------------------------------------------------------------

;%include files here...

 
        
      	;; ------------------------------------------------------------
	;; data areas
	;; ------------------------------------------------------------

	section	.data

        
	;; ------------------------------------------------------------
	;; code area
	;; ------------------------------------------------------------

	section	.text
	global	_start

_start:


        ;; (add your code here!!!!)
        

        

	;; exit()

	mov	eax,1
	mov	ebx,0
	int	0x80		; final system call