English Amiga Board


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

 
 
Thread Tools
Old 07 May 2019, 06:47   #1
turrican3
Moon 1969 = amiga 1985
 
turrican3's Avatar
 
Join Date: Apr 2007
Location: belgium
Age: 48
Posts: 3,913
help learning asm, needed ??

Could someone give a little test to do in asm, i mean a little code to make this or that, something easy with some explanations.
I mean really easy, for exemple how to write a tiny txt on screen.
Or something else, something which could help a totaly noob to understand ASM. I know there is books, i have books about ASM but it's not enough for me.

It could help me and others to begin to understand how works ASM.
If someone is ok to give it a try ???


ps: There is so much users who would like to product new stuffs for the amiga but need a little help to start. Please help
turrican3 is offline  
Old 07 May 2019, 07:34   #2
britelite
Registered User
 
Join Date: Feb 2010
Location: Espoo / Finland
Posts: 820
Quote:
Originally Posted by turrican3 View Post
I know there is books, i have books about ASM but it's not enough for me.
In all honesty, if the books don't help, then pieces of code won't help either.

Quote:
It could help me and others to begin to understand how works ASM.
You could try having a look at Photon's Amiga coding tutorials at http://coppershade.org/
britelite is offline  
Old 07 May 2019, 07:43   #3
jPV
Registered User
 
jPV's Avatar
 
Join Date: Feb 2008
Location: RNO
Posts: 1,007
Here's another article that came in my mind: https://www.reaktor.com/blog/crash-c...y-programming/
jPV is offline  
Old 07 May 2019, 10:52   #4
Hewitson
Registered User
 
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,773
Writing text on the screen is not so simple on the Amiga! Maybe try writing some simple copperlists, opening/closing libraries, etc.
Hewitson is offline  
Old 07 May 2019, 11:45   #5
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,436
Quote:
Originally Posted by Hewitson View Post
Writing text on the screen is not so simple on the Amiga! Maybe try writing some simple copperlists, opening/closing libraries, etc.
Yup, I'd recommend starting with something else. The only easy way to draw text is using the OS.

Quote:
Originally Posted by turrican3 View Post
Could someone give a little test to do in asm, i mean a little code to make this or that, something easy with some explanations.
I mean really easy, for exemple how to write a tiny txt on screen.
Or something else, something which could help a totaly noob to understand ASM. I know there is books, i have books about ASM but it's not enough for me.

It could help me and others to begin to understand how works ASM.
If someone is ok to give it a try ???


ps: There is so much users who would like to product new stuffs for the amiga but need a little help to start. Please help
In general, I'd recommend first figuring out why you want to learn assembly (to write games/demos? to accelerate parts of programs in other languages? because you just really want to know what makes the Amiga tick?).

Once you do that, look at your current level of knowledge of programming. If you're an absolute beginner, assembly is not a great place to start and you might want to get some experience in other languages (particularly, try to do some C at one point) first to get to understand the basics.

When beginning, there are (IMHO!) two routes: focus on the 68000 first, focus on the Amiga hardware first. Choose one based on your level of knowledge and the 'why' you want to do this.

The former means mostly mucking about under the OS trying out how to build algorithms in assembly, what works and what doesn't and getting to know how the processor addressing modes all work. The latter means poking around in the custom chip set and lots of reading/trying stuff based on the HRM and learning 68000 coding as and when you need it for accessing the hardware.

Both have their pro's and con's. Both take quite a bit of time.

Good luck
roondar is offline  
Old 07 May 2019, 22:14   #6
redblade
Zone Friend
 
redblade's Avatar
 
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,127
turrican3: There are some tutorials on flashtro.com website which sets up the screen and writes text. The tutorials hit the hardware directly.

On Aminet.net in /dev/asm there is a Amiga assembler tutorial by a belgian called cool-g (In English tho.)

