Skip to content

Commit

Permalink
Fix for issue #89
Browse files Browse the repository at this point in the history
  • Loading branch information
envenomator committed Nov 9, 2024
1 parent 942db22 commit 43c4c16
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 13 deletions.
9 changes: 6 additions & 3 deletions src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,12 @@ void io_close(void) {

void emit_8bit(uint8_t value) {
if(pass == 2) {
while(remaining_dsspaces) {
io_outputc(fillbyte);
remaining_dsspaces--;
if(remaining_dsspaces) {
if(list_enabled || consolelist_enabled) listPrintDSLines(remaining_dsspaces, fillbyte);
while(remaining_dsspaces) {
io_outputc(fillbyte);
remaining_dsspaces--;
}
}
if(list_enabled || consolelist_enabled) listEmit8bit(value);
io_outputc(value);
Expand Down
39 changes: 29 additions & 10 deletions src/listing.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ uint8_t _listLineObjectCount;
uint16_t _listLineNumber;
uint24_t _listSourceLineNumber;

char _listHeader[] = "PC Output Line\n\r";
char _listHeader[] = "PC Output Line\n\r";
char _listDataHeader[] = " ";

char buffer[(LINEMAX * 2) + 1];

Expand All @@ -30,6 +31,26 @@ void listStartLine(char *line, unsigned int linenumber) {
_listLineNumber = 0;
}

void listPrintDSLines(int number, int value) {
while(number) {
uint8_t i = 0;
if(list_enabled) io_puts(FILE_LISTING, _listDataHeader);
if(consolelist_enabled) printf("%s",_listDataHeader);

while(i < LISTING_OBJECTS_PER_LINE) {
if(number) {
sprintf(buffer, "%02X ",value);
if(list_enabled) io_puts(FILE_LISTING, buffer);
if(consolelist_enabled) printf("%s",buffer);
number--;
}
i++;
}
if(list_enabled) io_puts(FILE_LISTING, "\r\n");
if(consolelist_enabled) printf("\r\n");
}
}

void listPrintLine(void) {
uint8_t i,spaces;

Expand All @@ -39,9 +60,8 @@ void listPrintLine(void) {
if(consolelist_enabled) printf("%s",buffer);
}
else {
sprintf(buffer, " ");
if(list_enabled) io_puts(FILE_LISTING, buffer);
if(consolelist_enabled) printf("%s",buffer);
if(list_enabled) io_puts(FILE_LISTING, _listDataHeader);
if(consolelist_enabled) printf("%s", _listDataHeader);
}
for(i = 0; i < _listLineObjectCount; i++) {
sprintf(buffer, "%02X ",_listObjects[i]);
Expand Down Expand Up @@ -70,15 +90,14 @@ void listPrintLine(void) {
}
if(list_enabled) io_puts(FILE_LISTING, buffer);
if(consolelist_enabled) printf("%s",buffer);
sprintf(buffer, "%s\r\n", _listLine);
if(list_enabled) io_puts(FILE_LISTING, buffer);
if(consolelist_enabled) printf("%s",buffer);
}
else {
sprintf(buffer, "\r\n");
sprintf(buffer, "%s", _listLine);
if(list_enabled) io_puts(FILE_LISTING, buffer);
if(consolelist_enabled) printf("%s",buffer);
}

if(list_enabled) io_puts(FILE_LISTING, "\r\n");
if(consolelist_enabled) printf("\r\n");

_listLineObjectCount = 0;
_listLineNumber++;
}
Expand Down
1 change: 1 addition & 0 deletions src/listing.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
void listInit(void);
void listStartLine(char *line, unsigned int linenumber);
void listEndLine(void);
void listPrintDSLines(int number, int value);
void listEmit8bit(uint8_t value);

#endif // LISTING_H

0 comments on commit 43c4c16

Please sign in to comment.