• Welcome to Dark Bit Factory & Gravity.
 

[680x0 ASM] Get Amiga Config

Started by va!n, October 01, 2007

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

va!n

I found some old stuff from our group for the 680x0 amiga... Dont know if following stuff will directly work... maybe you have to modify... otherwise the routine should work like a dream  :kewl:



Original code by  Stringray [S]carab

*******************************************
*** Get Amiga Config              ***
*******************************************

; determines               output in
;      - ChipSet OCS/ECS/AGA       d0
;       - Kickstart version/VideoFreq   d1
;      - CPU version (z.b. "$68000")   d2
;      - FPU version (e.g. "$68882")   d3
;      - Free ram (Chip)      d4
;      - Free ram (Fast)      d5
;      - Max ram (Chip)      d6
;      - Max ram (Fast)      d7

; kills:   d0-d7/a6

GetConfig:
   move.l   a6,-(a7)
   move.l   $4.w,a6         ; get execbase
   move.l   #$20002,d1      ; largest Chip
   jsr   -216(a6)      ; AvailMem()
   lsr.l   #8,d0         ; /1024
   lsr.l   #2,d0
   move.l   d0,d4

   move.l   #$20004,d1      ; largest Fast
   jsr   -216(a6)      ; AvailMem()
   lsr.l   #8,d0         ; /1024
   lsr.l   #2,d0
   move.l   d0,d5
   
   move.l   62(a6),d0      ; Max Chip
   lsr.l   #8,d0         ; / 1024
   lsr.l   #2,d0   
   move.l   d0,d6

   moveq   #4,d1         ; Max Fast
   bset    #19,d1   
   jsr     -216(a6)      ; AvailMem()
   lsr.l   #8,d0         ; / 1024
   lsr.l   #2,d0   
   move.l   d0,d7
   
   bsr   GetGFX
   
   move.l   $4.w,a6         ; get execbase
   moveq   #0,d1
   move.w   $14(a6),d1      ; KS version (1.3 = version 34)
   swap   d1
   move.b   530(a6),d1      ; VBlank Frequency
   
   move.l   $4.w,a6         ; get execbase
   moveq   #0,d2
   move.b   $129(a6),d2
   bsr   GetFPU
   bsr.b   GetCPU
   move.l   (a7)+,a6
   rts


GetCPU   btst   #7,d2
   bne.b   .68060
   btst   #3,d2
   bne.s   .68040
   btst   #2,d2
   bne.s   .68030
   btst   #1,d2
   bne.s   .68020
   btst   #0,d2
   bne.s   .68010

.68000   move.l   #$68000,d2
   rts
.68010   move.l   #$68010,d2
   rts
.68020   move.l   #$68020,d2
   rts
.68030   move.l   #$68030,d2
   rts
.68040   move.l   #$68040,d2
   rts
.68060   move.l   #$68060,d2
   rts
   
GetFPU   moveq   #0,d3
   btst   #7,d2
   bne.b   .68060i
   btst   #6,d2
   bne.b   .68040i
   btst   #5,d2
   bne.b   .68882
   btst   #4,d2
   bne.b   .68881
   rts

.68881   move.l   #$68881,d3
   rts
.68882   move.l   #$68882,d3
   rts
.68040i   move.l   #$68040,d3
   rts
.68060i   move.l   #$68060,d3
   rts
   
GetGFX   moveq   #0,d1
   move.b  $dff07d,d1
   cmp.b   #$f8,d1
   beq.b   .AGA
   cmp.b   #$fc,d1
   beq.b   .ECS
   moveq   #0,d0
   rts

.AGA   moveq   #2,d0
   rts
.ECS   moveq   #1,d0
   rts
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Jim

Kind of a history lesson :)  Looks like it'll work as long as the OS is around :D

Jim
Challenge Trophies Won:

Shockwave

Some Karma for the nostalgia value :)
Shockwave ^ Codigos
Challenge Trophies Won:

StingRay

#3
Interesting what one can find while browsing forums at work...
Let's compare it with the routine I've coded for my demo-system:


