22 February 2011, 10:22 | #1 |
Posts: n/a
|
Mimic XCopy KillSys function
Hey guys, I'm new...and too young for having lived fully the Amiga scene, sadly.
Since you are more expert than me in Amiga low level programming and I want to start to make my own demoscenes for my Miggy 600, I'm training myself to use very well the custom chips directly with asm. But I am all but good :P Ended this remark, the question I want to ask regarding this: [ Show youtube player ] It frees "System area" to gain more free ram. (I do know there are some pre-built binaries that do these on Aminet but I would not use them). Now, it is not shown very well but it disables the multitasking so: Code:
move.l 4.w,a6 ; EXEC address on a6 jsr -$78(a6) ; disable multasking Am I (probably) wrong? Is there any other routines it seems to do? ...or simply is there a simple kickstart function that do it already? Important note: Please don't post asm portion of code for my sake. I don't want to be a (asm) script kiddie and so I want to be able to understand fully for myself without "copying already done pieces of code"...at least I could do it when I have already understood it, but not before so I'll never learn:P So some tips about what I should do to mimic that function, and not how. Thanks for help! |
22 February 2011, 16:05 | #2 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
1. Call Forbid to prevent other programs from doing any funny stuff while we're pausing the system
2. Call OwnBlitter and then WaitBlit to make sure we can use the blitter without screwing up any program that was currently using it 3. Call LoadView with an argument of 0 to get a standard display output 4. Call WaitTOF (some say you must call WaitTOF twice but I dunno about that) 5. Save the contents of the INTENAR, INTREQR and DMACONR hardware registers 6. Disable all interrupts and DMA by writing $7FFF to INTENA and INTREQ, and $7FF to DMACON You now have full control of the system and can safely program all the graphics hardware. To return back to AmigaDOS or Workbench: 1. Disable all interrupts and DMA again 2. Call RemakeDisplay 3. Read the gb_copinit value from the graphics.library base structure and write it to COP1LC and then write any value to COPJMP1 4. Get the previously saved contents of INTENAR, INTREQR and DMACONR registers and set bit 15 to 1 in each of these values and write them back to INTENA, INTREQ and DMACON 5. Call WaitTOF for changes to take effect 6. Call DisownBlitter 7. Call Permit There's more to this if you need things like file access during your demo, interrupt and CPU control etc. but I think this will suffice to get started. EDIT: corrected Disable/Enable to Forbid/Permit Last edited by Leffmann; 22 February 2011 at 18:27. |
22 February 2011, 18:17 | #3 |
Cheesy crust
Join Date: Nov 2008
Location: Hawk's Creek
Age: 48
Posts: 1,383
|
This is how X-Copy does it. Just pasted the main KILLSYS part here, it branches to other things, and comments are in German. That's how the source is...
Code:
IFEQ SOLO ; *** KILLSYSTEM (KillSys) ; ***---------------------- KILLSYSTEM: move.l 4,a0 move.l 62(a0),maxchip lea w_ksys,A0 bsr x_OpenWindow move.l D0,-(SP) ; Windowpointer speichern lea w_ksys,A0 bsr x_CheckGadgets move.w D0,D6 ; Rueckgabewert speichern bsr ReleaseLMB RestoreWindow (SP)+ cmp.w #1,D6 bne return ; es ist nicht OK angeklickt worden bsr DrivesOFF bsr CheckFastMem movem.l default,d1-d7/a1-a2; alle wichtigen Werte an SOLO uebergeben movem.l d1-d7/a1-a2,defstore move.w #$7fff,D0 move.w D0,$DFF096 move.w D0,$DFF09C move.w D0,$DFF09A move.l #SOLOSTART-8,A1 ; Destination ($3F8) ; lea end_of_menue,a0 ; lea end_of_solo,a2 ;.copy move.b (a0)+,(a1)+ ; cmp.l a0,a2 ; bne.s .copy lea tmpstackend,a7 lea solodata,a0 ; Source lea SOLOSTART-8,a1 ; destination bsr PPDecrunch ; bsr CheckSerial movem.l defstore,d1-d7/a1-a2 ; move.l #$FC0002,D7 ; Ruecksprungadresse (fällt aus!) jmp SOLOSTART-8 defstore: DS.L 18 tmpstack: DS.B 128 tmpstackend: INCLUDE "depack.s" ENDC IFEQ SOLO |
22 February 2011, 20:16 | #4 | ||
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Notice that you can't quit back to AmigaOS once you used X-Copy's "KillSys". This is because X-Copy will most probably use all available Chip-RAM (512k, $0-$80000) for its buffers during copying and they don't have to be saved/restored as it would be the case when you want to return to the OS.
Quote:
Quote:
Two WaitTOF's are needed so that interlaced displays will be properly reset (2 copperlists!) Last edited by StingRay; 22 February 2011 at 20:22. |
||
23 February 2011, 08:11 | #5 | ||
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
Quote:
|
||
23 February 2011, 09:46 | #6 |
Cheesy crust
Join Date: Nov 2008
Location: Hawk's Creek
Age: 48
Posts: 1,383
|
|
23 February 2011, 10:14 | #7 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
Code:
move.w #$7fff,D0 move.w D0,$DFF096 move.w D0,$DFF09C move.w D0,$DFF09A the code is rather uninteresting for the thread opener anyway. |
|
23 February 2011, 10:33 | #8 | |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
|
|
23 February 2011, 20:55 | #9 |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
I tried to put a clean kill system routine at the start of my code (following Leffmanns guide) to fix a problem where the initial screen was occationally corrupted (DIWSTRT and a few other settings were wrong).
The problem I have now is that I have disabled the blitter, which is needed for a later screen. Can anyone suggest what I might be doing wrong? I have listed what I did to disable interrupts previously (old), and what I have changed it to (new). Code:
Disabling: Old New **** **** $4000 -> INTENA $7FFF -> INTREQR $01A0 -> DMACON $7FFF -> INTENA $07FF -> DMACON Enabling: Old New *** *** $8180 -> DMACON $83A0 -> DMACON $C070 -> INTENA Regards, Lonewolf10 |
23 February 2011, 21:43 | #10 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
$83a0 = sprite, copper, bitplane DMA enabled $83a0 | 1<<6 = $83e0 -> sprite, copper, blitter, bitplane DMA enabled Code:
$7FFF -> INTREQR |
|
23 February 2011, 22:37 | #11 | ||
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
Quote:
Quote:
Regards, Lonewolf10 |
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Xcopy with dongle | elpiloto | request.Apps | 8 | 09 December 2012 18:27 |
Seeking Xcopy Pro | Washac | request.Apps | 3 | 13 February 2010 20:03 |
XCopy problem | orange | support.Apps | 0 | 27 December 2009 22:07 |
Xcopy | mtb | support.Apps | 5 | 03 December 2003 08:40 |
XCopy | Ziaxx | Retrogaming General Discussion | 5 | 04 January 2003 00:12 |
|
|