Actually, the ASM code has many points where it is easy to do much better, look e.g. at the loops with char indexes.
Nevertheless, when one passes pointers to functions it seems quite efficient and clean (look at the FSM() code)
We haven't changed anything about symbol file support in quite a while...
As I've left Hitech C apart for a while (2/3 years) it is possible that the problem has appeared in previous updates of the debugger....
BTW I've opened a issue on github, sorry for the offtopic
For the sake of comparison, this is a sample code developed for Hitech-C (cross compiler v7.8pl2) with its compiled counterpart. Look at the LST files to see the generated code.
This is the main file compiled (LINK).
Could someone try to compile it in MSX-C and post the ASM?
https://github.com/artrag/C-experiments-for-msx
Manuel, the SYM file seems not supported anymore by the last openmsx debugger.
Is this a problem of mine or a real issue in the last openmsx release?
Hi, for MSX-C the libs and functions are different. Even does not exist sys.h nor msxio.h. Don't know what is setvdpwvram(), there is no loadvrampalette()... Also there is no enum in K&R.
Do you have the equivalences?. I could simply define them to get the asm code.
Already adapted defining the functions. Here the whole folder:
https://dl.dropboxusercontent.com/u/56103320/Files/MSX/disk_artrag.zip
demofsm.c - the code as is adapted.
demofsm.mac - the ASM result.
demofsmc.c - the MSX-C optimized version.
demofsmc.mac - the MSX-C optimized ASM result.
The MSX-C optimized changes FOR by WHILE and all possible INT to UINT to avoid signed math, both cases involving functions calling.
@DarkSchneider: forgot to tell the struct typedef thing worked fine, but it is kinda linear in its usage, tried to use it within a function, but it gave error that it wasn't declared. So i put it globally declared.
@ARTRAG: What DarkSchneider says is true, and you can create a seperate lib for those different functions.
Thanks for compiling my test file
It seems that msx-c does not use ix and it at all.
The functions accepting pointers to structs can become very large and potentially inefficient if you use only HL and ADD/SBC
Thanks for compiling my test file
It seems that msx-c does not use ix and it at all.
The functions accepting pointers to structs can become very large and potentially inefficient if you use only HL and ADD/SBC
I didn't used another "trick" for MSX-C involving pointer parameters. Define a static struct *local = parameter and use that local. Also use statics when variable is much used to avoid stack access (slow because the add HL and add SP, HL etc.).
Updated:
https://dl.dropboxusercontent.com/u/56103320/Files/MSX/disk_artrag.zip
Functions interact and fsm modifired with that. Files are demfsmc2.c and demfsmc2.mac.
It is usual C compiled ASM to have some more lines than handmade code. But in the real usage there is not noticeable impact. Having +60K cycles per interrupt, a few lines are not really a concern in practice. There are other worries like some work within loops to avoid and things like that. ASM lines involving registers are not really much a burden.
Even is an interesting note about no usage of IX and IY. Probably a compiler made for 64KB has no room for that logic.
Even is an interesting note about no usage of IX and IY. Probably a compiler made for 64KB has no room for that logic.
Even the cp/m version of the Hi-tech compiler supports IX and IY. I'd rather say that it is an indication of the age of the compiler, probably derived by an 8080 product.
Even is an interesting note about no usage of IX and IY. Probably a compiler made for 64KB has no room for that logic.
Even the cp/m version of the Hi-tech compiler supports IX and IY. I'd rather say that it is an indication of the age of the compiler, probably derived by an 8080 product.
Good to know. What I miss is the fast calling convention for functions. See table 12 here:
http://msx.hansotten.com/index.php?page=msx-c-manual
Hi-tech if I am not mistaken always uses the stack. I'd like to use registers for few params functions. For both speed and integration with ASM made functions.
How is the ASM generated by the CP/M version for that code?
The Hi-tech C passes the function parameters using registers when you use ansi c definitions and the stack when you use old k&r definitions.
I do not have the cp/m version anymore, I cannot compile sorry