X-Git-Url: https://eleni.mutantstargoat.com/git/?p=bootboot;a=blobdiff_plain;f=bb.asm;h=3f4bcd1debf141a33485c37ef5e29a87cbe43f50;hp=fee43e4a37922f50ac73891a975e64c84d611610;hb=6c37e30642cc79c97c8e563f21ea6002fa41d0b2;hpb=32ae013dd1e0f660e80aea5928dba4064f5843e3 diff --git a/bb.asm b/bb.asm index fee43e4..3f4bcd1 100644 --- a/bb.asm +++ b/bb.asm @@ -96,7 +96,7 @@ clearscreen: ret saved_drive_num: - db 0 ; declare byte 0 + db 0 ; define byte 0 ; assembler trick: write as many 0 needed to fill 510 bytes ; $ <- means here @@ -104,7 +104,44 @@ saved_drive_num: dw 0aa55h sector_2: - mov ax, 5 - call clearscreen +; disp palette + mov ax, 0a000h ; video segment points to video memory + mov ds, ax + mov bx, 0 ; video offset + mov cx, 0 ; y +.y_loop: + mov dx, 0 ; x +.x_loop: + mov ax, dx + test ax, 0ff00h ; lower 8 bits 0, highest 1, Z flag is set while < 256, test = and but doesnt change ax + jz .skip_clear_ax + mov al, 0 +.skip_clear_ax: + mov [bx], al ; pixel written on screen + inc bx ; increment + inc dx + cmp dx, 320 + jnz .x_loop + inc cx + cmp cx, 200 + jnz .y_loop + +; setup grayscale palette (64 first colors because ramdac uses 6 bits / color so 2^6) +; ram dac (digital to analog converter) tis vga +; in a ^ register which index we want to write +; 3 writes in another ramdac register (data) +; ramdac feature: when you need to set a palette + mov al, 0 ; first index + mov dx, 3c8h ; ramdac index registe + out dx, al ; because io port (address) > 255 + inc dx ; ramdac data register: 3c9h +.pal_loop: + out dx, al ; r + out dx, al ; g + out dx, al ; b + inc al + test al, 3fh ; test with 3fh to keep the lowest 6 bits of al + jnz .pal_loop + .inf_loop: jmp .inf_loop