http://aminet.net/dev/asm/AsmCourseSrc1.lha and http://aminet.net/dev/asm/Asm_course.lha

Hope they help.
redblade is offline  
Old 07 May 2019, 22:57   #7
DofD
Registered User
 
Join Date: Jun 2018
Location: Victoria, Canada
Age: 56
Posts: 134
Way, way back when I started assembly, a book I found good as a starting point to try to understand the basics of assembly on the 68000 series is Assembly Language Programming for the 68000 by Thomas Skinner. It includes examples for the Amiga.
DofD is offline  
Old 08 May 2019, 15:55   #8
robsoft
Registered User
 
robsoft's Avatar
 
Join Date: May 2018
Location: Chester, UK
Posts: 15
If you're wanting to get text onto the screen just as a means of helping you learn assembler, then it's easy to get text back out to the console from which you launched your program - you can do that in a handful of lines of code.

If you want to set-up a screen of your own choosing (resolution, palette etc) and *draw* text to it, that's a different matter.

I think you need to decide what you specifically want to do to begin with, break it down as much as possible and then review what individual things you're going to need to learn in order to do it. I'm partway through this process myself, I've got ANSI text in a console and simple bleeps out of Paula, my next steps are to take over the screen and draw some bitmap data.

The advice above about concentrating on either the 68k or the hardware is quite good I think - I thought I could treat it all as one but quickly realised that I wasn't really understanding the examples (mind you, I'm getting old so it's taking longer than it might have done a decade ago).
So I accepted there was no 'quick route', and started learning more about the basic 68k stuff, as opposed to the Amiga hardware. And now I have a very rudimentary grasp of basic 68k stuff, the hardware examples are making a bit more sense.

Just my experience with it, anyway.
robsoft is offline  
Old 08 May 2019, 16:49   #9
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,488
Do you want to write something on the Amiga screen?
Excellent, why not use asm code that call BCPL environment?

Take this message as a joke, but in effect the TRIPOS/BCPL legacy framework is still here and works flawlessy...


Code:
;	BCPL initial environment
;	a1 - base of the current BCPL stack frame
;	a2 - pointer to the BCPL Global Vector
;	a3 - return address of the caller
;	a4 - entry address
;	a5 - pointer to a "caller" service routine
;	a6 - pointer to a "returner" service routine

	lea	(stxt,pc),a0
	moveq	#32,d0			;amount of global area
	move.l	a0,d1			;&buf
	moveq	#etxt-stxt,d2		;length
	movea.l	($AC,a2),a4		;entry [$AC=writeoutput(d1,d2)]
	jsr	(a5)			;"caller" service routine
	moveq	#0,d0			;DOS return code
	rts

stxt	dc.b	"Hello, world :)",$0a
etxt
72 bytes executable attached (well, actually half is by header )
Attached Files
File Type: 68k hello_world.68k (72 Bytes, 105 views)
ross is offline  
Old 08 May 2019, 17:20   #10
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 720
Quote:
Originally Posted by ross View Post
Do you want to write something on the Amiga screen?
Excellent, why not use asm code that call BCPL environment?

Take this message as a joke, but in effect the TRIPOS/BCPL legacy framework is still here and works flawlessy...


Code:
;	BCPL initial environment
;	a1 - base of the current BCPL stack frame
;	a2 - pointer to the BCPL Global Vector
;	a3 - return address of the caller
;	a4 - entry address
;	a5 - pointer to a "caller" service routine
;	a6 - pointer to a "returner" service routine

	lea	(stxt,pc),a0
	moveq	#32,d0			;amount of global area
	move.l	a0,d1			;&buf
	moveq	#etxt-stxt,d2		;length
	movea.l	($AC,a2),a4		;entry [$AC=writeoutput(d1,d2)]
	jsr	(a5)			;"caller" service routine
	moveq	#0,d0			;DOS return code
	rts

