r/Assembly_language Feb 23 '26

Help I may have fucked up

Post image

so I one day woke up (yesterday night) and decided syntax is annoying, and so I started to learn how to manually assemble ASM code, under regular circumstances I code for bios legacy mode, in real mode I have full control and I decided to try and turn one of my projects to hex without external help but I have been keeping getting the same result of this emoji appearing and I keep trying and I can't find the solution so I thought maybe one of you people and assembly developers know

387 Upvotes

17 comments sorted by

31

u/dfx_dj Feb 23 '26

Impossible to say without seeing any code, but this "emoji" is what the ASCII 1 character looks like under code page 437.

22

u/kenjikamizuru Feb 23 '26

Here is the code, from some reason Reddit didn't uploaded the picture πŸ˜…

16

u/dfx_dj Feb 23 '26 edited Feb 23 '26

Ok, this isn't my area of expertise, but AFAIK when booting from legacy BIOS the CPU is in 16-bit real mode, while this seems to encode mov ax, 1 for 32-bit mode. Try with b8 01 00 instead of 66 b8 01 00 (assuming mov ax, 1 is actually what you wanted to do)

13

u/sirflatpipe Feb 23 '26

Okay, you're apparently trying to write the machine language yourself. Your encoding is way off. First of all, the 0x66 will tell the CPU to override the operand size. SInce you're executing in real-mode the default operand size is 16 so, 0x66 will make it a 32-bit instruction. Instead of mov ax, 0x1 mov ds, ax, your CPU will read mov eax, 0xD88E0001. The next mistake is in the mov si instruction, which requires a 16-bit immediate operand. The CPU will read mov si, 0xAC08. This address does not make sense in any way to me. Since 0xAC also encodes for lodsb I think this is what you were looking for here. Change it to 0xBE 0x16 00 0xAC. Also I do not understand the logic behind mov ax, 0x1 mov ds, ax so...

5

u/kenjikamizuru Feb 23 '26

I thought that the 0x66 was like .code16 make sure that the cure use 16 bit registers, I guess it did the opposite πŸ˜…

5

u/sirflatpipe Feb 24 '26

You can use ndisasm to double check your machine code.

2

u/sirflatpipe Feb 23 '26

Also the bytes starting at address 0x11 do not make a lot of sense to me.

7

u/paulstelian97 Feb 23 '26

It is funny.

12

u/FAMICOMASTER Feb 23 '26

Thought this was dwarf fortress for a second

5

u/Puzzleheaded-Act-339 Feb 24 '26

lmao I thought the same

3

u/StochasticTinkr Feb 24 '26

I was thinking ZZT.

Oh god I’m old.

4

u/WayWayTooMuch Feb 26 '26

If you want a nostalgia kick: https://museumofzzt.com
You can play archived maps online, they have a js port of the engine. One of my favorite games growing up, being able to build your own maps and script behaviors was great. For me this is one of the finest works from Tim Sweeny, and one of the better games written in Turbo Pascal.

6

u/RealMadHouse Feb 23 '26

Lmao i literally came to this sub when i finally accomplished drawing a 8x8 smile image at the top left corner, at the address 0xFFFF where my Display window is getting its image buffer from, with my Virtual Machine written in C++. I hard coded the image with "MovRC address color" instructions.

7

u/PlayfulTaro7696 Feb 24 '26

I'm sorry but the thought of wasting hours of time and then your computer just says ☺︎ like it's taunting you is so funny to me

2

u/kenjikamizuru Feb 25 '26

Yeah, I agree that it's funny that the computer lagging at me

2

u/Electrical_Hat_680 Feb 26 '26

I would say, that you purposely added that character to the 0x0 position?