My project is to take an input file and reverse the text, but first I want to concentrate on just plain reversing a string.

This program has no errors, but it doesn't display the reverse string

INCLUDE Irvine32.inc

.data
source BYTE "This is the source string",0
target BYTE SIZEOF source DUP('#')

.code
main PROC

	mov esi, 0
	mov ecx,SIZEOF source-1
	
L1:
	mov al,source[esi]
	mov target[esi],al
	inc esi
	loop L1
	
	mov esi,OFFSET target
	mov ebx,1
	mov ecx,SIZEOF target
	call DumpMem
	
	exit
main ENDP
END main

An easy way would be to push each character onto the stack, and then create a loop to pop and print each character. The characters will come off in reverse order from the stack.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.