Question: c: temp assembly hla q 2 9 > fhla q 2 9 . hla Error in file q 2 9

c:\temp\assembly\hla\q29>fhla q29.hla
Error in file "q29.hla" at line 28[errid:98726/hlaparse.c]:
syntax error, unexpected byteTkn.
Near: << byte >>
program StringProgram;
#include("stdlib.hhf");
#include("cs17string.hla");
static
stringData : dword;
answer : int32;
procedure endsWithZ(stringData : dword); @nodisplay; @noframe;
static
dReturnAddress : dword;
currentChar : byte;
i : dword;
begin endsWithZ;
// Preserve the return address
pop(dReturnAddress);
// Get the stringData off the stack
mov(stringData, EBX);
// Push back the return address
push(dReturnAddress);
// Initialize loop index
mov(0, i);
// Loop through the string
endsWithZ_loop:
// Load the current character
movzx(byte ptr [EBX + i], currentChar);
// Check if we have reached the null terminator
cmp(currentChar,0);
je endsWithZ_checkLastChar;
// Move to the next character
inc(i);
jmp endsWithZ_loop;
endsWithZ_checkLastChar:
// Check if the last character is 'Z'
dec(i); // Move back to the last valid character
movzx(byte ptr [EBX + i], currentChar);
cmp(currentChar,'Z');
je endsWithZ_true;
// Return false if it's not 'Z'
mov(0, EAX);
jmp endsWithZ_done;
endsWithZ_true:
// Return true if it is 'Z'
mov(1, EAX);
endsWithZ_done:
// Restore the registers used
ret();
end endsWithZ;
begin StringProgram;
stdout.put("Please enter a string to process", nl);
// This code allocates a string of size 80
mov(@size(int8), AL);
mov(80, BL);
inc(BL);
mul(BL);
mov(0, EBX);
mov(AX, BX);
malloc(EBX);
mov(EAX, stringData);
// Let's try reading a value into the string
mov(stringData, EAX);
push(EAX);
mov(80, CX);
push(CX);
call gets;
// Print the string
stdout.put("---> here is the string you entered: ");
mov(stringData, EAX);
push(EAX);
call puts;
stdout.newln();
// Initialize EAX before calling the function.
mov(0, EAX);
// Pass a string parameter to the function
push(stringData);
call endsWithZ;
mov(EAX, answer);
// Show the results
stdout.put("after endsWithZ --- result=");
stdout.put(answer);
stdout.newln();
end StringProgram;
this keep gives me error

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!