flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3, 4 |
Author |
|
Dex4u 01 Mar 2011, 02:31
Teehee wrote: i thought that was just the buffer that had trash, but i did First are you sure bochs uses 32bit ? But if it does it should be more like this Code: clear: mov edi,videobuff32bpp mov eax,0x00FFFFFF mov ecx,1280*1024 rep stosd mov edi,[video_ptr] mov esi,videobuff32bpp mov ecx,1280*1024 rep movsd ret videobuff32bpp rd 1280*1024 That is, if you have set 1280x1024 32bpp mode Also that you are using a zero base descriptor |
|||
![]() |
|
Teehee 01 Mar 2011, 11:41
how to ensure bochs use 32bit? i didnt find any option to change that.
and how to set a 32bpp mode? i just set video mode to 0x411B (1280x1024x16M (8:8:8 ) + LFB). I'v made 3 descriptors: null, CS and DS, both zero base and limit 0xFFFFFFFF. |
|||
![]() |
|
edfed 01 Mar 2011, 11:48
read the bpp field in vesainfo block.
|
|||
![]() |
|
Teehee 01 Mar 2011, 11:56
ModeInfoBlock do you mean?
Code: cmp byte[ModeInfoBlock.BitsPerPixel],32 je $ ; never equal |
|||
![]() |
|
Dex4u 01 Mar 2011, 17:12
Try this demo
Code: ;************************************ ; By Dex ; Assemble with fasm ; c:\fasm Vesa.asm Vesa.bin ; ;************************************ org 0x7C00 use16 ;**************************** ; Realmode startup code. ;**************************** start: xor ax,ax mov ds,ax mov es,ax mov ss,ax mov sp,0x7C00 ;**************************** ; Vesa start code. ;**************************** mov bx,4112h mov ax,4f01h mov di,Mode_Info mov cx,bx int 10h mov ax,4f02h int 10h ;***************************** ; Setting up, to enter pmode. ;***************************** cli lgdt [gdtr] mov eax, cr0 or al,0x1 mov cr0,eax jmp 0x10: protected ;***************************** ; Pmode. Do not change the mode just test, just assemble as a bin file. I think bochs let you boot bin files, if not you will need to add it to a floppy image. Your res is too high, start at the basic then when it works move to a higher res. |
|||
![]() |
|
Madis731 01 Mar 2011, 18:18
When I started with VBE, I found myself writing different code for all the virtual machines and PC. I learned that I needed to have detection code. Now I can tell you that Bochs 800x600x32 is 0x143; 1280x1024x32 is 0x145. You can never be sure what modes to expect because VESA allows vendors to make up their own.
I just updated my VESA example (64-bit mode) and here's the link: http://board.flatassembler.net/topic.php?p=118339#118339 |
|||
![]() |
|
Teehee 01 Mar 2011, 20:43
Madis731 wrote: 1280x1024x32 is 0x145. Indeed. Now i have 32 bit in cmp, however im still having this problem: ![]() _________________ Sorry if bad english. |
|||
![]() |
|
Madis731 01 Mar 2011, 21:11
You need to clear the buffer, at start it usually does include some garbage.
EDIT: Sorry, I was tired, I didn't understand the source ![]() Last edited by Madis731 on 02 Mar 2011, 07:55; edited 1 time in total |
|||
![]() |
|
Teehee 01 Mar 2011, 22:40
i did Madis.. but i still have that problem, see:
Code: clear: ; Clear mov edi,video_buff mov eax,0xFFFFFFFF mov ecx,1280*1024 rep stosd ; Copy mov edi,[video_ptr] mov esi,video_buff mov ecx,1280*1024 rep movsd ret |
|||
![]() |
|
edfed 01 Mar 2011, 23:44
where is video_buff... it is maybe not in the right place...
remember, the video_ptr is memory mapped for the screen, but there are many other memories mapped for other peripherals, and video_buff maybe points to one of them, as shows the trash on your screenshot. try another adress for your buffer then... |
|||
![]() |
|
Teehee 01 Mar 2011, 23:53
i just made this:
Code: format binary as 'img' org SECTOR_BOOT include 'boot.asm' ; Fill this sector up rb 512-($-$$)-2 dw BIOS_SIGNATURE org SECTOR_KERNEL ; = 0x8000 kernel: include 'kernel.asm' ; Fill the disk image up (1.4Mb) ;times (0x0167E00-($-kernel)) db 0 video_buff rd 1280*1024 how do i change the buffer address? |
|||
![]() |
|
edfed 02 Mar 2011, 01:25
OK, then, it is a certitude, all your video buffer is trashed by the BIOS, because parasites you see, it is the BIOS.
to change this adress, just declare the position you want it to be in the label instead of reserve datas. Code: video_buff=10'0000h ;it starts now at 16MB, under 16MB, it may be used by DMA... there are many other ways to do, more or less complex. if you want to continue to use the RB 1280*1024 statement, and then have the data size defined, use virtual Code: virtual at 10'0000h video_buff rd 1280*1024 end virtual something like that. don't know if it works, i never use virtual... but first try the = statement, it will save you a lot of time. |
|||
![]() |
|
Teehee 02 Mar 2011, 10:58
thank you ed, i just forgot that i do not need to reserve bytes, i just can use a free memory location. Now it works.
But how do i know which memory region is being used by the hardware or whatever? i would never know that bios was inside that address bc i did org 0x8000 while bios was on org 0x7C00. |
|||
![]() |
|
Teehee 02 Mar 2011, 11:09
Madis731 wrote: I just updated my VESA example (64-bit mode) and here's the link: WOW Madis! Nice example! its a window system working! ![]() _________________ Sorry if bad english. |
|||
![]() |
|
edfed 02 Mar 2011, 11:45
bios is not at org 7C00h, it is somewhere over linear [0C'0000h]
the ROM BIOS is in the upper real mode memory. and to know that HW use some memory, first read a memory map and some hw spec. DMA can use any adress between 0 and 16M, but only in 4 chunks of 64k (4 channels). VESA uses memory you found in vesainfoblock USB uses another memory that you don't have to care about if you don't use it. NIC too use some memory adresses... ones you will se advanced hw, you will be able to generate a memory map from the HW prior to any kernel loading. step by step, continue as you make, by experimentations, and step by step you will understand more and more things. you can try to read the memory mapp from HW properties in windows. for exemple, my video card uses 4800'0000h to 5000'FFFFh, and 0A0000h to 0CBFFFh. with IOPORTS 03B0-03BB, and 03C0-03DF my NIC uses E800'0000h to E800'03FFh, and IO ports 1C00 to 1CFFh my usb controler just uses IOPORTS windows doesn't map the DMA memory, but you can assume, when yuo write your own os, to be the only one to be able to determine it. and maybe, only use the lower 1MB memory for DMA. if you look closer to the memory map i gave you for my HW, you can notice that video and NIC are mapped outside the RAM. my ram is 256 MB. then, from 0 to 1000'0000h. if you have 1GB ram, limit adress is 4000'0000h and is still well under HW memory zones. |
|||
![]() |
|
Teehee 02 Mar 2011, 15:57
edfed wrote: the ROM BIOS is in the upper real mode memory. you mean 1Mb - ROM_BIOS_SIZE or 1Mb + ROM_BIOS_SIZE ? This place can't be writen, right? Quote: step by step, continue as you make, by experimentations, and step by step you will understand more and more things. ![]() Quote: you can try to read the memory mapp from HW properties in windows. Quote: if you have 1GB ram, limit adress is 4000'0000h and is still well under HW memory zones. _________________ Sorry if bad english. |
|||
![]() |
|
Goto page Previous 1, 2, 3, 4 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.