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 / AM160PAT.ASM < prev    next >
Assembly Source File  |  1986-09-19  |  2KB  |  104 lines

  1. ; AM160PAT.ASM   PATCH FOR AUTOMITE.COM VERSION 1.60   6/12/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. ;
  9. BDOS    equ    0005H    ; BDOS ENTRY
  10. ESC    equ    01BH    ; ASCII ESCAPE CHARACTER
  11. ;
  12. djnz    macro addr    ; Z80 djnz macro
  13.     db 10h
  14.     db low addr-($+1)
  15.     endm
  16. ;
  17.     org    011bh    ; id string
  18.     db    '1.60'
  19. ;
  20.     ORG     100H    ; start of TPA
  21. ;
  22.     JMP    PATCH    ; branch to patch code
  23. ;
  24.     org    713AH    ; end of program pointer
  25.  
  26.     DW    ENDPRG    ; change pointer to protect patch
  27.  
  28.     ORG     74CFH    ; start of patch area
  29. ;
  30. patch:    lxi    sp,endprg
  31.     call     swap        ; exchange BIOS Warm Boot vector
  32.     lxi    h,line25    ; turn off status line
  33.     call    prnstr
  34.     jmp    713CH        ; execute AUTOMITE
  35.  
  36. ;
  37. ;    This code intercepts the Warm Boot following the exit
  38. ;    from Automite.  This code:
  39. ;
  40. ;        1.  Resotres the orginal Warm Boot vector at the BIOS
  41. ;        jump table level.
  42. ;        2.  Ensures that the 25th line is cleared
  43. ;        3.  Exits to the orginal Warm Boot routine
  44. ;
  45. WBPATCH:
  46.     lxi    sp,endprg
  47.     call    swap        ; restore BIOS Warm Boot vector
  48.     lxi    h,line24    ; restore status line
  49.     call    prnstr
  50.     rst    0        ; Warm Boot
  51. ;
  52. ;    This code exchanges the BIOS jump table Warm Boot vector
  53. ;    for the vector stored locally.  This code is used to 
  54. ;    insert a Warm Boot patch into Automite and then restore
  55. ;    the orginal Warm Boot vector.
  56. ;
  57. swap:    lhld    0001        ; get BIOS Warm BootJMP ADDR
  58.     push    h        ; save jmp addr
  59.     lxi    d,0ch-3     ; offset to conout routine
  60.     dad    d
  61.     shld    conout+1
  62.     pop    h        ; restore jmp addr
  63.     inx    h        ; hl --> BIOS Warm Boot vector
  64.     lxi    d,table        ; de --> local Warm Boot handler
  65.     mvi    b,2        ; vector size in bytes
  66. ;
  67. ;    exchange the contents pointed to by hl with those
  68. ;    pointed to by de.
  69. ;
  70. loop:                ; repeat
  71.     mov    c,m        ;   swap *hl,*de
  72.     ldax    d
  73.     mov    m,a
  74.     mov    a,c
  75.     stax    d
  76.     inx    h        ;   hl++, de++
  77.     inx    d
  78.     djnz    loop        ; unitl bytes swaped
  79.         ret
  80. ;
  81. prnstr: mov    a,m        ; while character is not 0
  82.     ora    a        ; 
  83.     rz
  84.     mov    c,a        ;   set up to pass char in c
  85.     push    h        ;   save pointer 
  86.     call    conout        ;   output to screen 
  87.     pop    h        ;   restore pointer
  88.     inx    h        ;   and advance to next char
  89.     jmp     prnstr        ; end while
  90.  
  91. conout:    jmp    0        ; dummy jump to BIOS CONOUT routine
  92. ;
  93. table:    DW    wbpatch        ; replacement Warm Boot Vector
  94. ;
  95. line25:    DB    ESC,'C7',0
  96. line24:    DB    ESC,'B7',0
  97. ;
  98.     ds    16        ; temp stack area
  99. ;
  100. ENDPRG    equ    $        ; end marker
  101. ;
  102.     END
  103.  
  104.