News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Displaying a pixel

Started by zak100, September 21, 2009, 02:40:48 PM

Previous topic - Next topic

zak100

Hi,
I am trying the code provided by Steve (with some modification) on this forum but some how its not displaying the pixel. I dont know if there is a color problem. If some body can guide me, i would be thankful for this.


.MODEL  TINY
.CODE
ORG     0

;code branch

boot0:  jmp short boot1
boot1: cli                     ;disable maskable interrupts
       xor     di,di
       mov     ss,di
       mov     sp,7C00h        ;SS:SP = 0000:7C00
       
       sti
;----------------------
    cld
    mov ax,0B800h
    mov es,ax
    xor di,di
    mov ax,1F41h
    stosw
;-----------------------
    mov ah, 0
    int 16h
;-----------------
MOV     AH,0    ; Function 0
        MOV     AL,13H  ; set 320 x 200 256 color mode
        INT     10H     ; Video BIOS Call

;--------------Use function 0BH to write a pixel.


;-----Code:
        MOV     AH,0BH  ; function 0BH
        MOV     BH,0    ; page number
        MOV     CX,100  ; X or column
        MOV     DX,100  ; Y or row
        MOV     AL,15   ; Color value
        INT     10H     ; Video BIOS Call

ORG 1FEH


        dw      0AA55h

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

        END     boot0



Zulfi.

dedndave

hiya Zulfi
the beauty of video mode 13h is, you can write pixels directly to the video buffer - very fast
but, the bios call will work also
i see one problem that may fix it - you have row 256 and column 256
there are only 200 rows, numbered 0 to 199 (0 to 0C7h)

FORTRANS

Hi,

   No he has 100 not 100H, so that's not the problem.  He has no
"halt" code, so he's not terminating cleanly.  He may be resetting
or some such so he doesn't see anything.

Regards,

Steve N.

dedndave

you got me Steve - lol
i cudda swore i saw 100h - gettin old, here
he should have a dead loop at the end
it could be he has chosen a poor color, too - i don't remember the standard palette
might try a colour of 255

dedndave

ohhhhhhhhhhhhhhhh
lol
function 0Bh - wrong function
you want function 0Ch, Zulfi

        mov     ax,13h     ;set mode 13h
        int     10h

        xor     bx,bx
        mov     cx,100
        mov     dx,100
        mov     ax,0C0Fh   ;write pixel, colour=15
        int     10h

FORTRANS

   Oops, good catch Dave.

Regards,

Steve N.

zak100

Hi,
Thanks. Its working now.

Zulfi.