• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

MOT6502 assembler, disassembler and linker


Commit MetaInfo

Revisioncf59cadcb09e8ae42c196b571b9806d8fcf5cf89 (tree)
Time2013-02-06 18:00:57
Authorastoria-d <astoria-d@my-s...>
Commiterastoria-d

Log Message

linker load ok (temporary release). contain assembler bug, linker is not ready yet.

Change Summary

Incremental Difference

--- a/linker/linker.c
+++ b/linker/linker.c
@@ -1,12 +1,25 @@
11 #include <stdio.h>
2+#include <stdlib.h>
3+#include <string.h>
24 #include "tools.h"
35 #include "obj-format.h"
6+#include "segment.h"
7+
8+struct seginfo * segh2segi (struct seghdr *sgh, FILE* objfile, const char* fname) {
9+ struct seginfo * pseg = malloc (sizeof(struct seginfo));
10+
11+ dlist_init (&pseg->list);
12+ pseg->name = strdup(sgh->seg_name);
13+ dprint("segment: %s\n", pseg->name);
14+
15+ return pseg;
16+}
417
518 int load_object (const char* obj_fname) {
619 FILE* fp;
720 struct molfhdr* molh;
821 int segh_start;
9- int seg_cnt;
22+ int i, seg_cnt;
1023
1124 fp=fopen(obj_fname, "r");
1225 if (fp == NULL) {
@@ -24,5 +37,28 @@ int load_object (const char* obj_fname) {
2437 segh_start = molh->segh_off;
2538 free(molh);
2639
40+
41+ fseek(fp, segh_start, SEEK_SET);
42+ for (i = 0; i < seg_cnt; i++) {
43+ struct seghdr *sgh;
44+ struct seginfo *pseg;
45+
46+
47+ sgh = load_segh(fp);
48+
49+ if (!sgh) {
50+ free(sgh);
51+ fclose(fp);
52+ return FALSE;
53+ }
54+
55+ //pseg = segh2segi(sgh, fp, obj_fname);
56+ ///must make list of seg!!!
57+ //
58+ //segh_start += sgh->seg_data_size;
59+
60+ free(sgh);
61+ }
62+
2763 return TRUE;
2864 }