Hey some im writing a bootloader using nasm a virtual machine ect. Anyhow, im using vram to display background and font color changes triggered by keys s, d, f, g. S switches the color of the font with the background color. I know how this can be done but i do not know the proper way. vram is setup as so 2 bytes the first is the character, the second is its attributes. These are background then character color. So i need to take these and switch them. That would switch the font color and the background color. How do i actually do it with code?
; s key
;///////////////////////////////////////////////////////////
.s:
mov bx,0xb800 ;direct video memory access 0xB8000
mov es,bx
xor bx,bx ;es:bx : 0xb8000
mov dh,0 ;row from 0 to 24
mov dl,0 ;col from 0 to 79
.loops1:
inc bx
mov byte [es:bx], 0ah ;attribute
inc bx
inc dl
cmp dl,80 ;col 0-79
jne .loops1
mov dl,0
inc dh
cmp dh,25 ;row 0-24
jne .loops1
jmp .kbin
Second question: Im using this loop to detect key's how could i change these keys to Ctrl + key.
.kbin:
mov ah,10h ;Read from keyboard
;ah scan code, al ascii char
int 16h
cmp al, 53h ;uppercase s
je .s
cmp al, 73h ;lowercase s
je .s
cmp al, 44h ;uppercase d
je .d
cmp al, 64h ;lowercase d
je .d
cmp al, 46h ;uppercase f
je .f
cmp al, 66h ;lowercase f
je .f
cmp al, 47h ;uppercase g
je .g
cmp al, 67h ;lowercase g
je .g
jmp .kbin
Thank you.