Closed Thread
Results 1 to 2 of 2

Thread: Clear Window in 8086 Assembler, no Ints

  1. #1
    omniscian is offline Newbie
    Join Date
    Dec 2007
    Posts
    1
    Rep Power
    0

    Clear Window in 8086 Assembler, no Ints

    Hey

    I am fairly new to assembler and I need to be able to create a window of specified co-ordinates and fill it with a certain colour. It needs to be able to do sizes from 1 line to the full screen. I am not allowed to use interupts in my code. My attempt so far does this but does not do the right number of columns.
    [HIGHLIGHT="ASM"]

    void ClearWindow(BYTE Left, BYTE Top, BYTE Right, BYTE Bottom, BYTE Char,BYTE Colour)
    {
    asm {
    mov ax, SCREEN_SEG
    mov es, ax
    xor ax, ax
    mov al, Top
    xor bx, bx
    mov bl, SCREEN_WIDTH*2


    mul bl
    xor bl, bl
    mov bl, Left
    shl bl, 1
    add ax, bx
    mov di, ax
    xor ax, ax
    mov al, Bottom
    sub al, Top

    push ax
    xor ax, ax
    mov al, Right
    sub al, Left

    xor bx, bx
    xor dx, dx
    mov bx, ax
    mov bh, 1
    }

    Begin:
    asm {
    xor ax, ax
    mov al, SCREEN_WIDTH*2
    sub al, bl
    mov cx, ax
    sub cx, 1
    mov bh, 1
    xor ax, ax
    mov al, Char
    mov ah, Colour
    }

    Paint:
    asm {
    mov es:[di], ax
    add di, 2
    cmp bh, bl
    je Line
    inc bh
    loop Paint
    }

    Line:
    asm {
    inc di
    loop Line
    }

    asm {
    cmp dh, 1
    jl End
    cmp dh, dl
    je Exit
    inc dh
    jmp Begin
    }

    End:
    asm {
    pop dx
    mov dh, 1
    jmp Begin
    }
    Exit:
    }
    [/HIGHLIGHT]

    Any help at all would be greatful.

    Thanks, Ian

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Oct 2007
    Location
    /dev/null
    Posts
    4,513
    Blog Entries
    8
    Rep Power
    59
    Try inserting inc ax at line 26.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to make a loop that goes thru an array of ints to..?
    By Lokantis in forum General Programming
    Replies: 0
    Last Post: 02-18-2011, 11:32 PM
  2. Strings printing as Ints
    By so1i in forum PHP Development
    Replies: 18
    Last Post: 11-21-2009, 03:22 PM
  3. Converting number in text file to ints?
    By Djanvk in forum C and C++
    Replies: 12
    Last Post: 09-04-2008, 12:26 PM
  4. help on 8086 simulator
    By zeatwork in forum C# Programming
    Replies: 10
    Last Post: 04-24-2008, 08:49 AM
  5. 8086 Assembler HELP
    By BamaBUB1983 in forum General Programming
    Replies: 3
    Last Post: 12-12-2007, 07:11 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts