| | |
printing in assembly
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2008
Posts: 43
Reputation:
Solved Threads: 0
hi all
i have this code and now i need to print it char yes and char no i.e.- the sentce is my-second-exercis and now i need to print it m-eod-xri
how do i do that?
then i need to print the first sentence backwords
how do i do that also?
here is the code
10x!
data segment
dec bp
pop cx
sub ax,4553h
inc bx
dec di
dec si
inc sp
sub ax,5845h
inc bp
push dx
inc bx
dec cx
push bx
inc bp
and al,36
data ends
i have this code and now i need to print it char yes and char no i.e.- the sentce is my-second-exercis and now i need to print it m-eod-xri
how do i do that?
then i need to print the first sentence backwords
how do i do that also?
here is the code
10x!
data segment
dec bp
pop cx
sub ax,4553h
inc bx
dec di
dec si
inc sp
sub ax,5845h
inc bp
push dx
inc bx
dec cx
push bx
inc bp
and al,36
data ends
•
•
Join Date: Aug 2005
Posts: 150
Reputation:
Solved Threads: 13
I'm sorry, but I didn't understand your first question.
To print a string backwards, you can use two ways. First you print it directly the other way round:
This code stores the chars of the string the other way round and prints it on the screen.
or, in my opinion, the better way:
This time the code saves the string in string2 (new memory). Then you can not only print it but also use it for further calculation.
To print a string backwards, you can use two ways. First you print it directly the other way round:
Assembly Syntax (Toggle Plain Text)
MOV ECX,stringlength MOV EBX,ECX ;stringlength as well, but better performance; EBX: Vector printloop: DEC EBX ;let the vector move to the beginning MOV AL,[string+EBX] ;get the char ;printing stuff (dont' know BIOS-Interrupt, google a bit) LOOP printloop ;repeat
or, in my opinion, the better way:
Assembly Syntax (Toggle Plain Text)
MOV ECX,stringlength MOV EBX,ECX ;stringlength as well, but better performance; EBX: Vector XOR EDX,EDX ;EDX: Vector for 2nd string printloop: DEC EBX ;let the vector move to the beginning MOV AL,[string+EBX] ;get the char, but this time... MOV [string2+EDX],AL ;store the char in the new string INC EDX ;increase the vector of the 2nd string LOOP printloop ;...over and over again ;print string2
![]() |
Similar Threads
- String Printing with condition (Assembly)
- printing buffer strings (Assembly)
- Linux Assembly - how to output numbers instead of ASCII symbols (Assembly)
- SPIM Assembly HELP!!!! (Assembly)
- Printing Uppercase Characters (Assembly)
- HELP - Printing Integers (Assembly)
Other Threads in the Assembly Forum
- Previous Thread: Square root assembly and c++
- Next Thread: Which assembler is best for me
| Thread Tools | Search this Thread |





