저는 꽤 혼란스럽고 한 블록 맞았습니다. 내 수업 과제는 다음과 같은 일을합니다. 입력조립 및 버퍼 방법
- 인사 사용자
- 프롬프트 변환 된 문자열을 사용자에게 모두 대문자
- 디스플레이 메시지에
- 변환 문자열
나는 1과 2에는 문제가 없으며, 필요할 때 소문자를 대문자로 변환하는 루프를 알아낼 수 있습니다.
cmp $96, %ah
jg Subtract
call Loop
Subtract:
sub $32, %ah
mov %ah, back to the array
ret
이것이 최선의 방법은 아닐지 모르지만 일단이 배열과 버퍼를 알아 내면 알아낼 수 있습니다. 교수가 우리에게하는 일은 그의 도서관을 사용하는 것과 관련이 있습니다. =
.data
Intro:
.ascii "Hey enter in your what you want converted.\n\0"
Task:
.space 5 #This is the buffer that is supposed to limit what the user can enter.... I'm very confused about how to make this work
.text
.global _start
_start:
mov $Intro, %rax
call PrintCString #from the Prof's library
mov $Task, %rbx
call ScanCString
여기 그가 ScanCString 입력 = RAX, RBX 노트를 사용하는 방법에 대한 말씀의 주소 %의 RAX에 널 종료 문자열을 저장합니다를 검사 : 사용자의 입력을 얻기 위해 코드는 다음과 같습니다. 레지스터 % rbx에는 읽을 수있는 최대 문자 수 (버퍼 크기)가 포함되어야합니다.
여기에서 내 생각은 각 캐릭터를 이동하고 대문자인지 소문자인지 결정한 다음 그에 따라 조정할 수 있습니다. 루프를 통해이를 실행하고 사용자에게 다시 알려줍니다.
내가 지금까지 가지고있는 모든 것, 제 시험 물건의 광기에 신경 쓰지 마십시오. 어떤 도움이라도 대단히 감사하겠습니다.
.data
Intro:
.ascii "\nYup... Mr. Meekseeks here to help. What ya want me to do?\n\n\0"
Task:
.space 5
NewLine:
.ascii "\n\n\0"
Goodbye:
.ascii "\nYou got it buddy I'll get right on doing \0"
Test:
.ascii "\nYou made it to the first loop\n\0"
Test2:
.ascii "\nYou made it past the first compare\n\0"
Test3:
.ascii "\nYou added 1 to the pointer\n\0"
Test4:
.ascii "\nHere's the string length \0"
.text
.global _start
_start:
mov $Intro, %rax #start with greeting the user
call PrintCString #Print the greeting to the user
mov $0, %rax
mov Task(,8), %rbx #move the buffer into RBX, prep for input
call ScanCString #User Input
# mov %rax, Task
# mov %rax, %rdx #Move the message so it's not destroyed
call LengthCString #Determine loop limit
mov $0, %rdi #set pointer
mov %rax, %rcx #set counter to zero
mov Task(%rdi), %rax
call PrintCString
mov $Test4, %rax
call PrintCString
mov %rcx, %rax
call PrintInt
mov %rax, %rcx
mov $Test, %rax
call Loop
Loop:
mov $Test2, %rax
call PrintCString
add $1, %rdi
mov $Test3, %rax
call PrintCString
cmp %rdi, %rcx
je Closing
call Loop
# movb %rax, %rdx
# mov %rcx, %rax
# call PrintInt
# call PrintCString
# call Ending
#Adding:
# Greeting:
# mov $Intro, %rax
# call PrintCString
# ret
Closing:
mov $Goodbye, %rax
call PrintCString
call Ending
Ending:
mov $NewLine, %rax
call PrintCString
call EndProgram