Cannot draw pixels on the y axis with INT 10h / AH = 0Ch

I have the following code snippet that should draw a diagonal starting at (30, 100), however it just draws a horizontal line on top of the screen, for example:

enter image description here

To check the code, run make run.

This is loader.asm:

    BITS 16

; ----------------------------------------------------------------------

_start:
    mov ax, 07C0h
    add ax, 288
    mov ss, ax              ; ss = stack space
    mov sp, 4096            ; sp = stack pointer

    mov ax, 07C0h
    mov ds, ax              ; ds = data segment

    call print_pixel

    jmp $                   ; infinite loop

; ----------------------------------------------------------------------

print_pixel:

    ; changing video mode to graphical

    mov ah, 00h             ; set video mode

    mov al, 13h             ; 13h - graphical mode.
                            ; 40x25. 256 colors.;320x200 pixels. 1 page.

    int 10h                 ; call

    ; drawing random pixels

    mov ah, 0Ch             ; change color for a single pixel

    mov al, 0000b           ; color
    mov bh, 0               ; page number
    mov cx, 30              ; x
    mov dx, 100             ; y

    int 10h                 ; paint 1st pixel

.repeat:

    inc al                  ; change color
    inc cx                  ; go one pixel right
    inc dx                  ; go one pixel down

    int 10h                 ; paint

    cmp al, 1111b
    je .done                ; last color was painted

    jmp .repeat

.done:
    ret

times 510 - ($ - $$) db 0   ; padding with 0 at the end
dw 0xAA55                   ; PC boot signature

This is Makefile:

.PHONY: build run

build: image.flp

run: build
    qemu-system-i386 -fda image.flp

image.bin: loader.asm
    nasm -f bin -o image.bin loader.asm

image.flp: image.bin
    dd status=noxfer conv=notrunc if=image.bin of=image.flp
+4
source share
1 answer

, Plex86 VGA BIOS, QEMU Ubuntu. ​​ VGA Plex86; SeaBIOS Plex86; , Ubuntu/Debian BIOS. , Cirrus VGA BIOS, Makefile , :

qemu-system-i386 -fda image.flp

:

qemu-system-i386 -fda image.flp -vga cirrus

Ubuntu 15.04 . , DX ( Y).

- int 10h AX/AH/AL . VGA-BIOS, .

Debian Jessie, , , VGA BIOS Plex86, :

qemu-system-i386 -fda image.flp -vga std

, Ubuntu. Debian. , Debian VGA BIOS, .

+1

Source: https://habr.com/ru/post/1610157/


All Articles