All pastes #948840 Raw Edit

Mine

public text v1 · immutable
·published 2008-03-19 13:46 UTC
rendered paste body
; Plots a pixel on mode13 surface data.
;
; Parameters:
;       - Surface data pointer  [ebp+8]
;       - Pixel X position              [ebp+12]
;       - Pixel Y position              [ebp+14]
;       - Pixel color                   [ebp+16]

vid_set_pixel_mode13:
        push    ebp
        mov             ebp, esp

        xor             eax, eax
        mov             ax, [ebp+14]            ; Set ax to y position
        shl             eax, 8                  ; Shift eight bits to the left

        xor             ebx, ebx
        mov             bx, [ebp+14]            ; Set bx to y position
        shl             ebx, 6                  ; Shift six bits to the left

        add             eax, ebx                ; eax = (y<<8)+(y<<6)
        add             eax, [ebp+12]           ; eax = (y<<8)+(y<<6)+x

        add             eax, [ebp+8]

        mov             edi, eax                ; Set data index

        xor             eax, eax
        mov             al, byte[ebp+16]        ; Set value
        stosb                                   ; Store pixel

        leave
        ret