ASM and String output
Results 1 to 5 of 5

Thread: ASM and String output

  1. #1
    Banned
    Join Date
    Jul 2003
    Posts
    325

    Question Assembler and String output

    I am working on a project and am really confused on how to output a series of strings. Here is the spec:

    We are supposed to have a prompt that asks the user "Enter your name" then the user enters a string. When the user hits enter, the program displays "Hello(string), Do you like ASM? (Y/N)?" When the user presses Y, the program returns "You are one smart dude!" and return control to DOS. If the user presses N, then the program returns "Then take an art class" and return control to DOS.

    Asking the question and having the program force y/n characters force to lowercase is easy. Displaying the yes and no conditions are easy. However, I am having trouble finding snippets on how to get the program to accept a string, output a string that says "Hello(inputted string) Do you like assembler?" into one output for the user to choose y or n.

    Any help would be appreciated.

    edit: I am learning using the 8088 instruction set and registers using TASM 1.1.

    And Yes, I am Googling as we speak. :P

  2. #2
    Senior Member
    Join Date
    Jan 2003
    Posts
    220
    So Im guessing the lagnuage your programming in is Assembly? You could try http://www.planetsourcecode.com they have some source code on assembly last time I checked. They may have what your looking for.
    [gloworange]And then it happened... a door opened to a world... rushing through the phone line like heroin through an addict\'s veins, an electronic pulse is sent out, a refuge from the day-to-day incompetencies is sought... a board is found. \"This is it... this is where I belong...\" I know everyone here... even if I\'ve never met them, never talked to them, may never hear from them again... I know you all...[/gloworange]

  3. #3
    Jaded Network Admin nebulus200's Avatar
    Join Date
    Jun 2002
    Posts
    1,356
    What language...and if it is assembly, what processor?

    /nebulus

    EDIT: It has been sooo long since I hand-wrote assembler, this may no longer apply, but I remember with the MC68000, you had to write the string to a particular address (or maybe it was you set the pointer to the address having the string), then you would issue a Trap 13 to flush the buffer/print it out. Whether or not this applies anymore or not, I would expect that you would first have to build a string somewhere in memory (probably on your stack), then have whatever outputs the stuff to your screen point to the memory address where your string is...

    Regardless, I guess you see why I was asking the processor (Intel can be psychotic to hand code compared to something like the MC68K or MIPS)..

    There is only one constant, one universal, it is the only real truth: causality. Action. Reaction. Cause and effect...There is no escape from it, we are forever slaves to it. Our only hope, our only peace is to understand it, to understand the 'why'. 'Why' is what separates us from them, you from me. 'Why' is the only real social power, without it you are powerless.

    (Merovingian - Matrix Reloaded)

  4. #4
    Banned
    Join Date
    Jul 2003
    Posts
    325
    Oh sorry. It is assembler, and we are learning on TASM 1.1 using the 8088 instruction set and registers.

  5. #5
    AO Curmudgeon rcgreen's Avatar
    Join Date
    Nov 2001
    Posts
    2,716
    Here's a quick and sloppy outline.

    Code:
    mov ah,40		;write to file or device
    mov bx,0001		;standard output
    mov cx,f		;length
    mov dx,200		;address of prompt string
    int 21			;DOS call
    mov ah,3f		;read from file or device
    mov bx,0000		;standard input
    mov cx,ff		;length of buffer
    mov dx,300		;address of buffer
    int 21			;DOS call
    mov ah,40		;write to file or device
    mov bx,0001		;standard output
    mov cx,ff		;length of buffer
    mov dx,300		;address of buffer
    int 21			;DOS call
    mov ah,4c		;terminate process
    int 21			;DOS call
    this will send a prompt message to standard output (DS DX is the address where you store it)
    Then it accepts input from standard input (I've put arbitrary addresses and buffer lengths)
    and then in sends your input back out to standard output. You can construct your
    conversation with these two routines.
    I came in to the world with nothing. I still have most of it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •