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.


Sign In
Create Account

Back to top









