2006-01-03 12:43:31 +03:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
|
|
|
;; flat assembler source ;;
|
2006-07-28 17:39:16 +04:00
|
|
|
;; Copyright (c) 1999-2006, Tomasz Grysztar ;;
|
2006-01-03 12:43:31 +03:00
|
|
|
;; All rights reserved. ;;
|
|
|
|
;; ;;
|
|
|
|
;; Menuet port by VT ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
NORMAL_MODE = 8
|
|
|
|
CONSOLE_MODE = 32
|
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
MAGIC1 = 6*(text.line_size-1)+14
|
|
|
|
MAX_PATH = 100
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
APP_MEMORY = 0x00800000
|
2006-01-03 12:43:31 +03:00
|
|
|
|
|
|
|
;; Menuet header
|
|
|
|
|
2006-11-02 17:18:23 +03:00
|
|
|
appname equ "flat assembler "
|
2006-10-11 02:15:57 +04:00
|
|
|
|
2006-01-03 12:43:31 +03:00
|
|
|
use32
|
|
|
|
|
|
|
|
org 0x0
|
|
|
|
db 'MENUET01' ; 8 byte id
|
2006-10-11 02:15:57 +04:00
|
|
|
dd 0x01 ; header version
|
|
|
|
dd START ; program start
|
2006-01-03 12:43:31 +03:00
|
|
|
dd program_end ; program image size
|
2007-09-20 21:07:33 +04:00
|
|
|
dd stacktop ; required amount of memory
|
|
|
|
dd stacktop ; stack
|
2006-01-03 12:43:31 +03:00
|
|
|
dd params,0x0 ; parameters,icon
|
|
|
|
|
|
|
|
include 'lang.inc'
|
2007-05-10 17:48:35 +04:00
|
|
|
include '..\..\..\macros.inc'
|
2007-05-29 14:56:54 +04:00
|
|
|
purge add,sub ; macros.inc does incorrect substitution
|
2006-01-03 12:43:31 +03:00
|
|
|
include 'fasm.inc'
|
|
|
|
|
|
|
|
center fix true
|
|
|
|
|
2006-07-28 17:39:16 +04:00
|
|
|
START: ; Start of execution
|
2007-02-08 19:38:05 +03:00
|
|
|
mov edi, fileinfos
|
|
|
|
mov ecx, (fileinfos_end-fileinfos)/4
|
|
|
|
or eax, -1
|
|
|
|
rep stosd
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
cmp [params],0
|
|
|
|
jz red
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
mov ecx,10
|
2007-06-14 16:56:45 +04:00
|
|
|
mov eax,' '
|
2006-10-11 02:15:57 +04:00
|
|
|
mov edi,infile
|
|
|
|
push ecx
|
2006-01-03 12:43:31 +03:00
|
|
|
cld
|
2006-10-11 02:15:57 +04:00
|
|
|
rep stosd
|
|
|
|
mov ecx,[esp]
|
|
|
|
mov edi,outfile
|
|
|
|
rep stosd
|
|
|
|
pop ecx
|
|
|
|
mov edi,path
|
|
|
|
rep stosd
|
|
|
|
|
|
|
|
mov esi,params
|
2006-01-03 12:43:31 +03:00
|
|
|
; DEBUGF "params: %s\n",esi
|
2006-10-11 02:15:57 +04:00
|
|
|
mov edi,infile
|
2006-01-03 12:43:31 +03:00
|
|
|
call mov_param_str
|
|
|
|
; mov edi,infile
|
|
|
|
; DEBUGF " input: %s\n",edi
|
2006-10-11 02:15:57 +04:00
|
|
|
inc esi
|
|
|
|
mov edi,outfile
|
2006-01-03 12:43:31 +03:00
|
|
|
call mov_param_str
|
|
|
|
; mov edi,outfile
|
|
|
|
; DEBUGF "output: %s\n",edi
|
2006-10-11 02:15:57 +04:00
|
|
|
inc esi
|
|
|
|
mov edi,path
|
2006-01-03 12:43:31 +03:00
|
|
|
call mov_param_str
|
|
|
|
; mov edi,path
|
|
|
|
; DEBUGF " path: %s\n",edi
|
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
cmp [esi], dword ',run'
|
|
|
|
jne @f
|
|
|
|
mov [_run_outfile],1
|
2006-01-03 12:43:31 +03:00
|
|
|
@@:
|
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
mov [_mode],CONSOLE_MODE
|
|
|
|
jmp start
|
2006-01-03 12:43:31 +03:00
|
|
|
|
|
|
|
|
2006-07-28 17:39:16 +04:00
|
|
|
red: ; Redraw
|
2006-01-03 12:43:31 +03:00
|
|
|
call draw_window
|
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
still:
|
|
|
|
push 10 ; Wait here for event
|
|
|
|
pop eax
|
2007-05-10 17:48:35 +04:00
|
|
|
mcall
|
2006-10-11 02:15:57 +04:00
|
|
|
dec eax
|
|
|
|
je red ; Redraw request
|
|
|
|
dec eax
|
|
|
|
jne button ; Button in buffer
|
|
|
|
|
|
|
|
key: ; Key
|
|
|
|
mov al,2 ; Read it and ignore
|
2007-05-10 17:48:35 +04:00
|
|
|
mcall
|
2006-01-03 12:43:31 +03:00
|
|
|
jmp still
|
|
|
|
|
|
|
|
button: ; Button in Window
|
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
mov al,17
|
2007-05-10 17:48:35 +04:00
|
|
|
mcall
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
cmp ah,1
|
|
|
|
jne noclose
|
|
|
|
or eax,-1
|
2007-05-10 17:48:35 +04:00
|
|
|
mcall
|
2006-10-11 02:15:57 +04:00
|
|
|
|
|
|
|
noclose:
|
|
|
|
cmp ah,2 ; Start compiling
|
|
|
|
je start
|
|
|
|
cmp ah,3 ; Start compiled file
|
2006-01-03 12:43:31 +03:00
|
|
|
jnz norunout
|
|
|
|
|
|
|
|
mov edx,outfile
|
|
|
|
call make_fullpaths
|
2006-10-11 02:15:57 +04:00
|
|
|
mcall 70,file_info_start
|
2006-01-03 12:43:31 +03:00
|
|
|
; xor ecx,ecx
|
|
|
|
jmp still
|
|
|
|
norunout:
|
2007-06-14 16:56:45 +04:00
|
|
|
cmp ah,4
|
|
|
|
jnz norundebug
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2007-06-14 16:56:45 +04:00
|
|
|
mov edx,outfile
|
|
|
|
call make_fullpaths
|
|
|
|
mcall 70,file_info_debug
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
norundebug:
|
2006-10-11 02:15:57 +04:00
|
|
|
mov ecx,5
|
2006-01-03 12:43:31 +03:00
|
|
|
mov [ya],ecx
|
|
|
|
|
2006-07-28 17:39:16 +04:00
|
|
|
cmp ah,11 ; Infile
|
2006-10-11 02:15:57 +04:00
|
|
|
je f1
|
2006-07-28 17:39:16 +04:00
|
|
|
cmp ah,12 ; Outfile
|
2006-10-11 02:15:57 +04:00
|
|
|
je f2
|
2006-07-28 17:39:16 +04:00
|
|
|
cmp ah,13 ; Path
|
2006-10-11 02:15:57 +04:00
|
|
|
je f3
|
2007-06-14 16:56:45 +04:00
|
|
|
cmp ah,14
|
|
|
|
je f4
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
jmp still
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2007-06-14 16:56:45 +04:00
|
|
|
f4:
|
|
|
|
xor [bGenerateDebugInfo], 1
|
|
|
|
mcall 8,,,0x8000000E
|
|
|
|
call draw_checkbox
|
|
|
|
jmp still
|
2006-01-03 12:43:31 +03:00
|
|
|
|
|
|
|
draw_window:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mcall 12,1 ; Start of draw
|
|
|
|
|
|
|
|
get_sys_colors 1,0
|
|
|
|
|
2006-11-26 04:43:33 +03:00
|
|
|
xor eax,eax
|
2007-06-14 16:56:45 +04:00
|
|
|
mov ebx,50*65536+280
|
|
|
|
mov ecx,50*65536+260
|
2006-10-11 02:15:57 +04:00
|
|
|
mov edx,[sc.work]
|
|
|
|
or edx,0x33000000
|
2007-05-10 17:48:35 +04:00
|
|
|
mov edi,title ; Draw Window Label Text
|
|
|
|
mcall
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
mcall 9,PROCESSINFO,-1
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
mpack ecx,1,1
|
2007-05-17 03:02:17 +04:00
|
|
|
mov ebx,[pinfo.box.width]
|
2006-10-11 02:15:57 +04:00
|
|
|
sub ebx,10
|
2006-01-03 12:43:31 +03:00
|
|
|
|
|
|
|
push ecx
|
2007-06-14 16:56:45 +04:00
|
|
|
madd ecx, 14*3+16+2, 14*3+16+2
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall 38,,,[sc.work_graph]
|
|
|
|
pop ecx
|
|
|
|
|
|
|
|
sub ebx,MAGIC1+3
|
|
|
|
mcall
|
2007-02-22 11:47:28 +03:00
|
|
|
madd ecx, 14, 14
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall
|
2007-02-22 11:47:28 +03:00
|
|
|
madd ecx, 14, 14
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall
|
2007-02-22 11:47:28 +03:00
|
|
|
madd ecx, 14, 14
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall
|
|
|
|
push ebx
|
2006-10-11 02:15:57 +04:00
|
|
|
mpack ebx,MAGIC1,MAGIC1
|
2007-02-22 11:47:28 +03:00
|
|
|
sub ecx, 14*3
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall
|
|
|
|
mov ebx,[esp-2]
|
|
|
|
pop bx
|
|
|
|
mcall
|
|
|
|
add esp,2
|
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
mpack ebx,0,MAGIC1-1
|
2007-02-22 11:47:28 +03:00
|
|
|
mpack ecx,1+1, 14-2
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall 8,,,0x4000000B ; Button: Enter Infile
|
2007-02-22 11:47:28 +03:00
|
|
|
madd ecx, 14,0
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall ,,,0x4000000C ; Button: Enter Outfile
|
2007-02-22 11:47:28 +03:00
|
|
|
madd ecx, 14,0
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall ,,,0x4000000D ; Button: Enter Path
|
|
|
|
|
2007-05-17 03:02:17 +04:00
|
|
|
mpack ebx,[pinfo.box.width],MAGIC1
|
2006-10-11 02:15:57 +04:00
|
|
|
msub ebx,MAGIC1+10+1,0
|
2007-06-14 16:56:45 +04:00
|
|
|
mpack ecx,0, (14*3+16)/3-1
|
2007-02-22 11:47:28 +03:00
|
|
|
madd ecx,1,0
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall ,,,0x00000002,[sc.work_button]
|
2007-06-14 16:56:45 +04:00
|
|
|
madd ecx, (14*3+16)/3+1,0
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall ,,,0x00000003
|
2007-06-14 16:56:45 +04:00
|
|
|
madd ecx, (14*3+16)/3+1,0
|
|
|
|
mcall ,,,4
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
mpack ebx,6,0 ; Draw Window Text
|
2007-02-22 11:47:28 +03:00
|
|
|
add ebx,1+ 14/2-3
|
2006-01-03 12:43:31 +03:00
|
|
|
mov ecx,[sc.work_text]
|
|
|
|
mov edx,text
|
|
|
|
mov esi,text.line_size
|
|
|
|
mov eax,4
|
|
|
|
newline:
|
2007-05-10 17:48:35 +04:00
|
|
|
mcall
|
2007-02-22 11:47:28 +03:00
|
|
|
add ebx, 14
|
2006-01-03 12:43:31 +03:00
|
|
|
add edx,text.line_size
|
|
|
|
cmp byte[edx],'x'
|
|
|
|
jne newline
|
|
|
|
|
2007-05-17 03:02:17 +04:00
|
|
|
mov ebx,[pinfo.box.width]
|
2006-10-11 02:15:57 +04:00
|
|
|
sub ebx,MAGIC1+10+1-9
|
2006-01-03 12:43:31 +03:00
|
|
|
shl ebx,16
|
2007-06-14 16:56:45 +04:00
|
|
|
add ebx,1+( (14*3+16)/3-1)/2-3
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall ,,[sc.work_button_text],s_compile,7
|
2007-06-14 16:56:45 +04:00
|
|
|
add ebx,(14*3+16)/3+1
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall ,,,s_run
|
2007-06-14 16:56:45 +04:00
|
|
|
add ebx,(14*3+16)/3+1
|
|
|
|
mcall ,,,s_debug
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
mpack ebx,MAGIC1+6,0
|
2007-02-22 11:47:28 +03:00
|
|
|
add ebx,1+ 14/2-3+ 14*0
|
2007-05-17 03:02:17 +04:00
|
|
|
mov esi,[pinfo.box.width]
|
2006-01-03 12:43:31 +03:00
|
|
|
sub esi,MAGIC1*2+5*2+6+3
|
|
|
|
mov eax,esi
|
|
|
|
mov cl,6
|
|
|
|
div cl
|
|
|
|
cmp al,MAX_PATH
|
|
|
|
jbe @f
|
|
|
|
mov al,MAX_PATH
|
|
|
|
@@: movzx esi,al
|
|
|
|
mcall 4,,[sc.work_text],infile
|
2007-02-22 11:47:28 +03:00
|
|
|
add ebx,14
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall ,,,outfile
|
2007-02-22 11:47:28 +03:00
|
|
|
add ebx,14
|
2006-01-03 12:43:31 +03:00
|
|
|
mcall ,,,path
|
|
|
|
|
2007-06-14 16:56:45 +04:00
|
|
|
call draw_checkbox
|
|
|
|
|
2006-01-03 12:43:31 +03:00
|
|
|
call draw_messages
|
|
|
|
|
|
|
|
mcall 12,2 ; End of Draw
|
|
|
|
|
|
|
|
popa
|
|
|
|
ret
|
|
|
|
|
|
|
|
bottom_right dd ?
|
|
|
|
|
2007-06-14 16:56:45 +04:00
|
|
|
draw_checkbox:
|
|
|
|
mcall 8,<5,10>,<14*3+5,10>,14,[sc.work_button]
|
|
|
|
cmp [bGenerateDebugInfo], 0
|
|
|
|
jz @f
|
|
|
|
mov edx, [sc.work_button_text]
|
|
|
|
mcall 38,<7,13>,<14*3+7,14*3+13>
|
|
|
|
mcall 38,,<14*3+13,14*3+7>
|
|
|
|
@@:
|
|
|
|
mov ecx, [sc.work_text]
|
|
|
|
or ecx, 0x80000000
|
|
|
|
mcall 4,<20,14*3+7>,,s_dbgdescr
|
|
|
|
ret
|
|
|
|
|
2006-01-03 12:43:31 +03:00
|
|
|
draw_messages:
|
|
|
|
mov eax,13 ; clear work area
|
2007-05-17 03:02:17 +04:00
|
|
|
mpack ebx,7-2,[pinfo.box.width]
|
2007-02-22 11:47:28 +03:00
|
|
|
sub ebx,5*2+7*2-1-2*2
|
2007-05-17 03:02:17 +04:00
|
|
|
mpack ecx,0,[pinfo.box.height]
|
2007-06-14 16:56:45 +04:00
|
|
|
madd ecx, 14*3+16+1+7+1,-( 14*3+16+1+7*2+25)
|
2006-01-03 12:43:31 +03:00
|
|
|
mov word[bottom_right+2],bx
|
|
|
|
mov word[bottom_right],cx
|
|
|
|
msub [bottom_right],7,11
|
2007-02-22 11:47:28 +03:00
|
|
|
add [bottom_right],7 shl 16 + 53
|
2006-01-03 12:43:31 +03:00
|
|
|
mov edx,[sc.work]
|
2007-05-10 17:48:35 +04:00
|
|
|
mcall
|
2006-01-03 12:43:31 +03:00
|
|
|
_cy = 0
|
|
|
|
_sy = 2
|
|
|
|
_cx = 4
|
|
|
|
_sx = 6
|
|
|
|
push ebx ecx
|
2007-02-22 11:47:28 +03:00
|
|
|
mpack ebx,4,5
|
2006-01-03 12:43:31 +03:00
|
|
|
add bx,[esp+_cx]
|
|
|
|
mov ecx,[esp+_sy-2]
|
|
|
|
mov cx,[esp+_sy]
|
|
|
|
msub ecx,1,1
|
|
|
|
mcall 38,,,[sc.work_graph]
|
|
|
|
mov si,[esp+_cy]
|
|
|
|
add cx,si
|
|
|
|
shl esi,16
|
|
|
|
add ecx,esi
|
|
|
|
madd ecx,1,1
|
|
|
|
mcall
|
2007-02-22 11:47:28 +03:00
|
|
|
mpack ebx,4,4
|
2006-01-03 12:43:31 +03:00
|
|
|
mov esi,[esp+_sy-2]
|
|
|
|
mov si,cx
|
|
|
|
mov ecx,esi
|
|
|
|
mcall
|
|
|
|
mov si,[esp+_cx]
|
|
|
|
add bx,si
|
|
|
|
shl esi,16
|
|
|
|
add ebx,esi
|
|
|
|
madd ebx,1,1
|
|
|
|
mcall
|
|
|
|
pop ecx ebx
|
|
|
|
ret
|
|
|
|
|
|
|
|
; read string
|
|
|
|
|
|
|
|
f1: mov [addr],infile
|
2007-02-22 11:47:28 +03:00
|
|
|
add [ya], 14*0
|
2006-01-03 12:43:31 +03:00
|
|
|
jmp rk
|
|
|
|
f2: mov [addr],outfile
|
2007-02-22 11:47:28 +03:00
|
|
|
add [ya], 14*1
|
2006-01-03 12:43:31 +03:00
|
|
|
jmp rk
|
|
|
|
f3: mov [addr],path
|
2007-02-22 11:47:28 +03:00
|
|
|
add [ya], 14*2
|
2006-01-03 12:43:31 +03:00
|
|
|
rk:
|
|
|
|
|
|
|
|
mov edi,[addr]
|
|
|
|
mov al,0
|
|
|
|
mov ecx,MAX_PATH
|
|
|
|
add edi,ecx
|
|
|
|
dec edi
|
|
|
|
std
|
|
|
|
repe scasb
|
|
|
|
sub ecx,MAX_PATH
|
|
|
|
neg ecx
|
|
|
|
mov al,$1C ; ''
|
|
|
|
add edi,2
|
|
|
|
push edi
|
|
|
|
cld
|
|
|
|
rep stosb
|
|
|
|
call print_text
|
|
|
|
pop edi
|
|
|
|
f11:mcall 10
|
|
|
|
cmp eax,2
|
|
|
|
jne read_done
|
|
|
|
mcall; 2
|
|
|
|
shr eax,8
|
|
|
|
cmp al,13
|
2006-07-28 17:39:16 +04:00
|
|
|
je read_done
|
2006-01-03 12:43:31 +03:00
|
|
|
cmp al,8
|
|
|
|
jne nobs
|
|
|
|
cmp edi,[addr]
|
2006-07-28 17:39:16 +04:00
|
|
|
je f11
|
2006-01-03 12:43:31 +03:00
|
|
|
sub edi,1
|
|
|
|
mov byte[edi],$1C ; '_'
|
|
|
|
call print_text
|
|
|
|
jmp f11
|
|
|
|
nobs:
|
|
|
|
movzx ebx,al
|
|
|
|
sub ebx,$20
|
|
|
|
jle f11
|
|
|
|
sub al,[sub_table+ebx]
|
|
|
|
keyok:
|
|
|
|
mov ecx,[addr]
|
|
|
|
add ecx,MAX_PATH
|
|
|
|
cmp edi,ecx
|
|
|
|
jae f11
|
|
|
|
mov [edi],al
|
|
|
|
|
|
|
|
call print_text
|
|
|
|
inc edi
|
|
|
|
jmp f11
|
|
|
|
|
|
|
|
read_done:
|
|
|
|
|
|
|
|
mov ecx,[addr]
|
|
|
|
add ecx,MAX_PATH
|
|
|
|
sub ecx,edi
|
|
|
|
mov al,0;' '
|
|
|
|
cld
|
|
|
|
rep stosb
|
|
|
|
call print_text
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
print_text:
|
|
|
|
|
2007-05-17 03:02:17 +04:00
|
|
|
mpack ebx,MAGIC1+6,[pinfo.box.width]
|
2007-02-22 11:47:28 +03:00
|
|
|
sub ebx,MAGIC1*2+19
|
2006-01-03 12:43:31 +03:00
|
|
|
movzx esi,bx
|
|
|
|
mov ecx,[ya-2]
|
|
|
|
mov cx,8
|
|
|
|
mcall 13,,,[sc.work]
|
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
mpack ebx,MAGIC1+6,[ya]
|
2006-01-03 12:43:31 +03:00
|
|
|
mov eax,esi
|
|
|
|
mov cl,6
|
|
|
|
div cl
|
|
|
|
cmp al,MAX_PATH
|
|
|
|
jbe @f
|
|
|
|
mov al,MAX_PATH
|
|
|
|
@@: movzx esi,al
|
|
|
|
mcall 4,,[sc.work_text],[addr]
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
; DATA
|
|
|
|
|
|
|
|
text:
|
|
|
|
db ' INFILE:'
|
|
|
|
.line_size = $-text
|
|
|
|
db 'OUTFILE:'
|
|
|
|
db ' PATH:'
|
|
|
|
db 'x'
|
|
|
|
|
|
|
|
s_compile db 'COMPILE'
|
2007-06-14 16:56:45 +04:00
|
|
|
s_run db ' RUN '
|
|
|
|
s_debug db ' DEBUG '
|
|
|
|
|
|
|
|
s_dbgdescr db 'Generate debug information',0
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2006-11-02 17:18:23 +03:00
|
|
|
infile db 'example.asm'
|
2006-01-03 12:43:31 +03:00
|
|
|
times MAX_PATH+$-infile db 0
|
2006-11-02 17:18:23 +03:00
|
|
|
outfile db 'example'
|
2006-01-03 12:43:31 +03:00
|
|
|
times MAX_PATH+$-outfile db 0
|
2007-06-14 16:56:45 +04:00
|
|
|
path db '/rd/1/'
|
2006-01-03 12:43:31 +03:00
|
|
|
times MAX_PATH+$-path db 0
|
|
|
|
|
|
|
|
lf db 13,10,0
|
|
|
|
|
|
|
|
addr dd 0x0
|
|
|
|
ya dd 0x0
|
|
|
|
zero db 0x0
|
|
|
|
|
|
|
|
mov_param_str:
|
|
|
|
@@:
|
|
|
|
mov al,[esi]
|
|
|
|
cmp al,','
|
2006-07-28 17:39:16 +04:00
|
|
|
je @f
|
2006-01-03 12:43:31 +03:00
|
|
|
cmp al,0
|
2006-07-28 17:39:16 +04:00
|
|
|
je @f
|
2006-01-03 12:43:31 +03:00
|
|
|
mov [edi],al
|
|
|
|
inc esi
|
|
|
|
inc edi
|
|
|
|
jmp @b
|
|
|
|
@@:
|
|
|
|
mov al,0
|
|
|
|
stosb
|
|
|
|
ret
|
|
|
|
|
|
|
|
start:
|
|
|
|
cmp [_mode],NORMAL_MODE
|
|
|
|
jne @f
|
|
|
|
call draw_messages
|
2007-06-14 16:56:45 +04:00
|
|
|
mov [textxy],7 shl 16 + 70
|
2006-01-03 12:43:31 +03:00
|
|
|
@@:
|
|
|
|
mov esi,_logo
|
|
|
|
call display_string
|
|
|
|
|
|
|
|
;
|
|
|
|
; Fasm native code
|
|
|
|
;
|
|
|
|
|
|
|
|
mov [input_file],infile
|
|
|
|
mov [output_file],outfile
|
|
|
|
|
|
|
|
call init_memory
|
|
|
|
|
|
|
|
call make_timestamp
|
|
|
|
mov [start_time],eax
|
|
|
|
|
|
|
|
call preprocessor
|
|
|
|
call parser
|
|
|
|
call assembler
|
2007-06-14 16:56:45 +04:00
|
|
|
cmp [bGenerateDebugInfo], 0
|
|
|
|
jz @f
|
|
|
|
call symbol_dump
|
|
|
|
@@:
|
2006-01-03 12:43:31 +03:00
|
|
|
call formatter
|
|
|
|
|
|
|
|
call display_user_messages
|
|
|
|
movzx eax,[current_pass]
|
|
|
|
inc eax
|
|
|
|
call display_number
|
|
|
|
mov esi,_passes_suffix
|
|
|
|
call display_string
|
|
|
|
call make_timestamp
|
|
|
|
sub eax,[start_time]
|
|
|
|
xor edx,edx
|
|
|
|
mov ebx,100
|
|
|
|
div ebx
|
2006-07-28 17:39:16 +04:00
|
|
|
or eax,eax
|
|
|
|
jz display_bytes_count
|
2006-01-03 12:43:31 +03:00
|
|
|
xor edx,edx
|
|
|
|
mov ebx,10
|
|
|
|
div ebx
|
|
|
|
push edx
|
|
|
|
call display_number
|
|
|
|
mov dl,'.'
|
|
|
|
call display_character
|
|
|
|
pop eax
|
|
|
|
call display_number
|
|
|
|
mov esi,_seconds_suffix
|
|
|
|
call display_string
|
|
|
|
display_bytes_count:
|
|
|
|
mov eax,[written_size]
|
|
|
|
call display_number
|
|
|
|
mov esi,_bytes_suffix
|
|
|
|
call display_string
|
|
|
|
xor al,al
|
|
|
|
|
|
|
|
cmp [_run_outfile],0
|
2007-02-22 11:47:28 +03:00
|
|
|
je @f
|
2006-01-03 12:43:31 +03:00
|
|
|
mov edx,outfile
|
|
|
|
call make_fullpaths
|
2006-10-11 02:15:57 +04:00
|
|
|
mov eax,70
|
2006-01-03 12:43:31 +03:00
|
|
|
mov ebx,file_info_start
|
|
|
|
xor ecx,ecx
|
2007-05-10 17:48:35 +04:00
|
|
|
mcall
|
2006-01-03 12:43:31 +03:00
|
|
|
@@:
|
|
|
|
jmp exit_program
|
|
|
|
|
|
|
|
|
|
|
|
include 'system.inc'
|
|
|
|
include 'version.inc'
|
|
|
|
include 'errors.inc'
|
|
|
|
include 'expressi.inc'
|
|
|
|
include 'preproce.inc'
|
|
|
|
include 'parser.inc'
|
|
|
|
include 'assemble.inc'
|
|
|
|
include 'formats.inc'
|
|
|
|
include 'x86_64.inc'
|
2006-07-28 17:39:16 +04:00
|
|
|
include 'tables.inc'
|
2007-06-14 16:56:45 +04:00
|
|
|
include 'symbdump.inc'
|
2007-12-31 02:34:37 +03:00
|
|
|
include 'messages.inc'
|
2006-01-03 12:43:31 +03:00
|
|
|
|
2007-05-10 17:48:35 +04:00
|
|
|
title db appname,VERSION_STRING,0
|
2006-10-27 11:38:46 +04:00
|
|
|
|
2006-01-03 12:43:31 +03:00
|
|
|
_logo db 'flat assembler version ',VERSION_STRING,13,10,0
|
|
|
|
|
|
|
|
_passes_suffix db ' passes, ',0
|
|
|
|
_seconds_suffix db ' seconds, ',0
|
|
|
|
_bytes_suffix db ' bytes.',13,10,0
|
|
|
|
|
|
|
|
_include db 'INCLUDE',0
|
|
|
|
|
|
|
|
_counter db 4,'0000'
|
|
|
|
|
2006-07-28 17:39:16 +04:00
|
|
|
_mode dd NORMAL_MODE
|
2006-01-03 12:43:31 +03:00
|
|
|
_run_outfile dd 0
|
2007-06-14 16:56:45 +04:00
|
|
|
bGenerateDebugInfo db 0
|
2006-01-03 12:43:31 +03:00
|
|
|
|
|
|
|
sub_table:
|
|
|
|
times $41 db $00
|
|
|
|
times $1A db $20
|
|
|
|
times $25 db $00
|
|
|
|
times $10 db $20
|
|
|
|
times $30 db $00
|
|
|
|
times $10 db $50
|
|
|
|
times $04 db $00,$01
|
|
|
|
times $08 db $00
|
|
|
|
|
|
|
|
;include_debug_strings
|
|
|
|
|
|
|
|
params db 0 ; 'TINYPAD.ASM,TINYPAD,/HD/1/TPAD4/',
|
|
|
|
program_end:
|
|
|
|
rb 1000h
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
include 'variable.inc'
|
|
|
|
|
|
|
|
program_base dd ?
|
|
|
|
buffer_address dd ?
|
|
|
|
memory_setting dd ?
|
|
|
|
start_time dd ?
|
|
|
|
|
2007-12-31 02:34:37 +03:00
|
|
|
predefinitions rb 1000h
|
|
|
|
|
2007-06-14 16:56:45 +04:00
|
|
|
dbgfilename rb MAX_PATH+4
|
|
|
|
|
2006-01-03 12:43:31 +03:00
|
|
|
sc system_colors
|
2007-02-08 19:38:05 +03:00
|
|
|
max_handles = 8
|
|
|
|
fileinfos rb (4+20+MAX_PATH)*max_handles
|
|
|
|
fileinfos_end:
|
2006-01-03 12:43:31 +03:00
|
|
|
pinfo process_information
|
2007-09-20 21:07:33 +04:00
|
|
|
|
|
|
|
align 1000h
|
|
|
|
rb 1000h
|
|
|
|
stacktop:
|