gdi, se
BIN
ws2010/gdi3/u12/Uebung-12.pdf
Normal file
BIN
ws2010/gdi3/u12/solution.odt
Normal file
90
ws2010/gdi3/u2/1.asm
Normal file
@ -0,0 +1,90 @@
|
||||
.data
|
||||
# zu überprüfende Matrikelnummer einkommentieren:
|
||||
|
||||
# matr: .long 0,9,3,9,1,8,2 # --> falsch
|
||||
# matr: .long 1,2,3,4,5,6,7 # --> falsch
|
||||
matr: .long 0,6,1,1,8,1,3 # --> richtig
|
||||
# matr: .long 1,3,9,8,1,4,0 # --> falsch
|
||||
# matr: .long 1,5,6,9,2,0,3 # --> falsch
|
||||
|
||||
intout:
|
||||
.string "1 -> Matrikelnummer richtig\n2 -> Matrikelnummer falsch\nWert: %d\n"
|
||||
|
||||
.text
|
||||
|
||||
.globl main
|
||||
|
||||
main:
|
||||
|
||||
xor %ecx, %ecx # %ecx = 0
|
||||
xor %edi, %edi # 0 in Indexregister ("xor" ist schneller als "movl $0, reg")
|
||||
|
||||
|
||||
movl matr(,%edi,4), %ebx # liest erste Stelle (a)
|
||||
imull $9, %ebx # a * 9
|
||||
addl %ebx, %ecx # %ecx += a
|
||||
|
||||
inc %edi # %edi += 1
|
||||
movl matr(,%edi,4), %ebx # liest zweite Stelle (b)
|
||||
imull $7, %ebx # b * 7
|
||||
addl %ebx, %ecx # %ecx += b
|
||||
|
||||
inc %edi # %edi += 1
|
||||
movl matr(,%edi,4), %ebx # liest dritte Stelle (c)
|
||||
imull $3, %ebx # c * 3
|
||||
addl %ebx, %ecx # %ecx += c
|
||||
|
||||
inc %edi # %edi += 1
|
||||
movl matr(,%edi,4), %ebx # liest vierte Stelle (d)
|
||||
imull $9, %ebx # d * 9
|
||||
addl %ebx, %ecx # %ecx += c
|
||||
|
||||
inc %edi # %edi += 1
|
||||
movl matr(,%edi,4), %ebx # liest fünfte Stelle (e)
|
||||
imull $7, %ebx # e * 7
|
||||
addl %ebx, %ecx # %ecx += c
|
||||
|
||||
inc %edi # %edi += 1
|
||||
movl matr(,%edi,4), %ebx # liest sechste Stelle (f)
|
||||
imull $3, %ebx # f * 3
|
||||
addl %ebx, %ecx # %ecx += c
|
||||
|
||||
|
||||
|
||||
|
||||
movl %ecx, %eax # bereite für Division vor
|
||||
|
||||
movl $10, %ebx
|
||||
xor %edx, %edx # %edx leeren, sonst loating point exception, da noch alter Wert in %edx steht
|
||||
|
||||
idivl %ebx # %eax / %ebx (10) Quotient liegt nun in %eax, Rest in %edx
|
||||
|
||||
inc %edi # %edi += 1
|
||||
movl matr(,%edi,4), %eax # %eax = siebte Stelle (g)
|
||||
|
||||
|
||||
|
||||
cmp %edx, %eax # Vergleiche Rest mit g
|
||||
je .true # rest = g
|
||||
|
||||
jmp .false # rest != g
|
||||
|
||||
.true:
|
||||
movl $1, %eax # Ausgabe true -> 1
|
||||
jmp .ende # "false-Label" überspringen
|
||||
|
||||
.false:
|
||||
movl $0, %eax # Ausgabe false -> 0
|
||||
|
||||
.ende:
|
||||
|
||||
|
||||
# Wert im %eax ausgeben
|
||||
pushl %eax
|
||||
pushl $intout
|
||||
call printf
|
||||
|
||||
|
||||
# Exit
|
||||
movl $1, %eax
|
||||
int $0x80
|
||||
95
ws2010/gdi3/u2/2.asm
Normal file
@ -0,0 +1,95 @@
|
||||
.data
|
||||
# zu sortierende List einkommentieren
|
||||
# list: .long 10,9,8,7,6,5,4,3,2,1
|
||||
list: .long 16,5,18,12,11,66,62,1,9,33
|
||||
|
||||
# Länge der Liste:
|
||||
length: .long 10
|
||||
|
||||
intout:
|
||||
.string "Sortierte Liste: %d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n"
|
||||
|
||||
.text
|
||||
|
||||
.globl main
|
||||
|
||||
main:
|
||||
|
||||
movl length, %ecx # %ecx = n
|
||||
subl $1, %ecx # n - 1
|
||||
|
||||
|
||||
movl $0, %edi # %edi mit 0 initialisieren
|
||||
|
||||
##############################################################################
|
||||
|
||||
.schleife_aussen:
|
||||
|
||||
|
||||
|
||||
pushl %ecx # Speicher den Wert von %ecx auf Stack
|
||||
|
||||
#########################################################
|
||||
|
||||
.schleife_innen:
|
||||
|
||||
|
||||
movl list(,%edi, 4), %eax # %eax = j
|
||||
inc %edi # %edi um 1 erhöhen
|
||||
movl list(,%edi, 4), %ebx # %ebx = j+1
|
||||
dec %edi # %edi wieder auf 0 setzen
|
||||
|
||||
cmp %eax, %ebx # vergleiche nun j und j+1 und springe zu den passenden Labels
|
||||
jb .true
|
||||
|
||||
jmp .false
|
||||
|
||||
.true:
|
||||
# Registertausch:
|
||||
xchgl %eax, %ebx
|
||||
movl %eax, list(,%edi, 4) # zurück ins Datenfeld schreiben
|
||||
inc %edi
|
||||
movl %ebx, list(,%edi, 4) # zurück ins Datenfeld schreiben
|
||||
dec %edi
|
||||
|
||||
.false:
|
||||
# Weiter im Code
|
||||
|
||||
inc %edi # %edi um 1 erhöhen, um nun das nächste Paar im Array zu vergleichen
|
||||
|
||||
|
||||
loop .schleife_innen
|
||||
|
||||
##########################################################
|
||||
|
||||
|
||||
popl %ecx # ursprünglichen Wert von %ecx vom Stack holen
|
||||
|
||||
xor %edi, %edi # %edi wieder auf 0 setzen
|
||||
|
||||
loop .schleife_aussen
|
||||
|
||||
##################################################################################
|
||||
|
||||
|
||||
#### Ausgabe ####
|
||||
|
||||
movl length, %esi # Kopiere Arraygröße nach %esi(= k)
|
||||
|
||||
.printElement:
|
||||
|
||||
cmpl $0 , %esi # Vergleiche %esi = 0 ?
|
||||
je .callPrintf # Wenn ja ,springe zu callPrintf
|
||||
dec %esi # Veringere %esi um 1
|
||||
|
||||
movl list(,%esi,4) , %ecx # Kopiere a[k] nach %ecx
|
||||
pushl %ecx # pushl auf Stack
|
||||
jmp .printElement
|
||||
|
||||
.callPrintf:
|
||||
pushl $intout
|
||||
call printf
|
||||
|
||||
# Exit
|
||||
movl $1, %eax
|
||||
int $0x80
|
||||
BIN
ws2010/gdi3/u2/Uebung-02.pdf
Normal file
BIN
ws2010/gdi3/u2/solution.odt
Normal file
BIN
ws2010/gdi3/u2/solution.pdf
Normal file
BIN
ws2010/gdi3/u3/Uebung-03.pdf
Normal file
117
ws2010/gdi3/u3/solution/1.asm
Normal file
@ -0,0 +1,117 @@
|
||||
.data
|
||||
# zu sortierende List einkommentieren
|
||||
# list: .long 10,9,8,7,6,5,4,3,2,1
|
||||
list: .long 16,5,18,12,11,66,62,1,9,33
|
||||
|
||||
# Länge der Liste:
|
||||
length: .long 10
|
||||
|
||||
intout:
|
||||
.string "Sortierte Liste: %d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n"
|
||||
|
||||
.text
|
||||
|
||||
.globl main
|
||||
|
||||
main:
|
||||
|
||||
|
||||
leal list, %esi # Laden der Adresse mach %esi
|
||||
leal length, %edi # Laden der Adresse nach %edi
|
||||
|
||||
|
||||
call .bubble_sort # Aufruf von Unterprogramm
|
||||
|
||||
|
||||
jmp .ende
|
||||
|
||||
|
||||
|
||||
.bubble_sort:
|
||||
|
||||
# Basepointer muss nicht gesichert werden. Das übernimmt der call-Befehl!
|
||||
|
||||
|
||||
movl (%edi), %ecx # lese Wert von length
|
||||
|
||||
|
||||
dec %ecx # length - 1
|
||||
xor %edi, %edi # %edi = 0
|
||||
movl %esi, %edi
|
||||
|
||||
##############################################################################
|
||||
|
||||
.schleife_aussen:
|
||||
|
||||
|
||||
|
||||
pushl %ecx # Speicher den Wert von %ecx auf Stack
|
||||
|
||||
#########################################################
|
||||
|
||||
.schleife_innen:
|
||||
|
||||
|
||||
movl 0(%edi), %eax # %eax = Wert an Adresse %edi (j)
|
||||
movl 4(%edi), %ebx # %ebx = Wert an Adresse %edi + 4 (j + 1)
|
||||
cmp %eax, %ebx # vergleiche nun j und j+1 und springe zu den passenden Labels
|
||||
jb .true
|
||||
|
||||
jmp .false
|
||||
|
||||
.true:
|
||||
# Registertausch:
|
||||
|
||||
movl %ebx, 0(%edi) # zurück ins Datenfeld schreiben
|
||||
movl %eax, 4(%edi) # zurück ins Datenfeld schreiben
|
||||
|
||||
.false:
|
||||
|
||||
# Weiter im Code
|
||||
|
||||
addl $4, %edi # Adresse in %edi um 4 erhöhen, um nun das nächste Paar im Array zu vergleichen
|
||||
|
||||
|
||||
loop .schleife_innen
|
||||
|
||||
##########################################################
|
||||
|
||||
|
||||
popl %ecx # ursprünglichen Wert von %ecx vom Stack holen
|
||||
|
||||
movl %esi, %edi
|
||||
|
||||
loop .schleife_aussen
|
||||
##################################################################################
|
||||
|
||||
|
||||
|
||||
ret # Unterprogramm verlassen
|
||||
|
||||
|
||||
|
||||
.ende:
|
||||
|
||||
|
||||
|
||||
#### Ausgabe ####
|
||||
|
||||
movl length, %esi # Kopiere Arraygröße nach %esi(= k)
|
||||
|
||||
.printElement:
|
||||
|
||||
cmpl $0 , %esi # Vergleiche %esi = 0 ?
|
||||
je .callPrintf # Wenn ja ,springe zu callPrintf
|
||||
dec %esi # Veringere %esi um 1
|
||||
|
||||
movl list(,%esi,4) , %ecx # Kopiere a[k] nach %ecx
|
||||
pushl %ecx # pushl auf Stack
|
||||
jmp .printElement
|
||||
|
||||
.callPrintf:
|
||||
pushl $intout
|
||||
call printf
|
||||
|
||||
# Exit
|
||||
movl $1, %eax
|
||||
int $0x80
|
||||
111
ws2010/gdi3/u3/solution/2_b.asm
Normal file
@ -0,0 +1,111 @@
|
||||
.data
|
||||
|
||||
b: .long 5
|
||||
e: .long 7
|
||||
m: .long 77
|
||||
|
||||
|
||||
intout:
|
||||
.string "Ergebnis: %d\n"
|
||||
|
||||
.text
|
||||
|
||||
.globl main
|
||||
|
||||
|
||||
|
||||
main:
|
||||
|
||||
movl b, %eax
|
||||
movl e, %ebx
|
||||
movl m, %ecx
|
||||
|
||||
|
||||
call .agy_pot
|
||||
|
||||
jmp .end
|
||||
|
||||
|
||||
######################################
|
||||
# %eax = b
|
||||
# %ebx = e
|
||||
# %ecx = m
|
||||
|
||||
.agy_pot:
|
||||
|
||||
cmp $0, %ebx # exponent = 0?
|
||||
je .agy_pot_ancor # jump to ancor
|
||||
|
||||
movl %ebx, %edx # copy e to %edx
|
||||
and $0b000001, %edx # mask last bit of %edx
|
||||
cmp $0, %edx # %edx uneven?
|
||||
je .agy_pot_irrelevant # even = irrelevant
|
||||
jmp .agy_pot_relevant # uneven = relevant
|
||||
|
||||
.agy_pot_relevant:
|
||||
pushl %eax # save basis
|
||||
pushl %eax # save basis again
|
||||
|
||||
movl %ebx, %eax # %eax = exponent
|
||||
movl $2, %ebx # %ebx = 2
|
||||
cdq
|
||||
idivl %ebx # exponent / 2
|
||||
movl %eax, %ebx # %ebx = exponent / 2
|
||||
|
||||
popl %eax # restore basis
|
||||
imull %eax, %eax # basis^2
|
||||
|
||||
cdq # Basis^2 MOD m
|
||||
idivl %ecx
|
||||
movl %edx, %eax
|
||||
|
||||
call .agy_pot # call agy_pot for the rest
|
||||
|
||||
popl %edx # get relevant basis
|
||||
|
||||
imull %edx, %eax # relvant basis * result from agy_pot
|
||||
|
||||
cdq
|
||||
idivl %ecx # (relvant basis * result from agy_pot) mod m
|
||||
movl %edx, %eax
|
||||
|
||||
ret
|
||||
|
||||
.agy_pot_irrelevant:
|
||||
|
||||
pushl %eax # save basis
|
||||
|
||||
movl %ebx, %eax # %eax = exponent
|
||||
movl $2, %ebx # %ebx = 2
|
||||
cdq
|
||||
idivl %ebx # exponent / 2
|
||||
movl %eax, %ebx # %ebx = exponent / 2
|
||||
|
||||
popl %eax # restore basis
|
||||
imull %eax, %eax # basis^2
|
||||
|
||||
cdq # Basis^2 MOD m
|
||||
idivl %ecx
|
||||
movl %edx, %eax
|
||||
|
||||
call .agy_pot # call agy_pot for the rest
|
||||
ret
|
||||
|
||||
.agy_pot_ancor:
|
||||
movl $1, %eax # result = 1
|
||||
ret
|
||||
|
||||
|
||||
|
||||
##AUSGABE####################################################################
|
||||
.end:
|
||||
|
||||
# Wert im %eax ausgeben
|
||||
pushl %eax
|
||||
pushl $intout
|
||||
call printf
|
||||
|
||||
|
||||
# Exit
|
||||
movl $1, %eax
|
||||
int $0x80
|
||||
BIN
ws2010/gdi3/u3/solution/solution.odt
Normal file
BIN
ws2010/gdi3/u3/solution/solution.pdf
Normal file
47
ws2010/gdi3/u4/1_a.asm
Normal file
@ -0,0 +1,47 @@
|
||||
.data
|
||||
i: .long 2
|
||||
result: .long 1
|
||||
n: .long 12
|
||||
|
||||
intout:
|
||||
.string "Fakultaet: %d\n"
|
||||
|
||||
.text
|
||||
|
||||
.globl main
|
||||
|
||||
main:
|
||||
|
||||
movl i, %ebx # %ebx = i
|
||||
movl result, %eax # %eax = result
|
||||
movl n, %ecx # %ecx = n
|
||||
|
||||
subl %ebx, %ecx # %ecx = n - i
|
||||
|
||||
inc %ecx # Anzahl der Schleifendurchläufe + 1
|
||||
|
||||
|
||||
|
||||
.schleife:
|
||||
cmp $0, %ecx # %ecx = 0 ? -> jump .end
|
||||
je .end
|
||||
|
||||
mull %ebx # %eax *= %ebx (result *= i)
|
||||
inc %ebx # i++
|
||||
dec %ecx
|
||||
|
||||
jmp .schleife
|
||||
|
||||
|
||||
|
||||
.end:
|
||||
|
||||
# Wert im %eax ausgeben
|
||||
pushl %eax
|
||||
pushl $intout
|
||||
call printf
|
||||
|
||||
|
||||
# Exit
|
||||
movl $1, %eax
|
||||
int $0x80
|
||||
40
ws2010/gdi3/u4/1_b.c
Normal file
@ -0,0 +1,40 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
int i = 2;
|
||||
int result = 1;
|
||||
int n = 12;
|
||||
|
||||
//int a; //für Zeitmessung einkommentieren
|
||||
//int c = 100000000; //für Zeitmessung einkommentieren
|
||||
//for (a = 1; a <= c; a++){ //für Zeitmessung einkommentieren
|
||||
//result = 1; //für Zeitmessung einkommentieren
|
||||
|
||||
|
||||
|
||||
asm ( "subl %%ebx, %%ecx;" // %ecx = n - i
|
||||
|
||||
"inc %%ecx;" // Anzahl der Schleifendurchläufe + 1
|
||||
|
||||
|
||||
".schleife: cmp $0, %%ecx \n\t" // %ecx = 0 ? -> jump .end
|
||||
"je .end \n\t"
|
||||
|
||||
"mull %%ebx \n\t" // %eax = %eax * %ebx(result *= i)
|
||||
"inc %%ebx \n\t" // %ebx++ (i++)
|
||||
"dec %%ecx;" // %ecx-- (n - 1)
|
||||
|
||||
"jmp .schleife;" // jump .schleife
|
||||
|
||||
|
||||
".end: "
|
||||
|
||||
: "=a" (result) // output operands result = %eax
|
||||
: "a" (result), "b" (i), "c" (n) // input operands: %eax = result, %ebx = i, %ecx = n
|
||||
|
||||
|
||||
);
|
||||
//} //für Zeitmessung einkommentieren
|
||||
|
||||
printf("Fakultaet: %d\n", result);
|
||||
}
|
||||
25
ws2010/gdi3/u4/2.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
int a = 9;
|
||||
|
||||
|
||||
int fib(int a) {
|
||||
if (a == 0)
|
||||
return 0;
|
||||
if (a == 1)
|
||||
return 1;
|
||||
|
||||
return fib(a - 1) + fib (a - 2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
printf ("Fibonacci-Zahl zu %d = %d\n", a, fib(a));
|
||||
|
||||
}
|
||||
BIN
ws2010/gdi3/u4/Uebung-04.pdf
Normal file
BIN
ws2010/gdi3/u4/solution.odt
Normal file
58
ws2010/gdi3/u5/2_rbg_faehig.asm
Normal file
@ -0,0 +1,58 @@
|
||||
.data
|
||||
# Eingabe
|
||||
a: .float 2.3
|
||||
b: .float 0.7
|
||||
c: .float 4.7
|
||||
d: .float 1.7
|
||||
e: .float 3.0
|
||||
f: .float 2.0
|
||||
g: .float 9.0
|
||||
h: .float 3.0
|
||||
i: .float 1.0
|
||||
x: .float 1.0
|
||||
|
||||
|
||||
|
||||
intout:
|
||||
.string "Ergebnis: %f\n"
|
||||
|
||||
.text
|
||||
|
||||
.globl main
|
||||
|
||||
main:
|
||||
fld a # Lade a auf FPU-Stack # st(3)
|
||||
fsub x # a - x
|
||||
fadd b # + b
|
||||
|
||||
fld c # Lade c auf FPU-Stack # st(2)
|
||||
fsub d # c - d
|
||||
|
||||
fld e # Lade e auf FPU-Stack # st(1)
|
||||
fmul f # e * f
|
||||
|
||||
fld g # Lade g auf FPU-Stack # st(0)
|
||||
fdiv h # g / h
|
||||
fadd i # g / h + i
|
||||
|
||||
fxch # Tausche st(0) <-> st(1)
|
||||
fsubp # (e * f - (g / h + i)) # dekrementiere stack
|
||||
fxch # Tausche st(0) <-> st(1)
|
||||
fmulp # (c - d) * (e * f - (g / h + i)) # dekrementiere stack
|
||||
fxch # Tausche st(0) <-> st(1)
|
||||
fdivp # ((a - x) + b) / ((c - d) * (e * f - (g / h + i))) # dekrementiere stack
|
||||
|
||||
|
||||
|
||||
fstpl(%esp) # Ausgabe von st(0)
|
||||
|
||||
.end:
|
||||
|
||||
# Wert ausgeben
|
||||
pushl $intout
|
||||
call printf
|
||||
|
||||
|
||||
# Exit
|
||||
movl $1, %eax
|
||||
int $0x80
|
||||
BIN
ws2010/gdi3/u5/Uebung-05.pdf
Normal file
BIN
ws2010/gdi3/u5/baum.jpg
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
ws2010/gdi3/u5/baum.vsd
Normal file
603
ws2010/gdi3/u5/floatingStripped_rbg_faehig.asm
Normal file
@ -0,0 +1,603 @@
|
||||
.data
|
||||
fltout: .string "Wert: %f\n"
|
||||
a: .float 2.76
|
||||
b: .float -3.12
|
||||
c: .float 1.2
|
||||
|
||||
test: .string "Debug-String\n"
|
||||
|
||||
|
||||
.text
|
||||
.globl main
|
||||
|
||||
|
||||
main:
|
||||
|
||||
|
||||
# a * b
|
||||
movl a, %eax
|
||||
movl b, %ebx
|
||||
call fltmul
|
||||
call fltprint
|
||||
|
||||
|
||||
|
||||
# Addition läuft mit allen angegebenen Werten
|
||||
|
||||
# b + c
|
||||
#movl b, %eax
|
||||
#movl c, %ebx
|
||||
#call fltadd
|
||||
#call fltprint
|
||||
|
||||
|
||||
# c + a
|
||||
#movl c, %eax
|
||||
#movl a, %ebx
|
||||
#call fltadd
|
||||
#call fltprint
|
||||
|
||||
|
||||
.ende:
|
||||
# Exit
|
||||
movl $1, %eax
|
||||
int $0x80
|
||||
|
||||
|
||||
################################################################################################################################
|
||||
|
||||
/*
|
||||
Addition zweier float Werte
|
||||
Eingabe: %eax, %ebx
|
||||
Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
fltadd:
|
||||
|
||||
|
||||
pushl %eax # a 40(%esp)
|
||||
pushl %ebx # b 36(%esp)
|
||||
pushl $0 # 0 (sign a) 32(%esp)
|
||||
pushl $0 # 0 (sign b) 28(%esp)
|
||||
pushl $0 # 0 (exp a) 24(%esp)
|
||||
pushl $0 # 0 (exp b) 20(%esp)
|
||||
pushl $0 # 0 (mant a) 16(%esp)
|
||||
pushl $0 # 0 (mant b) 12(%esp)
|
||||
pushl $0 # 0 (new sign) 08(%esp)
|
||||
pushl $0 # 0 (new exp) 04(%esp)
|
||||
pushl $0 # 0 (new mant) 00(%esp)
|
||||
|
||||
# collect data
|
||||
#sign a
|
||||
call sign # sign of a
|
||||
movl %eax, 32(%esp) # save to 32(%esp)
|
||||
|
||||
#sign b
|
||||
movl 36(%esp), %eax # %eax = b
|
||||
call sign # sign of b
|
||||
movl %eax, 28(%esp) # save to 28(%esp)
|
||||
|
||||
#exp a
|
||||
movl 40(%esp), %eax # %eax = a
|
||||
call exponent # exp of a
|
||||
movl %eax, 24(%esp) # save to 24(%esp)
|
||||
|
||||
#exp b
|
||||
movl 36(%esp), %eax # %eax = b
|
||||
call exponent # exp of b
|
||||
movl %eax, 20(%esp) # save to 20(%esp)
|
||||
|
||||
#mant a
|
||||
movl 40(%esp), %eax # %eax = a
|
||||
call significand # mant of a
|
||||
movl %eax, 16(%esp) # save to 16(%esp)
|
||||
|
||||
#mant b
|
||||
movl 36(%esp), %eax # %eax = b
|
||||
call significand # mant of b
|
||||
movl %eax, 12(%esp) # save to 12(%esp)
|
||||
|
||||
# extend mant
|
||||
#mant a
|
||||
movl 16(%esp), %eax # mant of a
|
||||
call one_mantisse # extend
|
||||
pushl %eax # save extended mant a
|
||||
#mant b
|
||||
movl 16(%esp), %eax # mant of b
|
||||
call one_mantisse # extend
|
||||
pushl %eax # save extended mant b
|
||||
|
||||
|
||||
#stack:
|
||||
# a 48(%esp)
|
||||
# b 44(%esp)
|
||||
# sign a 40(%esp)
|
||||
# sign b 36(%esp)
|
||||
# exp a 32(%esp)
|
||||
# exp b 28(%esp)
|
||||
# mant a 24(%esp)
|
||||
# mant b 20(%esp)
|
||||
# 0 (new sign) 16(%esp)
|
||||
# 0 (new exp) 12(%esp)
|
||||
# 0 (new mant) 08(%esp)
|
||||
# extended mant a 04(%esp) (2 be cleared)
|
||||
# extended mant b 00(%esp) (2 be cleared)
|
||||
|
||||
# shift till exp equal
|
||||
|
||||
.fltadd_exp:
|
||||
movl 32(%esp), %eax # exp a
|
||||
movl 28(%esp), %ebx # exp b
|
||||
cmp %ebx, %eax # eax = exp a - exp b ? 0
|
||||
je .fltadd_exp_a_equal_b
|
||||
jb .fltadd_exp_a_small_b
|
||||
ja .fltadd_exp_a_great_b
|
||||
|
||||
.fltadd_exp_a_great_b:
|
||||
movl (%esp), %ebx # ext mant b
|
||||
movl 28(%esp), %ecx # exp b
|
||||
shrl $1, %ebx # b >> 1
|
||||
addl $1, %ecx # exp b + 1
|
||||
movl %ebx, (%esp) # save change to stack (mant)
|
||||
movl %ecx, 28(%esp) # save change to stack (exp)
|
||||
|
||||
jmp .fltadd_exp
|
||||
|
||||
.fltadd_exp_a_small_b:
|
||||
movl 4(%esp), %ebx # ext mant a
|
||||
movl 32(%esp), %ecx # exp a
|
||||
shrl $1, %ebx # a >> 1
|
||||
addl $1, %ecx # exp a + 1
|
||||
movl %ebx, 4(%esp) # save change to stack (mant)
|
||||
movl %ecx, 32(%esp) # save change to stack (exp)
|
||||
|
||||
jmp .fltadd_exp
|
||||
|
||||
.fltadd_exp_a_equal_b:
|
||||
#do nothing here
|
||||
|
||||
# invert mant a and/or mant b if negativ
|
||||
.fltadd_sign_a:
|
||||
movl 40(%esp), %eax # sign a
|
||||
cmp $1, %eax # a negativ?
|
||||
je .fltadd_sign_a_neg
|
||||
|
||||
.fltadd_sign_b:
|
||||
movl 36(%esp), %eax # sign b
|
||||
cmp $1, %eax # b negativ?
|
||||
je .fltadd_sign_b_neg
|
||||
|
||||
.fltadd_sign_goon:
|
||||
jmp .fltadd_addmants # continue with add
|
||||
|
||||
.fltadd_sign_a_neg:
|
||||
movl 4(%esp), %eax # ext mant a
|
||||
negl %eax # invert
|
||||
movl %eax, 4(%esp) # write back
|
||||
jmp .fltadd_sign_b # check b
|
||||
|
||||
.fltadd_sign_b_neg:
|
||||
movl (%esp), %eax # ext mant b
|
||||
negl %eax # invert
|
||||
movl %eax, (%esp) # write back
|
||||
jmp .fltadd_sign_goon # continue
|
||||
|
||||
# add ext mants
|
||||
.fltadd_addmants:
|
||||
movl 4(%esp), %eax # ext signed mant a
|
||||
movl (%esp), %ebx # ext signed mant b
|
||||
|
||||
addl %ebx, %eax # ext signed mant a + ext signed mant b
|
||||
|
||||
addl $8, %esp # delete ext signed mants
|
||||
pushl %eax # save new combined mant (signed)
|
||||
|
||||
#stack:
|
||||
# a 44(%esp)
|
||||
# b 40(%esp)
|
||||
# sign a 36(%esp)
|
||||
# sign b 32(%esp)
|
||||
# exp a 28(%esp)
|
||||
# exp b 24(%esp)
|
||||
# mant a 20(%esp)
|
||||
# mant b 16(%esp)
|
||||
# 0 (new sign) 12(%esp)
|
||||
# 0 (new exp) 08(%esp)
|
||||
# 0 (new mant) 04(%esp)
|
||||
# ext mants (a+b) 00(%esp) (2 be cleared)
|
||||
|
||||
# calc new sign
|
||||
movl (%esp), %eax # ext mants
|
||||
cmp $0, %eax # ext mants ? 0
|
||||
js .fltadd_newsign_neg # ext mants < 0 -> new sign -> neg
|
||||
jmp fltadd_shift_strip # go on
|
||||
|
||||
.fltadd_newsign_neg:
|
||||
movl $1, 12(%esp) # write new sign = 1 (neg)
|
||||
movl (%esp), %eax # get ext mants
|
||||
negl %eax # invert ext mants
|
||||
movl %eax, (%esp) # write back
|
||||
|
||||
jmp fltadd_shift_strip #go on
|
||||
|
||||
# shift and strip leading one
|
||||
fltadd_shift_strip:
|
||||
movl 28(%esp), %eax # get exp a(=exp b)
|
||||
movl (%esp), %ebx # get ext mants
|
||||
|
||||
fltadd_shift_loop_down: # mant bigger then possible
|
||||
cmp $0x00FFFFFF , %ebx # ebx > mantspace (24 bits cuz we strip the first one)
|
||||
ja fltadd_shift_loop_down_big
|
||||
jmp fltadd_shift_loop_up
|
||||
|
||||
fltadd_shift_loop_down_big:
|
||||
shrl $1, %ebx # ext mant >> 1
|
||||
addl $1, %eax # exp +1
|
||||
jmp fltadd_shift_loop_down
|
||||
|
||||
fltadd_shift_loop_up: # mant small then possible
|
||||
cmp $0x00800000 , %ebx # ebx < mantspace (24 bits cuz we strip the first one)
|
||||
jb fltadd_shift_loop_down_small
|
||||
jmp fltadd_shift_loop_end
|
||||
|
||||
fltadd_shift_loop_down_small:
|
||||
shll $1, %ebx # ext mant << 1
|
||||
subl $1, %eax # exp -1
|
||||
jmp fltadd_shift_loop_up
|
||||
|
||||
fltadd_shift_loop_end:
|
||||
andl $0x007FFFFF, %ebx #strip 1 bit
|
||||
|
||||
addl $4, %esp # clear mants from stack
|
||||
movl %eax, 4(%esp) # save exp
|
||||
movl %ebx, (%esp) # save mants
|
||||
|
||||
# build new number
|
||||
movl 8(%esp), %eax # new sign
|
||||
movl 4(%esp), %ebx # new exp
|
||||
movl (%esp), %ecx # new mant
|
||||
shll $31, %eax # sign << 31 # S 0000 0000 000 0000 0000 0000 0000 0000
|
||||
shll $23, %ebx # exp << 23 # 0 EEEE EEEE 000 0000 0000 0000 0000 0000
|
||||
|
||||
orl %ebx, %eax # S EEEE EEEE 000 0000 0000 0000 0000 0000
|
||||
orl %ecx, %eax # S EEEE EEEE MMM MMMM MMMM MMMM MMMM MMMM
|
||||
|
||||
# clear stack
|
||||
addl $44, %esp
|
||||
|
||||
# return
|
||||
ret
|
||||
################################################################################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
################################################################################################################################
|
||||
|
||||
/*
|
||||
Multiplikation zweier float Werte
|
||||
Eingabe: %eax, %ebx
|
||||
Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
fltmul:
|
||||
|
||||
|
||||
pushl %eax # a 40(%esp)
|
||||
pushl %ebx # b 36(%esp)
|
||||
pushl $0 # 0 (sign a) 32(%esp)
|
||||
pushl $0 # 0 (sign b) 28(%esp)
|
||||
pushl $0 # 0 (exp a) 24(%esp)
|
||||
pushl $0 # 0 (exp b) 20(%esp)
|
||||
pushl $0 # 0 (mant a) 16(%esp)
|
||||
pushl $0 # 0 (mant b) 12(%esp)
|
||||
pushl $0 # 0 (new sign) 08(%esp)
|
||||
pushl $0 # 0 (new exp) 04(%esp)
|
||||
pushl $0 # 0 (new mant) 00(%esp)
|
||||
|
||||
# collect data
|
||||
#sign a
|
||||
call sign # sign of a
|
||||
movl %eax, 32(%esp) # save to 32(%esp)
|
||||
|
||||
#sign b
|
||||
movl 36(%esp), %eax # %eax = b
|
||||
call sign # sign of b
|
||||
movl %eax, 28(%esp) # save to 28(%esp)
|
||||
|
||||
#exp a
|
||||
movl 40(%esp), %eax # %eax = a
|
||||
call exponent # exp of a
|
||||
movl %eax, 24(%esp) # save to 24(%esp)
|
||||
|
||||
#exp b
|
||||
movl 36(%esp), %eax # %eax = b
|
||||
call exponent # exp of b
|
||||
movl %eax, 20(%esp) # save to 20(%esp)
|
||||
|
||||
#mant a
|
||||
movl 40(%esp), %eax # %eax = a
|
||||
call significand # mant of a
|
||||
movl %eax, 16(%esp) # save to 16(%esp)
|
||||
|
||||
#mant b
|
||||
movl 36(%esp), %eax # %eax = b
|
||||
call significand # mant of b
|
||||
movl %eax, 12(%esp) # save to 12(%esp)
|
||||
|
||||
# extend mant
|
||||
#mant a
|
||||
movl 16(%esp), %eax # mant of a
|
||||
call one_mantisse # extend
|
||||
pushl %eax # save extended mant a
|
||||
#mant b
|
||||
movl 16(%esp), %eax # mant of b
|
||||
call one_mantisse # extend
|
||||
pushl %eax # save extended mant b
|
||||
|
||||
#stack:
|
||||
# a 48(%esp)
|
||||
# b 44(%esp)
|
||||
# sign a 40(%esp)
|
||||
# sign b 36(%esp)
|
||||
# exp a 32(%esp)
|
||||
# exp b 28(%esp)
|
||||
# mant a 24(%esp)
|
||||
# mant b 20(%esp)
|
||||
# 0 (new sign) 16(%esp)
|
||||
# 0 (new exp) 12(%esp)
|
||||
# 0 (new mant) 08(%esp)
|
||||
# extended mant a 04(%esp) (2 be cleared)
|
||||
# extended mant b 00(%esp) (2 be cleared)
|
||||
|
||||
#shift mants
|
||||
#mant a
|
||||
movl 4(%esp), %eax # ext mant a
|
||||
#movl 32(%esp), %ebx # exp a
|
||||
|
||||
#0000 0000 mMMM MMMM MMMM MMMM MMMM MMMM
|
||||
# >>>> >>>>
|
||||
shrl $8, %eax # ext mant a >> 8
|
||||
#addl $8, %ebx # exp + 8
|
||||
|
||||
movl %eax, 4(%esp) # write back ext mant a
|
||||
#movl %ebx, 32(%esp) # write back exp a
|
||||
#mant b
|
||||
movl (%esp), %eax # ext mant b
|
||||
#movl 28(%esp), %ebx # exp b
|
||||
|
||||
#0000 0000 mMMM MMMM MMMM MMMM MMMM MMMM
|
||||
# >>>> >>>>
|
||||
shrl $8, %eax # ext mant a >> 8
|
||||
#addl $8, %ebx # exp + 8
|
||||
|
||||
movl %eax, (%esp) # write back ext mant b
|
||||
#movl %ebx, 28(%esp) # write back exp b
|
||||
|
||||
# multiply mants
|
||||
movl 4(%esp), %eax # shifted ext mant a
|
||||
movl (%esp), %ebx # shifted ext mant b
|
||||
|
||||
mull %ebx # shifted ext mant a * shifted ext mant b
|
||||
|
||||
pushl %eax # write to stack
|
||||
|
||||
# round fix
|
||||
movl 28(%esp), %eax # mant a
|
||||
andl $0x000000FF, %eax # last 8 bit
|
||||
movl 4(%esp), %ebx # shifted ext mant b
|
||||
|
||||
mull %ebx # mul last 8 bit with b
|
||||
pushl %eax # save round-fix-result1
|
||||
|
||||
movl 28(%esp), %eax # mant b
|
||||
andl $0x000000FF, %eax # last 8 bit
|
||||
movl 12(%esp), %ebx # shifted ext mant a
|
||||
|
||||
mull %ebx # mul last 8 bit with b
|
||||
|
||||
popl %ebx # get round-fix-result 1
|
||||
addl %ebx, %eax # rf-result 1 + rf-result 2
|
||||
shrl $8, %eax # shift result >> 8 to match the other result
|
||||
|
||||
popl %ebx # get main-result
|
||||
addl %ebx, %eax # add round-fix result(1+2) + main-result
|
||||
|
||||
addl $8, %esp # clear stack
|
||||
|
||||
pushl %eax # write to stack
|
||||
|
||||
#stack:
|
||||
# a 44(%esp)
|
||||
# b 40(%esp)
|
||||
# sign a 36(%esp)
|
||||
# sign b 32(%esp)
|
||||
# exp a 28(%esp) (altered)
|
||||
# exp b 24(%esp) (altered)
|
||||
# mant a 20(%esp)
|
||||
# mant b 16(%esp)
|
||||
# 0 (new sign) 12(%esp)
|
||||
# 0 (new exp) 08(%esp)
|
||||
# 0 (new mant) 04(%esp)
|
||||
# multiplied mants 00(%esp) (2 be cleared)
|
||||
|
||||
# add exponents
|
||||
movl 28(%esp), %eax # exp a
|
||||
movl 24(%esp), %ebx # exp b
|
||||
|
||||
addl %ebx, %eax # exp a + exp b
|
||||
subl $127, %eax # -1x bias
|
||||
#addl $1, %eax # bit no 24
|
||||
movl %eax, 8(%esp) # write to new exp
|
||||
|
||||
# calc sign
|
||||
movl 36(%esp), %eax # sign a
|
||||
movl 32(%esp), %ebx # sign b
|
||||
|
||||
cmp %eax, %ebx # sign a = sign b?
|
||||
je fltmul_sign_eq
|
||||
movl $1, 12(%esp) # if sign a != sign b -> negativ
|
||||
|
||||
fltmul_sign_eq:
|
||||
#continue
|
||||
|
||||
# shift and strip leading one
|
||||
fltmul_shift_strip:
|
||||
movl 8(%esp), %eax # get new exp
|
||||
subl $7, %eax # exp - 7 (shift before mull)
|
||||
movl (%esp), %ebx # get ext mants
|
||||
|
||||
fltmul_shift_loop_down: # mant bigger then possible
|
||||
cmp $0x00FFFFFF , %ebx # ebx > mantspace (24 bits cuz we strip the first one)
|
||||
ja fltmul_shift_loop_down_big
|
||||
jmp fltmul_shift_loop_up
|
||||
|
||||
fltmul_shift_loop_down_big:
|
||||
shrl $1, %ebx # ext mant >> 1
|
||||
addl $1, %eax # exp +1
|
||||
jmp fltmul_shift_loop_down
|
||||
|
||||
fltmul_shift_loop_up: # mant small then possible
|
||||
cmp $0x00800000 , %ebx # ebx < mantspace (24 bits cuz we strip the first one)
|
||||
jb fltmul_shift_loop_down_small
|
||||
jmp fltmul_shift_loop_end
|
||||
|
||||
fltmul_shift_loop_down_small:
|
||||
shll $1, %ebx # ext mant << 1
|
||||
#subl $1, %eax # exp -1
|
||||
jmp fltmul_shift_loop_up
|
||||
|
||||
fltmul_shift_loop_end:
|
||||
andl $0x007FFFFF, %ebx #strip 1 bit
|
||||
|
||||
addl $4, %esp # clear mants from stack
|
||||
movl %eax, 4(%esp) # save exp
|
||||
movl %ebx, (%esp) # save mants
|
||||
|
||||
# build new number
|
||||
movl 8(%esp), %eax # new sign
|
||||
movl 4(%esp), %ebx # new exp
|
||||
movl (%esp), %ecx # new mant
|
||||
shll $31, %eax # sign << 31 # S 0000 0000 000 0000 0000 0000 0000 0000
|
||||
shll $23, %ebx # exp << 23 # 0 EEEE EEEE 000 0000 0000 0000 0000 0000
|
||||
|
||||
orl %ebx, %eax # S EEEE EEEE 000 0000 0000 0000 0000 0000
|
||||
orl %ecx, %eax # S EEEE EEEE MMM MMMM MMMM MMMM MMMM MMMM
|
||||
|
||||
# clear stack
|
||||
addl $44, %esp
|
||||
|
||||
# return
|
||||
ret
|
||||
|
||||
ret
|
||||
################################################################################################################################
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Ausgabe einer float Zahl via printf
|
||||
Wichtig: printf ist leider nur double kompatibel,
|
||||
daher muss float auf double erweitert werden
|
||||
auch wenn %f genutzt wird!
|
||||
|
||||
Eingabe: %eax
|
||||
Ausgabe: ---
|
||||
*/
|
||||
fltprint:
|
||||
pusha
|
||||
|
||||
call extend # Wegen printf auf double erweitern
|
||||
pushl %edx
|
||||
pushl %eax
|
||||
pushl $fltout
|
||||
call printf
|
||||
addl $12, %esp
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
/*
|
||||
Erweitert ein float in double
|
||||
Eingabe: %eax
|
||||
Ausgabe: %edx:%eax
|
||||
|
||||
Notizen: %ebx enthaelt dauerhaft den float-Wert
|
||||
%ecx:%edx Zwischenergebniss der Erweiterung
|
||||
%edx enthaelt Differenz der Exponenten
|
||||
*/
|
||||
extend:
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
|
||||
movl %eax, %ebx # Sicherung des floats
|
||||
call sign # Vorzeichen extrahieren
|
||||
movl %eax, %ecx # ecx:edx wird double enthalten
|
||||
movl %ebx, %eax
|
||||
call exponent # Exponent extrahieren
|
||||
addl $896, %eax # Exponent erweitern -127 +1023
|
||||
shll $11, %ecx
|
||||
orl %eax, %ecx # An ecx anhaengen
|
||||
movl %ebx, %eax
|
||||
call significand # Mantisse extrahieren
|
||||
movl %eax, %edx
|
||||
shrl $3, %eax # Nur 20 Bit passen noch dran
|
||||
shll $20, %ecx
|
||||
orl %eax, %ecx
|
||||
shll $29, %edx # Mantisse erweitern
|
||||
movl %edx, %eax # Ausgabe setzen
|
||||
movl %ecx, %edx
|
||||
|
||||
popl %ecx
|
||||
popl %ebx
|
||||
ret
|
||||
|
||||
|
||||
/*
|
||||
Vorzeichen des floats extrahieren
|
||||
Ein-/Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
sign:
|
||||
shrl $31, %eax # %eax shiften
|
||||
|
||||
ret
|
||||
|
||||
/*
|
||||
Exponent des floats extrahieren
|
||||
Ein-/Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
exponent:
|
||||
andl $0x7F800000, %eax # exponent maskieren
|
||||
shrl $23, %eax # %eax shiften
|
||||
ret
|
||||
|
||||
/*
|
||||
Mantisse des floats extrahieren
|
||||
Ein-/Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
significand:
|
||||
andl $0x007FFFFF, %eax # mantisse maskieren
|
||||
ret
|
||||
|
||||
|
||||
/*
|
||||
Mantisse mit führender 1 erweitern
|
||||
Ein-/Ausgabe: %eax
|
||||
*/
|
||||
one_mantisse:
|
||||
orl $0x00800000, %eax # mantisse mit führender 1 erweitern
|
||||
ret
|
||||
|
||||
|
||||
528
ws2010/gdi3/u5/floatingStripped_ulf.asm
Normal file
@ -0,0 +1,528 @@
|
||||
.data
|
||||
fltout: .string "Wert: %f\n"
|
||||
intout: .string "Wert: %d\n"
|
||||
a: .float 2.76
|
||||
b: .float -3.12
|
||||
c: .float 1.2
|
||||
|
||||
.text
|
||||
|
||||
#Windebugging
|
||||
.globl _main
|
||||
.globl main
|
||||
#.global printf
|
||||
#printf:
|
||||
# call _printf
|
||||
# ret
|
||||
_main:
|
||||
jmp main
|
||||
main:
|
||||
|
||||
#float 2 console
|
||||
movl a, %eax
|
||||
call fltprint
|
||||
|
||||
# a * b = -8,6112
|
||||
#movl a, %eax
|
||||
#movl b, %ebx
|
||||
#call fltmul
|
||||
#call fltprint
|
||||
|
||||
# b + c = -1,92
|
||||
movl b, %eax
|
||||
movl c, %ebx
|
||||
call fltadd
|
||||
call fltprint
|
||||
|
||||
|
||||
# c + a = 3,96
|
||||
#movl c, %eax
|
||||
#movl a, %ebx
|
||||
#call fltadd
|
||||
#call fltprint
|
||||
|
||||
|
||||
.ende:
|
||||
# Exit
|
||||
movl $1, %eax
|
||||
int $0x80
|
||||
|
||||
|
||||
################################################################################################################################
|
||||
|
||||
/*
|
||||
Addition zweier float Werte
|
||||
Eingabe: %eax, %ebx
|
||||
Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
fltadd:
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
|
||||
|
||||
|
||||
|
||||
# VERGLEICHE EXPONENTEN -> SHIFTE MANTISSE ENTSPRECHEND
|
||||
##################################################################################
|
||||
|
||||
call exponent # liefert exponent von %eax in %eax #lieft null -> für 3.... -> 11...., also müsste exponent mind 1 sein
|
||||
pushl %eax # movl %eax, %edx # a
|
||||
# b
|
||||
# exp a
|
||||
|
||||
movl 4(%esp), %eax # movl %ebx, %eax # verschieben b in %eax
|
||||
call exponent # liefert exponent von %ebx in %eax #ist null und richtig
|
||||
pushl %eax # # a
|
||||
# b
|
||||
# exp a
|
||||
# exp b
|
||||
|
||||
movl %eax, %ebx # Eponent von %ebx in %ebx
|
||||
movl 4(%esp), %eax # Exponent von %eax in %eax
|
||||
|
||||
|
||||
cmp %ebx, %eax # vergleiche exponenten
|
||||
jb .shift_eax # %ebx ist größer -> shift eax
|
||||
ja .shift_ebx # %ebx ist kleiner -> shift ebx
|
||||
je .shift_nothing # exponenten gleich, kein shift notwendig
|
||||
|
||||
|
||||
.shift_eax:
|
||||
|
||||
#TODO
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
|
||||
pushl %ebx # Exponent sichern
|
||||
subl %ebx, %eax # %eax - %ebx
|
||||
pushl %eax # Shiftwert sichern
|
||||
movl 4(%ebp), %ebx # Urpsüngliche Gleitkommazahl herstellen
|
||||
movl 8(%ebp), %eax
|
||||
call significand # liefert Mantisse von %eax
|
||||
|
||||
popl %ecx
|
||||
|
||||
.loop_shift: # Shifte Mantisse von %eax x-mal
|
||||
shrl $1, %eax
|
||||
loop .loop_shift
|
||||
|
||||
pushl %eax
|
||||
movl %ebx, %eax
|
||||
call significand # Extrahiere Mantisse von %ebx
|
||||
movl %eax, %ebx
|
||||
popl %eax
|
||||
popl %edx # Exponent wiederherstellen
|
||||
jmp .add_fraction
|
||||
|
||||
popl %ebp
|
||||
jmp .shift_nothing
|
||||
|
||||
|
||||
.shift_ebx:
|
||||
|
||||
subl %ebx, %eax # %eax - %ebx
|
||||
pushl %eax # Shiftwert sichern # a
|
||||
# b
|
||||
# exp a
|
||||
# exp b
|
||||
# shift b
|
||||
movl 12(%esp), %eax # Urpsüngliche Gleitkommazahl herstellen (b)
|
||||
call significand # liefert Mantisse von b
|
||||
|
||||
popl %ecx
|
||||
|
||||
.loop_shift2: # Shifte Mantisse von %eax x-mal um 2 nach LINKS
|
||||
shll $1, %eax
|
||||
loop .loop_shift2
|
||||
|
||||
pushl %eax # a
|
||||
# b
|
||||
# exp a
|
||||
# exp b
|
||||
# mantisse b
|
||||
movl 16(%esp), %eax
|
||||
call significand # Extrahiere Mantisse von a
|
||||
pushl %eax # a
|
||||
# b
|
||||
# exp a
|
||||
# exp b
|
||||
# mantisse b
|
||||
# mantisse a
|
||||
|
||||
jmp .check_sign
|
||||
|
||||
.shift_nothing: # %eax und %ebx haben gleichen Exponenten!
|
||||
movl 8(%esp), %eax
|
||||
call significand # Extrahiere Mantisse von b
|
||||
pushl %eax
|
||||
movl 16(%esp), %eax
|
||||
call significand # Extrahiere Mantisse von a
|
||||
pushl %eax
|
||||
#######################################################################################
|
||||
|
||||
|
||||
;# VERGLEICHE VORZEICHEN UND BILDE EVENTUELL ZWEIERKOMPLEMENT
|
||||
#######################################################################################
|
||||
|
||||
.check_sign:
|
||||
|
||||
# a
|
||||
# b
|
||||
# exp a
|
||||
# exp b
|
||||
# mantisse b
|
||||
# mantisse a
|
||||
|
||||
movl 20(%esp), %eax # Urpsüngliche Gleitkommazahl herstellen (a)
|
||||
call sign # Vorzeichen von %eax extrahieren (a)
|
||||
cmp $1, %eax
|
||||
je .build_complement_a # Zweier Komplement bilden
|
||||
|
||||
.sign_b:
|
||||
movl 16(%esp), %eax # Urpsüngliche Gleitkommazahl herstellen (b)
|
||||
call sign # Vorzeichen von %eax extrahieren (b)
|
||||
cmp $1, %eax
|
||||
je .build_complement_b # Zweier Komplement bilden
|
||||
jmp .sign_end
|
||||
|
||||
.build_complement_a:
|
||||
movl (%esp), %eax # Hole Mantisse von a
|
||||
xor $0x007FFFF, %eax # Invertiere %eax 0000 0000 07 F F F F F
|
||||
inc %eax # %eax +1
|
||||
movl %eax, (%esp) # Schriebe Mantisse zurück
|
||||
jmp .sign_b
|
||||
|
||||
.build_complement_b:
|
||||
movl 4(%esp), %eax # Hole Mantisse von b
|
||||
xor $0x007FFFF, %eax # Invertiere %eax
|
||||
inc %eax # %eax + 1
|
||||
movl %eax, 4(%esp) # Schreibe Mantisse zurück
|
||||
jmp .sign_end
|
||||
|
||||
.sign_end:
|
||||
|
||||
|
||||
#######################################################################################
|
||||
|
||||
|
||||
;# ADDIERE MANTISSEN
|
||||
#######################################################################################
|
||||
.add_fraction:
|
||||
|
||||
# a
|
||||
# b
|
||||
# exp a
|
||||
# exp b
|
||||
# mantisse b
|
||||
# mantisse a
|
||||
|
||||
movl (%esp), %eax # mantisse a
|
||||
movl 4(%esp), %ebx # mantisse b
|
||||
addl %ebx, %eax # Mantissen addieren
|
||||
pushl %eax # %eax sichern # a
|
||||
# b
|
||||
# exp a
|
||||
# exp b
|
||||
# mantisse b
|
||||
# mantisse a
|
||||
# new mantisse
|
||||
|
||||
|
||||
movl 16(%esp), %eax # exp a
|
||||
movl 12(%esp), %ebx # exp b
|
||||
|
||||
subl %ebx, %eax # exp a - exp b
|
||||
cmp $0, %eax # exp a - exp b = 0?
|
||||
je .exp_eql
|
||||
ja .exp_a_big
|
||||
jb .exp_b_big
|
||||
|
||||
.exp_eql:
|
||||
movl 16(%esp), %eax # exp a
|
||||
pushl %eax
|
||||
movl 28(%esp), %eax # a
|
||||
call sign
|
||||
pushl %eax
|
||||
# a
|
||||
# b
|
||||
# exp a
|
||||
# exp b
|
||||
# mantisse b
|
||||
# mantisse a
|
||||
# new mantisse
|
||||
# new exp
|
||||
# new sign
|
||||
jmp .build_flt
|
||||
|
||||
.exp_a_big:
|
||||
movl 16(%esp), %eax # exp a
|
||||
pushl %eax
|
||||
movl 28(%esp), %eax # a
|
||||
call sign
|
||||
pushl %eax
|
||||
|
||||
# a
|
||||
# b
|
||||
# exp a
|
||||
# exp b
|
||||
# mantisse b
|
||||
# mantisse a
|
||||
# new mantisse
|
||||
# new exp
|
||||
# new sign
|
||||
jmp .build_flt
|
||||
.exp_b_big:
|
||||
movl 12(%esp), %eax # exp b
|
||||
pushl %eax
|
||||
movl 24(%esp), %eax # b
|
||||
call sign
|
||||
pushl %eax
|
||||
|
||||
# a
|
||||
# b
|
||||
# exp a
|
||||
# exp b
|
||||
# mantisse b
|
||||
# mantisse a
|
||||
# new mantisse
|
||||
# new exp
|
||||
# new sign
|
||||
jmp .build_flt
|
||||
|
||||
.build_flt:
|
||||
|
||||
movl (%esp), %eax # sign << 31
|
||||
movl 4(%esp), %ebx # exp << 23
|
||||
movl 8(%esp), %ecx # mantisse << 0
|
||||
shll $31, %eax # ok!
|
||||
shll $23, %ebx # ok!
|
||||
|
||||
orl %ebx, %eax
|
||||
orl %ecx, %eax
|
||||
|
||||
addl $36, %esp
|
||||
|
||||
#??????????????????????????????ß
|
||||
#andl $0x00800000, %eax # prüfe ob shift und Exponentanpassung nötig ist
|
||||
#shrl $23, %eax
|
||||
#cmp $0, %eax
|
||||
#je .no_shift
|
||||
|
||||
|
||||
#popl %eax
|
||||
#shrl $1, %eax
|
||||
#inc %edx
|
||||
|
||||
|
||||
#.no_shift:
|
||||
|
||||
|
||||
## Vorzeichenbit muss noch behandelt werden
|
||||
# cmp $0, %eax # ergebnis < 0 -> Zweierkomplement bilden
|
||||
# ja .no_complement
|
||||
#
|
||||
# # Zweierkomplement vom Ergebnis bilden
|
||||
# xor $0x00711111, %eax
|
||||
# inc %eax
|
||||
# xor $0x80000000, %eax # -> Vorzeichenbit setzen
|
||||
#
|
||||
# .no_complement:
|
||||
#
|
||||
|
||||
|
||||
# # Zahl wieder "zusammenbauen"
|
||||
# subl $896, %edx # Exponent wieder in richtige Form bringen
|
||||
# andl 0x7F800000, %edx
|
||||
|
||||
# orl %edx, %eax # Exponent_Mantisse
|
||||
|
||||
|
||||
|
||||
#######################################################################################
|
||||
ret
|
||||
|
||||
|
||||
################################################################################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
################################################################################################################################
|
||||
|
||||
/*
|
||||
Multiplikation zweier float Werte
|
||||
Eingabe: %eax, %ebx
|
||||
Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
fltmul:
|
||||
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
|
||||
|
||||
call significand # Mantisse von %eax bestimmen
|
||||
orl 0x00100000, %eax
|
||||
pushl %eax
|
||||
|
||||
movl %ebx, %eax # Mantisse von %ebx bestimmen
|
||||
call significand
|
||||
orl 0x00100000, %eax
|
||||
movl %eax, %ebx
|
||||
popl %eax
|
||||
|
||||
# 2 * 24 bit = 48 bit !!!!
|
||||
mull %ebx # Mantissen multiplizieren
|
||||
|
||||
pushl %eax # Sichere neue Mantissse auf dem Stack
|
||||
|
||||
|
||||
movl 4(%ebp), %ebx # ebx wieder herstellen
|
||||
movl 8(%ebp), %eax # eax wieder herstellen
|
||||
|
||||
|
||||
#Expoenten extrahieren und neuen Exponent bestimmen
|
||||
call exponent
|
||||
pushl %eax
|
||||
|
||||
movl %ebx, %eax
|
||||
call exponent
|
||||
movl %eax, %ebx
|
||||
popl %eax
|
||||
|
||||
addl %ebx, %eax # Addiere beide Exponenten
|
||||
subl $127, %eax # Exponenten - (1 x BIAS)
|
||||
|
||||
|
||||
pushl %eax # Sichere neuen Exponentn auf dem Stack
|
||||
|
||||
|
||||
|
||||
#Berechne Vorzeichen des Produkts
|
||||
movl 4(%ebp), %ebx # ebx wieder herstellen
|
||||
movl 8(%ebp), %eax # eax wieder herstellen
|
||||
|
||||
|
||||
call sign
|
||||
movl %eax, %ebx
|
||||
pushl %eax
|
||||
|
||||
movl %ebx, %eax
|
||||
call sign
|
||||
movl %eax, %ebx
|
||||
popl %eax
|
||||
|
||||
xor %ebx, %eax
|
||||
|
||||
pushl %eax # Neuen Exponent auf Stack sichern
|
||||
|
||||
|
||||
|
||||
|
||||
# Ergebnis zusammensetzen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ret
|
||||
################################################################################################################################
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Ausgabe einer float Zahl via printf
|
||||
Wichtig: printf ist leider nur double kompatibel,
|
||||
daher muss float auf double erweitert werden
|
||||
auch wenn %f genutzt wird!
|
||||
|
||||
Eingabe: %eax
|
||||
Ausgabe: ---
|
||||
*/
|
||||
fltprint:
|
||||
pusha
|
||||
|
||||
call extend # Wegen printf auf double erweitern
|
||||
pushl %edx
|
||||
pushl %eax
|
||||
pushl $fltout
|
||||
call _printf
|
||||
addl $12, %esp
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
/*
|
||||
Erweitert ein float in double
|
||||
Eingabe: %eax
|
||||
Ausgabe: %edx:%eax
|
||||
|
||||
Notizen: %ebx enthaelt dauerhaft den float-Wert
|
||||
; %ecx:%edx Zwischenergebniss der Erweiterung
|
||||
; %edx enthaelt Differenz der Exponenten
|
||||
*/
|
||||
extend:
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
|
||||
movl %eax, %ebx # Sicherung des floats
|
||||
call sign # Vorzeichen extrahieren
|
||||
movl %eax, %ecx # ecx:edx wird double enthalten
|
||||
movl %ebx, %eax
|
||||
call exponent # Exponent extrahieren
|
||||
addl $896, %eax # Exponent erweitern -127 +1023
|
||||
shll $11, %ecx
|
||||
orl %eax, %ecx # An ecx anhaengen
|
||||
movl %ebx, %eax
|
||||
call significand # Mantisse extrahieren
|
||||
movl %eax, %edx
|
||||
shrl $3, %eax # Nur 20 Bit passen noch dran
|
||||
shll $20, %ecx
|
||||
orl %eax, %ecx
|
||||
shll $29, %edx # Mantisse erweitern
|
||||
movl %edx, %eax # Ausgabe setzen
|
||||
movl %ecx, %edx
|
||||
|
||||
popl %ecx
|
||||
popl %ebx
|
||||
ret
|
||||
|
||||
|
||||
/*
|
||||
Vorzeichen des floats extrahieren
|
||||
Ein-/Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
sign:
|
||||
shrl $31, %eax # %eax shiften
|
||||
|
||||
ret
|
||||
|
||||
/*
|
||||
Exponent des floats extrahieren
|
||||
Ein-/Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
exponent:
|
||||
and $0x7F800000, %eax # exponent maskieren
|
||||
shrl $23, %eax # %eax shiften
|
||||
ret
|
||||
|
||||
/*
|
||||
Mantisse des floats extrahieren
|
||||
Ein-/Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
significand:
|
||||
andl $0x007FFFFF, %eax # mantisse maskieren
|
||||
ret
|
||||
|
||||
|
||||
582
ws2010/gdi3/u5/floatingStripped_ulf2.asm
Normal file
@ -0,0 +1,582 @@
|
||||
.data
|
||||
fltout: .string "Wert: %f\n"
|
||||
a: .float 2.76
|
||||
b: .float -3.12
|
||||
c: .float 1.2
|
||||
|
||||
.text
|
||||
.globl main
|
||||
.globl _main
|
||||
|
||||
_main:
|
||||
main:
|
||||
|
||||
# a
|
||||
movl a, %eax
|
||||
call fltprint
|
||||
|
||||
# a * b = -8,6112
|
||||
movl a, %eax
|
||||
movl b, %ebx
|
||||
call fltmul
|
||||
call fltprint
|
||||
|
||||
# a * c = 3,312
|
||||
movl a, %eax
|
||||
movl c, %ebx
|
||||
call fltmul
|
||||
call fltprint
|
||||
|
||||
# b + c = -1,92
|
||||
movl b, %eax
|
||||
movl c, %ebx
|
||||
call fltadd
|
||||
call fltprint
|
||||
|
||||
# c + a = 3,96
|
||||
movl c, %eax
|
||||
movl a, %ebx
|
||||
call fltadd
|
||||
call fltprint
|
||||
|
||||
# Exit
|
||||
movl $1, %eax
|
||||
int $0x80
|
||||
|
||||
/*
|
||||
Addition zweier float Werte
|
||||
Eingabe: %eax, %ebx
|
||||
Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
fltadd:
|
||||
|
||||
pushl %eax # a 40(%esp)
|
||||
pushl %ebx # b 36(%esp)
|
||||
pushl $0 # 0 (sign a) 32(%esp)
|
||||
pushl $0 # 0 (sign b) 28(%esp)
|
||||
pushl $0 # 0 (exp a) 24(%esp)
|
||||
pushl $0 # 0 (exp b) 20(%esp)
|
||||
pushl $0 # 0 (mant a) 16(%esp)
|
||||
pushl $0 # 0 (mant b) 12(%esp)
|
||||
pushl $0 # 0 (new sign) 08(%esp)
|
||||
pushl $0 # 0 (new exp) 04(%esp)
|
||||
pushl $0 # 0 (new mant) 00(%esp)
|
||||
|
||||
# collect data
|
||||
#sign a
|
||||
call sign # sign of a
|
||||
movl %eax, 32(%esp) # save to 32(%esp)
|
||||
|
||||
#sign b
|
||||
movl 36(%esp), %eax # %eax = b
|
||||
call sign # sign of b
|
||||
movl %eax, 28(%esp) # save to 28(%esp)
|
||||
|
||||
#exp a
|
||||
movl 40(%esp), %eax # %eax = a
|
||||
call exponent # exp of a
|
||||
movl %eax, 24(%esp) # save to 24(%esp)
|
||||
|
||||
#exp b
|
||||
movl 36(%esp), %eax # %eax = b
|
||||
call exponent # exp of b
|
||||
movl %eax, 20(%esp) # save to 20(%esp)
|
||||
|
||||
#mant a
|
||||
movl 40(%esp), %eax # %eax = a
|
||||
call significand # mant of a
|
||||
movl %eax, 16(%esp) # save to 16(%esp)
|
||||
|
||||
#mant b
|
||||
movl 36(%esp), %eax # %eax = b
|
||||
call significand # mant of b
|
||||
movl %eax, 12(%esp) # save to 12(%esp)
|
||||
|
||||
# extend mant
|
||||
#mant a
|
||||
movl 16(%esp), %eax # mant of a
|
||||
call one_mantisse # extend
|
||||
pushl %eax # save extended mant a
|
||||
#mant b
|
||||
movl 16(%esp), %eax # mant of b
|
||||
call one_mantisse # extend
|
||||
pushl %eax # save extended mant b
|
||||
|
||||
#stack:
|
||||
# a 48(%esp)
|
||||
# b 44(%esp)
|
||||
# sign a 40(%esp)
|
||||
# sign b 36(%esp)
|
||||
# exp a 32(%esp)
|
||||
# exp b 28(%esp)
|
||||
# mant a 24(%esp)
|
||||
# mant b 20(%esp)
|
||||
# 0 (new sign) 16(%esp)
|
||||
# 0 (new exp) 12(%esp)
|
||||
# 0 (new mant) 08(%esp)
|
||||
# extended mant a 04(%esp) (2 be cleared)
|
||||
# extended mant b 00(%esp) (2 be cleared)
|
||||
|
||||
# shift till exp equal
|
||||
|
||||
.fltadd_exp:
|
||||
movl 32(%esp), %eax # exp a
|
||||
movl 28(%esp), %ebx # exp b
|
||||
cmp %ebx, %eax # eax = exp a - exp b ? 0
|
||||
je .fltadd_exp_a_equal_b
|
||||
jb .fltadd_exp_a_small_b
|
||||
ja .fltadd_exp_a_great_b
|
||||
|
||||
.fltadd_exp_a_great_b:
|
||||
movl (%esp), %ebx # ext mant b
|
||||
movl 28(%esp), %ecx # exp b
|
||||
shrl $1, %ebx # b >> 1
|
||||
addl $1, %ecx # exp b + 1
|
||||
movl %ebx, (%esp) # save change to stack (mant)
|
||||
movl %ecx, 28(%esp) # save change to stack (exp)
|
||||
|
||||
jmp .fltadd_exp
|
||||
|
||||
.fltadd_exp_a_small_b:
|
||||
movl 4(%esp), %ebx # ext mant a
|
||||
movl 32(%esp), %ecx # exp a
|
||||
shrl $1, %ebx # a >> 1
|
||||
addl $1, %ecx # exp a + 1
|
||||
movl %ebx, 4(%esp) # save change to stack (mant)
|
||||
movl %ecx, 32(%esp) # save change to stack (exp)
|
||||
|
||||
jmp .fltadd_exp
|
||||
|
||||
.fltadd_exp_a_equal_b:
|
||||
#do nothing here
|
||||
|
||||
# invert mant a and/or mant b if negativ
|
||||
.fltadd_sign_a:
|
||||
movl 40(%esp), %eax # sign a
|
||||
cmp $1, %eax # a negativ?
|
||||
je .fltadd_sign_a_neg
|
||||
|
||||
.fltadd_sign_b:
|
||||
movl 36(%esp), %eax # sign b
|
||||
cmp $1, %eax # b negativ?
|
||||
je .fltadd_sign_b_neg
|
||||
|
||||
.fltadd_sign_goon:
|
||||
jmp .fltadd_addmants # continue with add
|
||||
|
||||
.fltadd_sign_a_neg:
|
||||
movl 4(%esp), %eax # ext mant a
|
||||
negl %eax # invert
|
||||
movl %eax, 4(%esp) # write back
|
||||
jmp .fltadd_sign_b # check b
|
||||
|
||||
.fltadd_sign_b_neg:
|
||||
movl (%esp), %eax # ext mant b
|
||||
negl %eax # invert
|
||||
movl %eax, (%esp) # write back
|
||||
jmp .fltadd_sign_goon # continue
|
||||
|
||||
# add ext mants
|
||||
.fltadd_addmants:
|
||||
movl 4(%esp), %eax # ext signed mant a
|
||||
movl (%esp), %ebx # ext signed mant b
|
||||
|
||||
addl %ebx, %eax # ext signed mant a + ext signed mant b
|
||||
|
||||
addl $8, %esp # delete ext signed mants
|
||||
pushl %eax # save new combined mant (signed)
|
||||
|
||||
#stack:
|
||||
# a 44(%esp)
|
||||
# b 40(%esp)
|
||||
# sign a 36(%esp)
|
||||
# sign b 32(%esp)
|
||||
# exp a 28(%esp)
|
||||
# exp b 24(%esp)
|
||||
# mant a 20(%esp)
|
||||
# mant b 16(%esp)
|
||||
# 0 (new sign) 12(%esp)
|
||||
# 0 (new exp) 08(%esp)
|
||||
# 0 (new mant) 04(%esp)
|
||||
# ext mants (a+b) 00(%esp) (2 be cleared)
|
||||
|
||||
# calc new sign
|
||||
movl (%esp), %eax # ext mants
|
||||
cmp $0, %eax # ext mants ? 0
|
||||
js .fltadd_newsign_neg # ext mants < 0 -> new sign -> neg
|
||||
jmp fltadd_shift_strip # go on
|
||||
|
||||
.fltadd_newsign_neg:
|
||||
movl $1, 12(%esp) # write new sign = 1 (neg)
|
||||
movl (%esp), %eax # get ext mants
|
||||
negl %eax # invert ext mants
|
||||
movl %eax, (%esp) # write back
|
||||
|
||||
jmp fltadd_shift_strip #go on
|
||||
|
||||
# shift and strip leading one
|
||||
fltadd_shift_strip:
|
||||
movl 28(%esp), %eax # get exp a(=exp b)
|
||||
movl (%esp), %ebx # get ext mants
|
||||
|
||||
fltadd_shift_loop_down: # mant bigger then possible
|
||||
cmp $0x00FFFFFF , %ebx # ebx > mantspace (24 bits cuz we strip the first one)
|
||||
ja fltadd_shift_loop_down_big
|
||||
jmp fltadd_shift_loop_up
|
||||
|
||||
fltadd_shift_loop_down_big:
|
||||
shrl $1, %ebx # ext mant >> 1
|
||||
addl $1, %eax # exp +1
|
||||
jmp fltadd_shift_loop_down
|
||||
|
||||
fltadd_shift_loop_up: # mant small then possible
|
||||
cmp $0x00800000 , %ebx # ebx < mantspace (24 bits cuz we strip the first one)
|
||||
jb fltadd_shift_loop_down_small
|
||||
jmp fltadd_shift_loop_end
|
||||
|
||||
fltadd_shift_loop_down_small:
|
||||
shll $1, %ebx # ext mant << 1
|
||||
subl $1, %eax # exp -1
|
||||
jmp fltadd_shift_loop_up
|
||||
|
||||
fltadd_shift_loop_end:
|
||||
andl $0x007FFFFF, %ebx #strip 1 bit
|
||||
|
||||
addl $4, %esp # clear mants from stack
|
||||
movl %eax, 4(%esp) # save exp
|
||||
movl %ebx, (%esp) # save mants
|
||||
|
||||
# build new number
|
||||
movl 8(%esp), %eax # new sign
|
||||
movl 4(%esp), %ebx # new exp
|
||||
movl (%esp), %ecx # new mant
|
||||
shll $31, %eax # sign << 31 # S 0000 0000 000 0000 0000 0000 0000 0000
|
||||
shll $23, %ebx # exp << 23 # 0 EEEE EEEE 000 0000 0000 0000 0000 0000
|
||||
|
||||
orl %ebx, %eax # S EEEE EEEE 000 0000 0000 0000 0000 0000
|
||||
orl %ecx, %eax # S EEEE EEEE MMM MMMM MMMM MMMM MMMM MMMM
|
||||
|
||||
# clear stack
|
||||
addl $44, %esp
|
||||
|
||||
# return
|
||||
ret
|
||||
|
||||
/*
|
||||
Multiplikation zweier float Werte
|
||||
Eingabe: %eax, %ebx
|
||||
Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
fltmul:
|
||||
|
||||
pushl %eax # a 40(%esp)
|
||||
pushl %ebx # b 36(%esp)
|
||||
pushl $0 # 0 (sign a) 32(%esp)
|
||||
pushl $0 # 0 (sign b) 28(%esp)
|
||||
pushl $0 # 0 (exp a) 24(%esp)
|
||||
pushl $0 # 0 (exp b) 20(%esp)
|
||||
pushl $0 # 0 (mant a) 16(%esp)
|
||||
pushl $0 # 0 (mant b) 12(%esp)
|
||||
pushl $0 # 0 (new sign) 08(%esp)
|
||||
pushl $0 # 0 (new exp) 04(%esp)
|
||||
pushl $0 # 0 (new mant) 00(%esp)
|
||||
|
||||
# collect data
|
||||
#sign a
|
||||
call sign # sign of a
|
||||
movl %eax, 32(%esp) # save to 32(%esp)
|
||||
|
||||
#sign b
|
||||
movl 36(%esp), %eax # %eax = b
|
||||
call sign # sign of b
|
||||
movl %eax, 28(%esp) # save to 28(%esp)
|
||||
|
||||
#exp a
|
||||
movl 40(%esp), %eax # %eax = a
|
||||
call exponent # exp of a
|
||||
movl %eax, 24(%esp) # save to 24(%esp)
|
||||
|
||||
#exp b
|
||||
movl 36(%esp), %eax # %eax = b
|
||||
call exponent # exp of b
|
||||
movl %eax, 20(%esp) # save to 20(%esp)
|
||||
|
||||
#mant a
|
||||
movl 40(%esp), %eax # %eax = a
|
||||
call significand # mant of a
|
||||
movl %eax, 16(%esp) # save to 16(%esp)
|
||||
|
||||
#mant b
|
||||
movl 36(%esp), %eax # %eax = b
|
||||
call significand # mant of b
|
||||
movl %eax, 12(%esp) # save to 12(%esp)
|
||||
|
||||
# extend mant
|
||||
#mant a
|
||||
movl 16(%esp), %eax # mant of a
|
||||
call one_mantisse # extend
|
||||
pushl %eax # save extended mant a
|
||||
#mant b
|
||||
movl 16(%esp), %eax # mant of b
|
||||
call one_mantisse # extend
|
||||
pushl %eax # save extended mant b
|
||||
|
||||
#stack:
|
||||
# a 48(%esp)
|
||||
# b 44(%esp)
|
||||
# sign a 40(%esp)
|
||||
# sign b 36(%esp)
|
||||
# exp a 32(%esp)
|
||||
# exp b 28(%esp)
|
||||
# mant a 24(%esp)
|
||||
# mant b 20(%esp)
|
||||
# 0 (new sign) 16(%esp)
|
||||
# 0 (new exp) 12(%esp)
|
||||
# 0 (new mant) 08(%esp)
|
||||
# extended mant a 04(%esp) (2 be cleared)
|
||||
# extended mant b 00(%esp) (2 be cleared)
|
||||
|
||||
#shift mants
|
||||
#mant a
|
||||
movl 4(%esp), %eax # ext mant a
|
||||
#movl 32(%esp), %ebx # exp a
|
||||
|
||||
#0000 0000 mMMM MMMM MMMM MMMM MMMM MMMM
|
||||
# >>>> >>>>
|
||||
shrl $8, %eax # ext mant a >> 8
|
||||
#addl $8, %ebx # exp + 8
|
||||
|
||||
movl %eax, 4(%esp) # write back ext mant a
|
||||
#movl %ebx, 32(%esp) # write back exp a
|
||||
#mant b
|
||||
movl (%esp), %eax # ext mant b
|
||||
#movl 28(%esp), %ebx # exp b
|
||||
|
||||
#0000 0000 mMMM MMMM MMMM MMMM MMMM MMMM
|
||||
# >>>> >>>>
|
||||
shrl $8, %eax # ext mant a >> 8
|
||||
#addl $8, %ebx # exp + 8
|
||||
|
||||
movl %eax, (%esp) # write back ext mant b
|
||||
#movl %ebx, 28(%esp) # write back exp b
|
||||
|
||||
# multiply mants
|
||||
movl 4(%esp), %eax # shifted ext mant a
|
||||
movl (%esp), %ebx # shifted ext mant b
|
||||
|
||||
mull %ebx # shifted ext mant a * shifted ext mant b
|
||||
|
||||
pushl %eax # write to stack
|
||||
|
||||
# round fix
|
||||
movl 28(%esp), %eax # mant a
|
||||
andl $0x000000FF, %eax # last 8 bit
|
||||
movl 4(%esp), %ebx # shifted ext mant b
|
||||
|
||||
mull %ebx # mul last 8 bit with b
|
||||
#shrl $8, %eax # shift result >> 8 to match the other result
|
||||
pushl %eax # save round-fix-result1
|
||||
|
||||
movl 28(%esp), %eax # mant b
|
||||
andl $0x000000FF, %eax # last 8 bit
|
||||
movl 12(%esp), %ebx # shifted ext mant a
|
||||
|
||||
mull %ebx # mul last 8 bit with b
|
||||
#shrl $8, %eax # shift result >> 8 to match the other result
|
||||
|
||||
popl %ebx # get round-fix-result 1
|
||||
addl %ebx, %eax # rf-result 1 + rf-result 2
|
||||
shrl $8, %eax # shift result >> 8 to match the other result
|
||||
|
||||
popl %ebx # get main-result
|
||||
addl %ebx, %eax # add round-fix result(1+2) + main-result
|
||||
|
||||
addl $8, %esp # clear stack
|
||||
|
||||
pushl %eax # write to stack
|
||||
|
||||
#stack:
|
||||
# a 44(%esp)
|
||||
# b 40(%esp)
|
||||
# sign a 36(%esp)
|
||||
# sign b 32(%esp)
|
||||
# exp a 28(%esp) (altered)
|
||||
# exp b 24(%esp) (altered)
|
||||
# mant a 20(%esp)
|
||||
# mant b 16(%esp)
|
||||
# 0 (new sign) 12(%esp)
|
||||
# 0 (new exp) 08(%esp)
|
||||
# 0 (new mant) 04(%esp)
|
||||
# multiplied mants 00(%esp) (2 be cleared)
|
||||
|
||||
# add exponents
|
||||
movl 28(%esp), %eax # exp a
|
||||
movl 24(%esp), %ebx # exp b
|
||||
|
||||
addl %ebx, %eax # exp a + exp b
|
||||
subl $127, %eax # -1x bias
|
||||
#addl $1, %eax # bit no 24
|
||||
movl %eax, 8(%esp) # write to new exp
|
||||
|
||||
# calc sign
|
||||
movl 36(%esp), %eax # sign a
|
||||
movl 32(%esp), %ebx # sign b
|
||||
|
||||
cmp %eax, %ebx # sign a = sign b?
|
||||
je fltmul_sign_eq
|
||||
movl $1, 12(%esp) # if sign a != sign b -> negativ
|
||||
|
||||
fltmul_sign_eq:
|
||||
#continue
|
||||
|
||||
# shift and strip leading one
|
||||
fltmul_shift_strip:
|
||||
movl 8(%esp), %eax # get new exp
|
||||
subl $7, %eax # exp - 7 (shift before mull)
|
||||
movl (%esp), %ebx # get ext mants
|
||||
|
||||
fltmul_shift_loop_down: # mant bigger then possible
|
||||
cmp $0x00FFFFFF , %ebx # ebx > mantspace (24 bits cuz we strip the first one)
|
||||
ja fltmul_shift_loop_down_big
|
||||
jmp fltmul_shift_loop_up
|
||||
|
||||
fltmul_shift_loop_down_big:
|
||||
shrl $1, %ebx # ext mant >> 1
|
||||
addl $1, %eax # exp +1
|
||||
jmp fltmul_shift_loop_down
|
||||
|
||||
fltmul_shift_loop_up: # mant small then possible
|
||||
cmp $0x00800000 , %ebx # ebx < mantspace (24 bits cuz we strip the first one)
|
||||
jb fltmul_shift_loop_down_small
|
||||
jmp fltmul_shift_loop_end
|
||||
|
||||
fltmul_shift_loop_down_small:
|
||||
shll $1, %ebx # ext mant << 1
|
||||
#subl $1, %eax # exp -1
|
||||
jmp fltmul_shift_loop_up
|
||||
|
||||
fltmul_shift_loop_end:
|
||||
andl $0x007FFFFF, %ebx #strip 1 bit
|
||||
|
||||
addl $4, %esp # clear mants from stack
|
||||
movl %eax, 4(%esp) # save exp
|
||||
movl %ebx, (%esp) # save mants
|
||||
|
||||
# build new number
|
||||
movl 8(%esp), %eax # new sign
|
||||
movl 4(%esp), %ebx # new exp
|
||||
movl (%esp), %ecx # new mant
|
||||
shll $31, %eax # sign << 31 # S 0000 0000 000 0000 0000 0000 0000 0000
|
||||
shll $23, %ebx # exp << 23 # 0 EEEE EEEE 000 0000 0000 0000 0000 0000
|
||||
|
||||
orl %ebx, %eax # S EEEE EEEE 000 0000 0000 0000 0000 0000
|
||||
orl %ecx, %eax # S EEEE EEEE MMM MMMM MMMM MMMM MMMM MMMM
|
||||
|
||||
# clear stack
|
||||
addl $44, %esp
|
||||
|
||||
# return
|
||||
ret
|
||||
|
||||
|
||||
/*
|
||||
Ausgabe einer float Zahl via printf
|
||||
Wichtig: printf ist leider nur double kompatibel,
|
||||
daher muss float auf double erweitert werden
|
||||
auch wenn %f genutzt wird!
|
||||
|
||||
Eingabe: %eax
|
||||
Ausgabe: ---
|
||||
*/
|
||||
fltprint:
|
||||
pusha
|
||||
|
||||
call extend # Wegen printf auf double erweitern
|
||||
pushl %edx
|
||||
pushl %eax
|
||||
pushl $fltout
|
||||
call _printf
|
||||
addl $12, %esp
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
#/*
|
||||
# Erweitert ein float in double
|
||||
# Eingabe: %eax
|
||||
# Ausgabe: %edx:%eax
|
||||
#
|
||||
# Notizen: %ebx enthaelt dauerhaft den float-Wert
|
||||
# %ecx:%edx Zwischenergebniss der Erweiterung
|
||||
# %edx enthaelt Differenz der Exponenten
|
||||
#*/
|
||||
extend:
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
|
||||
movl %eax, %ebx # Sicherung des floats
|
||||
call sign # Vorzeichen extrahieren
|
||||
movl %eax, %ecx # ecx:edx wird double enthalten
|
||||
movl %ebx, %eax
|
||||
call exponent # Exponent extrahieren
|
||||
addl $896, %eax # Exponent erweitern -127 +1023
|
||||
shll $11, %ecx
|
||||
orl %eax, %ecx # An ecx anhaengen
|
||||
movl %ebx, %eax
|
||||
call significand # Mantisse extrahieren
|
||||
movl %eax, %edx
|
||||
shrl $3, %eax # Nur 20 Bit passen noch dran
|
||||
shll $20, %ecx
|
||||
orl %eax, %ecx
|
||||
shll $29, %edx # Mantisse erweitern
|
||||
movl %edx, %eax # Ausgabe setzen
|
||||
movl %ecx, %edx
|
||||
|
||||
popl %ecx
|
||||
popl %ebx
|
||||
ret
|
||||
|
||||
/*
|
||||
Vorzeichen des floats extrahieren
|
||||
Ein-/Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
sign:
|
||||
shrl $31, %eax # %eax shiften
|
||||
ret
|
||||
|
||||
/*
|
||||
Exponent des floats extrahieren
|
||||
Ein-/Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
exponent:
|
||||
|
||||
andl $0x7F800000, %eax # exponent maskieren
|
||||
shrl $23, %eax # %eax shiften
|
||||
ret
|
||||
|
||||
/*
|
||||
Mantisse des floats extrahieren
|
||||
Ein-/Ausgabe: %eax
|
||||
|
||||
Notizen: --AUSFUELLEN--
|
||||
*/
|
||||
significand:
|
||||
|
||||
andl $0x007FFFFF, %eax # mantisse maskieren
|
||||
ret
|
||||
|
||||
/*
|
||||
Mantisse mit führender 1 erweitern
|
||||
Ein-/Ausgabe: %eax
|
||||
*/
|
||||
one_mantisse:
|
||||
orl $0x00800000, %eax # mantisse mit führender 1 erweitern
|
||||
ret
|
||||
BIN
ws2010/gdi3/u5/solution.odt
Normal file
BIN
ws2010/gdi3/u6/Uebung-06.pdf
Normal file
BIN
ws2010/gdi3/u6/solution.odt
Normal file
BIN
ws2010/gdi3/u6/solution.pdf
Normal file
BIN
ws2010/gdi3/u7/GDI 3_Hausuebung7_H1.pdf
Normal file
BIN
ws2010/gdi3/u7/Uebung-07.pdf
Normal file
BIN
ws2010/gdi3/u7/solution.odt
Normal file
42
ws2010/gdi3/u8/CRC.asm
Normal file
@ -0,0 +1,42 @@
|
||||
.data
|
||||
intout: .string "0x%08x\n"
|
||||
|
||||
CRC32POLY: .long 0x04C11DB7
|
||||
|
||||
datastream: .long 1,0,0,0,1,1,0,1
|
||||
databits: .long 8
|
||||
|
||||
.text
|
||||
.globl main
|
||||
|
||||
main:
|
||||
movl $0, %eax
|
||||
movl $0 , %ecx
|
||||
L1:
|
||||
|
||||
movl %eax , %ebx
|
||||
and $0x80000000 , %ebx
|
||||
shrl $31 , %ebx
|
||||
movl %ecx , %esi
|
||||
cmpl %ebx , datastream(,%esi,4)
|
||||
je equal
|
||||
|
||||
shll $1 , %eax
|
||||
xor CRC32POLY , %eax
|
||||
jmp goAhead
|
||||
|
||||
equal:
|
||||
shll $1 , %eax
|
||||
|
||||
goAhead:
|
||||
inc %ecx
|
||||
cmpl databits, %ecx
|
||||
jne L1
|
||||
|
||||
pushl %eax
|
||||
pushl $intout
|
||||
call printf
|
||||
|
||||
.Exit:
|
||||
movl $1, %eax
|
||||
int $0x80
|
||||
BIN
ws2010/gdi3/u8/GDI 3 Hausuebung 8.pdf
Normal file
BIN
ws2010/gdi3/u8/Uebung-08.pdf
Normal file
BIN
ws2010/gdi3/u8/solution.odt
Normal file
BIN
ws2010/gdi3/u9/Uebung-09.pdf
Normal file
BIN
ws2010/gdi3/u9/a1_baum.jpg
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
ws2010/gdi3/u9/a1_baum.vsd
Normal file
BIN
ws2010/gdi3/u9/a1_baum_semantisch.jpg
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
ws2010/gdi3/u9/a1_baum_semantisch.vsd
Normal file
BIN
ws2010/gdi3/u9/solution.odt
Normal file
BIN
ws2010/se/300px-Template_Method_UML.svg.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
ws2010/se/438px-Fabrikmethode.svg.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
ws2010/se/496px-Beobachter-pattern.svg.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
ws2010/se/499px-Dekorierer.svg.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
ws2010/se/544px-AbstkrakteFabrik.svg.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
ws2010/se/EX12.jpg
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
ws2010/se/Iterator_Klassen.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
13
ws2010/se/Klausurvorbereitung/Klausurinfo.txt
Normal file
@ -0,0 +1,13 @@
|
||||
Klausur hat wenig mit Übungen zu tun.
|
||||
Auf jeden Fall alle FOLIEN durchgehen und zusammenfassen, da open-book
|
||||
|
||||
|
||||
Klausurinfos vom Prof:
|
||||
- alles
|
||||
- patterns im code bzw UML identifizieren
|
||||
- Rollen von Pattern bennen. Welche klasse/Funktion hat welche Rolle?
|
||||
- openBook-Klausur
|
||||
- Verständnisfragen
|
||||
- Klausur wird nicht zeitlich zu schaffen sein. 1,0 liegt dann bei 80 - 90 % oder
|
||||
auch druntern, je nach Schnitt!
|
||||
-
|
||||
BIN
ws2010/se/Klausurvorbereitung/SE-Zusammenfassung-TUD.pdf
Normal file
BIN
ws2010/se/Klausurvorbereitung/Zusammenfasssung.odt
Normal file
BIN
ws2010/se/Klausurvorbereitung/Zusammenfasssung.pdf
Normal file
BIN
ws2010/se/Klausurvorbereitung/Zusammenfasssung2.odt
Normal file
BIN
ws2010/se/KommandoMuster_Klassen.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
ws2010/se/Kompositum_Klassen.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
ws2010/se/Kompositum_Objekte.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
ws2010/se/Strategie.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
9
ws2010/se/semester project/.classpath
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="test"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="lib" path="lib/commons-io-1.4.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
ws2010/se/semester project/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>EiseProject</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
BIN
ws2010/se/semester project/flashcards_ausf�hrbar.jar
Normal file
BIN
ws2010/se/semester project/lib/commons-io-1.4.jar
Normal file
@ -0,0 +1,50 @@
|
||||
/** License (BSD Style License):
|
||||
* Copyright (c) 2010
|
||||
* Software Engineering
|
||||
* Department of Computer Science
|
||||
* Technische Universität Darmstadt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of the Software Engineering Group or Technische
|
||||
* Universität Darmstadt nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package de.tud.cs.se.flashcards.model;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
SimpleStrategyTests.class,
|
||||
ExtendedStrategyTests.class,
|
||||
FlashcardSeriesTest.class,
|
||||
FlashcardTest.class,
|
||||
ConditionCoverageTest.class,
|
||||
ImportTest.class
|
||||
}
|
||||
)
|
||||
public class AllTests {
|
||||
|
||||
}
|
||||
@ -0,0 +1,124 @@
|
||||
package de.tud.cs.se.flashcards.model;
|
||||
|
||||
import javax.swing.event.ListDataEvent;
|
||||
import javax.swing.event.ListDataListener;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
|
||||
public class ConditionCoverageTest {
|
||||
|
||||
private FlashcardSeries m_flashcard_a;
|
||||
private FlashcardSeries m_flashcard_b;
|
||||
|
||||
@Before public void _setup(){
|
||||
m_flashcard_a = new FlashcardSeries();
|
||||
m_flashcard_b = new FlashcardSeries();
|
||||
|
||||
m_flashcard_a.addListDataListener(null);
|
||||
}
|
||||
|
||||
@Test public void test_removeListDataListener() {
|
||||
|
||||
//covers (true/false)
|
||||
//if (listDataListeners[index] == l) -> true //index = 0
|
||||
//if (index < (listDataListeners.length - 1)) -> false //index = 0; // listDataListeners.length - 1 = 0;
|
||||
|
||||
assertEquals(1, m_flashcard_a.getListDataListeners().length);
|
||||
|
||||
m_flashcard_a.removeListDataListener(null);
|
||||
|
||||
assertEquals(0, m_flashcard_a.getListDataListeners().length);
|
||||
}
|
||||
|
||||
@Test (expected = java.lang.NegativeArraySizeException.class)
|
||||
public void test_removeListDataListener2() {
|
||||
|
||||
|
||||
//covers (???/???)
|
||||
//if (listDataListeners[index] == l) -> ??? (Wird nicht evaluiert)
|
||||
//if (index < (listDataListeners.length - 1)) -> ??? (Wird nicht evaluiert)
|
||||
|
||||
assertEquals(0, m_flashcard_b.getListDataListeners().length);
|
||||
|
||||
m_flashcard_b.removeListDataListener(null);
|
||||
|
||||
assertEquals(0, m_flashcard_b.getListDataListeners().length);
|
||||
}
|
||||
|
||||
@Test (expected = java.lang.ArrayIndexOutOfBoundsException.class)
|
||||
public void test_removeListDataListener3() {
|
||||
|
||||
//covers (false/false)
|
||||
//if (listDataListeners[index] == l) -> false //index = 0
|
||||
//if (index < (listDataListeners.length - 1)) -> false //index = 0; // listDataListeners.length - 1 = 0;
|
||||
|
||||
assertEquals(1, m_flashcard_a.getListDataListeners().length);
|
||||
|
||||
ListDataListener listener = new ListDataListener() {
|
||||
|
||||
public void intervalAdded(ListDataEvent e) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void intervalRemoved(ListDataEvent e) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void contentsChanged(ListDataEvent e) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
};
|
||||
|
||||
m_flashcard_a.removeListDataListener(listener);
|
||||
|
||||
assertEquals(1, m_flashcard_b.getListDataListeners().length);
|
||||
}
|
||||
|
||||
@Test public void test_removeListDataListener4() {
|
||||
|
||||
//covers (true/true)
|
||||
//if (listDataListeners[index] == listner) -> true
|
||||
//if (index < (listDataListeners.length - 1)) -> true //index = 1; // listDataListeners.length - 1 = 2;
|
||||
|
||||
assertEquals(1, m_flashcard_a.getListDataListeners().length);
|
||||
|
||||
ListDataListener listener = new ListDataListener() {
|
||||
|
||||
public void intervalAdded(ListDataEvent e) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void intervalRemoved(ListDataEvent e) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void contentsChanged(ListDataEvent e) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
};
|
||||
ListDataListener listener2 = new ListDataListener() {
|
||||
|
||||
public void intervalAdded(ListDataEvent e) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void intervalRemoved(ListDataEvent e) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void contentsChanged(ListDataEvent e) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
};
|
||||
|
||||
m_flashcard_a.addListDataListener(listener);
|
||||
m_flashcard_a.addListDataListener(listener2);
|
||||
|
||||
assertEquals(3, m_flashcard_a.getListDataListeners().length);
|
||||
|
||||
m_flashcard_a.removeListDataListener(listener);
|
||||
|
||||
assertEquals(2, m_flashcard_a.getListDataListeners().length);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package de.tud.cs.se.flashcards.model;
|
||||
|
||||
import de.tud.cs.se.flashcards.model.strategy.JustNewStrategy;
|
||||
import de.tud.cs.se.flashcards.model.strategy.QuizStrategy;
|
||||
import de.tud.cs.se.flashcards.model.strategy.SystematicStrategy;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
|
||||
public class ExtendedStrategyTests {
|
||||
|
||||
@Before public void _setup(){
|
||||
}
|
||||
|
||||
@Test public void test_quizStrategy(){
|
||||
ILearnStrategy s = new QuizStrategy(FlashcardSeries.createInitialFlashcardSeries());
|
||||
while(s.getNextQuestion() != null){
|
||||
assertFalse(s.getCurrent().getLearnCount()==0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test public void test_justnewStrategy(){
|
||||
ILearnStrategy s = new JustNewStrategy(FlashcardSeries.createInitialFlashcardSeries());
|
||||
while(s.getNextQuestion() != null){
|
||||
assertTrue(s.getCurrent().getLearnCount()==0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test public void test_systematicStrategy(){
|
||||
ILearnStrategy s = new SystematicStrategy(FlashcardSeries.createInitialFlashcardSeries());
|
||||
int lastlc = 0;
|
||||
while(s.getNextQuestion() != null){
|
||||
assertTrue(s.getCurrent().getLearnCount() >= lastlc);
|
||||
lastlc = s.getCurrent().getLearnCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,131 @@
|
||||
package de.tud.cs.se.flashcards.model;
|
||||
|
||||
import javax.swing.event.ListDataEvent;
|
||||
import javax.swing.event.ListDataListener;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
|
||||
public class FlashcardSeriesTest {
|
||||
|
||||
private FlashcardSeries m_flashcard_std_cards;
|
||||
private FlashcardSeries m_flashcard_no_cards;
|
||||
|
||||
@Before public void _setup(){
|
||||
m_flashcard_std_cards = FlashcardSeries.createInitialFlashcardSeries();
|
||||
m_flashcard_no_cards = new FlashcardSeries();
|
||||
}
|
||||
|
||||
@Test public void test_createInitialFlashcardSeries(){
|
||||
assertFalse(m_flashcard_std_cards == null);
|
||||
assertEquals("Hund", m_flashcard_std_cards.getElementAt(0).getQuestion());
|
||||
assertEquals("Haus", m_flashcard_std_cards.getElementAt(1).getQuestion());
|
||||
assertEquals("Beispiel", m_flashcard_std_cards.getElementAt(2).getQuestion());
|
||||
assertEquals("Entwurfsmuster", m_flashcard_std_cards.getElementAt(3).getQuestion());
|
||||
assertEquals("Stellvertreter", m_flashcard_std_cards.getElementAt(4).getQuestion());
|
||||
assertEquals("hoher Zusammenhalt", m_flashcard_std_cards.getElementAt(5).getQuestion());
|
||||
assertEquals("lose Kopplung", m_flashcard_std_cards.getElementAt(6).getQuestion());
|
||||
}
|
||||
|
||||
@Test public void test_addremoveListDataListener(){
|
||||
m_flashcard_no_cards.addListDataListener(null);
|
||||
assertEquals(null,m_flashcard_no_cards.getListDataListeners()[0]);
|
||||
|
||||
ListDataListener listener = new ListDataListener() {
|
||||
|
||||
public void intervalAdded(ListDataEvent e) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void intervalRemoved(ListDataEvent e) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void contentsChanged(ListDataEvent e) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
m_flashcard_no_cards.addListDataListener(listener);
|
||||
assertEquals(listener,m_flashcard_no_cards.getListDataListeners()[1]);
|
||||
assertEquals(2, m_flashcard_no_cards.getListDataListeners().length);
|
||||
|
||||
m_flashcard_no_cards.removeListDataListener(listener);
|
||||
assertEquals(1, m_flashcard_no_cards.getListDataListeners().length);
|
||||
assertEquals(null,m_flashcard_no_cards.getListDataListeners()[0]);
|
||||
|
||||
m_flashcard_no_cards.removeListDataListener(null);
|
||||
assertEquals(0, m_flashcard_no_cards.getListDataListeners().length);
|
||||
|
||||
m_flashcard_no_cards.addListDataListener(null);
|
||||
m_flashcard_no_cards.addListDataListener(listener);
|
||||
m_flashcard_no_cards.removeListDataListener(null);
|
||||
m_flashcard_no_cards.removeListDataListener(listener);
|
||||
assertEquals(0, m_flashcard_no_cards.getListDataListeners().length);
|
||||
}
|
||||
|
||||
@Test public void test_addremoveCard() {
|
||||
|
||||
assertEquals(0,m_flashcard_no_cards.getSize());
|
||||
assertEquals(7, m_flashcard_std_cards.getSize());
|
||||
|
||||
m_flashcard_no_cards.addCard(new Flashcard("abc","ABC"));
|
||||
assertEquals(1,m_flashcard_no_cards.getSize());
|
||||
|
||||
int[] i = {0};
|
||||
m_flashcard_no_cards.removeCards(i);
|
||||
|
||||
assertEquals(0,m_flashcard_no_cards.getSize());
|
||||
}
|
||||
|
||||
@Test public void test_fireInterval() {
|
||||
ListDataListener listener = new ListDataListener() {
|
||||
|
||||
public void intervalAdded(ListDataEvent e) {
|
||||
assertEquals("ABC",((FlashcardSeries)e.getSource()).getElementAt(0).getAnswer());
|
||||
}
|
||||
|
||||
public void intervalRemoved(ListDataEvent e) {
|
||||
assertEquals("Dog",((FlashcardSeries)e.getSource()).getElementAt(0).getAnswer());
|
||||
}
|
||||
|
||||
public void contentsChanged(ListDataEvent e) {}
|
||||
};
|
||||
|
||||
m_flashcard_std_cards.addListDataListener(listener);
|
||||
m_flashcard_std_cards.addCard(new Flashcard("abc","ABC"));
|
||||
int[] i = {0};
|
||||
m_flashcard_std_cards.removeCards(i);
|
||||
m_flashcard_std_cards.getElementAt(0).setAnswer("Delphin");
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
protected void fireIntervalAdded(Object source, int index0, int index1) {
|
||||
|
||||
if (listDataListeners != NO_LIST_DATA_LISTENERS) {
|
||||
ListDataListener[] listeners = listDataListeners;
|
||||
ListDataEvent e = new ListDataEvent(source,
|
||||
ListDataEvent.INTERVAL_ADDED, index0, index1);
|
||||
|
||||
for (int i = listeners.length - 1; i >= 0; i -= 1) {
|
||||
listeners[i].intervalAdded(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void fireIntervalRemoved(Object source, int index0, int index1) {
|
||||
|
||||
if (listDataListeners != NO_LIST_DATA_LISTENERS) {
|
||||
ListDataListener[] listeners = listDataListeners;
|
||||
ListDataEvent e = new ListDataEvent(source,
|
||||
ListDataEvent.INTERVAL_REMOVED, index0, index1);
|
||||
|
||||
for (int i = listeners.length - 1; i >= 0; i -= 1) {
|
||||
listeners[i].intervalRemoved(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package de.tud.cs.se.flashcards.model;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class FlashcardTest {
|
||||
|
||||
private Flashcard m_flashcard_text;
|
||||
private Flashcard m_flashcard_no_text;
|
||||
|
||||
@Before public void _setup(){
|
||||
|
||||
m_flashcard_text = new Flashcard("Wurde diese Karte getestet?","ja");
|
||||
m_flashcard_no_text = new Flashcard();
|
||||
|
||||
}
|
||||
|
||||
@Test public void test_getAnswer() {
|
||||
|
||||
assertEquals("ja",m_flashcard_text.getAnswer());
|
||||
assertEquals("",m_flashcard_no_text.getAnswer());
|
||||
}
|
||||
|
||||
@Test public void test_getQuestion() {
|
||||
|
||||
assertEquals("Wurde diese Karte getestet?",m_flashcard_text.getQuestion());
|
||||
assertEquals("",m_flashcard_no_text.getQuestion());
|
||||
}
|
||||
|
||||
@Test public void test_setAnswer() {
|
||||
|
||||
m_flashcard_no_text.setAnswer("Not an empty answer");
|
||||
assertEquals("Not an empty answer",m_flashcard_no_text.getAnswer());
|
||||
}
|
||||
|
||||
@Test public void test_setQuestion() {
|
||||
|
||||
m_flashcard_no_text.setQuestion("Not an empty question");
|
||||
assertEquals("Not an empty question",m_flashcard_no_text.getQuestion());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package de.tud.cs.se.flashcards.model;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import de.tud.cs.se.flashcards.model.Flashcard;
|
||||
import de.tud.cs.se.flashcards.model.FlashcardSeries;
|
||||
import de.tud.cs.se.flashcards.persistence.Store;
|
||||
import de.tud.cs.se.flashcards.ui.FlashcardsWindow;
|
||||
|
||||
public class ImportTest {
|
||||
|
||||
private FlashcardsWindow window;
|
||||
|
||||
@Before public void _setup(){
|
||||
window = new FlashcardsWindow(FlashcardSeries.createInitialFlashcardSeries());
|
||||
}
|
||||
|
||||
@Test (expected = IOException.class)
|
||||
public void test_filenotfound() throws IOException {
|
||||
Store.importSeries(window.getSeries(), new File(""));
|
||||
}
|
||||
|
||||
@Test public void test_keepowncard() throws IOException {
|
||||
FlashcardSeries s = new FlashcardSeries();
|
||||
s.addCard(new Flashcard("Hund", ""));
|
||||
|
||||
File file = new File("test_keepowncard" + Store.FILE_ENDING);
|
||||
Store.saveSeries(s, file);
|
||||
|
||||
int cardcount = window.getSeries().getSize();
|
||||
|
||||
Store.importSeries(window.getSeries(), file);
|
||||
|
||||
for(int i=0; i < window.getSeries().getSize(); i++){
|
||||
if(window.getSeries().getElementAt(i).getQuestion().equals("Hund")){
|
||||
assertFalse(window.getSeries().getElementAt(i).getAnswer().equals(""));
|
||||
}
|
||||
}
|
||||
assertEquals(window.getSeries().getSize(), cardcount);
|
||||
}
|
||||
|
||||
@Test public void test_noduplicates() throws IOException {
|
||||
|
||||
FlashcardSeries s = FlashcardSeries.createInitialFlashcardSeries();
|
||||
|
||||
File file = new File("test_noduplicates" + Store.FILE_ENDING);
|
||||
Store.saveSeries(s, file);
|
||||
|
||||
int cardcount = window.getSeries().getSize();
|
||||
|
||||
Store.importSeries(window.getSeries(), file);
|
||||
|
||||
Vector<String> temp = new Vector<String>();
|
||||
|
||||
for(int i=0; i < window.getSeries().getSize(); i++){
|
||||
for(int j=0; j < temp.size(); j++){
|
||||
assertFalse(temp.get(j).equals(window.getSeries().getElementAt(i).getQuestion()));
|
||||
}
|
||||
|
||||
temp.add(window.getSeries().getElementAt(i).getQuestion());
|
||||
}
|
||||
|
||||
assertEquals(window.getSeries().getSize(), cardcount);
|
||||
|
||||
}
|
||||
|
||||
@Test public void test_importnothing() throws IOException {
|
||||
|
||||
FlashcardSeries s = new FlashcardSeries();
|
||||
|
||||
File file = new File("test_importnothing" + Store.FILE_ENDING);
|
||||
Store.saveSeries(s, file);
|
||||
|
||||
int cardcount = window.getSeries().getSize();
|
||||
|
||||
Store.importSeries(window.getSeries(), file);
|
||||
|
||||
assertEquals(window.getSeries().getSize(), cardcount);
|
||||
}
|
||||
|
||||
@Test public void test_normalimport() throws IOException {
|
||||
|
||||
FlashcardSeries s = new FlashcardSeries();
|
||||
s.addCard(new Flashcard("fwretxcdrhtet234xdf", "gsfdg"));
|
||||
|
||||
File file = new File("test_normalimport" + Store.FILE_ENDING);
|
||||
Store.saveSeries(s, file);
|
||||
|
||||
int cardcount = window.getSeries().getSize();
|
||||
|
||||
Store.importSeries(window.getSeries(), file);
|
||||
|
||||
assertEquals(window.getSeries().getSize(), cardcount+1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package de.tud.cs.se.flashcards.model;
|
||||
|
||||
import de.tud.cs.se.flashcards.model.strategy.LastestFirstStrategy;
|
||||
import de.tud.cs.se.flashcards.model.strategy.OldestFirstStrategy;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
|
||||
public class SimpleStrategyTests {
|
||||
|
||||
@Before public void _setup(){
|
||||
}
|
||||
|
||||
@Test public void test_latestStrategy(){
|
||||
ILearnStrategy s = new LastestFirstStrategy(FlashcardSeries.createInitialFlashcardSeries());
|
||||
assertEquals("Hund", s.getNextQuestion());
|
||||
assertEquals("Dog", s.getNextAnswer());
|
||||
}
|
||||
|
||||
@Test public void test_oldestStrategy(){
|
||||
ILearnStrategy s = new OldestFirstStrategy(FlashcardSeries.createInitialFlashcardSeries());
|
||||
assertEquals("lose Kopplung", s.getNextQuestion());
|
||||
assertEquals("loose coupling", s.getNextAnswer());
|
||||
}
|
||||
}
|
||||
63
ws2010/se/u1/crc-cards.txt
Normal file
@ -0,0 +1,63 @@
|
||||
Anforderungen:
|
||||
A1 karten erstellen,
|
||||
editieren,
|
||||
in datei speichern,
|
||||
von datei laden,
|
||||
lernen(rictig falsch)
|
||||
in jedem durchlauf nur einmal anzeigen
|
||||
A2 Doppelseitiges lernen
|
||||
A3 Export 2 JPEG/Syncro
|
||||
|
||||
Karte: text, Formeln, Bilder
|
||||
|
||||
|
||||
Class : CFlashCard
|
||||
Responsibilities: Question(CCardPage) Answer(CCardPage), zähler(richtig falsch viewed), already viewed?, speichern, laden, editieren (+ richtig + falsch + viewed)
|
||||
Collaborations : CCardPage
|
||||
|
||||
Class : CCardPage(Canvas)
|
||||
Responsibilities: A1 Beinhaltet Text, Bilder/Formeln, editieren, speichern, laden, eindeutige ids, (card2pic)
|
||||
Responsibilities: A2 Kategorie
|
||||
Collaborations : CCardContent
|
||||
|
||||
Class : CCardContent
|
||||
Responsibilities: InhaltOberklasse, Position auf Karte, speichern, laden
|
||||
Collaborations : CCardContent_Text/Picture/Formula
|
||||
|
||||
Class : CCardContent_Text
|
||||
Responsibilities: render to canvas,speichern, laden
|
||||
Collaborations : CCardContent
|
||||
|
||||
Class : CCardContent_Picture
|
||||
Responsibilities: render to canvas,speichern, laden
|
||||
Collaborations : CCardContent
|
||||
|
||||
Class : CCardContent_Formula
|
||||
Responsibilities: render to canvas,speichern, laden
|
||||
Collaborations : CCardContent
|
||||
|
||||
Class : CCardList
|
||||
Responsibilities: A1 Sortieren(lernerfolg), next card(random oder nächste), neue karte, speichern, laden
|
||||
Responsibilities: A2 zz gewählte Kategorien
|
||||
Responsibilities: A3 syncronisieren mit Smartphone
|
||||
Collaborations : CFlashCard
|
||||
|
||||
Class : CCardLists
|
||||
Responsibilities: Verwalten der Kartenlisten, Standartliste
|
||||
Collaborations : CCardList
|
||||
|
||||
Class : CCardGUI
|
||||
Responsibilities: Anzeige
|
||||
Collaborations : CCardLists, CCardList, CFlashCard, CCardPage, CCardApp
|
||||
|
||||
Class : CCardApp
|
||||
Responsibilities: Systemanbindung
|
||||
Collaborations : CCardGUI, CCardLists
|
||||
|
||||
Class : CJpegBuilder
|
||||
Responsibilities: Erstellt aus Canvas(CCardPage) ein Jpeg Bild
|
||||
Collaborations : CCardPage
|
||||
|
||||
Class : CBmpBuilder...
|
||||
Responsibilities: Erstellt aus Canvas(CCardPage) ein Bmp Bild
|
||||
Collaborations : CCardPage
|
||||
8
ws2010/se/u10/.classpath
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="test"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/commons-io-1.4.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
ws2010/se/u10/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>EiSE-Exercise10</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
BIN
ws2010/se/u10/EX10 A3.3.jpg
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
ws2010/se/u10/ex10.pdf
Normal file
BIN
ws2010/se/u10/lib/commons-io-1.4.jar
Normal file
BIN
ws2010/se/u10/solution.odt
Normal file
BIN
ws2010/se/u10/solution.pdf
Normal file
BIN
ws2010/se/u11/EX11 A1.4.jpg
Normal file
|
After Width: | Height: | Size: 150 KiB |
BIN
ws2010/se/u11/ex11.pdf
Normal file
BIN
ws2010/se/u11/solution.odt
Normal file
BIN
ws2010/se/u11/solution.pdf
Normal file
BIN
ws2010/se/u12/ex12.pdf
Normal file
BIN
ws2010/se/u12/solution.odt
Normal file
27
ws2010/se/u2/ex2.txt
Normal file
@ -0,0 +1,27 @@
|
||||
3.
|
||||
|
||||
a)
|
||||
|
||||
1. NFR -> Product requirements -> Portability requirements / Usability requirements
|
||||
2. NFR -> external -> ethical / NRF -> Orga -> Standards
|
||||
3. NFR -> Product -> Efficiency -> Performance
|
||||
4. NFR -> Product -> Usability
|
||||
|
||||
b)
|
||||
|
||||
NFR
|
||||
|-Product
|
||||
| |-Portability = Die Lernkartei muss auf den gängigen Smartphones laufen (explizit: iPhone, Blackberry, Androidsysteme)
|
||||
| |-Reliability = Die Lernkartei muss
|
||||
| |-Efficiency = Die Lernkartei muss bei einer Lernkartei mit 100000 Lernkarteikarten die nächste Karte in <= 50ms anzeigen (smartphones 150ms)
|
||||
| |-Usability = Die Lernkartei muss
|
||||
|
|
||||
|-Organizational
|
||||
| |-Delivery = Die Lernkartei muss bis zum x.x.x mit allen anforderungen erfüllt dem Kunden ausgeliefert werden
|
||||
| |-Implementaion = Die Lernkartei muss in java 1.6 geschreiben werden und darf nur auf libs/projekten, welche unter lgpl veröffentlicht wurden, verwenden
|
||||
| |-Standards = Die Lernkartei muss Karteien als csv exportieren. Es muss eine Dokumentation des Dateiformats frei zugänglich gemacht werden
|
||||
|
|
||||
|-External
|
||||
| |-Interoperability = Die Lernkartei muss
|
||||
| |-Ethical = Die Lernkartei muss in Deutsch u. English zur verfügung stehen. Desweiteren muss eine Schnittstelle zur übersetzung geschaffen werden (sprach-datei)
|
||||
| |-Legislative = Die Lernkartei muss als Webanwendung über ssl zur verfügung stehen
|
||||
BIN
ws2010/se/u3/A1.jpg
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
ws2010/se/u3/FullyDressed-UseCase-Template.doc
Normal file
BIN
ws2010/se/u3/FullyDressed-UseCase-Template.odt
Normal file
77
ws2010/se/u3/a1 & 2.txt
Normal file
@ -0,0 +1,77 @@
|
||||
Größter Blödsinn den ich je gehört habe
|
||||
|
||||
name: Starten der Anwendung
|
||||
text: liste mit zusammengehörigen Lernkarteien wird angezeigt
|
||||
|
||||
name: filtern/sortieren
|
||||
text: filtern/sortieren nach erstelldatum, zuletzt gelernt, wie oft gelernt
|
||||
speichert diese infos (datum + uhrzeit des letzten (nicht) erinnerns)
|
||||
|
||||
name: erstellen von karten
|
||||
text: Inhalte frei anzuordnen -> bilder, text, formeln
|
||||
jede karte mindestens ein textfeld für frage-> in der übersicht anzeigen
|
||||
|
||||
name: anzeige von karten infos (infoleiste)
|
||||
text: erstelldatum + uhrzeit, datum letzten (nicht) erinnerns + Uhrzeit,
|
||||
wie oft gelernt
|
||||
wie oft hintereinander richtig beantwortet
|
||||
fehlerfall: keine karte -> Hinweistext
|
||||
fehlerfall: mehrere karten -> Hinweistext
|
||||
|
||||
name: lernen
|
||||
text: immer nur eine lernkartei, neues fenster für karteikarte, lernerfolg(richtig ja nein)
|
||||
zur nächsten karte -> update der infoleiste
|
||||
|
||||
name: karten bearbeiten & hinzufügen & löschen
|
||||
text: fehlerfall: leere karten können nicht gespeichert werden
|
||||
|
||||
name: lernkartei laden/speichern/anlegen
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------
|
||||
|
||||
Name des Anwendungsfalls
|
||||
(Use Case Name)
|
||||
Chatroom learning
|
||||
|
||||
Kurzbeschreibung des Anwendungsfallziels
|
||||
(Goal in Context)
|
||||
Zwei Benutzer lernen mithilfe der Webanwendung als Abfrager und Gefragter eine Lernkartei
|
||||
|
||||
Interessensgruppe und Interessen
|
||||
(Stakeholders and Interests)
|
||||
Lernender(Gefragter): Lernen
|
||||
Abfragender: ???
|
||||
|
||||
Minimale Garantien
|
||||
(Minimal Guarantees)
|
||||
Lernerfolg wird zu jeder zeit gespeichert
|
||||
|
||||
Erfolgsgarantien
|
||||
(Success Guarantees)
|
||||
Anzeigen falls Antwort richtig/falsch
|
||||
|
||||
Hauptakteur
|
||||
(Primary Actor)
|
||||
gefragter, Abfragender
|
||||
|
||||
Untergeordnete Akteure
|
||||
(Secondary Actors)
|
||||
|
||||
Übergeordnete Use Cases
|
||||
(Superordinate Use Cases)
|
||||
|
||||
Untergeordnete Use Cases
|
||||
(Subordinate Use Cases)
|
||||
|
||||
Vorbedingungen
|
||||
(Precondition)
|
||||
Lernender hat Abfrager gefunden
|
||||
|
||||
Haupterfolgsszenario
|
||||
(Main Success Scenario)
|
||||
Lernender beantwortet alle Karten in einer Lernkartei
|
||||
|
||||
Erweiterungen
|
||||
(Extensions)
|
||||
|
||||
BIN
ws2010/se/u3/solution.pdf
Normal file
BIN
ws2010/se/u7/ex07.pdf
Normal file
BIN
ws2010/se/u7/ex07_loesungs_vorschlag.docx
Normal file
15
ws2010/se/u7/se bescheibung.txt
Normal file
@ -0,0 +1,15 @@
|
||||
useratory:
|
||||
|
||||
flashcardanwendung
|
||||
lernen
|
||||
flashcards bei freunden -> aus verschiedenen kategorien
|
||||
will karten mit freunden austauschen(kartensets)
|
||||
freund gibt ihm die datei -> kann sie laden
|
||||
will (immer) alle seine Karten lernen die er besitzt.
|
||||
will kartensets zum gleichen thema zusammenlernen(seine + karten von freunden)
|
||||
er will ein set aus mehreren Kartensets zusammen abspeichern
|
||||
Doppelte Karten -> löschen(tauchen nicht auf) -> Wenn Frage gleich = Doppelt
|
||||
Will nicht umbedingt wissen von wem die Karten sind
|
||||
lernerfolg unwichtig
|
||||
löschen der Karten -> eigene Karten behalten
|
||||
importieren in vorhandenes set
|
||||
BIN
ws2010/se/u7/solution.odt
Normal file
BIN
ws2010/se/u7/solution.pdf
Normal file
BIN
ws2010/se/u7/vortrag.m4a
Normal file
BIN
ws2010/se/u8/ex08.pdf
Normal file
BIN
ws2010/se/u8/solution.odt
Normal file
BIN
ws2010/se/u8/solution.pdf
Normal file
8
ws2010/se/u9/.classpath
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="test"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/commons-io-1.4.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
ws2010/se/u9/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>EiSE-Exercise09</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
BIN
ws2010/se/u9/EX9 A2c.jpg
Normal file
|
After Width: | Height: | Size: 81 KiB |