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

  1. ;--------= screen copy routine =--------
  2. ; Author:       Ian Graf
  3. ;               (ian_graf@geocities.com)
  4. ; Version:      1.0
  5. ; Date:         8/31/98
  6. ;
  7. ;---------------------------------------
  8. ; this routine writes from location hl
  9. ; directly to the lcd. there must be
  10. ; 768 bytes of data at hl. to only copy
  11. ; 756 bytes (the size of a pic var)
  12. ; change the line "cp      0C0h" to
  13. ; "cp     0BFh".
  14. ;
  15. ; example usage:
  16. ;
  17. ;       ld      hl,plotsscreen
  18. ;       call    putscreen
  19. ;
  20. ; this copies the graph buffer to the
  21. ; screen.
  22.  
  23.  
  24. ;-------------= put screen =------------
  25. ; input:        hl - location of screen
  26. ;               data
  27. ; output:       768 bytes written to
  28. ;               screen
  29. ; destroys:     af, bc, d, hl
  30.  
  31. putscreen:
  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. wloop1: call    lcdbusy                 ; set row
  39.         out     (lcdinstport),a         ;
  40.         ld      a,20h                   ; left col
  41.         call    lcdbusy                 ; set col
  42.         out     (lcdinstport),a         ;
  43.         ld      bc,12*256+lcddataport   ; 12 cols/port 11h
  44. wloop2: call    lcdbusy                 ;
  45.         outi                            ; write col
  46.         jr      nz,wloop2               ;
  47.         inc     d                       ;
  48.         ld      a,d                     ;
  49.         cp      0C0h                    ; bottom row
  50.         jr      nz,wloop1               ;
  51.         ld      a,05h                   ; x inc mode
  52.         call    lcdbusy                 ;
  53.         out     (lcdinstport),a         ;
  54.         ei                              ; enable interrupts
  55.         ret                             ;
  56.  
  57. ;---------------= lcdbusy =-------------
  58.  
  59. lcdbusy:
  60.         push    af                      ; create a small delay before
  61.         inc     hl                      ; communicating with LCD
  62.         dec     hl                      ;
  63.         pop     af                      ;
  64.         ret                             ;
  65.