Browse code

Add set and get functions of the cursor row position. Do not add a new line in terminal after app exiting if the cursor is at beginning row.

Pawel Jablonski authored on 12/06/2023 15:53:20
Showing 2 changed files
... ...
@@ -77,6 +77,30 @@ external .xStringGetCursorX:
77 77
 	ldr *xStringCursorX, A
78 78
 	ret
79 79
 
80
+; Arguments:
81
+; 	A - row
82
+; No return
83
+external .xStringSetCursorY:
84
+	push X
85
+	push Y
86
+	; Write new row position to set
87
+	mov A, Y
88
+	; Read current column position to set
89
+	ldr *xStringCursorX, X
90
+	; Set new row position and leave column position
91
+	call .xStringSetCursor
92
+	pop Y
93
+	pop X
94
+	ret
95
+
96
+; No arguments
97
+; Return:
98
+;	A - row
99
+external .xStringGetCursorY:
100
+	; Get current row position
101
+	ldr *xStringCursorY, A
102
+	ret
103
+
80 104
 ; No arguments
81 105
 ; No return
82 106
 external .xStringNewLine:
... ...
@@ -125,9 +125,14 @@ const messageFreeRam "28K Data memory free"
125 125
 .xTerminalGetCommand:
126 126
 	; Reset color
127 127
 	call .xTerminalColorReset
128
-	; Show command line
128
+	; Do not make a new line if the cursor is at beginning
129
+	call .xStringGetCursorY
130
+	cmp 0, A
131
+	je .xTerminalGetCommand_no_newLine
129 132
 	call .xStringNewLine
130 133
 	call .xStringNewLine
134
+.xTerminalGetCommand_no_newLine:
135
+	; Show command line
131 136
 	mov '>', A
132 137
 	call .xStringPrintChar
133 138
 	call .xLcdRefresh