Code Monkey home page Code Monkey logo

asd's People

Contributors

levanvn avatar

asd's Issues

code

; Revert String
include irvine32.inc
.data
; the strings have to be terminated, so ",0" is added:
myMessage BYTE "Enter number : ",0
myMessage1 BYTE "Revert String: ",0

stringin Byte 256 dup (0)
Array DWORD 256 dup (0)
newline BYTE 10,13,0

.code
main proc
mov edx, offset myMessage
call writestring

mov edx, offset stringin
mov ecx, 256
call readstring ; eax = size(string)

mov edi, offset stringin
call ParseUserInput


mov edx, offset newLine    ; add a CrLF here
call writestring

exit
; ParseUserInput function
; In: esi -> Chuoi cac so,
; out: array int
ParseUserInput:
xor ecx,ecx
xor ebp, ebp ; ebp = size of array
mov esi,edi
mov ebx, offset array ;ebx luu offset array
mov edx,esi ; edx = vi tri bat dau cua xau
findstringlen:
mov al,[esi]
cmp al, ' '
jnz tt
;if al = space
mov al, [esi-1]
cmp al,' '; neu truoc khoang trang la so thi ket thuc chuoi
jnz Handle1

inc esi 
jmp findstringlen

tt:
cmp al, 0
jz done
mov al, [esi-1]
cmp al, ' ' ; neu truoc so la khoang trang thi la bat dau cuar chuoi
jnz tt1
mov edx, esi ; luu vi tri bat dau vao edx
tt1:
inc ecx
inc esi
jmp findstringlen

done:
inc ebp
call ParseInteger32 ; returns EAX, CF
mov [ebx],eax
ret

Handle1:
inc ebp
inc esi
; Convert to binary (EDX -> string, ECX = length)
call ParseInteger32 ; returns EAX, CF
mov [ebx],eax
add ebx,4
xor ecx,ecx
jmp findstringlen

exit
main endp
end main

socket

include windows.inc
include winsock2.inc
EXTERN WSAStartup: PROC
EXTERN getaddrinfo: PROC
EXTERN connect: PROC
EXTERN socket: PROC
;EXTERN ExitProcess: PROC
ADDRINFO struct
ai_flags DWORD ?
ai_family DWORD ?
ai_socktype DWORD ?
ai_protocol DWORD ?
ai_addrlen QWORD ?
ai_canonname QWORD ?
ai_addr QWORD ?
ai_next QWORD ?
ADDRINFO ENDS
.data
pIpAddr db "127.0.0.1",0
pPort db "8080",0
wsaDat byte 408 dup (0)
hints ADDRINFO <>
presult qword 0
.code

main proc
mov rcx, 202h
mov rdx, offset wsaDat
call WSAStartup
cmp rax, 0
jne Erro

lea r9, presult
lea r8, hints
lea rdx, pPort
lea rcx, pIpAddr
call getaddrinfo
cmp rax, 0
jne Erro

mov rax, presult
mov r8d, [rax+0ch]; protocol
mov edx, [rax+8]	;type
mov ecx, [rax+4]   ;af

call socket

mov rdx, presult
mov rcx, rax  ;socket
mov rbx, rax
mov r8d, [rdx+10h] ;namelen
mov rdx, [rdx+20h] ; name

call connect
cmp eax, 0
jne  Erro

Erro:
call ExitProcess
main endp
end

1212

Đề bài tuần 2

Bài 1

Viết chương trình cho phép nhập 1 xâu và in chính xâu đó theo thứ tự ngược lại ( tác dụng giống như hàm strrev() trong C). Viết trên cả 2 kiến trúc 32bit và 64bit.

Bài 2

Viết chương trình cho phép nhập 1 dãy số ( tối thiểu 10 số) và in ra dãy số đã được sắp xếp (Tăng dần hoặc giảm dần). Viết trên cả 2 kiến trúc 32bit và 64bit.

Bài 3

Viết chương trình cho phép nhập vào 2 xâu và hiển thị vị trí của xâu thứ hai trong xâu thứ nhất. Nếu không tìm thấy thì trả về -1. Viết trên cả hai kiến trúc 32bit và 64bit

Đề bài tuần 3

Viết chương trình client và chương trình server. Client gửi dữ liệu tới server, server phản hồi lại chính xác những gì client đã gửi. Có mã hóa đường truyền bằng thuật toán XOR. Viết trên kiến trúc 64bit, sử dụng assembly.
Tài liệu tham khảo về client và server: cs556-3rd-tutorial.pdf

Đề bài tuần 4

Viết chương trình cho phép người dùng nhập một đoạn text vào một ô và hiển thị chính đoạn text đó theo thứ tự ngược lại ở ô còn lại. Yêu cầu viết chương trình bằng assembly.
Tài liệu lập trình windows : https://gitlab.visc.com/quangnh14/windows-programming

Đề bài tuần 5

Viết chương trình vẽ một quả bóng trong 1 cửa sổ và quả bóng đó di chuyển theo 1 đường thẳng. Nếu quả bóng gặp cạnh của cửa sổ thì đổi hướng, "nẩy" trở lại. Viết chương trình bằng assembly.

Đề bài tuần 6

Viết chương trình calculator (chế độ standard của windows). Yêu cầu tối thiểu: có các nút nhập số (0 đến 9), các nút toán tử (+ - * / = ), làm được các phép toán đơn giản.
Làm càng giống chương trình gốc càng tốt. Viết chương trình bằng assembly.
ó thể sử dụng resource để tạo các nút. Nếu dùng resource thì tham khảo "Chapter 9: The Concept of Resource—Resource Editors and Compilers" trong sách và hàm DialogBoxParam()

Bài tập bổ sung tuần 6

Bài này là không bắt buộc, trong trường hợp đã làm xong bài Calculator, có thể làm bài sau để được cộng thêm điểm đánh giá.

Hash Calculator: Viết một chương trình có 1 ổ text edit, 1 nút cho phép người dùng chọn file và hiển thị đường dẫn vào ô text edit khi nhấn OK. Người dùng có thể gõ đường dẫn của file vào ô text hoặc chọn bằng nút. Sau khi chọn file xong, một nút bấm khác cho phép tính mã băm của file. Yêu cầu chương trình hỗ trợ MD5 và SHA1. Để tính MD5 hoặc SHA1, có thể sử dụng thư viện Wincrypt của windows : https://msdn.microsoft.com/en-us/library/windows/desktop/aa380252(v=vs.85).aspx

Đề bài tuần 7

Viết chương trình cho phép đọc một file PE bất kì ( hỗ trợ cả 2 loại file PE 32 bit và 64bit), hiển thị cấu trúc của file PE. Lưu ý: Phải có phần import table và export table, không cần thiết làm phần resource.
Giao diện giống như eXeScope. Có thể viết chương trình bằng C hoặc assembly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.