Lost Password?

Go Back   CodeCall Programming Forum > Software Development > General Programming

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-07-2007, 04:40 PM
omniscian omniscian is offline
Newbie
 
Join Date: Dec 2007
Posts: 1
Rep Power: 0
omniscian is on a distinguished road
Default 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.
ASM Code:
  1. void ClearWindow(BYTE Left, BYTE Top, BYTE Right, BYTE Bottom, BYTE Char,BYTE Colour)
  2. {
  3.   asm {
  4.         mov ax, SCREEN_SEG   
  5.     mov es, ax     
  6.     xor ax, ax     
  7.     mov al, Top   
  8.     xor bx, bx     
  9.     mov bl, SCREEN_WIDTH*2       
  10.                     
  11.  
  12.     mul bl       
  13.     xor bl, bl     
  14.     mov bl, Left           
  15.     shl bl, 1         
  16.     add ax, bx     
  17.     mov di, ax     
  18.     xor ax, ax     
  19.     mov al, Bottom             
  20.     sub al, Top   
  21.                
  22.     push    ax         
  23.     xor ax, ax     
  24.     mov al, Right         
  25.     sub al, Left               
  26.  
  27.     xor bx, bx     
  28.              xor dx, dx   
  29.     mov bx, ax     
  30.     mov bh, 1         
  31.       }
  32.  
  33. Begin:
  34.   asm {
  35.     xor ax, ax     
  36.     mov al, SCREEN_WIDTH*2   
  37.     sub al, bl     
  38.     mov cx, ax   
  39.     sub cx, 1         
  40.     mov bh, 1         
  41.              xor ax, ax   
  42.         mov al, Char   
  43.         mov ah, Colour   
  44.       }
  45.  
  46. Paint:
  47.   asm {
  48.     mov es:[di], ax     
  49.     add di, 2         
  50.     cmp bh, bl     
  51.     je  Line           
  52.     inc bh       
  53.     loop Paint     
  54.       }
  55.  
  56. Line:
  57.   asm {
  58.     inc di       
  59.     loop Line         
  60.       }
  61.  
  62.   asm {
  63.     cmp dh, 1         
  64.     jl End       
  65.     cmp dh, dl     
  66.     je Exit    
  67.     inc dh       
  68.     jmp Begin         
  69.       }
  70.  
  71. End:
  72.   asm {
  73.     pop dx       
  74.     mov dh, 1         
  75.     jmp Begin         
  76.       }
  77. Exit:   
  78. }

Any help at all would be greatful.

Thanks, Ian
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 02-25-2008, 09:58 PM
dargueta dargueta is offline
Guru
 
Join Date: Oct 2007
Age: 18
Posts: 507
Last Blog:
Programs Under the Hoo...
Rep Power: 10
dargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the rough
Default

Try inserting inc ax at line 26.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
A Not So Simple Problem felixme86 C and C++ 2 09-27-2007 02:24 PM
! Need urgent help ! Drawing program using cygwin siren C and C++ 0 05-26-2007 10:51 PM


All times are GMT -5. The time now is 12:12 AM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
LogicKills ........ 20.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 67%

Ads