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
1 answer

Can I run assembly program that switches to protected mode in dosbox?

We are studying an assembly program that switches an 386 processor from real mode to protected mode, and then back to real mode. The program is compiled using TASM. Because this program needs to do some privileged operations, and it needs to start…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
2
votes
2 answers

i386 Real mode - loading from floppy

I am approaching to x86 real mode coding, and I have found some example code here: http://www.nondot.org/sabre/os/files/Booting/nasmBoot.txt The third example in that article loads a few sector of the floppy in the memory using the BIOS calls in…
mghis
  • 517
  • 1
  • 5
  • 14
2
votes
2 answers

Accessing memory at 0xF000FFFE (computer type) in fasm (MS-DOS)

The problem is: I need to get 'computer' type from BIOS memory. I know, that I can do it that way in fasm (my program and all segments are 16 bits): mov al, [0xF000FFFE] but that returnes zero and it is not right, because equivalent code in turbo…
deathmood
  • 113
  • 6
2
votes
1 answer

What does this hvmloader.c bootloader code do?

I read the code of xen and find the code below. But I don't know the meaning of it. Is it the code which initializes idt and gdt? Is it the code that jumps from real mode to protected mode? If it is, where is the physical address of gdt and…
Jimmy
  • 353
  • 3
  • 10
1
vote
0 answers

Real Mode x86 simulator similar to SPIM?

I am looking for a Real Mode x86 simulator similar in principle to the MIPS32 simulator "SPIM". Ideally, it would also support 286 Protected Mode (32 bit Protected Mode is less important). Anyone know such a beast?
Andrew J. Brehm
  • 4,448
  • 8
  • 45
  • 70
1
vote
1 answer

Why my print function doesn't print my string?

I just started creating my first operating system, I wanted to start with a very simple bootloader that basically just prints a very simple string. But I can't figure out why, whatever string, the virtual machine (qemu) just prints a 'U' This is my…
1
vote
0 answers

How to start to build OS/Kernel

I'm starting to program my first "operating system", for now I have created only the bootloader but I would like to add the kernel as well as I can. Do I need to create a linker.ld file? (I've never used a linker file) Do I have to write the kernel…
1
vote
1 answer

Enabling the VGA 13h video mode on a modern PC in UEFI via a UEFI bootloader, written in assembly

I have been writing some x86_16 assembly code for BIOS real mode as a hobby for quiet a while now. Recently I decided to move to writing 64-bit bootloaders for UEFI. First thing, that I came up with was entering the 13h VGA graphics mode(256 colors,…
adivanced
  • 31
  • 6
1
vote
1 answer

questions about writing an operating system

I have some very specific questions about writing operating systems that I was hoping could get answered: How much assembly code would I need to write to load a minimal C Kernel if I use GRUB as a boot loader? My kernel will be written in C, It…
PgrAm
  • 671
  • 2
  • 7
  • 19
1
vote
1 answer

Copy single byte to multiple memory locations in XV6 8086 Assembly 0x13 VGA (Real Mode)

Before anybody tells me that this technology is outdated, I am aware however the scope of the project is very specific. My requirement is to print a filled rectangle to the output by writing directly to the video memory (0x13 in real mode). I have…
1
vote
2 answers

The relation between I386 GDT and display memory address 0xa0000?

I believe I have set up the GDT correctly like this: # Start the CPU: switch to 32-bit protected mode, jump into C. # The BIOS loads this code from the first sector of the hard disk into # memory at physical address 0x7c00 and starts executing in…
lewis
  • 51
  • 3
1
vote
0 answers

Jump to the wrong position when perform a far jump operation in x86 real mode

first apologize for my poor english : ) I'm now developing a simple bootloader for my toy os, but i got stucked in the very early stage. That is i want to move the bootsector from 0x7c00 to 0x90000 for the new kernel movement, but when i finished…
1
vote
0 answers

Video BIOS is displaying wrong pixels/text

Recently I have started learning bare-metal assembly programming (NASM) and got myself a headache right in the beginning. After learning basic syntax I tried to write code that will draw something in real mode on screen in text or as graphics. I…
Haramoyo
  • 35
  • 1
  • 4
1
vote
1 answer

Base poiner offset in x86 real mode

Having a following code: .code16 _entry: xorw %ax, %ax movw %ax, %ds movw %ax, %ss movw %ax, %es movw $0x7c00, %ax movw %ax, %sp movw %ax, %bp pushw $49 callw printh addw $4, %sp lp: jmp…
TheCPPNoob
  • 31
  • 4
1
vote
2 answers

What exactly is memory mapped io and port based io

Well I have some confusions about memory mapped io and port based io. Questions are:- In port based io if I write to a port will it affect the corresponding memory address or not and vise versa. Does x86 uses port based io or memory mapped io.(I…