Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- struct Incidencia {
- char carretera [8];//8
- int km;//2
- char problema[128];//128
- };//138
- Incidencia i[]={
- {"NII",2,"atasco"},
- {"A18",69,"nieve"},
- {"A152",115,"meteorito"}
- };
- int km(0) ,size (sizeof (Incidencia));//140
- char a[128],b[128];
- int deslplazamiento(8);
- asm (
- "INICIO :"
- "nop \n\t"
- "lea (%5),%%ebx\n\t"/* carga la direccion de base de i de struct incidencia*/
- "add %3,%%ebx \n\t"/* suma a ebx el tamano de la struct*/
- "add %3,%%ebx \n\t"/* suma a ebx el tamano de la struct*/
- "mov 8(%%ebx),%2 \n\t"/* accede a km tras los 8 char de carretera*/
- :"=g"(a) , "=g"(b),"=g"(km) ,"=m" (size),"=c" (deslplazamiento)/* %0 %1 %2 %3 %4 */
- :"r"(i) /* %5*/
- );
- cout<<"size "<<size<<endl;
- cout<<km<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement