Skip to content
Snippets Groups Projects
Commit eb8552bd authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Beispiele 11.5.2021

parent 00d64d56
No related branches found
No related tags found
No related merge requests found
Showing with 1077 additions and 1 deletion
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
% Attribution-ShareAlike 3.0 Unported License along with this % Attribution-ShareAlike 3.0 Unported License along with this
% document. If not, see <http://creativecommons.org/licenses/>. % document. If not, see <http://creativecommons.org/licenses/>.
% README: Computer-Sprachen: Arduino % README: Computer-Sprachen, Programmieren in Assembler: PC
\documentclass[10pt,t]{beamer} \documentclass[10pt,t]{beamer}
......
%.s: %.c
avr-gcc -Wall -Os -mmcu=atmega328p $< -S -o $@
%.elf: %.c
avr-gcc -Wall -Os -mmcu=atmega328p $< -o $@
%.hex: %.elf
avr-objcopy -O ihex $< $@
download:
./download.sh
# 1 "blink-0.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "blink-0.c"
# 1 "/usr/lib/avr/include/avr/io.h" 1 3
# 99 "/usr/lib/avr/include/avr/io.h" 3
# 1 "/usr/lib/avr/include/avr/sfr_defs.h" 1 3
# 126 "/usr/lib/avr/include/avr/sfr_defs.h" 3
# 1 "/usr/lib/avr/include/inttypes.h" 1 3
# 37 "/usr/lib/avr/include/inttypes.h" 3
# 1 "/usr/lib/gcc/avr/5.4.0/include/stdint.h" 1 3 4
# 9 "/usr/lib/gcc/avr/5.4.0/include/stdint.h" 3 4
# 1 "/usr/lib/avr/include/stdint.h" 1 3 4
# 125 "/usr/lib/avr/include/stdint.h" 3 4
# 125 "/usr/lib/avr/include/stdint.h" 3 4
typedef signed int int8_t __attribute__((__mode__(__QI__)));
typedef unsigned int uint8_t __attribute__((__mode__(__QI__)));
typedef signed int int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int uint16_t __attribute__ ((__mode__ (__HI__)));
typedef signed int int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int uint32_t __attribute__ ((__mode__ (__SI__)));
typedef signed int int64_t __attribute__((__mode__(__DI__)));
typedef unsigned int uint64_t __attribute__((__mode__(__DI__)));
# 146 "/usr/lib/avr/include/stdint.h" 3 4
typedef int16_t intptr_t;
typedef uint16_t uintptr_t;
# 163 "/usr/lib/avr/include/stdint.h" 3 4
typedef int8_t int_least8_t;
typedef uint8_t uint_least8_t;
typedef int16_t int_least16_t;
typedef uint16_t uint_least16_t;
typedef int32_t int_least32_t;
typedef uint32_t uint_least32_t;
typedef int64_t int_least64_t;
typedef uint64_t uint_least64_t;
# 217 "/usr/lib/avr/include/stdint.h" 3 4
typedef int8_t int_fast8_t;
typedef uint8_t uint_fast8_t;
typedef int16_t int_fast16_t;
typedef uint16_t uint_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast32_t;
typedef int64_t int_fast64_t;
typedef uint64_t uint_fast64_t;
# 277 "/usr/lib/avr/include/stdint.h" 3 4
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
# 10 "/usr/lib/gcc/avr/5.4.0/include/stdint.h" 2 3 4
# 38 "/usr/lib/avr/include/inttypes.h" 2 3
# 77 "/usr/lib/avr/include/inttypes.h" 3
typedef int32_t int_farptr_t;
typedef uint32_t uint_farptr_t;
# 127 "/usr/lib/avr/include/avr/sfr_defs.h" 2 3
# 100 "/usr/lib/avr/include/avr/io.h" 2 3
# 272 "/usr/lib/avr/include/avr/io.h" 3
# 1 "/usr/lib/avr/include/avr/iom328p.h" 1 3
# 273 "/usr/lib/avr/include/avr/io.h" 2 3
# 627 "/usr/lib/avr/include/avr/io.h" 3
# 1 "/usr/lib/avr/include/avr/portpins.h" 1 3
# 628 "/usr/lib/avr/include/avr/io.h" 2 3
# 1 "/usr/lib/avr/include/avr/common.h" 1 3
# 630 "/usr/lib/avr/include/avr/io.h" 2 3
# 1 "/usr/lib/avr/include/avr/version.h" 1 3
# 632 "/usr/lib/avr/include/avr/io.h" 2 3
# 1 "/usr/lib/avr/include/avr/fuse.h" 1 3
# 239 "/usr/lib/avr/include/avr/fuse.h" 3
typedef struct
{
unsigned char low;
unsigned char high;
unsigned char extended;
} __fuse_t;
# 639 "/usr/lib/avr/include/avr/io.h" 2 3
# 1 "/usr/lib/avr/include/avr/lock.h" 1 3
# 642 "/usr/lib/avr/include/avr/io.h" 2 3
# 2 "blink-0.c" 2
# 3 "blink-0.c"
int main (void)
{
# 5 "blink-0.c" 3
(*(volatile uint8_t *)((0x0A) + 0x20))
# 5 "blink-0.c"
= 0x7c;
# 6 "blink-0.c" 3
(*(volatile uint8_t *)((0x0B) + 0x20))
# 6 "blink-0.c"
= 0x40;
while (1);
return 0;
}
#include <avr/io.h>
int main (void)
{
DDRD = 0x7c; /* binär: 0111 1100 */ /* DDR = Data Direction Register */
PORTD = 0x40; /* binär: 0100 0000 */ /* 0 = input, 1 = output */
while (1)
/* just wait */; /* Endlosschleife */
return 0;
}
:100000000C9434000C943E000C943E000C943E0082
:100010000C943E000C943E000C943E000C943E0068
:100020000C943E000C943E000C943E000C943E0058
:100030000C943E000C943E000C943E000C943E0048
:100040000C943E000C943E000C943E000C943E0038
:100050000C943E000C943E000C943E000C943E0028
:100060000C943E000C943E0011241FBECFEFD8E04C
:10007000DEBFCDBF0E9440000C9445000C940000F0
:0E0080008CE78AB980E48BB9FFCFF894FFCFEC
:00000001FF
:100000000C9434000C943E000C943E000C943E0082
:100010000C943E000C943E000C943E000C943E0068
:100020000C943E000C943E000C943E000C943E0058
:100030000C943E000C943E000C943E000C943E0048
:100040000C943E000C943E000C943E000C943E0038
:100050000C943E000C943E000C943E000C943E0028
:100060000C943E000C943E0011241FBECFEFD8E04C
:10007000DEBFCDBF0E9440000C9445000C940000F0
:0E0080008CE78AB980E08BB9FFCFF894FFCFF0
:00000001FF
.section .text.startup,"ax",@progbits
.global main
main:
ldi r24,0x7c
out 0xa,r24
ldi r24,0x00
out 0xb,r24
.L2:
rjmp .L2
.file "blink-1.c"
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__SREG__ = 0x3f
__tmp_reg__ = 0
__zero_reg__ = 1
.global __mulsf3
.global __ltsf2
.global __gtsf2
.global __fixunssfsi
.text
.global main
.type main, @function
main:
push r28
push r29
in r28,__SP_L__
in r29,__SP_H__
sbiw r28,28
in __tmp_reg__,__SREG__
cli
out __SP_H__,r29
out __SREG__,__tmp_reg__
out __SP_L__,r28
/* prologue: function */
/* frame size = 28 */
/* stack size = 30 */
.L__stack_usage = 30
ldi r24,lo8(42)
ldi r25,0
ldi r18,lo8(124)
movw r30,r24
st Z,r18
ldi r24,lo8(43)
ldi r25,0
ldi r18,lo8(43)
ldi r19,0
movw r30,r18
ld r18,Z
ori r18,lo8(64)
movw r30,r24
st Z,r18
.L18:
ldi r24,0
ldi r25,0
ldi r26,lo8(-6)
ldi r27,lo8(67)
std Y+1,r24
std Y+2,r25
std Y+3,r26
std Y+4,r27
ldi r18,0
ldi r19,0
ldi r20,lo8(122)
ldi r21,lo8(69)
ldd r22,Y+1
ldd r23,Y+2
ldd r24,Y+3
ldd r25,Y+4
call __mulsf3
movw r26,r24
movw r24,r22
std Y+19,r24
std Y+20,r25
std Y+21,r26
std Y+22,r27
ldi r18,0
ldi r19,0
ldi r20,lo8(-128)
ldi r21,lo8(63)
ldd r22,Y+19
ldd r23,Y+20
ldd r24,Y+21
ldd r25,Y+22
call __ltsf2
tst r24
brge .L23
ldi r24,lo8(1)
ldi r25,0
std Y+24,r25
std Y+23,r24
rjmp .L4
.L23:
ldi r18,0
ldi r19,lo8(-1)
ldi r20,lo8(127)
ldi r21,lo8(71)
ldd r22,Y+19
ldd r23,Y+20
ldd r24,Y+21
ldd r25,Y+22
call __gtsf2
cp __zero_reg__,r24
brge .L24
ldi r18,0
ldi r19,0
ldi r20,lo8(32)
ldi r21,lo8(65)
ldd r22,Y+1
ldd r23,Y+2
ldd r24,Y+3
ldd r25,Y+4
call __mulsf3
movw r26,r24
movw r24,r22
movw r22,r24
movw r24,r26
call __fixunssfsi
movw r26,r24
movw r24,r22
std Y+24,r25
std Y+23,r24
rjmp .L7
.L8:
ldi r24,lo8(-112)
ldi r25,lo8(1)
std Y+26,r25
std Y+25,r24
ldd r24,Y+25
ldd r25,Y+26
/* #APP */
; 105 "/usr/lib/avr/include/util/delay_basic.h" 1
1: sbiw r24,1
brne 1b
; 0 "" 2
/* #NOAPP */
std Y+26,r25
std Y+25,r24
ldd r24,Y+23
ldd r25,Y+24
sbiw r24,1
std Y+24,r25
std Y+23,r24
.L7:
ldd r24,Y+23
ldd r25,Y+24
or r24,r25
brne .L8
rjmp .L9
.L24:
ldd r22,Y+19
ldd r23,Y+20
ldd r24,Y+21
ldd r25,Y+22
call __fixunssfsi
movw r26,r24
movw r24,r22
std Y+24,r25
std Y+23,r24
.L4:
ldd r24,Y+23
ldd r25,Y+24
std Y+28,r25
std Y+27,r24
ldd r24,Y+27
ldd r25,Y+28
/* #APP */
; 105 "/usr/lib/avr/include/util/delay_basic.h" 1
1: sbiw r24,1
brne 1b
; 0 "" 2
/* #NOAPP */
std Y+28,r25
std Y+27,r24
.L9:
ldi r24,lo8(43)
ldi r25,0
ldi r18,lo8(43)
ldi r19,0
movw r30,r18
ld r18,Z
andi r18,lo8(-65)
movw r30,r24
st Z,r18
ldi r24,0
ldi r25,0
ldi r26,lo8(-6)
ldi r27,lo8(67)
std Y+5,r24
std Y+6,r25
std Y+7,r26
std Y+8,r27
ldi r18,0
ldi r19,0
ldi r20,lo8(122)
ldi r21,lo8(69)
ldd r22,Y+5
ldd r23,Y+6
ldd r24,Y+7
ldd r25,Y+8
call __mulsf3
movw r26,r24
movw r24,r22
std Y+9,r24
std Y+10,r25
std Y+11,r26
std Y+12,r27
ldi r18,0
ldi r19,0
ldi r20,lo8(-128)
ldi r21,lo8(63)
ldd r22,Y+9
ldd r23,Y+10
ldd r24,Y+11
ldd r25,Y+12
call __ltsf2
tst r24
brge .L25
ldi r24,lo8(1)
ldi r25,0
std Y+14,r25
std Y+13,r24
rjmp .L12
.L25:
ldi r18,0
ldi r19,lo8(-1)
ldi r20,lo8(127)
ldi r21,lo8(71)
ldd r22,Y+9
ldd r23,Y+10
ldd r24,Y+11
ldd r25,Y+12
call __gtsf2
cp __zero_reg__,r24
brge .L26
ldi r18,0
ldi r19,0
ldi r20,lo8(32)
ldi r21,lo8(65)
ldd r22,Y+5
ldd r23,Y+6
ldd r24,Y+7
ldd r25,Y+8
call __mulsf3
movw r26,r24
movw r24,r22
movw r22,r24
movw r24,r26
call __fixunssfsi
movw r26,r24
movw r24,r22
std Y+14,r25
std Y+13,r24
rjmp .L15
.L16:
ldi r24,lo8(-112)
ldi r25,lo8(1)
std Y+16,r25
std Y+15,r24
ldd r24,Y+15
ldd r25,Y+16
/* #APP */
; 105 "/usr/lib/avr/include/util/delay_basic.h" 1
1: sbiw r24,1
brne 1b
; 0 "" 2
/* #NOAPP */
std Y+16,r25
std Y+15,r24
ldd r24,Y+13
ldd r25,Y+14
sbiw r24,1
std Y+14,r25
std Y+13,r24
.L15:
ldd r24,Y+13
ldd r25,Y+14
or r24,r25
brne .L16
rjmp .L17
.L26:
ldd r22,Y+9
ldd r23,Y+10
ldd r24,Y+11
ldd r25,Y+12
call __fixunssfsi
movw r26,r24
movw r24,r22
std Y+14,r25
std Y+13,r24
.L12:
ldd r24,Y+13
ldd r25,Y+14
std Y+18,r25
std Y+17,r24
ldd r24,Y+17
ldd r25,Y+18
/* #APP */
; 105 "/usr/lib/avr/include/util/delay_basic.h" 1
1: sbiw r24,1
brne 1b
; 0 "" 2
/* #NOAPP */
std Y+18,r25
std Y+17,r24
.L17:
ldi r24,lo8(43)
ldi r25,0
ldi r18,lo8(43)
ldi r19,0
movw r30,r18
ld r18,Z
ori r18,lo8(64)
movw r30,r24
st Z,r18
rjmp .L18
.size main, .-main
.ident "GCC: (GNU) 5.4.0"
:100000000C9434000C943E000C943E000C943E0082
:100010000C943E000C943E000C943E000C943E0068
:100020000C943E000C943E000C943E000C943E0058
:100030000C943E000C943E000C943E000C943E0048
:100040000C943E000C943E000C943E000C943E0038
:100050000C943E000C943E000C943E000C943E0028
:100060000C943E000C943E0011241FBECFEFD8E04C
:10007000DEBFCDBF0E9440000C9453000C940000E2
:100080008CE78AB95E9A2FEF89E698E1215080408B
:100090009040E1F75E982FEF89E698E1215080408B
:0A00A0009040E1F7EFCFF894FFCF96
:00000001FF
.section .text.startup
.global main
main:
ldi r24,0x7c
out 0xa,r24 ; DDRD = 0x7c: verwende die 1-Bits in 0x7c als Ouputs
loop:
sbi 0xb,6 ; setze Bit 6 auf PORTD ("set bit"), schalte LED ein
ldi r18,lo8(1599999)
ldi r24,hi8(1599999)
ldi r25,hlo8(1599999)
wait1: subi r18,1
sbci r24,0
sbci r25,0
brne wait1
cbi 0xb,6 ; lösche Bit 6 auf PORTD ("clear bit"), schalte LED aus
ldi r18,lo8(1599999)
ldi r24,hi8(1599999)
ldi r25,hlo8(1599999)
wait2: subi r18,1
sbci r24,0
sbci r25,0
brne wait2
rjmp loop
port=$(ls -rt /dev/ttyACM* | tail -1)
echo avrdude -P $port -c arduino -p m328p -U flash:w:$(ls -rt *.hex | tail -1)
avrdude -P $port -c arduino -p m328p -U flash:w:$(ls -rt *.hex | tail -1) 2>/dev/null
../20210503/screenshot-20210503-181001.png
\ No newline at end of file
../common/logo-hochschule-bochum-cvh-text-v2.pdf
\ No newline at end of file
../common/logo-hochschule-bochum.pdf
\ No newline at end of file
../common/pgslides.sty
\ No newline at end of file
File added
% rtech-20210511.pdf - Lecture Slides on Computer Technology
% Copyright (C) 2012, 2013, 2014, 2021 Peter Gerwinski
%
% This document is free software: you can redistribute it and/or
% modify it either under the terms of the Creative Commons
% Attribution-ShareAlike 3.0 License, or under the terms of the
% GNU General Public License as published by the Free Software
% Foundation, either version 3 of the License, or (at your option)
% any later version.
%
% This document is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this document. If not, see <http://www.gnu.org/licenses/>.
%
% You should have received a copy of the Creative Commons
% Attribution-ShareAlike 3.0 Unported License along with this
% document. If not, see <http://creativecommons.org/licenses/>.
% README: Programmieren in Assembler: Arduino
\documentclass[10pt,t]{beamer}
\usepackage{pgslides}
\usepackage{pdftricks}
\newcommand{\Cin}{C\raisebox{-0.5ex}{\footnotesize in}}
\newcommand{\Cout}{C\raisebox{-0.5ex}{\footnotesize out}}
\begin{psinputs}
\usepackage[latin1]{inputenc}
\usepackage[german]{babel}
\usepackage[T1]{fontenc}
\usepackage{helvet}
\renewcommand*\familydefault{\sfdefault}
\usepackage{pstricks,pst-grad,pst-circ-pg}
\newcommand{\invisible}{\tiny\color{white}}
\psset{unit=1cm}
\psset{logicLabelstyle=\invisible}
\newcommand{\logicSymbol}{\small\boldmath\bf\rule{0pt}{0.5cm}}
\psset{logicSymbolstyle=\logicSymbol}
\newcommand{\Cin}{C\raisebox{-0.5ex}{\footnotesize in}}
\newcommand{\Cout}{C\raisebox{-0.5ex}{\footnotesize out}}
\end{psinputs}
\title{Rechnertechnik}
\author{Prof.\ Dr.\ rer.\ nat.\ Peter Gerwinski}
\date{11.\ Mai 2021}
\begin{document}
\maketitleframe
\sectionnonumber{\inserttitle}
\begin{frame}
\showsectionnonumber
\begin{itemize}
\item[\textbf{1}] \textbf{Einführung}
\item[\textbf{2}] \textbf{Vom Schaltkreis zum Computer}
\begin{itemize}
\item[2.1] Logik-Schaltkreise
\item[2.2] Binärdarstellung von Zahlen
\item[2.3] Vom Logik-Schaltkreis zum Addierer
\item[2.4] Negative Zahlen
\item[2.5] Vom Addierer zum Computer
\item[2.6] Computer-Sprachen
\color{orange}
\item[2.7] Programmieren in Assembler
\end{itemize}
\color{gray}
\item[\textbf{3}] \textbf{Architekturmerkmale von Prozessoren}
\item[\textbf{4}] \textbf{Der CPU-Stack}
% \item[\textbf{5}] \textbf{Hardwarenahe Programmierung}
% \item[\textbf{6}] \textbf{Anwender-Software}
% \item[\textbf{7}] \textbf{Bus-Systeme}
% \item[\textbf{8}] \textbf{Pipelining}
\item[\textbf{\dots\hspace{-0.75em}}]
% \item[\textbf{9}] \textbf{Ausblick}
\end{itemize}
\end{frame}
\setcounter{section}{1}
\section{Vom Schaltkreis zum Computer}
\setcounter{subsection}{5}
\subsection{Computer-Sprachen}
\subsubsection{Maschinensprache}
\begin{frame}
\showsubsection
\showsubsubsection
\strut\hfill
\begin{minipage}{6.5cm}
\vspace*{-1.7cm}
\small
Computer
\begin{itemize}\itemsep0pt
\item Rechenwerk (ALU)
\item Speicher: Register,\\
adressierbarer Hauptspeicher
\item Takt: Befehle abarbeiten
\item Peripherie: Kommunikation\\
mit der Außenwelt
\arrowitem in Maschinensprache programmierbar
\end{itemize}
\end{minipage}\hspace*{-0.5cm}
In jedem Takt:
\begin{itemize}
\item
dort aus dem Hauptspeicher lesen, wohin das Register \lstinline{IP} zeigt\\
\textarrow\ \newterm{Befehl\/} (\newterm{Instruction\/} -- \lstinline{IP} = \newterm{Instruction Pointer\/})
\item
den \newterm{Befehl\/} an den \newterm{Funktion\/}-Eingang der \newterm{ALU\/} legen
\item
auf ähnliche Weise weitere Daten an den \newterm{Akkumulator\/}-\\
und den \newterm{Daten\/}-Eingang der \newterm{ALU\/} legen
\item
auf ähnliche Weise den \newterm{Ergebnis\/}-Ausgang der \newterm{ALU}\\
in den Hauptspeicher schreiben
\textarrow\ Befehl ausgeführt
\item
Register \lstinline{IP} hochzählen
\textarrow\ nächster Befehl
\arrowitem
Maschinensprache
\end{itemize}
\end{frame}
\begin{frame}
\showsubsection
\showsubsubsection
\begin{itemize}
\item
Daten aus dem Speicher in Register einlesen
\item
Daten aus Register in den Speicher schreiben
\arrowitem
Lade- und Speicher-Befehle
\item
Daten aus Registern (oder Speicher) an ALU legen,\\
Ergebnis in Register (oder Speicher) schreiben
\arrowitem
arithmetische Befehle
% \pause
\item
Daten aus Register oder Speicher in das \lstinline{IP}-Register laden
\arrowitem
\only<1->{unbedingter }Sprungbefehl
% \pause
\item
Sprungbefehl nur dann, wenn im Status-Ausgang der ALU ein bestimmtes Bit gesetzt ist
\arrowitem
bedingter Sprungbefehl
% \pause
% \pause
\bigskip
\arrowitem
Der Computer kann "`alles"' -- \newterm{Turing-Vollständigkeit}
\end{itemize}
\end{frame}
\begin{frame}
\showsubsection
\showsubsubsection
\begin{itemize}
\item
Lade- und Speicher-Befehle\\
arithmetische Befehle\\
unbedingte und bedingte Sprungbefehle
\arrowitem
Der Computer kann "`alles"' -- \newterm{Turing-Vollständigkeit}
\bigskip
\item
Maschinensprache = Zahlen \textarrow\ für Menschen schwer handhabbar
\arrowitem
Namen für die Befehle: \newterm{Mnemonics}
\arrowitem
\newterm{Assembler\/}-Sprache
\end{itemize}
\end{frame}
\subsubsection{\strut{\protect\color{gray}Maschinensprache \protect\textarrow\ }Assembler}
\begin{frame}[fragile]
\showsubsubsection
Beispiel: Intel-x86-16-Bit-Assembler
\begin{itemize}
\item
Lade- und Speicher-Befehle\hfill
\lstinline{mov}, \dots\\
arithmetische Befehle\hfill
\lstinline{add}, \lstinline{sub}, \lstinline{inc}, \lstinline{dec},
\lstinline{xor}, \lstinline{cmp}, \dots\\
unbedingte und bedingte Sprungbefehle\hfill
\lstinline{jmp}, \lstinline{jz}, \lstinline{jae}, \dots
\item
Register\hfill
\lstinline{ax}, \lstinline{bx}, \dots
\end{itemize}
\bigskip
Beispiel: Atmel-AVR-8-Bit-Assembler
\begin{itemize}
\item
Lade- und Speicher-Befehle\hfill
\lstinline{ldi}, \lstinline{lds}, \lstinline{sti}, \dots\\
arithmetische Befehle\hfill
\lstinline{add}, \lstinline{sub}, \lstinline{subi},
\lstinline{eor}, \lstinline{cp}, \dots\\
unbedingte und bedingte Sprungbefehle\hfill
\lstinline{rjmp}, \lstinline{brsh}, \lstinline{brlo}, \dots
\item
Register\hfill
\lstinline{r0}, \lstinline{r1}, \dots
\end{itemize}
\bigskip
\textarrow\ für jeden Prozessor anders
\end{frame}
\subsubsection{\strut{\protect\color{gray}Maschinensprache \protect\textarrow\ Assembler \protect\textarrow\ }Hochsprachen}
\begin{frame}[fragile]
\showsubsubsection
Beispiel: Intel-x86-16-Bit-Assembler
\begin{itemize}
\item
Lade- und Speicher-Befehle\hfill
\lstinline{mov}, \dots\\
arithmetische Befehle\hfill
\lstinline{add}, \lstinline{sub}, \lstinline{inc}, \lstinline{dec},
\lstinline{xor}, \lstinline{cmp}, \dots\\
unbedingte und bedingte Sprungbefehle\hfill
\lstinline{jmp}, \lstinline{jz}, \lstinline{jae}, \dots
\item
Register\hfill
\lstinline{ax}, \lstinline{bx}, \dots
\end{itemize}
\bigskip
Beispiel: Atmel-AVR-8-Bit-Assembler
\begin{itemize}
\item
Lade- und Speicher-Befehle\hfill
\lstinline{ldi}, \lstinline{lds}, \lstinline{sti}, \dots\\
arithmetische Befehle\hfill
\lstinline{add}, \lstinline{sub}, \lstinline{subi},
\lstinline{eor}, \lstinline{cp}, \dots\\
unbedingte und bedingte Sprungbefehle\hfill
\lstinline{rjmp}, \lstinline{brsh}, \lstinline{brlo}, \dots
\item
Register\hfill
\lstinline{r0}, \lstinline{r1}, \dots
\end{itemize}
\bigskip
\textarrow\ für jeden Prozessor anders
\bigskip
Hochsprache \textarrow\ für jeden Prozessor gleich
\end{frame}
\begin{frame}[fragile]
\showsubsubsection
Compiler-Sprachen
\begin{itemize}\itemsep0pt
\item
\newterm{Compiler\/} übersetzt Hochsprachen-\newterm{Quelltext\/} in die Assembler-Sprache
\item
\newterm{Assembler\/} übersetzt Assembler-Quelltext in die Maschinensprache
\item
Compiler und Assembler sind Programme,\\
geschrieben in Maschinensprache, Assembler oder einer Hochsprache
\item
Beispiele: Fortran, Algol, Pascal, Ada, C, C++, \dots
\end{itemize}
% \pause
\medskip
Interpreter- oder Skript-Sprachen
\begin{itemize}\itemsep0pt
\item
\newterm{Interpreter\/} liest Hochsprachen-\newterm{Quelltext\/} und führt ihn sofort aus
\item
Der Interpreter ist ein Programm,\\
geschrieben in Maschinensprache, Assembler oder einer Hochsprache
\item
Beispiele: Unix-Shell, BASIC, Perl, Python, \dots
\end{itemize}
% \pause
\medskip
Kombinationen
\begin{itemize}\itemsep0pt
\item
\newterm{Compiler\/} erzeugt \newterm{Zwischencode\/} für eine \newterm{virtuelle Maschine}
\item
\newterm{Interpreter\/} liest Hochsprachen-\newterm{Zwischencode\/} und führt ihn sofort aus
\item
Die virtuelle Maschine ist ein Programm,
geschrieben in Maschinensprache, Assembler, einer Hoch- oder Skript-Sprache
\item
Beispiele: UCSD-Pascal, Java, \dots
\end{itemize}
\vspace*{-1cm}
\end{frame}
\subsection{Programmieren in Assembler}
\begin{frame}
\showsubsection
Beispiel: PC, 1980er bis 1990er Jahre
\begin{itemize}
\item
Prozessor: Intel 8086
\item
Takt: 4,77--100\,MHz
\end{itemize}
Anwendung von Assembler: zeitkritische Programmteile,\\
z.\,B.\ Text- und Grafikausgabe
\begin{onlyenv}<1>
\begin{center}
\vspace*{-0.15cm}
\includegraphics[width=9.8cm,trim={0cm 0cm 0cm 0.8cm},clip]{hello-world-maschinensprache.png}
\vspace*{-10cm}
\end{center}
\end{onlyenv}
\pause
\bigskip
Beispiel: Arduino Uno
\begin{itemize}
\item
Prozessor: ATmega 328p
\item
Takt: 16\,MHz
\end{itemize}
Anwendung von Assembler: zeitkritische Programmteile,\\
z.\,B.\ Mikrosekunden-Timing
\end{frame}
\begin{frame}[fragile]
\showsubsection
Beispiel: Arduino Uno
\begin{itemize}
\item
Prozessor: ATmega 328p
\item
Takt: 16\,MHz
\end{itemize}
Anwendung von Assembler: zeitkritische Programmteile,\\
z.\,B.\ Mikrosekunden-Timing
\bigskip
Cross-Entwicklung
\begin{itemize}
\item
Programmieren auf PC
\item
Compilieren auf PC:
\begin{lstlisting}[style=cmd,gobble=8]
avr-gcc -Wall -Os -mmcu=atmega328p blink.c -o blink.elf
\end{lstlisting}
\item
Speicherabbild auf PC erstellen:
\begin{lstlisting}[style=cmd,gobble=8]
avr-objcopy -O ihex blink.elf blink.hex
\end{lstlisting}
\item
Speicherabbild auf den Mikrocontroller herunterladen:
\begin{lstlisting}[style=cmd,gobble=8]
avrdude -P /dev/ttyACM0 -c arduino -p m328p \
-U flash:w:blink.hex
\end{lstlisting}
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\showsubsection
Cross-Entwicklung
\begin{itemize}
\item
Programmieren auf PC
\item
Compilieren auf PC:
\begin{lstlisting}[style=cmd,gobble=8]
avr-gcc -Wall -Os -mmcu=atmega328p blink.c -o blink.elf
\end{lstlisting}
\item
Speicherabbild auf PC erstellen:
\begin{lstlisting}[style=cmd,gobble=8]
avr-objcopy -O ihex blink.elf blink.hex
\end{lstlisting}
\item
Speicherabbild auf den Mikrocontroller herunterladen:
\begin{lstlisting}[style=cmd,gobble=8]
avrdude -P /dev/ttyACM0 -c arduino -p m328p \
-U flash:w:blink.hex
\end{lstlisting}
\medskip
\item
Präprozessor auf PC:
\begin{lstlisting}[style=cmd,gobble=8]
avr-gcc -Wall -Os -mmcu=atmega328p blink.c \
-E -o blink.E
\end{lstlisting}
\item
Compilieren auf PC, Assembler-Quelltext erzeugen:
\begin{lstlisting}[style=cmd,gobble=8]
avr-gcc -Wall -Os -mmcu=atmega328p blink.c -S
\end{lstlisting}
\end{itemize}
\end{frame}
\sectionnonumber{\inserttitle}
\begin{frame}
\showsectionnonumber
\begin{itemize}
\item[\textbf{1}] \textbf{Einführung}
\item[\textbf{2}] \textbf{Vom Schaltkreis zum Computer}
\begin{itemize}
\item[2.1] Logik-Schaltkreise
\item[2.2] Binärdarstellung von Zahlen
\item[2.3] Vom Logik-Schaltkreis zum Addierer
\item[2.4] Negative Zahlen
\item[2.5] Vom Addierer zum Computer
\item[2.6] Computer-Sprachen
\color{orange}
\item[2.7] Programmieren in Assembler
\end{itemize}
\color{gray}
\item[\textbf{3}] \textbf{Architekturmerkmale von Prozessoren}
\item[\textbf{4}] \textbf{Der CPU-Stack}
% \item[\textbf{5}] \textbf{Hardwarenahe Programmierung}
% \item[\textbf{6}] \textbf{Anwender-Software}
% \item[\textbf{7}] \textbf{Bus-Systeme}
% \item[\textbf{8}] \textbf{Pipelining}
\item[\textbf{\dots\hspace{-0.75em}}]
% \item[\textbf{9}] \textbf{Ausblick}
\end{itemize}
\end{frame}
\end{document}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment