home *** CD-ROM | disk | FTP | other *** search
- ;--------= screen grab routine =--------
- ; Author: Ian Graf
- ; (ian_graf@geocities.com)
- ; Version: 1.0
- ; Date: 8/31/98
- ;
- ;---------------------------------------
- ; this routine reads directly from the
- ; lcd and stores it at hl. there must be
- ; 768 bytes free at hl. to only grab 756
- ; bytes (the size of a pic var) change
- ; the line "cp 0C0h" to
- ; "cp 0BFh".
- ;
- ; example usage:
- ;
- ; ld hl,plotsscreen
- ; call getscreen
- ;
- ; this saves the screen to the graph
- ; buffer.
-
-
- ;-------------= get screen =------------
- ; input: hl - location to save
- ; screen
- ; output: 768 bytes written to
- ; location hl
- ; destroys: af, bc, d, hl
-
- getscreen:
- di ; disable interrupts
- ld a,07h ; set y inc mode
- call lcdbusy ;
- out (lcdinstport),a ;
- ld a,80h ; top row
- ld d,a ;
- rloop1: call lcdbusy ; set row
- out (lcdinstport),a ;
- ld a,20h ; left col
- call lcdbusy ; set col
- out (lcdinstport),a ;
- call lcdbusy ; dummy read
- in a,(lcddataport) ;
- ld bc,12*256+lcddataport ; 12 cols/port 11h
- rloop2: call lcdbusy ;
- ini ; read col
- jr nz,rloop2 ;
- inc d ;
- ld a,d ;
- cp 0C0h ; bottom row
- jr nz,rloop1 ;
- ld a,05h ; x inc mode
- call lcdbusy ;
- out (lcdinstport),a ;
- ei ; enable interrupts
- ret ;
-
- ;---------------= lcdbusy =-------------
-
- lcdbusy:
- push af ; create a small delay before
- inc hl ; communicating with LCD
- dec hl ;
- pop af ;
- ret ;
-