\documentclass[journal, a4paper]{IEEEtran}
% some very useful LaTeX packages include:
%\usepackage{cite}      % Written by Donald Arseneau
                        % V1.6 and later of IEEEtran pre-defines the format
                        % of the cite.sty package \cite{} output to follow
                        % that of IEEE. Loading the cite package will
                        % result in citation numbers being automatically
                        % sorted and properly "ranged". i.e.,
                        % [1], [9], [2], [7], [5], [6]
                        % (without using cite.sty)
                        % will become:
                        % [1], [2], [5]--[7], [9] (using cite.sty)
                        % cite.sty's \cite will automatically add leading
                        % space, if needed. Use cite.sty's noadjust option
                        % (cite.sty V3.8 and later) if you want to turn this
                        % off. cite.sty is already installed on most LaTeX
                        % systems. The latest version can be obtained at:
                        % http://www.ctan.org/tex-archive/macros/latex/contrib/supported/cite/
\usepackage{graphicx}   % Written by David Carlisle and Sebastian Rahtz
                        % Required if you want graphics, photos, etc.
                        % graphicx.sty is already installed on most LaTeX
                        % systems. The latest version and documentation can
                        % be obtained at:
                        % http://www.ctan.org/tex-archive/macros/latex/required/graphics/
                        % Another good source of documentation is "Using
                        % Imported Graphics in LaTeX2e" by Keith Reckdahl
                        % which can be found as esplatex.ps and epslatex.pdf
                        % at: http://www.ctan.org/tex-archive/info/
%\usepackage{psfrag}    % Written by Craig Barratt, Michael C. Grant,
                        % and David Carlisle
                        % This package allows you to substitute LaTeX
                        % commands for text in imported EPS graphic files.
                        % In this way, LaTeX symbols can be placed into
                        % graphics that have been generated by other
                        % applications. You must use latex->dvips->ps2pdf
                        % workflow (not direct pdf output from pdflatex) if
                        % you wish to use this capability because it works
                        % via some PostScript tricks. Alternatively, the
                        % graphics could be processed as separate files via
                        % psfrag and dvips, then converted to PDF for
                        % inclusion in the main file which uses pdflatex.
                        % Docs are in "The PSfrag System" by Michael C. Grant
                        % and David Carlisle. There is also some information
                        % about using psfrag in "Using Imported Graphics in
                        % LaTeX2e" by Keith Reckdahl which documents the
                        % graphicx package (see above). The psfrag package
                        % and documentation can be obtained at:
                        % http://www.ctan.org/tex-archive/macros/latex/contrib/supported/psfrag/
%\usepackage{subfigure} % Written by Steven Douglas Cochran
                        % This package makes it easy to put subfigures
                        % in your figures. i.e., "figure 1a and 1b"
                        % Docs are in "Using Imported Graphics in LaTeX2e"
                        % by Keith Reckdahl which also documents the graphicx
                        % package (see above). subfigure.sty is already
                        % installed on most LaTeX systems. The latest version
                        % and documentation can be obtained at:
                        % http://www.ctan.org/tex-archive/macros/latex/contrib/supported/subfigure/
\usepackage{url}        % Written by Donald Arseneau
                        % Provides better support for handling and breaking
                        % URLs. url.sty is already installed on most LaTeX
                        % systems. The latest version can be obtained at:
                        % http://www.ctan.org/tex-archive/macros/latex/contrib/other/misc/
                        % Read the url.sty source comments for usage information.
%\usepackage{stfloats}  % Written by Sigitas Tolusis
                        % Gives LaTeX2e the ability to do double column
                        % floats at the bottom of the page as well as the top.
                        % (e.g., "\begin{figure*}[!b]" is not normally
                        % possible in LaTeX2e). This is an invasive package
                        % which rewrites many portions of the LaTeX2e output
                        % routines. It may not work with other packages that
                        % modify the LaTeX2e output routine and/or with other
                        % versions of LaTeX. The latest version and
                        % documentation can be obtained at:
                        % http://www.ctan.org/tex-archive/macros/latex/contrib/supported/sttools/
                        % Documentation is contained in the stfloats.sty
                        % comments as well as in the presfull.pdf file.
                        % Do not use the stfloats baselinefloat ability as
                        % IEEE does not allow \baselineskip to stretch.
                        % Authors submitting work to the IEEE should note
                        % that IEEE rarely uses double column equations and
                        % that authors should try to avoid such use.
                        % Do not be tempted to use the cuted.sty or
                        % midfloat.sty package (by the same author) as IEEE
                        % does not format its papers in such ways.
