Browse Source

Starting changing screen drivers to 640x480, 16 colours

Stephen Downward 1 year ago
parent
commit
ee39f07ded
3 changed files with 47 additions and 12 deletions
  1. 29 11
      boot.asm
  2. 14 0
      drivers/screen.asm
  3. 4 1
      print.asm

+ 29 - 11
boot.asm

@ -1,4 +1,3 @@
1
2 1
	cpu 286
3 2
	org 0x7c00
4 3
	bits 16
@ -21,11 +20,12 @@
21 20
	mov al, 0x00
22 21
	int 0x10
23 22
24
	;; 80x25, 16 colours
23
	;; 640x480, 16 colours
25 24
	mov ah, 0
26
	mov al, 0x03
25
	mov al, 0x12
27 26
	int 0x10
28 27
28
	mov cx, 0x02				;Green
29 29
	mov bx, STARTUP
30 30
	call print
31 31
@ -40,10 +40,13 @@
40 40
	mov bx, 0x7E00				;RAM
41 41
	call read_sector
42 42
43
	push bx
44
	mov bx, 0xF
43 45
	mov al, '>'					;cmd line
44 46
	call print_char
45 47
	mov al, ' '
46 48
	call print_char
49
	pop bx
47 50
	
48 51
loop:
49 52
	mov ah, 0
@ -60,15 +63,20 @@ loop:
60 63
	mov ah, [CMD_BUFFER_POS]
61 64
	add ah, 1
62 65
	mov [CMD_BUFFER_POS], ah
63
	
66
67
	;; char output
68
	push bx
69
	mov bx, 0xD
64 70
	mov ah, 0x0e
65 71
	int 0x10
72
	pop bx
66 73
	
67 74
	jmp loop
68 75
69 76
	;; Print has to be kept here so that disk errors can be printed
70 77
	%include "print.asm"
71 78
	%include "disk.asm"
79
	%include "drivers/screen.asm"
72 80
	
73 81
;//CMD_BUFFER:	times 64 db 0 		;63 char buffer for command
74 82
CMD_BUFFER_POS:	dw 0
@ -81,10 +89,13 @@ STARTUP:	db "Starting Steve16...", 0xA, 0xD,
81 89
	times 510-($-$$) db 0
82 90
	dw 0xaa55
83 91
92
	;; =====================================
84 93
	;; SECTOR 2 & 3
94
	;; =====================================
85 95
	%include "string.asm"
86 96
	%include "textedit.asm"
87 97
	%include "memtest.asm"
98
	
88 99
89 100
kb_bs:
90 101
	cmp [CMD_BUFFER_POS], byte 0 ;Ignore the backspace if CMD_BUFFER is empty
@ -145,10 +156,13 @@ kb_ent:
145 156
	call cmd
146 157
147 158
	;; Print >
159
	push bx
160
	mov bx, 0xF
148 161
	mov al, '>'
149 162
	call print_char
150 163
	mov al, ' '
151 164
	call print_char
165
	pop bx
152 166
	
153 167
	jmp loop
154 168
@ -189,9 +203,15 @@ cmd:
189 203
	cmp [CMD_BUFFER_POS], byte 0
190 204
	je clear_cmd_buffer
191 205
	
192
206
	push cx						;maybe unnecessary?
207
	mov cx, 0x4
193 208
	mov bx, RTN_UNKNOWN_STR
194 209
	call print
210
	pop cx
211
212
clear_cmd_buffer:	
213
	mov [CMD_BUFFER_POS], byte 0
214
	ret
195 215
196 216
cmd_memtest:
197 217
	pusha
@ -201,13 +221,12 @@ cmd_memtest:
201 221
	popa
202 222
	jmp clear_cmd_buffer
203 223
204
clear_cmd_buffer:	
205
	mov [CMD_BUFFER_POS], byte 0
206
	ret
207
208 224
cmd_help:
225
	push cx
226
	mov cx, 0xB					;CYAN INFO
209 227
	mov bx, RTN_HELP_STR
210 228
	call print
229
	pop cx
211 230
	jmp clear_cmd_buffer
212 231
213 232
cmd_sedit:
@ -215,8 +234,7 @@ cmd_sedit:
215 234
	jmp clear_cmd_buffer
216 235
217 236
cmd_clear:
218
	mov ax, 0x03
219
	int 0x10
237
	call kernel_scn_cls
220 238
	jmp clear_cmd_buffer
221 239
222 240
cmd_strsplit:

+ 14 - 0
drivers/screen.asm

@ -0,0 +1,14 @@
1
kernel_scn_cls:
2
	push cx
3
	push ax
4
	push es
5
	mov ax, 0xA000
6
	mov es, ax				;video addr
7
	mov ax, 0x0
8
	xor di, di				;set to 0
9
	mov cx, (640*480)/2
10
	rep stosw
11
	pop es
12
	pop ax
13
	pop cx
14
	ret

+ 4 - 1
print.asm

@ -55,7 +55,8 @@ output_digit:
55 55
hex_buffer:	times 5 db 0
56 56
hex_count:	 dw 0
57 57
	
58
;; Pass pointer to string @bx
58
	;; Pass pointer to string @bx
59
	;; Pass colour into cx
59 60
print:
60 61
	pusha
61 62
	mov ah, 0x0E				;Teletype output
@ -63,7 +64,9 @@ print_cont:
63 64
	mov al, [bx]
64 65
	cmp al, 0
65 66
	je print_end
67
	xchg cx, bx
66 68
	int 0x10 					;print the character
69
	xchg bx, cx
67 70
	inc bx
68 71
	jmp print_cont				;One less instruction per print
69 72