Skip to content

Instantly share code, notes, and snippets.

@b-adams
Created October 17, 2012 15:21
Show Gist options
  • Save b-adams/3906114 to your computer and use it in GitHub Desktop.
Save b-adams/3906114 to your computer and use it in GitHub Desktop.
CS225 WED OCT 17 NOTES
BR main
msg: .ASCII "Beans beans beans beans beans!\x00"
main: NOP0
;Set up index register to 0
LDX 0,i
loop:NOP0
LDX 0,i ;Clear accumulator
LDBYTEA msg,x ;Load current letter
BREQ endloop ;string is over if that letter is 0 aka /x00
CHARO msg,x ;Second letter?
ADDX 1,i ;X++ part 1/1
BR loop
endloop:NOP0
stop
.end
#include <stdio.h>
int main(void)
{
int size;
scanf("%d", &size);
for(int j=0; j<size; j++)
{
for(int i=0; i<j; i++)
{
printf("*");
}
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment