sorry, i don't know which forum i should post this question.

Q) a machine language program to input 2 numbers then adds 2 numbers then output the single-character result.

this is what i got so far but it doesn't work..any help plz~~

0000	4900FE ;Get input from the user and store it @ 00FE
0003	4900FF ;Get input from the user and store it @ 00FF
0006	910022 ;Convert second input to decimal
0009	F100FA ;Store second decimal
000C	D100FE ;Load first input into memory
000F	910022 ;Convert first input to decimal
0015	A10020 ;convert sum to character
0018	F1001F ;store the character
001B	51001F ;output the character
001E	00     ; stop
001F	00     ; character to output
0020	0030   ; convert mask to ASCII from decimal
0022	000F   ; convert mask to decimal from ASCII

Hex Version for the Loader in Pep/8 simulator

49 00 FE 49 00 FF 91 00 22 F1 00 FA D1 00 FE 91 00 22 71 00 FA A1 00 20 F1 00 1F 51 00 1F 00 00 00 30 00 0F zz

for what purpose? And why not just store and add the hex, then if you want convert only the answer to dec for std out.

for what purpose? And why not just store and add the hex, then if you want convert only the answer to dec for std out.

Did anyone ever figure out why this did not work?

Did anyone ever figure out why this did not work?

i DIDNT even think about it. As I infer in another post, with today's DRAM and CPU speed, simplicity is far more important, and nothing is simpler than a lookup table.

I am trying to get this problem worked out but still not able get it right.

0000 4900FE ;Get input from the user and store it @ 00FE
0003 4900FF ;Get input from the user and store it @ 00FF
0006 D100FE ;load first input to memory
0009 910025 ;Convert first input to decimal
000C F100FE ;Store first decimal
000F D100FF ;Load second input into memory
0012 910025 ;Convert second input to decimal
0018 A10023 ;convert sum to character
001B F100FF ;store the character
001E 5100FF ;output the character
0021 00 ; stop
0022 00 ; character to output
0023 0030 ; convert mask to ASCII from decimal
0025 000F ; convert mask to decimal from ASCII

49 00 FE 49 00 FF D1 00 FE 91 00 25 F1 00 FE D1
00 FF 91 00 25 71 00 FE A1 00 23 F1 00 FF 51 00
FF 00 00 00 30 00 0F zz

My input is:
5
2

Output:
4

Any help would be appreciated.

I am trying to get this problem worked out but still not able get it right.

0000 4900FE ;Get input from the user and store it @ 00FE
0003 4900FF ;Get input from the user and store it @ 00FF
0006 D100FE ;load first input to memory
0009 910025 ;Convert first input to decimal
000C F100FE ;Store first decimal
000F D100FF ;Load second input into memory
0012 910025 ;Convert second input to decimal
0018 A10023 ;convert sum to character
001B F100FF ;store the character
001E 5100FF ;output the character
0021 00 ; stop
0022 00 ; character to output
0023 0030 ; convert mask to ASCII from decimal
0025 000F ; convert mask to decimal from ASCII

49 00 FE 49 00 FF D1 00 FE 91 00 25 F1 00 FE D1
00 FF 91 00 25 71 00 FE A1 00 23 F1 00 FF 51 00
FF 00 00 00 30 00 0F zz

My input is:
5
2

Output:
4

Any help would be appreciated.

Do all the math in hex. Only convert to decimal at output.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.