llvm-mos-sdk
atari2600_constants.h
Go to the documentation of this file.
1 // Copyright 2023 LLVM-MOS Project
2 // Licensed under the Apache License, Version 2.0 with LLVM Exceptions.
3 // See https://github.com/llvm-mos/llvm-mos-sdk/blob/main/LICENSE for license
4 // information.
5 
6 // Originally from cc65.
7 
8 #ifndef _ATARI2600_CONSTANTS_H
9 #define _ATARI2600_CONSTANTS_H
10 
11 // TIA - CONSTANTS
12 
13 #define HMOVE_L7 (0x70)
14 #define HMOVE_L6 (0x60)
15 #define HMOVE_L5 (0x50)
16 #define HMOVE_L4 (0x40)
17 #define HMOVE_L3 (0x30)
18 #define HMOVE_L2 (0x20)
19 #define HMOVE_L1 (0x10)
20 #define HMOVE_0 (0x00)
21 #define HMOVE_R1 (0xF0)
22 #define HMOVE_R2 (0xE0)
23 #define HMOVE_R3 (0xD0)
24 #define HMOVE_R4 (0xC0)
25 #define HMOVE_R5 (0xB0)
26 #define HMOVE_R6 (0xA0)
27 #define HMOVE_R7 (0x90)
28 #define HMOVE_R8 (0x80)
29 
30 // Values for ENAMx and ENABL
31 #define DISABLE_BM (0b00)
32 #define ENABLE_BM (0b10)
33 
34 // Values for RESMPx
35 #define LOCK_MISSILE (0b10)
36 #define UNLOCK_MISSILE (0b00)
37 
38 // Values for REFPx
39 #define NO_REFLECT (0b0000)
40 #define REFLECT (0b1000)
41 
42 // Values for NUSIZx
43 #define ONE_COPY (0b000)
44 #define TWO_COPIES (0b001)
45 #define TWO_MED_COPIES (0b010)
46 #define THREE_COPIES (0b011)
47 #define TWO_WIDE_COPIES (0b100)
48 #define DOUBLE_SIZE (0b101)
49 #define THREE_MED_COPIES (0b110)
50 #define QUAD_SIZE (0b111)
51 #define MSBL_SIZE1 (0b000000)
52 #define MSBL_SIZE2 (0b010000)
53 #define MSBL_SIZE4 (0b100000)
54 #define MSBL_SIZE8 (0b110000)
55 
56 // Values for CTRLPF
57 #define PF_PRIORITY (0b100)
58 #define PF_SCORE (0b10)
59 #define PF_REFLECT (0b01)
60 #define PF_NO_REFLECT (0b00)
61 
62 // Values for SWCHB
63 #define P1_DIFF_MASK (0b10000000)
64 #define P0_DIFF_MASK (0b01000000)
65 #define BW_MASK (0b00001000)
66 #define SELECT_MASK (0b00000010)
67 #define RESET_MASK (0b00000001)
68 
69 #define VERTICAL_DELAY (1)
70 
71 // SWCHA joystick bits
72 #define MOVE_RIGHT (0b01111111)
73 #define MOVE_LEFT (0b10111111)
74 #define MOVE_DOWN (0b11011111)
75 #define MOVE_UP (0b11101111)
76 #define P0_JOYSTICK_MASK (0b11110000)
77 #define P1_JOYSTICK_MASK (0b00001111)
78 
79 // SWCHA paddle bits
80 #define P0_TRIGGER_PRESSED (0b01111111)
81 #define P1_TRIGGER_PRESSED (0b10111111)
82 #define P2_TRIGGER_PRESSED (0b11110111)
83 #define P3_TRIGGER_PRESSED (0b11111011)
84 
85 // Values for VBLANK
86 #define DUMP_PORTS (0b10000000)
87 #define ENABLE_LATCHES (0b01000000)
88 #define DISABLE_TIA (0b00000010)
89 #define ENABLE_TIA (0b00000000)
90 
91 // Values for VSYNC
92 #define START_VERT_SYNC (0b10)
93 #define STOP_VERT_SYNC (0b00)
94 
95 #endif