Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This program was written by Brenton Stockwell on November 30, 2011 for Boyd's CSCI 10 class.'
- program Starter;
- // includes
- #include ("stdlib.hhf");
- type
- int32Node: record
- number: int32;
- nextNode: pointer to int32Node;
- endrecord;
- type pInt32Node: pointer to int32Node;
- // static declarations
- static
- listHead: pInt32Node := NULL;
- loopCounter: uns32 := 0;
- choice: char;
- begin Starter;
- mem.alloc(@size(int32Node));
- mov(eax, (type int32Node listHead).nextNode);
- stdout.put("Hello, would you like to input a number? <Y/N>",nl);
- stdin.get(choice);
- //this is where all of the singly linked list stuff goes.
- while(eax != 'n' || eax != 'N') do
- push(eax);
- mem.alloc(@size(int32Node));
- mov(eax, ebx);
- mov(null, (type int32Node [ebx]).nextNode);
- mov(listHead, (type int32Node [ebx]).nextNode);
- mov(ebx, listHead);
- stdout.put("Please insert a number.",nl);
- stdin.geti32();
- mov(eax, (type int32Node [ebx]).number);
- pop(eax);
- inc(loopCounter);
- stdout.put("Hello, would you like to input another number? <Y/N>",nl);
- stdin.get(choice);
- endwhile;
- //now here is where all of the review stuff goes! this will only be viewed if they leave the loop.
- for(mov(0, ecx); ecx<loopCounter; inc(ecx)) do
- stdout.put((type int32Node [ebx+ecx]));
- stdout.put((type int32Node [ebx+ecx]).number);
- stdout.put((type int32Node [ebx+ecx]).nextNode);
- endfor;
- mem.free(eax);
- end Starter;
Add Comment
Please, Sign In to add comment