Writing Programs with Echo (DOS)

How do you input those characters as parameters for the echo command? I found no way of doing that. If you know a way, please drop me a line.

Is that possible? Yes, it is. It’s just a matter of redirecting echo output to a file. Writing the program with echo should be a straightforward task if we are able to produce the sequence of characters corresponding to the intended binary, executable file. Is that useful? Surely not. But it’s a healthy way to waste your time 🙂 This can be achieved by writing the characters of the executable file, using a simple text editor like notepad or even the old MS-DOS Editor. Of course, the program should be relatively small or we would adventure into the dangerous lands of masochism. By using the echo command of DOS we will be following the conceited style of doing things 🙂 But we’ll restrict this post to the simple hello, world! program we have been reviewing in previous entries.

Continue reading “Writing Programs with Echo (DOS)”

Postales en Sepia: III

Hoy, cuando te vi y fingiste no verme, supe que habías aprendido a odiarme. No fue de olvido o indiferencia de lo que habló tu cuello. Sólo los ojos que odian piensan en la excusa de la nada y del todo suspendido entre los transeúntes sobre la acera. Está bien. Así puedes recordarme sin que te duela tanto. Pero no olvides que el odio es el bálsamo de los perdedores, y no se corresponde con la luz y la alegría de tu imagen en mi memoria.

Postal anterior

El Hombre Frenético

Autor: Alejandro (relato publicado en la revista Mandeb N° 2, 2010).

Dentro de pocas horas, la entrevista, como un destino implacable e insoslayable. Entonces era preciso aprestarse en el pulimento de los zapatos, únicos artefactos que aún andaban a su antojo en el orden de la indumentaria. Tenían que ser los negros, comprados en la capital pocos años atrás, usados pero presentables. Tenían que ser los negros porque aún si dispusiera de otros zapatos, de otros colores, sólo el negro proporciona el aplomo, la seguridad que debía clavar como una bofetada en la cara del entrevistador. “Demostrar confianza en uno mismo”, recordaba haber leído en una columna periodística, que según él, nadie más había leído. A ver, el cajón. Un poco más abajo, al fondo. La caja con los instrumentos. Por fortuna, el betún aún no se ha endurecido. De inmediato estorba el trapo (buen trapo: áspero en una cara, suave en la otra). Un poco más abajo, al fondo, allí está. El cepillo sigue siendo el mismo “Latouché” que Patricia había conseguido en casa de sus padres, no sin cierta efusiva protesta del suegro. Ahora que Patricia se había ido, era una suerte que el “Latouché” continuara en el fondo de la caja. Cuando Patricia estaba ella le pulía los zapatos mientras decía cosas sobre los niños, cosas que ahora él no recordaba. No las recordaba porque a Patricia no había que concederle demasiada atención. Cosas sobre los niños, porque ¿de qué otro tema hablaba Patricia en las tardes pardas y tristes que él inundaba con la pestilencia del alcohol y lo infructuoso de una colocación? Pero ahora Patricia se había ido, y dentro de pocas horas, la entrevista.

Al comienzo, el cepillo respondía con deleite. El ruido de las cerdas batiéndose contra el cuero quebraba el silencio de aquellas paredes donde ya no quedaba nada o casi nada que pudiera emitir algún sonido. Ni los acreedores iban ya. La bulla de los niños se había extinguido más de una semana atrás, junto con el viejo radio de pilas. Estaban temporalmente con ella. Temporalmente, porque sólo debían aguardar a que él demostrara quién era y cuánto valía para el puesto, dentro de pocas horas. Patricia se los había llevado (temporalmente, esperando con tranquilidad la entrevista… después de eso, la normalidad), pero no se había llevado, todavía, el “Latouché”. Sin Patricia, el cepillo estaba demasiado a gusto. Iba y venía gobernando su mano derecha. Distribuía el betún por todo el cuero. Iba y venía. Un poco más abajo, al fondo. Y el cepillado sin tregua comenzaba a devorar los minutos. Y de pronto, sintió que los zapatos debían pagar, temporalmente, por todo aquello. El vaivén se olvidó del zapato, y el cepillo azotaba ya el aire, ya el suelo, empañándolo con la crema negra, infatigable la mecánica del cepillado que se había adueñado, por fin, de todo su brazo derecho. Y entonces, esparcido ya en el suelo, con la pizca de cordura que aún dudaba en marcharse, sintió que no sentía el cuerpo, a excepción del brazo derecho, que aún continuaba frenética y autónomamente cepillando la nada, como si estuviese embadurnando la cara del entrevistador con su autoconfianza.

Encoding Intel x86/IA-32 Assembler Instructions

Translation of the second line is a direct and solved issue. What about jmp 114? Well, we want to jump over the data (18 bytes, one byte per each character in the string.) IASDM tell us (Appendix B) that the opcode for unconditional jumps in the same segment is 11101011, which in hexadecimal, is expressed as EB.

