Mail Archives: djgpp/2009/11/10/22:45:14
Hi,
On Nov 10, 2:10=A0pm, DJ Delorie <d DOT DOT DOT AT delorie DOT com> wrote:
>
> If you want to continue the fine tradition of making it meet your
> needs, go ahead :-)
Okay, this hack below seems to work (even though I swear I am not a C
programmer):
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
*** tony_y.bk1 Tue Nov 10 17:37:22 2009
--- tony.y Tue Nov 10 21:26:58 2009
***************
*** 2335,2340 ****
--- 2335,2341 ----
{
int c, c2, i, oldc;
struct opcode *opp, op;
+ char str[33], str2[33];
do {
c =3D fgetc(infile);
***************
*** 2454,2460 ****
}
#else
ungetc(c, infile);
! fscanf(infile, "%i", &(yylval.i));
#endif
sprintf(last_token, "%d", yylval.i);
return NUMBER;
--- 2455,2473 ----
}
#else
ungetc(c, infile);
!
! fscanf(infile, "%[0-9a-fA-FhHxX]",str);
!
! if (str[strlen(str)-1] =3D=3D 'h' || str[strlen(str)-1] =3D=3D 'H')
! {
! str[strlen(str)-1]=3D'\0';
! strcpy(str2,"0x");
! strcat(str2,str);
! strcpy(str,str2);
! }
! sscanf(str, "%i", &(yylval.i));
!
!
#endif
sprintf(last_token, "%d", yylval.i);
return NUMBER;
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
And here's the simplest example (modified HELLO.ASM) although a bigger
example, BEFI.COM using "0x100" or "100h" style both assemble to the
exact same .COM, matching CRC32.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
.type "com"
.org 0x100 ; origin for .COM program
mov dx, msg ; point DX to message
mov ah, 0x9 ; DOS print string function
int 21h
mov ax, 4c00h ; DOS exit with errorlevel
int 0x21
msg:
.db "hello, world\r\n$"
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- Raw text -