From: Frank Kotler on
Herbert Kleebauer wrote:
> Frank Kotler wrote:
>> Herbert Kleebauer wrote:
>> ...
>>> PS: And the CPU really deserves some greetings if it
>>> accepts such a syntax without a word of protest:
>> Right! Everybody knows an x86 CPU prefers Motorola syntax! Oh, wait...
>
> It doesn't matter what "everybody" knows. It only matters what the
> CPU thinks. Just ask your CPU yourself. But you have to do this in
> an OS which allows the CPU to give an uncensored answer (real mode
> DOS instead of protected mode Linux). I have converted the question
> to NASM syntax, so go ahead and feed the question to the CPU and
> read it's answer.
>
> nasm askcpu.asm -o askcpu.com
>
> org $100
> db "Isn't the Motorola syntax much superior to the Intel syntax? ",13,10
> db "I suppose, there is no doubt about your answer. ",13,10
> db "VX4$, 0D',u,uPZ511599"
> int $21
> ret

Well, the wind blew and the power went out, so I had a chance to boot
dos and try this. Even trickier than it appears! In DEBUG, it waits for
a key and doesn't print anything! I'll have to study this... Thanks,
Herbert!

Best,
Frank

From: io_x on

"Herbert Kleebauer" <klee(a)unibwm.de> ha scritto nel messaggio
news:4B33C852.77932A03(a)unibwm.de...
> io_x wrote:
>>
>> Buon Natale
>>
>> Merry Christmas to all!
>
> Sorry, there must be a bug. Your code crashes when I execute it.

yes possibily i'm not much sure on "ah=0Eh|int 10h"

> Here a working version (maybe you should use an assembler
> with a more logical syntax):

this below here not segfault, and print the strings in a cmd window
where "bcc32" is the Borland C and C++ compiler 32bit
-------------------------------------------
; nasmw -fobj this.asm
; bcc32 -v this.obj
section _DATA use32 public class=DATA
global _main
extern _printf
fmt db "%c" , 0, 0
auguri db "Auguri di Buon Natale, e di un felice "
db "anno nuovo!" , 13, 10
db "Merry Christmas and a Happy New Year!"
db 13, 10, 0, 0

section _TEXT use32 public class=CODE
_main:
pushad
mov esi, auguri
xor ebx, ebx
..1: mov bl, [esi]
cmp ebx, 0
je .2
push ebx
push fmt
call _printf
add esp, 8
cmp eax, 1
jne .2
inc esi
jmp short .1
..2:
popad
mov eax, 0
ret
--------------------
; nasmw -fobj this.asm
; bcc32 -v this.obj
section _DATA use32 public class=DATA
global _main
extern _printf
fmt db "%c", 0, 0
auguri db "Auguri di Buon Natale, e di un felice "
db "anno nuovo!", 13, 10
db "Merry Christmas and a Happy New Year!"
db 13, 10, 0, 0

section _TEXT use32 public class=CODE
_main:
pushad
i=auguri|b^=b
..1: bl=*i|b==0#.2
_printf<(fmt, b)|a!=1#.2
++i|#.1
..2:
popad
a=0
ret
--------------------

> @=$100
> dc.b "Merry Christmas and a Happy New Year!"
> dc.b "$VZ500599"
> trap #$21
> rts.w
>
>
> The hexdump of the binary:
>
> 4d65727279204368726973746d617320616e64206120486170
> 7079204e657720596561722124565a353030353939cd21c3




From: Herbert Kleebauer on
io_x wrote:
> "Herbert Kleebauer" <klee(a)unibwm.de> ha scritto nel messaggio

> > io_x wrote:
> >>
> >> Buon Natale
> >>
> >> Merry Christmas to all!
> >
> > Sorry, there must be a bug. Your code crashes when I execute it.
>
> yes possibily i'm not much sure on "ah=0Eh|int 10h"

I didn't say your code but your greetings crashes when executed.

When I disassemble the text:

------------------------------------------
Buon Natale

Merry Christmas to all!
------------------------------------------

I get:

0100 inc.w r1 (42)
0101 bne.b $0172 (75 6f)
0103 out.b (r5.w)+-,r1 (6e)
0104 and.b r2,$61(r4.w){s7} (20 4e 61)
0107 beq.b $016a (74 61)
0109 in.b r1,(r6.w)+-{s1} (6c)
010a or.w #$0d0a,r0 (65 0d 0a 0d)
010e or.b $65(r6.w),r2 (0a 4d 65)
0111 bcs.b $0185 (72 72)
0113 bpl.b $0135 (79 20)
0115 inc.w r3 (43)
0116 move.w #$6972,-(sp) (68 72 69)
0119 bcc.b $018f (73 74)
011b in.w r1,(r6.w)+-{s1} (6d)
011c movem.w (sp)+,r0-r7 (61)
011d bcc.b $013f (73 20)
011f beq.b $0190 (74 6f)
0121 and.b m0,$6c(r3.w,r6.w) (20 61 6c)
0124 in.b r1,(r6.w)+-{s1} (6c)
0125 and.w r0,(r3.w,r5.w) (21 00)

