|
|
@@ -10,10 +10,11 @@ SYS_TIMER_FD_SETTIME equ 0x145
|
|
|
section .bss
|
|
|
sz RESB 4 ; 4 byte for window size
|
|
|
num resb 4 ;4 byte for ascii numbers
|
|
|
- srow resb 1;
|
|
|
- scol resb 1;
|
|
|
+ srow resb 1 ;screen rows
|
|
|
+ scol resb 1 ;screen columns
|
|
|
+ tof resb 1 ; 1 byte store top offstet
|
|
|
|
|
|
- tmp resb 4
|
|
|
+ tmp resb 1
|
|
|
|
|
|
section .data
|
|
|
;num to ascii variables
|
|
|
@@ -23,7 +24,6 @@ section .data
|
|
|
;graphics layout
|
|
|
rcount db 0;
|
|
|
lb db 0xa; linebrak
|
|
|
- tof db 0; ; top offset
|
|
|
lof db 0; ; left offset
|
|
|
gh db 42; ; game height
|
|
|
gw db 102; ; game width
|
|
|
@@ -100,25 +100,31 @@ _start:
|
|
|
;calc offset
|
|
|
;top
|
|
|
xor eax, eax
|
|
|
- xor bl, bl
|
|
|
+ xor bx, bx
|
|
|
mov ax, [srow]
|
|
|
- and ax, 0x0F ; bitmask so that only srow (1byte) is inside ax (2byte) else it is scol+srow
|
|
|
- ;sub ax, [gh] ;screenrows - geameheight
|
|
|
+ and ax, 0xFF ; bitmask so that only srow (1byte) is inside ax (2byte) else it is scol+srow
|
|
|
+ mov bx, [gh]
|
|
|
+ and bx, 0xFF
|
|
|
+ sub ax, bx ;screenrows - geameheight
|
|
|
mov bl, 2
|
|
|
div bl
|
|
|
- ;mov [tof], al
|
|
|
- jmp exit
|
|
|
+ mov al, 0x6
|
|
|
+ mov [tof], al
|
|
|
+ ;jmp exit
|
|
|
|
|
|
;left
|
|
|
mov ax, [scol]
|
|
|
- sub ax, [gw]
|
|
|
+ and ax, 0xFF
|
|
|
+ mov bx, [gw]
|
|
|
+ and bx, 0xFF
|
|
|
+ sub ax, bx
|
|
|
mov bl, 0x2
|
|
|
div bl
|
|
|
mov [lof], al
|
|
|
|
|
|
;print terminal
|
|
|
print:
|
|
|
-
|
|
|
+ jmp topoffset
|
|
|
emptyterminal:
|
|
|
mov eax, SYS_WRITE
|
|
|
mov ebx, STDOUT
|
|
|
@@ -139,12 +145,12 @@ topoffset:
|
|
|
mov ebx, STDOUT
|
|
|
mov ecx, lb
|
|
|
mov edx, 1
|
|
|
- int 0x80
|
|
|
+ ;int 0x80
|
|
|
|
|
|
inc byte [rcount]
|
|
|
mov al, [rcount]
|
|
|
cmp al, [tof]
|
|
|
- jl topoffset
|
|
|
+ jle topoffset
|
|
|
|
|
|
toprow:
|
|
|
tlcorner:
|