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

Binding PIT, PIC and IVT together to get a sleep() function

I have decided to write a small program to check, if I am able to implement a sleep function in a real mode app. Thats, what I did: Added an IRQ_0 handler function to the address at 0x0000:0x80, corresponding to the 0x20 interrupt in the IVT Set up…
adivanced
  • 31
  • 6
0
votes
0 answers

When I use soft interrupt, the program returns from protected mode to real mode. Why is this happening?

void test_task_a(void) { int i, j, k; k = 0; /* Normal: trigger #GP */ /*asm ( "int $32\n\t" );*/ while(TRUE){ for(i = 0; i < 100; i++){ for(j = 0; j < 10000; j++){} //delay } …
0
votes
2 answers

x86 real mode function calls not executing

I have some x86 realmode assembly code which isn't behaving exactly as expected. I believe the issue relates to an incorrectly calculated jmp/call offset, but I might be mistaken. Here is the assembler language code: [org 0x7c00] mov ah, 0x0e mov…
FreelanceConsultant
  • 13,167
  • 27
  • 115
  • 225
0
votes
0 answers

"Real-mode" equivalent linux 64-bit

For an electrical-engineering research project, I'm looking for a way to have a code of a simple test-program running on a PC, to operate on an entire single-core while having full access to cpu resources and the entire non-virtual address space. No…
ds_2001
  • 1
  • 1
0
votes
1 answer

x86 timer2 of 8254/8253: creates always 1s instead of wave

I'm trying to make a hardware delay using the counter2 of 8254 IC by creating a square wave and counting the number of times the square wave value got 1: mov al, 10101110B out 43H, al mov al, 33h out 42H, al mov al, 05h out 42H, al …
Pouria
  • 49
  • 8
0
votes
0 answers

Making a print function in real mode

I've seen a lot of questions doing the same thing as me but didn't really find an answer that helped me. Like the title says, I'm trying to make a simple print function that takes an address of a string that was pushed to the stack and print…
0
votes
0 answers

How do I print a number in bios assembly

I tried many ways of doing this and was searching the internet for 2 hours, didn't find anything. Please help, new to assembly. I realised that I have to convert the number into a string, but I didn't succeed in doing so. Last attempt: pint: …
0
votes
0 answers

How to draw specific type of colour at some row col in assembly?

I want to know how to draw a particular pixel on screen at given row, col in assembly in 16 bit real mode for boot sector? Also how can I know width and height of screen?
Rahul
  • 47
  • 4
0
votes
1 answer

NASM: Invalid effective address in Real Mode

I am trying to draw to screen in Real Mode, so I am trying to access 0xB8000 using segmentation My assembly code is this [BITS 16] org 0x7c00 begin: mov ah, 0x01 ; disable cursor mov ch, 0x3f int 0x10 mov ch, 0x0000 mov cs, 0xb800 mov…
frogstair
  • 444
  • 5
  • 20
0
votes
2 answers

Updating variable that lives in the data segment from the stack and its segment

I currently have three segments of memory, my main data segment, stack segment and the segment where my API lives. The following instructions are executed from the data segment, they push the address of cursorRow and welcomeMsg then do a far call to…
TheFuzz
  • 2,607
  • 6
  • 29
  • 48
0
votes
1 answer

x86 why do i keep getting CD in the al register when moving a variable

Titles say the question. But basically every time I use the MOV instruction with a variable to a register the register display CD. but when I use an actual number the register display the number? Does mov ax, @data mean move the data segment memory…
DarkAtomz
  • 23
  • 6
0
votes
0 answers

Reading defined bytes that i loaded into a different segment [NASM, real mode]

I loaded this code off of the disk at 0x1000:0x0000 Here is the memory address of wtf being pushed onto the stack in segment 0x1000, then returning to segment 0: mov ax, wtf push ax push ds mov ax, 0 push ax mov ax, word [ds:0x1000] push ax retf…
0
votes
0 answers

Translate real mode memory access instrution to AT&T syntax

How do I translate the following x86 real mode instruction to gas AT&T syntax? cmp word [es:di], 0x1234
Peter
  • 2,919
  • 1
  • 16
  • 35
0
votes
1 answer

Can I get some info on real mode segments

I have been trying to understand segmented memory and I came across this statement on this website: website. The first sentence is the most confusing to me.. "Interesting to note is the fact that although segments are 64KB in size, they are spaced…
TheFuzz
  • 2,607
  • 6
  • 29
  • 48
0
votes
1 answer

How can I create a power function in assembly?

I'm trying to write an assembly function to convert ASCII decimal digits into hexadecimal values which can be easily used by the computer. Before showing my code, I have to point out that I'm working in 16-bit real mode (using AT&T syntax),…