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
45
votes
3 answers

Cannot write to screen memory in C

I am very new to C, it's my second high-level programming language after Java. I have gotten most of the basics down, but for whatever reason I am unable to write a single character to screen memory. This program is compiled using Turbo C for DOS on…
Ampera
  • 440
  • 4
  • 13
31
votes
10 answers

Printing out a number in assembly language?

mov al,10 add al,15 How do I print the value of 'al'?
Kristina
  • 15,859
  • 29
  • 111
  • 181
14
votes
1 answer

What is a paragraph (when referring to memory)

I feel silly for asking something that seems like it should be so easy to look up, but as you might guess, searching for paragraph gets a lot results that have nothing to do with what I want to know. I've been learning assembly these past few days…
cost
  • 4,420
  • 8
  • 48
  • 80
14
votes
6 answers

What are the segment and offset in real mode memory addressing?

I am reading about memory addressing. I read about segment offset and then about descriptor offset. I know how to calculate the exact addresses in real mode. All this is OK, but I am unable to understand what exactly offset is? Everywhere I…
narayanpatra
  • 5,627
  • 13
  • 51
  • 60
13
votes
5 answers

Is it possible to use 32 bits registers/instructions in real mode?

I'm confused about a simple assembly problem when studying some simple os source code. In this website: http://wiki.osdev.org/Babystep7 the following code is to switch from real mode to protected mode mov eax, cr0 or al,1 mov cr0, eax I know how…
mike820324
  • 217
  • 3
  • 13
12
votes
4 answers

Looking for 16-bit c compiler for x86

I am working on porting uc/OS-II from DOS to x86 (real mode). I need: A compiler to generate real mode 16-bit x86 assembly An assembler to assemble the generated assembly into an object file A linker to link the object files together and output an…
user639642
  • 123
  • 1
  • 1
  • 5
12
votes
1 answer

How to write to screen with video memory address 0xb8000 from real mode?

I created simple code to load second sector from hard drive, and then write to whole screen, with spaces with red background. The problem is that always instead of spaces I got @ signs. This is the code: org 0x7C00 bits 16 xor ax,ax mov ds,ax mov…
vakus
  • 732
  • 1
  • 10
  • 24
12
votes
3 answers

What is the true difference between a real mode program and a protected mode program?

I know the difference between a real mode and protected mode from the OS and hardware perspective. But I am trying to figure out What does a program 'knows' about real mode or protected mode? how can you say while looking at an source code/object…
KawaiKx
  • 9,558
  • 19
  • 72
  • 111
11
votes
1 answer

Using ".intel_syntax noprefix" how can I get memory address of a label?

I'm learning how to create real mode programs assembled and linked with: GCC Assembler version 2.25 Binutils version 2.25 GCC version 5.2.0 I use Intel syntax without prefixes specified with .intel_syntax noprefix I want to load the address of a…
TheDome
  • 343
  • 3
  • 10
11
votes
1 answer

Running code on different processor (x86 assembly)

In real mode on x86, what instructions would need to be used to run the code on a different processor, in a multiprocessor system? (I'm writing some pre-boot code in assembler that needs to set certain CPU registers, and do this on every CPU in the…
Rhys Bradshaw
  • 113
  • 1
  • 4
9
votes
2 answers

Real-Mode x86 ASM: How are the Basics Done?

I'm currently reading the boot.s file in the source for the first ever Linux kernel (assuming that 0.01 is indeed the first public release). I know C and ASM, the latter considerably less than the former. Even so, I seem to be able to understand and…
Louis
  • 2,442
  • 1
  • 18
  • 15
9
votes
1 answer

Segmented far pointer allocation in 16bit x86 MS-DOS real mode

I'm trying to get my head around programming real mode MS-DOS in C. Using some old books on game programming as a starting point. The source code in the book is written for Microsoft C, but I'm trying to get it to compile under OpenWatcom v2. I've…
IronPug
  • 123
  • 4
8
votes
2 answers

Grub and getting into Real Mode (low-level assembly language programming)

I've been working on a toy OS and have been using grub as my boot loader. Recently when trying to use VGA I found that I couldn't use hardware interrupts. This I found was because I had been slung into protected mode by grub. Does anybody know how…
blackthorn
8
votes
1 answer

Switch from protected mode to real mode in a DOS EXE program

I learned to switch to protected mode with a simple DOS based bootloader. This loader loads kernel.bin into a buffer and copies the buffer to 100000h (kernel is 8KiB). Control is then transferred to the kernel. When I return from the kernel and…
micheal007
  • 137
  • 9
8
votes
2 answers

How to switch from real mode to protected mode after bootloader?

I just finished up a very bare-bones bootloader for my OS and now I'm trying to switch to protected mode and jump to the kernel. The kernel exists on the second sector (right after the bootloader) and on. Can anyone help me out with my code? I…
David
  • 693
  • 1
  • 7
  • 20
1
2 3
18 19