From f3ecf733b67d66805bc139ea6240344756061bb7 Mon Sep 17 00:00:00 2001 From: Freddy Offenga Date: Mon, 21 Oct 2019 22:27:50 +0200 Subject: [PATCH] added a8_hardware files --- examples/a8/rainbow.mfk | 10 +++++++ include/a8.ini | 2 +- include/a8_antic.mfk | 24 ++++++++++++++++ include/a8_gtia.mfk | 64 +++++++++++++++++++++++++++++++++++++++++ include/a8_hardware.mfk | 8 ++++++ include/a8_pia.mfk | 17 +++++++++++ include/a8_pokey.mfk | 43 +++++++++++++++++++++++++++ 7 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 examples/a8/rainbow.mfk create mode 100644 include/a8_antic.mfk create mode 100644 include/a8_gtia.mfk create mode 100644 include/a8_hardware.mfk create mode 100644 include/a8_pia.mfk create mode 100644 include/a8_pokey.mfk diff --git a/examples/a8/rainbow.mfk b/examples/a8/rainbow.mfk new file mode 100644 index 00000000..2223b49d --- /dev/null +++ b/examples/a8/rainbow.mfk @@ -0,0 +1,10 @@ +byte clock @20 +byte a + +void main() { + while(true){ + a = (antic_vcount + clock) << 1 + antic_wsync = a + gtia_colpf2 = a + } +} \ No newline at end of file diff --git a/include/a8.ini b/include/a8.ini index ffb3d1e6..d9b9822b 100644 --- a/include/a8.ini +++ b/include/a8.ini @@ -1,6 +1,6 @@ [compilation] arch=strict -modules=a8_kernel,default_panic,stdlib +modules=a8_hardware,a8_kernel,default_panic,stdlib encoding=atascii screen_encoding=atasciiscr diff --git a/include/a8_antic.mfk b/include/a8_antic.mfk new file mode 100644 index 00000000..8566a148 --- /dev/null +++ b/include/a8_antic.mfk @@ -0,0 +1,24 @@ +// Atari 8-bit ANTIC hardware + +#if not(ATARI_8) +#warn a8_antic module should be used only on Atari computer-compatible targets +#endif + +volatile byte antic_dmactl @$D400 // direct memory access control +volatile byte antic_chactl @$D401 // character mode control +volatile byte antic_dlistl @$D402 // display list pointer low-byte +volatile byte antic_dlisth @$D403 // display list pointer high-byte +volatile byte antic_hscrol @$D404 // horizontal scroll enable +volatile byte antic_vscrol @$D405 // vertical scroll enable +volatile byte antic_unuse0 @$D406 // unused +volatile byte antic_pmbase @$D407 // msb of p/m base address +volatile byte antic_unuse1 @$D408 // unused +volatile byte antic_chbase @$D409 // character base address +volatile byte antic_wsync @$D40A // wait for horizontal synchronization +volatile byte antic_vcount @$D40B // vertical line counter +volatile byte antic_penh @$D40C // light pen horizontal position +volatile byte antic_penv @$D40D // light pen vertical position +volatile byte antic_nmien @$D40E // non-maskable interrupt enable + +// nmi reset status +volatile byte antic_nmires @$D40F diff --git a/include/a8_gtia.mfk b/include/a8_gtia.mfk new file mode 100644 index 00000000..84c7a390 --- /dev/null +++ b/include/a8_gtia.mfk @@ -0,0 +1,64 @@ +// Atari 8-bit GTIA hardware + +#if not(ATARI_8) +#warn a8_gtia module should be used only on Atari computer-compatible targets +#endif + +// read/write +volatile byte gtia_hposp0 @$D000 // horizontal position player 0 +volatile byte gtia_hposp1 @$D001 // horizontal position player 1 +volatile byte gtia_hposp2 @$D002 // horizontal position player 2 +volatile byte gtia_hposp3 @$D003 // horizontal position player 3 +volatile byte gtia_hposm0 @$D004 // horizontal position missile 0 +volatile byte gtia_hposm1 @$D005 // horizontal position missile 1 +volatile byte gtia_hposm2 @$D006 // horizontal position missile 2 +volatile byte gtia_hposm3 @$D007 // horizontal position missile 3 +volatile byte gtia_sizep0 @$D008 // size of player 0 +volatile byte gtia_sizep1 @$D009 // size of player 1 +volatile byte gtia_sizep2 @$D00A // size of player 2 +volatile byte gtia_sizep3 @$D00B // size of player 3 +volatile byte gtia_sizem @$D00C // size of missiles +volatile byte gtia_grafp0 @$D00D // graphics shape player 0 +volatile byte gtia_grafp1 @$D00E // graphics shape player 1 +volatile byte gtia_grafp2 @$D00F // graphics shape player 2 +volatile byte gtia_grafp3 @$D010 // graphics shape player 3 +volatile byte gtia_grafm @$D011 // graphics shape missiles +volatile byte gtia_colpm0 @$D012 // color player and missile 0 +volatile byte gtia_colpm1 @$D013 // color player and missile 1 +volatile byte gtia_colpm2 @$D014 // color player and missile 2 +volatile byte gtia_colpm3 @$D015 // color player and missile 3 +volatile byte gtia_colpf0 @$D016 // color playfield 0 +volatile byte gtia_colpf1 @$D017 // color playfield 1 +volatile byte gtia_colpf2 @$D018 // color playfield 2 +volatile byte gtia_colpf3 @$D019 // color playfield 3 +volatile byte gtia_colbk @$D01A // color background +volatile byte gtia_prior @$D01B // priority selection +volatile byte gtia_vdelay @$D01C // vertical delay +volatile byte gtia_gractl @$D01D // stick/paddle latch, p/m control +volatile byte gtia_hitclr @$D01E // clear p/m collision +volatile byte gtia_consol @$D01F // console buttons + +// read +volatile byte gtia_m0pf @$D000 // missile 0 to playfield collision +volatile byte gtia_m1pf @$D001 // missile 1 to playfield collision +volatile byte gtia_m2pf @$D002 // missile 2 to playfield collision +volatile byte gtia_m3pf @$D003 // missile 3 to playfield collision +volatile byte gtia_p0pf @$D004 // player 0 to playfield collision +volatile byte gtia_p1pf @$D005 // player 1 to playfield collision +volatile byte gtia_p2pf @$D006 // player 2 to playfield collision +volatile byte gtia_p3pf @$D007 // player 3 to playfield collision +volatile byte gtia_m0pl @$D008 // missile 0 to player collision +volatile byte gtia_m1pl @$D009 // missile 1 to player collision +volatile byte gtia_m2pl @$D00A // missile 2 to player collision +volatile byte gtia_m3pl @$D00B // missile 3 to player collision +volatile byte gtia_p0pl @$D00C // player 0 to player collision +volatile byte gtia_p1pl @$D00D // player 1 to player collision +volatile byte gtia_p2pl @$D00E // player 2 to player collision +volatile byte gtia_p3pl @$D00F // player 3 to player collision +volatile byte gtia_trig0 @$D010 // joystick trigger 0 +volatile byte gtia_trig1 @$D011 // joystick trigger 1 +volatile byte gtia_trig2 @$D012 // joystick trigger 2 +volatile byte gtia_trig3 @$D013 // joystick trigger 3 + +// pal/ntsc flag +volatile byte gtia_pal @$D014 diff --git a/include/a8_hardware.mfk b/include/a8_hardware.mfk new file mode 100644 index 00000000..f52b5632 --- /dev/null +++ b/include/a8_hardware.mfk @@ -0,0 +1,8 @@ +#if not(ATARI_8) +#warn a8_hardware module should be used only on Atari computer-compatible targets +#endif + +import a8_antic +import a8_gtia +import a8_pia +import a8_pokey diff --git a/include/a8_pia.mfk b/include/a8_pia.mfk new file mode 100644 index 00000000..46b07542 --- /dev/null +++ b/include/a8_pia.mfk @@ -0,0 +1,17 @@ +// Atari 8-bit PIA hardware + +#if not(ATARI_8) +#warn a8_pia module should be used only on Atari computer-compatible targets +#endif + +// port A data r/w +volatile byte pia_porta @$D300 + +// port B data r/w +volatile byte pia_portb @$D301 + +// port A control +volatile byte pia_pactl @$D302 + +// port B control +volatile byte pia_pbctl @$D303 diff --git a/include/a8_pokey.mfk b/include/a8_pokey.mfk new file mode 100644 index 00000000..f9f9a350 --- /dev/null +++ b/include/a8_pokey.mfk @@ -0,0 +1,43 @@ +// Atari 8-bit POKEY hardware + +#if not(ATARI_8) +#warn a8_pokey module should be used only on Atari computer-compatible targets +#endif + +// write +volatile byte pokey_audf1 @$D200 // audio channel #1 frequency +volatile byte pokey_audc1 @$D201 // audio channel #1 control +volatile byte pokey_audf2 @$D202 // audio channel #2 frequency +volatile byte pokey_audc2 @$D203 // audio channel #2 control +volatile byte pokey_audf3 @$D204 // audio channel #3 frequency +volatile byte pokey_audc3 @$D205 // audio channel #3 control +volatile byte pokey_audf4 @$D206 // audio channel #4 frequency +volatile byte pokey_audc4 @$D207 // audio channel #4 control +volatile byte pokey_audctl @$D208 // audio control +volatile byte pokey_stimer @$D209 // start pokey timers +volatile byte pokey_skrest @$D20A // reset serial port status reg. +volatile byte pokey_potgo @$D20B // start paddle scan sequence +volatile byte pokey_unuse1 @$D20C // unused +volatile byte pokey_serout @$D20D // serial port data output +volatile byte pokey_irqen @$D20E // interrupt request enable +volatile byte pokey_skctl @$D20F // serial port control + +// read +volatile byte pokey_pot0 @$D200 // paddle 0 value +volatile byte pokey_pot1 @$D201 // paddle 1 value +volatile byte pokey_pot2 @$D202 // paddle 2 value +volatile byte pokey_pot3 @$D203 // paddle 3 value +volatile byte pokey_pot4 @$D204 // paddle 4 value +volatile byte pokey_pot5 @$D205 // paddle 5 value +volatile byte pokey_pot6 @$D206 // paddle 6 value +volatile byte pokey_pot7 @$D207 // paddle 7 value +volatile byte pokey_allpot @$D208 // eight paddle port status +volatile byte pokey_kbcode @$D209 // keyboard code +volatile byte pokey_random @$D20A // random number generator +volatile byte pokey_unuse2 @$D20B // unused +volatile byte pokey_unuse3 @$D20C // unused +volatile byte pokey_serin @$D20D // serial port input +volatile byte pokey_irqst @$D20E // interrupt request status + +// serial port status +volatile byte pokey_skstat @$D20F