x86-16

Trouble when reverse and display string in assembly

时间秒杀一切 提交于 2019-12-12 02:44:00
问题 here is my code: model small stack 100h .data string1 db "Khoa$" string2 db 4 dup(?) count dw 4 .code begin: mov ax,@data mov ds,ax mov es,ax mov cx,count mov si,0 mov di,0 add di,count dec di again: mov al,string1[si] mov string2[di],al inc si dec di loop again mov ah,9 lea dx,string1 int 21h end begin in this part mov ah,9 lea dx,string1 int 21h when i try to display string1 to console, it's ok. but no result with string2. i'm new to assembly. Please help! 回答1: Although this is homework,

Assembly speaker and wait interrupt endless sleep

十年热恋 提交于 2019-12-12 01:54:57
问题 This question was migrated from Electrical Engineering Stack Exchange because it can be answered on Stack Overflow. Migrated 4 years ago . I am working on an assembly program (8086) that plays music on the PC speaker. Everything works fine but I've got one problem. Program falls in endless sleep (with speaker on) on 78th note, no matter what note it is. I am using 86h function of 15 interrupt . So why does that endless sleep occur, and how to fix that? Here's the code (with Mortal Kombat

Entering and dealing with floating point numbers on IEEE 784 with assembler (NASM 32bit)

给你一囗甜甜゛ 提交于 2019-12-12 00:29:20
问题 I am taking Computer Architecture subject at University, and I was assigned to program a tool which would take floating point number as input, I guess store it in memory and printout hexadecimal form of the binary representation of the number in IEEE 784 standart. Now I am certain about the algorithm of converting any decimal floating point number to its binary form in IEEE 784 on paper yet I struggle to come up with a solution for assembler (numbers can be such as -157.4, 0.5, -0.6 and etc.)

How to add in assembly?

末鹿安然 提交于 2019-12-11 18:35:13
问题 I am trying to make a calculator in assembly. You introduce two variables and then you choose the operation. Now the operation is only addition. I am working only with BIOS interrupts, no DOS. Can someone explain to me how to make it? I have two problems and I am stuck with them: The first problem is when I add 5+6 for example it returns 59(48+11) in ASCII. I think a solution would be to print in decimal but I found nothing on the internet using only BIOS interrupts. The second problem is

How can i make the os wait a second before shutdown ( nasm )

让人想犯罪 __ 提交于 2019-12-11 15:54:32
问题 powerCommand: mov si, powerOFF call printString ;sleep command here mov ax, 0x1000 mov ax, ss mov sp, 0xf000 mov ax, 0x5307 mov bx, 0x0001 mov cx, 0x0003 int 0x15 ret I want the program wait for 1 second then continue with shutdown. At the moment it shuts down instantly after the shutdown message. I am running it on my custom os made in nasm. 回答1: Assuming your program is loaded by the ROM-BIOS (not EFI), and you're running in (Real/Virtual) 86 Mode, and you have interrupts enabled ( sti ),

Assembly system time DOS

北慕城南 提交于 2019-12-11 14:57:55
问题 I wrote some code: petla: mov ah,2 int 1ah mov[sekunda], dh mov ah, [sekunda] mov cl, 4 and ah, 11110000b shr ah, cl mov dl, ah add dl, '0' mov ah, 2 int 21h mov ah, [sekunda] and ah, 00001111b mov dl, ah add dl, '0' mov ah, 2 int 21h jmp petla sekunda db 0 When I run this program shows me lot of values (seconds) looks like this: 12 12 12 12 12 13 13 How modify code to show only one time one values ( one seconds one value)? How I can modify code to show for example time every 5 sec? I need

Using the mouse in a game

不想你离开。 提交于 2019-12-11 13:24:57
问题 I’m trying to do a game (really basic) that a character printed on a random place (in graphic mode). And then if the player pressed with the mouse on it, it changes to other random place. I did some function - which calculating a random place, print the character, and then checked if the player pressed on it If no continue to check, if yes jumps to the beginning and calculating a random place print and more... But I have a problem. Until the pressing everything works fine but then, after I

Convert hexadecimal number to hexadecimal string in assembly language (NASM) (debug)

北战南征 提交于 2019-12-11 11:53:10
问题 OK, before someone else marks this question as a duplicate. Let me make this very clear that this is more of a debugging problem than a logical problem. The logic is correct as far as I know because if I individually print the value in bx register after each operation, then I get correct output. The problem is that storing the results in bx register should make changes in the memory location it holds which is not happening. So, I was learning assembly language these days, in NASM. I am

Physical address calculation assembly IAPX8088

你说的曾经没有我的故事 提交于 2019-12-11 11:53:09
问题 Given that: CS=0x5645, DS=0x1000, ES=0x6783, SS=0x0FFF, BX=0x4567, SI=0x1000, DI=0x2000, BP=0x4500 Write the physical address of the memory locations read or written by the following instructions if ax=0. mov ax,[si] mov ax,[bp] mov ax,cs:[bp+20] mov ax,[bx+si+10] mov ss:[bx+di],ax mov es:[bp+si+0x200],20 What is the formula for calculation address this way and how to deal with segment registers in this. 回答1: To calculate the physical address do the following: All the components between the

Assembly (emu8086) not allowing moving of bytes into 8-bit registers

淺唱寂寞╮ 提交于 2019-12-11 10:39:35
问题 I am making a calculator-type program, and I use this to get a number from the user and store it: mov ah, 01h int 21h mov offset num1, al and at the end of the code I have num1 set up as a byte with num1 db 0 giving it a default value of 0. The problem is, when I try to move the value from num1 back into a register to perform the actual operation: mov bl, offset num1 I get an error saying the second operand is over 8 bits, and I cannot figure this out through any searching of the internet