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 / KAYPRO / ADVENT1.ARK / MM451PAT.ASM < prev    next >
Assembly Source File  |  1986-09-19  |  3KB  |  118 lines

  1. ; MM451PAT.ASM   PATCH FOR MASMENU.COM VERSION 4.51
  2. ; 6/11/86 GSD
  3. ;
  4. ; THIS PATCH:
  5. ;
  6. ;    1. ENSURES THAT THE 25th LINE ON THE SCREEN IS ERASED
  7. ;    2. ASSEMBLES WITH DRI'S MAC ASSEMBLER
  8. ;
  9. ; USE DDT TO PATCH MASMENU.COM:
  10. ;
  11. ; A>DDT MASMENU.COM
  12. ; NEXT PC
  13. ; 4700 0100
  14. ; #IMM451PAT.HEX
  15. ; #R
  16. ; NEXT PC
  17. ; 4732 0100
  18. ; #G0
  19. ; A>SAVE 71 MASMENU.COM
  20. ;
  21. ;
  22. BDOS    equ    0005H    ; BDOS ENTRY
  23. ESC    equ    01BH    ; ASCII ESCAPE CHARACTER
  24. ;
  25. djnz    macro addr    ; Z80 djnz macro
  26.     db 10h
  27.     db low addr-($+1)
  28.     endm
  29.  
  30.  
  31.     ORG     137H    ; ID STRING
  32.     DB     '4.51'
  33.  
  34.     ORG     100H    ; start of TPA
  35. ;
  36.     JMP    inisub    ; branch to patch code
  37. ;
  38.     org    2F2AH    ; end of program pointer
  39.  
  40.     DW    ENDPRG    ; change pointer to protect patch
  41.  
  42.     ORG     46E0H    ; start of patch area
  43. ;
  44. inisub:    lxi    sp,endprg
  45.     call     swap        ; exchange BIOS Warm Boot vector
  46.     lxi    h,line25    ; turn off status line
  47.     call    prnstr
  48.     jmp    2F2CH        ; execute MASMENU
  49.  
  50. ;
  51. ;    This code intercepts the Warm Boot following the exit
  52. ;    from MASMENU.  This code:
  53. ;
  54. ;        1.  Resotres the orginal Warm Boot vector at the BIOS
  55. ;        jump table level.
  56. ;        2.  Ensures that the 25th line is cleared
  57. ;        3.  Exits to the orginal Warm Boot routine
  58. ;
  59. WBPATCH:
  60.     lxi    sp,endprg
  61.     call    swap        ; restore BIOS Warm Boot vector
  62.     lxi    h,line24    ; restore status line
  63.     call    prnstr
  64.     rst    0        ; Warm Boot
  65. ;
  66. ;    This code exchanges the BIOS jump table Warm Boot vector
  67. ;    for the vector stored locally.  This code is used to 
  68. ;    insert a Warm Boot patch into Automite and then restore
  69. ;    the orginal Warm Boot vector.
  70. ;
  71. swap:    lhld    0001        ; get BIOS Warm BootJMP ADDR
  72.     push    h        ; save jmp addr
  73.     lxi    d,0ch-3     ; offset to conout routine
  74.     dad    d
  75.     shld    conout+1
  76.     pop    h        ; restore jmp addr
  77.     inx    h        ; hl --> BIOS Warm Boot vector
  78.     lxi    d,table        ; de --> local Warm Boot handler
  79.     mvi    b,2        ; vector size in bytes
  80. ;
  81. ;    exchange the contents pointed to by hl with those
  82. ;    pointed to by de.
  83. ;
  84. loop:                ; repeat
  85.     mov    c,m        ;   swap *hl,*de
  86.     ldax    d
  87.     mov    m,a
  88.     mov    a,c
  89.     stax    d
  90.     inx    h        ;   hl++, de++
  91.     inx    d
  92.     djnz    loop        ; unitl bytes swaped
  93.         ret
  94. ;
  95. prnstr: mov    a,m        ; while character is not 0
  96.     ora    a        ; 
  97.     rz
  98.     mov    c,a        ;   set up to pass char in c
  99.     push    h        ;   save pointer 
  100.     call    conout        ;   output to screen 
  101.     pop    h        ;   restore pointer
  102.     inx    h        ;   and advance to next char
  103.     jmp     prnstr        ; end while
  104.  
  105. conout:    jmp    0        ; dummy jump to BIOS CONOUT routine
  106. ;
  107. table:    DW    wbpatch        ; replacement Warm Boot Vector
  108. ;
  109. line25:    DB    ESC,'C7',0
  110. line24:    DB    ESC,'B7',0
  111. ;
  112.     ds    16        ; temp stack area
  113. ;
  114. ENDPRG    equ    $        ; end marker
  115. ;
  116.     END
  117.  
  118.