home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / asmutl / m80date.lbr / M80DATE.MZC / M80DATE.MAC
Text File  |  1987-07-18  |  4KB  |  140 lines

  1.     TITLE    M80DATE: Patch for date and time in M80 v 3.4 listing page heading
  2.  
  3.  
  4. ;************************************************************************
  5. ;                                    *
  6. ;    Patch for Microsoft M80 assembler.  This patch puts the date    *
  7. ;    and time in the page heading line of the assembly listing.     *
  8. ;                                    *
  9. ;    This Patch uses CP/M Plus  (CP/M 3.0 or higher) functions,    *
  10. ;    and will not work for earlier versions of CP/M.            *
  11. ;                                    *
  12. ;    The patch replaces the listing page heading buffer in M80.COM    *
  13. ;    by a buffer in an RSX.   The RSX, (with name GETBUF), is     *
  14. ;    attached to the modified M80.COM and is removed from system    *
  15. ;    memory when M80 terminates.  The patch is executed once at the    *
  16. ;    start of M80 execution.  It does the following:            *
  17. ;                                    *
  18. ;    (a)  Calls the RSX to get the new buffer address.        *
  19. ;    (b)  Sets up the buffer contents.                *
  20. ;       (c)  Updates the buffer pointer within M80.COM.            *
  21. ;    (d)  Restores the first three bytes of M80.COM (at 0100h)    *
  22. ;         to there original value.                    *
  23. ;       (e)  Prints a console signon message for modified M80.        *
  24. ;    (f)  Jumps to 0100h to begin execution of M80.            *
  25. ;                                     *
  26. ;    If this patch is applied to other versions of M80, the         *
  27. ;    following may need to be changed:                *
  28. ;                                    *
  29. ;    ENDM80    - memory location of end of your version of M80.     *
  30. ;                                    *
  31. ;    LDHLX   - address of M80 instruction "LD HL,BUFR", where    *
  32. ;          BUFR is the address of the M80 ID in the original    *
  33. ;          page heading buffer.                    *
  34. ;                                    *
  35. ;    FIRST3  - Value of first three bytes of your version of        *
  36. ;          M80.COM.                        *
  37. ;                                    *
  38. ;    You will also want to change the signon message and the        *
  39. ;    M80 version number in the new listing heading.            *
  40. ;                                    *
  41. ;    This patch requires a Z80 processor.                *
  42. ;                                    *
  43. ;                                    *
  44. ;                Hugh R. Coomes                *
  45. ;                19 Old Mamaroneck Road            *
  46. ;                White Plains, NY 10605            *
  47. ;                                    *
  48. ;                28 Oct 84                *
  49. ;                                    *
  50. ;************************************************************************
  51.  
  52.     PAGE
  53.     .Z80            ; VERSION 28 OCT 84
  54.     ASEG
  55. TPA    EQU    0100H
  56. ENDM80    EQU    04C00H        ; END OF M80.COM VERSION 3.4.
  57.  
  58.     ORG    TPA        ; OVERLAY FIRST THREE BYTES OF M80.COM.
  59. ;;;    JP    ENDM80        ; MUST BE PATCHED IN USING SID OR DDT.
  60.  
  61. ;;;    ORG    ENDM80        ; THIS PATCH RESIDES AT END OF M80.
  62.                 ; IT MUST BE PLACED THERE BY SID OR DDT.
  63.     .PHASE    ENDM80
  64.  
  65.     LD    DE,SO_MSG    ; PRINT A SIGNON MESSAGE FOR PATCHED M80.
  66.     LD    C,PRTSTR
  67.     CALL    BDOS
  68.  
  69.     LD    DE,RSXPB    ; MAKE A CALL TO THE RSX GETBUF TO GET
  70.     LD    C,CALRSX    ; A BUFFER IN HIGH MEMORY.
  71.     CALL    BDOS    
  72.     OR    A        ; CHECK FOR VALID COMPLETION
  73.     JP    NZ,RSXERR    ; 0 = OK, 0FFH = RSX DID NOT RETURN BUFFER.
  74.     PUSH    HL        ; THE BUFFER ADDRESS IS IN HL.
  75.  
  76.     LD    DE,M80ID    ; MOVE M80 ID TO BUFFER.
  77.     EX     DE,HL
  78.     LD    BC,M80IDE-M80ID    ; LENGTH IF ID.
  79.     LDIR
  80.  
  81.     EX    DE,HL        ; GET NEXT BUFFER POSITION IN HL.
  82.     CALL    DATE2        ; STORE THE DATE IN FORM DD MMM YY.
  83.     LD    (HL),' '    ; STORE A COUPLE OF SPACES BETWEEN THE
  84.     INC    HL        ; DATE AND TIME.
  85.     LD    (HL),' '
  86.     INC    HL
  87.     CALL    HHMMSS        ; STORE THE TIME IN THE FORM HH:MM:SS.
  88.     LD    DE,M80PG    ; MOVE THE END OF THE PAGE HEADING TO
  89.     EX    DE,HL        ; TO THE BUFFER.
  90.     LD    BC,M80PGE-M80PG  
  91.     LDIR    
  92.  
  93. LDHLX    EQU    01929H        ; M80 HAS A 'LD HL,BUFR' AT THIS ADDRESS 
  94.                 ; WHERE BUFR IS THE M80 ID IN THE LISTING
  95.                 ; PAGE HEADING.
  96.  
  97.     POP    HL        ; GET BACK START OF BUFFER AND PATCH
  98.     LD    (LDHLX+1),HL    ; THE ADDRESS TO OUR BUFFER ADDRESS.
  99.     
  100.     LD    HL,FIRST3    ; RESTORE THE FIRST THREE BYTES OF M80 
  101.     LD    DE,TPA        ; TO THEIR ORIGINAL VALUE.  (THEY WILL HAVE
  102.     LD    BC,3        ; BEEN CHANGED TO A "JP ENDM80" BY SID OR
  103.     LDIR            ; DDT.
  104.  
  105.     JP    TPA        ; ENTER M80.
  106.  
  107. RSXERR:    
  108.     LD    DE,RSXMSG    ; SOMETHING WRONG WITH THE RSX. PRINT
  109.     LD    C,PRTSTR    ; A MESSAGE AND QUIT.
  110.     CALL    BDOS
  111.     JP    RESTART
  112. RSXMSG:
  113.     DB    13,10,'Fatal error - RSX processing',13,10,'$'
  114.  
  115. RSXPB:    DB    127        ; RSX NUMBER (USING FOWLER CONVENTION).
  116.     DB    1        ; NUMBER OF PARAMETERS.
  117.     DW    RSXNAM        ; PARAMETER IS THE RSX NAME.
  118. RSXNAM: DB    'GETBUF  '    
  119.         
  120. SO_MSG: DB    10,'M80 v 3.4  with date & time mod. 28 Oct 84',13,10,'$'
  121.  
  122. M80ID:    DB    09        ; TAB CHARACTER.
  123.     DB    'M80 3.4   '
  124. M80IDE    EQU    $
  125.  
  126. M80PG:    DB    '   Page'
  127.     DB    09        ; TAB CHARACTER.
  128.     DB    0        ; M80 EOM.
  129. M80PGE    EQU    $
  130.  
  131. FIRST3:    DB    021H,00AH,001H    ; FIRST THREE BYTES OF M80.
  132.     
  133.     PAGE
  134.     INCLUDE    DATIME.INC
  135.     PAGE
  136.     INCLUDE BDOS.INC
  137.     .DEPHASE
  138.  
  139.     END
  140.