CSC231 Copying Strings in RAM

From dftwiki3
Revision as of 08:08, 19 September 2012 by Thiebaut (talk | contribs) (Created page with "--~~~~ ---- =A Program with 2 Strings= <source lang="asm"> ;;; movString1s.asm ;;; D. Thiebaut ;;; ;;; ;;; ;;; To assemble, link, and run: ;;; nasm -f elf -F stabs movString1...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut 09:08, 19 September 2012 (EDT)


A Program with 2 Strings

;;; movString1s.asm
;;; D. Thiebaut
;;;
;;; 
;;;
;;; To assemble, link, and run:
;;; 	nasm -f elf -F stabs movString1s.asm
;;; 	ld -melf_i386 -o movStrings1 movStrings1.o
;;; 	./movStrings1
;;;

		section	.data
msg1		db	"Smith College", 10
msg1Len		equ	$-msg1
msg2		db	".............", 10
	
		section	.text
		global	_start
_start:	

;;; print msg1
		mov	eax, 4
		mov	ebx, 1
		mov 	ecx, msg1
		mov	edx, msg1Len
		int	0x80

;;; print msg2
		mov	eax, 4
		mov	ebx, 1
		mov 	ecx, msg2
		mov	edx, msg1Len
		int	0x80
;;; exit
		mov	ebx, 0
		mov	eax, 1
		int	0x80