(This post is about my previous post.)
PlayOS; yes, LINEAR_SEL describes a segment with base address 0 and it is a readable segment. I noticed that this code worked on a 166 MHz machine and it is not working on my 800 MHz machine. I think the problem might be about BIOS settings of machines. Can base of text video memory addresses of two machines be different? Thanx in advance for any advices...
Previous Post:
The code below is a part of bootloader that I am trying to write. Here, code has turned into pmode. Now it should write Hello to upper left corner of screen but it does not. I could not find out why. Ant ideas are welcome. Thanx in advance for any advices...
NOTE: In case you might want to know, I started with org 0x0000 and A20 is (at leaset should be) enabled at this place of code.
...
mov cr0,eax
jmp SYS_CODE_SEL:do_pm + 0x7c00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 32-bit protected mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[BITS 32]
do_pm: mov ax,SYS_DATA_SEL
mov ds,ax ; not segments anymore: SELECTORS
mov ss,ax
nop
mov es,ax
mov fs,ax
mov ax,LINEAR_SEL
mov gs,ax
; write to text video memory starting at linear address 0xB8000
; (upper left corner of screen)
mov byte [gs:0xB8000],'H'
mov byte [gs:0xB8002],'e'
mov byte [gs:0xB8004],'l'
mov byte [gs:0xB8006],'l'
bootloader qx 4
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:bootloader qx 4
No I thought people who want to answer this question might want to know the answer that I gave to PlayOS. So that no time and place wasted in forum.
Re:bootloader qx 4
It is not likely that two standard VGA video adapters will have different base for text video memory, are both systems operating in the same text mode when you run the code? Is your video adapter standard VGA compliant?
Have you tried explicity setting the video mode while still in real mode? I do this to clear the screen. I use mode 0x03 (80x25 Color Text).
Hope this helps.
Have you tried explicity setting the video mode while still in real mode? I do this to clear the screen. I use mode 0x03 (80x25 Color Text).
Hope this helps.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:bootloader qx 4
text mode is starting at 0xb8000 on every VGA-compliant colour display and at 0xb0000 on VGA-compliant monochrome display. However, in order to have a char displayed correctly, you must first have both character byte (at 0xb?000+2*n) and a mode byte (at 0xb?000+2*n+1) in VRAM. The latter one selects the color/blink/underline state of your character. if mode byte is 0, you're printing black on black! thus there is little chance you see anything
try to add
it should set up the first 4 bytes with light grey on black ...
try to add
Code: Select all
mov dword [gs:0xb8000],0x07070707