x86-16

What addressing mode is used in 'mov cx, [bp+6]'?

霸气de小男生 提交于 2019-12-02 08:32:00
问题 What addressing mode is used in "mov cx, [bp+6]"? The processor is intel 8086. I am studying "Microprocessor and Interfacing" by Douglas V. Hall. I know its memory addressing mode. But not sure whether its based addressing mode or index addressing mode? 回答1: [bp+6] is the based addressing mode. From the original 8086 docs: In based addressing, the effective address is the sum of a displacement value and the content of register BX or register BP. Indexed addressing mode is similar but with the

Turbo assembler language cursor position, offset

感情迁移 提交于 2019-12-02 07:53:23
We have given an instruction to make the the text CSC 112.1 to be centered. I used DB instruction and offset. This is my code .model small .stack .data c db 10,13,10,13," лллл ",10,13 db " лллллл ",10,13 db "лл лл",10,13 db "лл ",10,13 db "лл ",10,13 db "лл ",10,13 db "лл ",10,13 db "лл ",10,13 db "лл ",10,13 db "лл лл",10,13 db " лллллл ",10,13 db " лллл ",10,13,"$" .code mov ax,@data mov ds,ax call ccall ;call the procedure ccall which outputs C call scall ;call the procedure scall which outputs S call numcall ;call the procedure numcall which outputs 112.1 call exit ;call the procedure exit

What does SEG directive do in 8086?

大城市里の小女人 提交于 2019-12-02 06:56:13
SEG A : Assigns the content held in segment register corresponding to the segment in which A resides to the operand. I guess that means that if A lies in Data Segment, SEG A is the same as DS . Since DS holds the base address of the Data Segment, does MOV AX, LEA A MOV DX, SEG A MOV AX, [AX + DX] copy the physical address of A to AX ? I guess that means that if A lies in Data Segment, SEG A is the same as DS. Correct, if DS points to Data Segment. does MOV AX, LEA A MOV DX, SEG A MOV AX, [AX + DX] copy the physical address of A to AX? The last instruction is invalid, it does not exist in any

What does DX + 2 mean in mov ah,9 int 21h?

纵饮孤独 提交于 2019-12-02 06:53:07
mov dx, offset buffer mov ah, 0ah int 21h jmp print buffer db 10,?, 10 dup(' ') print: xor bx, bx mov bl, buffer[1] mov buffer[bx+2], '$' mov dx, offset buffer + 2 mov ah, 9 int 21h I know buffer[bx+2] stands for '$', but offset buffer +2 in mov ah,9 stands for what? They said, "Start printing from address DS:DX + 2 ". From address ds:dx +2 . When a string is captured from keyboard with int 21h, ah=0Ah, the string has next structure: As you can see, the first two bytes are control, the characters entered by user start at the third byte (byte 2). The last char is chr(13) (ENTER key). To display

Assigning value to the variable present in previous line using $ sign

我是研究僧i 提交于 2019-12-02 06:11:09
问题 I'm trying to understand the MS-DOS v2.0 source code, and in particular some of the code in MSDATA.ASM. This code was originally assembled with a 35+ year old MASM assembler (a version that wasn't commercially available). The code I'm interested in is near the beginning: SUBTTL Initialized data and data used at DOS initialization PAGE ; DATA AREA for MS-DOS IFNDEF KANJI KANJI EQU 0 ;FALSE ENDIF CONSTANTS SEGMENT BYTE PUBLIC 'CONST' EXTRN international_table:BYTE EXTRN Current_Country:WORD ORG

Get the supported “bitness” of an x86 CPU when booted in 16-bit mode

こ雲淡風輕ζ 提交于 2019-12-02 04:43:15
问题 I am developing an x86 bootloader and have come across this problem (which I guess should be pretty straightforward, but so far I haven't been able to solve): I want to detect the bitness of the CPU host (e.g. if it's 16bit-only, or supports 32bit or 64bit). I have used the CPUID instruction, but it was introduced with 486 so doesn't help for detecting 16-bit-only vs. a 386-compatible CPU that supports 32-bit protected mode (or 32-bit operand-size in real mode with prefixes). 回答1: Checking

Intel 8086 Assembly procedure calling from C

拥有回忆 提交于 2019-12-02 04:12:39
I need to develop a procedure for Assembly language and call that procedure from C language (pass a string and return an integer value). My assembly procedure works fine "stand-alone". I need help with connecting them together. Program is supposed to run on Intel 8086. I need to use MASM or emu8086 as assembler/simulator. Kindly recommend a C compiler and also a way to make the simple C program that is able to call the assembly procedure and get the returned value. How can I pass a string to this external function? How can I connect the ASM file and the C file? (How will the compiler know

What addressing mode is used in 'mov cx, [bp+6]'?

梦想的初衷 提交于 2019-12-02 04:11:05
What addressing mode is used in "mov cx, [bp+6]"? The processor is intel 8086. I am studying "Microprocessor and Interfacing" by Douglas V. Hall. I know its memory addressing mode. But not sure whether its based addressing mode or index addressing mode? [bp+6] is the based addressing mode. From the original 8086 docs: In based addressing, the effective address is the sum of a displacement value and the content of register BX or register BP. Indexed addressing mode is similar but with the SI or DI registers. Basically, you have the following modes: Direct memory accessing like [1234] . Register

Calculate Segment:Offset from absolute address

醉酒当歌 提交于 2019-12-02 03:29:15
问题 I can calculate an address Segment:Offset as Segment * 0x10 + Offset . But how do I calculate the opposite? E.g. how do I get from 0xF4170 to F400:0170 and from 0xACF04 to ABCD:1234 ? 回答1: You would be required to have either the base or the offset to start with, along with the linear address, as multiple Segment:Offset pairs can map to the same linear address. so if we have the segment 0xF400 and the linear address 0xF4170 , we get the offset being 0xF4170 - (0xF400 << 4) which is 0x170 .

Looping statement that works in Windows 7 debug instructions won't work in DOSBox 0.74

[亡魂溺海] 提交于 2019-12-02 02:51:24
问题 We had an activity about looping in assembly language. Our task is simple: display the numbers 0 to 9 with spaces in-between each number. I got the code to work in the command prompt using the 'debug' command in WINDOWS 7 in our school. My laptop is Windows 10 and I recently found out that there's no 'debug' command in the command prompt. So I tried writing my code in DOSBox 0.74 (latest, maybe). Every time i run it in DOSBox, the programs suddenly hangs up and then crashes. Here's the code