stxt	dc.b	"Hello, world :)",$0a
etxt
72 bytes executable attached (well, actually half is by header )
Cool! But what's the meaning of 32 'global area'? And is it bytes or long-words?
alkis is offline  
Old 08 May 2019, 18:04   #11
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,488
Quote:
Originally Posted by alkis View Post
Cool! But what's the meaning of 32 'global area'? And is it bytes or long-words?
It's an area (defined in bytes but, as usual with BCPL, need to be [mod 4 = 0]) where every BCPL function save some 68k registers (internal BCPL stack is 'reversed'..).
Probably in some VERY old document (or a KS resource) you can find what's the minimum usable for every internal call.
I've simply used a conservative value.

service init in KS1.3 is:
Code:
;  a1 - base of the current BCPL stack frame
   MOVEM.L A1/A3-A4,(-$C,A1,D0.L)
So seems that only 12 bytes from the 32 requested are used here.
Certainly therefore a low limit under which not to go.

Then the frame is advanced:
 ADDA.L D0,A1

and after a 'standard' push of registers on stack:
 MOVEM.L D1-D4,(A1)


Further on:
Code:
  MOVEQ #$20,D0
  MOVEA.L ($108,A2),A4
  JSR (A5)
So also BCPL routines that call itself use a default value of 32 bytes.
I simply noticed this and used (anyway you can find this value in old BCPL programs before writeoutput usage).

A long time ago I checked out what the various calls were doing (the documentation is poor and in theory the direct use of the framework is deprecated, but maintained for compatibility in every KS).

You may wonder why I had done such a thing .. well, there was a reason, but this is another story

Last edited by ross; 08 May 2019 at 18:51. Reason: added some comments
ross is offline  
Old 08 May 2019, 18:59   #12
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 720
Quote:
Originally Posted by ross View Post
It's an area (defined in bytes but, as usual with BCPL, need to be [mod 4 = 0]) where every BCPL function save some 68k registers (internal BCPL stack is 'reversed'..).
Probably in some VERY old document (or a KS resource) you can find what's the minimum usable for every internal call.
I've simply used a conservative value.

service init in KS1.3 is:
Code:
;  a1 - base of the current BCPL stack frame
   MOVEM.L A1/A3-A4,(-$C,A1,D0.L)
So seems that only 12 bytes from the 32 requested are used here.
Certainly therefore a low limit under which not to go.

Then the frame is advanced:
 ADDA.L D0,A1

and after a 'standard' push of registers on stack:
 MOVEM.L D1-D4,(A1)


Further on:
Code:
  MOVEQ #$20,D0
  MOVEA.L ($108,A2),A4
  JSR (A5)
So also BCPL routines that call itself use a default value of 32 bytes.
I simply noticed this and used (anyway you can find this value in old BCPL programs before writeoutput usage).

A long time ago I checked out what the various calls were doing (the documentation is poor and in theory the direct use of the framework is deprecated, but maintained for compatibility in every KS).

You may wonder why I had done such a thing .. well, there was a reason, but this is another story
Thank you very much for the explanation
alkis is offline  
Old 08 May 2019, 19:27   #13
nogginthenog
Amigan
 
Join Date: Feb 2012
Location: London
Posts: 1,316
Quote:
Originally Posted by DofD View Post
Way, way back when I started assembly, a book I found good as a starting point to try to understand the basics of assembly on the 68000 series is Assembly Language Programming for the 68000 by Thomas Skinner. It includes examples for the Amiga.
Mine was 68008 assembly for the Sinclair QL. I didn't have a QL but my library had this book. That and a hardware guide (not the official one) and a copy of Devpac was all I needed.
nogginthenog is offline  
Old 08 May 2019, 21:00   #14
flype
Registered User
 
Join Date: Dec 2014
Location: France
Posts: 104
Maybe this might be of some help :

https://m68kdev.blogspot.com/2016/05...icated-to.html
flype is offline  
Old 09 May 2019, 03:20   #15
LongLifeA1200
Registered User
 
