Questions tagged [real-mode]

x86 real mode is where a CPU begins execution. It has a 20-bit memory address space and unlimited direct software access to all addressable memory, I/O addresses and peripheral hardware. It has no concept of virtual memory, paging or memory protection as in protected-mode and long-mode. Use this tag for programming questions related to real mode.

Real mode, also called real address mode, is an operating mode of all x86-compatible CPUs.

Real mode is characterized by

  • a 20-bit segmented memory address space (giving exactly 1 MiB of addressable memory) and
  • unlimited direct software access to all addressable memory, I/O addresses and peripheral hardware, it
  • provides no support for memory protection, multitasking, or code privilege levels.

Before the release of the 80286, which introduced real mode was the only available mode for x86 CPUs. In the interests of backwards compatibility, all x86 CPUs start in real mode when reset, though its possible to emulate real mode on other systems when starting on other modes.

281 questions
2
votes
0 answers

Risk in switching between real and protected mode multiple times

For my custom bootloader project, I asked myself whether there is a risk or overhead in switching between real mode and protected mode multiple times. So far, I've been looking at the following questions: Switch to and from 16-bit Real Mode and…
CRoemheld
  • 889
  • 7
  • 26
2
votes
1 answer

Find Segment address from given physical and effective address

how to find a segment address from given data? Physical address = 0x119B, Effective address = 0x10AB what could be the formula?
Damsaz Ali
  • 23
  • 3
2
votes
2 answers

How can I copy memory data from pointer to array ASSEMBLY 8086

I'm working on a C program that calls an assembly function passing an array as argument. In the assembly code (for 8086), I'm able to get the address of the array in memory and to save the address in ES:BX but after that I need to copy the values to…
ssoBAekiL
  • 635
  • 3
  • 13
2
votes
1 answer

Calculating the segment address range of an 8086 assembly programm

I have the following lines of programm (written for 8086 Microprocessor): first SEGMENT BYTE a db 7 dup (?) first ENDS second SEGMENT WORD b dw 200 dup (?) second ENDS third SEGMENT PARA c db 3 dup (?) d dw ? third ENDS And I need…
Zacky
  • 243
  • 1
  • 3
  • 12
2
votes
1 answer

Write to address without segment register

I know this code will actually write data to ds:[100h] mov [100h], ax But how can I write to linear address 100H directly without using any segment register for a segment base?
Jack
  • 227
  • 3
  • 8
2
votes
0 answers

Reading the content from 0000:FFFF to AX register may change CS:IP to F000:E9DF

I want to read the word at memory address 0000:FFFF, but when I debug my program: org 0x7C00 mov ax, 0x0000 mov ds, ax mov ax, [0xFFFF] executing the last instruction mov ax, [0xFFFF], will change CS:IP to F000:E9DF. So strange...
Jack
  • 227
  • 3
  • 8
2
votes
0 answers

(nasm x86 real mode) How to write/read strings in boot-loaded sector?

I'm using NASM to write a minimal OS for x86 real mode for educational purposes. I want to use the 512-byte boot sector to load a larger sector that contains the rest of the OS. I've successfully created a boot sector that loads another sector, but…
jth
  • 369
  • 3
  • 8
2
votes
1 answer

Assembly string instructions register DS and ES in real mode

I have been studying this assembly program from my book and I have a question about it. The purpose of this program is to simply copy string1 to string2. My question relates to the following two instructions: mov AX,DS mov ES,AX I…
Rubiks
  • 461
  • 1
  • 6
  • 21
2
votes
1 answer

Entering Protected Mode: Triple-Fault

I am adding SMP to my kernel, in which the AP should boot. It starts in realmode and faults on entering protected mode. To be clear, it faults on the JMP 0x8:... after loading CR0. I am sure that the AP is getting its code, because looping anywhere…
Shukant Pal
  • 706
  • 6
  • 19
2
votes
0 answers

If the segment address is greater than F000H, will the A20 pin be enabled?

In the book "The Intel Microprocessors" by Barry B. Brey, I have seen that if the segment address is FFFFH, A20 pin is enabled while adding offset to the segment address. But to take the full advantage of the "high memory", any segment address in…
Preetom Saha Arko
  • 2,588
  • 4
  • 21
  • 37
2
votes
0 answers

My assembly procedure doesn't seem to return

I'm trying to write a code to be ran as a bootloader. It should print 'Enter your name', then read user's name, then proceed to do other things, but I'm stuck at printing 'Enter your name!'. When I run this code, it does print 'Enter your name!',…
2
votes
1 answer

Real Mode Assembly Get Keyboard Input

In real mode assembly, I use this code: mov ah, 0h int 0x16 to wait for a keyboard input. I know when a key is pressed, the information about the key I press is stored in ah and al registers. For example, when I press ENTER, 0x0D will be stored in…
ArdaGuler
  • 95
  • 2
  • 8
2
votes
0 answers

Trying to return from Protected Mode to Real

i'm trying to go back to real mode, after protected, and processor just got stuck right after changing cr0 register. I'm using nasm, and compile my program as binary .img to run under virtualbox as bootloader. Probably I'm missing something with…
xdegtyarev
  • 135
  • 1
  • 8
2
votes
0 answers

32bit displacement, near call, real mode

Suppose we have near relative call x86 instruction. E8 offset // offset from the next instruction Size of offset is determined by current operand size. In 32bit protected mode: E8 rel32 // target 32bit address = add_32bit(eip, rel32) 66…
igntec
  • 1,006
  • 10
  • 24
2
votes
1 answer

why these real-mode code works in virtual machine but not working on my real machine?

I'm trying to write assemble code into mbr to use BIOS ISRs. I write the following code to the mbr, expecting the chars "ABCD" to be printed on the screen: mov ah,0x0e mov bp,0x8000 mov sp,bp push 'A' push 'B' push 'C' push 'D' mov al,…
social_loser
  • 143
  • 1
  • 6