Guest User

Untitled

a guest
Apr 16th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //This program was written by Brenton Stockwell on November 30, 2011 for Boyd's CSCI 10 class.'
  2.  
  3.  
  4. program Starter;
  5.  
  6. // includes
  7.     #include ("stdlib.hhf");
  8.  
  9.     type
  10.         int32Node: record
  11.             number: int32;
  12.             nextNode: pointer to int32Node;
  13.         endrecord;
  14.    
  15.     type pInt32Node: pointer to int32Node;
  16.    
  17.    
  18. // static declarations
  19. static
  20.  
  21.     listHead: pInt32Node := NULL;
  22.     loopCounter: uns32 := 0;
  23.     choice: char;
  24.    
  25. begin Starter;
  26.  
  27. mem.alloc(@size(int32Node));
  28. mov(eax, (type int32Node listHead).nextNode);
  29.  
  30.  
  31. stdout.put("Hello, would you like to input a number? <Y/N>",nl);
  32. stdin.get(choice);
  33. //this is where all of the singly linked list stuff goes.
  34. while(eax != 'n' || eax != 'N') do
  35.     push(eax);
  36.  
  37.    
  38.     mem.alloc(@size(int32Node));
  39.     mov(eax, ebx);
  40.     mov(null, (type int32Node [ebx]).nextNode);
  41.     mov(listHead, (type int32Node [ebx]).nextNode);
  42.     mov(ebx, listHead);
  43.    
  44.     stdout.put("Please insert a number.",nl);
  45.     stdin.geti32();
  46.     mov(eax, (type int32Node [ebx]).number);
  47.    
  48.  
  49.     pop(eax);
  50.    
  51.     inc(loopCounter);
  52.    
  53.     stdout.put("Hello, would you like to input another number? <Y/N>",nl);
  54.     stdin.get(choice);
  55. endwhile;
  56.  
  57. //now here is where all of the review stuff goes! this will only be viewed if they leave the loop.
  58.  
  59. for(mov(0, ecx); ecx<loopCounter; inc(ecx)) do
  60.     stdout.put((type int32Node [ebx+ecx]));
  61.     stdout.put((type int32Node [ebx+ecx]).number);
  62.     stdout.put((type int32Node [ebx+ecx]).nextNode);
  63. endfor;
  64. mem.free(eax);
  65. end Starter;
Add Comment
Please, Sign In to add comment