diff --git a/src/example/char_in.asm b/src/example/char_in.asm index 4fb6497..faa2dd2 100644 --- a/src/example/char_in.asm +++ b/src/example/char_in.asm @@ -1,13 +1,13 @@ -10;Queries the keyboard for input and prints the resulting keycode -20 ORG 100H ;Tell the assembler to start at addr 0x100 -30START: LD HL,GREET ;Load the start addr. of the banner text -40 LD B,15H ;The length if the string -50 LD DE,0H ;Start output in the top left corner -60 CALL 84CDH ;Call str_out -70LOOP: CALL 8881H ;Call the char_in -80 LD DE,16H ;Position cursor in row 0, col 22 -90 CALL 8468H ;Print the char -100 JR LOOP ;Retrun to the loop -110 RET ;End the program -120GREET: DB 'Test keyboard input: ' -130 END ;Mark the end of code for the assembler +;Queries the keyboard for input and prints the resulting keycode + ORG 100H ;Tell the assembler to start at addr 0x100 +START: LD HL,GREET ;Load the start addr. of the banner text + LD B,15H ;The length if the string + LD DE,0H ;Start output in the top left corner + CALL 84CDH ;Call str_out +LOOP: CALL 8881H ;Call the char_in + LD DE,16H ;Position cursor in row 0, col 22 + CALL 8468H ;Print the char + JR LOOP ;Retrun to the loop + RET ;End the program +GREET: DB 'Test keyboard input: ' + END ;Mark the end of code for the assembler diff --git a/src/example/char_out.asm b/src/example/char_out.asm index 20050af..757203b 100644 --- a/src/example/char_out.asm +++ b/src/example/char_out.asm @@ -1,8 +1,8 @@ -10;Outputs an "A" in the second column of the last row -20 ORG 100H ;Tell the assembler to start at addr. 0x100 -30START: LD A,41H ;Load the letter "A" to register A -40 LD DE,301H ;Sets the row to 3 and the column to 1 -50 CALL 8468H ;Calls the ```char_out``` function -60 RET ;Return -70 END ;Marks the end of the code for the assembler +;Outputs an "A" in the second column of the last row + ORG 100H ;Tell the assembler to start at addr. 0x100 +START: LD A,41H ;Load the letter "A" to register A + LD DE,301H ;Sets the row to 3 and the column to 1 + CALL 8468H ;Calls the ```char_out``` function + RET ;Return + END ;Marks the end of the code for the assembler diff --git a/src/example/str_out.asm b/src/example/str_out.asm index f7bcc2b..4ade84e 100644 --- a/src/example/str_out.asm +++ b/src/example/str_out.asm @@ -1,10 +1,10 @@ -10;output a string into the top left of the screen -20 ORG 0100H ;Start at addr 0x100 -30START: LD HL,DATA ;Load the start address of the string -40 LD B,0DH ;The length of the string (max 255 chars) -50 LD DE,0H ;Start in the top left corner (D=0-3 -> row; E=0-23 column) -60 CALL 84CDH ;Call the str_out function in ROM -70 RET ;Return from call -80DATA: DB 'HELLO, WORLD!' -90 END ;End marker for the assembler +;output a string into the top left of the screen + ORG 0100H ;Start at addr 0x100 +START: LD HL,DATA ;Load the start address of the string + LD B,0DH ;The length of the string (max 255 chars) + LD DE,0H ;Start in the top left corner (D=0-3 -> row; E=0-23 column) + CALL 84CDH ;Call the str_out function in ROM + RET ;Return from call +DATA: DB 'HELLO, WORLD!' + END ;End marker for the assembler