瀏覽代碼

started terminal print loop

Phil 5 年之前
父節點
當前提交
97d162a5e8
共有 1 個文件被更改,包括 36 次插入7 次删除
  1. 36 7
      dino.asm

+ 36 - 7
dino.asm

@@ -8,10 +8,13 @@ SYS_IOCTL equ 54
 section .bss
 	sz RESB 4 ; 4 byte for window size
 	num resb 4 ;4 byte for ascii numbers
-
+	srow resb 1;
+	scol resb 1;
 section .data
 	ha db 0 ;hundreds
 	ta db 0 ;tens
+	rcount db 0;
+	lb db 0xa; linebrak
 
 section .text
 	global _start
@@ -24,6 +27,38 @@ _start:
 	mov edx, sz		; target struct
 	int 0x80		; call kernel
 
+	;print fullscreen
+
+	;save window size
+	mov eax, [sz]
+	mov [srow], eax
+	mov eax, [sz+2]
+	mov [scol], eax
+	call print
+	jmp exit
+
+	;print terminal
+print:
+	mov eax, SYS_WRITE
+	mov ebx, STDOUT
+	mov eax, [rcount]
+	add eax, '0'
+	mov [lb], eax
+	mov ecx, lb
+	mov edx, 1
+	int 0x80
+
+	inc byte [rcount]
+	mov eax, [srow]
+	cmp eax, [rcount]
+	jl print
+	ret
+
+exit:
+	;exit
+	mov eax, 1
+	mov ebx, 0
+	int 0x80
 
 	; print rows
 	
@@ -81,12 +116,6 @@ tens:
 	;mov edx, 3
 	;int 0x80
 
-exit:
-	;exit
-	mov eax, 1
-	mov ebx, 0
-	int 0x80
-
 inchundred:
 	inc byte [ha]		;increment hundreds
 	sub ecx, 0x64