home *** CD-ROM | disk | FTP | other *** search
- ;
- ; VerCheck V2.00
- ;
- ; by Jan Hagqvist
- ;
-
- ; V1.00 Saturday, 19 June 1993
- ; V1.05 Tuesday, 22 June 1993
- ; V2.00 Monday, 28 June 1993
-
- VerCheck
- move.l 4,a6 ; Execbase
- cmp.b #'6',(a0) ; Argument first digit a '6'?
- bne.s VerCheck2 ; No
- cmp.b #'8',1(a0) ; Argument second digit a '8'?
- bne.s VerCheck2 ; No
- cmp.b #'8',2(a0) ; Argument third digit a '8'?
- beq.s WantFPU ; Yep
- cmp.b #'0',2(a0) ; Argument third digit a '0'?
- beq.s WantCPU ; Yep
- VerCheck2
- moveq.l #0,d1 ; Clear d1
- VerLoop
- bsr.s GetByte ; Get a byte from command line
- cmp.b #0,d2 ; Any flags set?
- bne.s CheckIt ; Yep
- mulu #10,d1 ; Multiply by 10
- add.w d0,d1 ; Add to d1
- bra.s VerLoop ; Get the next byte
- CheckIt
- move.w 20(a6),d0 ; Get Exec version
- cmp.b #2,d2 ; Want given or better?
- beq.s CheckIt2 ; Yep
- cmp.w d1,d0 ; Compare with given version
- beq.s SameOrGreater ; Current version same as given
- bra.s NotTheOne ; Didn't match
- CheckIt2
- cmp.w d1,d0 ; Compare with given version
- bpl.s SameOrGreater ; Current version same or better than required
- NotTheOne
- clr.l d0 ; Return NIL
- rts
- SameOrGreater
- moveq.l #5,d0 ; Return WARN
- rts
-
- GetByte
- moveq.l #0,d2 ; Clear flags
- move.b (a0)+,d0 ; Get a byte from command line
- cmp.b #'>',d0 ; Is it a '>'-sign?
- beq.s GetByte3 ; Yep
- cmp.b #48,d0 ; ascii=>48?
- bmi.s GetByte4 ; No
- sub.b #48,d0 ; Translate to a number
- cmp.b #10,d0 ; Is it a digit (0-9)? ascii<=57?
- bmi.s GetByte2 ; Yep
- GetByte4
- moveq.l #1,d2 ; Set "No more digits"-flag
- GetByte2
- rts
- GetByte3
- moveq.l #2,d2 ; Set "Given version or better wanted"-flag
- rts
-
- WantCPU
- bsr.s GetProcessor ; Get the processor
- cmp.b d4,d1 ; Compare current with wanted
- beq.s ProSameOrBetter ; Wanted or better found
- moveq.l #0,d0 ; Return NIL
- rts
-
- ProSameOrBetter
- moveq.l #5,d0 ; Return WARN
- rts
-
- WantFPU
- bsr.s GetProcessor ; Get the processor
- cmp.b d5,d1 ; Compare current with wanted
- beq.s ProSameOrBetter ; Wanted or better found
- moveq.l #0,d0 ; Return NIL
- rts
-
- GetProcessor
- moveq.l #0,d1 ; Clear d1
- move.w 296(a6),d3 ; Get AttnFlags
- moveq.l #0,d4 ; Clear d4
- move.l d4,d5 ; Clear d5
- btst #0,d3 ; 68010?
- beq.s GetPro2 ; No
- move.b #10,d4 ; d4=10
- GetPro2
- btst #1,d3 ; 68020?
- beq.s GetPro3 ; No
- move.b #20,d4 ; d4=20
- GetPro3
- btst #2,d3 ; 68030?
- beq.s GetPro4 ; No
- move.b #30,d4 ; d4=30
- GetPro4
- btst #3,d3 ; 68040?
- beq.s GetPro5 ; No
- move.b #40,d4 ; d4=40
- GetPro5
- btst #4,d3 ; 68881?
- beq.s GetPro6 ; No
- move.b #81,d5 ; d4=81
- GetPro6
- btst #5,d3 ; 68882?
- beq.s GetPro7 ; No
- move.b #82,d5 ; d4=82
- GetPro7
- addq.l #3,a0 ; Skip 680/688 on command line
- ProLoop
- bsr GetByte ; Get a byte from command line
- cmp.b #0,d2 ; Any flags set?
- bne.s GotProcessor ; Yep
- mulu #10,d1 ; Multiply by 10
- add.w d0,d1 ; Add to d1
- bra.s ProLoop ; Get the next byte
- GotProcessor
- rts
-
- VersionString dc.b '$VER: VerCheck V2.00 28-June-1993',0
-
- END
-