⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fasmd.asm

📁 Fasm - Flat Assmebler
💻 ASM
📖 第 1 页 / 共 4 页
字号:
	cmp	[window_position],0
	je	main_loop
	dec	[window_position]
	jmp	moved_window
  scroll_right:
	inc	[window_position]
	jmp	moved_window
  scroll_up:
	mov	esi,[window_line]
	mov	esi,[esi+4]
	or	esi,esi
	jz	main_loop
	mov	[window_line],esi
	dec	[window_line_number]
	jmp	moved_window
  scroll_down:
	mov	esi,[window_line]
      find_next_window_line:
	mov	esi,[esi]
	btr	esi,0
	jc	find_next_window_line
	or	esi,esi
	jz	main_loop
	mov	[window_line],esi
	inc	[window_line_number]
	jmp	moved_window
  ins_key:
	and	byte [fs:18h],not 80h
	test	byte [fs:17h],11b
	jnz	block_paste
  switch_mode:
	xor	[editor_mode],AEMODE_OVERWRITE
	jmp	main_loop
  switch_blocks:
	xor	[editor_mode],AEMODE_VERTICALSEL
	jmp	main_loop
  block_delete:
	cmp	[was_selection],0
	je	get_command
	call	store_status_for_undo
	call	delete_block
	mov	[selection_line],0
	jmp	operation_done
  block_copy:
	cmp	[was_selection],0
	je	get_command
	call	copy_to_clipboard
	jmp	get_command
    copy_to_clipboard:
	cmp	[clipboard],0
	je	allocate_clipboard
	mov	ebx,[clipboard_handle]
	call	release_memory
    allocate_clipboard:
	call	get_block_length
	inc	ecx
	call	get_memory
	mov	[clipboard],eax
	mov	[clipboard_handle],ecx
	or	eax,eax
	jz	not_enough_memory
	mov	edi,[clipboard]
	call	copy_block
	retn
  block_cut:
	cmp	[was_selection],0
	je	get_command
	call	copy_to_clipboard
	jmp	block_delete
  block_paste:
	call	store_status_for_undo
	cmp	[was_selection],0
	je	paste_secureselection_ok
	test	[editor_style],AES_SECURESEL
	jnz	paste_secureselection_ok
	call	delete_block
    paste_secureselection_ok:
	mov	esi,[clipboard]
	or	esi,esi
	jz	operation_done
	call	insert_block
	jc	paste_failed
	test	[editor_style],AES_SECURESEL
	jz	no_selection_after_paste
	mov	eax,[caret_line]
	mov	ecx,[caret_line_number]
	mov	edx,[caret_position]
	xchg	eax,[selection_line]
	xchg	ecx,[selection_line_number]
	xchg	edx,[selection_position]
	mov	[caret_line],eax
	mov	[caret_line_number],ecx
	mov	[caret_position],edx
	jmp	operation_done
    no_selection_after_paste:
	mov	[selection_line],0
	jmp	operation_done
    paste_failed:
	call	undo_changes
	jmp	operation_done
  undo:
	cmp	[undo_data],0
	je	get_command
	call	undo_changes
	mov	[last_operation],0
	jmp	operation_done
  select_all:
	or	eax,-1
	call	find_line
	mov	[caret_line],esi
	mov	[caret_line_number],ecx
	call	check_line_length
	mov	[caret_position],ecx
	mov	eax,1
	call	find_line
	mov	[selection_line],esi
	mov	[selection_line_number],ecx
	mov	[selection_position],0
	jmp	operation_done
  ascii_table:
	call	ascii_table_window
	jc	main_loop
	jmp	character

  moved_caret:
	test	byte [fs:17h],11b
	jnz	operation_done
	mov	[selection_line],0
	jmp	operation_done
  text_modified:
	cmp	[was_selection],0
	jne	operation_done
	mov	[selection_line],0
  operation_done:
	call	update_positions
	call	let_caret_appear
	call	update_window
	jmp	main_loop
  moved_window:
	call	update_positions
	cmp	[was_selection],0
	jne	main_loop
	mov	[selection_line],0
	jmp	main_loop

  new_editor:
	call	create_editor_instance
	jmp	main_loop
  close_editor:
	mov	[command_flags],1
	jmp	closing_loop
  close_all:
	mov	[command_flags],0
    closing_loop:
	cmp	[undo_data],0
	je	do_close
	mov	esi,[file_path]
	call	get_file_title
	mov	ebx,esi
	mov	esi,_saving_question
	mov	eax,2 shl 24
	mov	ax,[message_box_colors]
	mov	[first_button],_yes
	mov	[second_button],_no
	call	message_box
	cmp	eax,1
	jb	main_loop
	ja	do_close
	cmp	[file_path],0
	jne	save_before_closing
	call	get_saving_path
	jc	main_loop
    save_before_closing:
	call	save_file
	jc	main_loop
    do_close:
	call	remove_editor_instance
	jc	exit
	test	[command_flags],1
	jnz	main_loop
	call	update_cursor
	call	update_screen
	jmp	closing_loop
  switch_editor:
	test	byte [fs:17h],11b
	jnz	previous_editor
	mov	eax,[next_instance]
	or	eax,eax
	jnz	do_switch
	mov	eax,[previous_instance]
	or	eax,eax
	jz	get_command
    find_first_editor:
	mov	ebx,[eax+16+previous_instance-editor_data]
	or	ebx,ebx
	jz	do_switch
	mov	eax,ebx
	jmp	find_first_editor
    do_switch:
	call	switch_editor_instance
	jmp	main_loop
    previous_editor:
	mov	eax,[previous_instance]
	or	eax,eax
	jnz	do_switch
	mov	eax,[next_instance]
	or	eax,eax
	jz	get_command
    find_last_editor:
	mov	ebx,[eax+16+next_instance-editor_data]
	or	ebx,ebx
	jz	do_switch
	mov	eax,ebx
	jmp	find_last_editor
  select_editor:
	mov	eax,[editor_memory]
	mov	edx,[previous_instance]
    prepare_for_editor_counting:
	or	edx,edx
	jz	find_selected_editor
	mov	eax,edx
	mov	edx,[edx+16+previous_instance-editor_data]
	jmp	prepare_for_editor_counting
    find_selected_editor:
	dec	ecx
	jz	selected_editor_found
	mov	eax,[eax+16+next_instance-editor_data]
	or	eax,eax
	jz	get_command
	jmp	find_selected_editor
    selected_editor_found:
	cmp	eax,[editor_memory]
	je	get_command
	jmp	do_switch
  show_user_screen:
	call	switch_to_user_screen
	mov	ah,10h
	int	16h
	call	switch_to_ide_screen
	jmp	main_loop

  save_current:
	cmp	[file_path],0
	jne	do_save
  save_as:
	call	get_saving_path
	jc	main_loop
      do_save:
	call	save_file
	jmp	main_loop
  open_file:
	mov	esi,_open
	call	file_open_dialog
	jc	main_loop
	call	load_file
	jmp	main_loop
  goto:
	call	goto_dialog
	jc	main_loop
	or	edx,edx
	jz	goto_position_ok
	dec	edx
	mov	[caret_position],edx
	mov	[selection_position],edx
      goto_position_ok:
	or	ecx,ecx
	jz	goto_line_ok
	mov	eax,ecx
	call	find_line
	mov	[caret_line],esi
	mov	[selection_line],esi
	mov	[caret_line_number],ecx
	mov	[selection_line_number],ecx
      goto_line_ok:
	call	update_positions
	call	let_caret_appear
	call	update_window
	jmp	main_loop
  search:
	call	find_dialog
	jc	main_loop
	call	find_first
	jc	not_found
      show_found_text:
	mov	eax,[caret_position]
	xchg	eax,[selection_position]
	mov	[caret_position],eax
	call	update_positions
	call	let_caret_appear
	call	update_window
	mov	eax,[caret_position]
	xchg	eax,[selection_position]
	mov	[caret_position],eax
	jmp	main_loop
  replace:
	call	replace_dialog
	jc	main_loop
	push	edi
	call	find_first
	jc	not_found
	call	store_status_for_undo
      replace_loop:
	call	delete_block
	mov	esi,[esp]
	call	insert_block
	call	find_next
	jnc	replace_loop
	call	update_positions
	call	let_caret_appear
	call	update_window
	jmp	main_loop
  search_next:
	cmp	[search_data],0
	je	main_loop
	call	find_next
	jnc	show_found_text
      not_found:
	call	update_screen
	mov	esi,_not_found
	mov	ebx,_find
	movzx	eax,[message_box_colors]
	call	message_box
	jmp	main_loop
  compile:
	mov	[command_flags],0
	jmp	do_compile
  compile_and_run:
	mov	[command_flags],1
      do_compile:
	push	[editor_memory]
	mov	eax,[main_project_file]
	or	eax,eax
	jz	got_main_file
	call	switch_editor_instance
      got_main_file:
	cmp	[file_path],0
	jne	main_file_path_ok
	call	update_screen
	call	get_saving_path
	jc	main_loop
	call	update_screen
      main_file_path_ok:
	mov	eax,[editor_memory]
	push	eax
      find_first_to_save:
	mov	edx,[eax+16+previous_instance-editor_data]
	or	edx,edx
	jz	save_all_files
	mov	eax,edx
	jmp	find_first_to_save
      save_all_files:
	call	switch_editor_instance
	cmp	[file_path],0
	je	save_next
	cmp	[undo_data],0
	je	save_next
	call	save_file
	jc	main_loop
      save_next:
	mov	eax,[next_instance]
	or	eax,eax
	jnz	save_all_files
	pop	eax
	call	switch_editor_instance
	mov	esi,[file_path]
	mov	edi,buffer
	mov	ebx,edi
      copy_directory_path:
	lodsb
	or	al,al
	jz	directory_path_ok
	stosb
	cmp	al,'\'
	jne	copy_directory_path
	mov	ebx,edi
	jmp	copy_directory_path
      directory_path_ok:
	mov	byte [ebx],0
	mov	ah,0Eh
	mov	dl,[buffer]
	sub	dl,'A'
	cmp	dl,'Z'-'A'
	jbe	directory_drive_ok
	sub	dl,'a'-'A'
      directory_drive_ok:
	int	21h
	xor	dx,dx
	mov	ax,713Bh
	call	dos_int
	cmp	ax,7100h
	jne	compilation_directory_ok
	mov	ah,3Bh
	call	dos_int
      compilation_directory_ok:
	mov	eax,[file_path]
	mov	[input_file],eax
	pop	eax
	call	switch_editor_instance
	mov	cx,1000h
	mov	ah,1
	int	10h
	mov	esi,_compile
	mov	cx,0316h
	mov	ah,[window_colors]
	call	draw_centered_window
	add	edi,2
	mov	[progress_offset],edi
	mov	ax,500h
	mov	edi,buffer
	int	31h
	mov	eax,[edi]
      allocate_memory:
	mov	ecx,eax
	mov	edx,eax
	shr	edx,2
	sub	eax,edx
	mov	[memory_end],eax
	mov	[additional_memory_end],edx
	call	get_memory
	or	eax,eax
	jnz	memory_allocated
	mov	eax,[additional_memory_end]
	shl	eax,1
	cmp	eax,4000h
	jb	not_enough_memory
	jmp	allocate_memory
      memory_allocated:
	mov	[allocated_memory],ebx
	mov	[memory_start],eax
	add	eax,[memory_end]
	mov	[memory_end],eax
	mov	[additional_memory],eax
	add	[additional_memory_end],eax
	xor	eax,eax
	mov	[output_file],eax
	mov	[display_length],eax
	mov	[stack_limit],stack_bottom
	mov	[passes_limit],100
	mov	ax,204h
	mov	bl,9
	int	31h
	mov	dword [keyboard_handler],edx
	mov	word [keyboard_handler+4],cx
	mov	ax,205h
	mov	bl,9
	mov	cx,cs
	mov	edx,aborting_handler
	int	31h
	mov	eax,[fs:6Ch]
	mov	[start_time],eax
	call	preprocessor
	call	draw_progress_segment
	call	parser
	call	draw_progress_segment
	call	assembler
	call	draw_progress_segment
	call	formatter
	call	draw_progress_segment
	mov	ax,205h
	mov	bl,9
	mov	edx,dword [keyboard_handler]
	mov	cx,word [keyboard_handler+4]
	int	31h
	test	[command_flags],1
	jnz	execute
	call	flush_display_buffer
	call	update_screen
	mov	edi,buffer
	movzx	eax,[current_pass]
	inc	eax
	call	number_as_text
	mov	eax,' pas'
	stosd
	mov	eax,'ses,'
	stosd
	mov	al,20h
	stosb
	mov	eax,[fs:6Ch]
	sub	eax,[start_time]
	mov	ebx,100
	mul	ebx
	mov	ebx,182
	div	ebx
	or	eax,eax
	jz	show_bytes_count
	xor	edx,edx
	mov	ebx,10
	div	ebx
	push	edx
	call	number_as_text
	mov	al,'.'
	stosb
	pop	eax
	call	number_as_text
	mov	eax,' sec'
	stosd
	mov	eax,'onds'
	stosd
	mov	ax,', '
	stosw
      show_bytes_count:
	mov	eax,[written_size]
	call	number_as_text
	mov	eax,' byt'
	stosd
	mov	eax,'es.'
	stosd
	mov	ebx,[allocated_memory]
	call	release_memory
	mov	esi,buffer
	mov	ebx,_compile
	movzx	eax,[message_box_colors]
	mov	[first_button],_ok
	mov	[second_button],_get_display
	cmp	[display_length],0
	je	show_compilation_summary
	or	eax,2 shl 24
      show_compilation_summary:
	call	message_box
	cmp	eax,2
	jb	main_loop
	cmp	[clipboard],0
	je	get_display_to_clipboard
	mov	ebx,[clipboard_handle]
	call	release_memory
      get_display_to_clipboard:
	mov	ecx,[display_length]
	inc	ecx
	call	get_memory
	mov	[clipboard_handle],ebx
	mov	[clipboard],eax
	or	eax,eax
	jz	not_enough_memory
	xor	esi,esi
	mov	edi,eax
	mov	ecx,[display_length]
	push	ds
	mov	ds,[low_memory_selector]
	rep	movsb
	pop	ds
	xor	al,al
	stosb
	jmp	main_loop
    execute:
	mov	edx,[output_file]
	call	adapt_path
	mov	ebx,[allocated_memory]
	call	release_memory
	cmp	[output_format],3
	ja	cannot_execute
	call	release_low_memory
	call	switch_to_user_screen
	call	close_video
	mov	edi,buffer+200h
	lea	edx,[edi-buffer]
	mov	ax,0D00h
	stosw
	lea	ebx,[edi-buffer]
	xor	eax,eax
	stosw
	mov	ax,buffer_segment
	shl	eax,16
	mov	ax,dx
	stosd
	xor	eax,eax
	stosd
	stosd
	mov	ax,4B00h
	xor	dx,dx
	call	dos_int
	call	init_video
	jc	startup_failed
	call	switch_to_ide_screen
	call	get_low_memory
	jmp	main_loop
      cannot_execute:
	mov	esi,_not_executable
	mov	ebx,_error
	movzx	eax,[error_box_colors]
	call	message_box
	jmp	main_loop
    draw_progress_segment:
	mov	eax,[progress_offset]
	mov	ecx,4
      draw_progress_filler:
	mov	byte [gs:eax],254
	add	eax,2
	loop	draw_progress_filler
	mov	[progress_offset],eax
	ret
    aborting_handler:
	push	eax
	in	al,60h
	cmp	al,1
	jne	no_abort
	mov	dword [esp+4],abort_compiling
	mov	word [esp+4+4],cs
      no_abort:
	pop	eax
	jmp	pword [cs:keyboard_handler]
      abort_compiling:
	cli
	mov	ax,[cs:main_selector]
	mov	esp,stack_top
	mov	ss,ax
	mov	ds,ax
	mov	es,ax
	mov	fs,[bios_selector]
	mov	gs,[video_selector]
	mov	ax,205h
	mov	bl,9
	mov	edx,dword [keyboard_handler]
	mov	cx,word [keyboard_handler+4]
	int	31h
	sti
      discard_keyboard_buffer:
	mov	ah,11h
	int	16h
	jz	keyboard_buffer_ok
	mov	ah,10h
	int	16h
	jmp	discard_keyboard_buffer
      keyboard_buffer_ok:
	mov	ebx,[allocated_memory]
	call	release_memory
	jmp	main_loop
  assign_to_compiler:
	mov	eax,[editor_memory]
	xchg	eax,[main_project_file]
	cmp	eax,[editor_memory]
	jne	main_loop
	mov	[main_project_file],0
	jmp	main_loop
  options:
	push	[editor_style]
	call	options_dialog
	pop	eax
	jnc	main_loop
	mov	[editor_style],eax
	jmp	main_loop

  startup_failed:
	mov	esi,_startup_failed
      error_message_loop:
	lodsb
	or	al,al
	jz	error_message_ok
	mov	dl,al
	mov	ah,2
	int	21h
	jmp	error_message_loop
      error_message_ok:
	mov	ax,4C0Fh
	int	21h

  exit:
	call	switch_to_user_screen
	mov	ax,4C00h
	int	21h

  init_video:
	call	check_video_mode
	mov	bx,gs
	movzx	edx,byte [fs:4Ah]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -