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
Can you give me some help to show the red bar reaching the bottom part of the screen (touch the green bar)?
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