x86-16

32 bit Calculator in 8086 Assembly

你说的曾经没有我的故事 提交于 2019-12-13 08:58:31
问题 CALCULATOR 32 Bit Can someone help me with my 32 bit calculator in MASM32. i think the adding and subtracting is OK but i cant print the number in decimal; 0002FFFF - 10005 = 1fffa In MEMORY :0001 0FFFA PRINTING: 165530 in decimal DATA_HERE SEGMENT mult1 dw 0002H dw 0FFFFH mult2 dw 0001H dw 0005H ans dw 0,0 DATA_HERE ENDS STACK_HERE SEGMENT STACK DW 40 DUP(0) STACK_HERE ENDS CODE_HERE SEGMENT ASSUME CS:CODE_HERE, DS:DATA_HERE, SS: STACK_HERE INICIO: MOV AX,DATA_HERE MOV DS,AX ADD: MOV AX

How to move cursor with mouse?

流过昼夜 提交于 2019-12-13 07:51:10
问题 I am developing a realmode operating system in x86 assembly. I managed to move cursor with keyboard, but I want to move the cursor with mouse. I don't know how. I found int 33h deals with the mouse, but I can't seem to move the cursor using int 33h. 回答1: Interrupts int 10h to int 1Fh are BIOS interrupts; they can be used before the OS is booted. Interrupts int 20h to int 2Fh are DOS interrupts; they can only be used when DOS has already been loaded. Other interrupts (e.g. int 33h ) are

8086 assembly convert input string to integer

混江龙づ霸主 提交于 2019-12-13 06:04:55
问题 I am trying to get my code to perform a calculation correctly in emu8086, however, I am not sure how to convert a string into an integer in assemly. message1 db 0dh, 0ah, "input width: $" message2 db 0dh, 0ah, "Input perimeter: $" width dw ' ', 20 dup('?') height dw ' ', 20 dup('?') w dw 0 h dw 0 calc: mov dx, offset message1 mov ah, 9 int 21h lea dx, width mov ah, 0ah int 21h mov cx, width xor bx, bx .next_digit1: mov ax, byte[cx] inc cx sub al, '0' mul bx, 10 add bx, ax loop .next_digit1

Add a variable to the stack in x86 assembly [closed]

删除回忆录丶 提交于 2019-12-13 04:46:17
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I wonder, how to set a local variable in ASM's procedure ? thanks!! 回答1: If you want to store a variable on the stack, you need to reserve space for it, this is generally done with the SUB ESP,xxx sequence, where

Trying to perform a factorial in assembly but causing stack overflow

喜你入骨 提交于 2019-12-13 03:24:47
问题 Ok, so I am trying to test out a factorial program from my college book, and when I type it correctly as shown, it gives me a stack overflow error. It happens at the line push ebp . Can anyone tell me what is wrong? .code main PROC mov ebp,0 push 3 call Factorial call WriteDec call Crlf exit main ENDP Factorial PROC push ebp mov ebp,esp cmp eax,0 ja L1 mov eax,1 jmp L2 L1: dec eax push eax call Factorial ReturnFact: mov ebx,[ebp+8] mul ebx L2: pop ebp ret 4 Factorial ENDP 回答1: It is just me

Assembly: How to convert hex input to decimal?

痞子三分冷 提交于 2019-12-13 02:22:59
问题 I have found many questions on this issue, however, I have not been able to get my code to run. My program should take a hex value, check to see if it is a valid hex character, then display the hex value as a decimal value. If it is a lower case hex character then it needs to be converted to upper case. All this needs to be in a loop. I have all of this done except for converting the hex to decimal. I have the code in the program I think should convert it, but it will not compile. I will list

How can I tell if jump is absolute or relative?

落爺英雄遲暮 提交于 2019-12-13 01:05:44
问题 I'm studying for a test in assembly and in the subject of "Position-Independent-Code" I find the difference between a relative jump and an absolute jump confusing. How can I tell what kind of jump it is? I understand what a relative jump is (the offset from current line). But what does an absolute jump look like? When does it happen? 回答1: Anything that looks like just plain jmp label is relative. Absolute jumps look like jmp register jmp [address] jmp segment:absoluteaddr jmp far [address]

x86 assembly - multimodule programming (MASM/TASM)

北城以北 提交于 2019-12-13 00:09:03
问题 ok so here's the code: assume cs:code, ds:data data segment sname db 'Some Name','$' len equ $-sname ascii db 'a'-'A' data ends code segment start: mov ax,data mov ds,ax cld lea si,sname do_this: lodsb cmp al,61h jae lowercase uppercase: cmp si,len je the_end jmp continue lowercase: mov bl,ascii sub ax,bx mov ds:[si-1],al cmp si,len je the_end continue: loop do_this the_end: mov ax,0000 lea dx,sname mov ah,09h int 21h mov ax,4c00h int 21h code ends end start Basically it just converts all

Pass by value and pass by reference in Assembly

为君一笑 提交于 2019-12-12 20:13:46
问题 I'm trying to solve this problem: Create a PROC procedure that takes one parameter as Pass by Value and prints the number of 'X' according to the number passed as a parameter. Before printing, make sure parameter is a positive number, at end of program you need to change the registers that have been used back to their first values . If the input to the procedure is 5 then the output on the console should be: XXXXX This is my code: var db 5 ;In the dataseg push [var] ;in the codeseg proc

8086 Assembly - DIV going ape, IP jumping to a weird location endlessly

谁说我不能喝 提交于 2019-12-12 20:00:57
问题 i've been stuck with this problem for like a day, not finding any relevant information.. there's this one part in my code that takes a number (ex. 259) and separates it's digits into array slots. SEPERATE_DIGITS: mov ax,RESULT ; result is the number im working on. RESULT dw 259h mov si,0 SEPERATE_DIGITS_LOOP: div TEN ; TEN dw 10h add dl,30h ; fix-up to print later on mov SEPERATED[si],dl ; store separated digit in my array. inc si cmp ax,0 jne SEPERATE_DIGITS_LOOP i have been debugging it on