Загрузка данных


org 100h

start:
    mov bx, 0

    mov byte ptr ds:[bx]+0, 0Fh
    mov byte ptr ds:[bx]+1, 0Fh
    mov byte ptr ds:[bx]+2, 0Fh
    mov byte ptr ds:[bx]+3, 10h
    mov byte ptr ds:[bx]+4, 0Fh
    mov byte ptr ds:[bx]+5, 10h
    mov byte ptr ds:[bx]+6, 04h
    mov byte ptr ds:[bx]+7, 04h
    mov byte ptr ds:[bx]+8, 11h
    mov byte ptr ds:[bx]+9, 04h
    mov byte ptr ds:[bx]+10, 11h
    mov byte ptr ds:[bx]+11, 04h
    mov byte ptr ds:[bx]+12, 04h
    mov byte ptr ds:[bx]+13, 12h
    mov byte ptr ds:[bx]+14, 04h
    mov byte ptr ds:[bx]+15, 12h
    mov byte ptr ds:[bx]+16, 04h
    mov byte ptr ds:[bx]+17, 04h
    mov byte ptr ds:[bx]+18, 11h
    mov byte ptr ds:[bx]+19, 02h
    mov byte ptr ds:[bx]+20, 04h
    mov byte ptr ds:[bx]+21, 10h
    mov byte ptr ds:[bx]+22, 32h
    mov byte ptr ds:[bx]+23, 04h
    mov byte ptr ds:[bx]+24, 11h
    mov byte ptr ds:[bx]+25, 32h
    mov byte ptr ds:[bx]+26, 00h
    mov byte ptr ds:[bx]+27, 10h
    mov byte ptr ds:[bx]+28, 04h
    mov byte ptr ds:[bx]+29, 10h
    mov byte ptr ds:[bx]+30, 30h
    mov byte ptr ds:[bx]+31, 10h
    mov byte ptr ds:[bx]+32, 00h
    mov byte ptr ds:[bx]+33, 30h
    mov byte ptr ds:[bx]+34, 10h
    mov byte ptr ds:[bx]+35, 04h
    mov byte ptr ds:[bx]+36, 04h
    mov byte ptr ds:[bx]+37, 10h
    mov byte ptr ds:[bx]+38, 30h
    mov byte ptr ds:[bx]+39, 11h
    mov byte ptr ds:[bx]+40, 30h
    mov byte ptr ds:[bx]+41, 10h
    mov byte ptr ds:[bx]+42, 04h
    mov byte ptr ds:[bx]+43, 03h
    mov byte ptr ds:[bx]+44, 11h
    mov byte ptr ds:[bx]+45, 33h
    mov byte ptr ds:[bx]+46, 11h
    mov byte ptr ds:[bx]+47, 33h
    mov byte ptr ds:[bx]+48, 11h
    mov byte ptr ds:[bx]+49, 03h
    mov byte ptr ds:[bx]+50, 02h
    mov byte ptr ds:[bx]+51, 11h
    mov byte ptr ds:[bx]+52, 02h

    mov si, 0
    mov di, 0F600h
    mov dh, 20

row_loop:
    cmp dh, 0
    je done

    mov ch, 22

run_loop:
    cmp si, 53
    je done

    mov bh, [bx+si]
    inc si

    mov ah, bh
    shr ah, 4

    cmp ah, 0
    je color_white
    cmp ah, 1
    je color_black
    cmp ah, 2
    je color_red
    cmp ah, 3
    je color_green
    cmp ah, 4
    je color_blue

color_white:
    mov dl, 0Fh
    jmp get_count

color_black:
    mov dl, 00h
    jmp get_count

color_red:
    mov dl, 04h
    jmp get_count

color_green:
    mov dl, 02h
    jmp get_count

color_blue:
    mov dl, 01h

get_count:
    mov bl, bh
    and bl, 0Fh
    inc bl

draw_run:
    mov al, 20h
    mov ah, dl

    mov [di], ax
    add di, 2

    mov [di], ax
    add di, 2

    dec ch
    dec bl
    cmp ch, 0
    je next_row

    cmp bl, 0
    jne draw_run

    jmp run_loop

next_row:
    dec dh
    jmp row_loop

done:
    hlt