A
A
Alexander2022-02-19 15:41:23
assembler
Alexander, 2022-02-19 15:41:23

How to display the image of the symbol "N" in assembler using pseudographics in text mode?

It is necessary to display the image of the symbol "N" using pseudographics.
As I understand it, pseudographic characters are located between 176 and 223 codes in the ASCII table. But I don’t know what to do next with this, because in fact, only today I started learning assembler, and I already need to do such a task.

I have an example of how to display the character "O" using pseudographics, but this program does not even want to compile, because it has errors. Here is the code:

.686
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
.data
hConsoleOutput dd 0
NumberOfCharsWritten dd 0
Symbol db 60 dup (32),10,13
 db 19 dup (32),26 dup(219),19 dup (32), 10, 13
 db 17 dup (32),2 dup(219),7 dup(176),2 dup(219),8 dup(32),2 dup(219),7 dup(176),2
dup(219),17 dup(32), 10, 13
 db 15 dup (32),2 dup(219),7 dup(176),2 dup(219),12 dup(32),2 dup(219),7 dup(176),2
dup(219),15 dup(32), 10,13
 db 13 dup (32),2 dup(219),7 dup(176),2 dup(219),16 dup(32),2 dup(219),7 dup(176),2
dup(219),13 dup(32), 10,13
 db 11 dup (32),2 dup(219),7 dup(176),2 dup(219),20 dup(32),2 dup(219),7 dup(176),2
dup(219),11 dup(32), 10,13
 db 8 dup( 9 dup (32),2 dup(219),7 dup(176),2 dup(219),24 dup(32),2 dup(219),7
dup(176),2 dup(219),9 dup(32), 10,13)
 db 11 dup (32),2 dup(219),7 dup(176),2 dup(219),20 dup(32),2 dup(219),7 dup(176),2
dup(219),11 dup(32), 10,13
 db 13 dup (32),2 dup(219),7 dup(176),2 dup(219),16 dup(32),2 dup(219),7 dup(176),2
dup(219),13 dup(32), 10,13
 db 15 dup (32),2 dup(219),7 dup(176),2 dup(219),12 dup(32),2 dup(219),7 dup(176),2
dup(219),15 dup(32), 10,13
 db 17 dup (32),2 dup(219),7 dup(176),2 dup(219),8 dup(32),2 dup(219),7 dup(176),2
dup(219),17 dup(32), 10,13
 db 19 dup (32),26 dup(219),19 dup (32),13,10
 db 60 dup (32),10,13
NumberOfCharsToWrite dd $-Symbol
ReadBuf db 128 dup(?)
hConsoleInput dd 0
.code
start:
call AllocConsole
push -11
call GetStdHandle
mov hConsoleOutput, eax
push 0
push offset NumberOfCharsWritten
push NumberOfCharsToWrite
push offset Symbol
push hConsoleOutput
call WriteConsoleA
push -10
call GetStdHandle
mov hConsoleInput, eax
push 0
push offset NumberOfCharsWritten
push 128
push offset ReadBuf
push hConsoleInput
call ReadConsoleA
push 0
call ExitProcess
end start


I don't understand at all what most commands do, especially what code like Symbol db 60 dup (32), 10,13
db 19 dup (32), 26 dup(219) and so on is for
.

Can you tell me how to implement this program? I will be very grateful for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2022-02-19
@AlexB_49

I don't understand at all what most commands do, especially what code like
Symbol db 60 dup (32),10,13 db 19 dup (32),26 dup(219) is for

Symbol is an array of characters to be displayed
db 60 dup (32), 10,13 - this literally means - "60 spaces (ascii code 32), then newline (ascii code 10, 13)
db 19 dup (32 ), 26 dup(219), 19 dup (32), 10, 13 - this literally means "output 19 spaces, then 26 characters of pseudocode (ascii code 219), then again 19 spaces, and a newline"
As a result, you will display :
_                 ██████████████████████████
                 ██░░░░░░░██        ██░░░░░░░██
               ██░░░░░░░██            ██░░░░░░░██
             ██░░░░░░░██                ██░░░░░░░██
           ██░░░░░░░██                    ██░░░░░░░██
         ██░░░░░░░██                        ██░░░░░░░██
         ██░░░░░░░██                        ██░░░░░░░██
         ██░░░░░░░██                        ██░░░░░░░██
         ██░░░░░░░██                        ██░░░░░░░██
         ██░░░░░░░██                        ██░░░░░░░██
         ██░░░░░░░██                        ██░░░░░░░██
         ██░░░░░░░██                        ██░░░░░░░██
         ██░░░░░░░██                        ██░░░░░░░██
           ██░░░░░░░██                    ██░░░░░░░██
             ██░░░░░░░██                ██░░░░░░░██
               ██░░░░░░░██            ██░░░░░░░██
                 ██░░░░░░░██        ██░░░░░░░██
                   ██████████████████████████

To display another character, you draw it in a similar way in a text editor and copy it to the data array.
I paste this code, save it, then click Project -> Build All (I tried it in different ways). And I get this result:

because you mindlessly copy, not taking into account that you have a line feed there, and you tear the expressions of the data declaration. There the line should not start with dup , but with db

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question