EASy68K  
It is currently Thu Nov 15, 2018 1:30 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri Nov 02, 2018 4:17 pm 
Offline

Joined: Fri Nov 02, 2018 4:05 pm
Posts: 1
Hello, I have a basic programming assignment due tonight using EASy68k. I Have to preload an array of digits, prompt two numbers, and use the modulus of the two numbers to display the number at that index of the array. Everything is working the way it should, but for some reason, the wrong prompts are being displayed and I can't figure out why. If someone could point me in the right direction, I would really appreciate it.
Thanks,
Chris

* Description:
*-----------------------------------------------------------
ORG $1000
START: ; first instruction of program

* Put program code here

LEA Array, A3 ;Load array and messages to Address registers
LEA Message1, A0
LEA Message2, A1
LEA Output, A2

MOVE #14, D0 ;Display first prompt
TRAP #15

MOVE #4, D0 ;Take numeric input as ASCII edit to return key
TRAP #15

MOVE D1, D2 ;Move number from D1 to D2, then Clear D1
CLR D1

MOVE A1, D0 ;Move message2 from A1 to A0, then output via Trap task 14
MOVE D0, A0
MOVE #14, D0
TRAP #15

MOVE #4, D0 ;Take numeric input as ASCII edit to return key
TRAP #15

DIVU D1, D2 ;Divide D2 by D1, then swap upper and lower of D2 to obtain the remainder
SWAP D2

ADD D2, A3 ;Add number obtained in previous step to increment array
MOVE.B (A3), D1 ;Move number stored at that array index to D1

MOVE A2, D0 ;Move Output message to A0
MOVE D0, A0

MOVE #14, D0 ;Output message
TRAP #15

MOVE #3, D0 ;Output number stored in D1
TRAP #15

MOVE #9, D0
TRAP #15

SIMHALT ; halt simulator

* Put variables and constants here

Array DC.B 2, 3, 8, 7, 6, 5, 4
Message1 DC.W 'Please enter an index, then hit enter: ', 0
Message2 DC.W 'Please enter a size, then hit enter: ', 0
Output DC.W 'Array element at specified location is: ', 0

END START ; last line of source


Attachments:
68k output.PNG
68k output.PNG [ 294.57 KiB | Viewed 156 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group