Article View: comp.sys.amiga.tech
Article #6121Re: Assembly question from turnip
From: Greg Miller
Date: Sat, 27 Oct 1990 17:01
Date: Sat, 27 Oct 1990 17:01
57 lines
2740 bytes
2740 bytes
>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)
>> bne 1$
>> jmp giveup ;didn't get 60 bytes? SHEESH!
>>1$ move.l D0,vars ;stash the address for variables
>
>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".
Wait-a-sec!
He certainly doesn't want to do that!
Try:
move.l 4,a6
Or for those of us who have this strange preference for descriptive labels:
move.l _AbsExecBase,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:
>
> jsr _LVOAllocMem(a6) ; Try to allocate memory
> tst.l d0 ; Is the return value zero?
> beq giveup ; Branch if so
> move.l d0,vars ; Stash the address
>
>Valentin
>--
>The Goddess of democracy? "The tyrants Name: Valentin Pepelea
>may destroy a statue, but they cannot Phone: (215) 431-9327
>kill a god." UseNet: cbmvax!valentin@uunet.uu.net
> - Ancient Chinese Proverb Claimer: I not Commodore spokesman be
--
+----------------------------------------------------------------+
| A sign of mismanagement, over- | Greg Miller |
| complication and overall idiocy: | ..ames!sharkey!ionic!gm |
| | gm@ionic.uucp |
| | |
| "Designed By Committee" | |
+----------------------------------------------------------------+
Technical Details
Message-ID:
<gm.3476@ionic.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!dino!sharkey!ionic!gmReferences:
<2728cc8d-a00comp.sys.amiga.tech@tronsbox.xei.com> <15433@cbmvax.commodore.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!dino!sharkey!ionic!gm From: gm@ionic.UUCP (Greg Miller) Newsgroups: comp.sys.amiga.tech Subject: Re: Assembly question from turnip Message-ID: <gm.3476@ionic.UUCP> Date: 27 Oct 90 17:01:12 GMT References: <2728cc8d-a00comp.sys.amiga.tech@tronsbox.xei.com> <15433@cbmvax.commodore.com> Lines: 57