home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 148.lha / Install_II / BootCode2.asm < prev    next >
Assembly Source File  |  1988-04-25  |  2KB  |  109 lines

  1. *
  2. * BootCode2.asm - give preference to MEMF_CHIP and deactivate external drives
  3. * Copyright (C) 1987 Ralph Babel, Falkenweg 3, D-6204 Taunusstein
  4. * all rights reserved - alle Rechte vorbehalten
  5. *
  6. * 07-Aug-1987 created
  7. * 30-Mar-1988 cleanup
  8. *
  9.         nolist
  10.         include "exec/types.i"
  11.         include "exec/execbase.i"
  12.         include "exec/memory.i"
  13.         include "exec/resident.i"
  14.         include "devices/bootblock.i"
  15.         include "resources/disk.i"
  16.         list
  17. *
  18. * registers
  19. *
  20. REG_SysBase     equr    a6
  21. *
  22. * macros
  23. *
  24. xlib    macro
  25.         xref    _LVO\1
  26.         endm
  27. callsys macro
  28.         jsr     _LVO\1(REG_SysBase)
  29.         endm
  30. *
  31. * IMPORT, external symbol references
  32. *
  33.         xlib    Forbid
  34.         xlib    Permit
  35.         xlib    Remove
  36.         xlib    Enqueue
  37.         xlib    OpenResource
  38.         xlib    FindResident
  39. *
  40. * constants
  41. *
  42. ROOT    equ     880     ;default AmigaDOS root block (3.5 inch)
  43. NEW_PRI equ     10      ;priority for MEMF_CHIP regions
  44. *
  45. * code section
  46. *
  47.         section "text",code
  48. *
  49. * magic constants
  50. *
  51.         BBID_DOS
  52.         dc.l    0       ;checksum
  53.         dc.l    ROOT
  54. *
  55. * boot code, called on system start-up
  56. *
  57. * In:
  58. *
  59. * A1: IOStdReq for TD_NAME, UNIT_0
  60. * A6: SysBase
  61. *
  62. * Out:
  63. *
  64. * A0: start address to jump to (D0 == zero)
  65. * D0: failure code, null if successful
  66. *
  67.         move.l  d2,-(sp)
  68.         callsys Forbid
  69.         movea.l LH_HEAD+MemList(REG_SysBase),a1
  70.         bra.s   3$
  71. 1$      btst.b  #MEMB_CHIP,MH_ATTRIBUTES+1(a1)  ;hi .. lo
  72.         beq.s   2$
  73.         move.l  a1,-(sp)
  74.         callsys Remove
  75.         movea.l (sp)+,a1
  76.         move.b  #NEW_PRI,LN_PRI(a1)
  77.         lea     MemList(REG_SysBase),a0
  78.         callsys Enqueue
  79. 2$      movea.l d2,a1
  80. 3$      move.l  (a1),d2 ;move.l LN_SUCC(a1),d2
  81.         bne.s   1$
  82.         callsys Permit
  83.         move.l  (sp)+,d2
  84.         lea     diskName(pc),a1
  85.         callsys OpenResource
  86.         tst.l   d0
  87.         beq.s   error
  88.         movea.l d0,a0
  89.         lea     DR_UNITID+4(a0),a0
  90.         moveq   #DRT_EMPTY,d0
  91.         move.l  d0,(a0)+        ;unit 1
  92.         move.l  d0,(a0)+        ;unit 2
  93.         move.l  d0,(a0)         ;unit 3
  94.         lea     dosName(pc),a1
  95.         callsys FindResident
  96.         tst.l   d0
  97.         beq.s   error
  98.         movea.l d0,a0
  99.         movea.l RT_INIT(a0),a0
  100.         moveq   #0,d0
  101.         rts
  102. error   moveq   #-1,d0
  103.         rts
  104. diskName:
  105.         dc.b    'disk.resource',0
  106. dosName:
  107.         dc.b    'dos.library',0
  108.         end
  109.