1
0
mirror of synced 2024-11-22 04:54:24 +01:00

Small cleanup

This commit is contained in:
Christian Dietrich 2014-10-09 16:51:34 +02:00
parent 5a255d239e
commit 51e2a244bb
8 changed files with 45 additions and 39 deletions

View File

@ -68,9 +68,6 @@ int main() {
uint8_t i; uint8_t i;
for (hy=1;hy<=hyres;hy++) { for (hy=1;hy<=hyres;hy++) {
for (hx=1;hx<=hxres;hx++) { for (hx=1;hx<=hxres;hx++) {
setcolor(hx * 100, 255, 0);
dot(hx-1, hy-1);
continue;
cx = (((float)hx)/((float)hxres)-0.5)/magnify*3.0-0.7; cx = (((float)hx)/((float)hxres)-0.5)/magnify*3.0-0.7;
cy = (((float)hy)/((float)hyres)-0.5)/magnify*3.0; cy = (((float)hy)/((float)hyres)-0.5)/magnify*3.0;
cx += xdelta; cx += xdelta;
@ -109,7 +106,6 @@ int main() {
\avr@instr@run \avr@instr@run
\avrdrawppm{mandelbrot.ppm} \avrdrawppm{mandelbrot.ppm}
\immediate\write18{convert mandelbrot.ppm mandelbrot.png} \immediate\write18{convert mandelbrot.ppm mandelbrot.png}

View File

@ -1,3 +1,7 @@
%
% This interacts with the avr-gcc and provides a loader for ihex files
%
\def\avr@ihex@parse@line:#1#2#3#4#5#6#7#8#9;{% \def\avr@ihex@parse@line:#1#2#3#4#5#6#7#8#9;{%
\avr@hex@tobin{#1#2}{\avr@ihex@bytes}% \avr@hex@tobin{#1#2}{\avr@ihex@bytes}%
\avr@hex@tobin{#3#4#5#6}{\avr@ihex@address}% \avr@hex@tobin{#3#4#5#6}{\avr@ihex@address}%
@ -76,11 +80,7 @@
} }
\newcommand{\avrloadihex}[1]{% \newcommand{\avrloadihex}[1]{%
\avr@init%
\avr@ihex@load{#1}% \avr@ihex@load{#1}%
} }
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

View File

@ -1,3 +1,7 @@
%
% This file contains the basic binary operations
%
\def\avr@zeroes{00000000} \def\avr@zeroes{00000000}
\def\avr@ones{11111111} \def\avr@ones{11111111}
@ -282,9 +286,3 @@
\avr@count@tmpa=#2\relax% \avr@count@tmpa=#2\relax%
\expandafter\avr@bin@shiftright@helper\@tempa\@nnil% \expandafter\avr@bin@shiftright@helper\@tempa\@nnil%
} }
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "avr.tex"
%%% End:

View File

@ -1,6 +1,6 @@
%
% We define 2 IO Registers to communicate from AVR to the Drawing % This library can be used to draw graphics through IO ports
% mechanism %
\newcount\avr@draw@x \newcount\avr@draw@x
\newcount\avr@draw@y \newcount\avr@draw@y

View File

@ -1,3 +1,7 @@
%
% This file contains all opcode implementations
%
\def\avr@log#1{% \def\avr@log#1{%
\typeout{AVR (\the\avr@instr@executed): #1}% \typeout{AVR (\the\avr@instr@executed): #1}%
} }
@ -11,7 +15,6 @@
\errmessage{\the\avr@pc: #1}\bye% \errmessage{\the\avr@pc: #1}\bye%
} }
\newif\ifavrbreak \newif\ifavrbreak
\avrbreakfalse \avrbreakfalse
\newcount\avr@instr@executed \newcount\avr@instr@executed
@ -20,7 +23,21 @@
\avrbreakfalse% \avrbreakfalse%
} }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$
% Execution Engine % Execution Engine
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\avrstep}[1][1]{%
\avr@instr@steps{#1}%
}
\newcommand{\avrrun}{%
\avr@instr@run%
}
\newcommand{\avrsinglestep}{
\avr@instr@singlestep%
}
\def\avr@instr@step{% \def\avr@instr@step{%
\avr@code@get{\avr@instr@current}% \avr@code@get{\avr@instr@current}%
%\avr@reg@get{\csuse{avr@r24}}{\@@A}% %\avr@reg@get{\csuse{avr@r24}}{\@@A}%
@ -33,11 +50,11 @@
\advance\avr@instr@executed by 1\relax% \advance\avr@instr@executed by 1\relax%
} }
\def\avr@singlestep{% \def\avr@instr@singlestep{%
\avr@dump% \avr@dump%
\typein{Press Enter to Step}% \typein{Press Enter to Step}%
\avr@instr@step% \avr@instr@step%
\avr@singlestep% \avr@singlestep%
} }
\newcount\avr@instr@steps \newcount\avr@instr@steps
@ -69,6 +86,10 @@
\avr@instr@stepn@helper% \avr@instr@stepn@helper%
} }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Opcode decoding
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\avr@instr@dispatch#1#2#3#4#5#6#7#8#9\@nnil{% \def\avr@instr@dispatch#1#2#3#4#5#6#7#8#9\@nnil{%
\ifcsdef{avr@instr@#1#2#3#4#5#6#7#8#9}{% \ifcsdef{avr@instr@#1#2#3#4#5#6#7#8#9}{%
\csuse{avr@instr@#1#2#3#4#5#6#7#8#9}\@nnil% \csuse{avr@instr@#1#2#3#4#5#6#7#8#9}\@nnil%
@ -125,6 +146,7 @@
}% }%
} }
% How long is a specific instruction (for Skip one instr)
\def\avr@instr@length#1#2{% Addr, Length \def\avr@instr@length#1#2{% Addr, Length
\avr@code@load{#1}{\@@code}% \avr@code@load{#1}{\@@code}%
\avr@bin@and{\@@code}{1111110000001111}{\@@LDS}% \avr@bin@and{\@@code}{1111110000001111}{\@@LDS}%
@ -149,7 +171,6 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Helpers % Helpers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\avr@instr@gen@tworegs#1#2#3#4{% \def\avr@instr@gen@tworegs#1#2#3#4{%
\avr@bin@msb@del{#3}{\avr@ADD@dddd}{\avr@ADD@d}% \avr@bin@msb@del{#3}{\avr@ADD@dddd}{\avr@ADD@d}%
\avr@bin@msb@del{#4}{\avr@ADD@rrrr}{\avr@ADD@r}% \avr@bin@msb@del{#4}{\avr@ADD@rrrr}{\avr@ADD@r}%
@ -1204,7 +1225,7 @@
\avr@reg@get{#1#2#3#4#5}{\avr@Rd}% \avr@reg@get{#1#2#3#4#5}{\avr@Rd}%
\edef\@@X{\the\avr@count@tmpa}% \edef\@@X{\the\avr@count@tmpa}%
\avr@flag@get T \@@T% \avr@flag@get T \@@T%
\avr@debug{BLD #1#2#3#4#5(=\avr@Rd) |= \@@T<<\@@X}% \avr@debug{BLD #1#2#3#4#5(=\avr@Rd) |= \@@T<<\@@X}%|
\avr@bin@setbit{\avr@Rd}{\@@X}{\@@T}{\avr@Rd}% \avr@bin@setbit{\avr@Rd}{\@@X}{\@@T}{\avr@Rd}%
\avr@reg@set{\avr@Rd}{#1#2#3#4#5}% \avr@reg@set{\avr@Rd}{#1#2#3#4#5}%
\avr@pc@inc% \avr@pc@inc%
@ -1374,9 +1395,3 @@
% Do not set the output register % Do not set the output register
\avr@pc@inc% \avr@pc@inc%
} }
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "avr.tex"
%%% End:

View File

@ -1,4 +1,6 @@
\makeatletter %
% The IO subsystem
%
%% Bootup %% Bootup
\def\avr@init{% \def\avr@init{%
@ -327,9 +329,3 @@
}% }%
\avr@debug{ MEM R *#1==#2}% \avr@debug{ MEM R *#1==#2}%
} }
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "avr.tex"
%%% End:

View File

@ -1,5 +1,4 @@
%% These Functions are used within the test-suite %% These Functions are used within the test-suite
\def\avr@test@setup#1{% \def\avr@test@setup#1{%
\typeout{---- Test: #1 ----}% \typeout{---- Test: #1 ----}%
\typeout{-> Initialize the AVR}% \typeout{-> Initialize the AVR}%

View File

@ -1,3 +1,5 @@
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{avremu} [2014/10/09 v0.1 avremu]
\RequirePackage{etoolbox} \RequirePackage{etoolbox}
\RequirePackage{tabularx} \RequirePackage{tabularx}