Add support to load chr A (base64 16 colours) in tile.
Add support to load Map (automatic sprite to tiles and map 40x24).
Demostration with Arduino uno chino with ch340. Change power supply external to 5.2v to get hsync correct. cut the temples of the crystal to the minimum.
- Arduino atmega328
- crystal 28.6363 Mhz
- crystal 16 Mhz (optional switch)
- switch crystals
- i2C eprom 24LC256 (optional)
- 1 rca video
- 1 jack audio output mono
- gamepad atari 5 buttons
- gamepad nes
- gamepad snes
- audio input 1wire capacitor to transfer program (optional)
- bootloader i2c eprom (optional)
- 16 colours up 27 colours opcional
- NTSC colour
- tilemap 40x24
- sprites 4x8 pixels
- resolution 160x192
- A0 (pin 14) UP
- A1 (pin 15) DOWN
- A2 (pin 16) LEFT
- A3 (pin 17) RIGHT
It is defined in the file config.h
-
#ifdef _use_gamepad_atari
#define pin_btn_up 14
#define pin_btn_down 15
#define pin_btn_left 16
#define pin_btn_right 17
#endif
In file arduinocade.cpp, setup pullup input:
-
#ifdef _use_gamepad_atari
void setup()
{
pinMode(pin_btn_up,INPUT_PULLUP); //Joystick UP atari
pinMode(pin_btn_down,INPUT_PULLUP); //Joystick DOWN atari
pinMode(pin_btn_left,INPUT_PULLUP); //Joystick LEFT atari
pinMode(pin_btn_right,INPUT_PULLUP); //Joystick RIGHT atari
...
}
#endif
And file PACMAN.INO
-
byte ChooseDir(int dir, Sprite* s)
{
....
if (choice[0] != 0x7FFF && (digitalRead(pin_btn_up)==LOW)) return MUp;
if (choice[1] != 0x7FFF && (digitalRead(pin_btn_left)==LOW)) return MLeft;
if (choice[2] != 0x7FFF && (digitalRead(pin_btn_down)==LOW)) return MDown;
if (choice[3] != 0x7FFF && (digitalRead(pin_btn_right)==LOW)) return MRight;
}
Remove or comment call joystick IR and Intelligent Artificial
-
//test if (_ai && *readJoy()) {
I am currently developing a version that eliminates the entire keyboard library and infrared joysticks, saving us 570 bytes of flash and 20 bytes of RAM, but I have to test it well, since the original keyboard's reading is embedded in the interrupt routine for each generation of line, so it has to behave the same with the same times but without executing the same.
- A0 (pin 14) strobe
- A1 (pin 15) clk
- A2 (pin 16) data
It is defined in the file config.h
-
#ifdef _use_gamepad_nes
#define pin_nes_strobe 14
#define pin_nes_clock 15
#define pin_nes_data 16
#endif
At the beginning I used the library NESpad 1.2, but then I decided to make a custom code, to resize to 1 byte ram usage and 234 bytes of code. The code remove the delayMicroseconds, to test. It may be necessary in some gamepad.
PACMAN.INO
-
#include
...
#ifdef _use_gamepad_nes
byte state = 0;
byte nes_state = 0;
byte NESreadButtons(void);
byte NESshiftin(void);
void NESstrobe(void);
#endif
...
#ifdef _use_gamepad_nes
nes_state = NESreadButtons();
if (choice[0] != 0x7FFF && (nes_state & NES_UP)) return MUp;
if (choice[1] != 0x7FFF && (nes_state & NES_LEFT)) return MLeft;
if (choice[2] != 0x7FFF && (nes_state & NES_DOWN)) return MDown;
if (choice[3] != 0x7FFF && (nes_state & NES_RIGHT)) return MRight;
#endif
In development I am developing a program to test an NES and ATARI controller. I have reduced all the code to the minimum version, and I am even modifying the generation of sound waves to reduce the lookup table. Check buttons nes controller (up, down, left, right, select, start, A, B). 4348 bytes. Not data sound and kernel, and not ir keyboard and joysticks. Test in Arduino Duemilanove ATMEGA328p with mod bootloader 28 mhz mod. I am also developing a version that works with IDE 1.8.9, but for now it is 100% functional, since some visual defect of the tiles is generated.