Skip to content

Instantly share code, notes, and snippets.

@awave1
Forked from anonymous/A4.S
Created November 6, 2017 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awave1/80018776c5f6be39e1a907c900e70252 to your computer and use it in GitHub Desktop.
Save awave1/80018776c5f6be39e1a907c900e70252 to your computer and use it in GitHub Desktop.
; ========================================================================
; Name: Artem Golovin
; Email: agolo124@mtroyal.ca
; Course: COMP2655-001
; Due Date: November 5th
; Assignment: 4
; Instructor: ppospisil
; Source: A4.S
; Purpose: To gain experience with branching and to implement
; "snaking" column representation for sorted data
; Details: Linux "ls" command, by default displays output in columns
; whose format is snaking columns. The information is listed
; alphabetically in columns instead of rows. If the number of
; items is not evenly divisible by the number of columns,
; extra items are distributed in the columns from left to right
;
; Algorithm works this way:
; - Calculate longest string in the file
; - Read the file n times, where n is number of rows (incl. extra row)
; - Read word from the file
; - Skip first words if reading file not for the first time
; - Print the word
; - After new line is reached, skip words in file:
; - If there's an extra row:
; - Skip rows - 1 words for m columns that contain extra row
; - Skip rows - 2 words for the rest of the columns
; - Else: Skip rows - 1 words
; - Calculate # of whitespaces
; - Column Width - current string size
;
; Assumptions & Limitations:
; It is assumed that provided files are already sorted
; alphabetically
;
; Register Table:
; register usage
; ==========================================================
; d0 Mainly used to store character that was read
; from file and to output a charcter to screen
; d1 Used to store current file size. Represents
; EOF when reached 0
; d2
; d3
; d4
; d5
; d6
; d7
;
;
;
;=========================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment