forked from mamedev/mame
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I/O slots para o driver do Patinho Feio #1
Open
affonsoamendola
wants to merge
2
commits into
ArqueologiaDigital:patinhofeio
Choose a base branch
from
affonsoamendola:patinhofeio_io_slot
base: patinhofeio
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "emu.h" | ||
#include "patinhofeio_io.h" | ||
|
||
DEFINE_DEVICE_TYPE(PATINHO_FEIO_IO, patinho_feio_io_device, "patinho_feio_io", "Patinho Feio IO Port") | ||
|
||
patinho_feio_io_device::patinho_feio_io_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) | ||
: device_t(mconfig, PATINHO_FEIO_IO, tag, owner, clock), | ||
device_slot_interface(mconfig, *this), | ||
|
||
m_pin0_handler(*this), | ||
|
||
m_dev(nullptr) | ||
{ | ||
} | ||
|
||
void patinho_feio_io_device::device_config_complete() | ||
{ | ||
m_dev = dynamic_cast<patinho_feio_io_device *>(get_card_device()); | ||
} | ||
|
||
void patinho_feio_io_device::device_start() | ||
{ | ||
m_pin0_handler.resolve_safe(); | ||
|
||
// pull up | ||
m_pin0_handler(1); | ||
} | ||
|
||
WRITE_LINE_MEMBER( patinho_feio_io_device::write_pin0 ) { if (m_dev) m_dev->input_pin0(state); } | ||
|
||
device_patinho_feio_io_port_interface::device_patinho_feio_io_port_interface(const machine_config &mconfig, device_t &device) | ||
: device_slot_card_interface(mconfig, device) | ||
{ | ||
m_slot = dynamic_cast<patinho_feio_io_device *>(device.owner()); | ||
} | ||
|
||
device_patinho_feio_io_port_interface::~device_patinho_feio_io_port_interface() | ||
{ | ||
} | ||
|
||
/* | ||
A partir daqui o codigo do centronics define cada device que seria possivelmente plugado nessa porta, seria o caso de | ||
colocar aqui a teletype, decwriter, synth do guido, etc | ||
|
||
#include "comxpl80.h" | ||
#include "epson_ex800.h" | ||
#include "epson_lx800.h" | ||
#include "epson_lx810l.h" | ||
#include "nec_p72.h" | ||
#include "printer.h" | ||
#include "covox.h" | ||
|
||
SLOT_INTERFACE_START(centronics_devices) | ||
SLOT_INTERFACE("pl80", COMX_PL80) | ||
SLOT_INTERFACE("ex800", EPSON_EX800) | ||
SLOT_INTERFACE("lx800", EPSON_LX800) | ||
SLOT_INTERFACE("lx810l", EPSON_LX810L) | ||
SLOT_INTERFACE("ap2000", EPSON_AP2000) | ||
SLOT_INTERFACE("p72", NEC_P72) | ||
SLOT_INTERFACE("printer", CENTRONICS_PRINTER) | ||
SLOT_INTERFACE("covox", CENTRONICS_COVOX) | ||
SLOT_INTERFACE("covox_stereo", CENTRONICS_COVOX_STEREO) | ||
SLOT_INTERFACE_END | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#ifndef MAME_BUS_PATINHO_FEIO_IO_H | ||
#define MAME_BUS_PATINHO_FEIO_IO_H | ||
|
||
#pragma once | ||
|
||
#define MCFG_PATINHO_FEIO_IO_PORT_ADD(_tag, _slot_intf, _def_slot) \ | ||
MCFG_DEVICE_ADD(_tag, PATINHO_FEIO_IO_PORT, 0) \ | ||
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) | ||
|
||
//Aparentemente define cada um dos pinos de io, n entendi direitinho como funciona ainda... | ||
//E não corri atras ainda pra ver a definição da interface de entrada e saída do patinho, então também n to ligado em quantos pinos tem | ||
//nem a função de cada um, isso vai ficar para depois, por enquanto, definindo um dispositivo de IO com um só pino | ||
#define MCFG_PATINHO_FEIO_IO_PIN0_HANDLER(_devcb) \ | ||
devcb = &downcast<patinho_feio_io_port_device &>(*device).set_pin0_handler(DEVCB_##_devcb); | ||
|
||
//No codigo do centronics tem essa linha, que não aparece em nenhum dos dois outros (rs232 e hp80_io), pq? | ||
//DECLARE_DEVICE_TYPE(CENTRONICS, centronics_device) | ||
//Seria o caso de usar algo tipo | ||
DECLARE_DEVICE_TYPE(PATINHO_FEIO_IO, patinho_feio_io_device); | ||
//Pq logo após já tem a declaração do device patinho_feio_io_device, então sei la pq essa linha ta la | ||
|
||
class device_patinho_feio_io_port_interface; | ||
|
||
class patinho_feio_io_device : public device_t, | ||
public device_slot_interface | ||
{ | ||
friend class device_patinho_feio_io_port_interface; | ||
|
||
public: | ||
patinho_feio_io_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); | ||
|
||
//Não faço a MINIMA ideia do que isso faz, mas é padrão nos 3 codigos em que eu to me inspirando, acredito que seja essencial | ||
template <class Object> devcb_base &set_pin0_handler(Object &&cb) { return m_pin0_handler.set_callback(std::forward<Object>(cb)); } | ||
|
||
//Padrão em todos, acredito ser o que declara as funções que permitem escrever na linha?, faz sentido? | ||
DECLARE_WRITE_LINE_MEMBER( write_data0 ); | ||
|
||
|
||
protected: | ||
virtual void device_config_complete() override; | ||
virtual void device_start() override; | ||
|
||
devcb_write_line m_pin0_handler; | ||
|
||
private: | ||
device_patinho_feio_io_port_interface *m_dev; | ||
}; | ||
|
||
|
||
//Declaração da classe de interface de IO, n entendo pq tem uma diferença entre io_device, e io_interface, | ||
//tecnicamente eles n deveriam fazer a mesma coisa? | ||
//Pelo menos na centronics, o io_device só tem uma declaração de write_line_member para WRITE para cada pino, enquanto | ||
//no io_interface, tem uma declaração de write_line_member para input e output pra cada um, mas pq existe a declaração de write, | ||
//no io_device, se só tivesse as declarações de input e output no io_interface, e o io_device tivesse uma interface, | ||
//(O que ele tem, logo ali em cima da pra ver que *m_dev É uma io_interface), faria sentido, mas assim n faz muito | ||
//sentido na minha cabeça | ||
|
||
//Além do fato de input e output serem ambos DECLARE_****WRITE****, o que faz menos sentido ainda. | ||
class device_patinho_feio_io_interface : public device_slot_card_interface | ||
{ | ||
friend class patinho_feio_io_device; | ||
|
||
public: | ||
virtual ~device_patinho_feio_io_interface(); | ||
|
||
DECLARE_WRITE_LINE_MEMBER( output_pin0 ) { m_slot->m_pin0_handler(state); } | ||
|
||
protected: | ||
device_patinho_feio_io_interface(const machine_config &mconfig, device_t &device); | ||
|
||
virtual DECLARE_WRITE_LINE_MEMBER( input_pin0 ) { } | ||
|
||
device_patinho_feio_io *m_slot; | ||
}; | ||
|
||
void patinho_feio_io_devices(device_slot_interface &device); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acho que é bom remover o sufixo
_io
do nome do diretório e também dos arquivos.cpp
e.h
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entao, eu pus assim por causa do hp80, nele tem o driver la hp80.h e hp80.cpp na pasta mame/drivers, e tem hp80_io.h e hp80_io.cpp no /devices/bus, mas sei la
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
é... pode ser. Mas o nome do diretório tem que ser sem
_io
. Acho que no mínimo deveríamos mudar parasrc/devices/bus/patinhofeio/patinhofeio_io.cpp
esrc/devices/bus/patinhofeio/patinhofeio_io.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
felipesanches@c91f5e2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eu acho que você pode fazer:
É claro que esse commit é super simples, mas é um bom momento pra treinar esses métodos de colaboração com o git.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E pra ser sincero com você, eu nem sei se essa é a forma mais fácil, mas é um dos jeitos de se fazer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bus/patinhofeio/patinhofeio_io ficaria bom, vo tentar fazer isso aí que ce falou