简体   繁体   中英

Translating C++ to Pep/8 Assembly Language— Char Array

As the title states, I am currently having issues translating a C++ program to PEP/8.

The first part of the program deals with input and output of a char array. The strInput function simply reads in character values into an array until the user hits enter or the size of the array reaches 63. When the user hits enter, a '0' is stored instead of '\\n'. If the array reaches [63], a '0' is stored in [64]. The strOut function prints the contents of the array until a '0' is found or the length of the array is reached.

I have been playing around the current assembly code, however I am continuously prompted for input. I think the problem might be with the X register and/or the offset from the stack. Any insight would be appreciated.

C++ code: https://gist.github.com/anonymous/b690427aaf465dd7326a

Pep/8: https://gist.github.com/anonymous/37a51a34f7eecb15f4ee

I believe you need to 'SUBSP' at the beginning of your functions, to make room for the variables, versus 'ADDSP'.

EDIT: I made that change, amongst other things, and I cannot figure it out either. Let everyone know if you find the solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM