Stephen D 9 months ago
parent
commit
68b6a9866a
2 changed files with 77 additions and 16 deletions
  1. 33 16
      boot.asm
  2. 44 0
      memtest.asm

+ 33 - 16
boot.asm

@ -66,6 +66,7 @@ loop:
66 66
	
67 67
	jmp loop
68 68
69
	;; Print has to be kept here so that disk errors can be printed
69 70
	%include "print.asm"
70 71
	%include "disk.asm"
71 72
	
@ -158,6 +159,11 @@ cmd:
158 159
	cmp cl, 1
159 160
	je cmd_clear
160 161
162
	mov dx, CMD_MEMTEST_STR
163
	call strcmp
164
	cmp cl, 1
165
	je cmd_memtest
166
161 167
	;; don't print unknown command message if cmd is empty
162 168
	cmp [CMD_BUFFER_POS], byte 0
163 169
	je clear_cmd_buffer
@ -165,23 +171,13 @@ cmd:
165 171
166 172
	mov bx, RTN_UNKNOWN_STR
167 173
	call print
168
	
169
clear_cmd_buffer:	
170
	mov [CMD_BUFFER_POS], byte 0
171
	ret
172 174
173
cmd_help:
174
	mov bx, RTN_HELP_STR
175
	call print
176
	jmp clear_cmd_buffer
177
178
cmd_sedit:
179
	call sedit_init
180
	jmp clear_cmd_buffer
181
182
cmd_clear:
183
	mov ax, 0x03
184
	int 0x10
175
cmd_memtest:
176
	pusha
177
	mov bx, 0x8300
178
	mov ax, 0xFFFF
179
	call memtest_init
180
	popa
185 181
	jmp clear_cmd_buffer
186 182
	
187 183
	
@ -199,7 +195,27 @@ STARTUP:	db "Starting Steve16...", 0xA, 0xD,
199 195
	;; SECTOR 2 & 3
200 196
	%include "string.asm"
201 197
	%include "textedit.asm"
198
	%include "memtest.asm"
199
200
clear_cmd_buffer:	
201
	mov [CMD_BUFFER_POS], byte 0
202
	ret
203
204
cmd_help:
205
	mov bx, RTN_HELP_STR
206
	call print
207
	jmp clear_cmd_buffer
208
209
cmd_sedit:
210
	call sedit_init
211
	jmp clear_cmd_buffer
212
213
cmd_clear:
214
	mov ax, 0x03
215
	int 0x10
216
	jmp clear_cmd_buffer
202 217
218
CMD_MEMTEST_STR:	 db "MEMTEST", 0
203 219
CMD_SEDIT_STR: db "SEDIT", 0
204 220
CMD_HELP_STR:  db "HELP", 0
205 221
CMD_CLEAR_STR: db "CLEAR", 0
@ -210,6 +226,7 @@ RTN_HELP_STR:
210 226
	db "    HELP        This screen", 0xA, 0xD
211 227
	db "    SEDIT       Steve16 Text Editor", 0xA, 0xD
212 228
	db "    CLEAR       Clears the screen", 0xA, 0xD
229
	db "    MEMTEST     Runs a memory test", 0xA, 0xD
213 230
	db 0
214 231
215 232
RTN_UNKNOWN_STR:

+ 44 - 0
memtest.asm

@ -0,0 +1,44 @@
1
	;; Used to test memory
2
3
	;; bx - start of byte to test
4
	;; ax - last byte to test(not inclusive)
5
	;; writes all 0s, verifies, writes all 1s, verifies
6
memtest_init:
7
	pusha
8
9
memtest_test_ram:
10
	cmp bx, ax
11
	jge memtest_done
12
	mov [bx], byte 0
13
	cmp [bx], byte 0
14
	jne memtest_byte_error
15
	mov [bx], byte 0xFF
16
	cmp [bx], byte 0xFF
17
	jne memtest_byte_error
18
	add bx, 1
19
	jmp memtest_test_ram
20
	
21
memtest_byte_error:
22
	push bx
23
	mov bx, MEM_ERROR
24
	call print
25
	pop bx
26
	push ax
27
	mov ax, bx
28
	call print_hex
29
30
	mov al, 0xD
31
	call print_char
32
	mov al, 0xA
33
	call print_char
34
35
	
36
	pop ax
37
	add bx, 1
38
	jmp memtest_test_ram
39
40
memtest_done:
41
	popa
42
	ret
43
44
MEM_ERROR:	db "MEMORY ERROR: ", 0