Path: utzoo!attcan!uunet!comp.vuw.ac.nz!canterbury!chem194 From: chem194@canterbury (John Davis, programmer at large, chemistry department) Newsgroups: comp.sys.amiga.tech Subject: Re: Assembly question from turnip Message-ID: <1990Oct28.122346.9544@canterbury> Date: 27 Oct 90 23:23:46 GMT References: <2728cc8d-a00comp.sys.amiga.tech@tronsbox.xei.com> <15433@cbmvax.commodore.com> Organization: University of Canterbury Lines: 43 In article <15433@cbmvax.commodore.com>, valentin@cbmvax.commodore.com (Valentin Pepelea) writes: > In article <2728cc8d-a00comp.sys.amiga.tech@tronsbox.xei.com> > dfrancis@tronsbox.xei.com (Dennis Francis Heffernan) writes: >> >> Well, I've hit a good one. I've finally gotten around to trying to l >>learn assembly on this beast, and my first program crashes. >> >>getvarmem move #4,a6 ;get memory for variables >> move.b #60,D0 >> move.l #0,D1 >> jsr _LVOAllocMem(A6) > The first problem is with the first instruction. What is the data width of > that instruction? What data width does your assembler default to? Replace > that instruction with "move.l #4,a6". > > The second problem is with the test for the return value. Hey, wait a minute, > you are not testing for the return value at all! Here is what you should do: It's a lot simpler than that, and I'm amazed no-one picked it up!!! move #4,a6 should be move 4,a6 the poor guy's moving the literal value 4 to a6, instead of the contents of location 4 ( execbase pointer ). No wonder things fall over in a large, screaming heap! the comment about size is valid, you should declare the size as .l, though most assemblers will default to .l if you don't specify one. Also checking the return values would be a good idea .... ----------------------------------------------------------- | o John Davis - CHEM194@canterbury.ac.nz o | | o (Depart)mental Programmer,Chemistry Department o | | o University of Canterbury, Christchurch, New Zealand o | | o o | | o co-sysop AmigaINFO BBS,1200/2400 baud CCITT, o | | o 24 hours a day, ph NZ +3-3371-531 o | ze, a good asem will