x86-16

Assembly 8086. Read from the standard input several numbers, in base 2. Print on the screen these numbers in base 10

风流意气都作罢 提交于 2021-02-17 07:19:08
问题 So, i have to convert the numbers from base two in base 10, and i have no idea how to do it.This is how my program looks for now, but I am not sure if what I got until now works properly. The conversion part is really giving me a hard time, but for sure I have lots of mistakes in my code, so any help would be greatly appreciated. assume cs:code, ds:data data segment msg db 'Give numbers:$' numbers LABEL BYTE max_size DB 100 numbers_len DB ? number DB 100 dup (?) ten db 10 errm db 'Numbers not

Can't get output of assembly language code

别说谁变了你拦得住时间么 提交于 2021-02-16 20:30:17
问题 I am newbie in assembly language. I am trying to get a string of numbers from user terminated by Enter or the length of the string reaching 20. When I executed the program it didn't show any error, but neither did it show any output nor did it terminate when the string exceeded the 20 characters limit. My code is: .model small .stack 100h .data var1 db 100 dup('$') .code main proc mov ax, @data mov dx, ax mov si, offset var1 l1: mov ah, 1 int 21h cmp al,20 je programend mov [si], al inc si

Can't get output of assembly language code

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-16 20:29:06
问题 I am newbie in assembly language. I am trying to get a string of numbers from user terminated by Enter or the length of the string reaching 20. When I executed the program it didn't show any error, but neither did it show any output nor did it terminate when the string exceeded the 20 characters limit. My code is: .model small .stack 100h .data var1 db 100 dup('$') .code main proc mov ax, @data mov dx, ax mov si, offset var1 l1: mov ah, 1 int 21h cmp al,20 je programend mov [si], al inc si

How to input from user number more than one digit in assembly?

懵懂的女人 提交于 2021-02-16 17:54:35
问题 I need to find an interrupt that can receive from a user a number with more than 1 digit. ;code mov [0],0 mov si,0 lop: mov ah,1 int 21h cmp al,'q' je finishedInput xor ah,ah add [word ptr si], ax jmp lop finishedInput: I have already tried to do an end less loop that each time uses the mov ah,1 int 21h combination until the user press 'q' and the endless loop will stop and. However, I am almost convinced that I have seen a code that do the same thing with interrupt instead. I want to stop

Assembly safes and keys- why it won't work?

谁说我不能喝 提交于 2021-02-11 08:41:44
问题 So we have like this safes challenge in assembly, you need to create safes and keys that will break them and end the infinite loop. Here's an example for a safe: loopy: mov ax, [1900] cmp ax,1234 jne loopy and a key: loopy2: mov ax, 1234 mov [1900],ax jmp loopy2 So I have a safe and a key, and I don't understand why it doesn't work: here's my safe: org 100h mySafe: mov dx,5 mov ax, [5768h] mov bx,7 mov word [180h],2 mul word [180h] mov [180h],bx push ax dec bx mov cx,dx mov ax,dx loopy1: add

BIOS int 0x13 modifies CS:IP?

陌路散爱 提交于 2021-02-10 15:46:55
问题 I'm writing an x86 bootloader which occupies two sections (1024 bytes) on disk and the first thing I want it to do is to load both sections to segment 0x60 before continuing execution Here is the relocation part of my code: _start: // relocate and load remaining bootloader code mov $0x60, %ax mov %ax, %es mov $0x02, %ah mov $2, %al xor %bx, %bx mov $0, %ch mov $2, %cl xor %dh, %dh int $0x13 jmp $0x60, $reloc_done reloc_done: // set up segment registers mov $0x60, %ax mov %ax, %ds mov %ax, %es

is this the right way to use cbw in Mul?

放肆的年华 提交于 2021-02-10 11:58:14
问题 I get the Multiplication from 8bit and 8bit register. But, when you have one in 16 bit, and one in 8bit, how do we do the conversion before multiplying: Question : need to provide code fragments for 260*19, and print the results. I did: mov Ax,260 mov Al,19 cbw; Mul Ax PutInt Ax 回答1: mov Ax,260 mov Al,19 The AL register is the lowest half of the AX register. AX /-----------------\ MSB xxxx xxxx xxxx xxxx LSB \-------/ \-------/ AH AL The 2nd instruction mov al, 19 thus erroneously overwrites

is this the right way to use cbw in Mul?

眉间皱痕 提交于 2021-02-10 11:52:06
问题 I get the Multiplication from 8bit and 8bit register. But, when you have one in 16 bit, and one in 8bit, how do we do the conversion before multiplying: Question : need to provide code fragments for 260*19, and print the results. I did: mov Ax,260 mov Al,19 cbw; Mul Ax PutInt Ax 回答1: mov Ax,260 mov Al,19 The AL register is the lowest half of the AX register. AX /-----------------\ MSB xxxx xxxx xxxx xxxx LSB \-------/ \-------/ AH AL The 2nd instruction mov al, 19 thus erroneously overwrites

Assembly big numbers calculator

*爱你&永不变心* 提交于 2021-02-08 11:33:53
问题 I've been given an assingment to make a calculator in 8086 assembly that will add, substract, multiply and divide big decimal numbers. These numbers can be 30 digits long at most. I've used 3 arrays to house these numbers (num1, num2, result). I'm stuck at the addition, because every time I run the program, it displays that the result array is empty (it shows a plus sign and 60 zeroes) can you tell what is wrong with my code? ADDER: MOV BP, offset num1 MOV SI, offset num2 MOV DI, offset

Converting decimal to binary in assembler

好久不见. 提交于 2021-02-05 12:17:25
问题 I need help with my first program in assembler. I have to convert values entered by user from decimal to binary. I have no idea how can I show values as a decimal, and what should I do next. could anyone instruct me step by step what do next. .model small .stack 100h` .data txt1 db "Enter binary value:" ,10,13, "$" txt2 db "BIN: " ,10,13, "$" .code main proc mov ax, @data mov ds, ax ;clear screen mov ah,0fh int 10h mov ah,0 int 10h ;show first text mov ah, 9 mov dx, offset txt1 int 21h call