kategoria: Asembler
[#1] [ASM] Ciekawy kurs asm..
Natknąłem się na taki kurs, może Komuś się przyda:
https://www.markwrobel.dk/project/amigamachinecode/
[wyróżniony] [#2] Re: [ASM] Ciekawy kurs asm..

@mateusz_s, post #1

Przydać to się na pewno przyda, tylko trzeba jeszcze wziąć pod uwagę że zawiera błędy i w zasadzie przykłady ograniczają zastosowanie do A500. Chociaż i tu mogą być problemy. Ja na szybko znalazłem dwa błędy.
Ustawianie copperlisty po 'ubiciu' os bez strobowania copjmp1 może powodować problemy łącznie z NIE uruchomieniem copperlisty. Gdyż po uruchomieniu DMA coppera, do końca nowej ramki działa stara copperlista, która może wyczyniać cuda, włącznie z ustawieniem nowej copperlisty.
Procedura przerwania klawiatury zamieszczona w kursie jest beznadziejna. SMC na jpm $0 i brak handshake.
[#3] Re: [ASM] Ciekawy kurs asm..

@asman, post #2

Hi PPA folks,
Thanks for discovering my site - I hope you have fun reading it, as I did writting it. szeroki uśmiech.

Just a quick reply to asman in comment [#2].

I have no doubt that many of the coding examples are a bit "wild west", with very little emphasis on the multitask aspects of the operative system. I think the original authors choose this style to keep things simple. First crawl, then walk.

You write about the keyboard interrupt procedure example, where there is a jump to $0 and a missing handshake.

I know nothing about the handshake procedure - I will look it up . However, I do have a comment about that jump to $0 at the end of the code. It might look like the code jumps to $0, but that's not the case, since the program rewrites itself in the first two lines:
lea.l	jump,a1          ; move address of jump into a1
move.l	$68,2(a1)        ; move value in address $68 (interrupt 2) into memory pointed to by a1+2

When the program counter reaches the last line of the code, it would have already been overwritten by the code itself:
jump:
jmp	$0	    ; the jump was previously set to the value in address $68 (interrupt 2) 
                    ; so this interupt function is linked together with the previous one

The last jump will not be to $0 but to the previous keyboard interrupt procedure. This daisy chaining ensures that the keybord still works. When the keyboard is pressed, our interrupt procedure toggles the Amiga power light, and then calls the original keyboard interrupt procedure.

The program allocate memory for our interrupt procedure, and copies our self-modified code to that memory. That memory is then called, when we receive an interrupt from the keyboard.

And that's it. Take care out there folks, and happy Easter. OK
[#4] Re: [ASM] Ciekawy kurs asm..

@MarkWrobel, post #3

Hi Mark,

First at all thanks for your project Amiga Machine Code Course. Also thanks for reply.

I think the original authors choose this style to keep things simple. First crawl, then walk.

Yea, for sure. About copperlist link the solution is simple, add copjmp1 strobe, mean
move.w d0,$dff088

And thats it - copper will start immediatelly.

About keyboard handshake. Just look to link. Also the proper keyboard int routine you can find in WHDLoad dev package or catch me via email (in my profile) and I will send you my PORTS routine.

Stay healthy and happy Easter OK
[#5] Re: [ASM] Ciekawy kurs asm..

@asman, post #2

Jaki kurs w takim razie polecasz? Bo nawet się zainteresowałem i zainstalowałem emulator z systemem.
[#6] Re: [ASM] Ciekawy kurs asm..

@tom256, post #5

Biblioteka książek o ASM na Amigę jest potężna. Proponuje zacząć od tego i eksperymentować
z przykładowymi kodami. Nic tak nie uczy jak własne próby i błędy.
[#7] Re: [ASM] Ciekawy kurs asm..

@tom256, post #5

Polecam to co napisał Blady + pytać na forum w razie wątpliwości.
[#8] Re: [ASM] Ciekawy kurs asm..

@asman, post #7

A coś online?
[#9] Re: [ASM] Ciekawy kurs asm..

@tom256, post #5

Wiem, że nie wszyscy mają w domu zachomikowane jeszcze numery Magazynu Amiga, ale ja (jako wtedy zupełnie początkujący w asemblerze, ze znajomością tylko BASIC'a i ciutkę C) byłem zachwycony kursem prowadzonym w tym miesięczniku przez Bartka Pampucha. Jak dla mnie - REWELACJA. Człowiek potrafił wytłumaczyć wszystko - gdzie nie wszystkim się to udaje. Nie wiem czy dobrze pamiętam, ale jego pierwszy program w tym kursie miał postać:
rts

Potem powolutku tłumaczył co i jak... i dzięki niemu zrozumiałem filozofię asemblera OK
Jak czytałem inne materiały to za "chiny" nie mogłem połapać o co chodzi. A tutaj... autor miał oryginalny pomysł na to, a jaki - to myślę że chętni i ciekawi (jeśli posiadają archiwa z MA w biurku, szafie, czy też piwnicy/strychu) odnajdą to łatwo...
[#10] Re: [ASM] Ciekawy kurs asm..

@tom256, post #8

Ja asm'a załapałem po przeczytaniu tego - http://chaozer.ikod.se/asmtut.shtml.
[#11] Re: [ASM] Ciekawy kurs asm..

@majkel78, post #9

Niektórzy mają zaChomikowane powtarzam zaChomikowane niezbędne materiały.
Jak np:
- Mapa pamięci Amiga 500 2000 tom 1 i 2
- AMIGA bez tajemnic - książka niezbędna dla każdego kodera - zrób własne demo
- Helion - Kurs Assemblera Amiga
[#12] Re: [ASM] Ciekawy kurs asm..

@majkel78, post #9

Pamiętasz może które numery? Tak mniej więcej.
[#13] Re: [ASM] Ciekawy kurs asm..

@tom256, post #5

Ja mogę polecić książkę Czyża - Rodzina M680xx (z kawałkiem amigowej klawiatury i myszki na okładce).
Kurs w MA też był całkiem niezły.
[#14] Re: [ASM] Ciekawy kurs asm..

@tom256, post #12

MA od 11/95 do 10/97 (i jedna część w 11/97 innego autora).
[#15] Re: [ASM] Ciekawy kurs asm..

@tom256, post #8

[#16] Re: [ASM] Ciekawy kurs asm..

@asman, post #4

Thanks for the links :). I was pondering a little over what you wrote.

About the Keyboard interrupt routine from the Amiga Machine Code Course. You have really underscored that the routine cannot stand alone, since there is no handshake. All in all, it's very hackish

The routine only works, because it's daisy chained to the system keyboard handler, via the last jump. So the first interrupt handler just acts as a relay, that toggles the power LED, while the system keyboard handler takes care of the handshake.

However, I found something else that is a huge potential problem. It's about the last jump. The jump address is set by the program rewriting itself, and then copying part of the program to an allocated space of memory, which is then hooked into the exception vector table.

At first, I thought that this was an interesting technique, and it surely is, but it's very problematic. Here's a quote from Mike Morton written in BYTE magazine, September 1986.

Self-modifying code is especially bad for 68000 programs that may someday run on the 68020, because the 68020's instruction cache normally assumes that code is pure.


The 68020 introduced an L1 cache of 256 bytes, and I can imagine that any program that relies on self-modification, will risk running into big problems with memory and cache going out of sync.

Well, these was just my thoughts on the issue. The Amiga Machine Code course was originally written in 1989, and had a learn-fast-and-skip-details mindset. Just learn enough, to set you on the path of learning more yourself. For me, it has been a really good learning experience.

I first started my assembler journey by reading The Elements of Computing Systems. The book starts by you building all hardware with nand gates, which is followed by you building a virtual machine on top of which you build a compiler for a high level language called Jack. The keystone project is to build a game szeroki uśmiech

The book also have a companion site, callled nand2tetris.org with slides and notes.

Stay healthy

Ostatnia aktualizacja: 18.04.2020 12:43:04 przez MarkWrobel

Ostatnia aktualizacja: 18.04.2020 12:46:16 przez MarkWrobel
[#17] Re: [ASM] Ciekawy kurs asm..

@MarkWrobel, post #16

Thank you, Mark, for the course. I'm just exploring the assembler's secrets.
Na stronie www.PPA.pl, podobnie jak na wielu innych stronach internetowych, wykorzystywane są tzw. cookies (ciasteczka). Służą ona m.in. do tego, aby zalogować się na swoje konto, czy brać udział w ankietach. Ze względu na nowe regulacje prawne jesteśmy zobowiązani do poinformowania Cię o tym w wyraźniejszy niż dotychczas sposób. Dalsze korzystanie z naszej strony bez zmiany ustawień przeglądarki internetowej będzie oznaczać, że zgadzasz się na ich wykorzystywanie.
OK, rozumiem