Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 714
  • Last Modified:

how to input a number into an array

Machine language array insert explanation pep8
0
tagtekin
Asked:
tagtekin
2 Solutions
 
abithCommented:
refer this link
http://www.experts-exchange.com/Programming/Languages/Assembly/Q_22956333.html (not-accepted one).

but there are something that related to array.

0
 
abithCommented:
i am sorry i didnt notice that u want in pep8
0
 
abithCommented:
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
tagtekinAuthor Commented:
I dont see any pep 8 here they are all pythone
0
 
BrianGEFF719Commented:
I'm very good with PEP...I had some crazy professors who loved it. Why dont you post what you have so far and I can help you from there.

Here is a basic array example, I hope it helps.

This is a conversion of the following C++ program:

 int main()
 {
  int vector[4];
  int i;
  for(i=0;i<4;i++)
   cin >> vector[i];

  for(i = 3; i >=0; i--)
  cout <<i << ' ' << vector[i] << endl;

 return 0;
}


BR main
vector:  .EQUATE 2          ;LOCAL VARIABLE
i:       .EQUATE 2          ;LOCAL VARIABLE
main:    SUBSP   10,i       ;allocate 10 bytes for locals
         LDX     0,i        ;for(i = 0
         STX     i,s        
for1:    CPX     4,i        ; i<4
         BRGE    endFor1   
         ASLX               ;each element is 2 bytes
         DECI    vector,sx  ; cin >> vector[i]
         LDX     i,s
         ADDX    1,i
         STX     i,s
         BR      for1
endFor1: LDX     3,i        ;for(i = 3
         STX     i,s
for2:    CPX     0,i        ; i>=0
         BRLT    endFor2
         DECO    i,s        ; cout << i
         CHARO  ' ',i       ; << ' '
         ASLX               ;PEP uses 16bit ints (2bytes)
         DECO   vector,sx   ; << vector[i]
         CHARO  '\n',i      ; << endl
         LDX    i,s         ; i--
         SUBX   1,i
         STX    i,s
         BR     for2
endFor2: ADDSP  10,i        ;deallocate 10 bytes
         STOP
.END 
         
         

Open in new window

0
 
BrianGEFF719Commented:
@MBIZUP,

Abith posted a python link, highly irrelevant to the question at hand.

0
 
abithCommented:
>>Abith posted a python link
  Yes

>> highly irrelevant to the question at hand.
  I posted the link just to understand the arrays concept in Pep8.
0
 
BrianGEFF719Commented:
>>  I posted the link just to understand the arrays concept in Pep8.

I don't see how Python and PEP are related. I'm not going to argue points, I'm happy to split if it will make your day. :-)

Brian
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now