|
|
(18 intermediate revisions by 5 users not shown) |
Line 5: |
Line 5: |
| | | |
| === The Motorola 68k processor === | | === The Motorola 68k processor === |
− | The Motorola 68k processor... | + | The Motorola 68k processor is a 16-bit Big-Endian format processor, using 32-bit register and addresses. |
| | | |
− | Note: Assigment direction is source,dest instead of dest,source !!! | + | This means that instruction sizes on average are either 2 or 4 bytes each, and 6 bytes for longword / 32-bit instructions. |
| + | |
| + | Note: The assigment direction is source,dest instead of dest,source !!! |
| | | |
| ==== Registers ==== | | ==== Registers ==== |
− | To be added.
| |
− |
| |
− | == Atari ST ==
| |
− | The Atari ST systems consists of the M68k system with custom hardware for graphics and sound.
| |
− |
| |
− | === Setting up ===
| |
− | Setting up your development platform for the Atari ST systems is quite easy, first get the following tools:
| |
− |
| |
− | * Assembler: VASM - This assembler is able to assemble directly to a TOS executable
| |
− | * Assembler: [http://rmac.is-slick.com RMAC] - Can assemble to TOS executable as well as a headerless absolute binary
| |
− | * Emulator(s): -. Make sure to use the original TOS 1.62 Image for best compatibility.
| |
− |
| |
− | ==== Compiling to a TOS image ====
| |
− | Vasm -Ftos source.s -o source.tos
| |
− | rmac -p -o source.tos source.s
| |
− |
| |
− | === ST executable format, and why you should write relocatable code ===
| |
− |
| |
− | To be added
| |
− |
| |
− | === Video display ===
| |
− | The Atari ST uses an interleaved planar memory layout to represent its paletted display modes (we'll concentrate on 320x200x16 colours here).
| |
− |
| |
− | ==== Paletted? ====
| |
− | The Atari ST uses index values into a palette of colours. Index 0 is the background colour (that's also used for the border) and a maximum of 16 colours can be defined and indexed.
| |
− |
| |
− | ==== Planes? ====
| |
− | Every plane contains one bit of a pixel's colour index value. The bits of the binary representation of a colour index like %1010 (% Bit3,Bit2,Bit1,Bit0) will end up in 4 different planes (bits most significant to least significant aka left to right): Plane4 Plane3 Plane2 Plane1.
| |
− |
| |
− | So basicly Plane1 contains all of the Bit0s of all pixels, Plane2 all Bit1s, Plane3 all Bit2s and Plabe4 all Bit3s.
| |
− |
| |
− | The first pixel on a plane is described by the leftmost (aka most significant) bit in a word, the second one by the second-leftmost etc. - just like this %0123456789abcdef with 0-f=pixels 1-16. %1000000000000000=$8000=pixel 1 in a plane word set. The 16th pixel will use the leftmost bit of the next word in this plane. etc.
| |
− |
| |
− | ==== Interleaved? ====
| |
− | 16 pixels worth of data are represented as a full graphicword, meaning all information to display 16 pixels are stored together, followed by the data to represent the next 16 pixels etc. One row worth of display data has 20 graphicwords (20*16 pixels=320 pixels).
| |
− |
| |
− | 16 pixels are stored in 4 words - which contain 4 of the aforementioned planes.
| |
− | <br /><br />
| |
− | So a 320x200x16 colour display is a contiuous memory buffer containing:
| |
− |
| |
− | <syntaxhighlight lang="">
| |
− | Pixels 0-15, row 0:(Plane1.w Plane2.w Plane3.w Plane4.w)
| |
− | Pixels 16-31, row 0:(Plane1.w Plane2.w Plane3.w Plane4.w)
| |
− | Pixels 32-47, row 0:(Plane1.w Plane2.w Plane3.w Plane4.w)
| |
− | ......
| |
− | Pixels 304-319, row 199:(Plane1.w Plane2.w Plane3.w Plane4.w)
| |
− | </syntaxhighlight>
| |
− |
| |
− | To be refined soon.
| |
− |
| |
− | ==== Setting a palette ====
| |
− | Here is some code that will help you setup a palette
| |
− |
| |
− | <syntaxhighlight lang="">
| |
− | pea palette(pc)
| |
− | move.w #6,-(sp)
| |
− | trap #14
| |
− |
| |
− | ; Palette data
| |
− | palette:
| |
− | dc.w $000,$100,$200,$311,$422,$533,$644,$755
| |
− | dc.w $575,$464,$353,$242,$131,$020,$010,$000
| |
− | </syntaxhighlight>
| |
− |
| |
− | ==== Getting something on screen ====
| |
− | Here is a bit of code to get you started:
| |
− |
| |
− | <syntaxhighlight lang="">
| |
− | ;-----------------------
| |
− | ; Line-A Initialization
| |
− | ;-----------------------
| |
− | ; After calling this function, data register D0 and address register A0 point to a table ; with the starting address of the Line A variables.
| |
− | ; Address register A1 points to a table with the starting addresses for the three system ; font headers,
| |
− | ; and address register A2 points to a table that specifies the starting addresses of the; 15 Line A opcodes. There's no parameter required for this function, so all you have
| |
− | ; to do is call the word opcode label that you specified for the $A000 (Initialize)
| |
− | ; function.
| |
− | dc.w $A000
| |
− | movem.l (a0),a1-a4 ; A3=INTIN, A4=PTSIN
| |
− |
| |
− | ;---------
| |
− | ; For X&Y
| |
− | ;---------
| |
− | frameloop:
| |
− | move.w #200-1,d7 ; y
| |
− | yLoop:
| |
− | move.w #320-1,d6 ; x
| |
− | xLoop:
| |
− |
| |
− | ; Putpixel
| |
− | put_pixel:
| |
− | move.b d6,d0 ; d0=x
| |
− | eor d7,d0 ; d0=x^y
| |
− | lsr.b #2,d0 ; d0>>=4
| |
− | and #42,d0 ; d0&42
| |
− |
| |
− | move.w d0,(a3) ; a3=color(d0)
| |
− | movem.w d6/d7,(a4) ; a4=x,y`
| |
− |
| |
− | dc.w $A001 ; put pixel command
| |
− |
| |
− | dbra d6,xLoop ; decrease and branch
| |
− | dbra d7,yLoop
| |
− |
| |
− | ; Wait loop
| |
− | bra frameloop ; .s *
| |
− |
| |
− | </syntaxhighlight>
| |
− |
| |
− | === Sound ===
| |
− | The Atari ST systems use the YM2149 chip to generate sound.\
| |
− |
| |
− | For more information check out https://www.atarimagazines.com/v4n7/stsound.html
| |
− |
| |
− | ==== Make some noise ====
| |
− | To be added soon.
| |
− |
| |
− | === Additional Resources ===
| |
− | Sizecoding on the Atari ST is not very huge yet, so resources are sparse. Here are some bytetros with source code:
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/blob/master/ASM/Gaston/starfield_128b_src/STARFLD.S 128b Palette Starfield by Gaston] https://www.pouet.net/prod.php?which=64455
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/blob/master/ASM/Gaston/fractal_boot_src/FRACTAL.S Fractal Landscape bootsector by Gaston] https://www.pouet.net/prod.php?which=64468
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/NoCrew/bigscrol BIG scroller by NoCrew] https://www.pouet.net/prod.php?which=22325
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Preromanbritain/128drum 128byte drum machine by gwEm] https://www.pouet.net/prod.php?which=16924
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Preromanbritain/theremin.128 128byte Theremin by gwEm] https://www.pouet.net/prod.php?which=17041
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Preromanbritain/128b_303 128byte virtual 303 by gwEm] https://www.pouet.net/prod.php?which=17370
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Various/Sedma/SEDMA_ST 88 Bytes by Sedma] https://www.pouet.net/prod.php?which=25051
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/OUT2K5/mikro Realtime Competition by Mystic Bytes] https://www.pouet.net/prod.php?which=25052
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/KÜA%20software%20productions/boot The Bootshitctor by KÜA software productions] https://www.pouet.net/prod.php?which=24965
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/KÜA%20software%20productions/piggy BOOT MY PIGGY GAME by Lineout & KÜA software productions] https://www.pouet.net/prod.php?which=50496
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/D-Bug/OL09BOOT/OL09BOOT.S Keeping atari alive by D-Bug] https://www.pouet.net/prod.php?which=53190
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/Positivity/dla/src dla by Positivity] https://www.pouet.net/prod.php?which=53198
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/Positivity/quad/QUAD.SRC quadratic splines by Positivity] https://www.pouet.net/prod.php?which=54952] https://www.pouet.net/prod.php?which=53198
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/KÜA%20software%20productions/ttnoise TT-Noise by KÜA software productions] https://www.pouet.net/prod.php?which=56279
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/Positivity/cell/CELL.SRC Random Cell by Positivity] https://www.pouet.net/prod.php?which=57063
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/ASM/PHF/128choon 128 byte Choonage by Psycho Hacking Force] https://www.pouet.net/prod.php?which=57921
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/ASM/Positivity/showmem ShowMem by Positivity] https://www.pouet.net/prod.php?which=58123
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/ASM/ORB/Benoit(ST) Benoît by Orb] https://www.pouet.net/prod.php?which=65455
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/KÜA%20software%20productions/BIER/source 1 euro by Lineout & KÜA software productions & Psycho Hacking Force] https://www.pouet.net/prod.php?which=65611
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/KÜA%20software%20productions/etipolla Έτη πολλα! by KÜA software productions] https://www.pouet.net/prod.php?which=67392
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Various/Dyno/sync128b Sync128b by Dyno] https://www.pouet.net/prod.php?which=68508
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Various/Dyno/128b-Mandelbrot_Set 128B Mandelbrot Set by Dyno] https://www.pouet.net/prod.php?which=72891
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Various/Dyno/64b-Sierpinski_Scroller 64B Sierpinski Scroller by Dyno] https://www.pouet.net/prod.php?which=72893
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Various/Dyno/32b-Sierpinski_Triangle 32B Sierpinski Triangles by Dyno] https://www.pouet.net/prod.php?which=72894
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Various/Dyno/32b-Noise 32B Noise by Dyno] https://www.pouet.net/prod.php?which=72895
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Various/Cedric%20Bourse%20(orion_)/fract128 Fractal 128 by Orion_] https://www.pouet.net/prod.php?which=78762
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Satantronic/IMPERFCT ImPerfect by Satantronic] https://www.pouet.net/prod.php?which=81758
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/atariBDSM/tunnelST tunnelST by atariBDSM] https://www.pouet.net/prod.php?which=84120
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Various/Sebastian%20Pawlak%20(tr1x)/BLUES Blues by tr1x] https://www.pouet.net/prod.php?which=84238
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Various/Sebastian%20Pawlak%20(tr1x)/SHADES Shades by tr1x] https://www.pouet.net/prod.php?which=84239
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/blob/master/ASM/Gash/wobble/wobble.s Wobble by Gash] https://www.pouet.net/prod.php?which=86138
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Defence Force/MindBender MindBender by Defence Force] https://www.pouet.net/prod.php?which=86127
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/blob/master/ASM/SMFX/imperati/imperativ.s DER SPKR IMPERATIV by SMFX] https://www.pouet.net/prod.php?which=86129
| |
− |
| |
− | And some for the Atari Falcon
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/NoCrew/mandel NoBrains Mandelbrot Zoomer 128 by NoCrew] https://www.pouet.net/prod.php?which=25220
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/NoCrew/plasma 128 bytes Plasma demo by NoCrew] https://www.pouet.net/prod.php?which=28781
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/NoCrew/pyro 128 bytes Pyro demo by NoCrew] https://www.pouet.net/prod.php?which=28783
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/NoCrew/sierpins ] https://www.pouet.net/prod.php?which=28784 128 bytes Sierspinksi by NoCrew
| |
− |
| |
− | * [https://github.com/ggnkua/Atari_ST_Sources/blob/master/ASM/T.O.Y.S/128TRON2/SOURCE/128TRON2.S 128 TRON ][ by T.O.Y.S.] https://www.pouet.net/prod.php?which=28856
| |
| | | |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Mind%20Design/Strange%20Things%20Happends%20InSweden Strange Things Happends In Sweden by Mind Design] https://www.pouet.net/prod.php?which=28762 | + | * D0..D7 - 8 x 32 bit General Purpose Registers |
| | | |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/NoCrew/mixdots/src Mixed Dots 128 by NoCrew] https://www.pouet.net/prod.php?which=25221 | + | * A0..A6 - 7 x 32 bit Address Registers |
| | | |
− | * [https://github.com/ggnkua/Atari_ST_Sources/tree/master/ASM/Various/Sedma/SEDMA_F Realtime Competition Falcon by Sedma] https://www.pouet.net/prod.php?which=25050 | + | * A7 - 32-bit Stack-Address Register |
| | | |
| + | ==== Instructions timing ==== |
| + | The number of cycles for each instruction is different depending of processor model in M68K family. |
| + | : http://oldwww.nvg.ntnu.no/amiga/MC680x0_Sections/mc68000timing.HTML |
| | | |
| + | == Size considerations == |
| + | Here are some general rule of thumbs when it comes to size consideration when programming the M68000 |
| | | |
− | * ST Soundchip: https://www.atarimagazines.com/v4n7/stsound.html | + | * Moving/Calculating Register from/to registers - 2 bytes |
| + | * Moving/Calculating with byte or word values - 4 bytes |
| + | * Moving/Calculating with long values - 6 bytes |
| | | |
− | == Commodore Amiga ==
| + | Shorter variants: |
− | The Commodore Amiga system consists of the M68k system with custom hardware for graphics and sound.
| + | * moveq #value, reg : 2 bytes - Moves a values -128...127 to a register |
| + | * addq #value, reg : 2 bytes - Adds a values 0..8 to a register |
| + | * subq #value, reg : 2 bytes - Subtracts a values 0..8 from a register |
| | | |
− | === Setting up ===
| |
| | | |
− | * Assembler: -
| + | == Generic 68K sinus table generator == |
− | * Emulator(s): WinUAE | + | Here is a fairly generic 68k sinus table generator (16 bytes on Atari ST) as well as a 10-byte zigzag generator. |
| + | * [https://demozoo.org/productions/310191/ Singen68k] |
| | | |
− | === Video display === | + | == Resources == |
− | No information yet
| + | * [http://www.beycan.net/eklenen/M68000_Instruction_Set.pdf M68000 Instruction Set] |
| + | * [http://www.easy68k.com/ EASy68K Editor/Assembler/Simulator for the 68000] |
| + | * [http://www.easy68k.com/paulrsm/index.html Various Motorola 68k resources] |
| | | |
− | === Sound === | + | == Motorola M68K Platforms == |
− | No information yet
| + | *'''[[Atari ST]]''' - Atari ST Sizecoding information |
| + | *'''[[Atari Jaguar]]''' - Atari Jaguar Sizecoding information |
| + | *'''[[Commodore Amiga]]''' - Commodore Amiga Sizecoding information |
| + | *'''[[Spectrum QL]]''' - Spectrum QL information |
Wanting to start sizecoding on a Motorola 68k platform in this day and age can be tough.
The Motorola 68k processor is a 16-bit Big-Endian format processor, using 32-bit register and addresses.
This means that instruction sizes on average are either 2 or 4 bytes each, and 6 bytes for longword / 32-bit instructions.
The number of cycles for each instruction is different depending of processor model in M68K family.
Here are some general rule of thumbs when it comes to size consideration when programming the M68000
Here is a fairly generic 68k sinus table generator (16 bytes on Atari ST) as well as a 10-byte zigzag generator.