Giter Site home page Giter Site logo

tearitco / hexdump2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from softwareguycoder/hexdump2

0.0 0.0 0.0 6 KB

(NASM/Linux/x86) Demonstrates the use of assembly language procedures to make a hex dump utility

Assembly 98.70% Makefile 1.30%

hexdump2's Introduction

Program hexdump2

A simple program in assembly (32-bit mode), written with NASM, for Linux. Demonstrates using assembly language procedures to implement a hex dump utility that also shows the ASCII-equivalent output.

Pseudo-code

As long as there is data available from STDIN, do the following:
    Read data from STDIN
    Convert data bytes to a suitable hexadecimal/ASCII display form
Insert formatted data bytes into a 16-byte hex dump line
    Every 16 bytes, display the hex dump line

(The text below is from "Assembly Language Step by Step: Programming with Linux", 3rd ed., by Jeff Duntemann, John Wiley & Sons, 2009.)

This is a good example of early pseudo-code iteration, when you know roughly what you want the program to do but are still a little fuzzy on exactly how to do it. It should give you a head-start understanding of the much more detailed (and how-oriented) pseudo-code that follows:

Zero out the byte count total (ESI) and offset counter (ECX)
Call LoadBuff to fill a buffer with the first batch of data from STDIN
    Test number of bytes fetched into the buffer from STDIN
        If the number of bytes was zero, the file was empty; jump to Exit
Scan:   Get a byte from the buffer and put it in AL
        Derive the byte's position in the hex dump line stirng
        Call DumpChar to poke the byte into the line string
        Increment the total counter and buffer offset counter
        Test and see if we've processed the last byte in the buffer:
            If so, call LoadBuff to fill the buffer with data from STDIN
                Test number of bytes fetched into the buffer from STDIN
                    If the number of bytes was 0, we hit EOF; jump to Exit
        Test and see if we've poked 16 bytes into the hex dump line
        If o, call PrintLine to display the hex dump line
Loop back to Scan
Exit:   Shut down the program gracefully per Linux requirements

hexdump2's People

Contributors

softwareguycoder avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.