flat assembler
Message board for the users of flat assembler.

Index > Main > display "null" when ASCII value 0

Author
Thread Post new topic Reply to topic
codeHacker101



Joined: 02 Nov 2020
Posts: 20
codeHacker101
So I have this very basic code that displays symbol corresponding to ASCII value in dl.

Code:
.model small
.stack 100h
.data
.code
main proc
    mov dl, 78 ; 78 for N
    mov ah,2
    int 21h
    mov ah,4ch
    int 21h
    main endp
end main    


But the screen is blank (understandably) when the value is 0. I would like it to display something other than a blank screen. Even if I make a variable like zero db = 'null$' there seems to be no way to use if..else in assembly to only display it when appropriate.

I am actually open to anything as long as it is something other than a blank screen. Anything I can do?
Post 18 Nov 2020, 14:31
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 713
Location: Adelaide
sinsi
MASM code on a FASM board isn't likely to get much help Smile

Anything under the value of 32 is likely to be non-printable using DOS (except 7,8,9,10,13)
Code:
  cmp dl,32
  jae @f
  mov dl,"?"
@@:
  mov ah,2
  int 21h
    
Post 18 Nov 2020, 19:41
View user's profile Send private message Reply with quote
codeHacker101



Joined: 02 Nov 2020
Posts: 20
codeHacker101
This can't be MASM. We started assembly this semester and the teacher made us download and install emu8086 to use it. It is a software that emulates a microchip on Microsoft Windows. I didn't know which compiler was being used behind the scenes so I opened the folder for the installed files running emu8086 and there is a separate folder in there called "fasm". Inside is FASM.EXE and an include folder with the relevant asm files.


Last edited by codeHacker101 on 19 Nov 2020, 11:54; edited 1 time in total
Post 19 Nov 2020, 11:49
View user's profile Send private message Reply with quote
codeHacker101



Joined: 02 Nov 2020
Posts: 20
codeHacker101
That is how I found this forum. And values below 32 do get printed. For example 3 prints a heart.
Post 19 Nov 2020, 11:52
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17717
Location: In your JS exploiting you and your system
revolution
The display of ASCII codes depends upon your code page settings, your console settings, and your font settings.

I wouldn't worry about what 0x00 prints unless I was debugging some serial data streams. Then I would choose a font and code page to show all the control codes.

Like this:
␀␁␂␃ etc.
Post 19 Nov 2020, 13:54
View user's profile Send private message Visit poster's website Reply with quote
codeHacker101



Joined: 02 Nov 2020
Posts: 20
codeHacker101
But based on my explanation, I am correct to assume my code is FASM right? Because it runs in emu8086.
Post 21 Nov 2020, 08:47
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17717
Location: In your JS exploiting you and your system
revolution
That code is not fasm syntax.

Perhaps it is nasm or masm or something else, but it isn't fasm.
Post 21 Nov 2020, 14:29
View user's profile Send private message Visit poster's website Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 385
Ali.Z
its ugly masm.

_________________
Asm For Wise Humans
Post 22 Nov 2020, 03:05
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3056
Location: vpcmipstrm
bitRAKE
I quick google, and we can see that fasm is setup to partially emulate MASM syntax.

https://github.com/AhmadNaserTurnkeySolutions/emu8086/blob/master/fasm/INCLUDE/MACRO/MASM.INC

_________________
¯\(°_o)/¯ unlicense.org
Post 22 Nov 2020, 08:08
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 835
Location: Belarus
DimonSoft
But that would require to include a file before using MASM-specific syntax which, it seems, is not the case. So emu8086 might be set up to use some other compiler. That FASM is in a subfolder of the program doesn’t necessarily mean MASM isn’t. And it may also be set up to use MASM from some other place, not even related to emu8086 installation.
Post 22 Nov 2020, 09:14
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3056
Location: vpcmipstrm
bitRAKE
That's a lot of speculation, DimonSoft. Have you installed and tried the examples? If they build without MASM then it would be the case that includes are prepended to the process. I don't see a Copywrite notice for Microsoft in the documents - I doubt it uses MASM from Microsoft. Given that emu8086 inherrently supports a virtual machine environment with multiple devices, it's not surprising that includes are added to the build process.

_________________
¯\(°_o)/¯ unlicense.org
Post 23 Nov 2020, 01:36
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 835
Location: Belarus
DimonSoft
Well, maybe, the last time I’ve actually run emu8086 was more than 10 years ago.
Post 24 Nov 2020, 09:35
View user's profile Send private message Visit poster's website 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 GitHub, YouTube, Twitter.

Website powered by rwasa.