flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Write character on vga mode |
Author |
|
Arturx87 16 Mar 2023, 07:44
How to draw character in vga mode (13h) in my select position (example 2px x 4px)
Code: Mov al,’a’ Mov ah,0eh Int10h Thanks for Help |
|||
16 Mar 2023, 07:44 |
|
edfed 17 Mar 2023, 15:52
Code: print: .char: pushad movzx esi,al shl esi,3 add esi,bioschars mov edi,.base mov eax,[edi+.x] mov ebx,[edi+.y] mov ch,8 .loadline: mov dh,[esi] mov dl,80h .nextdot: test dh,dl je @f mov cl,[edi+.c];31 call put.pixel @@: inc eax shr dl,1 jne .nextdot inc ebx mov eax,[edi+.x] inc esi dec ch jne .loadline add dword[edi+.x],8 popad ret .string: ;esi asciiz string @@: lodsb or al,al je @f call .char jmp @b @@: ret .base = 10200h .x = 0 .y = 4 .c = 8 bioschars = 0ffa6eh .xl=16 .yl=16 char table is at 0ffa6eh putpixel is just like that: Code: .pixel: push ebx cmp eax,screen.xl jae @f cmp ebx,screen.yl jae @f imul ebx,screen.xl mov [screen.base+eax+ebx],cl ; xor [screen.base+eax+ebx],cl @@: pop ebx ret and screen.base can be the double buffer, or direct to vram, as you want. for CGA mode, it starts at 0a0000h this code is intended for protected mode but just whows how to print chars. |
|||
17 Mar 2023, 15:52 |
|
DimonSoft 17 Mar 2023, 20:17
There used to be functions that set/retrieve the current cursor position. Then one has to just add 1 plus 1.
|
|||
17 Mar 2023, 20:17 |
|
macomics 17 Mar 2023, 20:43
edfed wrote: char table is at 0ffa6eh To get pointers to the sign generator tables , there is a function AH=0x1130 DimonSoft wrote: There used to be functions that set/retrieve the current cursor position. Then one has to just add 1 plus 1. |
|||
17 Mar 2023, 20:43 |
|
Stancliff 01 Jul 2024, 17:10
; "PC System Programming for developers" by Michael Tischer 1988,1989,1990
; Dates to the end of the AT or the beginning of the Pentium. PDF format. My only ; available source for BIOS and DOS interrupt calls. Curious if it still ; applies 34 years later. I can't seem to find a newer source. I think BIOS calls still work but haven't has much chance to test. Not so sure about DOS calls since DOS is DEAD, isn't it? I also wonder about reading disk sectors, isn't 512 byte obsolete after 40 years? I would expect modern hard disks to use 2k or 4k for those 500 GB to 2 TB disks. Your opinion? |
|||
01 Jul 2024, 17:10 |
|
MatQuasar2 01 Jul 2024, 19:35
Stancliff wrote:
My personal opinion is that while a bootloader itself is 512 bytes, it can read disk like for another 100 sectors (512 bytes each) to load OS kernel. I don't know the details and will leave it for more knowledgeable person to explain. I am amazed you come back to Assembly programming after 40 years! Personally I only use BIOS interrupts in bootloader and DOS programs, and DOS interrupts in DOS programs. But those are for learning purposes only. In practice, I target for 32-bit and 64-bit Windows and Linux programming. There is also UEFI now which is newer than BIOS. |
|||
01 Jul 2024, 19:35 |
|
bitRAKE 01 Jul 2024, 22:04
Stancliff wrote: Not so sure about DOS calls since DOS is DEAD, isn't it? https://www.freedos.org/ Or operate several virtual DOS machines in parallel: https://www.dosbox.com/ https://dosbox-x.com/ Although there are modern drives with >512 bytes sectors, modern systems emulate legacy support for devices and drives. This allow PS/2 and COM interfaces for USB peripherals, too. UEFI is kind of awesome compared to BIOS, imho. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
01 Jul 2024, 22:04 |
|
revolution 02 Jul 2024, 00:54
The native sector size for drives sold today is 4kB.
The drives also support emulating 512B sectors at the interface level. So you can still use DOS to read/write the drives. But you likely will have trouble to get DOS to access an entire multi-TB drive. Maybe if you write your own FS layer for DOS then you can? |
|||
02 Jul 2024, 00:54 |
|
Stancliff 04 Jul 2024, 01:33
Thanks for your response. This is the first time I got serious about asm programming but I am learning a fair amount so far.
It is interesting that drives can pretend to use 512 byte sectors, but how would you prove what sector size a hard disk or SSD has? Especially if using bios calls... I guess I need to look up UEFI (never heard of it)! |
|||
04 Jul 2024, 01:33 |
|
revolution 04 Jul 2024, 01:54
Drives have plenty of diagnostics and commands to query their properties.
In DOS you can directly access them. |
|||
04 Jul 2024, 01:54 |
|
Stancliff 04 Jul 2024, 14:17
My program needs to work under Windows, not DOS, so I have to learn to use the GUI routines.
I will stop making comments here since I have a thread in 'Windows' which has helped a lot. |
|||
04 Jul 2024, 14:17 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.