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 / AMPATCH.ASM < prev    next >
Assembly Source File  |  1986-09-19  |  3KB  |  116 lines

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