A.D.A. Amiga Demoscene Archive

        Welcome guest!

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / Adding an OS Legal VB Interrupt to server chain

 

Author Message
bodhi
Member
#1 - Posted: 11 Jul 2013 00:38 - Edited
Reply Quote
Hi everyone!

I'm trying to add my own "OS legal" vertical blank handler to the AmigaOS server chain but I'm not having much success. So I thought maybe someone here might be able to help.

I know that there's already this useful thread which describes low level interrupts. However, even though I'm running the code on a classic AGA machine, I'm trying to install an OS legal interrupt so the situation is different.

I think there's probably a problem with the way I'm initializing my server, so I paste here just the stuff that I think might be wrong - hopefully it is enough information:

;################################################         ####
;# MAIN
;################################################# ###
_main
jsr StartUp
jsr Rasterize
jsr Convert2Cop
move.l #CopList0,COP1LC+_custom ; load address of new copper into cop control reg
jsr StartInterrupt ; <--- here's where the problems start
.loop

.skip
btst #6,$bfe001 ; mouse press loop
bne.s .loop

jsr CloseDown
rts
;################################################# ###
;# SUB ROUTINES
;################################################# ###

StartInterrupt
; initialize vertical blank Interrupt server structure
move.l #MyIS,a0
move.b #NT_INTERRUPT,LN_TYPE(a0)
move.b #100,LN_PRI(a0)
move.l #VBIntName,LN_NAME(a0)
move.l #counter,IS_DATA(a0)
move.l #VBCounter,IS_CODE(a0)

move.l 4.w,a6
move.b #INTB_VERTB,d0 ; type is VERTB interrupt
move.l #MyIS,a1
jsr _LVOAddIntServer(a6)
rts

VBCounter:

; ----> DO VB STUFF HERE <----

move.l #_custom,a0 ; 10+ priority vertb servers expect custom base address in a0 on exit
move.l #0,d0 ; set Z flag so that next VB server in chain is executed. Clear Z flag to terminate chain
rts

;################################################# ###
;# DATA
;################################################# ###

MyIS ds.b IS_SIZE
cnop 0,2
VBIntName dc.b "My-VB-Interrupt",0


If I comment out jsr _LVOAddIntServer(a6) I get no crash. If I leave it in, I get a fatal crash and reset.

I couldn't find any example code for this, so I'm basing my attempt directly from the RKMs. Also, I'm new to both ASM and AmigaOS, so please forgive me if I'm making obvious mistakes and doing it completely wrong - which is highly likely! :)
bodhi
Member
#2 - Posted: 11 Jul 2013 03:03
Reply Quote
ok, someone over at eab has just kindly pointed out my noobish error. AddIntServer(a6) interprets the whole longword of D0. so changing

move.b	#INTB_VERTB,d0


to

move.l	#INTB_VERTB,d0


...fixed it.

Yep, I know....sorry.

 

  Please log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0