\documentclass[aspectratio=169,t,xcolor=table,usenames]{beamer}
\mode<presentation>
{
  \usetheme{CambridgeUS}
}


\usepackage[utf8]{inputenc}

\usepackage[xetex]{animate}
\usepackage{booktabs}
\usepackage{subcaption}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{hyperref}

\usepackage{etoolbox}

\usepackage{datetime}

\usepackage{enumerate}
\usepackage{enumitem}

\usepackage{xltxtra}
\usepackage{listings-mips}
\usepackage{listings}

\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{makecell}
\usepackage{multicol}
\usepackage{multirow}

\usepackage{tabularx}
\usepackage{textcomp}
\usepackage{tikz}
\usetikzlibrary{arrows,automata,calc, decorations.pathmorphing,math,backgrounds,positioning,fit}
\usepackage{pgf-umlcd}

\usepackage{fontspec}
\IfFontExistsTF{Gentium Book Basic}{
  \setmainfont{Gentium Book Basic}
}{
  \setmainfont{Times New Roman}
}
\IfFontExistsTF{Comic Code}{
  \setmonofont{Comic Code}[
  Scale = 0.85,
  ]
}{
}

\lstset{
  basicstyle=\ttfamily,
  language={[mips]assembler},
}

\begin{document}

\begin{frame}[fragile]
  \frametitle{The Calling Stack}
\begin{lstlisting}
  .data
i:.word 1000
N:.word 20
eoln: .asciiz "\n"
end_comment: .asciiz "Done!\n"
name:
 .asciiz "123456789"
  .text
  # length of a string
  # $a0 - address of string to find length of
  # Registers:
  # $t1 - ch
  # $v0 - length

length:
   li    $v0, 0

length_load_ch:
  lb    $t1, ($a0)
  # if ch   == \0 jump to end
  beqz   $t1, length_after_loop

body:
  addi    $a0, $a0, 1
  addi    $v0, $v0, 1
  b        length_load_ch


length_after_loop:
  jr    $ra
  .globl main

  # chop off last character of string
  # $a0 - str
  # $t0 - length
  # calls length...
\end{lstlisting}
\end{frame}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
