2020-03-17 20:04:24 +00:00
|
|
|
/* ReC98
|
|
|
|
* -----
|
|
|
|
* Code segment #7 of TH01's REIIDEN.EXE
|
|
|
|
*/
|
|
|
|
|
[Separate translation units] [th01] ptn_copy_8_0_to_1()
So, we have a problem. The ridiculously optimized graph_putsa_fx() used
in TH04 and TH05 swaps out the target of two CALL instructions at
run-time… because there *really* wasn't any free register left for an
indirect CALL, eh? Therefore, the necessary relative addresses have to
be calculated at assembly time, by subtracting the target function
label from the call site label.
Unfortunately, the resulting values are stored in the .DATA segment,
which we can't move out right now. Declaring the labels as EXTERN
wouldn't work either, since the linker can't do fancy arithmetic and is
limited to simply replacing address placeholders with one single
address. This is explained pretty well at:
http://computer-programming-forum.com/46-asm/48f3d4a463bb38d1.htm
Which means we're stuck, and can't separate out this function for the
foreseeable future.
So, time to approach the SHARED segment from the top instead, to at
least get everything around graph_putsa_fx() done now. 🤷
vram_planes_set() is the first common function there. But since it was
introduced in TH01, we've got some maintenance to do for that game
first…
Part of P0138, funded by [Anonymous] and Blue Bolt.
2021-04-11 12:24:21 +00:00
|
|
|
#pragma option -zCSHARED
|
|
|
|
|
2020-03-18 17:54:51 +00:00
|
|
|
extern "C" {
|
[Separate translation units] [th01] ptn_copy_8_0_to_1()
So, we have a problem. The ridiculously optimized graph_putsa_fx() used
in TH04 and TH05 swaps out the target of two CALL instructions at
run-time… because there *really* wasn't any free register left for an
indirect CALL, eh? Therefore, the necessary relative addresses have to
be calculated at assembly time, by subtracting the target function
label from the call site label.
Unfortunately, the resulting values are stored in the .DATA segment,
which we can't move out right now. Declaring the labels as EXTERN
wouldn't work either, since the linker can't do fancy arithmetic and is
limited to simply replacing address placeholders with one single
address. This is explained pretty well at:
http://computer-programming-forum.com/46-asm/48f3d4a463bb38d1.htm
Which means we're stuck, and can't separate out this function for the
foreseeable future.
So, time to approach the SHARED segment from the top instead, to at
least get everything around graph_putsa_fx() done now. 🤷
vram_planes_set() is the first common function there. But since it was
introduced in TH01, we've got some maintenance to do for that game
first…
Part of P0138, funded by [Anonymous] and Blue Bolt.
2021-04-11 12:24:21 +00:00
|
|
|
#include "platform.h"
|
|
|
|
#include "pc98.h"
|
|
|
|
#include "planar.h"
|
2021-01-26 15:33:06 +00:00
|
|
|
#include "master.hpp"
|
2020-03-18 17:54:51 +00:00
|
|
|
#include "th01/hardware/graph.h"
|
2020-03-17 20:04:24 +00:00
|
|
|
|
2020-09-28 10:00:40 +00:00
|
|
|
#include "th01/hardware/egcrect.cpp"
|
2020-03-17 20:04:24 +00:00
|
|
|
#include "th01/formats/ptn_snap.cpp"
|
2020-03-18 17:54:51 +00:00
|
|
|
}
|