video memory addressing

Programming, for all ages and all languages.
Post Reply
wannabedeveloper
Posts: 8
Joined: Wed Mar 02, 2011 11:41 pm

video memory addressing

Post by wannabedeveloper »

Okay, just a quick question. How would you go about writing to an address like a000:013f? I've tried various things like a000:[013f] but none seem to work?
User avatar
JackScott
Member
Member
Posts: 1031
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:

Re: video memory addressing

Post by JackScott »

Firstly, what language are you trying to use?
Secondly, can you show us the code that isn't working?
Thirdly, what about it isn't working?
a5498828
Member
Member
Posts: 99
Joined: Thu Aug 12, 2010 7:25 am

Re: video memory addressing

Post by a5498828 »

question is how would i write? wtf. i would use for eg. mov/movs/stos, or a bios function.

this is address of a graphic mode of video controller. Have you set it go graphic mode? Maybe you dont see pixel. TRy reading it back.

Have you set cache to uc/wc/wt? if its wb it wont work well, and wp you wont read correct data but pixel wil lstill display correctly.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: video memory addressing

Post by Solar »

wannabedeveloper wrote:How would you go about writing to an address like a000:013f?
That's a real mode address. I.e., the 0xa000 must be loaded to a segment register, and the actual access be offset by the 0x013f.

Code: Select all

Mov BX, a000h
Mov ES, BX
Mov BX, 013fh
Mov AL, [ES:BX] 
Of course, things are different in protected mode.
Last edited by Solar on Thu Mar 10, 2011 11:14 pm, edited 1 time in total.
Every good solution is obvious once you've found it.
Gigasoft
Member
Member
Posts: 855
Joined: Sat Nov 21, 2009 5:11 pm

Re: video memory addressing

Post by Gigasoft »

Code: Select all

push 0a000h
pop es
mov byte ptr es:[13fh],whatever
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: video memory addressing

Post by Chandra »

Solar wrote:
wannabedeveloper wrote:How would you go about writing to an address like a000:013f?
That's a real mode address. I.e., the 0xa000 must be loaded to a sector register, and the actual access be offset by the 0x013f.

Code: Select all

Mov BX, a000h
Mov ES, BX
Mov BX, 013fh
Mov AL, [ES:BX] 
Of course, things are different in protected mode.
It's not 'sector register' but a 'segment register'. Anyway, well done Solar.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Post Reply