All pastes #466524 Raw Edit

Mine

public text v1 · immutable
·published 2007-05-01 01:01 UTC
rendered paste body
section .data
	entName:	db 'Enter a letter:',10		; Starting phrase.
	entLen:		equ $-entName				; Length of entName
	hello:		db 'You entered: '	; Don't forget line feed
	aLet:		db '?'				; replace this later.
	helloLen:	equ $-hello		; Length of the string

section .bss
	char:		resb	1		;One character only

section .text
	global _start

_start:
	mov eax, 4		; sys_write system call
	mov ebx, 1		; arg 1: standard output
	mov ecx, entName	; arg 2: offset of hello
; Remember: no brackets are needed for equs.
	mov edx, entLen	; arg 3: the length of the string
	int 80h			; Call the kernel to do the task.
	
	mov eax, 3			; sys_read system call
	mov ecx, [aLet]	; store the character in there.
	mov edx, 1			; Get one character.
	int 80h
	
	;mov [aLet],ax
	
	;mov al,[char]
	;mov [aLet], al
	
	; trying to do a MASM: print hello AND aLet consecutively
	; indirect addressing might be required.
	
	mov eax, 4
	;mov ecx, hello
	mov edx, 1
	;mov edx, 14
	int 80h

	mov eax, 1		; sys_exit system call
	mov ebx, 0		; arg 1: status code.  No error here.
	int 80h