flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
cod3b453 08 Mar 2016, 22:04
EDIT: Apologies, the following was misinterpreted, mis-remembered and incorrect
![]() Quote: Simply write the letters to that memory: Code: mov edi,$B8000 mov word [edi],(($F shl 12) or ($0 shl 8) or 'A') Last edited by cod3b453 on 15 Mar 2016, 18:57; edited 1 time in total |
|||
![]() |
|
newport 09 Mar 2016, 01:25
yea, that doesn't work. i've instantiated video mode 13h-10h prior to entering protected mode which requires A0000h. Now if I instantiate 03h-10h prior to protected mode, I can use the Text Mode @ B8000, which i've already built a partial keyboard driver for, but now i'm converting my OS to a graphical layout.. Thanks for the input, but it doesn't work for me that way.
|
|||
![]() |
|
revolution 09 Mar 2016, 01:42
You have to set each pixel to the foreground/background colours to draw the character.
You will probably need a bitmap giving you the character shapes. And then convert each bit into a pixel colour. |
|||
![]() |
|
newport 09 Mar 2016, 01:54
could you provide an example or point to some docs that might cover how to do this revolution? thanks..
|
|||
![]() |
|
revolution 09 Mar 2016, 02:42
First you ned the character shape definition:
Code: db 00000000b db 00111100b db 01000010b db 01000010b db 01111110b db 01000010b db 01000010b db 01000010b db 00000000b |
|||
![]() |
|
newport 09 Mar 2016, 03:12
ok. i got that part. thanks. however, i'm still at a loss. this is what i tried, but all i get is a single pixel in the upper left-hand corner..
Code: mov edi, 0A0000h mov al,0x02 ; the color of the pixel mov dword[edi],letterA letterA: db 00000000b db 00111100b db 01000010b db 01000010b db 01111110b db 01000010b db 01000010b db 01000010b db 00000000b |
|||
![]() |
|
revolution 09 Mar 2016, 03:33
Read each bit from the shape bitmap, one by one, if it is zero set for black, or 1 set for white, then put the colour on the screen. Move to the next pixel and repeat. Ugly pseudo code:
Code: screen = top_left_position_of_character vertical_pixel_count = 8 loop_v: horizontal_pixel_count = 8 ;a line of pixels loop_h: read_next_bit_from_the_shape_bitmap if 0 colour=black else colour=white end if mov [screen],colour add screen,1 ;move to next pixel dec horizontal_pixel_count jnz loop_h add screen,160-8 ;or whatever value needed to get to the next line dec vertical_pixel_count jnz loop_v |
|||
![]() |
|
newport 09 Mar 2016, 03:59
thanks revolution! i'll work with that and see what i come up with..
|
|||
![]() |
|
newport 12 Mar 2016, 03:20
I came up with the following that will correctly plot pixels for the byte sequence - 10101010b. However, I cannot figure out how I would move to the next row..
eg: Code: db 10101010b ;how do i move from this row to the next??? db 00111100b any ideas? Code: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Plots a single 8-bit sequence to screen ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; xor eax, eax xor ebx, ebx xor ecx, ecx xor edx, edx mov edi, 0xA0000 ;start memory address(vga) mov al, 0x0A ;pixel color mov bl, 10101010b ; this is plotted correctly pixelstart: shl bl, 1 jnc noprintpixel printPixel: mov [edi], al noprintpixel: add cx, 1 inc edi cmp cx, 8 jne pixelstart endpixel: Last edited by newport on 12 Mar 2016, 03:39; edited 1 time in total |
|||
![]() |
|
revolution 12 Mar 2016, 03:39
The value in BL should ideally come from a predefined array of character shapes. It shouldn't be hard coded into the source like that.
If you have ESI point to the current character shape memory the you can get the next value of BL by "mov bl,[esi]" and "inc esi" to get to the next value. |
|||
![]() |
|
newport 12 Mar 2016, 03:41
ok..i think I see now.. thanks for the help...
back to the drawing board.. (pun intended) |
|||
![]() |
|
newport 13 Mar 2016, 22:26
Ok.. I been working for days on this and can't seem to get anywhere. This is what I have now, however it will only print the first two bytes from esi. What am I doing wrong???
Code: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Plots a character to upper-left corner of screen ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; xor eax, eax xor ebx, ebx xor ecx, ecx xor edx, edx mov edi, 0xA0000 mov al, 0x0A mov esi, letterA mov bl, [esi] mov dx, 0 mov cx, 0 jmp drawLetter drawLetter: cld call drawByte inc esi add edi, 312 mov bl, [esi] mov al, 0x0a add cx, 1 cmp cx, 8 je finished jmp drawLetter finished: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Plots a 8-bit sequence to screen ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; drawByte: pixelstart: shl bl, 1 jnc noprintpixel printPixel: mov [edi], al noprintpixel: add dx, 1 inc edi cmp dx, 8 jne pixelstart endpixel: ret letterA: db 00011000b db 00100100b db 00100100b db 00111100b db 00100100b db 00100100b db 00100100b db 00000000b |
|||
![]() |
|
newport 13 Mar 2016, 22:34
Nevermind, lol... found the problem
this.... Code:
endpixel:
should actually be this... Code: endpixel: mov dx, 0 |
|||
![]() |
|
cod3b453 15 Mar 2016, 19:01
Sorry my previous was a mess! Just to let you know - there is also VESA LFB which can be written to as blocks of RGB pixels, if you wanted higher resolutions/more colours.
|
|||
![]() |
|
newport 17 Mar 2016, 01:44
thanks.. i'm actually reading up on vesa now
![]() |
|||
![]() |
|
Tomasz Grysztar 17 Mar 2016, 09:17
newport wrote: thanks.. i'm actually reading up on vesa now |
|||
![]() |
|
newport 23 Mar 2016, 13:55
thanks! i'll definitely read up on that!
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.