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: 22
codeHacker101 18 Nov 2020, 14:31
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: 794
Location: Adelaide
sinsi 18 Nov 2020, 19:41
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: 22
codeHacker101 19 Nov 2020, 11:49
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: 22
codeHacker101 19 Nov 2020, 11:52
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: 20454
Location: In your JS exploiting you and your system
revolution 19 Nov 2020, 13:54
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: 22
codeHacker101 21 Nov 2020, 08:47
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: 20454
Location: In your JS exploiting you and your system
revolution 21 Nov 2020, 14:29
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: 736
Ali.Z 22 Nov 2020, 03:05
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: 4075
Location: vpcmpistri
bitRAKE 22 Nov 2020, 08:08
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)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
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: 1228
Location: Belarus
DimonSoft 22 Nov 2020, 09:14
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: 4075
Location: vpcmpistri
bitRAKE 23 Nov 2020, 01:36
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)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
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: 1228
Location: Belarus
DimonSoft 24 Nov 2020, 09:35
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
codeHacker101



Joined: 02 Nov 2020
Posts: 22
codeHacker101 14 Dec 2020, 08:47
look there is a folder called fasm in the installation files, but no folder called nasm or masm. Most people in my class probably don't even know about these different compilers because I don't think the teacher ever told us about them. I think he basically just told us to download and install this software and start coding by watching him code.

So it is possible, I suppose that I am on the wrong forum.
Post 14 Dec 2020, 08:47
View user's profile Send private message Reply with quote
codeHacker101



Joined: 02 Nov 2020
Posts: 22
codeHacker101 14 Dec 2020, 08:59
that being said I did install fasm for windows afterward, to run programs outside emu8086 (the provided examples don't build on emu8086, but I thought that was because of different platforms, not different compilers), but I don't know where to go to ask about emu8086 specific problems.
Post 14 Dec 2020, 08:59
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 14 Dec 2020, 09:17
fasm assembles the same code on all platforms.

You can compile Linux exes on Windows. Or DOS exes on Linux. Etc. In any combination, with no changes to the source or in the output binary.
Post 14 Dec 2020, 09:17
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.