diff options
author | Karl Berry <karl@freefriends.org> | 2014-10-14 22:25:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-10-14 22:25:31 +0000 |
commit | 0db489324b44568fc4fdd9d194ce6d17203fae88 (patch) | |
tree | d14c24184a6da8bdbbb2886ac268350ce77fe1e5 /Master/texmf-dist/tex/latex/avremu/avr.io.tex | |
parent | 0f77752d377a5492ac8d36d73cb08ef7098dee64 (diff) |
avremu (14oct14)
git-svn-id: svn://tug.org/texlive/trunk@35373 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/avremu/avr.io.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/avremu/avr.io.tex | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/avremu/avr.io.tex b/Master/texmf-dist/tex/latex/avremu/avr.io.tex new file mode 100644 index 00000000000..c89f9d58686 --- /dev/null +++ b/Master/texmf-dist/tex/latex/avremu/avr.io.tex @@ -0,0 +1,122 @@ +%% Copyright (C) 2014 Christian Dietrich <stettberger@dokucode.de> +%% ------------------------------------------------------- +%% +%% This package may be distributed and/or modified under the conditions +%% of the LaTeX Project Public License, either version 1.3c of this +%% license or (at your option) any later version. The latest version of +%% this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008/05/04 or later. +%% +%% The IO Subsystem +%% + +\newcommand{\avrUDR}{% + \avr@UDR% +} +\newcommand{\avrUDRclear}{% + \def\avr@UDR{}% +} + +\def\avr@io@init{% + \def\avr@UDR{}% +} + +% OUT +\def\avr@instr@OUT#1#2#3{% A, R + \def\@@A{#2}% + \avr@bin@msb@del{\@@A}{\@@A}{\@@a}% + \avr@bin@msb@del{\@@A}{\@@A}{\@@b}% + \avr@code@set{10111\@@a\@@b#3\@@A}{#1}% +} + +\csdef{avr@instr@10111}#1#2#3#4#5#6#7#8\@nnil{% + \def\@@IOA{#1#2#8}% + \avr@reg@get{#3#4#5#6#7}{\avr@Rr}% + \avr@debug{OUT \@@IOA <- \avr@Rr}% + \avr@io@set{\avr@Rr}{\@@IOA}% + \avr@pc@inc% +} + +% IN +\def\avr@instr@IN#1#2#3{% A, R + \def\@@A{#2}% + \avr@bin@msb@del{\@@A}{\@@A}{\@@a}% + \avr@bin@msb@del{\@@A}{\@@A}{\@@b}% + \avr@code@set{10110\@@a\@@b#3\@@A}{#1}% +} + +\csdef{avr@instr@10110}#1#2#3#4#5#6#7#8\@nnil{% + \avr@debug{IN #1#2#8 -> #3#4#5#6#7}% + \edef\@@IOA{#1#2#8}% + \avr@io@get{\@@IOA}{\avr@Rr}% + \avr@reg@set{\avr@Rr}{#3#4#5#6#7}% + \avr@pc@inc% +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% IO Handlers +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% #1=Value, #2=Addr +\def\avr@io@set#1#2{% + \ifcsdef{avr@io@#2@set}{% + \csuse{avr@io@#2@set}{#1}% + }{% + \avr@io@set@default{#1}{#2}% + }% +} +% #1=Addr, #2=\result +\def\avr@io@get#1#2{% + \avr@debug{ IO R #1}% + \ifcsdef{avr@io@#1@get}{% + \csuse{avr@io@#1@get}{#2}% + }{% + \avr@io@get@default{#1}{#2}% + }% +} + +\def\avr@io@set@default#1#2{% + \avr@error{IO Port #2 is not defined (OUT <-#1)}% +} + +\def\avr@io@get@default#1#2{% + \avr@error{IO Port #1 is not defined (IN ->#2)}% +} + +\csdef{avr@io@111111@set}#1{% + \avr@debug{ SREG=#1}% + \avr@sreg@set{#1}% +} +\csdef{avr@io@111111@get}#1{\avr@sreg@get{#1}} + +% Stackpointer IO Ports +\csdef{avr@io@111110@set}#1{\avr@stack@SPH@set{#1}} +\csdef{avr@io@111101@set}#1{\avr@stack@SPL@set{#1}} +\csdef{avr@io@111110@get}#1{\avr@stack@SPH@get{#1}} +\csdef{avr@io@111101@get}#1{\avr@stack@SPL@get{#1}} + +\csdef{avr@io@001100@set}#1{% + \avr@bin@tocount{#1}{\avr@count@tmpa}% + \avr@ascii{\the\avr@count@tmpa}{\@@char}% + \avr@debug{UDR: \the\avr@count@tmpa}% + \xdef\avr@UDR{\avr@UDR \@@char}% +} + +% SPDR +\csdef{avr@io@001111@set}#1{% + \csdef{avr@io@001111}{#1}% +} + +\csdef{avr@io@001111@get}#1{% + \xdef#1{\csuse{avr@io@001111}}% +} + + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: "avr.tex" +%%% End: |