FF8 Checksum problem - Old title: Changing game time of FF8 PSX

  • Thread starter Thread starter Goth
  • Start date Start date
Status
Not open for further replies.
I have a feeling that you don't read my posts entirely... :D
I show again this link: https://www.ff7catalog.com/posts/66284/
Or rather, I'll quote to you the part of the post that shows the errors:
But I got the followings errors:
Assembler messages:
  junk `Ch' after expression
  junk `Ch' after expression
Path_of_the_project\Makefile.win [Build Error]  [main.o] Error 1
I hope that the code will work correcting these errors.
Those errors are missing context.  ch after what expression?
The only CH value I can see is test ch,80h
it might be saying "test" is a valid opcode but ch may not be the proper register name for that particular assembler.
Do you have the assembler manual?
Did you look up the error in it?
What compiler are you using, GCC or an older version of VC++?

Cyb
 
Those errors are missing context.  ch after what expression?
I'm sorry but DevC++ doesn't specify the numeber of the line when it checks assembler code.
In any case, as you said, the line/s are certainly "test ch,80h".

What compiler are you using, GCC or an older version of VC++?
As I already said in some post before, I use DevC++, so GCC.
Certainly I don't use VC++, or else I could use the same CRC' assembly code as Qhimm's one.
 
Last edited:
Hmmm documentation time
-masm=dialect
    Output asm instructions using selected dialect. Supported choices are `intel' or `att' (the default one). Darwin does not support `intel'.
Darwin is an OS (not of use here).

http://sourceware.org/binutils/docs-2.18/as/i386_002dSyntax.html#i386_002dSyntax

The big difference is numbering methodology, register syntax and source destination ordering.
 Now comes the fun part is Ch a register or a hexadecimal value to the GNU assembler in Intel format?
I suppose it differentiates based on weather there is a leading 0 or not (IE 0Ch is 0x0c). looks problematic if you ask me.
 
HOWEVER I think THIS is the problem
asm("test ch, 80\n"
   "je label4\n"
test ch,80 is NOT valid Intel syntax and should read
asm("test ch, 80h\n"
   "je label4\n"
hexadecimal numbers must end in h for Intel syntax.
see if that is the problem

Cyb
 
You can try with "test ecx, 8000h", as 80 would still be a valid constant.
 
hexadecimal numbers must end in h for Intel syntax.
If I put the H, I got an error. In fact, as you can see from the code, I never put it.
So the problem is not this. Instead, I managed to understand that the lines to correct is not these, but these:
Code: [Select]
Code:
"mov edi, dword ptr [esp+0000020Ch]\n""add esp, 0000000Ch\n"
The problem is that c is an hexadecimal number and so I've put the "0x" before. Now the code is this:
Code: [Select]
Code:
void CalcoloChecksum(FF8BLOCK &ff8){USHORT checksum = 0; void *dataptr = (void*)&ff8.gf;asm("push dataptr\n"    "push 00001350\n" "push 00000000\n");asm("sub esp, 00000200\n" "mov ecx, 0x00000080\n" "xor eax, eax\n" "push esi\n" "push edi\n" "lea edi, dword ptr [esp+0x08]\n" "xor esi, esi\n" "repz stosd\n" "mov eax, 0x0000FFFF\n" "lea edi, dword ptr [esp+0x08]\n");label2:asm("mov ecx, esi\n" "mov edx, 0x00000008\n" "shl ecx, 0x08\n");label3:asm("test ch, 80\n"    "je label4\n" "add ecx, ecx\n" "xor ecx, 00001021\n" "jmp label5\n");label4:asm("shl ecx, 1\n");label5:asm("dec edx\n" "mov word ptr [edi], cx\n" "jne label3\n" "inc esi\n" "add edi, 00000002\n" "cmp esi, 0x000000FF\n" "jb label2\n" "mov edi, dword ptr [esp+0x0000020C]\n" "test edi, edi\n" "jle label7\n" "mov esi, dword ptr [esp+00000210]\n");label6:asm("xor ecx, ecx\n" "xor edx, edx\n" "mov dl, byte ptr [esi]\n" "mov cl, ah\n" "and ecx, 0x000000FF\n" "xor ecx, edx\n" "xor edx, edx\n" "mov dh, al\n" "mov ax, word ptr [esp+2*ecx+0x08]\n" "xor ax, dx\n" "inc esi\n" "dec edi\n" "jne label6\n");label7:asm("pop edi\n" "pop esi\n" "not eax\n" "add esp, 00000200\n");asm("add esp, 0x0000000C\n" "mov checksum, ax\n"); ff8.checksum1 = ff8.checksum2 = checksum;}
The errors are vanished but now I got other errors:
[Linker error] undefined reference to `dataptr'
  [Linker error] undefined reference to `checksum'
  [Linker error] undefined reference to `label4'
  [Linker error] undefined reference to `label5'
  [Linker error] undefined reference to `label3'
  [Linker error] undefined reference to `label2'
  [Linker error] undefined reference to `label7'
  [Linker error] undefined reference to `label6'
  ld returned 1 exit status
 Path_of_the_project\Makefile.win [Build Error]  [program.exe] Error 1
 
Last edited:
It is obvious that it doesn't recongnize the variables and the flags that are extern of the assembly code.
I really don't understand why. In fact, both At&T and Intel syntax allow you to read variables of the C program simply writing the name of these variables.
So I don't think that I have to put something before "dataptr, "checksum", etc...
But the linker don't find these symbols.
I don't know why.
 
Just so you know I haven't abandoned you (hehe)

  • I'm still working on a clear C Code version
  • You might be able to have more success if you converted the assembly code into C code directly
  • I'm doing the above just for kicks
My current code is not working as expected but that's life sometimes things work as expected sometimes they don't.
We'll see I guess :D

Cyb
 
Status
Not open for further replies.
Back
Top