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:
|
boot:
|
||||||
; Load from disk
|
; Load from disk
|
||||||
mov ah, 0x02 ; read
|
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 cl, 0x02 ; Sector start (1 = boot sector, 2 = OS)
|
||||||
mov ch, 0x00 ; Cylinder 0
|
mov ch, 0x00 ; Cylinder 0
|
||||||
mov dh, 0x00 ; Head 0
|
mov dh, 0x00 ; Head 0
|
||||||
|
|
|
@ -5,8 +5,8 @@ pixels = list(im.getdata())
|
||||||
w, h = im.size
|
w, h = im.size
|
||||||
|
|
||||||
with open('gfxd_cursor.asm', 'w') as f:
|
with open('gfxd_cursor.asm', 'w') as f:
|
||||||
f.write(f'gfxd_cursor_dim: db {w} db {h}\n')
|
f.write(f'gfxd_cursor_dim: db {w}, {h}\n')
|
||||||
f.write('gfxd_cursor: ')
|
f.write('gfxd_cursor: db ')
|
||||||
|
|
||||||
for px in pixels:
|
for px in pixels:
|
||||||
if px == (255, 255, 255, 255):
|
if px == (255, 255, 255, 255):
|
||||||
|
@ -15,4 +15,4 @@ with open('gfxd_cursor.asm', 'w') as f:
|
||||||
c = '0x00'
|
c = '0x00'
|
||||||
else:
|
else:
|
||||||
c = '0xFF'
|
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
|
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
|
; di = y*32+x
|
||||||
; ax = width
|
; ax = width
|
||||||
; bl = height
|
; bl = height
|
||||||
|
@ -66,5 +75,47 @@ gfx_rect:
|
||||||
|
|
||||||
call _gfx_rect0
|
call _gfx_rect0
|
||||||
|
|
||||||
|
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
|
popa
|
||||||
ret
|
ret
|
19
main.asm
19
main.asm
|
@ -18,16 +18,13 @@ section KERNEL follows=BOOTSECTOR vstart=1000h
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
main:
|
main:
|
||||||
mov ax, 0x0013
|
call gfx_init_vga13
|
||||||
int 0x10
|
|
||||||
|
|
||||||
mov cx, 50 ; x
|
mov di, 0
|
||||||
mov al, 50 ; y
|
mov si, gfxd_cursor
|
||||||
mov dx, 100 ; w
|
mov ax, 11
|
||||||
mov bl, 100 ; h
|
mov bl, 18
|
||||||
mov bh, 0x01 ; color = Dark blue
|
call _gfx_blit0
|
||||||
|
|
||||||
call gfx_rect
|
|
||||||
|
|
||||||
jmp $ ; Halt
|
jmp $ ; Halt
|
||||||
|
|
||||||
|
@ -38,4 +35,6 @@ jmp $ ; Halt
|
||||||
|
|
||||||
; Data
|
; Data
|
||||||
HELLO_WORLD:
|
HELLO_WORLD:
|
||||||
db 'Hello, world! :D', 0
|
db 'Hello, world! :D', 0
|
||||||
|
|
||||||
|
%include "gfx/gfxd_cursor.asm"
|
Loading…
Add table
Reference in a new issue