home *** CD-ROM | disk | FTP | other *** search
- Nntp-Posting-Host: hnoss.ifi.uio.no
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!sunic!aun.uninett.no!nuug!ifi.uio.no!larsel
- From: larsel@ifi.uio.no (Lars Yngvar Ellingsen)
- Subject: HELP: Inline assembly in Think C
- Message-ID: <1992Nov19.014824.4747@ifi.uio.no>
- Keywords: assembly
- Sender: larsel@ifi.uio.no (Lars Yngvar Ellingsen)
- Organization: Dept. of Informatics, University of Oslo, Norway
- References: <BxxJ6A.KHw@mentor.cc.purdue.edu>
- Date: Thu, 19 Nov 1992 01:48:24 GMT
- Lines: 39
- Originator: larsel@hnoss.ifi.uio.no
-
-
- Yes, I know it sounds stupid, but I'm writing a flight simulator. In this
- flightsim I need some quick drawing routines. I had a friend write a small
- assembly routine on the amiga, but I have trouble with porting it to
- think C 5.0.2's inline assembler. Here is a (very) brushed up version of the
- code:
- (The routine is supposed to write a row of pixels from position x,y with
- one specific value on the screen in 8-bits color.)
- (I'm extremely inexperienced with both C and asm so forgive my stupid
- blunders :)
-
- main()
- {
- GDHandle theDevice;
- unsigned char *color;
- long *address;
- short x,y,*width;
- unsigned int color;
-
- theDevice = GetMainDevice();
-
- // do stuff; assign values to x, y, color and width
-
- &address = &(*(**(**theDevice).gdPMap).baseAddr)+
- (long)y*SCREENWIDTH+(long)x;
- asm {
- @Main: move.b color,d1
- move.w width,d2
- movea.l address,a1
- @Loop: move.b d1,(a1)+
- dbra d2,@Loop
- rts
- }
- }
-
- What am I doing wrong?
-
- Yours sincerly,
- Lars // larsel@ifi.uio.no
-