BRBOYER@MTUS5.CTS.MTU.EDU (Rucell) (05/09/91)
Hello. I am having a bit of trouble with this assembly code segment. What I am trying to do is this: Setup a UserItem Dialog with a List. I have got most of it working OK, but right in the middle of drawing the Dialog Items, it crashs just after the box is formed. I am not quite sure why. Can anybody see what could be wrong? Thanks much... ;------------------------------------------------------------------------------ InitLists MOVE.L GroupPtr(V),-(SP) ;Get DlogItem Info MOVE #MainGroup,-(SP) PEA ItemType(V) PEA ItemHndl(V) PEA Box(V) _GetDItem MOVE.L GroupPtr(V),-(SP) ;Set UserItem to draw MOVE #MainGroup,-(SP) ; Procedure MOVE ItemType(V),-(SP) PEA DrawGrpList PEA Box(V) _SetDItem PEA SizeRect(V) ;Calculate Initial CLR.L -(SP) ; Array MOVE #1,-(SP) CLR -(SP) _SetRect CLR.L -(SP) ;LNew up a new LIST PEA Box(V) PEA SizeRect(V) MOVE #16,-(SP) CLR -(SP) CLR -(SP) MOVE.L GroupPtr(V),-(SP) MOVE #True,-(SP) MOVE #False,-(SP) MOVE #False,-(SP) MOVE #True,-(SP) MOVE #68,-(SP) _Pack0 MOVE.L (SP)+,GroupListHndl(V) PEA Str1(V) ;Get String from Rsrc MOVE #128,-(SP) MOVE #5,-(SP) JSR GetIndString LEA Str1(V),A0 ;Put Str into List CLR D0 MOVE.B (A0)+,D0 MOVE.L A0,-(SP) MOVE D0,-(SP) CLR.L -(SP) MOVE.L GroupListHndl(V),-(SP) MOVE #88,-(SP) _Pack0 RTS DrawGrpList MOVE.L 6(SP),A3 ;Save Window Ptr MOVE 4(SP),D4 ;Save Dialog Item MOVE.L A3,-(SP) ;Get Box Size MOVE D4,-(SP) PEA ItemType(V) PEA ItemHndl(V) PEA Box(V) _GetDItem PEA Box(V) ;Draw Rectangle MOVE.L #-1,-(SP) _InsetRect PEA Box(V) _FrameRect MOVE.L visRgn(A3),-(SP) ;LUpdate MOVE.L GroupListHndl(V),-(SP) MOVE #100,-(SP) _Pack0 MOVE.L (SP)+,A0 ;Return ADD.L #6,SP JMP (A0) ;------------------------------------------------------------------------------ Bradley R. Boyer ##### # # ### BRBOYER@mtus5.cts.mtu.edu # # # # # BRBOYER%MTUS5.BITNET |"How could it have | # # ### ##### | been me? I wasn't| # # # # # Phi Kappa Theta - Michigan Chi Rho | even there!" | ##### # # ### Michigan Technological University ------ Posted using NetFeed, THE Macintosh <====> UseNet Interface Program ----
mandel@vax.anes.tulane.edu (Jeff E Mandel MD MS) (05/11/91)
In article <050991.121525BRBOYER@MTUS5.CTS.MTU.EDU>, BRBOYER@MTUS5.CTS.MTU.EDU (Rucell) writes: > > Hello. I am having a bit of trouble with this assembly code segment. What >I am trying to do is this: Setup a UserItem Dialog with a List. I have got >most of it working OK, but right in the middle of drawing the Dialog Items, it >crashs just after the box is formed. I am not quite sure why. Can anybody >see what could be wrong? Thanks much... > Here is a carved up assembly language program that does something close to what you want. It is written with the MPW structured assembly macros, so it may be difficult for you to follow, but hey, it's free. (BinHex-Stuffit, delete the signature at the end) (This file must be converted with BinHex 4.0) :#QaTFh4NCbjcDA3!8dP8)90*9#%!!!!!"c3!!!!!"*K6593K!!%!!!FdFNaKG3' q!!!!&J!!!J))E'PcG%4R,Q&'D@aP)'C[FL""GA4[)%0KFf0KC'PZC`!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!9%9B9%e38b!!!+431eHN8$jb!!!"IJ! !#1)!!!%D!!!&P#(rZ&S!!!!!!!!bE!!!"!JSN!!*3B-"CF`*FkB-#$CTjY!"8@G 1'6NJdY!TdqC%J`3J%``*Bc%N!SJ5LCaa%DD&!)*8LQ#KdJ6+&"!%FqU-1E2Q6Ce !J`)P"@A(PB!)a!8-i%G1R6&0`SbCii+-aj!!#D")5H+%5XJR6Mk'&!Xb5FdR8Vb #E$,R$*1)G+V!)40Q)`J@)1$)5I0Q,jdm56DfJ5,RcCJ'C"0-+A)%kiNQCHBXE(K eE"%mF2V5b9Ti6"NbGH5853"C-X-bE`NL!8$kM4ZTE`!`!N""YJ!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leans, LA mandel@vax.anes.tulane.edu
kurash@chocorua (Mark Valence) (05/11/91)
In article <050991.121525BRBOYER@MTUS5.CTS.MTU.EDU> BRBOYER@MTUS5.CTS.MTU.EDU (Rucell) writes: > > Hello. I am having a bit of trouble with this assembly code segment. What >I am trying to do is this: Setup a UserItem Dialog with a List. I have got >most of it working OK, but right in the middle of drawing the Dialog Items, it >crashs just after the box is formed. I am not quite sure why. Can anybody >see what could be wrong? Thanks much... > >;------------------------------------------------------------------------------ > > InitLists > Looks OK up to here, I assume you have equated 'V' to A5 or some similar global variable pointer. If not, then it must be equated to A6 or some other register you are using for a Frame Pointer, and you have left out the LINK or SUBA.L instructions for simplicity and to confuse me. This next routine causes the problem, if what you have posted is the entire routine: > DrawGrpList > MOVE.L 6(SP),A3 ;Save Window Ptr > MOVE 4(SP),D4 ;Save Dialog Item > AAAAAAHHHH!!!! You must save registers D3-D7, A2-A4, and A5-A6 if you plan on using them in this routine. A simple 'MOVEM.L D4/A3, -(SP)' as the first instruction, and then 'MOVEM.L (SP)+, D4/A3' before you pop the return address into A0 will probably solve the problem. > [code removed] > > MOVE.L (SP)+,A0 ;Return > ADD.L #6,SP > JMP (A0) > If you have left the MOVEM's out for simplicity, then you might try doing a _GetPort, _SetPort, _SetPort dance to be really retentive: MOVEM.L usedRegs, -(SP) [grab the dialog pointer] SUBQ.L #4, SP MOVE.L SP, -(SP) _GetPort MOVE.L A3, -(SP) _SetPort [do stuff with the user item] _SetPort ;old port was left on the stack MOVEM.L (SP)+, usedRegs This is rather retentive for the case of lists (the list manager does this same thing inside of the _LUpdate routine), but if you want to draw anything else, you might want to do this. Maybe the dialog manager does it too, I can't remember. Yes, in fact I'm pretty sure it does do this, so doing it again is kind of a waste. However, if you do save your registers, and it still craps out, try the above, it's all I can think of that might be a problem (other than the register trashing). > > Bradley R. Boyer ##### # # ### BRBOYER@mtus5.cts.mtu.edu > # # # # # BRBOYER%MTUS5.BITNET > |"How could it have | # # ### ##### > | been me? I wasn't| # # # # # Phi Kappa Theta - Michigan Chi Rho > | even there!" | ##### # # ### Michigan Technological University Well, neither was I. Mark.