The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: llkooj on December 05, 2008, 10:42:25 AM

Title: Printing
Post by: llkooj on December 05, 2008, 10:42:25 AM
My program was printing fine using print udword$(EBX),10,13. But now it is printing gibberish and is also beeping for each gibberish printed. Thanks.
Title: Re: Printing
Post by: sinsi on December 05, 2008, 11:08:42 AM
You're welcome.
Title: Re: Printing
Post by: KeepingRealBusy on December 05, 2008, 01:56:03 PM
Garbage in, Garbage out! You shouldn't use such bad language on this forum (read the guidelines). Go to the SoapBox! :bdg

Dave.
Title: Re: Printing
Post by: llkooj on December 05, 2008, 02:48:51 PM
Let me re-phrase. My program was printing fine using print udword$(EBX),10,13. But now it is printing gibberish and is also beeping for each gibberish printed. What could be the issue?

Title: Re: Printing
Post by: MichaelW on December 05, 2008, 02:58:36 PM
llkooj,

"Beeping gibberish" is a common occurrence in buggy 16-bit DOS code where the code is trying to display binary data as a string. The beeping occurs where the data includes ASCII code 7. Under Windows such binary data could appear as gibberish, but I am not aware of the console output functions responding to ASCII code 7 by producing a beep. In any case, I would suspect that the problem is caused by some change in your code.
Title: Re: Printing
Post by: llkooj on December 05, 2008, 03:14:01 PM
I am aware that it is caused by some changes in my code. To verify this, I deleted large sections of my code to see what happens. I does work fine then. How do I deal with ascii code problem?
Title: Re: Printing
Post by: KeepingRealBusy on December 05, 2008, 03:48:20 PM
Post your code, or a zip of your code, both the old code and the new code. Preferably, do a diff of the old and new sources and just post the original code and the diff. Maybe someone can figure where it is coming from.

Dave.
Title: Re: Printing
Post by: MichaelW on December 05, 2008, 04:03:27 PM
If the problem is ASCII code 7, other some other incorrect code, somewhere in the converted string, you could begin diagnosing the problem by examining a dump of the string memory. You should be able to do this with a debugger, or in code with something like this:

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    .data
      dumpbuff db 1000 dup(0)
      mystring db "Hi, I'm Larry, this is my brother Darryl,",13,10,\
                  "and this is my other brother Darryl.",13,10,7,0
    .code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    print ADDR mystring,13,10

    invoke HexDump, ADDR mystring, SIZEOF mystring, ADDR dumpbuff
   
    print ADDR dumpbuff,13,10
   
    inkey "Press any key to exit..."
    exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start


Hi, I'm Larry, this is my brother Darryl,
and this is my other brother Darryl.

48 69 2C 20 49 27 6D 20 - 4C 61 72 72 79 2C 20 74
68 69 73 20 69 73 20 6D - 79 20 62 72 6F 74 68 65
72 20 44 61 72 72 79 6C - 2C 0D 0A 61 6E 64 20 74
68 69 73 20 69 73 20 6D - 79 20 6F 74 68 65 72 20
62 72 6F 74 68 65 72 20 - 44 61 72 72 79 6C 2E 0D
0A 07 00

Title: Re: Printing
Post by: llkooj on December 05, 2008, 04:33:49 PM
I spotted the error. My 2 dimensional array was not defined properly!  I am hopefully done with my 1st projects in assembly language. It was a baptism of fire! The biggest problem I had was printing. Took me 2 days to realize that int 21h does not work on 32 bits.

Thanks