update
This commit is contained in:
parent
7da2e9886a
commit
6428bd0a08
Binary file not shown.
|
Before Width: | Height: | Size: 67 KiB |
@ -4,12 +4,31 @@
|
||||
^F:\CODING\C++\ZASM\MAIN.CPP
|
||||
/c /ZI /JMC /nologo /W3 /WX- /diagnostics:column /sdl /Od /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /permissive- /Fo"X64\DEBUG\\" /Fd"X64\DEBUG\VC143.PDB" /external:W3 /Gd /TP /FC F:\CODING\C++\ZASM\MAIN.CPP
|
||||
|
||||
cl /c /ZI /JMC /nologo /W3 /WX- /diagnostics:column /sdl /Od /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /permissive- /Fo"X64\DEBUG\\" /Fd"X64\DEBUG\VC143.PDB" /external:W3 /Gd /TP /FC D:\CODE\C++\ZASM\MAIN.CPP
|
||||
```
|
||||
|
||||
```shell
|
||||
cl -c -nologo -O2 -fp:fast /EHsc -DNDEBUG -Fobuild\.objs\xasm\windows\x64\release\src\main.cpp.obj src\main.cpp
|
||||
```
|
||||
|
||||
|
||||
|
||||
# Xmake
|
||||
|
||||
```shell
|
||||
./cl.exe -c -nologo -O2 -fp:fast /EHsc -DNDEBUG -Fobuild\.objs\xasm\windows\x64\release\src\main.cpp.obj src\main.cpp
|
||||
xmake config -y -P . -p windows -m debug -a x64 -o "build"
|
||||
xmake build -y -P . -w "zasm"
|
||||
cl -c -nologo -O2 -fp:fast /EHsc -DNDEBUG -Fobuild\.objs\xasm\windows\x64\release\src\main.cpp.obj src\main.cpp
|
||||
link -nologo -dynamicbase -nxcompat -machine:x64 /opt:ref /opt:icf -out:build\xasm.exe build\main.obj
|
||||
```
|
||||
|
||||
|
||||
|
||||
```shell
|
||||
#还需要在代码里设置环境变量
|
||||
cl -c -nologo -O2 -fp:fast /EHsc -DNDEBUG -Fobuild\.objs\xasm\windows\x64\release\src\main.cpp.obj src\main.cpp
|
||||
link -nologo -dynamicbase -nxcompat -machine:x64 /opt:ref /opt:icf -out:build\xasm.exe build\main.obj
|
||||
|
||||
[ 25%]: cache compiling.release src\main.cpp
|
||||
"D:\\Microsoft Visual Studio\\VS2022\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX64\\x64\\cl.exe" -c -nologo -O2 -fp:fast /EHsc -DNDEBUG -Fobuild\.objs\xasm\windows\x64\release\src\main.cpp.obj src\main.cpp
|
||||
[ 50%]: linking.release xasm.exe
|
||||
|
||||
80
专业积累/工具/devops/Docker.md
Normal file
80
专业积累/工具/devops/Docker.md
Normal file
@ -0,0 +1,80 @@
|
||||
# Centos 安装
|
||||
|
||||
## 卸载
|
||||
|
||||
```shell
|
||||
yum list installed | grep docker
|
||||
|
||||
yum -y remove docker-ce-cli.x86_64
|
||||
yum -y remove docker-ce.x86_64
|
||||
yum -y remove containerd.io
|
||||
```
|
||||
|
||||
## 安装
|
||||
|
||||
```shell
|
||||
#安装依赖
|
||||
yum install -y yum-utils device-mapper-persistent-data lvm2
|
||||
yum-config-manager --add-repo https://mirrors.cloud.tencent.com/docker-ce/linux/centos/docker-ce.repo
|
||||
#安装最新版
|
||||
yum install -y docker-ce docker-ce-cli containerd.io
|
||||
|
||||
#验证版本
|
||||
docker version
|
||||
```
|
||||
|
||||
## 多容器
|
||||
|
||||
```shell
|
||||
pip install docker-compose
|
||||
```
|
||||
|
||||
|
||||
|
||||
# 配置
|
||||
|
||||
```shell
|
||||
#启动
|
||||
systemctl start docker
|
||||
#设置开机启动
|
||||
systemctl enable docker
|
||||
#查看运行状态
|
||||
service docker status
|
||||
|
||||
#创建配置目录
|
||||
mkdir -p /etc/docker
|
||||
#添加配置
|
||||
tee /etc/docker/daemon.json <<-'EOF'
|
||||
{
|
||||
"registry-mirrors": ["https://mirror.ccs.tencentyun.com"]
|
||||
}
|
||||
EOF
|
||||
#重启进程
|
||||
systemctl daemon-reload && systemctl restart docker
|
||||
```
|
||||
|
||||
# 运行
|
||||
|
||||
```shell
|
||||
#拉去 hello-world镜像 创建hello容器
|
||||
docker run --name=hello hello-world
|
||||
#查看容器
|
||||
docker ps -a
|
||||
#查看镜像
|
||||
docker images
|
||||
#拉取镜像
|
||||
docker pull johngong/calibre-web
|
||||
#创建容器
|
||||
docker create --name=calibre-web -p 80:8083 -v /data/calibre-web/library:/library -e WEBLANGUAGE=zh_CN johngong/calibre-web
|
||||
#启动容器
|
||||
docker start calibre-web
|
||||
docker stop calibre-web
|
||||
docker kill calibre-web
|
||||
#删除容器
|
||||
docker rm -f hello
|
||||
#删除镜像
|
||||
docker rmi hello-world
|
||||
#删除所有镜像
|
||||
docker images -q
|
||||
docker rmi `docker images -q`
|
||||
```
|
||||
78
专业积累/工具/devops/LNMP 镜像.md
Normal file
78
专业积累/工具/devops/LNMP 镜像.md
Normal file
@ -0,0 +1,78 @@
|
||||
# LNMP
|
||||
|
||||
```shell
|
||||
docker pull nginx:alpine
|
||||
docker pull php:7-fpm-alpine
|
||||
docker pull postgres:alpine
|
||||
|
||||
docker run --rm -d -p 80:80 --name nginx nginx:alpine
|
||||
```
|
||||
|
||||
# 配置
|
||||
|
||||
## 全局
|
||||
|
||||
```shell
|
||||
touch ~/docker/docker-compose.yml
|
||||
touch ~/docker/nginx.conf
|
||||
```
|
||||
|
||||
```yaml
|
||||
version: "3"
|
||||
services:
|
||||
|
||||
Nginx:
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- 80:80
|
||||
volumes:
|
||||
- ./web:/usr/share/nginx/html:ro
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
|
||||
PHP:
|
||||
image: undefined01/php:7-fpm-alpine
|
||||
volumes:
|
||||
- ./web:/var/www/html:rw
|
||||
|
||||
Database:
|
||||
image: postgres:alpine
|
||||
environment:
|
||||
POSTGRES_USER: "postgres"
|
||||
POSTGRES_PASSWORD: "rootroot"
|
||||
volumes:
|
||||
- ./data:/var/lib/postgresql/data:rw
|
||||
```
|
||||
|
||||
```yaml
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.php index.html index.htm;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass PHP:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# 运行
|
||||
|
||||
```shell
|
||||
#启动
|
||||
docker-compose up -d
|
||||
#查看
|
||||
docker container ls
|
||||
```
|
||||
|
||||
7
专业积累/工具/devops/devops.md
Normal file
7
专业积累/工具/devops/devops.md
Normal file
@ -0,0 +1,7 @@
|
||||
# 版本工具
|
||||
|
||||
## git
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
@ -52,3 +52,21 @@ git:x:500:500::/home/git:/usr/local/git/bin/git-shell
|
||||
git clone git@175.24.226.114:/data/repositories/zlib.git
|
||||
```
|
||||
|
||||
# 客户端
|
||||
|
||||
```shell
|
||||
#设置
|
||||
git config --global user.email ouczbs@qq.com
|
||||
git config --global user.name ouczbs
|
||||
git config --global push.default simple
|
||||
|
||||
git remote set-url origin git@175.24.226.114:ouczbs/docker.git
|
||||
git remote -v
|
||||
|
||||
git diff
|
||||
git log .
|
||||
git add .
|
||||
git commit m "push commit"
|
||||
git push
|
||||
```
|
||||
|
||||
|
||||
261
专业积累/工具/xmake/xmake 解析.md
Normal file
261
专业积累/工具/xmake/xmake 解析.md
Normal file
@ -0,0 +1,261 @@
|
||||
# xmake
|
||||
|
||||
## option
|
||||
|
||||
```lua
|
||||
-- core/base/task.lua
|
||||
function task.common_options()
|
||||
if not task._COMMON_OPTIONS then
|
||||
task._COMMON_OPTIONS =
|
||||
{
|
||||
{'q', "quiet", "k", nil, "Quiet operation." }
|
||||
, {'y', "yes", "k", nil, "Input yes by default if need user confirm." }
|
||||
, {nil, "confirm", "kv", nil, "Input the given result if need user confirm."
|
||||
, values = function ()
|
||||
return {"yes", "no", "def"}
|
||||
end }
|
||||
, {'v', "verbose", "k", nil, "Print lots of verbose information for users." }
|
||||
, {nil, "root", "k", nil, "Allow to run xmake as root." }
|
||||
, {'D', "diagnosis", "k", nil, "Print lots of diagnosis information (backtrace, check info ..) only for developers."
|
||||
, "And we can append -v to get more whole information."
|
||||
, " e.g. $ xmake -vD" }
|
||||
, {nil, "version", "k", nil, "Print the version number and exit." }
|
||||
, {'h', "help", "k", nil, "Print this help message and exit." }
|
||||
, {}
|
||||
, {'F', "file", "kv", nil, "Read a given xmake.lua file." }
|
||||
, {'P', "project", "kv", nil, "Change to the given project directory."
|
||||
, "Search priority:"
|
||||
, " 1. The Given Command Argument"
|
||||
, " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
|
||||
, " 3. The Current Directory" }
|
||||
, {category = "action"}
|
||||
}
|
||||
end
|
||||
return task._COMMON_OPTIONS
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
```lua
|
||||
-- core/base/option.lua
|
||||
-- parse arguments with the given options
|
||||
function option.parse(argv, options, opt)
|
||||
-- run parser
|
||||
local pargs = cli.parsev(argv, flags)
|
||||
--...
|
||||
end
|
||||
```
|
||||
|
||||
## task
|
||||
|
||||
- build
|
||||
- config
|
||||
-
|
||||
|
||||
```lua
|
||||
-- core/base/task.lua
|
||||
-- the menu
|
||||
function task.menu(tasks)
|
||||
-- make menu
|
||||
local menu = {}
|
||||
for taskname, taskinst in pairs(tasks) do
|
||||
|
||||
-- has task menu?
|
||||
local taskmenu = taskinst:get("menu")
|
||||
-- main?
|
||||
if taskinst:get("category") == "main" then
|
||||
|
||||
-- delay to load main menu
|
||||
menu.main = function ()
|
||||
|
||||
-- translate main menu
|
||||
local mainmenu, errors = task._translate_menu(taskmenu)
|
||||
if not mainmenu then
|
||||
os.raise(errors)
|
||||
end
|
||||
|
||||
-- make tasks for the main menu
|
||||
mainmenu.tasks = {}
|
||||
for name, inst in pairs(tasks) do
|
||||
-- has menu?
|
||||
local m = inst:get("menu")
|
||||
-- add task
|
||||
mainmenu.tasks[name] =
|
||||
{
|
||||
category = inst:get("category"),
|
||||
shortname = m.shortname,
|
||||
description = m.description
|
||||
}
|
||||
end
|
||||
-- ok
|
||||
return mainmenu
|
||||
end
|
||||
-- delay to load task menu
|
||||
menu[taskname] = function ()
|
||||
local taskmenu, errors = task._translate_menu(taskmenu)
|
||||
return taskmenu
|
||||
end
|
||||
end
|
||||
-- ok?
|
||||
return menu
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
## config
|
||||
|
||||
- global
|
||||
- "C:\Users\ouczbs\AppData\Local\.xmake\xmake.conf"
|
||||
- local
|
||||
- D:\ZEngine\.xmake\windows\x64
|
||||
|
||||
```lua
|
||||
-- core/base/global.lua
|
||||
-- get the configure file
|
||||
function global.filepath()
|
||||
return path.join(global.directory(), xmake._NAME .. ".conf")
|
||||
end
|
||||
-- load the global configuration
|
||||
function global.load()
|
||||
-- load configure from the file first
|
||||
local filepath = global.filepath()
|
||||
-- load configs
|
||||
local results, errors = io.load(filepath)
|
||||
|
||||
-- merge the configure
|
||||
for name, value in pairs(results) do
|
||||
if global.get(name) == nil then
|
||||
global.set(name, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
## theme
|
||||
|
||||
```lua
|
||||
-- core/base/theme.lua
|
||||
|
||||
-- load the given theme
|
||||
function theme.load(name)
|
||||
-- find the theme script path
|
||||
local scriptpath = nil
|
||||
if name then
|
||||
for _, dir in ipairs(theme.directories()) do
|
||||
scriptpath = path.join(dir, name, "xmake.lua")
|
||||
if os.isfile(scriptpath) then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- not exists? uses the default theme
|
||||
if not scriptpath or not os.isfile(scriptpath) then
|
||||
scriptpath = path.join(os.programdir(), "themes", "default", "xmake.lua")
|
||||
end
|
||||
|
||||
-- get interpreter
|
||||
local interp = theme._interpreter()
|
||||
|
||||
-- load script
|
||||
local ok, errors = interp:load(scriptpath)
|
||||
if not ok then
|
||||
return nil, errors
|
||||
end
|
||||
|
||||
-- load theme
|
||||
local results, errors = interp:make("theme", true, false)
|
||||
if not results and os.isfile(scriptpath) then
|
||||
return nil, errors
|
||||
end
|
||||
|
||||
-- get result
|
||||
local result = results[name]
|
||||
if not result then
|
||||
return nil, string.format("the theme %s not found!", name)
|
||||
end
|
||||
|
||||
-- new an instance
|
||||
local instance, errors = _instance.new(name, result, interp:rootdir())
|
||||
if not instance then
|
||||
return nil, errors
|
||||
end
|
||||
|
||||
-- save the current theme instance
|
||||
theme._THEME = instance
|
||||
return instance
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
## main
|
||||
|
||||
```lua
|
||||
--core/_xmake_main.lua
|
||||
-- load modules
|
||||
local main = require("main")
|
||||
|
||||
-- the main function
|
||||
function _xmake_main()
|
||||
return main.entry()
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
```lua
|
||||
--core/main.lua
|
||||
function main.entry()
|
||||
-- init
|
||||
local ok, errors = main._init()
|
||||
--[[
|
||||
-- core/base/option.lua
|
||||
-- parse options
|
||||
option.parse(xmake._COMMAND_ARGV, task.common_options(), { allow_unknown = true })
|
||||
|
||||
-- core/base/task.lua
|
||||
--load task
|
||||
option._translate(menu)
|
||||
task.menu(xmake._COMMAND_ARGV, task.common_options(), { allow_unknown = true })
|
||||
]]
|
||||
-- load global configuration
|
||||
ok, errors = global.load()
|
||||
--[[
|
||||
-- core/base/global.lua
|
||||
-- load config
|
||||
global.load()
|
||||
]]
|
||||
-- load theme
|
||||
local theme_inst = theme.load(os.getenv("XMAKE_THEME") or global.get("theme")) or theme.load("default")
|
||||
colors.theme_set(theme_inst)
|
||||
|
||||
-- init option
|
||||
ok, errors = option.init(menu)
|
||||
--[[
|
||||
-- core/base/global.lua
|
||||
-- load config
|
||||
task.menu()
|
||||
option.parse(xmake._COMMAND_ARGV, options, { populate_defaults = false })
|
||||
]]
|
||||
|
||||
-- show help?
|
||||
if main._show_help() then
|
||||
return main._exit(true)
|
||||
end
|
||||
|
||||
-- get task instance
|
||||
local taskname = option.taskname() or "build"
|
||||
local taskinst = task.task(taskname) or project.task(taskname)
|
||||
|
||||
-- run task
|
||||
scheduler:enable(true)
|
||||
scheduler:co_start_named("xmake " .. taskname, function ()
|
||||
local ok, errors = taskinst:run()
|
||||
end)
|
||||
ok, errors = scheduler:runloop()
|
||||
end
|
||||
```
|
||||
|
||||
12
专业积累/库/C++/spdlog.md
Normal file
12
专业积累/库/C++/spdlog.md
Normal file
@ -0,0 +1,12 @@
|
||||
# 源码
|
||||
|
||||
[github](https://github.com/gabime/spdlog)
|
||||
|
||||
# 使用
|
||||
|
||||
## 输出格式
|
||||
|
||||
通过`set_pattern`可设定日志格式,如`set_pattern("[%Y-%m-%d %H:%M:%S.%e][%l](%@): %v");`
|
||||
|
||||
|
||||
|
||||
38
日常积累/工具/Anki/Anki.md
Normal file
38
日常积累/工具/Anki/Anki.md
Normal file
@ -0,0 +1,38 @@
|
||||
# 插件
|
||||
|
||||
[官网](https://ankiweb.net/shared/info/1020366288)
|
||||
|
||||
- 热力图
|
||||
- Review Headmap
|
||||
- 1771074083
|
||||
- 制卡
|
||||
- AnkiConnect
|
||||
- 2055492159
|
||||
- 同步
|
||||
- ankisyncd
|
||||
- 自建服务器
|
||||
|
||||
- 硬链接
|
||||
|
||||
- ```shell
|
||||
mklink \J D:\ouczbs\docker\anki\anki-word-query\fastwq C:\Users\ouczbs\AppData\Roaming\Anki2\addons21\fastwq
|
||||
```
|
||||
|
||||
-
|
||||
|
||||
# 共享词库
|
||||
|
||||
[官网](https://ankiweb.net/shared/decks/math)
|
||||
|
||||
- 音标
|
||||
- 数学
|
||||
- 驾照
|
||||
- 计算机
|
||||
- Git
|
||||
|
||||
# 第三方工具
|
||||
|
||||
## 浏览器
|
||||
|
||||
- Anki 划词制卡助手
|
||||
-
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
## 目录
|
||||
|
||||
`mkdir /data && mkdir /data/jupyter && cd /data/jupyter`
|
||||
`mkdir /data/jupyter && cd /data/jupyter`
|
||||
|
||||
# Conda
|
||||
|
||||
@ -70,16 +70,26 @@ trusted-host = mirrors.tencentyun.com
|
||||
```shell
|
||||
#无后台启动
|
||||
nohup jupyter notebook --allow-root > /data/jupyter.log 2>&1 &
|
||||
|
||||
%%writefile /etc/systemd/system/jupyter.service
|
||||
[Unit]
|
||||
Description=Jupyter Notebook
|
||||
After=network.target
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=nohup jupyter notebook --allow-root > /data/jupyter.log 2>&1 &
|
||||
#ExecStart 是执行文件
|
||||
ExecStart=/root/miniconda3/bin/jupyter-notebook --config=/root/.jupyter/jupyter_notebook_config.py --allow-root
|
||||
#文件路径名
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
```shell
|
||||
ps -a 显示进程pid
|
||||
kill -9 pid 终止进程
|
||||
#开机自启
|
||||
|
||||
systemctl enable jupyter.service
|
||||
service jupyter start
|
||||
```
|
||||
10
程序开发/游戏开发/UE4/源码编译.md
Normal file
10
程序开发/游戏开发/UE4/源码编译.md
Normal file
@ -0,0 +1,10 @@
|
||||
# 下载
|
||||
|
||||
```python
|
||||
#下载 realease 包
|
||||
#解压
|
||||
#运行 startup.bat
|
||||
#运行 GenerateProjectFiles.bat
|
||||
#VS 编译
|
||||
```
|
||||
|
||||
198
程序开发/编程语言/汇编/汇编语言.md
Normal file
198
程序开发/编程语言/汇编/汇编语言.md
Normal file
@ -0,0 +1,198 @@
|
||||
# CPU架构
|
||||
|
||||
## 总线接口单元
|
||||
|
||||
实现指令的读取功能
|
||||
|
||||
实现数据的读取写入功能
|
||||
|
||||
### 数据总线
|
||||
|
||||
字节编址:`1Byte = 8Bit`
|
||||
|
||||
总线编码: 20Bit,支持1MB的存储大小
|
||||
|
||||
寄存器:16Bit,仅能描述64KB大小
|
||||
|
||||
基寄存器 * 16 + 偏移寄存器 = 总线地址
|
||||
|
||||
### 段寄存器
|
||||
|
||||
1MB的空间分段,每段大小不超过64KB,段地址即16位寄存器地址 * 16
|
||||
|
||||
程序多次运行,变化的是段寄存器,逻辑地址保持不变
|
||||
|
||||
段之间可以分开也可以重合,取决于数据如何存储
|
||||
|
||||
- CS
|
||||
- 存放指令的代码段地址
|
||||
- DS
|
||||
- 存放数据的数据段地址
|
||||
- SS
|
||||
- 程序堆栈段地址
|
||||
- ES
|
||||
- 附加段寄存器
|
||||
- IP
|
||||
- 专用寄存器,指令偏移地址
|
||||
- 仅由跳转类指令间接控制
|
||||
|
||||
- 内部寄存器
|
||||
|
||||
### 指令队列
|
||||
|
||||
六字节,先进先出,跳转时刷新整个队列
|
||||
|
||||
## 执行单元
|
||||
|
||||
对指令进行译码,并执行
|
||||
|
||||
### 通用寄存器
|
||||
|
||||
寄存器描述的地址都是偏移地址,每次运行的偏移地址保持不变
|
||||
|
||||
- AH + AL = AX
|
||||
- 累加器
|
||||
- BH + BL = BX
|
||||
- 基址寄存器
|
||||
- CH + CL = CX
|
||||
- 计数器
|
||||
- DH + DL = DX
|
||||
- 数据寄存器
|
||||
- SP
|
||||
- 堆栈指针寄存器
|
||||
- 会受到指令控制,不应用于其他目的
|
||||
- BP
|
||||
- 基址指针寄存器
|
||||
- SI
|
||||
- 源变址寄存器
|
||||
- 如字符串首地址
|
||||
- DI
|
||||
- 目的变址寄存器
|
||||
- 如字符串第n个元素地址
|
||||
|
||||
# 程序数据
|
||||
|
||||
```assembly
|
||||
assume cs:code, ds:data, ss:stack ;定义了三个段 code,data,stack 只是为了阅读的方便,用其他的名称是一样的。
|
||||
|
||||
data segment
|
||||
dw 0123h, 0456h, 0789h, 0abch, 0defh, 0fedh, 0cbah, 0987h
|
||||
data ends
|
||||
|
||||
stack segment
|
||||
dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
stack ends
|
||||
|
||||
code segment
|
||||
start: mov ax,stack # stack 段的首地址
|
||||
mov ss,ax
|
||||
mov sp, 20h;
|
||||
|
||||
mov ax, data ;
|
||||
mov ds, ax; ds指向data 段的首地址
|
||||
|
||||
mov bx,0
|
||||
mov cx, 8
|
||||
|
||||
s: push [bx]
|
||||
add bx, 2
|
||||
loop s ;以上将data段中的0~15单元中的8个字型 数据一次入栈
|
||||
|
||||
mov bx,0
|
||||
mov cx,8
|
||||
s0: pop [bx]
|
||||
add bx,2
|
||||
loop s0; 出栈,把数据放回到data段。 如此就把数据逆序了。
|
||||
mov ax, 4c00h
|
||||
int 21h ;中断调用操作系统子程序
|
||||
code ends
|
||||
|
||||
end start
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 代码段
|
||||
|
||||
代码数据
|
||||
|
||||
## 数据段
|
||||
|
||||
程序数据
|
||||
|
||||
## 堆栈段
|
||||
|
||||
### 标志寄存器
|
||||
|
||||
ALU计算标志,中断、出错等
|
||||
|
||||
状态标志
|
||||
|
||||
- 进位标志CF
|
||||
- 奇偶标志PF
|
||||
- 调整标志AF
|
||||
- 零标志ZF
|
||||
|
||||
- 符号标志SF
|
||||
- 溢出标志OF
|
||||
|
||||
控制标志
|
||||
|
||||
- 方向标志DF
|
||||
- 中断标志IF
|
||||
- 单步标志TF
|
||||
|
||||
### ALU
|
||||
|
||||
算术逻辑单元,核心计算单元,电路实现了基础运算的程序功能
|
||||
|
||||
# 指令实例
|
||||
|
||||
## 接口
|
||||
|
||||
```assembly
|
||||
mov dest,src ;dest ← src
|
||||
mov al,[bx+si+6] ;指令功能:AL←[BX+SI+6]
|
||||
;[取地址存储的数据]
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 函数调用
|
||||
|
||||
```assembly
|
||||
;lea 取函数地址到rax寄存器
|
||||
lea rax,[TPoint::`vcall'{0}' (07FF6C97EC00Eh)]
|
||||
TPoint::TestStaticFunction();
|
||||
00007FF61BAC9A32 call TPoint::TestStaticFunction (07FF61B95BEF1h)
|
||||
00007FF61B95BEF1 jmp TPoint::TestStaticFunction (07FF61B9A2900h)
|
||||
00007FF61B9A2900 mov eax,dword ptr [TPoint::static_int_a (07FF61BB21BA0h)]
|
||||
|
||||
00007FF765B1E5AF call TPoint::Testvirtual (07FF765B068CFh)
|
||||
00007FF765B068CF jmp TPoint::Testvirtual (07FF765B529E0h)
|
||||
FuncPointer fp1 = &TPoint::Testvirtual;
|
||||
00007FF765B1E5B4 lea rax,[TPoint::`vcall'{0}' (07FF765B06663h)]
|
||||
FuncPointer fp2 = &TPoint::Testvirtua2;
|
||||
00007FF765B1E5C3 lea rax,[TPoint::`vcall'{8}' (07FF765B0600Fh)]
|
||||
|
||||
0x00007ff765c8fa88 {zplus.exe!void(* TPoint::`vftable'[3])()} {
|
||||
0x00007ff765b068cf {zplus.exe!TPoint::Testvirtual(void)},
|
||||
0x00007ff765b07581}
|
||||
```
|
||||
|
||||
|
||||
|
||||
# 编译
|
||||
|
||||
```
|
||||
cl.exe -c -nologo /EHsc -Fobuild\.objs\zasm\windows\x64\release\src\main.cpp.obj src\main.cpp
|
||||
link.exe -nologo -dynamicbase -nxcompat -machine:x64 -out:build\zasm.exe
|
||||
|
||||
[ 25%]: compiling.release src\main.cpp
|
||||
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX64\\x64\\cl.exe" -c -nologo /EHsc -Fobuild\.objs\zasm\windows\x64\release\src\main.cpp.obj src\main.cpp
|
||||
[ 50%]: linking.release zasm.exe
|
||||
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX64\\x64\\link.exe" -nologo -dynamicbase -nxcompat -machine:x64 -out:build\windows\x64\release\zasm.exe build\.objs\zasm\windows\x64\release\src\main.cpp.obj
|
||||
```
|
||||
|
||||
Loading…
Reference in New Issue
Block a user