Page 1 of 1

Direct access to memory

Posted: Mon Mar 03, 2008 11:03 pm
by crchemist
In DOS i can write something like that:

Code: Select all

mov ax, 40h
mov ds, ax
mov dx, [ds:1Eh]
how can i rewrite this chunk for colibri?

sorry for stupid questions - i'm common student, not asm guru ;)

Re: Direct access to memory

Posted: Mon Mar 03, 2008 11:32 pm
by crchemist
Ok, another question - can i get access to keyboard buffer in kolibri? Can i access to 40:1АН in protected mode?

Re: Direct access to memory

Posted: Tue Mar 04, 2008 1:49 am
by crchemist
crchemist wrote:Ok, another question - can i get access to keyboard buffer in kolibri? Can i access to 40:1АН in protected mode?
No, i can't. :(

Re: Direct access to memory

Posted: Tue Mar 04, 2008 8:47 am
by hidnplayr
crchemist wrote:Ok, another question - can i get access to keyboard buffer in kolibri?
Sure you can, but you can only read the first key in buffer, by using this function:
http://kolibrios.org/?p=Documentation&s ... ons&sfp=02

Commonly, people wait/check for a key event first, with function 10, 11 or 23.

As for Direct access to memory, i dont know exactly what you mean..

If you are just trying to read/write from a byte/word/dword in memory, you can do as follows:

Code: Select all

; write 123 into the byte memory
mov byte[label_to_byte], 123 
;.....
;now lets read the byte into al
mov al, byte[label_to_byte]
;....
label_to_byte: db 0

Re: Direct access to memory

Posted: Tue Mar 04, 2008 8:53 am
by <Lrz>
As rule, you can get access to keyboard buffer in kolibri if you will use the System Functions Reference. This is a link http://www.kolibrios.org/?p=Documentation&lang=en. Next, you cannot get the memory from a program because this array is place in protection of memory if you not use the system function.

Re: Direct access to memory

Posted: Tue Mar 04, 2008 5:46 pm
by crchemist
hidnplayr, you don't understand - i don't want read from some "label_to_byte", i want read value from 40h:1Ah (head ptr) and from 40h:1Ch (tail ptr) addresses. I can't read or write to this addresses - they located in protected memory as said <Lrz>. Certanly I know that i can access to keyboard within system functions. I'm new to kolibri and now i experement with (teach) it. I am trying to write some labs from "system programming" subject in kolibri for better understanding of kolibri and protected mode.

Re: Direct access to memory

Posted: Tue Mar 04, 2008 10:10 pm
by hidnplayr
ok, i tought i didnt understand you correctly :)

good luck with your projects