home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / system / vercheck / source.lha / source / VerCheck.s
Text File  |  1995-01-11  |  3KB  |  126 lines

  1. ;
  2. ; VerCheck V2.00
  3. ;
  4. ; (c) 1993 by Jan Hagqvist
  5. ;
  6.  
  7. ; V1.00  Saturday, 19 June 1993
  8. ; V1.05  Tuesday,  22 June 1993
  9. ; V2.00  Monday,   28 June 1993
  10.  
  11. VerCheck
  12.   move.l  4,a6        ; Execbase
  13.   cmp.b   #'6',(a0)    ; Argument first digit a '6'?
  14.   bne.s   VerCheck2    ; No
  15.   cmp.b   #'8',1(a0)    ; Argument second digit a '8'?
  16.   bne.s   VerCheck2    ; No
  17.   cmp.b   #'8',2(a0)    ; Argument third digit a '8'?
  18.   beq.s   WantFPU    ; Yep
  19.   cmp.b   #'0',2(a0)    ; Argument third digit a '0'?
  20.   beq.s   WantCPU    ; Yep
  21. VerCheck2
  22.   moveq.l #0,d1        ; Clear d1
  23. VerLoop
  24.   bsr.s   GetByte    ; Get a byte from command line
  25.   cmp.b   #0,d2        ; Any flags set?
  26.   bne.s   CheckIt    ; Yep
  27.   mulu    #10,d1    ; Multiply by 10
  28.   add.w   d0,d1        ; Add to d1
  29.   bra.s   VerLoop    ; Get the next byte
  30. CheckIt
  31.   move.w  20(a6),d0    ; Get Exec version
  32.   cmp.b   #2,d2        ; Want given or better?
  33.   beq.s   CheckIt2    ; Yep
  34.   cmp.w   d1,d0        ; Compare with given version
  35.   beq.s   SameOrGreater    ; Current version same as given
  36.   bra.s   NotTheOne    ; Didn't match
  37. CheckIt2
  38.   cmp.w   d1,d0        ; Compare with given version
  39.   bpl.s   SameOrGreater    ; Current version same or better than required
  40. NotTheOne
  41.   clr.l d0        ; Return NIL
  42.   rts
  43. SameOrGreater
  44.   moveq.l #5,d0        ; Return WARN
  45.   rts
  46.  
  47. GetByte
  48.   moveq.l #0,d2        ; Clear flags
  49.   move.b  (a0)+,d0    ; Get a byte from command line
  50.   cmp.b   #'>',d0    ; Is it a '>'-sign?
  51.   beq.s   GetByte3    ; Yep
  52.   cmp.b   #48,d0    ; ascii=>48?
  53.   bmi.s   GetByte4    ; No
  54.   sub.b   #48,d0    ; Translate to a number
  55.   cmp.b   #10,d0    ; Is it a digit (0-9)? ascii<=57?
  56.   bmi.s   GetByte2    ; Yep
  57. GetByte4
  58.   moveq.l #1,d2        ; Set "No more digits"-flag
  59. GetByte2
  60.   rts
  61. GetByte3
  62.   moveq.l #2,d2        ; Set "Given version or better wanted"-flag
  63.   rts
  64.  
  65. WantCPU
  66.   bsr.s   GetProcessor        ; Get the processor
  67.   cmp.b   d4,d1            ; Compare current with wanted
  68.   beq.s   ProSameOrBetter    ; Wanted or better found
  69.   moveq.l #0,d0            ; Return NIL
  70.   rts
  71.  
  72. ProSameOrBetter
  73.   moveq.l #5,d0            ; Return WARN
  74.   rts
  75.  
  76. WantFPU
  77.   bsr.s   GetProcessor        ; Get the processor
  78.   cmp.b   d5,d1            ; Compare current with wanted
  79.   beq.s   ProSameOrBetter    ; Wanted or better found
  80.   moveq.l #0,d0            ; Return NIL
  81.   rts
  82.  
  83. GetProcessor
  84.   moveq.l #0,d1            ; Clear d1
  85.   move.w  296(a6),d3        ; Get AttnFlags
  86.   moveq.l #0,d4            ; Clear d4
  87.   move.l  d4,d5            ; Clear d5
  88.   btst    #0,d3            ; 68010?
  89.   beq.s   GetPro2        ; No
  90.   move.b  #10,d4        ; d4=10
  91. GetPro2
  92.   btst    #1,d3            ; 68020?
  93.   beq.s   GetPro3        ; No
  94.   move.b  #20,d4        ; d4=20
  95. GetPro3
  96.   btst    #2,d3            ; 68030?
  97.   beq.s   GetPro4        ; No
  98.   move.b  #30,d4        ; d4=30
  99. GetPro4
  100.   btst    #3,d3            ; 68040?
  101.   beq.s   GetPro5        ; No
  102.   move.b  #40,d4        ; d4=40
  103. GetPro5
  104.   btst    #4,d3            ; 68881?
  105.   beq.s   GetPro6        ; No
  106.   move.b  #81,d5        ; d4=81
  107. GetPro6
  108.   btst    #5,d3            ; 68882?
  109.   beq.s   GetPro7        ; No
  110.   move.b  #82,d5        ; d4=82
  111. GetPro7
  112.   addq.l  #3,a0            ; Skip 680/688 on command line
  113. ProLoop
  114.   bsr     GetByte    ; Get a byte from command line
  115.   cmp.b   #0,d2        ; Any flags set?
  116.   bne.s   GotProcessor    ; Yep
  117.   mulu    #10,d1    ; Multiply by 10
  118.   add.w   d0,d1        ; Add to d1
  119.   bra.s   ProLoop    ; Get the next byte
  120. GotProcessor
  121.   rts
  122.  
  123. VersionString        dc.b '$VER: VerCheck V2.00  28-June-1993',0
  124.  
  125.   END
  126.