// hello.asm
// this little assembler programm outputs "Hi" on UART_TX
// 
// Put your code here:

// send "Never Graduate!" on UART_TX
// read BUT[1,2] and write to LED[1,2]

@78
D=A
@128
M=D //N
@101
D=A
@129
M=D //e
@118
D=A
@130
M=D //v
@101
D=A
@131
M=D //e
@114
D=A
@132
M=D //r
@32
D=A
@133
M=D // space
@71
D=A
@134
M=D //G
@114
D=A
@135
M=D //r
@97
D=A
@136
M=D //a
@100
D=A
@137
M=D //d
@117
D=A
@138
M=D //u
@97
D=A
@139
M=D //a
@116
D=A
@140
M=D //t
@101
D=A
@141
M=D //e
@33
D=A
@142
M=D //!
@13
D=A
@143
M=D // carriage return
@10
D=A
@144
M=D // line feed
@128
D=A
@CHARBOOT
M=D
@BOOT
0;JEQ

(POLL)
    @BUT
    D=!M
    @LED
    M=D
    @POLL
    0;JMP

(WAITBOOT)
@UART_TX
D=M
@BOOT
D;JEQ
@WAITBOOT
0;JMP

(BOOT)
@CHARBOOT
A=M
D=M
@UART_TX
M=D
@CHARBOOT
M=M+1
@145
D=A
@CHARBOOT
D=D-M
@ENDBOOT
D;JEQ
@WAITBOOT
0;JMP

(ENDBOOT)
@POLL
0;JMP
