From: Herbert Kleebauer on 26 Dec 2009 04:12 io_x wrote: > "Herbert Kleebauer" <klee(a)unibwm.de> ha scritto nel messaggio > the traslation > ------------------ > org 100h > main: > push si > mov ah, 0Eh > mov si, auguri > .1: mov al, [si] > cmp al, 0 > je .2 > inc si > int 10h > jmp short .1 > .2: mov ax, 0 > pop si > ret > 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 Displaying a text string on the screen is a beginners works. The greetings are meant for the CPU and not for a lazy human sitting before the screen. The CPU does all the hard work all the day and deserves some greetings. In my code "Merry Christmas and a Happy New Year!" is not some data string written to the screen but executed as code by the CPU byte by byte. PS: And the CPU really deserves some greetings if it accepts such a syntax without a word of protest: > ------------- > origin > ----------------- > org 100h > main: > <i |ah=0Eh|i=auguri > .1: al= *i|al==0#.2|++i|int 10h|#.1 > .2: a=0 > >i > ret > 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
From: wolfgang kern on 26 Dec 2009 05:53 "Herbert Kleebauer" <klee(a)unibwm.de> schrieb im Newsbeitrag 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. > Here a working version (maybe you should use an assembler > with a more logical syntax): > > > @=$100 > dc.b "Merry Christmas and a Happy New Year!" > dc.b "$VZ500599" > trap #$21 > rts.w > > > The hexdump of the binary: I try to interprete it out from my head: (assume a 16-bit .com) 0100 4d dec bp ;M 0101 65 72 72 gs: jc 0176 ;err ;if carry wasn't set 0104 79 20 jns 0126 ;y[] ;andif bp was >0 ... 0106 43 inc bx ;C 0107 68 72 69 push 6972 ;hri 010a 73 74 jnc 0180 ;st 010c 6d insw ;m 010d 61 popa ;a 010e 73 20 jnc 0130 ;s[] 0110 61 popa ;a 0111 6e outsb ;n 0112 64 20 61 20 and fs:[bx+di+20],ah ;d[]a[] 0116 48 dec ax ;H 0117 61 popa ;a 0118 70 70 jo 18a ;pp 011a 79 20 jns 13c ;y[] 011c 4e dec di ;N 011d 65 77 20 gs: ja 0140 ;ew[] 0120 59 pop cx ;Y 0121 65 61 gs: popa ;ea 0123 72 21 jc 0146 ;r! 0125 24 (56) and al,56 ;$(V) :126 56 push di ;V ;...then it might come here 0127 5a pop dx ;Z ;DS=PSP+0100, dx= 0 now ? 0128 35 30 30 xor ax,3030 ;500 012b 35 39 39 xor ax,3939 ;599 ;ah= 09 yet ? 012e cd 21 int 21 ; :130 c3 ret ; ASCII-decoding is kinda fun, Happy New Year! __ wolfgang
From: io_x on 27 Dec 2009 02:30 "Herbert Kleebauer" <klee(a)unibwm.de> ha scritto nel messaggio news:4B35D392.BBA4E50C(a)unibwm.de... > io_x wrote: > PS: And the CPU really deserves some greetings if it > accepts such a syntax without a word of protest: i like what is easy [for me], and loops
From: Frank Kotler on 27 Dec 2009 14:14 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... Best, Frank
From: Herbert Kleebauer on 28 Dec 2009 08:23 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
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Pushad with GAS? Next: ~~~~~~~~~~~~~~ DIABETIC SHOES ~~~~~~~~~~~~~~ |