Skip to content

Commit

Permalink
Merge pull request #135 from Konamiman/fix-crt0-msxdos-and-printf
Browse files Browse the repository at this point in the history
  • Loading branch information
Konamiman committed Nov 30, 2023
2 parents 7e1998e + b9a0176 commit 5ae2444
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion source/tools/C/crt0_msxdos_advanced.s
Expand Up @@ -129,7 +129,7 @@ cont: ld hl,#0x100
; Termination code for DOS 2 was returned on L.

ld c,#0x62 ;DOS 2 function for program termination (_TERM)
ld b,l
ld b,a
call 5 ;On DOS 2 this terminates; on DOS 1 this returns...
ld c,#0x0
jp 5 ;...and then this one terminates
Expand Down
11 changes: 8 additions & 3 deletions source/tools/C/printf.c
Expand Up @@ -11,7 +11,7 @@
Supported format specifiers:
%d or %i: signed int
%ud or %ui: unsigned int
%u: unsigned int
%x: hexadecimal int
%c: character
%s: string
Expand All @@ -20,7 +20,7 @@
Also if SUPPORT_LONG is defined:
%l: signed long
%ul: unsigned long
%lu: unsigned long
%lx: hexadecimal long
*/

Expand Down Expand Up @@ -160,7 +160,12 @@ static int format_string(const char* buf, const char *fmt, va_list ap)
else if(theChar == 'x') {
base = 16;
}
else if(theChar != 'd' && theChar != 'i') {
#ifdef SUPPORT_LONG
else if(isLong) {
fmtPnt--;
} else
#endif
if(theChar != 'd' && theChar != 'i') {
do_char_inc(theChar);
continue;
}
Expand Down

0 comments on commit 5ae2444

Please sign in to comment.