emu8086

How to convert String to Number in 8086 assembly?

吃可爱长大的小学妹 提交于 2019-11-28 14:38:04
I have to build a Base Converter in 8086 assembly . The user has to choose his based and then put a number, after then , the program will show him his number in 3 more bases[he bring a decimal number, and after this he will see his number in hex, oct, and bin. This first question is, how can I convert the number he gave me, from string, to a number? the sec question is, how can i convert? by RCR, and then adc some variable? Here is my code: data segment N=8 ERROR_STRING_BASE DB ,10,13, " THIS IS NOT A BASE!",10,13, " TRY AGINE" ,10,13," $" OPENSTRING DB " Welcome, to the Base Convertor",10,13,

X86 IDIV sign of remainder depends on sign of dividend for 8/-3 and -8/3?

主宰稳场 提交于 2019-11-28 08:49:13
问题 Can anyone explain for me why the sign of the remainder is different in these cases? Is this an emulator bug or do real CPUs do this, too? 8 / -3 : quotient(AL) = -2 remainder(AH) = 2 -8 / 3 : quotient(AL) = -2 remainder(AH) = -2 回答1: It is supposed to work that way, though it is tricky to find out by reading the documentation: Non-integral results are truncated (chopped) towards 0. Combined with the "division law" X = dq + r (the dividend is the divisor times the quotient plus the remainder)

Random number in assembly

落爺英雄遲暮 提交于 2019-11-28 02:07:05
I am new to assembly and would like to know how to write a program in EMU8086 that prints a different random number in every run of it. Is it possible to do it without using interrupts? If you were using a real version of DOS (not EMU8086) @fuz method is the way you can do it, and it doesn't require interrupts. You just read the lower 16-bits of the 32-bit value at memory address 0x46c (0x00040:0x006c) in the BIOS Data Area (BDA). The value at that location is a 32-bit value representing the number of timer ticks since midnight. Unfortunately EMU8086 doesn't support this method. To get a

Cannot move 8 bit address to 16 bit register

馋奶兔 提交于 2019-11-28 00:22:16
I am trying to assign variable to register here is the code: ORG 100h var1 DB 10 ; var2 DB 20 ; MOV BX,var1 ; error : operands do not match: 16 bit register and 8 bit address RET END But if swap the 4th line with: MOV BL, var1; it works. So my question is why can’t I move 8 bit variable into much larger 16 bit register ? I have already referred this , this and this OP but it does not answer my question. NOTE: I am using emu8086 assembler I am new to assembly language so I apologise if it's a stupid question. why can’t I move 8 bit variable into much larger 16 bit register? Becase the machine

How to convert String to Number in 8086 assembly?

家住魔仙堡 提交于 2019-11-27 08:38:43
问题 I have to build a Base Converter in 8086 assembly . The user has to choose his based and then put a number, after then , the program will show him his number in 3 more bases[he bring a decimal number, and after this he will see his number in hex, oct, and bin. This first question is, how can I convert the number he gave me, from string, to a number? the sec question is, how can i convert? by RCR, and then adc some variable? Here is my code: data segment N=8 ERROR_STRING_BASE DB ,10,13, " THIS

How to use strings in emu8086

夙愿已清 提交于 2019-11-27 05:40:09
I need help with strings in emu8086. I have initialized a string: str1 db "0neWord" And I have an empty string: str2 db ? Now I need to check all letters in str1 and copy to str2 , but if the letter in str1 is 0, I need to replace it with O. If not, I need to just copy the letter. How can I do this? str2 db ? is not an empty string. db stands for "define byte" , and that ? means single uninitialized byte. The db "0neWord" is assembler's convenience, it will compile into series of bytes defined as '0', 'n', 'e', ..., 'd' . There's no such thing as "string" type in assembler, everything is

Cannot move 8 bit address to 16 bit register

北慕城南 提交于 2019-11-26 23:24:18
问题 I am trying to assign variable to register here is the code: ORG 100h var1 DB 10 ; var2 DB 20 ; MOV BX,var1 ; error : operands do not match: 16 bit register and 8 bit address RET END But if swap the 4th line with: MOV BL, var1; it works. So my question is why can’t I move 8 bit variable into much larger 16 bit register ? I have already referred this, this and this OP but it does not answer my question. NOTE: I am using emu8086 assembler I am new to assembly language so I apologise if it's a

Displaying Time in Assembly

北战南征 提交于 2019-11-26 17:52:23
问题 Hello im trying to display the actual time hours/minutes/seconds this is my code sample: MOV AH, 2Ch INT 21h MOV AH, 0Eh MOV AL, CH INT 10h MOV AL, 3Ah INT 10h MOV AL, CL INT 10h MOV AL, 3Ah INT 10h MOV AL, DH INT 10h ret Here you can se what the console is displaying 回答1: See the x86 tag wiki for the instruction set reference manual, and many good links to reference material and tutorials. It takes enough code to split up an integer into ASCII digits that you should factor it out into a

How to use strings in emu8086

倾然丶 夕夏残阳落幕 提交于 2019-11-26 11:40:34
问题 I need help with strings in emu8086. I have initialized a string: str1 db \"0neWord\" And I have an empty string: str2 db ? Now I need to check all letters in str1 and copy to str2 , but if the letter in str1 is 0, I need to replace it with O. If not, I need to just copy the letter. How can I do this? 回答1: str2 db ? is not an empty string. db stands for "define byte" , and that ? means single uninitialized byte. The db "0neWord" is assembler's convenience, it will compile into series of bytes