amigaports / ace Goto Github PK
View Code? Open in Web Editor NEWAmiga C Engine
License: Mozilla Public License 2.0
Amiga C Engine
License: Mozilla Public License 2.0
Make interrupt servers also register in OS so that keyboard is properly updated when OS is active - needed for tehKaiN/ld40-squared#1
Right now source code have hardcoded amiga functions, or hardcoded #ifdefs to handling amiga code.
This should be reworked to a flexible handling more possible targets (like SDL).
Targets should be a whole file replacements with correct including in compile time.
Same target pattern should be followed by games.
Compile error should be rised when no target was specified.
Since this is multi-ppl project, a decision has to be made how code should be formatted on repo. Feel free to post suggestions below - I'll edit first post as discussion progresses.
Pros:
Cons:
Code is horizontally limited to 80 chars, so naturally some code folding must be done.
For functions in C files:
void fnShort(t1 arg1, t2 fnNameAndArgsFitInOneLine);
void fnWithManyArgs(
t1 arg1, t2 arg2, t3 allArgsFitInOneLineButWithoutFnName
);
void fnWithTooManyArgs(
t1 arg1, t2 arg2, t3 thereAreTooManyFnArgsToFitInOneLine,
t4 arg4, t5 arg5, t6 soArgListIsBrokenToMultipleLines
);
Whereas in header files:
void fnVoid(void);
void fnNonVoid(
t1 allArgsAre,
t2 inSeparateLine
);
Other arg formatting stuff doesn't mix with variable tab size properly. So I guess it must stay this way.
camelCase with prefixes. List of prefixes:
ub
- unsigned byte (UBYTE
, uint8_t
)uw
- unsigned word (UWORD
, uint16_t
)ul
- unsigned long (ULONG
, uint32_t
)b
, w
, l
for signed variantsp
- any pointer or arraycb
- any function pointer (callback)t
- typedefs
- struct instanceu
- union instancef
- float
or fixed-point vardouble
, uint64_t
for global var scoping additionally:
g_
- global visible from other filess_
- global visible from current file (static
)typedef struct _tTypeName {
} tTypeName;
IN
, OUT
and INOUT
defines:void fn(
UBYTE ubSomeInput,
UBYTE *pSomeMoreInputDataLikeArrayOrSomething,
UBYTE *pContentsGetOverwrittenOrArrayToBeFilled,
UBYTE *pContentsAreUsedInFnCalculationsAndThenModified
);
all fns in header files must be documented using DoxyComments. Functions which are not exported in headers should be documented in .c file
functions should be as short as possible. If needed, split function to multiple ones. There is no hard limit for fn length, but if it doesn't fit entirely on your screen then it's a good sign you're doing something wrong.
Currently we use something like that:
#ifndef GUARD_ACE_MANAGER_BLIT_H
#define GUARD_ACE_MANAGER_BLIT_H
Candidate for replacement:
#ifndef _ACE_MANAGERS_BLIT_H_
#define _ACE_MANAGERS_BLIT_H_
Pros:
inc/ace/managers/blit.h
Moved from #25 since it's currently not that critical but will be for moving to ROM-based platforms or squeezing into floppy. It would be cool to have an ability to work on plain file structure of host OS or on virtual FS based on monolithic file.
Before we introduce another custom file format, let's look at embedded systems for similar mature solutions. Perhaps SquashFS would do the job? Or is it too bloated?
I guess this part of code is bugged and rotten since it wasn't touched for a long time.
needed for Last-Minute-Creations/openFire#5
Scroll buffer:
Tile buffer:
blitRect()
generic/main.h
systemUse()
/systemUnuse()
Small interleaved bitmaps are blitter-friendly as they allow updating all bitplanes in single blit.
pView
field and viewLoad()
stuff
gameDestroy()
should call gamePopState()
in a loop
gameDestroy()
Since @approxit is responsible for game manager, I'd like to see his opinion in the comments.
One could wonder, why there is so much commented code in copper's process function.
The idea was that copper manager would mark copperlist areas which were modified and then update only them. It mostly works, but sometimes it's not.
Additional experiments are needed to determine which cases are broken. In fixing this code, there lies a potentially big performance boost.
This file seems to have been deleted a while back, so right now make showcase
doesn't build.
https://github.com/tehKaiN/ACE/blob/126533d8b6470d2f760889049d2eebe7f431c0c5/showcase/src/input.h#L7
https://github.com/tehKaiN/ACE/blob/1b540f652151ec280a8b7e0a65d4dae0032c8f71/showcase/src/main.c#L11
Writing makefiles is a pain and having custom build environment is no way to go. We don't need another standards.
Having CMake build environment would bring Amiga coding to 21st century even more. Also, CMake is very flexible at including other libraries with CMakeLists.txt written for them. Also, it by default supports stuff like debug/release builds and allows passing build options to dependencies very easily. It is easily configured to keep track of changes in .h files so no more using make all
.
The downside is that there is no Amiga port for CMake. Yet.
So std library has malloc, calloc and realloc. calloc is quite useless, but realloc would be nice.
I think it should only take new size as a parameter, since memory type is readable from source mem addr.
There are no stdc functions for reading directories, so to omit POSIX lib dependency ACE needs its own directory fns based on OS fns.
Also, wrapping around fopen will give us ability to setup file access based on OS files/dirs or one monolithic big file. This will also reduce disk usage 'cuz Amiga FSs are inefficient as hell with many small files.
opendir
/ readdir
/ closedir
fopen
, close
, fseek
, ftell
, fread
, fwrite
Add ability to work on plain file structure of host OS or on virtual FS based on monolithic file.
Needs #38
Currently processing mouse & keyboard are bound together by Intuition event loop. This prevents isolation of these two managers.
I guess the best way to do this would be getting mouse & keyboard events directly from HW, omitting Intuition code.
Right now having sine table precalculated with floats is better.
2 things should be considered:
FIX16_I_KNOW_WHAT_IM_DOING
or somethingAlso, this should be documented quite well.
Right now we have GAME_DEBUG flag hardcoded inside source files.
It's changes results in git. To make a prod you need to switch it's value on and off.
Better idea is to move this flag to compile flags.
Could be based on http://aminet.net/package/dev/asm/ReadJoyPad . Rewriting this to C shouldn't be much of hassle.
There are some options. MIT, BSD, Unlicense or GPL. Also, this decision may affect our prods' licenses.
Pros:
Cons:
Pros:
Cons:
All cons mentioned above are irrelevant if we just use MIT/Unlicense.
MIT is just an info about author without any restrictions, so It's mostly cool. What isn't cool is that most licenses require list of authors who modified source files. I don't really like keeping up-to-date list of contributors in copyright notice. That's getting messy very quickly.
So I propose using unlicense - at first line text below becomes copyrighted, then all rights are passed to everyone who's reading. Since there are no rights to be cleaimed, it's irrelevant who's listed as author. And there are really more important things to do than looking after all that license bs.
Currently, bob mechanism must be written from scratch - it should be for most games, but there should be some means to prototype things and I guess that most implementations could have a common ancestor.
It should be mentioned that blitter could be set up using CPU or Copper - the latter option ensures constant blitter throughput.
WARN:
and ERR:
prefixes, but some messages aren't still conforming to this. When other contributions arrive, it's going to be even bigger mess. Having fns like logErr
, logWarn
and logInfo
might be a good idea.Any ideas?
I've started doing this but needs further work, I think
Blitting using ACE's queue mechanism tends to freeze app or crash Amiga.
ACE is under development since 2013 and needs some form of outputting sound! After having that done, another issue will be made about making it better and more versatile.
Basic audio output is here: https://github.com/weiju/amiga-stuff/blob/master/hardware/soundfx.c
There are numerous mature fixed points projects out there, which could be integrated into ACE, e.g. https://github.com/PetteriAimonen/libfixmath/
Rationale: ACE has bitmap rotation fn, which requires fractional computations. Currently, it uses OS's float library, which implements software floats on non-fpu machines. This implementation is horribly slow and fixed points are always faster, even than hw fpu.
There are some online tile editors, so it would be cool if ACE would provide at least a bit of compatibility or even a guide about incorporating such tool into toolchain.
Currently, I have php script for generating ACE fonts, but it's inconvenient and not portable way to do this. It needs C implementation without too many dependencies - should be working directly on ttf/otf and some popular bitmap font formats.
Perhaps it would be wise to use freetype amalgamated lib?
glyphsFromDir()
Currently ACE uses OS version of bitmap struct, which has many flaws. Especially distinguishing whether bitmap is interleaved is nuts: BitMap: Interleaved mode.
Also, perhaps it would be good idea to attach bitmap mask at this level - either as another bitplane or as separate field.
Right now, there are two RNGS - one for 16-bit and one for 32-bit numbers. There's no need to that, since most of calc is 16-bit and 32-bit may be accomplished by joining two 16-bit random values.
Here's a nice xorshift.
68000's instruction is capable of shifting up to 8 bits in one operation (source) so we should use shifts lesser than 8.
We should determine if we use wiki or docs folder. Here's some arguments against wiki.
If we're dropping wiki, relative links will come in handy.
doc
folderdoc
folder, if wiki is going to be scrappedNot every game should listen for additional joys on parallel port - there could be other device plugged in.
It would be cool to have choice between VBCC and GCC6 supplied by Bebbo. There are some problems which break source compatibility:
amigainterrupt
keyword, which GCC is lacking.-O1
(on -O2
works)-O2
triggered by blitRect()
Currently, there are no means to draw lines using blitter. Drawing vertical/horizontal lines using blitRect()
is probably not fastest possible solution, and most certailny such usage is not intuitive.
Implementation could be based on Cahir's routine.
Since rewriting key & mouse input to hardware-based screen & window is no longer needed.
Currently, mouse actions are collected using Intuition events. Also, current cursor codebase relies on OS stuff, which is conflicting with current custom copperlist implementation. There is a need to:
I guess this part of code is bugged and rotten since it wasn't touched for a long time.
needed for Last-Minute-Creations/openFire#5
Log blocks use precise timers for benchmark, displayed times are sometimes improbable.
Since m68k has barrel-shift functions, it is possible to have rotate fns.
https://stackoverflow.com/questions/776508/best-practices-for-circular-shift-rotate-operations-in-c these are supposed to be optimizable to single instruction on decent compilers, however this should be checked on VBCC and Bebbo's GCC.
See "Blits with small dst" test.
There are some other problems with this fn, mainly apparent in font blits.
fix16_t
is of 16.16 format, so it's 32-bit value. A500 & A600 have 16-bit data bus, so 8 and 16-bit vars are faster than 32-bit to fetch. Implementing fix8_t
with format 8.8 analogous to fix16_t
would speed things a bit at a cost of precision.
Double buffering is needed for drawing if you don't want to race the display beam.
Many years ago I had some clever idea of implementing double buffering as vport manager which could work regardless if one uses simple or scroll buffer, but right now I have no idea how that could work. The only remnant of this idea is in viewport manager priority list:
/**
* Viewport manager IDs.
* Number determines processing order. Camera is last, so rest may see
* a difference between its current and previous position
*/
#define VPM_SCROLL 0
#define VPM_TILEBUFFER 1
#define VPM_DOUBLEBUFFER 2
#define VPM_CAMERA 128
Currently, this file only contains extern consts containing screen size. This approach is unnecessary since ACE really supports only PAL modes atm and values other than 320/256 may yield unexpected results.
Sometimes screen dimensions are needed in code, so to make them more generic I propose adding generic/screen.h which would contain defines with PAL/NTSC screen boundaries, also hires/laced variants. Also, PAL/NTSC names will be more meaningful
To achieve best performance, it is crucial to be able to disable OS stuff completely, including multitasking. After removing Intuition-related code, there should be no blockers to achieve this.
Could be done in similar way as in #57
This would allow easier mixing masks by passing them to blit functions, processing using chunky fns etc.
Related to #17, but more simple way, closer to makefiles.
So in openFire I'm implementing chat and there i have to draw something like: "%s: %s"
consisting of nick and message. So it would be cool to be able to pass multiple strings to font draw fn so that I could avoid copying to same buffer:
fontDrawMultiStr(stuffForFont, stuffForBfr, n, ...)
It could be used in my case as:
fontDrawMultiStr(yadda, yadda, 3, szNick, ": ", szMsg)
I guess cpp streams would do the job here. ;) Still, dunno how many times this fn would be useful in other projects.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.