English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 16 March 2013, 18:19   #1
Vikke
Registered User
 
Join Date: Feb 2013
Location: Lovisa / Finland
Age: 53
Posts: 80
2nd tutorial on ASM- and HW-coding

Thank you all for the great feedback regarding the first tutorial, here comes the next one.

Link: Vikke.net

This time it is a tutorial on doing horizontal shifting. Horizontal shifting is used for scrollers, but also as an effect in demos. You will probably recognize the effect once you see it.

If you have any questions about the code, just ask. I will try to explain everything as detailed as possible, but that isn't possible on the website.

The next codesnippet is already planned, and is yet another Copper-thingy, something very popular back in the day. Can you tell I really like the Copper?

And one more thing, I'm really sorry for the bad graphics. I wasn't this bad at doing graphics when only using an Amiga, but now making the graphics first in Photoshop and then converting to IFF isn't the best method.
Vikke is offline  
Old 16 March 2013, 19:31   #2
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
What is the order of precedence on the following:

move.w #384/8*200/4,d0

i'm guessing

384/8
48*200
9600/4
=2400
BippyM is offline  
Old 16 March 2013, 19:37   #3
Vikke
Registered User
 
Join Date: Feb 2013
Location: Lovisa / Finland
Age: 53
Posts: 80
Quote:
Originally Posted by bippym View Post
What is the order of precedence on the following:

move.w #384/8*200/4,d0

i'm guessing

384/8
48*200
9600/4
=2400
Yes, you're right.

Just to comment on why the values are what they are:

384px wide / 8 = 48 bytes per line

48 bytes/line * 200 lines = 9600 bytes total

9600 bytes / 4 bytes/longword = 2400 longwords (each 64 bits).

I chose to put the multiplications and divisions visible to be able to get a grasp on how the values are made (and it isn't any slower as the assembler calculates them at compile-stage anyhow).
Vikke is offline  
Old 16 March 2013, 19:38   #4
WayneK
Registered User
 
Join Date: May 2004
Location: Somewhere secret
Age: 50
Posts: 364
In this case it doesn't matter, but it's: (384/8) * (200/4).
WayneK is offline  
Old 16 March 2013, 19:40   #5
Vikke
Registered User
 
Join Date: Feb 2013
Location: Lovisa / Finland
Age: 53
Posts: 80
Quote:
Originally Posted by WayneK View Post
In this case it doesn't matter, but it's: (384/8) * (200/4).
You are also right, it can be put together in different forms, but in my previous post I explained the reasoning behind the "formula".
Vikke is offline  
Old 16 March 2013, 22:03   #6
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
why is it /8?
BippyM is offline  
Old 16 March 2013, 22:49   #7
Vikke
Registered User
 
Join Date: Feb 2013
Location: Lovisa / Finland
Age: 53
Posts: 80
Quote:
Originally Posted by bippym View Post
why is it /8?
320px equals 320 bits, to get that value to be in bytes we have to divide it by 8 (8 bits equals 1 byte).

With memory access the smallest possible alignment is one byte. The MC68k can address memory by alignments of bytes (8 bits), words (16 bits / 2 bytes) or longwords (32 bits / 4 bytes).
Vikke is offline  
Old 16 March 2013, 22:51   #8
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Quote:
Originally Posted by bippym View Post
why is it /8?
From what Vikke states below the screen is 384 pixels wide. A byte can only store the status of 8 pixels (8 bits in a byte, each representing a pixels status on one bitplane). Thus to get the number of bytes per line, for a one bitplane image/screen, you do:

width in pixels / 8 = number of bytes per line


Edit: Just beaten by Vikke
Lonewolf10 is offline  
Old 16 March 2013, 23:43   #9
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Re: 2nd tutorial on ASM- and HW-coding

I thought as much. I'm in the process of my first asm program to display a picture. Thought about using the copper to set all registers etc and then call the copper to show picture
BippyM is offline  
Old 17 March 2013, 07:52   #10
Vikke
Registered User
 
Join Date: Feb 2013
Location: Lovisa / Finland
Age: 53
Posts: 80
Quote:
Originally Posted by bippym View Post
I thought as much. I'm in the process of my first asm program to display a picture. Thought about using the copper to set all registers etc and then call the copper to show picture

That is a good place to start coding on an Amiga. Do you have the image in RAW format? I use IFFMaster to convert from IFF to RAW. Probably all graphics programs on the Amiga can save images in IFF, on windows Photoshop can do it and also Grafx2 (of these Grafx2 is way better as you can make the palette have the right amount of colors and in the correct order).
Vikke is offline  
Old 17 March 2013, 11:49   #11
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
I have not created a gfx yet. I have written some code, but am spending more time analysing each bit of code.

I've also got notepad++ looking a lot better and working more accurately with highlighting.
BippyM is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
4th tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 11 10 April 2013 20:32
3rd tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 6 26 March 2013 15:57
First tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 46 18 March 2013 12:33
REQ: AF 115 (C Coding Tutorial) quenthal AMR suggestions and feedback 2 23 July 2007 14:08
Help coding alexh Coders. General 14 15 August 2006 09:24

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:10.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08636 seconds with 13 queries