When I switch to mode 0x13 everything works ok (with the palette), but when I switch back to textmode it seems like only the first 8 colors can be changed.
The last 8 colors is still the same as it was in mode 0x13...
Any ideas of what might be wrong?
Code used:
Code: Select all
;--------------------------------------;
; sets the palette for any mode. ;
; input: si = pointer to palette. ;
; cx = number of colors. ;
; output: none. ;
;--------------------------------------;
set_palette:
push ax
push bx
mov ax, 0
.l1:
mov ah, byte [esi]
inc si
mov bl, byte [esi]
inc si
mov bh, byte [esi]
inc si
call set_pal
inc al
loop .l1
pop bx
pop ax
ret
;---------------------------------------------;
; sets the palette color no. to rgb value. ;
; ;
; input: al = color no. ;
; ah = red ;
; bl = green ;
; bh = blue ;
; ;
; output: none. ;
;---------------------------------------------;
set_pal:
push ax
push dx
mov dx, 0x03C8
out dx, al ; the color no. is in al
inc dx ; port 0x03C9
mov al, ah ; red i ah
out dx, al
mov al, bl ; green in bl
out dx, al
mov al, bh ; blue in bh
out dx, al
pop dx
pop ax
ret
------------------------------------
palette16 db 00, 00, 00, 00, 00, 42, 00, 42, 00, 00, 42, 42, 42
db 00, 00, 42, 00, 42, 42, 21, 00, 42, 42, 42, 21, 21
db 21, 21, 21, 63, 21, 63, 21, 21, 63, 63, 63, 21, 21
db 63, 21, 63, 63, 63, 21, 63, 63, 63