home *** CD-ROM | disk | FTP | other *** search
/ PC Shareware 1996 December / PC_Shareware-1996-12.iso / windows / spectrum / sources / tape2tap / tape.inc < prev    next >
Encoding:
Text File  |  1996-05-10  |  2.7 KB  |  123 lines

  1.  
  2.  ; Tape.inc : Misc routines for tape program.
  3.  ;
  4.  ; Copyright 1995 Rui Fernando Ferreira Ribeiro.
  5.  ;
  6.  ; This program is free software; you can redistribute it and/or modify
  7.  ; it under the terms of the GNU General Public License as published by
  8.  ; the Free Software Foundation; either version 2 of the License, or
  9.  ; (at your option) any later version.
  10.  ;
  11.  ; This program is distributed in the hope that it will be useful,
  12.  ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  ; GNU General Public License for more details.
  15.  ;
  16.  ; You should have received a copy of the GNU General Public License
  17.  ; along with this program; if not, write to the Free Software
  18.  ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  ;
  20.  
  21.                     ; some equates
  22.                                         ; *************
  23.  
  24. BLACK        equ    0
  25. BLUE        equ    1
  26. RED        equ    4
  27. YELLOW        equ    6
  28.  
  29. cr        equ    0dh
  30. lf        equ    0ah
  31.  
  32. READ_LPT    MACRO
  33.  
  34.         in    al,dx        ; read printer-1 status port
  35. ;        and    al,10h        ; the value may be used...
  36.         and    al,80h        ; reads busy pin
  37.         ENDM
  38.  
  39. BEEP_IT        MACRO            ; bleed bit read to beeper
  40.         pushf
  41. ;        shr    al,3
  42.         shr    al,6        ; modified for busy pin
  43.         out    61h,al
  44.  
  45.  
  46.         popf
  47.         ENDM
  48.  
  49. PRINT_STRING    MACRO
  50.         mov    ah,9
  51.         int    21h
  52.         ENDM
  53.  
  54. BREAK_KEY_CODE  equ     1               ; keyboard scan key code of ESC
  55.  
  56. TEST_BREAK    MACRO
  57. local        no_space, no_sound, leave, nokey
  58.  
  59.  
  60.         in    al,60h        ; read keyb port
  61.                     ; test for 'ESC' key
  62.         or    al,al
  63.         js    nokey
  64.         cmp    al,BREAK_KEY_CODE
  65.         jnz    no_space
  66.         jmp    leave_prog
  67. no_space:    cmp    al,31        ; test for 'S' key
  68.         jnz    no_sound
  69.         mov    byte ptr ds:[speaker_on],2
  70. no_sound:    cmp    al,49        ; test for 'N' key
  71.         jnz    leave
  72.         mov    byte ptr ds:[speaker_on],0
  73. leave:        cmp    al,2        ; test for '1' key
  74.         jnz    test_2
  75.         mov    byte ptr ds:[SpecCRC],0
  76. test_2:        cmp    al,3        ; test for '2' key
  77.         jnz    nokey
  78.         mov    byte ptr ds:[SpecCRC],1
  79. nokey:
  80.         ENDM
  81.  
  82. COLOUR_BORDER    MACRO    reg
  83.         local    wait_retrace
  84.  
  85.         push    dx
  86.         mov    dx,03DAh
  87. wait_retrace:    in    al,dx        ; read VGA Input Status register
  88.         test    al,8        ; if set it's vertical retrace
  89.         jnz    wait_retrace     ; so wait till it ends
  90.         mov    dx,03C0h    ; Attribute controller registers
  91.         mov    al,11h        ; Overscan colour
  92.         out    dx,al        ; Give address to controller
  93.         mov    al,reg
  94.         out    dx,al        ; Output colour
  95.         mov    al,20h        ; Tells controller to change only
  96.         out    dx,al        ; the border colour
  97.         pop    dx
  98.         ENDM
  99.  
  100.  
  101. RTC2DOSCLK    MACRO
  102.         mov    ah,2
  103.         int    1ah
  104.  
  105.         mov    al,ch
  106.         call    bcd_2_dec
  107.         mov    ch,al
  108.  
  109.         mov    al,cl
  110.         call    bcd_2_dec
  111.         mov    cl,al
  112.  
  113.         mov    al,dh
  114.         call    bcd_2_dec
  115.                 mov     dh,al
  116.  
  117.         mov    dl,0
  118.         mov    ah,2dh
  119.         int    21h
  120.         ENDM
  121.  
  122. ; EOF: Tape.inc
  123.