flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Move cursor console without interrupt Goto page 1, 2, 3 Next |
Author |
|
revolution 27 Mar 2020, 00:00
For text mode you need to program the graphics card registers directly.
For graphics mode you need to undraw and redraw the cursor periodically. |
|||
27 Mar 2020, 00:00 |
|
Fulgurance 27 Mar 2020, 00:07
Oh ... i have thinking there is a way to code that with in and ou instruction... OsDev don't talk about graphic card registers
|
|||
27 Mar 2020, 00:07 |
|
bitRAKE 27 Mar 2020, 02:21
It does ...
https://wiki.osdev.org/Category:VGA _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
27 Mar 2020, 02:21 |
|
Fulgurance 27 Mar 2020, 09:04
Yes, i have mention it in my first post, but i don't understand how this method work.
|
|||
27 Mar 2020, 09:04 |
|
bitRAKE 27 Mar 2020, 13:42
I just tested the code: https://wiki.osdev.org/Text_Mode_Cursor#Moving_the_Cursor_2
It seems to work fine. How it works is by setting two 8-bit registers in the VGA hardware. Moving the cursor to the right would consist of reading the registers; incrementing by one; and setting the registers. Really need more information about what you are doing to help further. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
27 Mar 2020, 13:42 |
|
Fulgurance 27 Mar 2020, 18:20
I have tested into my code, but nothing appening...
Code: Format binary as "img" org 0x7C00 use16 BootSector16: mov ax,0xB800 mov es,ax xor ax,ax mov bp,ax mov byte [es:bp],'>' inc bp mov byte [es:bp],00000111b mov dl, 80 mul dl add bx, ax mov dx, 0x03D4 mov al, 0x0F out dx, al inc dl mov al, bl out dx, al dec dl mov al, 0x0E out dx, al inc dl mov al, bh out dx, al Terminal: jmp short Terminal db 510-($-$$) dup 0x90 dw 0xAA55 |
|||
27 Mar 2020, 18:20 |
|
revolution 27 Mar 2020, 19:16
You haven't initialised the value in bx.
The "mul dl" does nothing since al=0 at that point. |
|||
27 Mar 2020, 19:16 |
|
Fulgurance 27 Mar 2020, 19:37
Ah yes ! Thanks !
|
|||
27 Mar 2020, 19:37 |
|
Fulgurance 27 Mar 2020, 23:02
I try to apply that into little console mode.
In my code, i move console cursor when the user input some alphabet character. But when my code run test, he always consider user have input something.... There is some scancode when user don't input nothing ? Code: Format binary as "img" org 0x7C00 use16 BootSector16: mov ax,0xB800 mov es,ax xor ax,ax mov bp,ax mov byte [es:bp],'>' inc bp mov byte [es:bp],00000111b mov bx,0x1 MoveCursorToRight: mov dx,0x3d4 mov al,0x0f out dx,al mov dx,0x3d5 mov al,bl out dx,al mov dx,0x3d4 mov al,0x0e out dx,al mov dx,0x3d5 mov al,bh out dx,al Terminal: xor si,si TestInput: in al,0x60 cmp al,0 jz TestInput cmp al,[CharactersScanCodeTable+si] inc si jne TestInput inc bx jmp short MoveCursorToRight jmp short Terminal CharactersTable: db 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' CharactersScanCodeTable: db 0x10,0x30,0x2e,0x20,0x12,0x21,0x22,0x23,0x17,0x24,0x25,0x26,0x32,0x31,0x18,0x19,0x1e,0x13,0x1f,0x14,0x16,0x2f,0x2c,0x2d,0x15,0x11 db 510-($-$$) dup 0x90 dw 0xAA55 |
|||
27 Mar 2020, 23:02 |
|
bitRAKE 28 Mar 2020, 10:50
Fulgurance wrote:
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
28 Mar 2020, 10:50 |
|
Fulgurance 28 Mar 2020, 11:04
Z flag ? I don't understand the problem
|
|||
28 Mar 2020, 11:04 |
|
N-LG 28 Mar 2020, 11:29
the z flag is the equal flag, when you do a cmp, its the same like "sub" but without saving the result
when you use the jne or jnz, the compiler use the same opcode, the jne or jnz is just for human try this: Code: inc si cmp al,[CharactersScanCodeTable-1+si] jne TestInput |
|||
28 Mar 2020, 11:29 |
|
Fulgurance 28 Mar 2020, 13:04
I have updated my code, it's better to read now
I have now different problem. When user input some alphabetic input, terminal always move cursor. And i have followed your advice... strange |
|||
28 Mar 2020, 13:04 |
|
Fulgurance 28 Mar 2020, 13:05
Code: Format binary as "img" org 0x7C00 use16 BootSector16: mov ax,0xB800 mov es,ax xor ax,ax mov bp,ax mov byte [es:bp],'>' inc bp mov byte [es:bp],00000111b mov bx,0x1 call MoveConsoleCursor xor si,si jmp TestCurrentInput include "MoveConsoleCursor.fasm" include "TestCurrentInput.fasm" CharactersTable: db 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' CharactersScanCodeTable: db 0x10,0x30,0x2e,0x20,0x12,0x21,0x22,0x23,0x17,0x24,0x25,0x26,0x32,0x31,0x18,0x19,0x1e,0x13,0x1f,0x14,0x16,0x2f,0x2c,0x2d,0x15,0x11 db 510-($-$$) dup 0x90 dw 0xAA55 |
|||
28 Mar 2020, 13:05 |
|
Fulgurance 28 Mar 2020, 13:05
Code: use16 MoveConsoleCursor: mov dx,0x3d4 mov al,0x0f out dx,al mov dx,0x3d5 mov al,bl out dx,al mov dx,0x3d4 mov al,0x0e out dx,al mov dx,0x3d5 mov al,bh out dx,al ret |
|||
28 Mar 2020, 13:05 |
|
Fulgurance 28 Mar 2020, 13:05
Code: use16 TestCurrentInput: mov ah,[CharactersScanCodeTable+si] in al,0x60 cmp al,0x0 je short TestCurrentInput cmp al,ah jne short Update inc bx call MoveConsoleCursor Reset: xor si,si jmp short TestCurrentInput Update: cmp si,0x1A jge short Reset inc si jmp short TestCurrentInput |
|||
28 Mar 2020, 13:05 |
|
bitRAKE 28 Mar 2020, 14:57
Give this a try ...
(untested on real hardware) Code: ; kbdtst.com org 0x100 use16 mov ax,0xB800 mov es,ax mov ax,cs mov ds,ax xor ax,ax mov di,ax mov bx,kbdus @@: in al,0x64 test al,1 jz @B test al,0x20 jnz @B in al,0x60 xlatb cmp al,0 jz @B ; output char mov ah,[TUI.Attribute] stosw ; move cursor mov dx,0x3d4 mov al,0x0f out dx,al mov dx,0x3d5 push di pop ax shr ax,1 out dx,al mov dx,0x3d4 mov al,0x0e out dx,al mov dx,0x3d5 mov al,ah out dx,al jmp @B TUI.Attribute db 00000111b ; scancode translation table kbdus db 0,0,\ '1234567890-=',\ 0,\ ; Backspace 0,\ ; Tab 'qwertyuiop[]',\ 0,\ ; Enter key 0,\ ; Control "asdfghjkl;'`",\ 0,\ ; Left shift '\zxcvbnm,./',\ 0,\ ; Right shift '*',\ 0,\ ; Alt ' ',\ 0,\ ; Caps lock 0,0,0,0,0,0,0,0,0,0,\ ; F1-F10 key 0,\ ; Num lock 0,\ ; Scroll Lock 0,\ ; Home key 0,\ ; Up Arrow 0,\ ; Page Up '-',\ 0,\ ; Left Arrow 0,\ 0,\ ; Right Arrow '+',\ 0,\ ; End key 0,\ ; Down Arrow 0,\ ; Page Down 0,\ ; Insert Key 0,\ ; Delete Key 0,0,0,\ 0,0 ; F11-F12 Key ; All other keys are undefined, or highbit set rb 255 - ($ - kbdus) db 0 ; force fasm to output zero bytes _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
28 Mar 2020, 14:57 |
|
DimonSoft 28 Mar 2020, 15:48
Guys, what’s wrong with int 10h/02h? Why mess with VGA ports when BIOS provides a means to do the same thing? Do you have much spare space with real mode addressing to reimplement BIOS?
|
|||
28 Mar 2020, 15:48 |
|
revolution 28 Mar 2020, 16:07
DimonSoft wrote: Guys, what’s wrong with int 10h/02h? Why mess with VGA ports when BIOS provides a means to do the same thing? Do you have much spare space with real mode addressing to reimplement BIOS? |
|||
28 Mar 2020, 16:07 |
|
Goto page 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.