LongLifeA1200's Avatar
 
Join Date: Nov 2017
Location: Amiga Kingdom
Posts: 368
turrican3, the "shortcut" you are looking for is a longways from being finished (currently in development, but well worth the wait I would argue). That only leaves you with the slow and laborious method at the moment.

1. Asm One 1.02 Manual (OR) Dev Pac V3.00 Manual
2. Amiga Machine Language by Stefan Dittrich (OR) Amiga Machine Language Programming Guide by Daniel Wolf & Leavitt Douglas
3. Amiga Hardware Reference Manual
(OR) = Take your pick, doesn't really matter at this point.

What was said in the first reply is spot-on.

Quote:
Originally Posted by britelite View Post
In all honesty, if the books don't help, then pieces of code won't help either.
LongLifeA1200 is offline  
Old 09 May 2019, 15:05   #16
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,537
Quote:
Originally Posted by LongLifeA1200 View Post
Wow! That's the book I got the day after I bought my A1000 in 1987 and started hacking it. Didn't know that there was an english translation of "Amiga Maschinensprache" from Data Becker.

Today I cannot recommend it, because of really bad code and assemblers (K-SEKA!) used in it. My first programs looked like in the book and stopped working after my A1000 got Fast-RAM.
phx is offline  
Old 09 May 2019, 15:32   #17
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,995
Quote:
Originally Posted by phx View Post
Wow! That's the book I got the day after I bought my A1000 in 1987 and started hacking it. Didn't know that there was an english translation of "Amiga Maschinensprache" from Data Becker.

Today I cannot recommend it, because of really bad code and assemblers (K-SEKA!) used in it. My first programs looked like in the book and stopped working after my A1000 got Fast-RAM.
But it looks like that today you are not too bad in coding, so would say that you got good bases from this book .


Which book would you recommend to OP then ?
malko is offline  
Old 09 May 2019, 17:22   #18
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,537
All books are obsolete. Photon's Youtube tutorials are quite good, or maybe some other recent tutorial on the net, which was mentioned here. But don't start with the mistakes from 30 years ago. I doubt the OP wants to spend a few decades to learn it, like we did...
phx is offline  
Old 10 May 2019, 00:04   #19
turrican3
Moon 1969 = amiga 1985
 
turrican3's Avatar
 
Join Date: Apr 2007
Location: belgium
Age: 48
Posts: 3,913
What i would like to do with asm ?? Simple :
Help jotd to make some cd32 slaves to make cd32 cdda games.
Making some demos, a game if possible.
I don't want to code on pc, the only computer i want to code is the amiga.
ASM is a dream, this is the magical coding on the amiga.
I would like to give back something to the amiga community, and coding something is the best way to do it. (i have no money. ;-)
I will have a look to all the books and stuffs you showed me.
If you have anything more to help me, you are welcome.
turrican3 is offline  
Old 10 May 2019, 17:50   #20
Ami
Registered User
 
Ami's Avatar
 
Join Date: Sep 2014
Location: Poland
Posts: 175
I've read dozens of asm books but I learned nothing, until I've read this -> http://chaozer.ikod.se/asmtut.shtml. But this is only step 1, you need step 2, so I would recommend one of the suggestions above, especially look for something which teach you asm+os coding. Good luck!
Ami 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
Tool to convert asm to gnu asm (gas) Asman Coders. Asm / Hardware 13 30 December 2020 11:57
Learning C nobody Coders. C/C++ 28 15 June 2016 08:07
I need help with my intro... I´m learning... Skillion76 Coders. General 10 27 September 2014 17:36
Wanting to start learning to code amiga in asm fishyfish Coders. Asm / Hardware 5 03 March 2012 06:11
Help needed!!Random octal numbers generator(asm) sheryn88 Coders. General 6 01 August 2010 07:19

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 17:58.

Top

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