And because your greetings doesn't specify any code at
address 0x0172, the processor executes what ever is
left there.
From: io_x on

"Herbert Kleebauer" <klee(a)unibwm.de> ha scritto nel messaggio
news:4B405C0B.5AA46BBF(a)unibwm.de...
> io_x wrote:
>> "Herbert Kleebauer" <klee(a)unibwm.de> ha scritto nel messaggio
>
>> > io_x wrote:
>> >>
>> >> Buon Natale
>> >>
>> >> Merry Christmas to all!
>> >
>> > Sorry, there must be a bug. Your code crashes when I execute it.
>>
>> yes possibily i'm not much sure on "ah=0Eh|int 10h"
>
> I didn't say your code but your greetings crashes when executed.
>
> When I disassemble the text:
>
> ------------------------------------------
> Buon Natale
>
> Merry Christmas to all!
> ------------------------------------------
>
> I get:
>
> 0100 inc.w r1 (42)
> 0101 bne.b $0172 (75 6f)
> 0103 out.b (r5.w)+-,r1 (6e)
> 0104 and.b r2,$61(r4.w){s7} (20 4e 61)
> 0107 beq.b $016a (74 61)
> 0109 in.b r1,(r6.w)+-{s1} (6c)
> 010a or.w #$0d0a,r0 (65 0d 0a 0d)
> 010e or.b $65(r6.w),r2 (0a 4d 65)
> 0111 bcs.b $0185 (72 72)
> 0113 bpl.b $0135 (79 20)
> 0115 inc.w r3 (43)
> 0116 move.w #$6972,-(sp) (68 72 69)
> 0119 bcc.b $018f (73 74)
> 011b in.w r1,(r6.w)+-{s1} (6d)
> 011c movem.w (sp)+,r0-r7 (61)
> 011d bcc.b $013f (73 20)
> 011f beq.b $0190 (74 6f)
> 0121 and.b m0,$6c(r3.w,r6.w) (20 61 6c)
> 0124 in.b r1,(r6.w)+-{s1} (6c)
> 0125 and.w r0,(r3.w,r5.w) (21 00)
>
> And because your greetings doesn't specify any code at
> address 0x0172, the processor executes what ever is
> left there.
if at that address i specify:
(si==100, bp==09xx)
00000072 55 push bp ; U
00000073 58 pop ax ; X
00000074 56 push si ; V
00000075 5A pop dx ; Z
00000076 53 push bx ; S (not used)
00000077 CD21 int 0x21 ; �! here ah=09h dx==0100h
00000079 53 push bx ; S (not used)
0000007A CD20 int 0x20 ; �
0000007C 21 db 0x21 ; ! (not used)
it would print the string until $; (but not using debug program)
it seems all right if this below is find in a .com file
--------------------
Buon Natale e un felice anno nuovo!
Merry Christmas and one Happy New Year!
thanks to CPU x86 and all you too
$UXVZS�!S� !




From: io_x on

"io_x" <a(a)b.c.invalid> ha scritto nel messaggio
news:4b41b05a$0$1143$4fafbaef(a)reader1.news.tin.it...
>> And because your greetings doesn't specify any code at
>> address 0x0172, the processor executes what ever is
>> left there.
> if at that address i specify:
> (si==100, bp==09xx)
> 00000072 55 push bp ; U
> 00000073 58 pop ax ; X
> 00000074 56 push si ; V
> 00000075 5A pop dx ; Z
> 00000076 53 push bx ; S (not used)
> 00000077 CD21 int 0x21 ; �! here ah=09h dx==0100h
> 00000079 53 push bx ; S (not used)
> 0000007A CD20 int 0x20 ; �
> 0000007C 21 db 0x21 ; ! (not used)
> it would print the string until $; (but not using debug program)
> it seems all right if this below is find in a .com file
> --------------------
> Buon Natale e un felice anno nuovo!
> Merry Christmas and one Happy New Year!
> thanks to CPU x86 and all you too
> $UXVZS�!S� !

---------------------
Buon Natale e un felice anno nuovo!
Merry Christmas and one Happy New Year!
Thanks to CPU x86 and all you too
$CLARA_LUX_VZ._S�!S� !