x86-16

80286: Which is the fastest way to multiply by 10?

荒凉一梦 提交于 2020-05-09 06:31:05
问题 To multiply a number by any any multiple of 2, I'll shift it those many times. Is there any such technique to multiply a number by 10 in less cycles? 回答1: The 80286 did not have a barrel shifter, that was introduced with the 80386. According to the timing tables in the Microsoft Macro Assembler 5.0 documentation (1987), SHL reg, immed8 takes 5+n cycles, whereas SHL reg, 1 takes 2 cycles. ADD reg, reg takes 2 cycles, as does MOV reg, reg . IMUL reg16, immed takes 21 cycles. Therefore, the

Assembly Array data storing

泄露秘密 提交于 2020-05-02 04:24:12
问题 Here is a new update on what i'm doing currently. I'm confused on how to use the data i stored in S2 to search the same word in the whole screen. If found highlight the word. DOSBOX - compiler : A86 org 100h ;----------------------------------------------------- lea bp, S1 mov cx, 35 mov al, 1 mov ah, 13h mov bh, 0 mov dl, 0 mov dh, 25 mov bl, 7 int 10h ;---------------------------------------------------------- ; Asks input' mov di,1 start: mov ah, 0 int 16h mov dx,ax mov ah, 0eh cmp dx

How to Solve 'bootloader.asm:30: error: TIMES value -44 is negative' Problem in NASM

一个人想着一个人 提交于 2020-04-07 10:29:22
问题 I'm developing a Hello World kernel and bootloader...I wrote this code but when I try to compile it via NASM It says : "bootloader.asm:30: error: TIMES value -44 is negative". bootloader.asm: [BITS 16] [ORG 0x7C00] MOV DL, 0x80 MOV DH, 0x0 MOV CH, 0x0 MOV CL, 0x02 MOV BX, 0x1000 MOV ES, BX MOV BX, 0x0 ReadFloppy: MOV AH, 0x02 MOV AL, 0x01 INT 0x13 JC ReadFloppy MOV AX, 0x1000 MOV DS, AX MOV ES, AX MOV FS, AX MOV GS, AX MOV SS, AX JMP 0x1000:0x0 TIMES 510 - ($ - $$) db 0 DW 0xAA55 kernel.asm:

Variable in memory not updated by a store to that symbol

妖精的绣舞 提交于 2020-04-07 07:49:50
问题 When I run the emu8086, this result(ans) return to me 0 ..Why ? data segment ans dw ? ends stack segment dw 128 dup(0) ends code segment start: mov ax,@data mov dx,ax mov ax,2 mov bl,2 mul bl mov ans,ax mov ax, 4c00h int 21h ends end start 回答1: mov ax,@data mov dx,ax This part of the code must setup the DS segment register. You made a typo and wrote DX instead! mov ax, @data mov ds, ax Because of this error, the result of your AL * BL multiplication (4) was still written in memory by mov ans

Multiplying 32 bit two numbers on 8086 microprocessor

僤鯓⒐⒋嵵緔 提交于 2020-03-16 07:25:57
问题 I have code example for multiplying two 16 bit numbers on 8086 and trying to update it for two 32 bit numbers multiplying. start: MOV AX,0002h ; 16 bit multiplicand MOV BX,0008h ; 16 bit multiplier MOV DX,0000h ; high 16 bits of multiplication MOV CX,0000h ; low 16 bits of multiplication MOV SI,10h ; loop for 16 times LOOP: MOV DI,AX AND DI,01h XOR DI,01h JZ ADD CONT: RCR DX,1 RCR CX,1 SHR AX,1 DEC SI CMP SI,0 JNZ LOOP JMP END ; ignore here, it's not about multiplication. ADD: ADD DX,BX JMP

How does a bitwise AND (or TEST) with 16 test the 5th bit?

ぐ巨炮叔叔 提交于 2020-02-25 06:08:59
问题 In my College's documentation on 8086 Assembly is the following example: TEST AL, 16 ; tests the 5th bit's state Is this at all correct given what the TEST instruction does? It sets flags based on AL & 16 . How does that test the 5th bit? NOTE: there's no previously mentioned value to AL, just exactly what's shown here, so I assume this has to work in the general case. 回答1: 16 in decimal is 10000 in binary. Notice the fifth bit from the right is set, and that it is the only one. TEST is

How to add numbers and display them to the console in a bootloader?

删除回忆录丶 提交于 2020-02-05 15:49:28
问题 I'm creating bootloader that should plus 512 to variable and print result until reaching the specified number. For me, it is 4194304, but the problem is that I really don't understand how to plus these numbers, because at the end I always get nothing or corrupted string. So how should I plus numbers correct? cpu 386 bits 16 org 0h start: cld xor ax,ax mov ss,ax mov sp,7c00h ; setup stack mov ax,8000h mov es,ax ; initialize es w/ 8000h mov ds,ax ; initialize ds w/ 8000h ;======================

Why don't x86 16-bit addressing modes have a scale factor, while the 32-bit version has it?

爷,独闯天下 提交于 2020-02-03 09:39:28
问题 I'm trying to figure out a reason for the scale factor not being present in the x86 16-bit addressing modes (MASM assembly). While the 32-bit and 64-bit addressing modes have a scale factor. Is there an actual reasoning behind this or it doesn't need it? I would appreciate it if you could explain. All possible ways different components can be combined to create an effective address: Differences between 16- and 32-bit addressing modes 回答1: 16-bit addressing modes only allow a single ModRM byte

generating sound in assembly 8086

冷暖自知 提交于 2020-02-02 15:01:08
问题 I'm trying to generate a sound with a specific frequency using 8086 assembly. I have searched and searched and found lots of codes regarding connecting to the speaker (not the PC speaker). Yet, none of them seem to work. The following is my code: mov al, 182 ; meaning that we're about to load out 43h, al ; a new countdown value mov ax, 2153 ; countdown value is stored in ax. It is calculated by ; dividing 1193180 by the desired frequency (with the ; number being the frequency at which the

Set and reset keyboard Interrupt Service Routines in x86 real mode within DOS with Assembly

白昼怎懂夜的黑 提交于 2020-01-24 11:14:12
问题 How do you properly set, and then reset, the keyboard ISR in DOS? (x86 assembly, real mode, 16 bit, with TASM) I have the following assembly code which sets up my ISR for the keyboard. All it is supposed to do is print out a sentence each time a key is pressed, up to five times. Then it is supposed to exit. It seems like the ISR is being installed correctly. It will print out a sentence each time a key is pressed (once for down, once for up). However, it appears as though I am uninstalling