Minime80
01-30-2002, 05:31 AM
Here's my dilemma. I've got an assignment due tomorrow, but haven't gotten around to putting Linux back on my machine at home yet. I can ssh to the school's machine's, but they're SPARC's. Anyways, this means I can't compile or test my stupid little program on anything before I turn it in, so I'm going to put the code here (it's short), and if anybody sees a problem with it let me know so I can fix it before I have to turn it in. Thanks...
Here's the code I've got (we're using NASM)
section .data
mystr1: db "S t a r t", 10
mystr1len: dd $-mystr1
mystr2: db "The char should be 'X', is: '"
mystr2len: dd $-mystr2
mychar: db 'X'
mycharlen: dd $-mychar
mystr3: db "'", 10
mystr3len: dd $-mystr3
mystr4: db "The E N D", 10
mystr4len: dd $-mystr4
section .text
global main
main:
push ebx
push ecx
push edx
mov eax, 4
mov ebx, 1
mov ecx, mystr1
mov edx, dword [mystr1len]
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, mystr2
mov edx, dword [mystr2len]
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, mychar
mov edx, dword [mycharlen]
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, mystr3
mov edx, dword [mystr3len]
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, mystr4
mov edx, dword [mystr4len]
int 0x80
pop edx
pop ecx
pop ebx
ret
Oh, it's supposed to output this to the terminal:
S t a r t
The char should be 'X', is: 'X'
The E N D
Here's the code I've got (we're using NASM)
section .data
mystr1: db "S t a r t", 10
mystr1len: dd $-mystr1
mystr2: db "The char should be 'X', is: '"
mystr2len: dd $-mystr2
mychar: db 'X'
mycharlen: dd $-mychar
mystr3: db "'", 10
mystr3len: dd $-mystr3
mystr4: db "The E N D", 10
mystr4len: dd $-mystr4
section .text
global main
main:
push ebx
push ecx
push edx
mov eax, 4
mov ebx, 1
mov ecx, mystr1
mov edx, dword [mystr1len]
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, mystr2
mov edx, dword [mystr2len]
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, mychar
mov edx, dword [mycharlen]
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, mystr3
mov edx, dword [mystr3len]
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, mystr4
mov edx, dword [mystr4len]
int 0x80
pop edx
pop ecx
pop ebx
ret
Oh, it's supposed to output this to the terminal:
S t a r t
The char should be 'X', is: 'X'
The E N D