Another newbie assignment ! 
Author Message
 Another newbie assignment !

hi
i have another "newbie" question . Its an assignment in skool the question
is as follows.

Draw on the screen, a checker board pattern that fills the screen with black
and white squares
( 8x8) with the lowermost square being white. The program should accept a
character 'q' for
 terminating and returning to DOS. (Restore original screen mode on exit).

I haven't played with the graphics mode in asm before and am just beginning
to.

Thank you

--
V?d??h?D

http://www.*-*-*.com/



Sat, 10 Aug 2002 03:00:00 GMT  
 Another newbie assignment !

just setup 13h mode, which is programmed pretty easily.

--------8<--------
Mov AH, 13h     ;set 320x200x256 color gfx mode
Int 10h
--------8<--------

16-bit offset in the VGA buffer (0A000h segment) is:
Y*320+X = (Y<<8)+(Y<<6)+X

Faster ASM code for putpixel():
--------8<--------
; AX = X coordinate (0...319)
; BX = Y coordinate (0...199)
; CL = color (0...255)
Mov DI, 0A000h
Mov ES, DI
Mov DI, BX
SHL DI, 6       ;DI=Y<<6
Mov DX, DI      ;DX=Y<<6
SHL DI, 2       ;DI=Y<<8
Add DI, DX      ;DI=(Y<<8)+(Y<<6)
Add DI, AX      ;DI=(Y<<8)+(Y<<6)+X
Mov ES:[DI], CL
--------8<--------

Use this for getting back to text mode:
--------8<--------
Mov AH, 3       ;set 80x25 color text mode
Int 10h
--------8<--------

I think you'll be able to draw anything with putpixel() and checker
board as well.

Good Luck
Alexei A. Frounze

Quote:

> hi
> i have another "newbie" question . Its an assignment in skool the question
> is as follows.

> Draw on the screen, a checker board pattern that fills the screen with black
> and white squares
> ( 8x8) with the lowermost square being white. The program should accept a
> character 'q' for
>  terminating and returning to DOS. (Restore original screen mode on exit).

> I haven't played with the graphics mode in asm before and am just beginning
> to.

> Thank you

> --
> V?d??h?D

> http://i.am/voodoochild



Sat, 10 Aug 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Newbie assignment help

2. ABC newbie: How do I use deep assignment to copy records

3. Newbie - error with 'Limited Type' assignment

4. Newbie inline assembler assignment questions

5. Newbie inline assembler assignment questions

6. Newbie inline assembler assignment questions

7. newbie constant matrix assignment question

8. Newbie question about homework assignment

9. Q: newbie win95 - python path navigation assignment strategies needed

10. Repeated assignments - a more elegant approach (newbie)

11. Newbie: Object assignment return value

12. No Assignment in Conditional/PROPOSAL: Assignment expression

 

 
Powered by phpBB® Forum Software