save 4 bytes

This commit is contained in:
dzwdz 2021-08-16 22:23:04 +02:00
parent 920c3ddaf6
commit 56dcba0b99
1 changed files with 16 additions and 11 deletions

27
boot.s
View File

@ -3,7 +3,7 @@
.global _start # the linker needs to find it
_start:
jmp vga_init
.ascii "I'm bootable!"
.ascii "I'm bootable! " # CAN AFFECT MANUALLY SET POINTER, LEAVE AT THIS LEN
_Xterm_grad:
.byte 0x00, 0x5f / 4, 0x87 / 4, 0xaf / 4, 0xd7 / 4, 0xff / 4
@ -17,7 +17,10 @@ vga_init:
# bh - color id
# dx - used up for the port number
mov $16, %bh
xor %ecx, %ecx # dumb as bullshit
xor %ch, %ch
mov $0x7c1, %ax # pointer to _Xterm_grad
mov %ax, %ds
palette_loop:
mov %bh, %al
mov $0x3c8, %dx
@ -39,21 +42,23 @@ palette_loop:
# at this point
# al - R
# ah - G
# cl - B (soon bl)
# cl - B
# because of some dumb as bullshit, i need to use ecx for stuff
mov %cl, %bl
mov %cl, %bl # stash %cl in %bl
mov %al, %cl
mov _Xterm_grad(%ecx), %al
mov %al, %cl # output R
mov %cx, %si
mov (%si), %al
out %al, %dx
mov %ah, %cl
mov _Xterm_grad(%ecx), %al
mov %ah, %cl # G
mov %cx, %si
mov (%si), %al
out %al, %dx
mov %bl, %cl
mov _Xterm_grad(%ecx), %al
mov %bl, %cl # B
mov %cx, %si
mov (%si), %al
out %al, %dx
inc %bh