flat assembler
Message board for the users of flat assembler.

Index > DOS > string concatenation (dx + "$")

Author
Thread Post new topic Reply to topic
pc2



Joined: 09 Feb 2005
Posts: 3
Location: Brazil
pc2
salutations,

we are beginners in assembly and we were trying to make an experimental program. look the code:
Code:
org 100h

;macros
macro print str {push ax
                 push dx
                 mov ah,09h
                 push bx
                 mov bx, str
                 mov dx, bx
                 pop bx
                 int 21h
                 pop ax
                 pop dx}

macro inputh {push ax
             mov ah,01h
             int 21h
             pop ax}
macro input {push ax
             mov dx, 80
             mov ah,0ah
             int 21h
             pop ax}
macro close {mov ax, 4c00h
             int 21h}
jmp start

message db "bem-vindo",10,13,"$"
avizzo db "o que desejas fazer"? $"

start:

print message
print avizzo
input
print 10
print 13
print dx
inputh
close    


it's output should be something like this:

bem vindo.
o que desejas fazer? 45 (an input just for example)
45 (the user's input printed)

with the input service 0ah of 21h, the buffer where it will store the user's input would be dx, right?

the (probably) only problem in the code is that the code needs to put the dx together with "$" (concatenation of dx with "$"), because the 21h input server we're using is 09h. but we don't know how the code would look like.

probably something like this? >>
Code:
... mov bx, str + "$" ...    


maybe there would be an output service that doesn't require the final "$" to indicate the end of the string?

best regards,

_________________
Paulo Marcos Durand Segal & Claudio Marcos Durand Segal
Post 28 May 2005, 22:55
View user's profile Send private message Reply with quote
UCM



Joined: 25 Feb 2005
Posts: 285
Location: Canada
UCM
shouldn't this be in DOS forum?

_________________
This calls for... Ultra CRUNCHY Man!
Ta da!! *crunch*
Post 29 May 2005, 00:40
View user's profile Send private message Reply with quote
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007
Code:

mov ah, 0ah
mov dx, buffer
int 21h

mov ah, 9
mov dx, buffer+2
int 21h

buffer          db  25       ;24 byte buffer+return
                  db  0         ;any previous input to be remembered=no
times 25      db  0         ;heres our buffer filled with 0's
                  db '$'         ;for printing out the input
    
Post 29 May 2005, 02:26
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
This thing confuses ppl because they use COM programs in Windows so they don't relate it to DOS. I think that a 16-bit and a 32-bit topics would be clearer difference.
Post 31 May 2005, 19:01
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.