home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / CRT8.ASM < prev    next >
Assembly Source File  |  1994-10-15  |  3KB  |  106 lines

  1.     page    66,132
  2. ;******************************** CRT8.ASM   *********************************
  3.  
  4. LIBSEG           segment byte public "LIB"
  5.         assume cs:LIBSEG , ds:nothing
  6.  
  7. ;----------------------------------------------------------------------------
  8. .xlist
  9.     include  mac.inc
  10.     include     common.inc
  11. .list
  12. ;----------------------------------------------------------------------------
  13.     extrn    lib_info:byte
  14. comment 
  15. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
  16. DISK_TO_CRT - loads a screen image file saved by CRT_TO_DISK
  17. ;
  18. ; inputs:    DS:[DX] = address of ASCIIZ filename
  19. ; outputs:   if CF = 1, AX = MS-DOS file I/O error code
  20. ;            if CF = 0, no error
  21. ;            registers modified = AX            
  22. ;
  23. ;notes:     The input file is assumed to be closed when DISK_TO_CRT is
  24. ;           called, and is left closed upon exit.
  25. ;* * * * * * * * * * * * * *
  26. 
  27.     public    disk_to_crt
  28. DISK_TO_CRT    PROC    FAR
  29.     MOV     AH,01
  30.     JMP     ctd_entry
  31. DISK_TO_CRT    ENDP
  32. comment 
  33. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
  34. CRT_TO_DISK - saves a screen image as a file
  35. ;
  36. ; inputs:    DS:[DX] = address of ASCIIZ filename
  37. ; outputs:   if CF = 1, AX = MS-DOS file I/O error code
  38. ;            if CF = 0, no error
  39. ;            registers modified = AX
  40. ;* * * * * * * * * * * * * *
  41. 
  42.     public    crt_to_disk
  43. CRT_TO_DISK    PROC    FAR
  44.     MOV     AH,00
  45. ctd_entry:
  46.     PUSHF
  47.     PUSH    BP
  48.     MOV     BP,SP
  49.     SUB     SP,+02
  50.     APUSH   BX,CX,DX,SI,DS,ES,DX
  51.     MOV     [BP-02],AH
  52.     mov     al,cs:lib_info.crt_rows
  53.     mov     ch,cs:lib_info.crt_columns
  54. ;;    call    DISPLAY_PARMS ;out: al=rows ch=columns bx:si=crt buf  dx=cga port
  55.     MUL     CH
  56.     SHL     AX,1
  57.     POP     DX
  58.     PUSH    AX
  59.     XOR     CX,CX
  60.     MOV     AX,3C00h
  61.     ADD     AH,[BP-02]
  62.     INT     21h            ;create file ds:dx using attribute (cx)
  63.     POP     CX
  64.     mov     ds,cs:lib_info.crt_seg
  65.     JB        ctd_exit
  66.     MOV     BX,AX
  67.     MOV     DX,0        ;assume display offset is zero (page 0)
  68.     MOV     AH,40h
  69.     SUB     AH,[BP-02]
  70.     INT     21h            ;write to file bx=handle cx=len ds:dx=data
  71.     JB      CTD_CONT
  72.     CMP     AX,CX
  73.     JZ      CTD_01
  74. CTD_CONT:
  75.     PUSH    AX
  76.     MOV     AH,3Eh
  77.     INT     21h            ;close file handle (bx)
  78.     POP     AX
  79.     STC
  80.     JMP     ctd_exit
  81.  
  82. CTD_01:    
  83.     MOV     AH,3Eh
  84.     INT     21h            ;close file handle (bx)
  85.     JB      ctd_exit
  86.     CLC
  87. ctd_exit:
  88.     APOP    ES,DS,SI,DX,CX,BX
  89.     MOV     SP,BP
  90.     POP     BP
  91.     JB      ctd_exit2
  92.     POPF
  93.     CLC
  94.     RETF
  95. ctd_exit2:
  96.     POPF
  97.     STC
  98.     RETF
  99. CRT_TO_DISK    ENDP
  100.  
  101.  
  102. LIBSEG    ENDS
  103.     end
  104.