forked from KolibriOS/kolibrios
1. Calc now use system colors and drawing from client area (with current kernel it works incorrect because there is a bug in 47th function)
2. New version https by Hex, rewrited to use 70th function by YELLOW. It also use 0th function to write header git-svn-id: svn://kolibrios.org@153 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
bede2c62e6
commit
2665e9eebc
@ -1,33 +1,35 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; ;
|
; ;
|
||||||
; Tiny HTTP Server v 0.4 for MenuetOS ;
|
; Tiny HTTP Server v 0.5 for KolibriOS ;
|
||||||
; ;
|
; ;
|
||||||
; License GPL / See file COPYING for details. ;
|
; License GPL / See file COPYING for details. ;
|
||||||
; Copyright 2003 Ville Turjanmaa ;
|
; Copyright 2003 Ville Turjanmaa ;
|
||||||
; ;
|
; ;
|
||||||
; Compile with FASM for Menuet ;
|
; Compile with FASM for Menuet/KolibriOS ;
|
||||||
; ;
|
; ;
|
||||||
; Request /TinyStat for server statistics ;
|
; Request /TinyStat for server statistics ;
|
||||||
; Request /TinyBoard for server message board ;
|
; Request /TinyBoard for server message board ;
|
||||||
; ;
|
; ;
|
||||||
|
; Special version for KoOS by Hex && Heavyiron ;
|
||||||
|
; ;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
version equ '0.4'
|
appname equ 'Kolibri HTTP Server '
|
||||||
|
version equ '0.6'
|
||||||
|
|
||||||
use32
|
use32
|
||||||
|
|
||||||
org 0x0
|
org 0x0
|
||||||
|
|
||||||
db 'MENUET01' ; 8 byte id
|
db 'MENUET01' ; 8 byte id
|
||||||
dd 0x01 ; required os
|
dd 0x01 ; required os
|
||||||
dd START ; program start
|
dd START ; program start
|
||||||
dd I_END ; program image size
|
dd I_END ; program image size
|
||||||
dd 0x400000 ; required amount of memory
|
dd 0x400000 ; required amount of memory
|
||||||
dd 0x20000
|
dd 0x20000
|
||||||
dd 0,0 ; reserved=no extended header
|
dd 0,0 ; reserved=no extended header
|
||||||
|
|
||||||
include 'lang.inc'
|
include "MACROS.INC"
|
||||||
include "macros.inc"
|
|
||||||
|
|
||||||
; 0x0+ - program image
|
; 0x0+ - program image
|
||||||
; 0x1ffff - stack
|
; 0x1ffff - stack
|
||||||
@ -35,18 +37,25 @@ include "macros.inc"
|
|||||||
; 0x100000+ - requested file
|
; 0x100000+ - requested file
|
||||||
|
|
||||||
filel:
|
filel:
|
||||||
dd 0x0,0x0,50000/512,0x20000,0x70000
|
dd 0
|
||||||
db '/rd/1/board.htm',0
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 50000
|
||||||
|
dd 0x20000
|
||||||
|
db '/rd/1/board.htm',0
|
||||||
|
|
||||||
files:
|
files:
|
||||||
dd 0x1,0x0,0x0,0x20000,0x70000
|
dd 2
|
||||||
db '/rd/1/board.htm',0
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0x20000
|
||||||
|
db '/rd/1/board.htm',0
|
||||||
|
|
||||||
|
|
||||||
|
START: ; start of execution
|
||||||
|
|
||||||
START: ; start of execution
|
mov eax,70
|
||||||
|
|
||||||
mov eax,58
|
|
||||||
mov ebx,filel
|
mov ebx,filel
|
||||||
int 0x40
|
int 0x40
|
||||||
mov [board_size],ebx
|
mov [board_size],ebx
|
||||||
@ -62,18 +71,17 @@ START: ; start of execution
|
|||||||
|
|
||||||
board_found:
|
board_found:
|
||||||
|
|
||||||
mov eax,58
|
mov eax,70
|
||||||
mov ebx,files
|
mov ebx,files
|
||||||
mov ecx,[board_size]
|
mov ecx,[board_size]
|
||||||
mov [files+8],ecx
|
mov [files+12],ecx
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
mov [status],-1
|
mov [status],-1
|
||||||
mov [last_status],-2
|
mov [last_status],-2
|
||||||
call clear_input
|
call clear_input
|
||||||
call draw_window ; at first, draw the window
|
red:
|
||||||
|
call draw_window ; at first, draw the window
|
||||||
; call ops
|
|
||||||
|
|
||||||
still:
|
still:
|
||||||
|
|
||||||
@ -98,44 +106,30 @@ still:
|
|||||||
|
|
||||||
jmp still
|
jmp still
|
||||||
|
|
||||||
|
|
||||||
reb: ; boot
|
|
||||||
|
|
||||||
mov eax,18
|
|
||||||
mov ebx,1
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
jmp $
|
|
||||||
|
|
||||||
|
|
||||||
last_status dd 0x0
|
last_status dd 0x0
|
||||||
|
|
||||||
check_events:
|
check_events:
|
||||||
|
|
||||||
cmp eax,1 ; redraw request ?
|
cmp eax,1 ; redraw request ?
|
||||||
jz red
|
jz red
|
||||||
cmp eax,2 ; key in buffer ?
|
cmp eax,2 ; key in buffer ?
|
||||||
jz key
|
jz key
|
||||||
cmp eax,3 ; button in buffer ?
|
cmp eax,3 ; button in buffer ?
|
||||||
jz button
|
jz button
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
red: ; redraw
|
key: ; Keys are not valid at this part of the
|
||||||
call draw_window
|
mov al,2 ; loop. Just read it and ignore
|
||||||
ret
|
|
||||||
|
|
||||||
key: ; Keys are not valid at this part of the
|
|
||||||
mov eax,2 ; loop. Just read it and ignore
|
|
||||||
int 0x40
|
int 0x40
|
||||||
ret
|
ret
|
||||||
|
|
||||||
button: ; button
|
button: ; button
|
||||||
|
|
||||||
mov eax,17 ; get id
|
mov al,17 ; get id
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
cmp ah,1 ; close
|
cmp ah,1 ; close
|
||||||
jnz tst2
|
jnz tst2
|
||||||
mov eax,53
|
mov eax,53
|
||||||
mov ebx,8
|
mov ebx,8
|
||||||
@ -145,16 +139,16 @@ button: ; button
|
|||||||
int 0x40
|
int 0x40
|
||||||
tst2:
|
tst2:
|
||||||
|
|
||||||
cmp ah,2 ; button id=2 ?
|
cmp ah,2 ; button id=2 ?
|
||||||
jnz tst3
|
jnz tst3
|
||||||
; open socket
|
; open socket
|
||||||
ops:
|
ops:
|
||||||
mov eax,53
|
mov eax,53
|
||||||
mov ebx,5
|
mov ebx,5
|
||||||
mov ecx,80 ; local port # - http
|
mov ecx,80 ; local port # - http
|
||||||
mov edx,0 ; no remote port specified
|
mov edx,0 ; no remote port specified
|
||||||
mov esi,0 ; no remote ip specified
|
mov esi,0 ; no remote ip specified
|
||||||
mov edi,0 ; PASSIVE open
|
mov edi,0 ; PASSIVE open
|
||||||
int 0x40
|
int 0x40
|
||||||
mov [socket], eax
|
mov [socket], eax
|
||||||
mov [posy],1
|
mov [posy],1
|
||||||
@ -164,12 +158,9 @@ button: ; button
|
|||||||
call draw_data
|
call draw_data
|
||||||
mov [server_active],1
|
mov [server_active],1
|
||||||
call check_status
|
call check_status
|
||||||
; cmp [status],0
|
|
||||||
; je reb
|
|
||||||
ret
|
ret
|
||||||
tst3:
|
tst3:
|
||||||
|
cmp ah,4 ; button id=4 ?
|
||||||
cmp ah,4 ; button id=4 ?
|
|
||||||
jnz no4
|
jnz no4
|
||||||
mov [server_active],0
|
mov [server_active],0
|
||||||
close_socket:
|
close_socket:
|
||||||
@ -190,9 +181,9 @@ button: ; button
|
|||||||
mov eax,53
|
mov eax,53
|
||||||
mov ebx,5
|
mov ebx,5
|
||||||
mov ecx,80 ; local port # - http
|
mov ecx,80 ; local port # - http
|
||||||
mov edx,0 ; no remote port specified
|
mov edx,0 ; no remote port specified
|
||||||
mov esi,0 ; no remote ip specified
|
mov esi,0 ; no remote ip specified
|
||||||
mov edi,0 ; PASSIVE open
|
mov edi,0 ; PASSIVE open
|
||||||
int 0x40
|
int 0x40
|
||||||
mov [socket], eax
|
mov [socket], eax
|
||||||
no_re_open:
|
no_re_open:
|
||||||
@ -220,8 +211,8 @@ button: ; button
|
|||||||
jmp still
|
jmp still
|
||||||
no4:
|
no4:
|
||||||
|
|
||||||
cmp ah,6 ; read directory
|
cmp ah,6 ; read directory
|
||||||
je read_string
|
je read_string
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -249,9 +240,9 @@ start_transmission:
|
|||||||
wait_for_data:
|
wait_for_data:
|
||||||
call check_for_incoming_data
|
call check_for_incoming_data
|
||||||
cmp [input_text+256+1],dword 'GET '
|
cmp [input_text+256+1],dword 'GET '
|
||||||
je data_received
|
je data_received
|
||||||
cmp [input_text+256+1],dword 'POST'
|
cmp [input_text+256+1],dword 'POST'
|
||||||
je data_received
|
je data_received
|
||||||
mov eax,5
|
mov eax,5
|
||||||
mov ebx,1
|
mov ebx,1
|
||||||
int 0x40
|
int 0x40
|
||||||
@ -300,7 +291,7 @@ start_transmission:
|
|||||||
add [filepos],edx
|
add [filepos],edx
|
||||||
|
|
||||||
cmp [file_left],0
|
cmp [file_left],0
|
||||||
jg newblock
|
jg newblock
|
||||||
|
|
||||||
no_http_request:
|
no_http_request:
|
||||||
|
|
||||||
@ -319,14 +310,6 @@ wait_for_empty_slot:
|
|||||||
|
|
||||||
wait_more:
|
wait_more:
|
||||||
|
|
||||||
; rdtsc
|
|
||||||
; mov ecx,eax
|
|
||||||
; add ecx,1000000
|
|
||||||
; wr:
|
|
||||||
; rdtsc
|
|
||||||
; cmp eax,ecx
|
|
||||||
; jb wr
|
|
||||||
|
|
||||||
mov eax,5
|
mov eax,5
|
||||||
mov ebx,1
|
mov ebx,1
|
||||||
int 0x40
|
int 0x40
|
||||||
@ -380,14 +363,14 @@ send_header:
|
|||||||
|
|
||||||
pusha
|
pusha
|
||||||
|
|
||||||
mov eax,53 ; send response and file length
|
mov eax,53 ; send response and file length
|
||||||
mov ebx,7
|
mov ebx,7
|
||||||
mov ecx,[socket]
|
mov ecx,[socket]
|
||||||
mov edx,h_len-html_header
|
mov edx,h_len-html_header
|
||||||
mov esi,html_header
|
mov esi,html_header
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
mov eax,53 ; send file type
|
mov eax,53 ; send file type
|
||||||
mov ebx,7
|
mov ebx,7
|
||||||
mov ecx,[socket]
|
mov ecx,[socket]
|
||||||
mov edx,[type_len]
|
mov edx,[type_len]
|
||||||
@ -397,10 +380,13 @@ send_header:
|
|||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
fileinfo dd 0
|
||||||
fileinfo dd 0,0,1,0x100000,0xf0000
|
dd 0
|
||||||
getf db '/RD/1/'
|
dd 0
|
||||||
times 50 db 0
|
dd 512
|
||||||
|
dd 0x100000
|
||||||
|
getf db '/rd/1/'
|
||||||
|
times 50 db 0
|
||||||
wanted_file: times 100 db 0
|
wanted_file: times 100 db 0
|
||||||
|
|
||||||
getflen dd 6
|
getflen dd 6
|
||||||
@ -409,47 +395,47 @@ make_room:
|
|||||||
|
|
||||||
pusha
|
pusha
|
||||||
|
|
||||||
mov edx,ecx
|
mov edx,ecx
|
||||||
|
|
||||||
mov esi,0x20000
|
mov esi,0x20000
|
||||||
add esi,[board_size]
|
add esi,[board_size]
|
||||||
mov edi,esi
|
mov edi,esi
|
||||||
add edi,edx
|
add edi,edx
|
||||||
mov ecx,[board_size]
|
mov ecx,[board_size]
|
||||||
sub ecx,board1-board
|
sub ecx,board1-board
|
||||||
inc ecx
|
inc ecx
|
||||||
std
|
std
|
||||||
rep movsb
|
rep movsb
|
||||||
cld
|
cld
|
||||||
|
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
from_i dd 0x0
|
from_i dd 0x0
|
||||||
from_len dd 0x0
|
from_len dd 0x0
|
||||||
|
|
||||||
message dd 0x0
|
message dd 0x0
|
||||||
message_len dd 0x0
|
message_len dd 0x0
|
||||||
|
|
||||||
read_file: ; start of execution
|
read_file: ; start of execution
|
||||||
|
|
||||||
mov [fileinfo+12],eax
|
|
||||||
mov [fileinfo+8],ebx
|
|
||||||
|
|
||||||
|
mov [fileinfo+16],eax
|
||||||
|
shl ebx, 9
|
||||||
|
mov [fileinfo+12],ebx
|
||||||
mov [file_type],unk
|
mov [file_type],unk
|
||||||
mov [type_len],unkl-unk
|
mov [type_len],unkl-unk
|
||||||
mov [filename+40*2+6],dword 'UNK '
|
mov [filename+40*2+6],dword 'UNK '
|
||||||
|
|
||||||
cmp [input_text+256+1],dword 'POST'
|
cmp [input_text+256+1],dword 'POST'
|
||||||
je yes_new_message
|
je yes_new_message
|
||||||
|
|
||||||
cmp [input_text+256+11],dword 'oard' ; server board message
|
cmp [input_text+256+11],dword 'oard' ; server board message
|
||||||
jne no_server_message_2
|
jne no_server_message_2
|
||||||
|
|
||||||
yes_new_message:
|
yes_new_message:
|
||||||
|
|
||||||
mov eax,58
|
mov eax,70
|
||||||
mov ebx,filel
|
mov ebx,filel
|
||||||
int 0x40
|
int 0x40
|
||||||
mov [board_size],ebx
|
mov [board_size],ebx
|
||||||
@ -468,7 +454,7 @@ read_file: ; start of execution
|
|||||||
newfroms:
|
newfroms:
|
||||||
inc esi
|
inc esi
|
||||||
cmp esi,input_text+256*20
|
cmp esi,input_text+256*20
|
||||||
je no_server_message_2
|
je no_server_message_2
|
||||||
cmp [esi],dword 'from'
|
cmp [esi],dword 'from'
|
||||||
jne newfroms
|
jne newfroms
|
||||||
|
|
||||||
@ -478,13 +464,14 @@ read_file: ; start of execution
|
|||||||
mov edx,0
|
mov edx,0
|
||||||
name_new_len:
|
name_new_len:
|
||||||
cmp [esi+edx],byte 13
|
cmp [esi+edx],byte 13
|
||||||
je name_found_len
|
je name_found_len
|
||||||
cmp [esi+edx],byte '&'
|
cmp [esi+edx],byte '&'
|
||||||
je name_found_len
|
je name_found_len
|
||||||
cmp edx,1000
|
cmp edx,1000
|
||||||
je name_found_len
|
je name_found_len
|
||||||
inc edx
|
inc edx
|
||||||
jmp name_new_len
|
jmp name_new_len
|
||||||
|
|
||||||
name_found_len:
|
name_found_len:
|
||||||
|
|
||||||
mov [from_len],edx
|
mov [from_len],edx
|
||||||
@ -493,7 +480,7 @@ read_file: ; start of execution
|
|||||||
newmessages:
|
newmessages:
|
||||||
inc esi
|
inc esi
|
||||||
cmp esi,input_text+256*20
|
cmp esi,input_text+256*20
|
||||||
je no_server_message_2
|
je no_server_message_2
|
||||||
cmp [esi],dword 'sage'
|
cmp [esi],dword 'sage'
|
||||||
jne newmessages
|
jne newmessages
|
||||||
|
|
||||||
@ -504,11 +491,11 @@ read_file: ; start of execution
|
|||||||
new_len:
|
new_len:
|
||||||
inc edx
|
inc edx
|
||||||
cmp [esi+edx],byte ' '
|
cmp [esi+edx],byte ' '
|
||||||
je found_len
|
je found_len
|
||||||
cmp [esi+edx],byte 13
|
cmp [esi+edx],byte 13
|
||||||
jbe found_len
|
jbe found_len
|
||||||
cmp edx,input_text+5000
|
cmp edx,input_text+5000
|
||||||
je found_len
|
je found_len
|
||||||
jmp new_len
|
jmp new_len
|
||||||
found_len:
|
found_len:
|
||||||
mov [message_len],edx
|
mov [message_len],edx
|
||||||
@ -546,7 +533,7 @@ read_file: ; start of execution
|
|||||||
imul ebx,16
|
imul ebx,16
|
||||||
add ebx,eax
|
add ebx,eax
|
||||||
mov [esi+edx],bl
|
mov [esi+edx],bl
|
||||||
mov [esi+edx+1],word ' '
|
mov [esi+edx+1],word ''
|
||||||
add edx,2
|
add edx,2
|
||||||
no_ascii:
|
no_ascii:
|
||||||
|
|
||||||
@ -565,21 +552,22 @@ read_file: ; start of execution
|
|||||||
call make_room
|
call make_room
|
||||||
|
|
||||||
|
|
||||||
mov esi,board1 ; first part
|
mov esi,board1 ; first part
|
||||||
mov edi,0x20000
|
mov edi,0x20000
|
||||||
add edi,board1-board
|
add edi,board1-board
|
||||||
mov ecx,edx
|
mov ecx,edx
|
||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
|
|
||||||
mov esi,[from_i] ; name
|
mov esi,[from_i] ; name
|
||||||
mov edi,0x20000
|
mov edi,0x20000
|
||||||
add edi,board1-board + board1e-board1
|
add edi,board1-board
|
||||||
|
add edi,board1e-board1
|
||||||
mov ecx,[from_len]
|
mov ecx,[from_len]
|
||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
|
|
||||||
mov esi,board2 ; middle part
|
mov esi,board2 ; middle part
|
||||||
mov edi,0x20000
|
mov edi,0x20000
|
||||||
add edi,board1-board + board1e-board1
|
add edi,board1-board + board1e-board1
|
||||||
add edi,[from_len]
|
add edi,[from_len]
|
||||||
@ -587,9 +575,9 @@ read_file: ; start of execution
|
|||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
|
|
||||||
mov esi,[message] ; message
|
mov esi,[message] ; message
|
||||||
mov edi,0x20000
|
mov edi,0x20000
|
||||||
add edi,board1-board + board1e-board1 +board2e-board2
|
add edi,board1-board + board1e-board1 + board2e-board2
|
||||||
add edi,[from_len]
|
add edi,[from_len]
|
||||||
mov ecx,[message_len]
|
mov ecx,[message_len]
|
||||||
cld
|
cld
|
||||||
@ -597,7 +585,7 @@ read_file: ; start of execution
|
|||||||
|
|
||||||
mov esi,board3 ; end part
|
mov esi,board3 ; end part
|
||||||
mov edi,0x20000
|
mov edi,0x20000
|
||||||
add edi,board1-board + board1e-board1 +board2e-board2
|
add edi,board1-board + board1e-board1 + board2e-board2
|
||||||
add edi,[from_len]
|
add edi,[from_len]
|
||||||
add edi,[message_len]
|
add edi,[message_len]
|
||||||
mov ecx,board3e-board3
|
mov ecx,board3e-board3
|
||||||
@ -607,9 +595,9 @@ read_file: ; start of execution
|
|||||||
inc [board_messages]
|
inc [board_messages]
|
||||||
|
|
||||||
mov eax,[board_size]
|
mov eax,[board_size]
|
||||||
mov [files+8],eax
|
mov [files+12],eax
|
||||||
|
|
||||||
mov eax,58
|
mov eax,70
|
||||||
mov ebx,files
|
mov ebx,files
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
@ -671,7 +659,7 @@ read_file: ; start of execution
|
|||||||
cld
|
cld
|
||||||
new_let:
|
new_let:
|
||||||
cmp [esi],byte ' '
|
cmp [esi],byte ' '
|
||||||
je no_new_let
|
je no_new_let
|
||||||
cmp edi,wanted_file+30
|
cmp edi,wanted_file+30
|
||||||
jge no_new_let
|
jge no_new_let
|
||||||
movsb
|
movsb
|
||||||
@ -684,10 +672,10 @@ read_file: ; start of execution
|
|||||||
cmp esi,input_text+256+6
|
cmp esi,input_text+256+6
|
||||||
jne no_index
|
jne no_index
|
||||||
mov edi,wanted_file
|
mov edi,wanted_file
|
||||||
mov [edi+0],dword 'inde'
|
mov [edi+0],dword 'inde'
|
||||||
mov [edi+4],dword 'x.ht'
|
mov [edi+4],dword 'x.ht'
|
||||||
mov [edi+8],byte 'm'
|
mov [edi+8],byte 'm'
|
||||||
mov [edi+9],byte 0
|
mov [edi+9],byte 0
|
||||||
add edi,9
|
add edi,9
|
||||||
|
|
||||||
mov [file_type],htm
|
mov [file_type],htm
|
||||||
@ -698,9 +686,9 @@ read_file: ; start of execution
|
|||||||
no_index:
|
no_index:
|
||||||
|
|
||||||
cmp [edi-3],dword 'htm'+0
|
cmp [edi-3],dword 'htm'+0
|
||||||
je htm_header
|
je htm_header
|
||||||
cmp [edi-3],dword 'HTM'+0
|
cmp [edi-3],dword 'HTM'+0
|
||||||
je htm_header
|
je htm_header
|
||||||
jmp no_htm_header
|
jmp no_htm_header
|
||||||
htm_header:
|
htm_header:
|
||||||
mov [file_type],htm
|
mov [file_type],htm
|
||||||
@ -710,9 +698,9 @@ read_file: ; start of execution
|
|||||||
no_htm_header:
|
no_htm_header:
|
||||||
|
|
||||||
cmp [edi-3],dword 'png'+0
|
cmp [edi-3],dword 'png'+0
|
||||||
je png_header
|
je png_header
|
||||||
cmp [edi-3],dword 'PNG'+0
|
cmp [edi-3],dword 'PNG'+0
|
||||||
je png_header
|
je png_header
|
||||||
jmp no_png_header
|
jmp no_png_header
|
||||||
png_header:
|
png_header:
|
||||||
mov [file_type],png
|
mov [file_type],png
|
||||||
@ -722,9 +710,9 @@ read_file: ; start of execution
|
|||||||
no_png_header:
|
no_png_header:
|
||||||
|
|
||||||
cmp [edi-3],dword 'gif'+0
|
cmp [edi-3],dword 'gif'+0
|
||||||
je gif_header
|
je gif_header
|
||||||
cmp [edi-3],dword 'GIF'+0
|
cmp [edi-3],dword 'GIF'+0
|
||||||
je gif_header
|
je gif_header
|
||||||
jmp no_gif_header
|
jmp no_gif_header
|
||||||
gif_header:
|
gif_header:
|
||||||
mov [file_type],gif
|
mov [file_type],gif
|
||||||
@ -734,9 +722,9 @@ read_file: ; start of execution
|
|||||||
no_gif_header:
|
no_gif_header:
|
||||||
|
|
||||||
cmp [edi-3],dword 'jpg'+0
|
cmp [edi-3],dword 'jpg'+0
|
||||||
je jpg_header
|
je jpg_header
|
||||||
cmp [edi-3],dword 'JPG'+0
|
cmp [edi-3],dword 'JPG'+0
|
||||||
je jpg_header
|
je jpg_header
|
||||||
jmp no_jpg_header
|
jmp no_jpg_header
|
||||||
jpg_header:
|
jpg_header:
|
||||||
mov [file_type],jpg
|
mov [file_type],jpg
|
||||||
@ -746,13 +734,13 @@ read_file: ; start of execution
|
|||||||
no_jpg_header:
|
no_jpg_header:
|
||||||
|
|
||||||
cmp [edi-3],dword 'asm'+0
|
cmp [edi-3],dword 'asm'+0
|
||||||
je txt_header
|
je txt_header
|
||||||
cmp [edi-3],dword 'ASM'+0
|
cmp [edi-3],dword 'ASM'+0
|
||||||
je txt_header
|
je txt_header
|
||||||
cmp [edi-3],dword 'txt'+0
|
cmp [edi-3],dword 'txt'+0
|
||||||
je txt_header
|
je txt_header
|
||||||
cmp [edi-3],dword 'TXT'+0
|
cmp [edi-3],dword 'TXT'+0
|
||||||
je txt_header
|
je txt_header
|
||||||
jmp no_txt_header
|
jmp no_txt_header
|
||||||
txt_header:
|
txt_header:
|
||||||
mov [file_type],txt
|
mov [file_type],txt
|
||||||
@ -778,13 +766,13 @@ read_file: ; start of execution
|
|||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
|
|
||||||
mov [fileinfo+8],dword 1 ; file exists ?
|
mov [fileinfo+12],dword 1 ; file exists ?
|
||||||
mov eax,58
|
mov eax,70
|
||||||
mov ebx,fileinfo
|
mov ebx,fileinfo
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
cmp eax,0 ; file not found - message
|
cmp eax,0 ; file not found - message
|
||||||
je file_found
|
je file_found
|
||||||
mov edi,et
|
mov edi,et
|
||||||
call set_time
|
call set_time
|
||||||
mov edi,ed
|
mov edi,ed
|
||||||
@ -804,8 +792,8 @@ read_file: ; start of execution
|
|||||||
|
|
||||||
file_found:
|
file_found:
|
||||||
|
|
||||||
mov [fileinfo+8],dword 0x2f0000 / 512 ; read all of file
|
mov [fileinfo+12],dword 0x2f0000 ; read all of file
|
||||||
mov eax,58
|
mov eax,70
|
||||||
mov ebx,fileinfo
|
mov ebx,fileinfo
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
@ -1000,7 +988,7 @@ check_status:
|
|||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
cmp eax,[status]
|
cmp eax,[status]
|
||||||
je c_ret
|
je c_ret
|
||||||
mov [status],eax
|
mov [status],eax
|
||||||
add al,48
|
add al,48
|
||||||
mov [text+12],al
|
mov [text+12],al
|
||||||
@ -1011,8 +999,8 @@ check_status:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
addr dd 0x0
|
addr dd 0x0
|
||||||
ya dd 0x0
|
ya dd 0x0
|
||||||
|
|
||||||
filename2: times 100 db 32
|
filename2: times 100 db 32
|
||||||
|
|
||||||
@ -1040,11 +1028,11 @@ read_string:
|
|||||||
int 0x40
|
int 0x40
|
||||||
shr eax,8
|
shr eax,8
|
||||||
cmp eax,13
|
cmp eax,13
|
||||||
je read_done
|
je read_done
|
||||||
cmp eax,8
|
cmp eax,8
|
||||||
jnz nobsl
|
jnz nobsl
|
||||||
cmp edi,[addr]
|
cmp edi,[addr]
|
||||||
jz f11
|
jz f11
|
||||||
sub edi,1
|
sub edi,1
|
||||||
mov [edi],byte 32
|
mov [edi],byte 32
|
||||||
call print_text
|
call print_text
|
||||||
@ -1088,30 +1076,19 @@ print_text:
|
|||||||
|
|
||||||
pusha
|
pusha
|
||||||
|
|
||||||
mov eax,13
|
|
||||||
mov ebx,97*65536+23*6
|
|
||||||
mov ecx,[ya]
|
|
||||||
shl ecx,16
|
|
||||||
mov cx,9
|
|
||||||
mov edx,0xffffff
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
mov eax,4
|
mov eax,4
|
||||||
mov edx,[addr]
|
mov edx,[addr]
|
||||||
mov ebx,97*65536
|
mov ebx,97*65536
|
||||||
add ebx,[ya]
|
add ebx,[ya]
|
||||||
mov ecx,0x000000
|
mov ecx,0x40000000
|
||||||
mov esi,23
|
mov esi,23
|
||||||
|
mov edi,0xffffff
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; *********************************************
|
; *********************************************
|
||||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||||
; *********************************************
|
; *********************************************
|
||||||
@ -1119,42 +1096,33 @@ print_text:
|
|||||||
|
|
||||||
draw_window:
|
draw_window:
|
||||||
|
|
||||||
mov eax,12 ; function 12:tell os about windowdraw
|
mov eax,12 ; function 12:tell os about windowdraw
|
||||||
mov ebx,1 ; 1, start of draw
|
mov ebx,1 ; 1, start of draw
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
; DRAW WINDOW
|
; DRAW WINDOW
|
||||||
mov eax,0 ; function 0 : define and draw window
|
mov eax,0 ; function 0 : define and draw window
|
||||||
mov ebx,100*65536+480 ; [x start] *65536 + [x size]
|
mov ebx,100*65536+480 ; [x start] *65536 + [x size]
|
||||||
mov ecx,100*65536+215 ; [y start] *65536 + [y size]
|
mov ecx,100*65536+215 ; [y start] *65536 + [y size]
|
||||||
mov edx,0x03ffffff ; color of work area RRGGBB
|
mov edx,0x13ffffff ; color of work area RRGGBB
|
||||||
mov esi,0x8050a0b0 ; color of grab bar RRGGBB,8->color gl
|
mov edi,header ; WINDOW LABEL
|
||||||
mov edi,0x0050a0b0 ; color of frames RRGGBB
|
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
; WINDOW LABEL
|
mov eax,8 ; function 8 : define and draw button
|
||||||
mov eax,4 ; function 4 : write text to window
|
mov ebx,(40)*65536+20 ; [x start] *65536 + [x size]
|
||||||
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
|
mov ecx,59*65536+9 ; [y start] *65536 + [y size]
|
||||||
mov ecx,0x10ffffff ; color of text RRGGBB
|
mov edx,2 ; button id
|
||||||
mov edx,labelt ; pointer to text beginning
|
mov esi,0x66aa66 ; button color RRGGBB
|
||||||
mov esi,labellen-labelt ; text length
|
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
mov eax,8 ; function 8 : define and draw button
|
; function 8 : define and draw button
|
||||||
mov ebx,(40)*65536+20 ; [x start] *65536 + [x size]
|
mov ebx,(40)*65536+20 ; [x start] *65536 + [x size]
|
||||||
mov ecx,59*65536+9 ; [y start] *65536 + [y size]
|
mov ecx,72*65536+9 ; [y start] *65536 + [y size]
|
||||||
mov edx,2 ; button id
|
mov edx,4 ; button id
|
||||||
mov esi,0x66aa66 ; button color RRGGBB
|
mov esi,0xaa6666 ; button color RRGGBB
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
mov eax,8 ; function 8 : define and draw button
|
; Enter directory
|
||||||
mov ebx,(40)*65536+20 ; [x start] *65536 + [x size]
|
|
||||||
mov ecx,72*65536+9 ; [y start] *65536 + [y size]
|
|
||||||
mov edx,4 ; button id
|
|
||||||
mov esi,0xaa6666 ; button color RRGGBB
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
mov eax,8 ; Enter directory
|
|
||||||
mov ebx,(25)*65536+66
|
mov ebx,(25)*65536+66
|
||||||
mov ecx,135*65536+15
|
mov ecx,135*65536+15
|
||||||
mov edx,6
|
mov edx,6
|
||||||
@ -1167,7 +1135,7 @@ draw_window:
|
|||||||
mov edx,0x6699cc ; 002288
|
mov edx,0x6699cc ; 002288
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
mov eax,38
|
|
||||||
mov ebx,241*65536+241
|
mov ebx,241*65536+241
|
||||||
mov ecx,22*65536+210
|
mov ecx,22*65536+210
|
||||||
mov edx,0x336699 ; 002288
|
mov edx,0x336699 ; 002288
|
||||||
@ -1175,8 +1143,8 @@ draw_window:
|
|||||||
|
|
||||||
call draw_data
|
call draw_data
|
||||||
|
|
||||||
mov eax,12 ; function 12:tell os about windowdraw
|
mov eax,12 ; function 12:tell os about windowdraw
|
||||||
mov ebx,2 ; 2, end of draw
|
mov ebx,2 ; 2, end of draw
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
ret
|
ret
|
||||||
@ -1186,7 +1154,7 @@ draw_data:
|
|||||||
|
|
||||||
pusha
|
pusha
|
||||||
|
|
||||||
mov ebx,25*65536+35 ; draw info text with function 4
|
mov ebx,25*65536+35 ; draw info text with function 4
|
||||||
mov ecx,0x000000
|
mov ecx,0x000000
|
||||||
mov edx,text
|
mov edx,text
|
||||||
mov esi,35
|
mov esi,35
|
||||||
@ -1218,7 +1186,7 @@ draw_data:
|
|||||||
mov [input_text+4],dword 'IVED'
|
mov [input_text+4],dword 'IVED'
|
||||||
mov [input_text+8],dword ': '
|
mov [input_text+8],dword ': '
|
||||||
|
|
||||||
mov ebx,255*65536+35 ; draw info text with function 4
|
mov ebx,255*65536+35 ; draw info text with function 4
|
||||||
mov ecx,0x000000
|
mov ecx,0x000000
|
||||||
mov edx,input_text
|
mov edx,input_text
|
||||||
mov esi,35
|
mov esi,35
|
||||||
@ -1247,7 +1215,7 @@ draw_data:
|
|||||||
|
|
||||||
; DATA AREA
|
; DATA AREA
|
||||||
|
|
||||||
status dd 0x0
|
status dd 0x0
|
||||||
|
|
||||||
text:
|
text:
|
||||||
db 'TCB status: x '
|
db 'TCB status: x '
|
||||||
@ -1259,7 +1227,7 @@ text:
|
|||||||
db ' /TinyBoard -message board '
|
db ' /TinyBoard -message board '
|
||||||
db ' '
|
db ' '
|
||||||
dirp:
|
dirp:
|
||||||
db ' Files: /RD/1/ '
|
db ' Files: /rd/1/ '
|
||||||
db ' '
|
db ' '
|
||||||
filename:
|
filename:
|
||||||
db ' '
|
db ' '
|
||||||
@ -1271,7 +1239,7 @@ filename:
|
|||||||
html_header:
|
html_header:
|
||||||
|
|
||||||
db 'HTTP/1.0 200 OK',13,10
|
db 'HTTP/1.0 200 OK',13,10
|
||||||
db 'Server: MenuetOS HTTP Server',13,10
|
db 'Server: KolibriOS HTTP Server',13,10
|
||||||
db 'Content-Length: '
|
db 'Content-Length: '
|
||||||
c_l: db '000000',13,10
|
c_l: db '000000',13,10
|
||||||
|
|
||||||
@ -1280,9 +1248,9 @@ h_len:
|
|||||||
fnf:
|
fnf:
|
||||||
db '<body>'
|
db '<body>'
|
||||||
db '<pre>'
|
db '<pre>'
|
||||||
db "TinyServer v ",version," for MenuetOS",13,10,13,10
|
db "HTTP-Ñåðâåð v ",version," äëÿ KolibriOS",13,10,13,10
|
||||||
db "Error 404 - File not found.",13,10,13,10
|
db "<H1>Error <FONT color=red>404</FONT> - File not found</H1>",13,10,13,10
|
||||||
db "For more info about server: request /TinyStat",13,10,13,10
|
db "Äëÿ ïîëó÷åíèÿ ñòàòèñòèêè âûïîëíèòå çàïðîñ /TinyStat",13,10,13,10
|
||||||
et: db "xx:xx:xx",13,10
|
et: db "xx:xx:xx",13,10
|
||||||
ed: db "xx.xx.xx",13,10
|
ed: db "xx.xx.xx",13,10
|
||||||
db "</pre></body>"
|
db "</pre></body>"
|
||||||
@ -1292,15 +1260,15 @@ fnfe:
|
|||||||
sm:
|
sm:
|
||||||
db '<body>'
|
db '<body>'
|
||||||
db '<pre>'
|
db '<pre>'
|
||||||
db "TinyServer v ",version," for MenuetOS",13,10,13,10
|
db "HTTP-Ñåðâåð v ",version," äëÿ KolibriOS",13,10,13,10
|
||||||
db "Statistics: (before current request)",13,10,13,10
|
db "Ñòàòèñòèêà: (ïîñëå äàííîãî çàïðîñà)",13,10,13,10
|
||||||
sms: db "- Documents served : xxxxxxxxx",13,10
|
sms: db "- Äîêóìåíòîâ ïðèíÿòî: xxxxxxxxx",13,10
|
||||||
smb: db "- Bytes transferred : xxxxxxxxx",13,10
|
smb: db "- Áàéò ïåðåäàííî : xxxxxxxxx",13,10
|
||||||
db "- Location : <a href=/TinyStat>/TinyStat</a>",13,10,13,10
|
db "- Ìåñòîíàõîæäåíèå : <a href=/TinyStat>Ñòàòèñòèêà</a>",13,10,13,10
|
||||||
db "TinyBoard:",13,10,13,10
|
db "Ãîñòåâàÿ:",13,10,13,10
|
||||||
smm: db "- Messages : xxxxxxxxx",13,10
|
smm: db "- Ñîîáùåíèé : xxxxxxxxx",13,10
|
||||||
smz: db "- Size in bytes : xxxxxxxxx",13,10
|
smz: db "- Ðàçìåð â áàéòàõ : xxxxxxxxx",13,10
|
||||||
db "- Location : <a href=/TinyBoard>/TinyBoard</a>",13,10,13,10
|
db "- Ìåñòîíàõîæäåíèå : <a href=/TinyBoard>Ãîñòåâàÿ</a>",13,10,13,10
|
||||||
smt: db "xx:xx:xx",13,10
|
smt: db "xx:xx:xx",13,10
|
||||||
smd: db "xx.xx.xx",13,10
|
smd: db "xx.xx.xx",13,10
|
||||||
db '</pre></body>'
|
db '</pre></body>'
|
||||||
@ -1326,42 +1294,42 @@ unk: db 'Content-Type: unknown/unknown',13,10,13,10
|
|||||||
unkl:
|
unkl:
|
||||||
|
|
||||||
|
|
||||||
labelt: db 'Tiny http server ',version
|
header db appname,version,0
|
||||||
labellen:
|
|
||||||
|
|
||||||
socket dd 0x0
|
socket dd 0x0
|
||||||
server_active db 0x0
|
server_active db 0x0
|
||||||
|
|
||||||
board:
|
board:
|
||||||
|
|
||||||
db "<HTML><BODY BGCOLOR=#ffffff ALINK=black VLINK=black><br>",13,10
|
db "<HTML><HEAD><TITLE>INTKolibriOS - /Ãîñòåâàÿ/</TITLE></HEAD>",13,10
|
||||||
|
db "<BODY background=bgnd.gif BGCOLOR=#ffffff ALINK=black VLINK=black><br>",13,10
|
||||||
db "<center>",13,10
|
db "<center>",13,10
|
||||||
db "<TABLE CELLPADDING=10 CELLSPACING=0 BORDER=0 bgcolor=#ffffff width=600>"
|
db "<TABLE CELLPADDING=10 CELLSPACING=0 BORDER=0 bgcolor=#ffffff width=600>"
|
||||||
db 13,10
|
db 13,10
|
||||||
db "<TR VALIGN=top><TD ALIGN=center bgcolor=f0f0f8>",13,10
|
db "<TR VALIGN=top><TD ALIGN=center bgcolor=F4F4F4>",13,10
|
||||||
db "<font size=3>Tinyserver Messageboard</TD></TR></TABLE><br>",13,10
|
db "<font size=4>Ãîñòåâàÿ ñåðâåðà INTKolibriOS</TD></TR></TABLE><br>",13,10
|
||||||
db "<TABLE CELLPADDING=14 CELLSPACING=2 BORDER=0 bgcolor=#ffffff width=600>"
|
db "<TABLE CELLPADDING=14 CELLSPACING=2 BORDER=0 bgcolor=#ffffff width=600>"
|
||||||
db 13,10,13,10
|
db 13,10,13,10
|
||||||
|
|
||||||
board1:
|
board1:
|
||||||
|
|
||||||
db "<TR VALIGN=top>",13,10
|
db "<TR VALIGN=top>",13,10
|
||||||
db "<TD ALIGN=left width=80 bgcolor=f0f0f8><P>",13,10
|
db "<TD ALIGN=left width=80 bgcolor=F4F4F4><P>",13,10
|
||||||
db "<font size=3>",13,10
|
db "<font size=3>",13,10
|
||||||
board1e:
|
board1e:
|
||||||
db "WebMaster",13,10
|
db "Hex",13,10
|
||||||
board2:
|
board2:
|
||||||
db "</font>",13,10
|
db "</font>",13,10
|
||||||
db "<br><br><br>",13,10
|
db "<br><br><br>",13,10
|
||||||
db "<br><br><br><br>",13,10
|
db "<br><br><br><br>",13,10
|
||||||
bsmt:
|
bsmt:
|
||||||
db "12.23.45<br>",13,10
|
db "15.23.45<br>",13,10
|
||||||
bsmd:
|
bsmd:
|
||||||
db "02.05.03",13,10
|
db "22.03.06",13,10
|
||||||
db "</P></TD>",13,10
|
db "</P></TD>",13,10
|
||||||
db "<TD bgcolor=f0f0f8><P>",13,10
|
db "<TD bgcolor=F4F4F4><P>",13,10
|
||||||
board2e:
|
board2e:
|
||||||
db "Assembly written messageboard from assembly written MenuetOS.<br>"
|
db "Äîáðî ïîæàëîâàòü â ãîñòåâóþ ñåðâåðà INTKolibriOS! (-:<br>"
|
||||||
db 13,10
|
db 13,10
|
||||||
board3:
|
board3:
|
||||||
db "</P></TD></TR>",13,10,13,10
|
db "</P></TD></TR>",13,10,13,10
|
||||||
@ -1374,11 +1342,11 @@ db "<br>",13,10
|
|||||||
db "<TABLE CELLPADDING=14 CELLSPACING=3 BORDER=0 bgcolor=#ffffff width=600>"
|
db "<TABLE CELLPADDING=14 CELLSPACING=3 BORDER=0 bgcolor=#ffffff width=600>"
|
||||||
db 13,10
|
db 13,10
|
||||||
db "<TR VALIGN=top>",13,10
|
db "<TR VALIGN=top>",13,10
|
||||||
db "<TD ALIGN=left bgcolor=f0f0f8><P>",13,10
|
db "<TD ALIGN=left bgcolor=F4F4F4><P>",13,10
|
||||||
db "<form method=Post Action=/TinyBoard>",13,10
|
db "<form method=Post Action=/TinyBoard>",13,10
|
||||||
db "Name: <br><input type=text name=from size=20 MAXLENGTH=20><br>",13,10
|
db "Èìÿ: <br><input type=text name=from size=20 MAXLENGTH=20><br>",13,10
|
||||||
db "Message: <br><textarea cols=60 rows=6 name=message></textarea><br>",13,10
|
db "Ñîîáùåíèå: <br><textarea cols=60 rows=6 name=message></textarea><br>",13,10
|
||||||
db "<input type=Submit Value=' Send Message '></form>",13,10
|
db "<input type=Submit Value=' Îòïðàâèòü ñîîáùåíèå '></form>",13,10
|
||||||
db "</TD></TR>",13,10
|
db "</TD></TR>",13,10
|
||||||
db "</TABLE>",13,10
|
db "</TABLE>",13,10
|
||||||
db "</BODY>",13,10
|
db "</BODY>",13,10
|
||||||
@ -1386,9 +1354,9 @@ db "</HTML>",13,10
|
|||||||
|
|
||||||
board_end:
|
board_end:
|
||||||
|
|
||||||
board_size dd 0x0
|
board_size dd 0x0
|
||||||
board_messages dd 0x0
|
board_messages dd 0x0
|
||||||
|
|
||||||
input_text:
|
input_text:
|
||||||
|
|
||||||
I_END:
|
I_END:
|
@ -1,4 +1,5 @@
|
|||||||
@erase lang.inc
|
@erase lang.inc
|
||||||
@echo lang fix en >lang.inc
|
@echo lang fix en >lang.inc
|
||||||
@fasm calc.asm calc
|
@fasm calc.asm calc
|
||||||
|
@erase lang.inc
|
||||||
@pause
|
@pause
|
@ -1,4 +1,5 @@
|
|||||||
@erase lang.inc
|
@erase lang.inc
|
||||||
@echo lang fix ru >lang.inc
|
@echo lang fix ru >lang.inc
|
||||||
@fasm calc.asm calc
|
@fasm calc.asm calc
|
||||||
|
@erase lang.inc
|
||||||
@pause
|
@pause
|
@ -1,28 +1,32 @@
|
|||||||
;; Calculator for MenuetOS
|
;; Calculator for MenuetOS (original version)
|
||||||
;; (c)Ville Turjanmaa
|
;; (c)Ville Turjanmaa
|
||||||
;; Compile with FASM for Menuet
|
;; Compile with FASM for Menuet
|
||||||
;;
|
;;
|
||||||
;; Š «ìªã«ïâ®à 1.1 alpha
|
;;What's new:
|
||||||
;; (c)Pavel Rymovski aka Heavyiron
|
;; Calc 1.1
|
||||||
;;What's new:1)changed design
|
;; 1)changed design
|
||||||
;; 2)new procedure of draw window (10 decimal digits, 23 binary, "+" not displayed now)
|
;; 2)new procedure of draw window (10 decimal digits, 23 binary, "+" not displayed now)
|
||||||
;; 3)window with skin
|
;; 3)window with skin
|
||||||
;; 4)I had used macroses
|
;; 4)I had used macroses
|
||||||
;; Calc 1.2 alpha
|
;; Calc 1.2
|
||||||
;; 1)added some useful functions, such as arcsin, arccos, arctg, 1/x, x^2
|
;; 1)added some useful functions, such as arcsin, arccos, arctg, 1/x, x^2
|
||||||
;; Calc 1.3
|
;; Calc 1.31
|
||||||
;; 1)optimised program
|
;; 1)optimised program
|
||||||
|
;; 2)new type of window (you need kernel 114 revision or higher)
|
||||||
|
;; Pavel Rymovski (Heavyiron)
|
||||||
|
|
||||||
|
appname equ 'Calc '
|
||||||
|
version equ '1.31'
|
||||||
|
|
||||||
use32
|
use32
|
||||||
org 0x0
|
org 0x0
|
||||||
|
|
||||||
db 'MENUET01' ; 8 byte id
|
db 'MENUET01' ; 8 byte id
|
||||||
dd 0x01 ; header version
|
dd 0x01 ; header version
|
||||||
dd START ; start of code
|
dd START ; start of code
|
||||||
dd I_END ; size of image
|
dd I_END ; size of image
|
||||||
dd 0x1000 ; memory for app
|
dd 0x1000 ; memory for app
|
||||||
dd 0x1000 ; esp
|
dd 0x1000 ; esp
|
||||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
dd 0x0,0x0 ; I_Param , I_Icon
|
||||||
|
|
||||||
include 'macros.inc'
|
include 'macros.inc'
|
||||||
|
|
||||||
@ -31,7 +35,7 @@ START:
|
|||||||
red:
|
red:
|
||||||
call draw_window
|
call draw_window
|
||||||
|
|
||||||
still:
|
still:
|
||||||
push 10
|
push 10
|
||||||
pop eax
|
pop eax
|
||||||
int 40h
|
int 40h
|
||||||
@ -39,16 +43,18 @@ still:
|
|||||||
jz red
|
jz red
|
||||||
dec eax
|
dec eax
|
||||||
jz key
|
jz key
|
||||||
|
|
||||||
button:
|
button:
|
||||||
mcall 17 ; ¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª®¯ª¨
|
mov al,17 ; ¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª®¯ª¨
|
||||||
|
int 0x40
|
||||||
shr eax,8
|
shr eax,8
|
||||||
jmp testbut
|
jmp testbut
|
||||||
|
|
||||||
key:
|
key:
|
||||||
mcall 2 ; ¯®«ãç¨âì ASCII-ª®¤ ¦ ⮩ ª« ¢¨è¨
|
mov al,2 ; ¯®«ãç¨âì ASCII-ª®¤ ¦ ⮩ ª« ¢¨è¨
|
||||||
|
int 0x40
|
||||||
shr eax,8
|
shr eax,8
|
||||||
mov edi,asci ; ¯¥à¥¢®¤ ASCII ¢ ¨¤¥â¨ä¨ª â®à ª®¯ª¨
|
mov edi,asci ; ¯¥à¥¢®¤ ASCII ¢ ¨¤¥â¨ä¨ª â®à ª®¯ª¨
|
||||||
mov ecx,18
|
mov ecx,18
|
||||||
cld
|
cld
|
||||||
repne scasb
|
repne scasb
|
||||||
@ -60,9 +66,10 @@ button:
|
|||||||
lodsb
|
lodsb
|
||||||
|
|
||||||
testbut:
|
testbut:
|
||||||
cmp eax,1 ; ª®¯ª 1 - § ªàë⨥ ¯à®£à ¬¬ë
|
cmp eax,1 ; ª®¯ª 1 - § ªàë⨥ ¯à®£à ¬¬ë
|
||||||
jne noclose
|
jne noclose
|
||||||
mcall -1
|
or eax,-1
|
||||||
|
int 0x40
|
||||||
|
|
||||||
noclose:
|
noclose:
|
||||||
cmp eax,2
|
cmp eax,2
|
||||||
@ -72,14 +79,14 @@ button:
|
|||||||
|
|
||||||
no_reset:
|
no_reset:
|
||||||
finit
|
finit
|
||||||
mov ebx,muuta1 ; <20>¥à¥¢®¤ ¢ ä®à¬ â FPU
|
mov ebx,muuta1 ; <20>¥à¥¢®¤ ¢ ä®à¬ â FPU
|
||||||
mov esi,18
|
mov esi,18
|
||||||
call atof
|
call atof
|
||||||
fstp [trans1]
|
fstp [trans1]
|
||||||
mov ebx,muuta2
|
mov ebx,muuta2
|
||||||
mov esi,18
|
mov esi,18
|
||||||
call atof
|
call atof
|
||||||
fst [trans2]
|
fst [trans2]
|
||||||
cmp eax,33
|
cmp eax,33
|
||||||
jne no_sign
|
jne no_sign
|
||||||
cmp [dsign],byte '-'
|
cmp [dsign],byte '-'
|
||||||
@ -107,40 +114,40 @@ button:
|
|||||||
mov [entry_multiplier],eax
|
mov [entry_multiplier],eax
|
||||||
call print_display
|
call print_display
|
||||||
jmp still
|
jmp still
|
||||||
multipl: dd 10,16,2
|
multipl: dd 10,16,2
|
||||||
|
|
||||||
no_display_change:
|
no_display_change:
|
||||||
cmp eax,6
|
cmp eax,6
|
||||||
jb no_a_f
|
jb no_a_f
|
||||||
cmp eax,11
|
cmp eax,11
|
||||||
jg no_a_f
|
jg no_a_f
|
||||||
add eax,4
|
add eax,4
|
||||||
call number_entry
|
call number_entry
|
||||||
jmp still
|
jmp still
|
||||||
|
|
||||||
no_a_f:
|
no_a_f:
|
||||||
cmp eax,12
|
cmp eax,12
|
||||||
jb no_13
|
jb no_13
|
||||||
cmp eax,14
|
cmp eax,14
|
||||||
jg no_13
|
jg no_13
|
||||||
sub eax,11
|
sub eax,11
|
||||||
call number_entry
|
call number_entry
|
||||||
jmp still
|
jmp still
|
||||||
|
|
||||||
no_13:
|
no_13:
|
||||||
cmp eax,19
|
cmp eax,19
|
||||||
jb no_46
|
jb no_46
|
||||||
cmp eax,21
|
cmp eax,21
|
||||||
jg no_46
|
jg no_46
|
||||||
sub eax,15
|
sub eax,15
|
||||||
call number_entry
|
call number_entry
|
||||||
jmp still
|
jmp still
|
||||||
|
|
||||||
no_46:
|
no_46:
|
||||||
cmp eax,26
|
cmp eax,26
|
||||||
jb no_79
|
jb no_79
|
||||||
cmp eax,28
|
cmp eax,28
|
||||||
jg no_79
|
jg no_79
|
||||||
sub eax,19
|
sub eax,19
|
||||||
call number_entry
|
call number_entry
|
||||||
jmp still
|
jmp still
|
||||||
@ -148,7 +155,7 @@ button:
|
|||||||
no_79:
|
no_79:
|
||||||
cmp eax,34
|
cmp eax,34
|
||||||
jne no_0
|
jne no_0
|
||||||
mov eax,0
|
xor eax,eax
|
||||||
call number_entry
|
call number_entry
|
||||||
jmp still
|
jmp still
|
||||||
|
|
||||||
@ -303,7 +310,7 @@ error:
|
|||||||
calculate:
|
calculate:
|
||||||
pusha
|
pusha
|
||||||
cmp [calc],' '
|
cmp [calc],' '
|
||||||
je no_calculation
|
je no_calculation
|
||||||
cmp [calc],'/'
|
cmp [calc],'/'
|
||||||
jne no_cdiv
|
jne no_cdiv
|
||||||
fdiv [trans1]
|
fdiv [trans1]
|
||||||
@ -338,7 +345,7 @@ number_entry:
|
|||||||
cmp eax,[entry_multiplier]
|
cmp eax,[entry_multiplier]
|
||||||
jge no_entry
|
jge no_entry
|
||||||
cmp [id],1
|
cmp [id],1
|
||||||
je decimal_entry
|
je decimal_entry
|
||||||
mov ebx,[integer]
|
mov ebx,[integer]
|
||||||
test ebx,0xc0000000
|
test ebx,0xc0000000
|
||||||
jnz no_entry
|
jnz no_entry
|
||||||
@ -384,7 +391,7 @@ number_entry:
|
|||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
mov [muuta1],al
|
mov [muuta1],al
|
||||||
mov edi,muuta1+10 ; 楫®¥
|
mov edi,muuta1+10 ; 楫®¥
|
||||||
mov eax,[integer]
|
mov eax,[integer]
|
||||||
|
|
||||||
new_to_muuta1:
|
new_to_muuta1:
|
||||||
@ -397,7 +404,7 @@ number_entry:
|
|||||||
dec edi
|
dec edi
|
||||||
cmp edi,muuta1+1
|
cmp edi,muuta1+1
|
||||||
jge new_to_muuta1
|
jge new_to_muuta1
|
||||||
mov edi,muuta1+17 ; ¤à®¡®¥
|
mov edi,muuta1+17 ; ¤à®¡®¥
|
||||||
mov eax,[decimal]
|
mov eax,[decimal]
|
||||||
|
|
||||||
new_to_muuta2:
|
new_to_muuta2:
|
||||||
@ -434,17 +441,17 @@ new_entry:
|
|||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
|
||||||
ten dd 10.0,0
|
ten dd 10.0,0
|
||||||
tmp dw 1,0
|
tmp dw 1,0
|
||||||
sign db 1,0
|
sign db 1,0
|
||||||
tmp2 dq 0x0,0
|
tmp2 dq 0x0,0
|
||||||
exp dd 0x0,0
|
exp dd 0x0,0
|
||||||
new_dec dd 100000,0
|
new_dec dd 100000,0
|
||||||
id db 0x0,0
|
id db 0x0,0
|
||||||
res dd 0
|
res dd 0
|
||||||
trans1 dq 0
|
trans1 dq 0
|
||||||
trans2 dq 0
|
trans2 dq 0
|
||||||
controlWord dw 1
|
controlWord dw 1
|
||||||
|
|
||||||
ftoa: ; fpu st0 -> [integer],[decimal]
|
ftoa: ; fpu st0 -> [integer],[decimal]
|
||||||
pusha
|
pusha
|
||||||
@ -452,7 +459,7 @@ ftoa: ; fpu st0 -> [integer],[decimal]
|
|||||||
fstcw [controlWord] ; set truncate integer mode
|
fstcw [controlWord] ; set truncate integer mode
|
||||||
mov ax,[controlWord]
|
mov ax,[controlWord]
|
||||||
mov [tmp], ax
|
mov [tmp], ax
|
||||||
or [tmp], word 0x0c00
|
or [tmp], word 0x0c00
|
||||||
fldcw [tmp]
|
fldcw [tmp]
|
||||||
ftst ; test if st0 is negative
|
ftst ; test if st0 is negative
|
||||||
fstsw ax
|
fstsw ax
|
||||||
@ -467,12 +474,12 @@ ftoa: ; fpu st0 -> [integer],[decimal]
|
|||||||
fld [tmp2]
|
fld [tmp2]
|
||||||
fisub [integer]
|
fisub [integer]
|
||||||
fldcw [controlWord]
|
fldcw [controlWord]
|
||||||
cmp byte [sign], 0 ; change fraction to positive
|
cmp byte [sign], 0 ; change fraction to positive
|
||||||
je no_neg2
|
je no_neg2
|
||||||
fchs
|
fchs
|
||||||
|
|
||||||
no_neg2:
|
no_neg2:
|
||||||
mov [res],0 ; convert 6 decimal numbers
|
mov [res],0 ; convert 6 decimal numbers
|
||||||
mov edi,6
|
mov edi,6
|
||||||
|
|
||||||
newd:
|
newd:
|
||||||
@ -488,7 +495,7 @@ ftoa: ; fpu st0 -> [integer],[decimal]
|
|||||||
fstsw ax
|
fstsw ax
|
||||||
|
|
||||||
dec edi
|
dec edi
|
||||||
jz real_done
|
jz real_done
|
||||||
jmp newd
|
jmp newd
|
||||||
|
|
||||||
real_done:
|
real_done:
|
||||||
@ -501,8 +508,8 @@ ftoa: ; fpu st0 -> [integer],[decimal]
|
|||||||
|
|
||||||
no_error:
|
no_error:
|
||||||
mov [dsign],byte '+'
|
mov [dsign],byte '+'
|
||||||
cmp [sign],byte 0 ; convert negative result
|
cmp [sign],byte 0 ; convert negative result
|
||||||
je no_negative
|
je no_negative
|
||||||
mov eax,[integer]
|
mov eax,[integer]
|
||||||
not eax
|
not eax
|
||||||
inc eax
|
inc eax
|
||||||
@ -521,9 +528,9 @@ atof:
|
|||||||
fldz
|
fldz
|
||||||
mov di, 0
|
mov di, 0
|
||||||
cmp si, 0
|
cmp si, 0
|
||||||
je .error ; Jump if string has 0 length.
|
je .error ; Jump if string has 0 length.
|
||||||
mov byte [sign], 0
|
mov byte [sign], 0
|
||||||
cmp byte [bx], '+' ; Take care of leading '+' or '-'.
|
cmp byte [bx], '+' ; Take care of leading '+' or '-'.
|
||||||
jne .noPlus
|
jne .noPlus
|
||||||
inc di
|
inc di
|
||||||
jmp .noMinus
|
jmp .noMinus
|
||||||
@ -531,7 +538,7 @@ atof:
|
|||||||
.noPlus:
|
.noPlus:
|
||||||
cmp byte [bx], '-'
|
cmp byte [bx], '-'
|
||||||
jne .noMinus
|
jne .noMinus
|
||||||
mov byte [sign], 1 ; Number is negative.
|
mov byte [sign], 1 ; Number is negative.
|
||||||
inc di
|
inc di
|
||||||
|
|
||||||
.noMinus:
|
.noMinus:
|
||||||
@ -542,16 +549,16 @@ atof:
|
|||||||
call atof_convertFractionalPart
|
call atof_convertFractionalPart
|
||||||
jc .error
|
jc .error
|
||||||
cmp byte [sign], 0
|
cmp byte [sign], 0
|
||||||
je .dontNegate
|
je .dontNegate
|
||||||
fchs ; Negate value
|
fchs ; Negate value
|
||||||
|
|
||||||
.dontNegate:
|
.dontNegate:
|
||||||
mov bh, 0 ; Set bh to indicate the string is a valid number.
|
mov bh, 0 ; Set bh to indicate the string is a valid number.
|
||||||
jmp .exit
|
jmp .exit
|
||||||
|
|
||||||
.error:
|
.error:
|
||||||
mov bh, 1 ; Set error code.
|
mov bh, 1 ; Set error code.
|
||||||
fstp st0 ; Pop top of fpu stack.
|
fstp st0 ; Pop top of fpu stack.
|
||||||
|
|
||||||
.exit:
|
.exit:
|
||||||
pop di
|
pop di
|
||||||
@ -568,7 +575,7 @@ atof_convertWholePart:
|
|||||||
mov al, [bx + di]
|
mov al, [bx + di]
|
||||||
cmp al, '.'
|
cmp al, '.'
|
||||||
je .exit
|
je .exit
|
||||||
cmp al, '0' ; Make sure character is a digit.
|
cmp al, '0' ; Make sure character is a digit.
|
||||||
jb .error
|
jb .error
|
||||||
cmp al, '9'
|
cmp al, '9'
|
||||||
ja .error
|
ja .error
|
||||||
@ -585,34 +592,34 @@ atof_convertWholePart:
|
|||||||
fmul dword [ten]
|
fmul dword [ten]
|
||||||
fiadd word [tmp]
|
fiadd word [tmp]
|
||||||
inc di
|
inc di
|
||||||
cmp si, di ; Jump if end of string has been reached.
|
cmp si, di ; Jump if end of string has been reached.
|
||||||
je .exit
|
je .exit
|
||||||
jmp .mainLoop
|
jmp .mainLoop
|
||||||
|
|
||||||
.error:
|
.error:
|
||||||
stc ; Set error (carry) flag.
|
stc ; Set error (carry) flag.
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.exit:
|
.exit:
|
||||||
clc ; Clear error (carry) flag.
|
clc ; Clear error (carry) flag.
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
atof_convertFractionalPart:
|
atof_convertFractionalPart:
|
||||||
fld1 ; Load 1 to TOS. This will be the value of the decimal place.
|
fld1 ; Load 1 to TOS. This will be the value of the decimal place.
|
||||||
|
|
||||||
.mainLoop:
|
.mainLoop:
|
||||||
cmp si, di ; Jump if end of string has been reached.
|
cmp si, di ; Jump if end of string has been reached.
|
||||||
je .exit
|
je .exit
|
||||||
inc di ; Move past the decimal point.
|
inc di ; Move past the decimal point.
|
||||||
cmp si, di ; Jump if end of string has been reached.
|
cmp si, di ; Jump if end of string has been reached.
|
||||||
je .exit
|
je .exit
|
||||||
mov al, [bx + di]
|
mov al, [bx + di]
|
||||||
cmp al, '0' ; Make sure character is a digit.
|
cmp al, '0' ; Make sure character is a digit.
|
||||||
jb .error
|
jb .error
|
||||||
cmp al, '9'
|
cmp al, '9'
|
||||||
ja .error
|
ja .error
|
||||||
fdiv dword [ten] ; Next decimal place
|
fdiv dword [ten] ; Next decimal place
|
||||||
sub al, '0'
|
sub al, '0'
|
||||||
mov ah, 0
|
mov ah, 0
|
||||||
mov [tmp], ax
|
mov [tmp], ax
|
||||||
@ -626,123 +633,196 @@ atof_convertFractionalPart:
|
|||||||
jmp .mainLoop
|
jmp .mainLoop
|
||||||
|
|
||||||
.error:
|
.error:
|
||||||
stc ; Set error (carry) flag.
|
stc ; Set error (carry) flag.
|
||||||
fstp st0 ; Pop top of fpu stack.
|
fstp st0 ; Pop top of fpu stack.
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.exit:
|
.exit:
|
||||||
clc ; Clear error (carry) flag.
|
clc ; Clear error (carry) flag.
|
||||||
fstp st0 ; Pop top of fpu stack.
|
fstp st0 ; Pop top of fpu stack.
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; *********************************************
|
; *********************************************
|
||||||
; ******* Ž<EFBFBD><EFBFBD>…„…‹…<EFBFBD>ˆ… ˆ Ž’<C5BD>ˆ‘Ž‚Š€ ŽŠ<C5BD>€ ********
|
; ******* WINDOW DEFINITIONS AND DRAW *********
|
||||||
; *********************************************
|
; *********************************************
|
||||||
|
|
||||||
draw_window:
|
draw_window:
|
||||||
|
|
||||||
|
mov eax,48
|
||||||
|
mov ebx,3
|
||||||
|
mov ecx,sc
|
||||||
|
mov edx,sizeof.system_colors
|
||||||
|
int 0x40
|
||||||
|
|
||||||
mcall 12,1
|
mov eax,12
|
||||||
mcall 0,200*65536+255,200*65536+180,0x03ddeeff ; äãªæ¨ï 0: ®¯à¥¤¥«¨âì ¨ ®âà¨á®¢ âì ®ª®
|
mov ebx,1
|
||||||
mcall 4,8*65536+8,0x10000000,labelt,label_len ; ‡€ƒŽ‹Ž‚ŽŠ ŽŠ<C5BD>€
|
int 0x40
|
||||||
|
|
||||||
|
mov eax,0
|
||||||
|
mov ebx,200*65536+255
|
||||||
|
mov ecx,200*65536+180
|
||||||
|
mov edx,[sc.work]
|
||||||
|
or edx,0x33000000
|
||||||
|
mov edi,header
|
||||||
|
int 0x40
|
||||||
|
|
||||||
mov ebx,24*65536+28
|
mov eax,8
|
||||||
mov ecx,70*65536+18
|
mov ebx,19*65536+28
|
||||||
|
mov ecx,49*65536+18
|
||||||
mov edx,6
|
mov edx,6
|
||||||
mov esi,0x0066ee
|
mov esi,[sc.work_button]
|
||||||
mov edi,7
|
mov edi,7
|
||||||
newbutton:
|
newbutton:
|
||||||
dec edi
|
dec edi
|
||||||
jnz no_new_row
|
jnz no_new_row
|
||||||
mov edi,7
|
mov edi,7
|
||||||
mov ebx,24*65536+25+3
|
mov ebx,19*65536+28
|
||||||
add ecx,20*65536
|
add ecx,20*65536
|
||||||
no_new_row:
|
no_new_row:
|
||||||
mcall 8
|
int 0x40
|
||||||
add ebx,30*65536
|
add ebx,30*65536
|
||||||
inc edx
|
inc edx
|
||||||
cmp edx,39
|
cmp edx,39
|
||||||
jbe newbutton
|
jbe newbutton
|
||||||
|
|
||||||
mcall 8,225*65536+8,28*65536+8,3 ; 'dec-bin-hex'
|
|
||||||
mcall 8,204*65536+28,70*65536+18,2,0xcc0000 ; 'C'
|
|
||||||
|
|
||||||
mov ebx,25*65536+75 ; <20>à®à¨á®¢ª ¯®¤¯¨á¥© ª®¯®ª
|
|
||||||
mov ecx,0xffffff
|
|
||||||
mov edx,text
|
|
||||||
mov esi,34
|
|
||||||
|
|
||||||
|
mcall ,199*65536+28,49*65536+18,2 ; 'C'
|
||||||
|
mcall ,220*65536+8,7*65536+8,3 ; 'dec-bin-hex'
|
||||||
|
|
||||||
|
mov eax,4
|
||||||
|
mov ebx,27*65536+54
|
||||||
|
mov ecx,[sc.work_button_text]
|
||||||
|
mov edx,text
|
||||||
|
mov esi,33
|
||||||
newline:
|
newline:
|
||||||
mcall 4
|
int 0x40
|
||||||
add ebx,20
|
add ebx,20
|
||||||
add edx,34
|
add edx,33
|
||||||
cmp [edx],byte 'x'
|
cmp [edx],byte 'x'
|
||||||
jne newline
|
jne newline
|
||||||
|
|
||||||
call print_display
|
call print_display
|
||||||
mcall 12,2
|
|
||||||
|
mov eax,12
|
||||||
|
mov ebx,2
|
||||||
|
int 0x40
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
print_display:
|
print_display:
|
||||||
pusha
|
pusha
|
||||||
mcall 13,100*65536+120,25*65536+13,0x00ddeeff
|
mcall 13,18*65536+210,19*65536+13,0xffffff
|
||||||
mcall 13,23*65536+210,40*65536+13,0xffffff
|
|
||||||
mcall 4,140*65536+28,0,calc,1
|
|
||||||
mov eax,4
|
mov eax,4
|
||||||
mov ebx,203*65536+29
|
mov ebx,135*65536+7
|
||||||
mov ecx,0
|
mov ecx,[sc.work_text]
|
||||||
|
or ecx,0x40000000
|
||||||
|
mov edx,calc
|
||||||
|
mov esi,1
|
||||||
|
mov edi,[sc.work]
|
||||||
|
int 0x40
|
||||||
|
|
||||||
|
mov ebx,198*65536+8
|
||||||
mov edx,[display_type]
|
mov edx,[display_type]
|
||||||
shl edx,2
|
shl edx,2
|
||||||
add edx,display_type_text
|
add edx,display_type_text
|
||||||
mov esi,3
|
mov esi,3
|
||||||
|
mov edi,[sc.work]
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
cmp [dsign],byte '+'
|
cmp [dsign],byte '+'
|
||||||
je positive
|
je positive
|
||||||
mcall 4,28*65536+43,0x0,dsign,1
|
mov ebx,23*65536+22
|
||||||
|
mov ecx,0x0
|
||||||
positive:
|
mov edx,dsign
|
||||||
cmp [display_type],0 ; ¤¥áïâ¨ç ï á¨á⥬ áç¨á«¥¨ï
|
mov esi,1
|
||||||
|
int 0x40
|
||||||
|
|
||||||
|
positive:
|
||||||
|
cmp [display_type],0
|
||||||
jne no_display_decimal
|
jne no_display_decimal
|
||||||
cmp [decimal],0
|
cmp [decimal],0
|
||||||
je whole
|
je whole
|
||||||
mcall 47,10*65536,[integer],125*65536+43,0x0 ; ®â®¡à ¦ âì 10 æ¨äà
|
|
||||||
mcall 4,185*65536+43,0x0,dot,1
|
mov ebx,180*65536+22
|
||||||
mcall 47,6*65536,[decimal],192*65536+43,0x0 ; ®â®¡à ¦ âì 6 æ¨äà ¯®á«¥ § ¯ï⮩
|
mov ecx,0x0
|
||||||
|
mov edx,dot
|
||||||
|
mov esi,1
|
||||||
|
int 0x40
|
||||||
|
|
||||||
|
mov eax,47
|
||||||
|
mov ebx,10*65536
|
||||||
|
mov ecx,[integer]
|
||||||
|
mov edx,120*65536+22
|
||||||
|
mov esi,0x0
|
||||||
|
int 0x40
|
||||||
|
|
||||||
|
mov ebx,6*65536
|
||||||
|
mov ecx,[decimal]
|
||||||
|
mov edx,187*65536+22
|
||||||
|
mov esi,0x0
|
||||||
|
int 0x40
|
||||||
|
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
|
||||||
whole:
|
whole:
|
||||||
|
mov ebx,220*65536+22
|
||||||
|
mov ecx,0x0
|
||||||
|
mov edx,dot
|
||||||
|
mov esi,1
|
||||||
|
int 0x40
|
||||||
|
|
||||||
cmp [integer],0
|
cmp [integer],0
|
||||||
je null
|
je null
|
||||||
mcall 47,10*65536,[integer],165*65536+43,0x0
|
|
||||||
mcall 4,225*65536+43,0x0,dot,1
|
mov eax,47
|
||||||
|
mov ebx,10*65536
|
||||||
|
mov ecx,[integer]
|
||||||
|
mov edx,160*65536+22
|
||||||
|
mov esi,0x0
|
||||||
|
int 0x40
|
||||||
|
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
|
||||||
no_display_decimal:
|
no_display_decimal:
|
||||||
cmp [integer],0
|
|
||||||
je null
|
|
||||||
cmp [display_type],1
|
cmp [display_type],1
|
||||||
jne no_display_hexadecimal
|
jne no_display_hexadecimal
|
||||||
mcall 47,1*256+8*65536,[integer],178*65536+43,0x0 ; ®â®¡à ¦ âì 8 è¥áâ ¤æ â¨à¨çëå æ¨äà
|
cmp [integer],0
|
||||||
|
je null
|
||||||
|
|
||||||
|
mov eax,47
|
||||||
|
mov ebx,256+8*65536
|
||||||
|
mov ecx,[integer]
|
||||||
|
mov edx,173*65536+22
|
||||||
|
mov esi,0x0
|
||||||
|
int 0x40
|
||||||
|
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
|
||||||
no_display_hexadecimal:
|
no_display_hexadecimal:
|
||||||
cmp [integer],0
|
cmp [integer],0
|
||||||
je null
|
je null
|
||||||
cmp [display_type],2
|
|
||||||
jne null
|
mov eax,47
|
||||||
mcall 47,2*256+32*65536,[integer],37*65536+43,0x0 ; ®â®¡à ¦ âì 32 ¤¢®¨çë¥ æ¨äàë
|
mov ebx,2*256+32*65536
|
||||||
|
mov ecx,[integer]
|
||||||
|
mov edx,32*65536+22
|
||||||
|
mov esi,0x0
|
||||||
|
int 0x40
|
||||||
|
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
|
||||||
null:
|
null:
|
||||||
mcall 47,1*65536,0,219*65536+43,0x0
|
mov eax,47
|
||||||
cmp [display_type],0
|
mov ebx,1*65536
|
||||||
jne end_pr
|
mov ecx,0
|
||||||
mcall 4,225*65536+43,0x0,dot,1
|
mov edx,214*65536+22
|
||||||
|
mov esi,0x0
|
||||||
end_pr:
|
int 0x40
|
||||||
|
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -768,36 +848,36 @@ clear_all:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
;Ž¡« áâì ¤ ëå
|
;data
|
||||||
|
|
||||||
|
header db appname,version,0
|
||||||
|
|
||||||
display_type dd 0 ; 0 = decimal, 1 = hexadecimal, 2= binary
|
display_type dd 0 ; 0 = decimal, 1 = hexadecimal, 2= binary
|
||||||
entry_multiplier dd 10
|
entry_multiplier dd 10
|
||||||
|
|
||||||
display_start_y dd 0x0
|
|
||||||
display_type_text db 'dec hex bin'
|
display_type_text db 'dec hex bin'
|
||||||
|
|
||||||
dot db '.'
|
dot db '.'
|
||||||
calc db ' '
|
calc db ' '
|
||||||
integer dd 0
|
integer dd 0
|
||||||
decimal dd 0
|
decimal dd 0
|
||||||
kymppi dd 10
|
kymppi dd 10
|
||||||
|
|
||||||
dsign:
|
dsign:
|
||||||
muuta1 db '+0000000000.000000'
|
muuta1 db '+0000000000.000000'
|
||||||
muuta2 db '+0000000000.000000'
|
muuta2 db '+0000000000.000000'
|
||||||
muuta0 db '+0000000000.000000'
|
muuta0 db '+0000000000.000000'
|
||||||
|
|
||||||
text:
|
text:
|
||||||
db ' A B C D E F C '
|
db ' A B C D E F C '
|
||||||
db ' 1 2 3 + Int Sin Asin'
|
db ' 1 2 3 + Int Sin Asin'
|
||||||
db ' 4 5 6 - 1/x Cos Acos'
|
db ' 4 5 6 - 1/x Cos Acos'
|
||||||
db ' 7 8 9 / x^2 Tan Atan'
|
db ' 7 8 9 / x^2 Tan Atan'
|
||||||
db ' +/- 0 . * Sqr Pi = '
|
db '+/- 0 . * Sqr Pi = '
|
||||||
db 'x'
|
db 'x'
|
||||||
|
|
||||||
asci: db 49,50,51,52,53,54,55,56,57,48,43,61,45,42,47,44,46,27
|
asci: db 49,50,51,52,53,54,55,56,57,48,43,61,45,42,47,44,46,27
|
||||||
butid: db 12,13,14,19,20,21,26,27,28,34,15,39,22,36,29,35,35,1
|
butid: db 12,13,14,19,20,21,26,27,28,34,15,39,22,36,29,35,35,1
|
||||||
labelt:
|
|
||||||
db 'Calc 1.3'
|
I_END:
|
||||||
label_len = $ - labelt
|
|
||||||
I_END:
|
sc system_colors
|
||||||
|
Loading…
Reference in New Issue
Block a user