0

I want to multiply a number by itself and show it's square root, but I can't write any type of value into the console and it displays a 0.

enter image description here

This is the code I've used so far:

org 100h

num rb 1

mov ah, 3fh
mov bx, 0
mov cx, 1
mov dx, num

mov al, [num]
mov bl, [num]

mul bl

mov ah, 2
add al, 48 ;30h
mov dl, al
int 21h 

Everything needs to be FASM compatible.

Andrej Hatzi
  • 312
  • 4
  • 18
  • 1
    You need to convert the input as well, not just the output as I already told you. Also don't put your `num` in the execution path. You are missing the `int 21h` call too to actually read user input. – Jester Mar 17 '20 at 01:01
  • 1
    [Segmentation fault when using DB (define byte) inside a function](https://stackoverflow.com/q/55642600) re: `num rb 1` in the wrong place. If that assembles to a `0` byte, then it's an opcode for an `add r/m, reg` 8-bit add instruction that consumes the first byte of the next instruction as its modrm byte. Use a disassembler and/or debugger to see what happened. – Peter Cordes Mar 17 '20 at 05:15
  • How do I convert the input?@Jester – Andrej Hatzi Mar 17 '20 at 10:35

0 Answers0