home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / HEATH / ZB4MHZ.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  7KB  |  373 lines

  1.  
  2. ;            ZB4MHZ.ASM
  3.  
  4. ;        P. L. Kelley (617) 332-1610
  5. ;             05/24/82
  6.  
  7. ;****WARNING**** Read the text of this file before using. ****WARNING****
  8.  
  9. ;Converts ZBIOS.SYS and ZFOR.COM to operate with a 4 MHz CPU on the H89
  10. ;using the Percom disk controller. Note that single density soft sectored
  11. ;disks and hard sectored disks cannot be cold booted at 4 MHz with Percom's
  12. ;rom.
  13.  
  14. TRUE        EQU    -1
  15. FALSE        EQU    NOT TRUE
  16.  
  17. ;You will want to convert this into two files:
  18.  
  19. ;    1. The present version of this file
  20.  
  21. ;    2. A file called ZF4MHZ.ASM made by reversing TRUE and FALSE
  22. ;       in the equates which follow
  23.  
  24. ZB4MHZ    EQU    TRUE    ;makes ZB4MHZ.ASM/HEX, set FALSE for ZF4MHZ.ASM/HEX
  25. ZF4MHZ    EQU    FALSE    ;set TRUE to make ZF4MHZ.ASM/HEX
  26.  
  27.  
  28. ;set the following to FALSE if no parallel printer
  29.  
  30. PARALLEL     EQU    TRUE
  31.  
  32.  
  33. ;This program is set up for version 1.00 of Percom's ZBIOS.SYS and
  34. ;ZFOR.COM. If you have another version you will likely need to
  35. ;change the values of BLSTLOC, FCOUNT, and the various HDLYs and
  36. ;INTDLYs.
  37.  
  38. ;After you overlay the memory image of ZBIOS.SYS with ZB4MHZ.HEX do:
  39. ;    SAVE 23 ZBIOS.SYS
  40.  
  41. ;ZB4MHZ does two things:
  42.  
  43. ;    1. Allows operation with a 4MHz CPU
  44.  
  45. ;    2. Operates a Centronics 730 parallel printer as follows:
  46. ;        a. Handles formfeed
  47. ;        b. Assumes auto linefeed after carriage return
  48.  
  49.  
  50. ;After you overlay the memory image of ZFOR.COM with ZF4MHZ.HEX do:
  51. ;    SAVE 9 ZFOR.COM
  52.  
  53. ;ZF4MHZ allows operation of ZFOR.COM with a 4 MHz CPU.
  54.  
  55.  
  56. TPA    EQU    0100H    ;location of start of ZBIOS.SYS when loaded by DDT
  57.  
  58. BPATCH    EQU    1600H    ;area for patching located above
  59.             ;distribution version of ZBIOS.SYS
  60.  
  61. FPATCH    EQU    0898H    ;area for patching ZFOR.COM located at
  62.             ;lowest memory reserved for stack
  63.             ;i.e. assume area reserved for stack in
  64.             ;distribution version is longer than necessary
  65.     
  66. BLSTLOC        EQU    02BEH
  67. BHDLY1        EQU    0B9EH
  68. BHDLY2        EQU    0BA6H
  69. BHDLY3        EQU    0C70H
  70. BHDLY4        EQU    0C93H
  71. BHDLY5        EQU    0CDAH
  72. BINTDLY        EQU    0D14H
  73.  
  74. FHDLY1        EQU    0608H
  75. FHDLY2        EQU    0623H
  76. FCOUNT        EQU    0752H
  77. FHDLY3        EQU    075FH
  78. FINTDLY1    EQU    07E5H
  79. FINTDLY2    EQU    0811H
  80.  
  81. DPORT        EQU    0E0H    ;printer data port
  82. TPORT        EQU    0E5H    ;port to test for printer status
  83. BUSY        EQU    020H    ;busy bit
  84.  
  85. ;change the following to suit your system size
  86.  
  87. SZ64K        EQU    TRUE
  88. SZ48K        EQU    FALSE
  89. SZ32K        EQU    FALSE
  90.  
  91. ;end of system size choice
  92.  
  93.     
  94.     IF    SZ64K
  95.  
  96. BIOS    EQU    0E800H    ;start of BIOS for 64K
  97.  
  98.     ENDIF    ;SZ64K
  99.  
  100.     
  101.     IF    SZ48K
  102.  
  103. BIOS    EQU    0A800H
  104.  
  105.     ENDIF    ;SZ48K
  106.  
  107.  
  108.     IF    SZ32K
  109.  
  110. BIOS    EQU    6800H
  111.  
  112.     ENDIF    ;SZ32K
  113.  
  114.  
  115.     IF    ZB4MHZ
  116.  
  117. PATCH    EQU    BPATCH+TPA
  118. OFFSET    EQU    BIOS-TPA
  119.  
  120.     ENDIF    ;ZB4MHZ
  121.  
  122.  
  123.     IF    ZF4MHZ
  124.  
  125. PATCH    EQU    FPATCH
  126. OFFSET    EQU    0
  127.  
  128.     ENDIF    ;ZF4MHZ
  129.  
  130.  
  131.     IF    ZB4MHZ AND PARALLEL
  132.  
  133.     ORG    BLSTLOC+TPA    ;location to patch to jump to parallel
  134.                 ;printer routine
  135.  
  136.     JMP    PARPRINT
  137.  
  138.     ENDIF    ;ZB4MHZ AND PARALLEL
  139.  
  140.  
  141.  
  142.     IF    ZB4MHZ
  143.  
  144.  
  145. ;the next five changes take care of hard disk timing in ZBIOS
  146.  
  147.     ORG    BHDLY1+TPA
  148.  
  149.     MVI    A,28H        ;2X previous value
  150.  
  151.  
  152.     ORG    BHDLY2+TPA
  153.  
  154.     MVI    A,20H        ;2X previous value
  155.  
  156.  
  157.     ORG    BHDLY3+TPA
  158.  
  159.     MVI    A,28H        ;2X previous value
  160.  
  161.  
  162.     ORG    BHDLY4+TPA
  163.  
  164.     MVI    A,28H        ;2X previous value
  165.  
  166.  
  167.     ORG    BHDLY5+TPA
  168.  
  169.     MVI    D,0F0H        ;3X previous value
  170.  
  171.  
  172.     ORG    BINTDLY+TPA    ;location to modify ZBIOS.SYS
  173.                 ;to extend the delay loop between the force
  174.                 ;interrupt command and a type I command
  175.                 ;*** this is crucial ***
  176.  
  177.     JMP    EXINTDLY    ;delay routine in patch area
  178.     NOP            ;eliminate odd XTHL
  179.  
  180.  
  181.     ENDIF    ;ZB4MHZ
  182.  
  183.  
  184.  
  185.     IF    ZF4MHZ
  186.  
  187.  
  188. ;The next four fix hard disk timing in ZFOR.COM
  189.  
  190.     ORG    FHDLY1
  191.  
  192.     MVI    A,3        ;3X the previous value
  193.  
  194.  
  195.     ORG    FHDLY2
  196.  
  197.     MVI    A,3        ;3X the previous value
  198.  
  199.  
  200.     ORG    FCOUNT
  201.  
  202.     LXI    D,0480H        ;the previous value was 036DH
  203.                 ;it was found that doubling this
  204.                 ;value would not give properly
  205.                 ;formatted hard sectored disks
  206.  
  207.     ORG    FHDLY3
  208.  
  209.     MVI    A,28H        ;2X the previous value
  210.  
  211.  
  212. ;The next two changes fix interrupt delay timing in ZFOR.COM
  213.  
  214.  
  215.     ORG    FINTDLY1
  216.  
  217.     CALL    EXINTDLY
  218.     NOP
  219.  
  220.  
  221.     ORG    FINTDLY2
  222.  
  223.     CALL    EXINTDLY
  224.     NOP
  225.  
  226.     ENDIF    ;ZF4MHZ
  227.  
  228.  
  229.  
  230.     ORG    PATCH
  231.  
  232.  
  233. EXINTDLY    EQU    $+OFFSET
  234.     MVI    A,0BH        ;delay count
  235. DELAY        EQU    $+OFFSET
  236.     DCR    A
  237.     JNZ    DELAY        ;loop until delay finished
  238.  
  239.     IF    ZB4MHZ
  240.  
  241.     CALL    BINTDLY+BIOS+3    ;go back to output command
  242.     PUSH    H        ;delay just a bit for
  243.     POP    H        ;single density soft sectored disks
  244.  
  245.     ENDIF    ;ZB4MHZ
  246.  
  247.     RET
  248.  
  249.  
  250.     IF    ZB4MHZ AND PARALLEL
  251.  
  252. PARPRINT    EQU    $+OFFSET
  253.     IN    TPORT
  254.     RAR
  255.     RAR
  256.     RNC        ;return    if printer is not connected
  257. PBUSY    EQU    $+OFFSET
  258.     IN    TPORT
  259.     ANI    BUSY    ;printer busy?
  260.     JNZ    PARPRINT        ;loop if printer busy
  261.     MOV    A,E    ;character in register E on entering routine
  262.     CPI    80H    ;test for non printable character
  263.     RNC        ;return if non printable
  264.     CPI    20H    ;test for not control character
  265.     JNC    CHAR
  266.     CPI    0AH    ;test for linefeed
  267.     JZ    LFEED
  268.     CPI    0CH    ;test for formfeed
  269.     JZ    FFEED
  270.     CPI    0DH    ;test for carriage return
  271.     JZ    CARET
  272.     RET        ;return if any other control character
  273.             ;i.e. present version does not allow
  274.             ;elongated characters
  275. CHAR    EQU    $+OFFSET
  276.     LXI    H,CRFLG    ;point to cr flag
  277.     MVI    M,00H    ;reset cr flag
  278.     INX    H    ;point to crlf flag
  279.     MVI    M,00H    ;reset crlf flag
  280. OUTPUT    EQU    $+OFFSET
  281.     OUT    DPORT    ;print character
  282.     RET
  283.  
  284. CARET    EQU    $+OFFSET
  285.     CALL    INCLN    ;call line # increment routine
  286.     LXI    H,CRFLG    ;load carriage return flag
  287.     MVI    A,01H    ;load the value of the CR and CRLF flags
  288.             ;when set
  289.     CMP    M    ;test for CR flag already set
  290.     JZ    CRLFRP    ;jump to output LF if set
  291.     MVI    M,01H    ;set carriage return flag
  292.     INX    H    ;point to CRLF flag
  293.     CMP    M    ;test if flag set
  294.     JZ    RCRLFF    ;jump to reset CRLF flag and output LF
  295.             ;otherwise output CR
  296. RELOAD    EQU    $+OFFSET
  297.     MOV    A,E    ;restore character
  298.     JMP    OUTPUT
  299.  
  300. CRLFRP    EQU    $+OFFSET
  301.     MVI    A,0AH    ;load LF
  302.     JMP    OUTPUT
  303.  
  304. RCRLFF    EQU    $+OFFSET
  305.     MVI    M,00H    ;reset CRLF flag
  306.     JMP    CRLFRP    ;jump to output LF
  307.  
  308. INCLN    EQU    $+OFFSET
  309.     LXI    H,PAGEL    ;point to page length
  310.     MOV    A,M    ;load page length into A
  311.     INX    H    ;point to line #
  312.     INR    M    ;increment line #
  313.     CMP    M    ;compare page length to line #
  314.     JZ    NEWPG    ;jump if new page
  315.     RET
  316.  
  317. NEWPG    EQU    $+OFFSET
  318.     MVI    M,00H    ;new page
  319.     RET
  320.  
  321. LFEED    EQU    $+OFFSET
  322.     LXI    H,CRFLG    ;point to CR flag
  323.     MVI    A,00H    ;load CR flag reset value
  324.     CMP    M    ;compare with flag
  325.     JNZ    LFRST    ;jump if line feed follows carriage return
  326.     CALL    INCLN    ;call line # increment routine
  327.     JMP    RELOAD    ;output LF
  328.  
  329. LFRST    EQU    $+OFFSET
  330.     MVI    M,00H    ;reset CR flag
  331.     INX    H    ;point to CRLF flag
  332.     MVI    M,01H    ;set CRLF flag
  333.     RET        ;don't output anything
  334.  
  335. FFEED    EQU    $+OFFSET
  336.  
  337. ;The Centronics 730 does not respond to formfeed (0CH).
  338. ;Instead of linefeeds this routine outputs a space followed by
  339. ;a carriage return to prevent the ribbon from lifting above the
  340. ;print head when too much vertical paper motion occurs. The
  341. ;problem occurs with tractor feed paper.
  342.  
  343.     MVI    E,' '    ;load a space
  344.     CALL    PBUSY    ;output a space
  345.     PUSH    H    ;give time
  346.     POP    H    ;     for BUSY
  347.     PUSH    H    ;      signal to
  348.     POP    H    ;        turn on
  349.     MVI    E,0DH    ;load CR
  350.     CALL    PBUSY    ;output CR
  351.     LXI    H,LINEN    ;point to line #
  352.     MVI    A,00H    ;top of page line #
  353.     CMP    M    ;test for top of page
  354.     RZ        ;return if at top
  355.     JMP    FFEED    ;otherwise repeat
  356.  
  357. PAGEL    EQU    $+OFFSET
  358.     DB    42H    ;page length
  359.  
  360. LINEN    EQU    $+OFFSET
  361.     DB    02H    ;initial line #
  362.             ;the print head is two lines down when
  363.             ;the paper tear line is at the tear bar
  364.  
  365. CRFLG    EQU    $+OFFSET
  366.     DB    00H,01H    ;initial CR and CRLF flag values
  367.  
  368.     ENDIF    ;ZB4MHZ AND PARALLEL
  369.  
  370.  
  371.     END
  372.  
  373.