CSC231 Mini Lab 1 Solution and Discussion
--D. Thiebaut 09:38, 12 September 2012 (EDT)
Solution 1
;;; minilab1.asm
;;; D. Thiebaut
;;; prints this string on the screen:
;;;
;;; *********************************
;;; * Welcome to CSC231 *
;;; * Home of the Assembly Language *
;;; *********************************
section .data
msg db "*********************************", 10
db "* Welcome to CSC231 *", 10
db "* Home of the Assembly Language *", 10
db "*********************************", 10, 10
msgLen equ $-msg
section .text
global _start
_start:
mov eax,4
mov ebx,1
mov ecx,msg
mov edx,msgLen
int 0x80
;;; exit
mov eax,1
mov ebx,0
int 0x80
Solution 2
;;; minilab1.asm
;;; D. Thiebaut
;;; prints this string on the screen:
;;;
;;; *********************************
;;; * Welcome to CSC231 *
;;; * Home of the Assembly Language *
;;; *********************************
section .data
msg db "*********************************", 10
msgLen1 equ $-msg
db "* Welcome to CSC231 *", 10
db "* Home of the Assembly Language *", 10
msgLen2 equ $-msg
section .text
global _start
_start:
;;; print first 3 lines
mov eax,4
mov ebx,1
mov ecx,msg
mov edx,msgLen2
int 0x80
;;; print first line back, to close box
mov eax,4
mov ebx,1
mov ecx,msg
mov edx,msgLen1
int 0x80
;;; exit
mov eax,1
mov ebx,0
int 0x80