Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can anyone help me if there's any m

Status
Not open for further replies.

23925

Programmer
Jul 26, 2003
5
0
0
PH
can anyone help me if there's any memory location of the screen for DOS??? if there is, please give me the location... and if you're in good mood, post me some simple code if u want... :)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
segment 0A000h for graphics, something else for text (I can't remember); if you want to do graphics get hold of a good book. Abrash is a good author name to go for. It's not totally straightforward (but it's fun!)
 
Color text mode starts at 0B800:0000h
Monochrome text mode starts at 0B000:0000h

To check which mode you're in:
AH = 0Fh
INT 10h
if AL == 7h --> monochrome
if AL != 7h --> color

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
For most text modes, segment 0B800h like Bertv says. In your program it is not unusual to set the video mode at the start - this clears the screen for one, and gives you a definate address for screen memory. I believe the DOS screen is usually video mode 3 (80x20 text resol,16 colors,8 display pages and screen addr 0B800h), but for other modes look for a list in BIOS INT 10h fuction 01h, for example, Ralf Brown might have this. Abrash is very cool too, but he deals more with graphics modes than text - if you can get an e-book read it anyway.

I have written this code as an example for you:
Code:
assume cs:code

code segment
  org 100h
program:
  jmp start

start:
; set screen mode (clear screen)
  mov ah,00h ; BIOS function
  mov al,03h ; video mode
  int 10h

  mov ax,0b800h ; video address
  mov es,ax
  sub di,di     ; start of vid.mem

  mov cx,07d0h ; repeat to fill screen
outputloop:
  mov al,'±'  ; character to put
  mov es:[di],al
  inc di
  mov al,03h  ; color
  mov es:[di],al
  inc di
  loop outputloop

; wait for key press
  mov ah,00h ; BIOS function
  int 16h

; clear screen
  mov ah,00h ; BIOS function
  mov al,03h ; video mode
  int 10h

; terminate program
  mov ax,4c00h
  int 21h

code ends

end program
Hope that helps. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top