*******************************************
*** Get Configuration _GC ***
*******************************************

; determines output in
; - ChipSet OCS/ECS/AGA d0
; - Kickstart version/VideoFreq d1
; - CPU version (e.g. "$68000") d2
; - FPU version (e.g. "$68882") d3
; - Free ram (Chip) d4
; - Free ram (Fast) d5
; - Max ram (Chip) d6
; - Max ram (Fast) d7
; - Amiga type (real/emulator) a0 -1=emulator, 0=real

; kills: d0-d7/a6

GetConfiguration_GC
move.l a6,-(a7)
move.l $4.w,a6 ; get execbase
move.l #$20002,d1 ; largest Chip
jsr -216(a6) ; AvailMem()
lsr.l   #8,d0 ; /1024
lsr.l   #2,d0
move.l d0,d4

move.l #$20004,d1 ; largest Fast
jsr -216(a6) ; AvailMem()
lsr.l   #8,d0 ; /1024
lsr.l   #2,d0
move.l d0,d5

move.l 62(a6),d0 ; Max Chip
lsr.l   #8,d0    ; / 1024
lsr.l   #2,d0   
move.l d0,d6

moveq   #4,d1    ; Max Fast
bset    #19,d1
jsr     -216(a6) ; AvailMem()
lsr.l   #8,d0    ; / 1024
lsr.l   #2,d0   
move.l d0,d7

bsr GetGFX ; get native chipset
bsr GetRTG ; get gfx-card system

move.l $4.w,a6 ; get execbase
moveq #0,d1
move.w $14(a6),d1 ; KS version (1.3 = version 34)
swap d1
move.b 530(a6),d1 ; VBlank Frequency

; check if running on a real Amiga or emulator
...


Déjà vu or what? So dear va!n, even if it's "old stuff from your group" (which I once was member of) I can't remember that I ever allowed you to publish my code... Specially in the way you did it here without mentioning who actually coded it. Apparently some things never change...

Shockwave

:-\ Do you want the code removed Stingray?

There are guidelines here about publishing source "found" on the internet btw, if you find any other transgressions a PM to myself or Jim will get it sorted out.
Shockwave ^ Codigos
Challenge Trophies Won:

va!n

#5
@Stingray:
I am really sorry about this... i was not sure who coded it and where i got it from... (its just to much years ago!!!)  i just found the routine standalon without any comments on a old backup CD i found inside my BlitzBasic project folder... so i thought it would be usefull for some amiga coders out there... If you want, i will delete it directly... (btw in the meantime i will add the credits for it... i am really sorry about it, dint know that it was a routine coded by you!)

And please be sure, i will never spread any other routines/sources/unfinished intros or something like this, done by your person or someone else! I was really not sure where the code comes from... (aminet, blitz mailinglist, or if it was something i converted myself from an old amiga assembler books i had, as i tried some own routines to use with the old amiga blitzbasic as you and dc still may know. so can just only say i am very sorry and if you want, i will delete the source/thread)
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

StingRay

Since this thread was brought to my attention today I just want to make clear that I had my reasons to react like I did and va!n surely knows them! However, if I wanted the code to be deleted I would have said so. So feel free to use the code in whichever way you like, I do not mind, after all it might be useful for someone. No hard feelings or anything.

Cheers, Sting

Jim

Challenge Trophies Won:

Zeb

I love looking at old code - brings back so many memories!
if (empty($coffee)) {new $coffee();} else {drinkCoffee('fast');}

Amiga coder (assembler, E), PC coder (learning C)

PC SPECS:
W7 x64 Ultimate, AMD Athlon X2 Dual Core 5200 @ 2.6GHz, 4GB DDR2 PC6400 (800) RAM, JeanTech Storm 700W PSU, ATI Radeon X1650 Pro 256MB PCI-Ex16, SoundBlaster Audigy Platinum 2 eX, 3TB hard drive storage, Dual 22"WS TFT, Epson R300 printer, Epson V100 Perfection scanner, DL-DVD-+RAM/ROM/RW, DL-DVD-+RW, X7 laser gaming mouse and more...