fix bootloader and add docs, minor fix to hello

This commit is contained in:
Konarak 2025-04-21 23:19:04 +05:30
parent de1ce5cdac
commit 48fbd4abed
Signed by: konarak
GPG Key ID: DE5E99432B548849
2 changed files with 51 additions and 15 deletions

View File

@ -3,8 +3,9 @@
// //
// Put your code here: // Put your code here:
// Never // send "Never Graduate!" on UART_TX
// 78 101 118 101 114 32 // read BUT[1,2] and write to LED[1,2]
@78 @78
D=A D=A
@128 @128
@ -29,8 +30,6 @@ M=D //r
D=A D=A
@133 @133
M=D // space M=D // space
// Graduate!
// 71 114 97 100 117 97 116 101 33 32
@71 @71
D=A D=A
@134 @134
@ -67,10 +66,14 @@ M=D //e
D=A D=A
@142 @142
M=D //! M=D //!
@10 @13
D=A D=A
@143 @143
M=D // newline M=D // carriage return
@10
D=A
@144
M=D // line feed
@128 @128
D=A D=A
@CHARBOOT @CHARBOOT
@ -102,7 +105,7 @@ D=M
M=D M=D
@CHARBOOT @CHARBOOT
M=M+1 M=M+1
@144 @145
D=A D=A
@CHARBOOT @CHARBOOT
D=D-M D=D-M
@ -114,5 +117,3 @@ D;JEQ
(ENDBOOT) (ENDBOOT)
@POLL @POLL
0;JMP 0;JMP

View File

@ -4,6 +4,41 @@
// //
// Put your code here: // Put your code here:
// @R0
// D=M
//
// // Shift left by 8 bits by doubling 8 times
// D=D+D // Shift left by 1 bit
// D=D+D // Shift left by another bit
// D=D+D // Shift left by another bit
// D=D+D // Shift left by another bit (4-bit shift so far)
// D=D+D // Shift left by another bit
// D=D+D // Shift left by another bit
// D=D+D // Shift left by another bit
// D=D+D // Shift left by another bit (now D contains 0xEA00)
//
// D=M -> 1111110000010000
// M=D -> 1110001100001000
// M=0 -> 1110101010001000
//
// // Store the result in R1
// @R1
// M=D
//
//
// 00010000 0 -> add 8 times and store to lhs
// 00000001 1 -> add to lhs and store to word
// 0001000000000001 write all the words to sram
//
// 0001000000000001
// 1111110001010000
// 0001000000000000
// 1110001100001000
// 0000000000000000
// 1110101010000111
// read data starting at address // read data starting at address
// 0x03 0x01 0x00 0x00 // 0x03 0x01 0x00 0x00
@3 @3
@ -48,7 +83,7 @@
@DECR2 @DECR2
D;JGT D;JGT
//command stack base address //command stack base address
@100 @100
D=A D=A
@READCOMMAND @READCOMMAND
@ -120,7 +155,7 @@
(WESTWORD) (WESTWORD)
@SPI @SPI
D=M D=M
@R13 @DEBUG0
M=D M=D
DM=D+M DM=D+M
DM=D+M DM=D+M
@ -142,11 +177,11 @@
M=D M=D
@SPI @SPI
D=M D=M
@R14 @DEBUG1
M=D M=D
@R13 @DEBUG0
D=M D=M
@R14 @DEBUG1
D=D+M D=D+M
@SRAM_D @SRAM_D
M=D M=D
@ -154,7 +189,7 @@
M=0 M=0
@WORDCOUNT @WORDCOUNT
M=M+1 M=M+1
@6 @57343
D=A D=A
@WORDCOUNT @WORDCOUNT
D=D-M D=D-M