home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / amiga / programm / 13076 < prev    next >
Encoding:
Text File  |  1992-09-03  |  2.6 KB  |  84 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!usenet.coe.montana.edu!nntp.uoregon.edu!cie.uoregon.edu!jlavin
  3. From: jlavin@cie.uoregon.edu (Jeff Lavin)
  4. Subject: Re: Assembly questions.
  5. Message-ID: <1992Sep4.070415.15104@nntp.uoregon.edu>
  6. Sender: news@nntp.uoregon.edu
  7. Organization: The Puzzle Factory
  8. References: <1802@grivel.une.edu.au>
  9. Date: Fri, 4 Sep 92 07:04:15 GMT
  10. Lines: 72
  11.  
  12. In article <1802@grivel.une.edu.au> cfiddyme@neumann.une.edu.au (Chris Fiddyment) writes:
  13. >
  14. >  Hi,
  15. >  I have a few (hopefully simple) questions to ask. I am new to assembler and
  16. >  can't afford a book yet (besides a borrowed copy of the RKM's).
  17. >
  18. >  First I am using the commands
  19. >  
  20. >      move.l  #186,d0
  21. >      divu    #10,d0
  22. >      moveq.l #0,d1
  23. >      move.b  d0,d1
  24. >
  25. >  to get d1 = 18. How canI get the remainder of the division (the upper part
  26. >  of d0) into register d2. Is there some way to shift the register?
  27. >
  28. >  Another question. I have written a program that opens a screen and moves a 
  29. >  sprite around. How do I print images to the screen. I tried the following :
  30. >
  31. >      move.l  intbase,a6
  32. >      move.l  rastport,a1        ; these could be back to front.
  33. >      lea     blockimage,a0
  34. >      move.l  #10,d0
  35. >      move.l  #10,d1
  36. >      jsr    -114(a6)     ;DrawImage()
  37. >
  38. >with the following variables:
  39. >
  40. >   blockimage
  41. >      dc.w 0,0,15,10,2       ; Is this the correct format. It seems right from
  42. >      dc.l myimage           ; looking in the RKM's
  43. >      dc.b 0,0
  44. >      dc.l 0
  45. >
  46. >   myimage
  47. >     dc.w  %0000000000000000,%0000000000000000
  48. >     ;10 lines of image data
  49. >     dc.w  %0000000000000000,%0000000000000000
  50. >
  51. >When the program is run the image is not drawn, the sprite dissapears from the
  52. >screen but the sprite handling routines still work.
  53. >What am I doing wrong??
  54. >When I get some money what is a book on assembler to get?
  55. >
  56. >   Thanks, Chris.
  57. >
  58. >* Chris Fiddyment.             |   I never promised anybody *
  59. >* cfiddyme@neumann.une.edu.au  |   anything.   Kermit.      *
  60.  
  61. Well, for starters use:
  62.  
  63.        swap    d0
  64.  
  65. this instruction swaps the 2 16 bit halves of a 32 bit register, so:
  66.  
  67. Before:  D0 = $12345678
  68. After:   D0 = $56781234
  69.  
  70. BTW, the mnemonic 'moveq' is implicitly LONG, so the '.l' is superfluous.
  71.  
  72. As to the graphics -- the actual image data (myimage) needs to be in chip
  73. memory.  In assembler this is done:
  74.  
  75.        SECTION MyImages,DATA,CHIP
  76.  
  77. Don't know about C.
  78.  
  79. -- 
  80. The Puzzle Factory, Inc.  | Jeff Lavin -- jlavin@cie.uoregon.edu
  81. Veneta, Oregon            |-------------------------------------
  82. Voice : (503) 935-3709    | Remainder of signature line
  83. Data  : (503) 935-7883    | under construction.
  84.