home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / HDX_BACK / HDX401.ATB / CHECK.S < prev    next >
Encoding:
Text File  |  2001-02-09  |  4.6 KB  |  158 lines

  1. ;+
  2. ;  CHECK.S - check for existence of different components in system.
  3. ;-
  4.  
  5. .include    "defs.h"
  6. .include    "68030.s"
  7.  
  8. REGBASE    equ    1            ; most are on odd part of data bus
  9. bSCSI    equ    $FFFF8780+REGBASE    ; base address of SCSI bus
  10. bAT    equ    $FFF00000+REGBASE    ; base address of AT bus
  11. WDC    equ    $FFFF8604        ; base address of ACSI bus
  12.  
  13. ;+
  14. ; chkscsi() - Check if SCSI bus exists
  15. ;
  16. ; Uses: d0, d1, d2, a0, a1
  17. ;-
  18.     .globl    _chkscsi
  19. _chkscsi:                ; check if SCSI exists
  20.     move.l    #0,savssp        ; no stack pointer is saved yet
  21.     move.l    #1,-(sp)        ; find out what mode processor is in
  22.     move.w    #$20,-(sp)        ; Super(1L)
  23.     trap    #1
  24.     addq.w    #6,sp            ; clean up stack
  25.     tst.w    d0            ; in Supervisor mode already?
  26.     bne.s    tscsi            ; if so, go test for SCSI
  27.     clr.l    -(sp)            ; else go to Supervisor mode
  28.     move.w    #$20,-(sp)        ; Super(0L)
  29.     trap    #1
  30.     addq.w    #6,sp            ; clean up stack
  31.     move.l    d0,savssp        ; save original stack pointer
  32. tscsi:    clr.w    result            ; assume SCSI doesn't exist
  33.     movea.l    BERR,a0            ; save original bus error vector
  34.     move.l    #nbus,BERR        ; install our own vector
  35.     movea.l    sp,a1            ; save current stack pointer
  36.     move.b    bSCSI,d1        ; try to access the SCSI bus
  37.     move.w    #1,result        ; if no bus error, SCSI exists
  38. nbus:    move.l    a0,BERR            ; restore original bus error vector
  39.     move.l    a1,sp            ; restore stack pointer
  40. chkret:    tst.l    savssp            ; were we in User mode when started?
  41.     beq.s    tend            ; if not, just return
  42.     move.l    savssp,-(sp)        ; go back to User mode 
  43.     move.w    #$20,-(sp)        ; Super(savssp)
  44.     trap    #1
  45.     addq.w    #6,sp            ; clean up stack
  46. tend:    move.w    result,d0        ; d0 = result
  47.     rts
  48.  
  49.  
  50. ;+
  51. ; chkacsi() - Check if ACSI bus exists
  52. ;
  53. ; Uses: d0, d1, d2, a0, a1
  54. ;-
  55.     .globl    _chkacsi
  56. _chkacsi:                ; check if SCSI exists
  57.     move.l    #0,savssp        ; no stack pointer is saved yet
  58.     move.l    #1,-(sp)        ; find out what mode processor is in
  59.     move.w    #$20,-(sp)        ; Super(1L)
  60.     trap    #1
  61.     addq.w    #6,sp            ; clean up stack
  62.     tst.w    d0            ; in Supervisor mode already?
  63.     bne.s    tacsi            ; if so, go test for SCSI
  64.     clr.l    -(sp)            ; else go to Supervisor mode
  65.     move.w    #$20,-(sp)        ; Super(0L)
  66.     trap    #1
  67.     addq.w    #6,sp            ; clean up stack
  68.     move.l    d0,savssp        ; save original stack pointer
  69. tacsi:    clr.w    result            ; assume SCSI doesn't exist
  70.     movea.l    BERR,a0            ; save original bus error vector
  71.     move.l    #nbus,BERR        ; install our own vector
  72.     movea.l    sp,a1            ; save current stack pointer
  73.     move.w    WDC,d1            ; try to access the ACSI bus
  74.     move.w    #1,result        ; if no bus error, ACSI exists
  75.     bra    nbus
  76.  
  77.  
  78. ;+
  79. ; chkat() - Check if AT bus exists
  80. ;
  81. ; Uses: d0, d1, d2, a0, a1
  82. ;-
  83.     .globl    _chkat
  84. _chkat:                    ; check if AT bus exists
  85.     move.l    #0,savssp        ; no stack pointer is saved yet
  86.     move.l    #1,-(sp)        ; find out what mode processor is in
  87.     move.w    #$20,-(sp)        ; Super(1L)
  88.     trap    #1
  89.     addq.w    #6,sp            ; clean up stack
  90.     tst.w    d0            ; in Supervisor mode already?
  91.     bne.s    tat            ; if so, go test for AT
  92.     clr.l    -(sp)            ; else go to Supervisor mode
  93.     move.w    #$20,-(sp)        ; Super(0L)
  94.     trap    #1
  95.     addq.w    #6,sp            ; clean up stack
  96.     move.l    d0,savssp        ; save original stack pointer
  97. tat:    clr.w    result            ; assume AT bus doesn't exist
  98.     movea.l    BERR,a0            ; save original bus error vector
  99.     move.l    #nbus,BERR        ; install our own vector
  100.     movea.l    sp,a1            ; save current stack pointer
  101.     move.b    bAT,d1            ; try to access the AT bus
  102.     move.w    #1,result        ; if no bus error, AT exists
  103.     bra    nbus
  104.  
  105.  
  106. ;+
  107. ; chkblit() - Check if BLiTTER exists
  108. ;
  109. ; Uses: d0
  110. ;-
  111.     .globl    _chkblit
  112. _chkblit:
  113.     move.w    #-1,-(sp)
  114.     move.w    #64,-(sp)        ; blitmode(-1)
  115.     trap    #14
  116.     addq.w    #4,sp            ; clean up stack
  117.     btst    #1,d0            ; does BLiTTER exist?
  118.     beq.s    nblit
  119.     moveq    #1,d0            ; return 1 if exists
  120.     rts
  121. nblit:    moveq    #0,d0            ; return 0 if not
  122.     rts
  123.  
  124.  
  125. ;+
  126. ; chkcache() - Check if '030 cache exists
  127. ;
  128. ; Uses: d0, d1, d2, a0, a1
  129. ;-
  130.     .globl    _chkcache
  131. _chkcache:                ; check if '030 cache exists
  132.     move.l    #0,savssp        ; no stack pointer is saved yet
  133.     move.l    #1,-(sp)        ; find out what mode processor is in
  134.     move.w    #$20,-(sp)        ; Super(1L)
  135.     trap    #1
  136.     addq.w    #6,sp            ; clean up stack
  137.     tst.w    d0            ; in Supervisor mode already?
  138.     bne.s    tcache            ; if so, go test for cache
  139.     clr.l    -(sp)            ; else go to Supervisor mode
  140.     move.w    #$20,-(sp)        ; Super(0L)
  141.     trap    #1
  142.     addq.w    #6,sp            ; clean up stack
  143.     move.l    d0,savssp        ; save original stack pointer
  144. tcache:    clr.w    result            ; assume cache doesn't exist
  145.     movea.l    IINS,a0            ; save orig illegal instrn vector
  146.     move.l    #ncache,IINS        ; install our own vector
  147.     movea.l    sp,a1            ; save current stack pointer
  148.     movecacrd0            ; does a cache exist?
  149.     move.w    #1,result        ; if so, set result
  150. ncache:    move.l    a0,IINS            ; restore orig illegal instrn vector
  151.     move.l    a1,sp            ; restore stack pointer
  152.     bra    chkret
  153.  
  154.  
  155. .bss
  156. savssp:    ds.l    1            ; stack pointer
  157. result:    ds.w    1
  158.