| | |
help with assembly assignment
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2009
Posts: 1
Reputation:
Solved Threads: 0
so I am working on an assignment in class, and I've hit a road block. the assignment is to replace certain letters (b, c) with others, (x, y). Right now, my program is not recognizing 'b' in ebx, and the second letter in the array, 'b', (stored in eax) as being the same, so it is not changing them. I know im doing something wrong, but I can't figure out what. Any hints would be much appreciated, meanwhile i will keep plugging away at it. Also, I cannot get the new array in edx to show up without subtracting sixteen, and im not sure how to fix that so that is not necessary. Thanks so much.
assembly Syntax (Toggle Plain Text)
INCLUDE Irvine32.inc .data array byte 'a', 'b', 'c', 'd', 'e', 'f', 'a', 'b', 'c', 'd', 'e', 'f', 'a', 'b', 'c' letter byte ? newArray byte 15 dup (?) .code main PROC mov ecx, lengthof array ;moves ecx to beginning of array as a counter mov esi, offset array ;moves esi to the beginning of array to obtain letters mov eax, [esi] ;moves first position of array into eax doLoop: ;starts a loop mov ebx, 'b' ;moves first letter comparison (b) into ebx cmp ebx, eax ;compares letters je check4C ;if it is b, then jump to check for c add edx, eax ;if not b, store first letter of newArray in edx add esi, type array ; increment esi to next letter in array loop doLoop ;loop back to the beginning mov edx, offset newArray sub edx, 16 call writestring ;print newArray string with new letters call crlf ;enters a blank line call waitmsg ;waits til user closes screen exit ;exit check4C: ;check for c add edx, 'x' ;adds x for b into new array add esi, type array ;move esi down the array mov eax, [esi] ;move esi into eax for next comparison mov ebx, 'c' ;move c into ebx for comparison cmp ebx, eax ;compare registers je replace ;if the letter is matches c go to replace add edx, eax ;store next letter of newArray in edx add esi, type array ;move esi down the array jmp doLoop ;go to the top of the loop replace: ;replaces y for c add edx, 'y' ;moves y into array instead of c add esi, type array ;move esi down the array jmp doLoop ;go to the top of the loop main ENDP END main
0
#2 Oct 21st, 2009
mov eax, dword [esi] ;moves first position of array into eax
And also moves a double word EAX=44434241h, I think so,
not sure.
To read each byte at a time do:
xor eax, eax
mov al, byte [esi]
mov ebx, 'b' ;moves first letter comparison (b) into ebx
cmp ebx, eax ;compares letters EAX=44434241h EBX=00000042h
je check4C
And also moves a double word EAX=44434241h, I think so,
not sure.
To read each byte at a time do:
xor eax, eax
mov al, byte [esi]
mov ebx, 'b' ;moves first letter comparison (b) into ebx
cmp ebx, eax ;compares letters EAX=44434241h EBX=00000042h
je check4C
Last edited by NotNull; Oct 21st, 2009 at 10:10 pm.
----------------------------------------------------------
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
![]() |
Similar Threads
- MIPS Assembly Lanuaguage programming (Assembly)
- Assembly assignment (Assembly)
- String Printing with condition (Assembly)
- TASM Arithmetic (Assembly)
- Need help with 8086 assembly language (Assembly)
- 8085 Assembly. (Assembly)
Other Threads in the Assembly Forum
- Previous Thread: hlt Instruction
- Next Thread: add
| Thread Tools | Search this Thread |
Tag cloud for Assembly
3d 68hc11 6811 adress alm array asic asm assembler assembly boot bootloader buffer compression cursor debug development directory division dos draw emulator endtask error file int10h integer interrupt language loop lsi nohau osdevelopment print program range read remainder requirements shape storage string text tsr x86





