Jump to content

program help/troubleshooting

- - - - -

  • Please log in to reply
3 replies to this topic

#1
nickhulium

nickhulium

    Newbie

  • Members
  • Pip
  • 1 posts
hi, ive been looking for a site hopefully that can help me out with a programming assignment im doing for class. my tutor thinks its a good idea to not help me and i am turning to online for help as the professor never helps and the book barely helps me.

i think im almost done doing the assignment like im so close. we are learning assembly language and we run the programs on CUSP. the assembler is CHASM. i dont know if this is relevant. I see different forms of assembly on the internet which is different from the variant im learning and hopefully someone can knows the kind im learning and can help me. thank you to anyone who can even help the slightest bit! maybe if someone can explain the logic behind the code more with an answer thatd be helpful.

write a program which:
a)calls PUT-STR (JSR $e05) to prompt a user to input a string of max length 35. the length of the prompt string should be stored in memory.

b)calls get-str (JSR $e04) to get this string from the keyboard (max length 20) and also the actual length of the string (35) as a return paramter.

c)calls PUT-STR to print the string obtained in (b)

d) calls a subroutine DELETE to delete all digits from the input string. (you need to write this subroutine)

e) calls PUT-STR to print the string obtained in (d) and the next line saying "BYe bye, Programming Assignments."

Note:
1)Length of strings should be passed as Call by Value (both "call" and "return").
2)address of strings should be passed as call by address.

3)the main program which performs actions a), b), c), d), and e) as well as subroutine DELETE will be assembled together as one program

INPUT STRING: C12LIN34TON COR657NE98

so basically i need help with a program to take in the string, deleting the numbers in a subroutine and outputting the answer. so essnentialy my output should be something like C LIN TON COR NE. my professor said to load the ascii value for the space character to replace the numbers which i tried to do but it didnt work.

here is my code so far hopefully someone can recognize this variant of assembly. my program lets me input the string but returns the whole string even with all characters and no replacements of the numbers with space. and it doesnt output bye bye programming assignments. thank you to anyone who can help even the slightest bit!

.EQU GET_STR, $E04
.EQU PUT_STR, $E05
.EQU PUT_NL, $E06

LDS# $E00
PSH# ENTERL     ;STRING "INPUT STRING OF MAX LENGTH 35"
PSH# ENTER
JSR PUT_STR     ;PRINT STRING
JSR PUT_NL     ;NEW LINE

PSH# 35
PSH# STRING1

PSH# SIZE
JSR GET_STR
ADS# 5

JSR PUT_NL
PSH SIZE
PSH# STRING1
JSR PUT_STR
ADS# 2

PSH# STRING1
PSH# STRING2
PSH SIZE
JSR DELETE
ADS# 3

JSR PUT_NL
PSH# ENDSTRINGL ;STRING FINAL STRING
PSH# ENDSTRING
JSR PUT_STR
ADS# 2

DONE: HLT

ENTER: .CHAR 'INPUT STRING OF MAX LENGTH 35', ENTERL
ENDSTRING: .CHAR 'Bye Bye, Programming Assignments.', ENDSTRINGL
SIZE: .WORD 22
STRING1: .BLKW 11
STRING2: .BLKW 11

DELETE: BGN# 0
PSHA
PSHX
.EQU S1, 4
.EQU S2, 3
.EQU THESIZE, 2

LDX SIZE
LOAD: LDC* !S1
CMA $41
JLE DLT
JMP DONE2

DLT: LDC $20

DONE2:PSHA
SOJ LOAD

LDX# 0
PLACE: POPA
STC* !S2
AOC !THESIZE
JLT PLACE
POPX
POPA
POPF
RTN

.END

Edited by dargueta, 05 November 2011 - 05:32 PM.


#2
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,705 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Er...what language is this? From a little bit of what I found it looks like this is from the Carleton University Simulator Project, but I don't see anything about its workings on their site. Do you know C/C++ or another higher-level language? It'd help if you write it in one of those languages and then translate the commands step by step into assembly language.
sudo rm -rf /

#3
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,252 posts
  • Location:C:\Countries\US

dargueta said:

... Do you know C/C++ or another higher-level language? It'd help if you write it in one of those languages and then translate the commands step by step into assembly language.

How about JavaScript?

#4
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,705 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
I was kinda thinking a strictly-typed language, but sure.
sudo rm -rf /




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users