1
0
mirror of synced 2024-11-12 16:18:52 +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;
for (hy=1;hy<=hyres;hy++) {
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;
cy = (((float)hy)/((float)hyres)-0.5)/magnify*3.0;
cx += xdelta;
@ -109,7 +106,6 @@ int main() {
\avr@instr@run
\avrdrawppm{mandelbrot.ppm}
\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;{%
\avr@hex@tobin{#1#2}{\avr@ihex@bytes}%
\avr@hex@tobin{#3#4#5#6}{\avr@ihex@address}%
@ -76,11 +80,7 @@
}
\newcommand{\avrloadihex}[1]{%
\avr@init%
\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@ones{11111111}
@ -282,9 +286,3 @@
\avr@count@tmpa=#2\relax%
\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
% mechanism
%
% This library can be used to draw graphics through IO ports
%
\newcount\avr@draw@x
\newcount\avr@draw@y

View File

@ -1,3 +1,7 @@
%
% This file contains all opcode implementations
%
\def\avr@log#1{%
\typeout{AVR (\the\avr@instr@executed): #1}%
}
@ -11,7 +15,6 @@
\errmessage{\the\avr@pc: #1}\bye%
}
\newif\ifavrbreak
\avrbreakfalse
\newcount\avr@instr@executed
@ -20,7 +23,21 @@
\avrbreakfalse%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$
% Execution Engine
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\avrstep}[1][1]{%
\avr@instr@steps{#1}%
}
\newcommand{\avrrun}{%
\avr@instr@run%
}
\newcommand{\avrsinglestep}{
\avr@instr@singlestep%
}
\def\avr@instr@step{%
\avr@code@get{\avr@instr@current}%
%\avr@reg@get{\csuse{avr@r24}}{\@@A}%
@ -33,11 +50,11 @@
\advance\avr@instr@executed by 1\relax%
}
\def\avr@singlestep{%
\def\avr@instr@singlestep{%
\avr@dump%
\typein{Press Enter to Step}%
\avr@instr@step%
\avr@singlestep%
\typein{Press Enter to Step}%
\avr@instr@step%
\avr@singlestep%
}
\newcount\avr@instr@steps
@ -69,6 +86,10 @@
\avr@instr@stepn@helper%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Opcode decoding
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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}{%
\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
\avr@code@load{#1}{\@@code}%
\avr@bin@and{\@@code}{1111110000001111}{\@@LDS}%
@ -149,7 +171,6 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Helpers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\avr@instr@gen@tworegs#1#2#3#4{%
\avr@bin@msb@del{#3}{\avr@ADD@dddd}{\avr@ADD@d}%
\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}%
\edef\@@X{\the\avr@count@tmpa}%
\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@reg@set{\avr@Rd}{#1#2#3#4#5}%
\avr@pc@inc%
@ -1374,9 +1395,3 @@
% Do not set the output register
\avr@pc@inc%
}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "avr.tex"
%%% End:

View File

@ -1,4 +1,6 @@
\makeatletter
%
% The IO subsystem
%
%% Bootup
\def\avr@init{%
@ -327,9 +329,3 @@
}%
\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
\def\avr@test@setup#1{%
\typeout{---- Test: #1 ----}%
\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{tabularx}