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 / CPM3 / CPM3SCB.LBR / BIOSFIX.MQC / BIOSFIX.MAC
Text File  |  2000-06-30  |  2KB  |  78 lines

  1.     .z80
  2.  
  3. ;For CP/M Plus Banked version only.
  4. ;
  5. ;A short patch program to fix the System Control Block BIOS jump
  6. ;vectors.  This will cause all BIOS Warm boot, console I/O, and
  7. ;List output routines to be entered with bank 1 (TPA bank) in
  8. ;context.  It will then be safe to implement RSXs that modify
  9. ;the BIOS jump vector to live below common base.  BIOSFIX should
  10. ;be executed after a cold boot, but not within a submit file because
  11. ;CP/Ms GET RSX (which is attached to submit) modifies these same
  12. ;vectors, then restores them to their original values on completion.
  13. ;So you will have to remember to run BIOSFIX by hand at each cold
  14. ;boot.  Refer to CPM3SCB.DOC for details of the SCB BIOS jump vectors.
  15. ;This short code sequence could also be implemented in an RSX that
  16. ;modifies the BIOS vectors.
  17. ;
  18. ;Jim Lopushinsky
  19. ;June 25, 1986
  20. ;Meadowlark RCP/M    403-435-6579
  21. ;
  22. ;To assemble and link:
  23. ;    M80 =BIOSFIX
  24. ;    L80 BIOSFIX,BIOSFIX/N/E
  25.  
  26. bdos    equ    5
  27.  
  28. main:
  29.     ld    c,12
  30.     call    bdos        ;get cpm version
  31.     ld    a,l
  32.     cp    30h
  33.     jr    nc,cpm3_ok
  34.     call    ilprt
  35.     db    'BIOSFIX requires CP/M Plus',13,10,0
  36.     rst    0
  37. cpm3_ok:
  38.     ld    de,scbpb
  39.     ld    c,49
  40.     call    bdos        ;get SCB address
  41.     ld    l,0f9h        ;point to common memory base
  42.     ld    a,(hl)
  43.     inc    l
  44.     or    (hl)        ;is it zero?
  45.     jr    nz,bank_ok
  46.     call    ilprt
  47.     db    'Banked version of CP/M Plus required',13,10,0
  48.     rst    0
  49. bank_ok:
  50.     ld    de,6        ;distance between vectors
  51.     ld    l,68h        ;offset to WBOOT vector
  52.     ld    b,5        ;5 vectors
  53.     ld    a,21h        ;just a LD  HL,  inst
  54. set_loop:
  55.     ld    (hl),a        ;modify the JP to LD HL,
  56.     add    hl,de        ;on to next vector
  57.     djnz    set_loop    ;loop for all vectors
  58.     call     ilprt
  59.     db    'SCB BIOS jump table now fixed',13,10,0
  60.     rst    0
  61.  
  62. ilprt:
  63.     pop    hl
  64.     ld    a,(hl)
  65.     inc    hl
  66.     push    hl
  67.     or    a
  68.     ret    z
  69.     ld    e,a
  70.     ld    c,2
  71.     call    bdos
  72.     jr    ilprt
  73.  
  74. scbpb:    db    3ah        ;location of SCB address
  75.     db    0        ;get operation
  76.  
  77.     end    main
  78.