Can someone help me, i need to reduce my code to be < 150 bytes when compile it in .com
The program works in real mode, and it draws the time in the upper right corrner and it's TSR.
I basicly install my interupt vector 1c that writes the time with yellow color, i'm writing directly in graphic memory, cause i'm forbbiden to use int 21h, and then i call 27h so it becomes TSR
My code is now 165 bytes, i need to lose 15 bytes, does anyone have an idea how to do it, i basicly stript every redundant code i could find, but i'm not experiensed in assembly, so i guss that there's a liter way of doing some instructions.
Here's the code:
org 100h
segment .code
main:
call _install_1C
mov dx, load
int 27h
; -----------------------------------------------------------------------
; Install vector 1c
; -----------------------------------------------------------------------
_install_1C:
;cli
xor ax, ax
mov es, ax
; Point vector table to my rutine
mov dx, timer_int
mov [es:1Ch*4], dx
mov ax, cs
mov [es:1Ch*4+2], ax
push ds
pop gs
sti
ret
timer_int:
pushaw
push gs
pop ds
; Timer interupt code
call _get_time ; my function to get time
call _print_time ; my function to print time
izlaz:
popaw
iret
; -----------------------------------------------------------------------
; _get_time_string -- gets time in format: hh:mm:ss
; -----------------------------------------------------------------------
%define T_SEPARATOR ':'
_get_time:
pusha
mov di, 0
mov ah, 2 ; Getting BIOS time in BCD
int 1Ah ; CH: hours, CL: minutes, DH: seconds
mov al, ch ; Hours
shr al, 4
and ch, 0Fh
call AddDigit
mov al, ch
call AddDigit
mov al, T_SEPARATOR
call AddSymbol
mov al, cl
shr al, 4
and cl, 0Fh
call AddDigit
mov al, cl
call AddDigit
mov al, T_SEPARATOR
call AddSymbol
mov al, dh ; Secunds
shr al, 4
and dh, 0Fh
call AddDigit
mov al, dh
call AddDigit
mov al, 0 ; end of string
call AddSymbol
popa
ret
AddDigit:
add al, '0' ; coverts AL into ASCII
mov [vreme + di], al
inc di
ret
AddSymbol:
mov [vreme + di], al
inc di
ret
; -----------------------------------------------------------------------
;Putting time in video memory
; -----------------------------------------------------------------------
zuta equ 0Eh ; Yellow color
_print_time:
push es
mov ax, 0B800h ; Baze adress of video momory = B8000h
mov es, ax
mov bx, word 144 ; Video position = end of line 2 is 160 - 16 bayte, 8 position since one position uses 2 bytes.
mov si, vreme ; si point to array 'vreme' (time)
.prn:
mov al, byte [si]
cmp al, 0
je .end
mov byte [es:bx], al
inc bx
mov al, zuta
mov byte [es:bx], al
inc bx
inc si
jmp .prn
.end:
pop es
ret
load:
segment .data
vreme: db 0
Thanks in advance