Skip to content

Instantly share code, notes, and snippets.

@pcyu16
Created June 22, 2010 11:02
Show Gist options
  • Select an option

  • Save pcyu16/448331 to your computer and use it in GitHub Desktop.

Select an option

Save pcyu16/448331 to your computer and use it in GitHub Desktop.
* Standard prelude:
0: LD 6,0(0) load maxaddress form location 0
1: ST 0,0(0) clear location 0
* End of standard prelude
2: LDA 0,1(7) save return address in ac
4: HALT 0,0,0 program end
5: ST 0,-1(6) start function code section(save return address)
6: LDC 0,1(0) ac = 1
* One instruction's place is reserved here
8: LDC 0,2(0) ac = 2
9: OUT 0,0,0 output(ac);
7: JEQ 0,2(7) jump to the end of if_stmt
10: LDC 0,3(0) ac = 3;
11: OUT 0,0,0 output(ac);
12: LD 7,-1(6) end function code section(jmp to return address)
3: LDA 7,1(7) jump to main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment