flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Longmode cursor problem |
Author |
|
TAH 23 Feb 2011, 11:56
Hello all
I've been playing around with 64bit long mode for a while, using PetroffHeroj's FAT12 boot sector and Tomasz Grysztar's long mode example. For a while I've been trying to set the cursor position using the following code: Code: ; BX = Offset in buffer mov AL, 0Eh mov AH, BH mov DX, 03D4h out DX, AX inc AX mov AH, BL out DX, AX The problem is that I can set the position to anything up to position 118 in the buffer, but as soon as i try anything above 118 the cursor disappears from the monitor. I have tested the code using bochs 2.4.5 on two computers, same result on both. So, my question is; is the problem in the setcursor code or is it related to the boot sector or long mode code ? Any examples that work would be nice. References: http://flatassembler.net/examples/phboot.zip http://flatassembler.net/examples/longmode.zip TAH |
|||
23 Feb 2011, 11:56 |
|
Dex4u 23 Feb 2011, 16:56
This is a nice OS (Baremetal OS) that has 64bit functions examples for cursor in it.
http://www.returninfinity.com/baremetal.html |
|||
23 Feb 2011, 16:56 |
|
edfed 23 Feb 2011, 17:10
use double buffering and update cursor position during VSYNC, before text video memory refresh.
|
|||
23 Feb 2011, 17:10 |
|
TAH 23 Feb 2011, 17:16
Dex4u wrote: This is a nice OS (Baremetal OS) that has 64bit functions examples for cursor in it. Thanks, I'll look into it. |
|||
23 Feb 2011, 17:16 |
|
edfed 23 Feb 2011, 17:28
test it, it is the only way to know if it solves the problem.
double buffering lets you play with video memory image, without the overhead induced by slow direct video memory accesses. |
|||
23 Feb 2011, 17:28 |
|
TAH 23 Feb 2011, 18:07
Well, seems like there is something strange going on here.
Tried the setcursor in bare-metal-os, and waiting for vsync. None of those solved the problem. Guess I'll have som debugging to do or start over rather |
|||
23 Feb 2011, 18:07 |
|
Dex4u 23 Feb 2011, 18:20
What interface are you using to set bx is it something like this
Code: ; Set the cursor to: DH = X DL = Y ;-------------------------------------- setcursorxy: push eax push ebx push edx movzx bx, dl mov ax, bx shl ax, 4 shl bx, 6 add bx, ax movzx ax, dh add bx, ax call setcursor pop edx pop ebx pop eax ret ; Set the cursor to: BX = Offset ;--------------------------------- setcursor: push eax push ebx push edx mov al, 0eh mov ah, bh mov dx, 3d4h out dx, ax inc ax mov ah, bl out dx, ax pop edx pop ebx pop eax ret And what about memory mapping for screen is that OK ? |
|||
23 Feb 2011, 18:20 |
|
TAH 23 Feb 2011, 19:04
Dex4u wrote: What interface are you using to set bx is it something like this I use this for calculating the offset to move the cursor: Code: ; CH - Line ; CL - Column mov RAX, ScreenX mul CH xor CH, CH add AX, CX mov BX, AX I think this is ok, it works fine for the sting output X/Y routines. And i use the same address for screen output and clearscreen. The only problem I have is to move the cursor to the end of the string. |
|||
23 Feb 2011, 19:04 |
|
Dex4u 23 Feb 2011, 19:52
TAH wrote:
Have you just hand written that, if not should it not be Code: ; CH - Line ; CL - Column mov RAX, [ScreenX] mul CH xor CH, CH add AX, CX mov BX, AX |
|||
23 Feb 2011, 19:52 |
|
TAH 23 Feb 2011, 20:04
ScreenX is declared as
Code:
ScreenX equ 80
As I remember I don't need the [].... And as I said, it works perfectly for the print string function. Also, I put the value to move the cursor directly in the DX register for testing purposes. And the code I borrowed from baremetal don't use ScreenX.... |
|||
23 Feb 2011, 20:04 |
|
TAH 23 Feb 2011, 22:14
After the responses I've got here, I think the bug must be somewhere in the longmode, IDT or GDT code (which is new to me).
I'll try to redo these parts, and see if I can make it work. I'll keep you posted. Thanks for the help guys. |
|||
23 Feb 2011, 22:14 |
|
Dex4u 23 Feb 2011, 22:43
Yes i would like to know, just in case i move to 64bit and have the same problem.
Happy debugging |
|||
23 Feb 2011, 22:43 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.