home *** CD-ROM | disk | FTP | other *** search
/ ticalc.org / ticalc_org_rev_b.iso / archives / 83 / asm / source / routines / getscreen.z80 < prev    next >
Encoding:
Text File  |  2001-07-01  |  2.3 KB  |  67 lines

  1. ;--------= screen grab routine =--------
  2. ; Author:       Ian Graf
  3. ;               (ian_graf@geocities.com)
  4. ; Version:      1.0
  5. ; Date:         8/31/98
  6. ;
  7. ;---------------------------------------
  8. ; this routine reads directly from the
  9. ; lcd and stores it at hl. there must be
  10. ; 768 bytes free at hl. to only grab 756
  11. ; bytes (the size of a pic var) change
  12. ; the line "cp      0C0h" to
  13. ; "cp     0BFh".
  14. ;
  15. ; example usage:
  16. ;
  17. ;       ld      hl,plotsscreen
  18. ;       call    getscreen
  19. ;
  20. ; this saves the screen to the graph
  21. ; buffer.
  22.  
  23.  
  24. ;-------------= get screen =------------
  25. ; input:        hl - location to save
  26. ;               screen
  27. ; output:       768 bytes written to
  28. ;               location hl
  29. ; destroys:     af, bc, d, hl
  30.  
  31. getscreen:
  32.         di                              ; disable interrupts
  33.         ld      a,07h                   ; set y inc mode
  34.         call    lcdbusy                 ;
  35.         out     (lcdinstport),a         ;
  36.         ld      a,80h                   ; top row
  37.         ld      d,a                     ;
  38. rloop1: call    lcdbusy                 ; set row
  39.         out     (lcdinstport),a         ;
  40.         ld      a,20h                   ; left col
  41.         call    lcdbusy                 ; set col
  42.         out     (lcdinstport),a         ;
  43.         call    lcdbusy                 ; dummy read
  44.         in      a,(lcddataport)         ;
  45.         ld      bc,12*256+lcddataport   ; 12 cols/port 11h
  46. rloop2: call    lcdbusy                 ;
  47.         ini                             ; read col
  48.         jr      nz,rloop2               ;
  49.         inc     d                       ;
  50.         ld      a,d                     ;
  51.         cp      0C0h                    ; bottom row
  52.         jr      nz,rloop1               ;
  53.         ld      a,05h                   ; x inc mode
  54.         call    lcdbusy                 ;
  55.         out     (lcdinstport),a         ;
  56.         ei                              ; enable interrupts
  57.         ret                             ;
  58.  
  59. ;---------------= lcdbusy =-------------
  60.  
  61. lcdbusy:
  62.         push    af                      ; create a small delay before
  63.         inc     hl                      ; communicating with LCD
  64.         dec     hl                      ;
  65.         pop     af                      ;
  66.         ret                             ;
  67.