31 March 2018, 15:46 | #1 |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
ASM newbie, general help
Hi all, I'm asking for basic help about some points:
- About point 2, with the code below my purpose was to paint a red line starting from the middle of the screen, reaching the bottom of the screen and then reverse back until reaching the top of the screen, switch back again and so on. Things works more or less, however the bar start from 1/3rd of the screen and reach the 2/3rd of the screen (see the attached image) What's the matter there? - About point 3, always on the code below I think I can optimize the code by using an XOR command on Direction flag to switch its value instead of branch to SetUp and SetDown. How does XOR works? Thank you PS I'm using ASM ONE 1.02 with FS UAE (A600 + HD) Code:
;***************** ;* Constants * ;***************** OldOpenLibrary = -$198 ; -408 CloseLibrary = -$19E ; -414 DMASET= %1000000111000000 ; -----a-bcdefghij ; a: Blitter Nasty ; b: Bitplane DMA (if this isn't set, sprites disappear!) ; c: Copper DMA ; d: Blitter DMA ; e: Sprite DMA ; f: Disk DMA ; g-j: Audio 3-0 DMA SECTION CODESECTION,CODE ; This command will run the below code ; on FAST RAM (if enough) or CHIP RAM START: MOVE.L $4.W,A6 ; Exec pointer to A6 LEA.L GfxName(PC),A1 ; Set library pointer to A1 MOVEQ #0,D0 JSR OldOpenLibrary(A6) ; Open graphics.library ; write to D0 the offset MOVE.L D0,A1 ; Use Base-pointer MOVE.L $26(A1),OLDCOP ; Store copperlist system address, ; retrieved $26 from glib offset JSR CloseLibrary(A6) ; Close graphics library move.l #COPPERLIST,$dff080 ; COP1LC - Point to #COPPERLIST move.w d0,$dff088 ; COPJMP1 - Start COP main: cmpi.b #$ff,$dff006 ; VHPOSR wait for horizontal line ; of the light pen bne.s main ; if pen did not reach the end, repeat loop bsr.s movebar ; waitmouse: btst #6,$bfe001 ; check for left mouse button bne.s main ; if not, repeat the above line end: move.l OldCop(PC),$dff080 ; COP1LC - Point to default COP system move.w d0,$dff088 ; COPJMP1 - Restart COP move.l 4.w,a6 jsr -$7e(a6) ; Enable Multitasking move.l gfxbase(PC),a1 ; Point to gfxbase jsr -$19e(a6) ; Closelibrary rts GfxName: dc.b "graphics.library",0,0 GfxBase: ; Dedicated to offset "graphics.library" dc.l 0 OldCop: ; Dedicated to system COP address dc.l 0 Movebar: LEA REDBAR,a0 TST.B Direction BEQ.S Movebardown BNE.S Movebarup ;waitpen: ; cmpi.b #$ff,$dff006 ; BEQ.S waitpen ; BNE.S waitmouse RTS ToggleDirection: TST.B Direction BEQ.S SetUp BNE.S SetDown RTS SetUp: MOVE.B #1,Direction RTS SetDown: MOVE.B #0,Direction RTS Movebarup: SUBQ.B #1,8(a0) SUBQ.B #1,(a0) CMPI.W #$7e07,(a0) BEQ.S ToggleDirection RTS Movebardown: ADDQ.B #1,(a0) ADDQ.B #1,8(a0) CMPI.w #$fd07,8(a0) BEQ.S ToggleDirection RTS Direction: DC.B 0,0 SECTION GRAPHIC,DATA_C ; Section below MUST be executen on CHIP RAM, ; because COPPERLIST requires it COPPERLIST: dc.w $100,$200 ; BPLCON0 - THE BITLANE CONTROL dc.w $180,$000 ; Color 0 - BLACK dc.w $7d07,$FFFE dc.w $180,$00f ; Color 0 - BLUE dc.w $7e07,$FFFE ; TOP LIMIT dc.w $180,$000 REDBAR: dc.w $7f07,$FFFE ; Wait for line $7f (half screen) dc.w $180,$F00 ; Color 0 - RED dc.w $8007,$FFFE ; Wait for line $80 (next line) dc.w $180,$000 ; Color 0 - BLACK dc.w $fe07,$FFFE ; Wait for last line dc.w $180,$00F ; Color 0 - BLUE dc.w $ff07,$FFFE dc.w $180,$000 dc.w $FFFF,$FFFE ; END OF COPPERLIST Last edited by fstarred; 31 March 2018 at 15:52. |
31 March 2018, 16:08 | #2 |
Registered User
Join Date: Oct 2012
Location: Italy
Age: 49
Posts: 2,942
|
Welcome to the forum fstarred
I'm sorry i can't help you with Assembly But you will surely find the help you need here |
31 March 2018, 17:33 | #3 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Point 1 : can't help. Not using Asm-one. Sorry.
Point 2 : I can't the heck understand what's your exact intent. Perhaps i can't help with the copper either if you're doing unusual stuff. However, you return to your loop without ever checking that the value is no longer $ff in $dff006 so "movebar" may be called several times in a row. Point 3 : there is no XOR command. You can use, however, EOR, but it's not exactly the best way to reverse a simple flag. Better initialize with 0 (or $ff, but not 1) and use NOT.B on the flag. A few remarks : - Your code uses 100% cpu. Not nice on some configs. - You have unreachable RTS after your commented "waitpen" label. |
31 March 2018, 20:19 | #4 | ||||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
Quote:
Quote:
Quote:
More important missing part is proper startup code. |
||||
01 April 2018, 11:19 | #5 |
Registered User
Join Date: Jan 2016
Location: NL
Posts: 32
|
about point 2: if you want the top to be higher try this:
in Movebarup: change Code:
CMPI.W #$7e07,(a0) Code:
CMPI.W #$2c07,(a0) change Code:
dc.w $180,$000 ; Color 0 - BLACK dc.w $7d07,$FFFE dc.w $180,$00f ; Color 0 - BLUE dc.w $7e07,$FFFE ; TOP LIMIT dc.w $180,$000 Code:
dc.w $180,$000 ; Color 0 - BLACK dc.w $2c07,$FFFE dc.w $180,$00f ; Color 0 - BLUE dc.w $2d07,$FFFE ; TOP LIMIT dc.w $180,$000 |
01 April 2018, 12:39 | #6 |
Registered User
Join Date: Jan 2016
Location: NL
Posts: 32
|
Here's a version with some stop/start-up code that appears to work (it exits without errors):
Code:
; Constants OldOpenLibrary = -$198 ; -408 CloseLibrary = -$19E ; -414 DMASET = %1000001010000000 ; %-----axbcdefghij ; a: Blitter Nasty ; x: Enable DMA ; b: Bitplane DMA (if this isn't set, sprites disappear!) ; c: Copper DMA ; d: Blitter DMA ; e: Sprite DMA ; f: Disk DMA ; g-j: Audio 3-0 DMA SECTION CODESECTION,CODE ; This command will run the below code ; on FAST RAM (if enough) or CHIP RAM Start: move.l 4.w,a6 ; a6 = execbase move.l #gfxname,a1 ; a1 = gfxname jsr OldOpenLibrary(a6) ; open gfxlibrary move.l d0,a1 ; a1 = gfxlibrary move.l 38(a1),oldcop ; save COPPER jsr CloseLibrary(a6) ; close gfxlibrary move.w $dff01c,oldint ; save INTENAR move.w $dff002,olddma ; save DMACONR move.w #$7fff,$dff09a ; disable INTENA = turn off OS move.w #$7fff,$dff09c ; disable INTREQ move.w #$7fff,$dff09c ; twice -> amiga4000 hw bug! move.w #$7fff,$dff096 ; disable DMACON move.w #DMASET,$dff096 ; enable necessary bits in DMACON move.l #copperlist,$dff080 ; COP1LCH set custom copperlist move.w #0,$dff088 ; COPJMP1 activate copperlist Main: move.l $dff004,d0 ; wait and.l #$0001ff00,d0 ; for cmp.l #303<<8,d0 ; rasterline 303 bne.s Main bsr.s Movebar .pause: btst #10,$dff016 ; check for right mouse button beq.s .pause ; pressed? pause! btst #6,$bfe001 ; check for left mouse button bne.s Main ; if not, repeat the above line End: move.w #$7fff,$dff096 ; clear DMACON move.w olddma,d0 or.w #$8200,d0 ; set bits of DMACON state move.w d0,$dff096 ; restore original DMACON move.l oldcop,$dff080 ; restore original copperlist move.w #0,$dff088 ; and activate it move.w oldint,d0 or.w #$c000,d0 ; set bits of INTENAR state move.w d0,$dff09a ; restore INTENA state = turn on OS moveq #0,d0 ; nice clean rts ; exit gfxname: dc.b "graphics.library",0,0 gfxbase: ; Dedicated to offset "graphics.library" dc.l 0 oldcop: ; Dedicated to system COP address dc.l 0 oldint: dc.w 0 ; Dedicated to INTENA(R) olddma: dc.w 0 ; Dedicated to DMA Movebar: lea redbar,a0 tst.b direction beq.s Movebardown bne.s Movebarup rts Movebarup: subq.b #1,(a0) ; red line subq.b #1,8(a0) ; black cmpi.b #$2c,(a0) ; top? beq.s ToggleDirection rts Movebardown: addq.b #1,(a0) ; red line addq.b #1,8(a0) ; black cmpi.b #$fe,8(a0) ; bottom? beq.s ToggleDirection rts ToggleDirection: tst.b direction beq.s .up .down move.b #0,direction bra.s .ret .up move.b #1,direction .ret rts direction: dc.b 0,0 SECTION GRAPHIC,DATA_C ; Section below MUST be executen on CHIP RAM, ; because copperlist requires it copperlist: dc.w $100,$0200 ; BPLCON0 - THE BITLANE CONTROL dc.w $180,$000 ; Color 0 - BLACK ;--- top blue dc.w $2c07,$FFFE ; line 44 dc.w $180,$00f ; Color 0 - BLUE dc.w $2d07,$FFFE ; TOP LIMIT dc.w $180,$000 redbar: dc.w $7f07,$FFFE ; Wait for line $7f (half screen) dc.w $180,$F00 ; Color 0 - RED dc.w $8007,$FFFE ; Wait for line $80 (next line) dc.w $180,$000 ; Color 0 - BLACK dc.w $ffdf,$FFFE ; line 255 dc.w $0007,$FFFE ; line 256 dc.w $180,$0f0 ; COLOR00 green dc.w $0107,$FFFE dc.w $180,$000 ;--- bottom blue dc.w $2c07,$FFFE ; Wait for last line dc.w $180,$00F ; Color 0 - BLUE dc.w $2d07,$FFFE ; BOTTOM LIMIT dc.w $180,$000 dc.w $FFFF,$FFFE ; END OF copperlist END - I changed some labels to my own naming-conventions, but that's just cosmetic stuff... |
01 April 2018, 13:18 | #7 |
Registered User
Join Date: Jan 2016
Location: NL
Posts: 32
|
Small last minute change to the stop-startup code!
Code:
... Start: movem.l d1-a6,-(sp) ; save CPU registers move.l 4.w,a6 ; a6 = execbase ... Code:
... movem.l (sp)+,d1-a6 ; restore CPU registers moveq #0,d0 ; nice clean rts ; exit ... |
01 April 2018, 17:27 | #8 |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
Thank you all for the reply
@Chip hi, where are you from exactly ? In response to your suggestions: 1 - gosh, I wonder how programmers made demos without going mad 2 - @meynaf thank you for your answer, I've added a waitframe label on the code below hope it's more or less what you was suggesting for; yes I know the code below it's all but cpu optimized, however it's just a start code for beginners 3 - @Toni Wilen Thank you, BCHG is exactly what I was looking for (see the code below) Code:
;***************** ;* Constants * ;***************** OldOpenLibrary = -$198 ; -408 CloseLibrary = -$19E ; -414 DMASET= %1000000111000000 ; -----a-bcdefghij ; a: Blitter Nasty ; b: Bitplane DMA (if this isn't set, sprites disappear!) ; c: Copper DMA ; d: Blitter DMA ; e: Sprite DMA ; f: Disk DMA ; g-j: Audio 3-0 DMA SECTION CODESECTION,CODE ; This command will run the below code ; on FAST RAM (if enough) or CHIP RAM START: MOVE.L $4.W,A6 ; Exec pointer to A6 LEA.L GfxName(PC),A1 ; Set library pointer to A1 MOVEQ #0,D0 JSR OldOpenLibrary(A6) ; Open graphics.library ; write to D0 the offset MOVE.L D0,A1 ; Use Base-pointer MOVE.L $26(A1),OLDCOP ; Store copperlist system address, ; retrieved $26 from glib offset JSR CloseLibrary(A6) ; Close graphics library move.l #COPPERLIST,$dff080 ; COP1LC - Point to #COPPERLIST move.w d0,$dff088 ; COPJMP1 - Start COP main: cmpi.b #$ff,$dff006 ; VHPOSR wait for horizontal line ; of the light pen bne.s main ; if pen did not reach the end, repeat loop bsr.s movebar ; waitframe: cmpi.b #$ff,$dff006 beq.s waitframe waitmouse: btst #6,$bfe001 ; check for left mouse button bne.s main ; if not, repeat the above line end: move.l OldCop(PC),$dff080 ; COP1LC - Point to default COP system move.w d0,$dff088 ; COPJMP1 - Restart COP move.l 4.w,a6 jsr -$7e(a6) ; Enable Multitasking move.l gfxbase(PC),a1 ; Point to gfxbase jsr -$19e(a6) ; Closelibrary rts GfxName: dc.b "graphics.library",0,0 GfxBase: ; Dedicated to offset "graphics.library" dc.l 0 OldCop: ; Dedicated to system COP address dc.l 0 Movebar: LEA REDBAR,a0 TST.B Direction BEQ.S Movebardown BNE.S Movebarup RTS SwitchDirection: BCHG #0,Direction RTS Movebarup: SUBQ.B #1,8(a0) SUBQ.B #1,(a0) CMPI.W #$7e07,(a0) BEQ.S SwitchDirection RTS Movebardown: ADDQ.B #1,(a0) ADDQ.B #1,8(a0) CMPI.w #$fd07,8(a0) BEQ.S SwitchDirection RTS Direction: DC.B 0 SECTION GRAPHIC,DATA_C ; Section below MUST be executen on CHIP RAM, ; because COPPERLIST requires it COPPERLIST: dc.w $100,$200 ; BPLCON0 - THE BITLANE CONTROL dc.w $180,$000 ; Color 0 - BLACK dc.w $7d07,$FFFE dc.w $180,$00f ; Color 0 - BLUE dc.w $7e07,$FFFE ; TOP LIMIT dc.w $180,$000 REDBAR: dc.w $7f07,$FFFE ; Wait for line $7f (half screen) dc.w $180,$F00 ; Color 0 - RED dc.w $8007,$FFFE ; Wait for line $80 (next line) dc.w $180,$000 ; Color 0 - BLACK dc.w $fe07,$FFFE ; Wait for last line dc.w $180,$00F ; Color 0 - BLUE dc.w $ff07,$FFFE dc.w $180,$000 dc.w $FFFF,$FFFE ; END OF COPPERLIST Trying to make it simplier; the code below produces a red line at 7f $VP (about center of the screen) (see attached image) Code:
COPPERLIST: dc.w $100, $200 ; BPLCON0 - THE BITLANE CONTROL dc.w $180, $000 ; Color 0 - BLACK REDBAR: dc.w $7f01,$ff00 ; Wait for line $7f (half screen) dc.w $180, $F00 ; Color 0 - RED dc.w $8001,$ff00 ; Wait for line $80 (next line) dc.w $180, $000 ; Color 0 - BLACK dc.w $FFFF,$FFFE ; END OF COPPERLIST Code:
dc.w $AA01,$ff00 ; Wait for line $AA dc.w $180, $F00 ; Color 0 - RED dc.w $AB01,$ff00 ; Wait for line $AB What am I missing still ? Last edited by fstarred; 01 April 2018 at 17:36. |
01 April 2018, 17:34 | #9 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
1. Your code debugs fine in AsmTwo (which is based on AsmOne 1.02). But if you add startup code that clears INTENA, clear all but VERTB and PORTS to be able to debug. Cartridges can debug even with the OS turned off, but you must then put a button wait in the critical places or know the breakpoint address to debug at the right place.
Your code is perfectly valid to show a screen for a while. In an OS environment, the system could refresh the screen and Copper pointer would be reset, and OS interrupts are still running (in fact, all the applications the user has started before yours will pre-emptively multitask with your demo) stealing processing time. And Lightpen is actually an accurate term for the raster beam, it really draws a picture with light. Whereas one of these is just a sensor that doesn't draw anything. 2. The hardware has no notion of raster positions > $ff; it's 8-bit so it wraps around to 0 after $ff. So instead, you must insert an extra $ffdf,$fffe to show something below this position. Bit of a pain, but if you create a .w variable for the vertical position you can move and bounce that, and then put the lower 8 bits of the position into the copper (and insert the extra wait if necessary). 3. XOR (strangely called EOR on 68k) inverts all bits of the destination that are 1 in the source. |
01 April 2018, 17:39 | #10 |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
@borchen
thank you so much for the code, honestly I'm still trying to figure out some basic concepit with the copper registry (see post above) |
01 April 2018, 18:23 | #11 |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
Ok, this is my updated code
Code:
;***************** ;* Constants * ;***************** OldOpenLibrary = -$198 ; -408 CloseLibrary = -$19E ; -414 DMASET= %1000000111000000 ; -----a-bcdefghij ; a: Blitter Nasty ; b: Bitplane DMA (if this isn't set, sprites disappear!) ; c: Copper DMA ; d: Blitter DMA ; e: Sprite DMA ; f: Disk DMA ; g-j: Audio 3-0 DMA SECTION CODESECTION,CODE ; This command will run the below code ; on FAST RAM (if enough) or CHIP RAM START: MOVE.L $4.W,A6 ; Exec pointer to A6 LEA.L GfxName(PC),A1 ; Set library pointer to A1 MOVEQ #0,D0 JSR OldOpenLibrary(A6) ; Open graphics.library ; write to D0 the offset MOVE.L D0,A1 ; Use Base-pointer MOVE.L $26(A1),OLDCOP ; Store copperlist system address, ; retrieved $26 from glib offset JSR CloseLibrary(A6) ; Close graphics library move.l #COPPERLIST,$dff080 ; COP1LC - Point to #COPPERLIST move.w d0,$dff088 ; COPJMP1 - Start COP main: cmpi.b #$ff,$dff006 ; VHPOSR wait for horizontal line ; of the light pen bne.s main ; if pen did not reach the end, repeat loop bsr.s movebar ; waitframe: cmpi.b #$ff,$dff006 beq.s waitframe waitmouse: btst #6,$bfe001 ; check for left mouse button bne.s main ; if not, repeat the above line end: move.l OldCop(PC),$dff080 ; COP1LC - Point to default COP system move.w d0,$dff088 ; COPJMP1 - Restart COP move.l 4.w,a6 jsr -$7e(a6) ; Enable Multitasking move.l gfxbase(PC),a1 ; Point to gfxbase jsr -$19e(a6) ; Closelibrary rts GfxName: dc.b "graphics.library",0,0 GfxBase: ; Dedicated to offset "graphics.library" dc.l 0 OldCop: ; Dedicated to system COP address dc.l 0 Movebar: LEA REDBAR,a0 TST.B Direction BEQ.S Movebardown BNE.S Movebarup RTS SwitchDirection: BCHG #0,Direction RTS Movebarup: SUBQ.B #1,8(a0) SUBQ.B #1,(a0) CMPI.W #$2c07,(a0) ; Upper limit BEQ.S SwitchDirection RTS Movebardown: ADDQ.B #1,(a0) ADDQ.B #1,8(a0) CMPI.w #$2b07,8(a0) ; Bottom limit BEQ.S SwitchDirection RTS Direction: DC.B 0,0 ; direction flag SECTION GRAPHIC,DATA_C ; Section below MUST be executen on CHIP RAM, ; because COPPERLIST requires it COPPERLIST: dc.w $100, $200 ; BPLCON0 - THE BITLANE CONTROL dc.w $180, $000 ; Color 0 - BLACK dc.w $2c07,$fffe dc.w $180, $0f0 dc.w $2d07,$fffe dc.w $180, $000 ; Color 0 - BLACK REDBAR: dc.w $ab07,$ff00 ; Wait for line $7f (half screen) dc.w $180, $F00 ; Color 0 - RED dc.w $ac07,$ff00 ; Wait for line $80 (next line) dc.w $180, $000 dc.w $ffdf,$fffe dc.w $2c07,$fffe dc.w $180, $0f0 dc.w $2d07,$fffe dc.w $180, $000 ; Color 0 - BLACK dc.w $FFFF,$FFFE ; END OF COPPERLIST Thank you so much for your code and hints !!! Edit: Thanks to photon explanation, I think I can work on it, once I have some time free I'LL post an update Last edited by fstarred; 01 April 2018 at 20:46. |
03 April 2018, 14:56 | #12 |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
Honestly I can't see how to deal with the $ffdf, even with Photon suggestion:
You can see the result so far on the attached gif and the red bar disappearing when reaching vertical position > $ff Basically, when REDBAR reached the $ff limit, I'd need to "call" the BOTTOM_OFFSET label BEFORE the RED_BAR offset. The problem is I don't know how to code this Can someone help me please? Code:
;***************** ;* Constants * ;***************** OldOpenLibrary = -$198 ; -408 CloseLibrary = -$19E ; -414 DMASET= %1000000111000000 ; -----a-bcdefghij ; a: Blitter Nasty ; b: Bitplane DMA (if this isn't set, sprites disappear!) ; c: Copper DMA ; d: Blitter DMA ; e: Sprite DMA ; f: Disk DMA ; g-j: Audio 3-0 DMA SECTION CODESECTION,CODE ; This command will run the below code ; on FAST RAM (if enough) or CHIP RAM START: MOVE.L $4.W,A6 ; Exec pointer to A6 LEA.L GfxName(PC),A1 ; Set library pointer to A1 MOVEQ #0,D0 JSR OldOpenLibrary(A6) ; Open graphics.library ; write to D0 the offset MOVE.L D0,A1 ; Use Base-pointer MOVE.L $26(A1),OLDCOP ; Store copperlist system address, ; retrieved $26 from glib offset JSR CloseLibrary(A6) ; Close graphics library move.w $dff01c,oldint ; save INTENAR move.w $dff002,olddma ; save DMACONR move.w #$7fff,$dff09a ; disable INTENA = turn off OS move.w #$7fff,$dff09c ; disable INTREQ move.w #$7fff,$dff09c ; twice -> amiga4000 hw bug! ;move.w #$7fff,$dff096 ; disable DMACON move.w #DMASET,$dff096 ; enable necessary bits in DMACON move.l #COPPERLIST,$dff080 ; COP1LC - Point to #COPPERLIST move.w d0,$dff088 ; COPJMP1 - Start COP Main: move.l $dff004,d0 ; wait and.l #$0001ff00,d0 ; for cmp.l #303<<8,d0 ; rasterline 303 bne.s Main bsr.s Movebar .pause: btst #10,$dff016 ; check for right mouse button beq.s .pause ; pressed? pause! btst #6,$bfe001 ; check for left mouse button bne.s Main ; if not, repeat the above line end: move.w #$7fff,$dff096 ; clear DMACON move.w olddma,d0 or.w #$8200,d0 ; set bits of DMACON state move.w d0,$dff096 ; restore original DMACON move.l oldcop,$dff080 ; restore original copperlist move.w #0,$dff088 ; and activate it move.w oldint,d0 or.w #$c000,d0 ; set bits of INTENAR state move.w d0,$dff09a ; restore INTENA state = turn on OS moveq #0,d0 ; nice clean rts ; exit GfxName: dc.b "graphics.library",0,0 GfxBase: ; Dedicated to offset "graphics.library" dc.l 0 OldCop: ; Dedicated to system COP address dc.l 0 oldint: dc.w 0 ; Dedicated to INTENA(R) olddma: dc.w 0 ; Dedicated to DMA Movebar: LEA REDBAR,a0 TST.B Direction BEQ.S Movebardown BNE.S Movebarup RTS SwitchDirection: BCHG #0,Direction RTS Movebarup: SUBQ.B #1,8(a0) SUBQ.B #1,(a0) CMPI.W #$2c07,(a0) ; Upper limit BEQ.S SwitchDirection RTS Movebardown: ADDQ.B #1,(a0) ADDQ.B #1,8(a0) CMPI.w #$2b07,8(a0) ; Bottom limit BEQ.S SwitchDirection RTS Direction: DC.B 0,0 ; direction flag SECTION GRAPHIC,DATA_C ; Section below MUST be executen on CHIP RAM, ; because COPPERLIST requires it COPPERLIST: dc.w $100, $200 ; BPLCON0 - THE BITLANE CONTROL dc.w $180, $000 ; Color 0 - BLACK dc.w $2c07,$fffe dc.w $180, $0f0 ; Top screen green bar dc.w $2d07,$fffe dc.w $180, $000 ; Color 0 - BLACK REDBAR: dc.w $ab07,$ff00 ; dc.w $180, $F00 ; Red bar dc.w $ac07,$ff00 ; BOTTOM_OFFSET: dc.w $180, $000 dc.w $ffdf,$fffe GREEN_BAR: dc.w $2c07,$fffe dc.w $180, $0f0 ; Bottom screen green bar dc.w $2d07,$fffe dc.w $180, $000 ; Color 0 - BLACK dc.w $FFFF,$FFFE ; END OF COPPERLIST |
03 April 2018, 18:05 | #13 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,212
|
Probably will be better for you to store your bar y position in a memory location and then "build" your copper wait with code
Then you can write beam wait positions, colour changes, and the PAL wait ($ffdf,$fffe) in the right order depending on the exact position of the bar... eg bar is above the line 255, bar is ON line 255 and bar is below line 255 (all cases would have the PAL wait copper command in a different place in relation to the other waits) |
04 April 2018, 12:12 | #14 | |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
Quote:
Code:
BEGIN_COPPERLIST: ; never changes ... REDBAR_ABOVE_FF: dc.w ... ; redbar position dc.w FFFD, FFFE ; end line (255) RTS REDBAR_BELOW_FF: dc.w FFFD, FFFE ; end line (255) dc.w ... ; redbar position An example: FOO: $11 $22 ; and so on I want to put $FF at the end of the label FOO, but I don't know how much FOO is at compile time, is there any way to do this with asm? Thank you very much |
|
04 April 2018, 21:19 | #15 | |||
Registered User
Join Date: Jan 2016
Location: NL
Posts: 32
|
@DanScott gave a good hint on what to do:
- You 'must' generate the REDBAR: part in the copperlist dynamically using the CPU. For this you 'must' reserve memory, which could look like this: Code:
REDBAR: dc.w 0,0 ; this dc.w 0,0 ; really dc.w 0,0 ; should dc.w 0,0 ; be dc.w 0,0 ; ds.w 10 - You have to deal with the following 3 cases: Quote:
Quote:
Quote:
|
|||
06 April 2018, 17:04 | #16 |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
Thanks @borchen, I've almost done:
Code:
;***************** ;* Constants * ;***************** OldOpenLibrary = -$198 ; -408 CloseLibrary = -$19E ; -414 DMASET= %1000000111000000 ; -----a-bcdefghij ; a: Blitter Nasty ; b: Bitplane DMA (if this isn't set, sprites disappear!) ; c: Copper DMA ; d: Blitter DMA ; e: Sprite DMA ; f: Disk DMA ; g-j: Audio 3-0 DMA SECTION CODESECTION,CODE ; This command will run the below code ; on FAST RAM (if enough) or CHIP RAM START: MOVE.L $4.W,A6 ; Exec pointer to A6 LEA.L GfxName(PC),A1 ; Set library pointer to A1 MOVEQ #0,D0 JSR OldOpenLibrary(A6) ; Open graphics.library ; write to D0 the offset MOVE.L D0,A1 ; Use Base-pointer MOVE.L $26(A1),OLDCOP ; Store copperlist system address, ; retrieved $26 from glib offset JSR CloseLibrary(A6) ; Close graphics library move.w $dff01c,oldint ; save INTENAR move.w $dff002,olddma ; save DMACONR move.w #$7fff,$dff09a ; disable INTENA = turn off OS move.w #$7fff,$dff09c ; disable INTREQ move.w #$7fff,$dff09c ; twice -> amiga4000 hw bug! ;move.w #$7fff,$dff096 ; disable DMACON move.w #DMASET,$dff096 ; enable necessary bits in DMACON move.l #COPPERLIST,$dff080 ; COP1LC - Point to #COPPERLIST move.w d0,$dff088 ; COPJMP1 - Start COP Main: move.l $dff004,d0 ; wait and.l #$0001ff00,d0 ; for cmp.l #303<<8,d0 ; rasterline 303 bne.s Main bsr.s Movebar .pause: btst #10,$dff016 ; check for right mouse button beq.s .pause ; pressed? pause! btst #6,$bfe001 ; check for left mouse button bne.s Main ; if not, repeat the above line end: move.w #$7fff,$dff096 ; clear DMACON move.w olddma,d0 or.w #$8200,d0 ; set bits of DMACON state move.w d0,$dff096 ; restore original DMACON move.l oldcop,$dff080 ; restore original copperlist move.w #0,$dff088 ; and activate it move.w oldint,d0 or.w #$c000,d0 ; set bits of INTENAR state move.w d0,$dff09a ; restore INTENA state = turn on OS moveq #0,d0 ; nice clean rts ; exit GfxName: dc.b "graphics.library",0,0 GfxBase: ; Dedicated to offset "graphics.library" dc.l 0 OldCop: ; Dedicated to system COP address dc.l 0 oldint: dc.w 0 ; Dedicated to INTENA(R) olddma: dc.w 0 ; Dedicated to DMA RbVPos: ; dc.b $26,$01 ; red bar h pos, v pos (always 0) dc.b $01,$01 ; $2d - VERT TOP LIMIT PAL ; $ff - ; $2c - VERT BOTTOM LIMIT PAL Movebar: tst.b Direction_flag beq.s Movebar_down bne.s Movebar_up rts SwitchDirection: bchg #0,Direction_flag rts Movebar_down: addq.b #1,RbVPos bsr.s Check_bottom_limit bsr.s draw_bar rts Check_bottom_limit: cmpi.b #$28,RbVPos ; Bottom limit beq.s SwitchDirection rts draw_bar: cmpi.b #$ff, RbVPos beq DrawBar_At_FF ; vpos at $ff cmpi.b #$2c, RbVPos bcs DrawBar_After_FF ; vpos from $00 to $2c bhi DrawBar_Before_FF ; vpos from $2d to $ff rts Movebar_up: subq.b #1,RbVPos bsr.s Check_top_limit bsr.s draw_bar rts Check_top_limit: cmpi.b #$2d,RbVPos ; Upper limit beq.s SwitchDirection rts Direction_flag: DC.B 0,0 ; direction flag DrawBar_Before_FF: lea redbar, a0 move.w RbVPos, (a0)+ move.w #$FF00, (a0)+ move.w #$180, (a0)+ move.w #$F00, (a0)+ move.w RbVPos, d0 add.w #$100, d0 move.w d0, (a0)+ move.w #$FF00, (a0)+ move.w #$180, (a0)+ move.w #$000, (a0)+ move.w #$ffdf, (a0)+ move.w #$fffe, (a0)+ rts DrawBar_At_FF: lea redbar, a0 move.w #$FF01, (a0)+ move.w #$FF00, (a0)+ move.w #$180, (a0)+ move.w #$F00, (a0)+ move.w #$ffdf, (a0)+ move.w #$fffe, (a0)+ move.w #$0001, (a0)+ move.w #$FF00, (a0)+ move.w #$180, (a0)+ move.w #$000, (a0)+ rts DrawBar_After_FF: lea redbar, a0 move.w #$ffdf, (a0)+ move.w #$fffe, (a0)+ move.w RbVPos, (a0)+ move.w #$FF00, (a0)+ move.w #$180, (a0)+ move.w #$F00, (a0)+ move.w RbVPos, d0 add.w #$100, d0 move.w d0, (a0)+ move.w #$FF00, (a0)+ move.w #$180, (a0)+ move.w #$000, (a0)+ rts SECTION GRAPHIC,DATA_C ; Section below MUST be executen on CHIP RAM, ; because COPPERLIST requires it COPPERLIST: dc.w $100, $200 ; BPLCON0 - THE BITLANE CONTROL dc.w $180, $000 ; Color 0 - BLACK dc.w $2c01,$ff00 dc.w $180, $0f0 ; Top screen green bar dc.w $2d01,$ff00 dc.w $180, $000 ; Color 0 - BLACK REDBAR: dc.w 0,0 dc.w 0,0 dc.w 0,0 dc.w 0,0 dc.w 0,0 GREEN_BAR: dc.w $2c01,$ff00 dc.w $180, $0f0 ; Bottom screen green bar dc.w $2d01,$ff00 dc.w $180, $000 ; Color 0 - BLACK END_COPPERLIST: dc.w $FFFF,$FFFE ; END OF COPPERLIST Such a mistery EDIT I really suspect that doing all those move.w on Draw_* label dramatically reduces performances, anyway I'm a bit perplexed.. Am I doing in the wrong way ? Last edited by fstarred; 06 April 2018 at 18:12. Reason: updated information |
07 April 2018, 12:50 | #17 | |
Registered User
Join Date: Jan 2016
Location: NL
Posts: 32
|
Quote:
- While trying to find the cause of the slowing down I messed around with your code and consolidated some parts of it; this should be done even more, because the Movebar: procedure 'should be' 1 piece of code, this would cause the program to bounce-around a lot less... - I also added some code to see the cpu-usage of the Movebar: procedure and raised the rasterline-wait to line 301, which is 1 line below the bottom-green line. Code:
... Main: move.l $dff004,d0 ; wait and.l #$0001ff00,d0 ; for cmp.l #301<<8,d0 ; rasterline 301 bne.s Main move.w #$f00,$dff180 ; start red cpu usage bsr.s Movebar move.w #$000,$dff180 ; end of red cpu usage ... Code:
;***************** ;* Constants * ;***************** OldOpenLibrary = -$198 ; -408 CloseLibrary = -$19E ; -414 DMASET= %1000001010000000 ; -----axbcdefghij ; a: Blitter Nasty ; x: DMA below on ; b: Bitplane DMA (if this isn't set, sprites disappear!) ; c: Copper DMA ; d: Blitter DMA ; e: Sprite DMA ; f: Disk DMA ; g-j: Audio 3-0 DMA SECTION CODESECTION,CODE ; This command will run the below code ; on FAST RAM (if enough) or CHIP RAM START: MOVE.L $4.W,A6 ; Exec pointer to A6 LEA.L GfxName(PC),A1 ; Set library pointer to A1 MOVEQ #0,D0 JSR OldOpenLibrary(A6) ; Open graphics.library ; write to D0 the offset MOVE.L D0,A1 ; Use Base-pointer MOVE.L $26(A1),oldcop ; Store copperlist system address, ; retrieved $26 from glib offset JSR CloseLibrary(A6) ; Close graphics library move.w $dff01c,oldint ; save INTENAR move.w $dff002,olddma ; save DMACONR move.w #$7fff,$dff09a ; disable INTENA = turn off OS move.w #$7fff,$dff09c ; disable INTREQ move.w #$7fff,$dff09c ; twice -> amiga4000 hw bug! move.w #$7fff,$dff096 ; disable DMACON move.w #DMASET,$dff096 ; enable necessary bits in DMACON move.l #COPPERLIST,$dff080 ; COP1LC - Point to #COPPERLIST move.w d0,$dff088 ; COPJMP1 - Start COP Main: move.l $dff004,d0 ; wait and.l #$0001ff00,d0 ; for cmp.l #301<<8,d0 ; rasterline 301 bne.s Main move.w #$f00,$dff180 ; start red cpu usage bsr.s Movebar move.w #$000,$dff180 ; end of red cpu usage .pause: btst #10,$dff016 ; check for right mouse button beq.s .pause ; pressed? pause! btst #6,$bfe001 ; check for left mouse button bne.s Main ; if not, repeat the above line end: move.w #$7fff,$dff096 ; clear DMACON move.w olddma,d0 or.w #$8200,d0 ; set bits of DMACON state move.w d0,$dff096 ; restore original DMACON move.l oldcop,$dff080 ; restore original copperlist move.w #0,$dff088 ; and activate it move.w oldint,d0 or.w #$c000,d0 ; set bits of INTENAR state move.w d0,$dff09a ; restore INTENA state = turn on OS moveq #0,d0 ; nice clean rts ; exit GfxName: dc.b "graphics.library",0,0 GfxBase: ; Dedicated to offset "graphics.library" dc.l 0 oldcop: ; Dedicated to system COP address dc.l 0 oldint: dc.w 0 ; Dedicated to INTENA(R) olddma: dc.w 0 ; Dedicated to DMA Direction_flag: DC.B 0,0 ; direction flag RbVPos: ; dc.b $26,$01 ; red bar h pos, v pos (always 0) dc.b $01,$07 ; $2d - VERT TOP LIMIT PAL ; $ff - ; $2c - VERT BOTTOM LIMIT PAL Movebar: tst.b Direction_flag beq.s Movebar_down bne.s Movebar_up rts Movebar_down: addq.b #1,RbVPos cmpi.b #$2c,RbVPos ; Bottom limit check bne.s .draw bchg #0,Direction_flag ; switch direction .draw bsr.s draw_bar rts draw_bar: lea REDBAR, a0 cmpi.b #$ff, RbVPos beq.s DrawBar_At_FF ; vpos at $ff cmpi.b #$2c, RbVPos bcs.s DrawBar_After_FF ; vpos from $00 to $2c bhi.s DrawBar_Before_FF ; vpos from $2d to $ff rts Movebar_up: subq.b #1,RbVPos cmpi.b #$2d,RbVPos ; Upper limit check bne.s .draw bchg #0,Direction_flag ; switch direction .draw bsr.s draw_bar rts DrawBar_Before_FF: move.w RbVPos,d0 move.w d0,(a0)+ move.w #$FFFE,(a0)+ move.l #$1800F00,(a0)+ add.w #$100,d0 move.w d0,(a0)+ move.w #$FFFE,(a0)+ move.l #$1800000,(a0)+ move.l #$ffdffffe,(a0) rts DrawBar_At_FF: move.l #$FF07FFFE,(a0)+ move.l #$1800F00,(a0)+ move.l #$ffdffffe,(a0)+ move.l #$0007FFFE,(a0)+ move.l #$1800000,(a0) rts DrawBar_After_FF: move.w RbVPos,d0 move.l #$ffdffffe,(a0)+ move.w d0,(a0)+ move.w #$FFFE,(a0)+ move.l #$1800F00,(a0)+ add.w #$100,d0 move.w d0,(a0)+ move.w #$FFFE,(a0)+ move.l #$1800000,(a0) rts SECTION GRAPHIC,DATA_C ; Section below MUST be executen on CHIP RAM, ; because COPPERLIST requires it COPPERLIST: dc.w $100, $200 ; BPLCON0 - THE BITLANE CONTROL dc.w $180, $000 ; Color 0 - BLACK dc.w $2c07,$fffe dc.w $180, $0f0 ; Top screen green bar dc.w $2d07,$fffe dc.w $180, $000 ; Color 0 - BLACK REDBAR: dc.w 0,0 dc.w 0,0 dc.w 0,0 dc.w 0,0 dc.w 0,0 GREEN_BAR: dc.w $2c07,$fffe dc.w $180, $0f0 ; Bottom screen green bar dc.w $2d07,$fffe dc.w $180, $000 ; Color 0 - BLACK END_COPPERLIST: dc.w $FFFF,$FFFE ; END OF COPPERLIST |
|
09 April 2018, 13:48 | #18 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Doesn't Photon cover this in his tutorials?
|
09 April 2018, 14:42 | #19 |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
Ok, I've optimized many calls, hope it looks better to you:
Code:
;***************** ;* Constants * ;***************** OldOpenLibrary = -$198 ; -408 CloseLibrary = -$19E ; -414 DMASET= %1000001010000000 ; -----axbcdefghij ; a: Blitter Nasty ; x: DMA below on ; b: Bitplane DMA (if this isn't set, sprites disappear!) ; c: Copper DMA ; d: Blitter DMA ; e: Sprite DMA ; f: Disk DMA ; g-j: Audio 3-0 DMA SECTION CODESECTION,CODE ; This command will run the below code ; on FAST RAM (if enough) or CHIP RAM START: MOVE.L $4.W,A6 ; Exec pointer to A6 LEA.L GfxName(PC),A1 ; Set library pointer to A1 MOVEQ #0,D0 JSR OldOpenLibrary(A6) ; Open graphics.library ; write to D0 the offset MOVE.L D0,A1 ; Use Base-pointer MOVE.L $26(A1),oldcop ; Store copperlist system address, ; retrieved $26 from glib offset JSR CloseLibrary(A6) ; Close graphics library move.w $dff01c,oldint ; save INTENAR move.w $dff002,olddma ; save DMACONR move.w #$7fff,$dff09a ; disable INTENA = turn off OS move.w #$7fff,$dff09c ; disable INTREQ move.w #$7fff,$dff09c ; twice -> amiga4000 hw bug! move.w #$7fff,$dff096 ; disable DMACON move.w #DMASET,$dff096 ; enable necessary bits in DMACON move.l #COPPERLIST,$dff080 ; COP1LC - Point to #COPPERLIST move.w d0,$dff088 ; COPJMP1 - Start COP bsr Draw_Env_Before_FF ; BE AWARE! if RbVPos < $2d ; call Draw_Env_After_FF instead Main: move.l $dff004,d0 ; wait and.l #$0001ff00,d0 ; for cmp.l #303<<8,d0 ; rasterline 303 bne.s Main bsr.s Movebar .pause: btst #10,$dff016 ; check for right mouse button beq.s .pause ; pressed? pause! btst #6,$bfe001 ; check for left mouse button bne.s Main ; if not, repeat the above line end: move.w #$7fff,$dff096 ; clear DMACON move.w olddma,d0 or.w #$8200,d0 ; set bits of DMACON state move.w d0,$dff096 ; restore original DMACON move.l oldcop,$dff080 ; restore original copperlist move.w #0,$dff088 ; and activate it move.w oldint,d0 or.w #$c000,d0 ; set bits of INTENAR state move.w d0,$dff09a ; restore INTENA state = turn on OS moveq #0,d0 ; nice clean rts ; exit GfxName: dc.b "graphics.library",0,0 GfxBase: ; Dedicated to offset "graphics.library" dc.l 0 OldCop: ; Dedicated to system COP address dc.l 0 oldint: dc.w 0 ; Dedicated to INTENA(R) olddma: dc.w 0 ; Dedicated to DMA RbVPos: ; dc.b $26,$01 ; red bar h pos, v pos (always 0) ; dc.b $fe,$01 dc.b $2e,$01 ; $2d - VERT TOP LIMIT PAL ; $ff - ; $2c - VERT BOTTOM LIMIT PAL Movebar: tst.b Direction_flag beq.s Movebar_down bne.s Movebar_up SwitchDirection: bchg #0,Direction_flag rts Movebar_down: addq.b #1,RbVPos cmpi.b #$28,RbVPos ; is bottom limit reached? beq.s SwitchDirection ; bottom limit reached ; switch direction cmpi.b #$ff,RbVPos beq.w Draw_Env_After_FF cmpi.b #$2d,RbVPos bcs.s Draw_Bar_After_FF bhi.w Draw_Bar_Before_FF Draw_Bar_Before_FF: lea redbar, a0 move.b RbVPos, (a0) move.b RbVPos, d0 addq.b #1, d0 move.b d0, 8(a0) rts Draw_Bar_After_FF: lea redbar, a0 move.b RbVPos, 4(a0) move.b RbVPos, d0 addq.b #1, d0 move.b d0, 12(a0) rts Movebar_up: subq.b #1,RbVPos cmpi.b #$2c, RbVPos ; is top limit reached? beq.s SwitchDirection ; top limit reached ; switch direction cmpi.b #$ff,RbVPos beq.s Draw_Env_Before_FF cmpi.b #$2d,RbVPos bcs.s Draw_Bar_After_FF bhi.s Draw_Bar_Before_FF rts Direction_flag: dc.b 0,0 ; direction flag Draw_Env_Before_FF: lea redbar, a0 move.l #$ff01ff00, (a0) ; redbar move.l #$01800f00, 4(a0) move.l #$0001ff00, 8(a0) ; redbar move.l #$01800000, 12(a0) move.l #$ffdffffe, 16(a0) rts Draw_Env_After_FF: lea redbar, a0 move.l #$ffdffffe, (a0) move.l #$ff01ff00, 4(a0) ; redbar move.l #$01800f00, 8(a0) move.l #$0001ff00, 12(a0) ; redbar move.l #$01800000, 16(a0) rts SECTION GRAPHIC,DATA_C ; Section below MUST be executen on CHIP RAM, ; because COPPERLIST requires it COPPERLIST: dc.w $100, $200 ; BPLCON0 - THE BITLANE CONTROL dc.w $180, $000 ; Color 0 - BLACK dc.w $2c01,$ff00 dc.w $180, $0f0 ; Top screen green bar dc.w $2d01,$ff00 dc.w $180, $000 ; Color 0 - BLACK REDBAR: dc.w 0,0 dc.w 0,0 dc.w 0,0 dc.w 0,0 dc.w 0,0 GREEN_BAR: dc.w $2c01,$ff00 dc.w $180, $0f0 ; Bottom screen green bar dc.w $2d01,$ff00 dc.w $180, $000 ; Color 0 - BLACK END_COPPERLIST: dc.w $FFFF,$FFFE ; END OF COPPERLIST Basically I had to reduce call to copperlist (redbar) with drawing fixed values once when passing to $ff vertical position (see Draw_Env_Before_FF and Draw_Env_After_FF) and then call move directive ONLY for redbar position. Thank you all! |
14 April 2018, 20:49 | #20 | ||
Registered User
Join Date: Jan 2016
Location: NL
Posts: 32
|
@mcgeezer
Quote:
@fstarred Quote:
Just for good measure, here's my version, which contains a simple to use Pause MACRO: Code:
; Constants OldOpenLibrary = -$198 ; -408 CloseLibrary = -$19E ; -414 DMASET = %1000001010000000 ; %-----axbcdefghij ; a: Blitter Nasty ; x: Enable DMA ; b: Bitplane DMA (if this isn't set, sprites disappear!) ; c: Copper DMA ; d: Blitter DMA ; e: Sprite DMA ; f: Disk DMA ; g-j: Audio 3-0 DMA ;--- Macros Pause: MACRO .pause\@: btst #10,$dff016 ; check for right mouse button bne.s .pause\@ ; pressed? continue! ENDM SECTION CODESECTION,CODE ; This command will run the below code ; on FAST RAM (if enough) or CHIP RAM Start: movem.l d1-a6,-(sp) ; save CPU registers move.l 4.w,a6 ; a6 = execbase move.l #gfxname,a1 ; a1 = gfxname jsr OldOpenLibrary(a6) ; open gfxlibrary move.l d0,a1 ; a1 = gfxlibrary move.l 38(a1),oldcop ; save COPPER jsr CloseLibrary(a6) ; close gfxlibrary move.w $dff01c,oldint ; save INTENAR move.w $dff002,olddma ; save DMACONR move.w #$7fff,$dff09a ; disable INTENA = turn off OS move.w #$7fff,$dff09c ; disable INTREQ move.w #$7fff,$dff09c ; twice -> amiga4000 hw bug! move.w #$7fff,$dff096 ; disable DMACON move.w #DMASET,$dff096 ; enable necessary bits in DMACON move.l #copperlist,$dff080 ; COP1LCH set custom copperlist move.w #0,$dff088 ; COPJMP1 activate copperlist ;--- Init Movebar move.w #$0100,d0 ; down=$0100, up=$ff00 move.w d0,delta ; set delta startvalue move.w #$aa07,line ; line counter Main: move.l $dff004,d0 ; check VPOSR and.l #$0001ff00,d0 ; for cmp.l #301<<8,d0 ; rasterline 301 bne.s Main bsr.s Movebar btst #6,$bfe001 ; check for left mouse button bne.s Main ; if not, goto Main End: move.w #$7fff,$dff096 ; clear DMACON move.w olddma,d0 or.w #$8200,d0 ; set bits of DMACON state move.w d0,$dff096 ; restore original DMACON move.l oldcop,$dff080 ; restore original copperlist move.w #0,$dff088 ; and activate it move.w oldint,d0 or.w #$c000,d0 ; set bits of INTENAR state move.w d0,$dff09a ; restore INTENA state = turn on OS movem.l (sp)+,d1-a6 ; restore CPU registers moveq #0,d0 ; nice clean rts ; exit gfxname: dc.b "graphics.library",0,0 gfxbase: ; Dedicated to offset "graphics.library" dc.l 0 oldcop: ; Dedicated to system COP address dc.l 0 oldint: dc.w 0 ; Dedicated to INTENA(R) olddma: dc.w 0 ; Dedicated to DMACON(R) Movebar: move.w line,d0 ; current vert pos add.w delta,d0 ; down=1 / up=-1 move.w d0,line ; save new vert pos lea redbar,a1 ; where to write in copperlist cmpi.w #$2c07,d0 blo.s Below cmpi.w #$ff07,d0 bne.s Above At: ; $ff = special part move.l #$ff07fffe,(a1)+ ; vert pos start move.l #$1800f00,(a1)+ ; COLOR00 red line move.l #$ffdffffe,(a1)+ ; extra wait move.l #$0007fffe,(a1)+ ; vert pos stop move.l #$1800000,(a1) ; COLOR00 black Pause rts Above: ; $2c - $fe = upper part move.w d0,(a1)+ ; vert pos start move.w #$fffe,(a1)+ ; wait move.l #$1800f00,(a1)+ ; COLOR00 red add.w #$0100,d0 move.w d0,(a1)+ ; vert pos stop move.w #$fffe,(a1)+ ; wait move.l #$1800000,(a1)+ ; COLOR00 black move.l #$ffdffffe,(a1) ; extra wait cmpi.w #$2d07,d0 ; $2c07+$0100 = top? bne.s .ret neg.w delta ; switch direction 1 -> -1 Pause .ret rts Below: ; $00 - $2b = lower part move.l #$ffdffffe,(a1)+ ; extra wait move.w d0,(a1)+ ; vert pos start move.w #$fffe,(a1)+ ; wait move.l #$1800f00,(a1)+ ; COLOR00 red add.w #$0100,d0 ; stop between $01-$2c move.w d0,(a1)+ ; vert pos stop move.w #$fffe,(a1)+ ; wait move.l #$1800000,(a1) ; COLOR00 black cmpi.w #$2c07,d0 ; $2b07+$0100 = bottom? bne.s .ret neg.w delta ; switch direction 1 -> -1 Pause .ret rts delta: dc.w 0 line: dc.w 0 SECTION GRAPHIC,DATA_C ; Section below MUST be executen on CHIP RAM, ; because copperlist requires it copperlist: dc.w $100,$0200 ; BPLCON0 - THE BITLANE CONTROL dc.w $180,$000 ; Color 0 - BLACK ;--- top blue dc.w $2b07,$FFFE ; line 43 dc.w $180,$00f ; Color 0 - BLUE dc.w $2c07,$FFFE ; TOP LIMIT dc.w $180,$000 ;--- generated in Movebar redbar: dc.w $aa07,$fffe ; wait start dc.w $180,$f00 ; COLOR00 red dc.w $ab07,$fffe ; wait stop dc.w $180,$000 ; COLOR00 black dc.w $ffdf,$fffe ; extra wait ;--- bottom blue dc.w $2c07,$FFFE ; Wait for last line dc.w $180,$00F ; Color 0 - BLUE dc.w $2d07,$FFFE ; BOTTOM LIMIT dc.w $180,$000 dc.w $FFFF,$FFFE ; END OF copperlist END |
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Tool to convert asm to gnu asm (gas) | Asman | Coders. Asm / Hardware | 13 | 30 December 2020 11:57 |
A newbie to the Amiga and ASM, what approach to take? | P-J | Coders. General | 19 | 18 September 2007 14:36 |
General asm question | Haakon | Coders. General | 14 | 15 February 2006 21:42 |
Some general newbie questions | Pixel | New to Emulation or Amiga scene | 10 | 14 March 2002 18:35 |
|
|