On the post Debugging hello, world, someone asked about the reason for translating the instruction jmp 114 into hexadecimal EB12. To answer this, we are going to recur to the “lovely” and elder Intel Architecture Software Developer Manual (IASDM), Volume 2. This volume describes the instructions set of the Intel Architecture processor (x86/IA-32) and the opcode structure. I’ll review some terms involved here:

    x86: It refers to the instruction set of the Intel-compatible CPU architectures (chips produced by Intel, AMD, VIA, and others) inaugurated by Intel’s original 16-bit 8086 CPU. A decision which proved wise was to make each new instance of x86 processors almost fully backwards compatible.
    IA-32: It is Intel’s 32-bit implementation of the x86 architecture; IA-32 distinguishes this implementation from the preceding 16-bit x86 processors. Note that when the 64-bit era arrived, Intel launched its Itanium processor, which discards compatibility with the IA-32 instruction set. Such 64-bit architecture description and implementation is referred to as IA-64, meaning “Intel Architecture, 64-bit”, but even though the names are similar, IA-32 and IA-64 are very different architectures and instructions sets. However, AMD’s response to Intel 64-bit processors, uses an instruction set that, in essence, is composed of 64-bit extensions to IA-32, i.e., it’s a superset of the x86 instruction set. Such instruction set is referred to as AMD64 (initially, x86-64.) Later, Intel cloned it under the name Intel 64. AMD’s processors Athlon 64, Terium, Opteron, Sempron, etc., are based on AMD64.
    Opcode: An opcode (operation code) is the part of a machine language instruction (pure binary code) specifying the operation to be performed. The other portion of the instruction is the operand, which is optional and represents the data to be operated on. In assembly language, mnemonics are used to represent the opcodes. Concretely, and according to the IASDM, a mnemonic is a reserved name for a class of instruction opcodes which have the same function. For example, in JMP 114, the mnemonic is JMP, and the operand is 114 (remember, 114 in hexadecimal, which is 276 in decimal.)

Continue reading “Encoding Intel x86/IA-32 Assembler Instructions”

Web, Evolution and Trust

By chance, I arrived to an old and interesting BBC news report (2008), Warning sounded on web’s future, on the worries of Tim Berners-Lee about the spreading of disinformation using the web. Such worries are still totally valid today. The article also touches on other related topics such as extending the reach of the web and improving the web’s usability.

Regarding the problem of publishing insincere or unfounded information on the web, Berners-Lee cited the campaign started because of the activation of the Large Hadron Collider. Specifically, some groups used the web for communicate invalid beliefs about the world being destroyed by effect of the LHC. This use of the web is, in first instance, unethical. Further, it may transmit fears, and additionally, the information posted by such groups has no scientific grounds. This a typical example of misusing a system.

Purple spider web

(Photo by toccia). This kind of problem arises because of the web’s intrinsic nature. The web is a different system… a system which is now inevitably linked to the behavior and trends of human society. The web is an open and complex system. It’s open because we can add as much information as we want, and it’s complex because it’s composed of a huge amount of producers and consumers of information, and their interactions. There is other factor that shapes the web complexity: evolution

The web changes at very high rates. The web’s technologies an content change so quickly, that it’s impossible for any person to assimilate all this evolution. After all, the user only wants to open her browser and read the news. Typically, she is interested neither in the technical details behind the publishing platform, nor in the path followed by the information until arriving to the final form on the online media. There is a tool the user recurs to in order to fight complexity: trust.
Continue reading “Web, Evolution and Trust”

White Rabbit

Previously, a song for a dark mood. Later, a sexy one. Now, it’s time for some psychedelic tunes, with the gorgeous Grace Slick. “White Rabbit” belongs to Surrealistic Pillow (1967), the second album by Jefferson Airplane. Besides being one of the essential rock albums, “Surrealistic Pillow” meant the debut of Slick as vocalist of JA on studio records.

By the way, covers of “White Rabbit” by Patti Smith and by Grace Potter and The Nocturnals are very good.

Postales en Sepia: II

No la amo, es sólo que me gusta escucharla todas las horas que ella quiera. Tampoco es que me parezca linda, pero me siento cómodo en su cintura. Es decir, el problema es mío, y por suerte, ella no se entera. Me duele la garganta si no quiebro el silencio con su nombre. Ya no siento la piel si no es con sus besos clandestinos y apresurados (a veces, torpes). Pero no se lo cuentes, porque entonces ya no podré hacer que se sienta vacía cuando le digo: “Es sólo un juego”.

Postal anterior

Programmers from the Wild West

Analysis, Design, and related topics are for sissies, and for allowing professors of Computer Science who are bad at mathematics to make a living. SDLC is a pony. Cowboys ride horses.

We all know what happens when a project’s deadline is not met. Besides firing someone, hard, dry heroes appear. Lonesome, ruthless and distrustful heroes which brings the peace only revolvers can conquer. Sometimes, the guys with the money hire them as the ultimate saviors: they have bothered to come here, from the farthest west, to rescue the project. They are irresistible: they are the cowboy programmers. It’s men’s time.

Ben Cartwright & Sons
Ben Cartwright & Sons

Continue reading “Programmers from the Wild West”