English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. Asm / Hardware (https://eab.abime.net/forumdisplay.php?f=112)
-   -   help learning asm, needed ?? (https://eab.abime.net/showthread.php?t=97292)

turrican3 07 May 2019 06:47

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 :help

britelite 07 May 2019 07:34

Quote:

Originally Posted by turrican3 (Post 1319871)
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/

jPV 07 May 2019 07:43

Here's another article that came in my mind: https://www.reaktor.com/blog/crash-c...y-programming/

Hewitson 07 May 2019 10:52

Writing text on the screen is not so simple on the Amiga! Maybe try writing some simple copperlists, opening/closing libraries, etc.

roondar 07 May 2019 11:45

Quote:

Originally Posted by Hewitson (Post 1319901)
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 (Post 1319871)
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 :)

redblade 07 May 2019 22:14

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.

DofD 07 May 2019 22:57

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.

robsoft 08 May 2019 15:55

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.

ross 08 May 2019 16:49

1 Attachment(s)
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 :))

alkis 08 May 2019 17:20

Quote:

Originally Posted by ross (Post 1320158)
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?

ross 08 May 2019 18:04

Quote:

Originally Posted by alkis (Post 1320163)
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' :shocked 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 :)

alkis 08 May 2019 18:59

Quote:

Originally Posted by ross (Post 1320166)
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' :shocked 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

nogginthenog 08 May 2019 19:27

Quote:

Originally Posted by DofD (Post 1320018)
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.

flype 08 May 2019 21:00

Maybe this might be of some help :

https://m68kdev.blogspot.com/2016/05...icated-to.html

LongLifeA1200 09 May 2019 03:20

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 (Post 1319880)
In all honesty, if the books don't help, then pieces of code won't help either.


phx 09 May 2019 15:05

Quote:

Originally Posted by LongLifeA1200 (Post 1320210)

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. :)

malko 09 May 2019 15:32

Quote:

Originally Posted by phx (Post 1320284)
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 ;) :p :laughing .


Which book would you recommend to OP then ? :)

phx 09 May 2019 17:22

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... :p

turrican3 10 May 2019 00:04

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. :)

Ami 10 May 2019 17:50

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! :)


All times are GMT +2. The time now is 09:06.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.04901 seconds with 11 queries