Difference between revisions of "Atari 8Bit"

From SizeCoding
Jump to: navigation, search
(Created page with "== Atari 8-bit family == The systems in this family are: Atari 400, 800, 5200, 1200XL, 600XL, 800XL, 130XE, 65XE, 800XE and XEGS.<br /> The Atari 8-bit systems consists of th...")
 
Line 7: Line 7:
 
Setting up your development platform for the Atari 8bit systems is quite easy, first get the following tools:
 
Setting up your development platform for the Atari 8bit systems is quite easy, first get the following tools:
  
* Assembler: MADS Assembler - This assembler has nice macros for creating Binaries and SNA snapshot files out of the box. You can download it at https://mads.atari8.info/
+
* Assembler: MADS Assembler - This assembler can create atari XEX files out of the box. Download it at https://mads.atari8.info/
* Emulator(s): I Found Altirra to work best for my usecase. Make sure to use the original Rev2 rom for best compatibility.
+
* Emulator(s): I Found Altirra to work best for my usecases. Make sure to use the original Rev2 rom for best compatibility.
  
 
==== Special Memory Adresses ====
 
==== Special Memory Adresses ====

Revision as of 16:18, 28 March 2024

Atari 8-bit family

The systems in this family are: Atari 400, 800, 5200, 1200XL, 600XL, 800XL, 130XE, 65XE, 800XE and XEGS.

The Atari 8-bit systems consists of the 6502 with custom hardware for graphics and sound.

Setting up

Setting up your development platform for the Atari 8bit systems is quite easy, first get the following tools:

  • Assembler: MADS Assembler - This assembler can create atari XEX files out of the box. Download it at https://mads.atari8.info/
  • Emulator(s): I Found Altirra to work best for my usecases. Make sure to use the original Rev2 rom for best compatibility.

Special Memory Adresses

  • FRAMECOUNTER_HIGH = 19
  • FRAMECOUNTER_LOW = 20

Video display

Video display on the Atari 8bit systems use the ANTIC and GTIA chips. Information can be found here:

Sync with frame

RTCLOK      equ $0012
      lda RTCLOK+2
waits
      cmp RTCLOK+2
      beq waits

Or if you don't mind trashing RTCLOK

RTCLOK      equ $0012
waits
      lsr RTCLOK+2
      bcc waits

Which is two bytes shorter.

Getting something on screen

;fill screen with charset,(88,89)=an address
 org $600; free 6th page:600-6ff
 ldy #0
fl: tya
 sta(88),y
 iny
 bne fl
 jmp *

To be added soon.

SDMCTL	= $022f
HPOSP0  = $d000
SIZEP0  = $d008
GRAFP0  = $d00d
COLPM0  = $d012

FRAMECOUNTER_HIGH = 19
FRAMECOUNTER = 20
WSYNC	= $d40a
VCOUNT	= $d40b

sinewave	= $0600		; to $06ff

		org $80

main	
	; disable all graphics/colors
	ldx #0
	stx SDMCTL	

	ldy #$7f
	sty SIZEP0	; size p0=127
		
	ldx #0
	ldy #$3f
make_sine:
value_lo
			lda #0
			clc
delta_lo
			adc #0
			sta value_lo+1
value_hi
			lda #0
delta_hi
			adc #0
			sta value_hi+1
 
			sta sinewave+$c0,x
			sta sinewave+$80,y
			eor #$7f
			sta sinewave+$40,x
			sta sinewave+$00,y
 
			lda delta_lo+1
			adc #8
			sta delta_lo+1
			bcc nothing
			inc delta_hi+1
nothing
			inx
			dey
			bpl make_sine

updateloop:
		; vblank
		lda VCOUNT
		bne updateloop

		; clear graphics
		sta HPOSP0
		sta GRAFP0

		ldy #0
		lda #47
		sta COLPM0
yloop:
		tya           ; graphics shape = y
		sta WSYNC
		sta GRAFP0

		; a = sin(frame+y)+48
		tya	
		adc FRAMECOUNTER
		tax
		lda sinewave,x
		adc #48
		sta HPOSP0
                
                iny
                bne yloop
		jmp updateloop

		run main

Sound

The Atari 8-bit use the POKEY chip to generate sound.

BASIC

; from Analog, 1985-09,pp.25-32
*=$2000
AUDF1=$D200
AUDC1=$D201
AUDCTL=$D208
SKCTL=$D20F

.MACRO SOUND ; voice,pitch,dist,vol;,dur
	lda #%2
	sta AUDF1+2*%1
    lda #[[%3 * 16] | %4] ;lda #[[%3 shl 4] or %4]
    sta AUDC1+2*%1
.ENDM

 lda #0
 sta AUDCTL
 lda #3
 sta SKCTL

 SOUND 0,121,10,8

 jmp *

Make some noise

To be added soon.

Additional Resources

Sizecoding resource for the Atari 8bit are: