Skip to content

Commit f00c4d1

Browse files
committed
still not working
1 parent b36d6b8 commit f00c4d1

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

as4.exe.stackdump

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Exception: STATUS_ACCESS_VIOLATION at eip=6115D511
2+
eax=00000013 ebx=00405702 ecx=00000000 edx=00000013 esi=00000000 edi=00000013
3+
ebp=0024C828 esp=0024C824 program=C:\Users\ryan\Documents\code\cpu-assembler\as4.exe, pid 5796, thread main
4+
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
5+
Stack trace:
6+
Frame Function Args
7+
0024C828 6115D511 (00000013, 0024C8F4, 00405702, 00000001)

in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
NSTART N_
2+
LOD &(beep[2])[1]
3+
LOD &(hurp)[2]
4+
LOD &(zurp)
5+
zurp: .data 1 0xF
6+
hurp: .data 2 0xAA
7+
beep: .data 4 0xBADE
8+
N_: .data 4 0x0123
9+
.data 4 0x4567
10+
.data 4 0x89AB
11+
.data 4 0xCDEF

src/label.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ void addlabel(char *outbuf, label **labels, label **unknownlabels, unsigned long
111111
if(!strcmp((*unknownlabels)[i].str, tempstr))
112112
{
113113

114-
/* If it is, then take stock of both the address it was referenced. If a label is referencing a label, we need to move 1 nibble back (as there is no instruction, just 4 nibbles). Cheaper than doing an if below. */
114+
printf("%s: %s\n", tempstr, (*unknownlabels)[i].str);
115+
/* If it is, then take stock of both the address it was referenced. If a label is referencing a label, we need to move 1 nibble back (as there is no instruction, just 4 nibbles). Cheaper than doing an if below. */
115116
unsigned short int instaddress = (*unknownlabels)[i].addr - ((*unknownlabels)[i].type & 1);
116117
/* And the address the label points to plus the requested offset. We need to add one nibble if it is an instruction referencing a nibble as we moved one back above. */
117118
unsigned short int labeladdr = (*labels)[(*numlabels) - 1].addr + (*unknownlabels)[i].offset + ((*unknownlabels)[i].type & 1);
@@ -124,6 +125,7 @@ void addlabel(char *outbuf, label **labels, label **unknownlabels, unsigned long
124125
char *nstr = calloc(1, 6);
125126
sprintf(nstr, "N_[%X]", ((labeladdr >> (3 - (*unknownlabels)[i].addroffset) & 0xF)));
126127
labeladdr = findlabel(unknownlabels, labels, nstr, (*numlabels), numunknownlabels, bits, ((*unknownlabels)[i].type) & 1);
128+
continue;
127129
}
128130
else
129131
{

0 commit comments

Comments
 (0)