flat assembler
Message board for the users of flat assembler.

Index > DOS > Capture fullscreen dos screen under win xp?

Author
Thread Post new topic Reply to topic
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
I need to capture the screen of a program to see if I have the pixels are plotting in the right spots, but printscreen doesnt seem to work right under xp. Does anyone know how to capture the screen from mode 13h? Or even better, could someone check for me and see if my program plots the pixels in the right spots?

Code:
;test program for drawing vertical lines by windwakr

        org 100h       ;make it .com

        push 0a000h    ;screen offset into es
        pop es         ;^^^

        mov ax,13h     ;mode 320x200 256 color
        int 10h        ;^^^

        xor ax,ax      ;zero out ax

start:
        mov [x],100    ;set up vline
        mov [y1],50    ;^^^
        mov [y2],150   ;^^^
        mov [color],1  ;^^^
        call vline     ;call the line drawer
        jmp key        ;when thats done, jump to key checker

vline:
        mov al,[y1]    ;converting the beginning y and the x into a single number.....y*320+x
        mov bx,ax      ;^^^
        shl ax,8h      ;^^^
        shl bx,6h      ;^^^
        add ax,bx      ;^^^
        add al,[x]     ;^^^
        mov di,ax      ;^^^
        mov al,[color] ;get color into al
        mov bl,[y2]    ;how long is the line? WARNING: if y2 under y1 it will probably draw lines all over the place
        sub bl,[y1]    ;^^
        mov cl,bl      ;get loop ready
        iloop:
        stosb          ;plot pixel
        add di,13fh    ;go to next line
        loop iloop     ;loop until line is finished
        ret            ;return


key:
        in ax,60h      ;get current key
        dec ax         ;check for esc
        jnz key        ;if no, go back to key checker....else, continue
        mov ax,03h     ;return video mode
        int 10h        ;^^^
        ret            ;exit

x db 0                 ;variables for the line drawer
y1 db 0                ;^^^
y2 db 0                ;^^^
color db 0             ;^^^
    


It *should* draw a vertical line starting at x 100, y 50 going down to y 150


thanks

_________________
----> * <---- My star, won HERE
Post 14 Jun 2008, 03:07
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 708
Location: Adelaide
sinsi
Watch out with mixing 8/16 bits e.g.
Code:
        mov al,[y1]    ;converting the beginning y and the x into a single number.....y*320+x
        mov bx,ax      ;^^^    

if AH is FF for example your calculations get screwed up. Better to define x,y1,y2 as words.

This is just personal, but
Code:
        add di,319     ;or even "320-1"    

makes more sense than
Code:
        add di,13fh    ;go to next line    

Code:
key: 
        in ax,60h      ;get current key 
        dec ax         ;check for esc 
        jnz key        ;if no, go back to key checker....else, continue    

Reading ports can be a problem (you're trying to read port 61h as well into AH) - just use
Code:
key:    sub ah,ah    ;BIOS wait for keypress
        int 16h
        cmp ah,1    ;esc key?
        jnz key    

One more, "loop" uses CX, not just CL.
Post 14 Jun 2008, 03:38
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
Thanks for the info. I'll try to remember that stuff in the future.
Post 14 Jun 2008, 03:58
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
windwakr wrote:
Does anyone know how to capture the screen from mode 13h?


Snarf, maybe? (w/ .ASM src)
Post 14 Jun 2008, 03:59
View user's profile Send private message Visit poster's website Reply with quote
rCX



Joined: 29 Jul 2007
Posts: 166
Location: Maryland, USA
rCX
You could also use DOSBox and press print screen for the window or when it is in full screen mode (Note: In full screen mode, rows of pixels are added to top and bottom. You might want to plot a pixel for reference).


Description:
Filesize: 9.73 KB
Viewed: 939 Time(s)

Screenshot.PNG


Post 14 Jun 2008, 06:22
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
windwakr wrote:

> Capture fullscreen dos screen

Screenshooting under DOS is exhaustively documented here:

WOW

> doesnt seem to work right under xp

Oops ... posting in DOS subforum and not using DOS ? Embarassed no DOSwakr Sad

Image
( 1'166 Byte's PNG )

Shot it for you in DOS with SNARF ... oops the wrong one Laughing

Your code has 2 criminal BUG's (as already pointed) :

Code:
        mov cl,bl      ;get loop ready
        iloop:
        stosb          ;plot pixel
        add di,13fh    ;go to next line
        loop iloop     ;loop until line is finished 
    


Regrettably loop decrements CX in 16-bit code and I don't see any initialization of CH Sad

Code:
        in ax,60h      ;get current key
        dec ax         ;check for esc
        jnz key        ;if no, go back to key checker....
    


You should in'ate AL not AX ... as-is your code triggers a hard freezer Sad


Last edited by DOS386 on 06 Feb 2010, 07:37; edited 1 time in total
Post 14 Jun 2008, 11:26
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
Thanks for the help and for showing me errors in my code.
Post 14 Jun 2008, 12:33
View user's profile Send private message Reply with quote
rain_storm



Joined: 05 Apr 2007
Posts: 67
Location: Ireland
rain_storm
Here is a routine I made for doing a screen capture. It is optimised for size (but not to extreme size) it was never meant for anything but doing a screen capture on exit from a 256 byte intro. its not very well commented but if you need something explained you can ask. This routine takes many shortcuts. not just by storing the header inside the routine it also outputs the file upside down for example. its not clean but you can learn from it

what it does is simple the header is stored in the routine This is written to file as is. next it starts reading red, green, blue values from pallet registers (starting at pallet index 0) this is stored to memory (+1 byte zero padding) This is written to file when all colours are stored. then it simply writes the screen memory to file as is (this is cheating cos the output is upside down but I can live with that) and that is all there is too it. those steps again

write header to file
send 0 -> port 03C7h
read r,g,b from port 003C9h (all 256 colours)
write colours to file
write screen to file like this
ds = A000h
cx = FA00h
dx = 0000h
bx = file handle
ah = 40h
int 21h


Description:
Download
Filename: SCREEN.ZIP
Filesize: 9.2 KB
Downloaded: 70 Time(s)

Post 15 Jun 2008, 04:51
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.