summaryrefslogtreecommitdiff
path: root/reverse-engineering/dosbox_snif/main_dump_ds0.c
diff options
context:
space:
mode:
Diffstat (limited to 'reverse-engineering/dosbox_snif/main_dump_ds0.c')
-rw-r--r--reverse-engineering/dosbox_snif/main_dump_ds0.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/reverse-engineering/dosbox_snif/main_dump_ds0.c b/reverse-engineering/dosbox_snif/main_dump_ds0.c
new file mode 100644
index 0000000..e54589d
--- /dev/null
+++ b/reverse-engineering/dosbox_snif/main_dump_ds0.c
@@ -0,0 +1,61 @@
+#include "rsp.h"
+#include "rsp_lemm.h"
+#include "utils.h"
+
+#include <string.h> /* memset() */
+#include <stdio.h> /* printf() */
+
+int main(int argc, char *argv[]) {
+ int rv, i, end=0;
+ struct rsp_state rsp;
+ char ds_si[10], command[16];
+ unsigned int addr, ds_offset;
+
+ rv=rsp_lemm_init(&rsp, ds_si);
+ if ( rv != 0 ) {
+ printf("Error rsp_lemm_init() returns %i\n", rv);
+ return 1;
+ }
+
+ while (!end) {
+ rsp_query(&rsp, "c"); // Continue
+ if ( rsp.replied != 1 ) printf("Bug 03\n");
+ rsp_recv_full(&rsp);
+ if ( rsp_check_and_clear(&rsp, "S05") != 0 ) printf("Bug 04\n");
+
+ // For the beginning of the ds segment
+ ds_offset=0;
+ /* For this chunk of code :
+ 000052A3 83E307 and bx,byte +0x7 bx = 0x5660 + lemm.x_effective % 8;
+ 000052A6 81C36056 add bx,0x5660 //
+ 000052AA 8A27 mov ah,[bx] ah = [bx];
+ */
+ ds_offset = 0x5660;
+ /* For understanding pixel collision tests at 00005280
+ di = lemm.y_effective - 16;
+ if ( di >= 0 ) di=0; //WTF ???
+ di *= (LEVEL_WIDTH/8);
+ di += 0x6d60 + lemm.x_effective / 8;
+ */
+ ds_offset = 0x6d60;
+
+ ds_offset = 0x3f;
+ for (i=0;i<8;i++) {
+ addr = (0xb55 << 4) + ds_offset + (i * 0x20);
+ snprintf(command, 15, "m%06x,0x20", addr );
+ rsp_query(&rsp, command);
+ if ( rsp_decode(&rsp) != 0x20 *2) {
+ printf("%06x : Bug\n", addr);
+ } else {
+ printf("%06x : %s\n", addr, rsp.decoded);
+ }
+ }
+ printf("\n");
+ }
+
+
+ rsp_quit(&rsp);
+ return 0;
+}
+
+