\usepackage{amsmath}    % From the American Mathematical Society
                        % A popular package that provides many helpful commands
                        % for dealing with mathematics. Note that the AMSmath
                        % package sets \interdisplaylinepenalty to 10000 thus
                        % preventing page breaks from occurring within multiline
                        % equations. Use:
%\interdisplaylinepenalty=2500
                        % after loading amsmath to restore such page breaks
                        % as IEEEtran.cls normally does. amsmath.sty is already
                        % installed on most LaTeX systems. The latest version
                        % and documentation can be obtained at:
                        % http://www.ctan.org/tex-archive/macros/latex/required/amslatex/math/
\usepackage[utf8x]{inputenc}
\usepackage{subcaption}
% Other popular packages for formatting tables and equations include:
%\usepackage{array}
% Frank Mittelbach's and David Carlisle's array.sty which improves the
% LaTeX2e array and tabular environments to provide better appearances and
% additional user controls. array.sty is already installed on most systems.
% The latest version and documentation can be obtained at:
% http://www.ctan.org/tex-archive/macros/latex/required/tools/
% V1.6 of IEEEtran contains the IEEEeqnarray family of commands that can
% be used to generate multiline equations as well as matrices, tables, etc.
% Also of notable interest:
% Scott Pakin's eqparbox package for creating (automatically sized) equal
% width boxes. Available:
% http://www.ctan.org/tex-archive/macros/latex/contrib/supported/eqparbox/
% *** Do not adjust lengths that control margins, column widths, etc. ***
% *** Do not use packages that alter fonts (such as pslatex).         ***
% There should be no need to do such things with IEEEtran.cls V1.6 and later.
% Your document starts here!
\begin{document}
% Define document title and author
	\title{Jogo da Cobrinha em Assembly MIPS}
	\author{João Victor Bohrer Munhoz  //  Arthur da Silveira Couto // Caio Albuquerque Brandao
	\thanks{}}
	\markboth{ISC - Lamar}{}
	\maketitle
% Write abstract here
\begin{abstract}
O programa detalhado a seguir apresenta a jogo da cobrinha implementado em Assembly MIPS
\end{abstract}
% Each section begins with a \section{title} command
\section{Introdução}
	% \PARstart{}{} creates a tall first letter for this first paragraph
	\PARstart{E}{sse} trabalho apresenta uma reprodução do clássico jogo "Snake",  conhecido como o jogo da cobrinha, usando a linguagem Assembly do MIPS, através do programa MARS.  A seguir, estão especificados os métodos através dos quais o programa foi montado:
% Main Part
\section{Metodologia}
	\PARstart{O} trabalho foi executado no simulador MARS desenvolvido pela Missouri State University e programado na linguagem assembly MIPS. 
    
    \begin{figure}[htb]
  \begin{center}
   \includegraphics[width=1.0\linewidth]{Mars.png}
  \end{center}
  \caption{As duas ferramentas mais utilizadas do MARS nesse trabalho: o MMIO e o Bitmap Display}
  \label{fig:Matriz}
\end{figure}
    
    Usou-se uma matriz lógica de  40x30 linhas, formada de caracteres, declarada na memória estática.  A matriz lógica é usada em todo o programa para  representar a posição de cada elemento do jogo.
    
   \begin{figure}[htb]
  \begin{center}
   \includegraphics[width=1.0\linewidth]{Matriz.png}
  \end{center}
  \caption{Matriz 40x30}
  \label{fig:Matriz}
\end{figure}
    
    Os visuais da cobra, do cenário, da pontuação e da vida foram mostradas no bitmap display através de funções que imprimem bit a bit dentro de um espaço de 8x8 bits.  
   
