We uhh.... ran out of space
This commit is contained in:
parent
c27c7cdb83
commit
d0c778f397
4 changed files with 64 additions and 14 deletions
2
boot.asm
2
boot.asm
|
@ -7,7 +7,7 @@ OS_SEGMENT equ 0x100
|
|||
boot:
|
||||
; Load from disk
|
||||
mov ah, 0x02 ; read
|
||||
mov al, 0x01 ; No of sectors (1)
|
||||
mov al, 0x02 ; No of sectors (1)
|
||||
mov cl, 0x02 ; Sector start (1 = boot sector, 2 = OS)
|
||||
mov ch, 0x00 ; Cylinder 0
|
||||
mov dh, 0x00 ; Head 0
|
||||
|
|
|
@ -5,8 +5,8 @@ pixels = list(im.getdata())
|
|||
w, h = im.size
|
||||
|
||||
with open('gfxd_cursor.asm', 'w') as f:
|
||||
f.write(f'gfxd_cursor_dim: db {w} db {h}\n')
|
||||
f.write('gfxd_cursor: ')
|
||||
f.write(f'gfxd_cursor_dim: db {w}, {h}\n')
|
||||
f.write('gfxd_cursor: db ')
|
||||
|
||||
for px in pixels:
|
||||
if px == (255, 255, 255, 255):
|
||||
|
@ -15,4 +15,4 @@ with open('gfxd_cursor.asm', 'w') as f:
|
|||
c = '0x00'
|
||||
else:
|
||||
c = '0xFF'
|
||||
f.write(f'db {c} ')
|
||||
f.write(f'{c}, ')
|
51
gfx_util.asm
51
gfx_util.asm
|
@ -1,5 +1,14 @@
|
|||
; Constants
|
||||
VMEM equ 0xA000
|
||||
|
||||
; Initializes 320x200 8-bit/256-color (13h) video graphics mode
|
||||
gfx_init_vga13:
|
||||
push ax
|
||||
mov ax, 0x0013
|
||||
int 0x10
|
||||
pop ax
|
||||
ret
|
||||
|
||||
; di = y*32+x
|
||||
; ax = width
|
||||
; bl = height
|
||||
|
@ -68,3 +77,45 @@ gfx_rect:
|
|||
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
; di = y*32+x
|
||||
; si = source color data
|
||||
; ax = width
|
||||
; bl = height
|
||||
|
||||
; ax/bl = 0 is undefined behavior. Don't do it.
|
||||
; (To be clear, in the current implementation it just halts)
|
||||
|
||||
_gfx_blit0:
|
||||
pusha
|
||||
|
||||
push VMEM
|
||||
pop es
|
||||
|
||||
mov dl, 0 ; row counter
|
||||
|
||||
.row:
|
||||
add dl, 1
|
||||
|
||||
mov cx, 0 ; col counter
|
||||
|
||||
.col:
|
||||
add cx, 1
|
||||
|
||||
mov dh, [si]
|
||||
mov [es:di], dh
|
||||
add di, 1
|
||||
add si, 1
|
||||
|
||||
cmp cx, ax
|
||||
jnz .col
|
||||
|
||||
sub di, ax ; di - width + 320. == x=x1; y++
|
||||
add di, 320
|
||||
|
||||
cmp dl, bl
|
||||
jnz .row
|
||||
|
||||
popa
|
||||
ret
|
17
main.asm
17
main.asm
|
@ -18,16 +18,13 @@ section KERNEL follows=BOOTSECTOR vstart=1000h
|
|||
%endmacro
|
||||
|
||||
main:
|
||||
mov ax, 0x0013
|
||||
int 0x10
|
||||
call gfx_init_vga13
|
||||
|
||||
mov cx, 50 ; x
|
||||
mov al, 50 ; y
|
||||
mov dx, 100 ; w
|
||||
mov bl, 100 ; h
|
||||
mov bh, 0x01 ; color = Dark blue
|
||||
|
||||
call gfx_rect
|
||||
mov di, 0
|
||||
mov si, gfxd_cursor
|
||||
mov ax, 11
|
||||
mov bl, 18
|
||||
call _gfx_blit0
|
||||
|
||||
jmp $ ; Halt
|
||||
|
||||
|
@ -39,3 +36,5 @@ jmp $ ; Halt
|
|||
; Data
|
||||
HELLO_WORLD:
|
||||
db 'Hello, world! :D', 0
|
||||
|
||||
%include "gfx/gfxd_cursor.asm"
|
Loading…
Add table
Reference in a new issue