\begin{figure}[htb]
  \begin{center}
   \includegraphics[width=1.0\linewidth]{jogo.png}
  \end{center}
  \caption{Tela printada do jogo, bit a bit,  no Bitmap display}
  \label{fig:03}
\end{figure}
    
    Os efeitos sonoros foram implementados através do syscall 31 (saída MIDI). O programa também usa o processo de polling, onde há a leitura da memória de entrada e saída (MMIO) também simulada no MARS. A cobra muda a sua direção de movimento quando for lida da memória uma entrada válida. O movimento constante da cobra se dará sempre que não for lida uma entrada válida. Para a implementação da velocidade da cobra foi usado o syscall sleep, para cada dificuldade foi usado um intervalo diferente de tempo. As vidas da cobra foram implementadas através de um contador. Toda vez que a cobra morre o contador decrementa e o programa lê a segunda matriz lógica, onde está salva a posição inicial do jogo, e recomeça o LOOP principal.   
	
\section{"Texturas"}
	\PARstart{D}{urante} a implementação do trabalho, percebemos que, apesar do jogo estar funcionando, visualmente, o trabalho parecia meio monótono, para isso, implementamos uma nova técnica de impressão no Bitmap display. Ao invés de pritarmos byte a byte, como geralmente é feito, printamos bit a bit. Isso nos permitiu fazer, através da variação de cores em um quadrado de 8x8 bits, fazer "texturas", como mostradas abaixo:
    
    \begin{figure}[htb]
  \begin{center}
   \includegraphics[scale=7]{grass.png}
  \end{center}
  \caption{Impressão bit a bit da "grama"}
  \label{fig:03}
\end{figure} 
\begin{figure}[htb]
  \begin{center}
   \includegraphics[scale=10]{Wall.png}
  \end{center}
  \caption{Impressão bit a bit da "parede de tijolos"}
  \label{fig:03}
\end{figure}
Além das coisas do cenário e dos corações para representar as vidas personalizamos também as próprias partes da cobra:
\begin{figure}[htb]
  \begin{center}
   \includegraphics[scale=10]{rabo.png}
  \end{center}
  \caption{Impressão bit a bit do "rabo" da cobra}
  \label{fig:03}
\end{figure}
\begin{figure}[htb]
  \begin{center}
   \includegraphics[scale=10]{corpo.png}
  \end{center}
  \caption{Impressão bit a bit do "corpo" da cobra}
  \label{fig:03}
\end{figure}
\begin{figure}[htb]
  \begin{center}
   \includegraphics[scale=10]{cabeca.png}
  \end{center}
  \caption{Impressão bit a bit da "cabeça" da cobra}
  \label{fig:03}
\end{figure}
\section{Resultados Obtidos}
	\PARstart{T}{endo} em vista os processos metodológicos descritos acima, chegamos ao resultado esperado, um jogo da cobrinha funcional rodando em uma base assembly MIPS. Entretanto, pelas limitações técnicas da IDE MARS e principalmente da linguagem de programação, o jogo apresenta alguns bugs, tais como dar uma leve travada quando a cobra come a comida, e depois de um tempo mais longo de funcionamento há possibilidade do jogo travar, provavelmente devido a quesitos de stackpile ou memória dando overflow.  
	% This is how you include a eps figure in your document. LaTeX only accepts EPS or TIFF files.
	
\section{Conclusão}
	\PARstart{A}{inda} que com alguns bugs, acreditamos que o trabalho foi realizado com sucesso, pois enquanto os erros foram por fatores externos ao código, o código em si funcionou como o esperado
% Now we need a bibliography:
\begin{thebibliography}{5}
	\bibitem{Proakis} % Book
	David Money Harris and Sarah L. Harris. {\em Digital Design and Computer Architecture}. Morgan Kaufmann.,
	Harvey Mudd College, USA, 2nd edition, 2012.
    
    \bibitem{Proakis} % Book
	Aula do Lamar
    
    \bibitem{Proakis} % Book
	F1 do MARS (Guia de referência do Assembly MIPS)
    
    \end{thebibliography}
% Your document ends here!
\end{document}