applekill / masm-1 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from wangzimei/masm
This project forked from wangzimei/masm
contents of this repository intro.md 8086, dos, masm 6 macros.md masm 6 macros compile sample codes 8086/masm611 not included in repo out compiler outputs unsorted 8086 16 位实模式 dos copy 抄来的东西 iaie intel 指令扩展 x64 保护模式, ring3, windows ==================== 编写和执行 masm 汇编程序 compile 16 bits masm 6.x code and run it in dos 5+ * macro programs run at compile time, you can compile them using newer versions of ml.exe, thus avoid dos and dosbox altogether. choices of toolchain: 1. online editor or compiler best choice, but i can't find any @2022.7.20 2. dosbox shared file system between local machine and dosbox 3. online emulator closest i've ever found is pcjs.org masm 4.0 on ms-dos 3.20 https://www.pcjs.org/software/pcjs/ masm 5.10 on pc-dos 3.30 https://www.pcjs.org/software/pcx86/lang/microsoft/masm/5.10x/ 4. bochs, qemu, virtualbox, ... dosbox 不是模拟器, 有些指令执行的不正确, 这时需要在模拟器里执行 download dosbox at https://www.dosbox.com/, mac users can also install via homebrew download masm 6.x, e.g. https://sourceforge.net/projects/masm611/ install dosbox, configure it, see relevant section below launch dosbox, install masm 6.x write code in any editor, switch to dosbox, ml file debug generated executable using cv.exe redirect ml outputs to file named fff > fff ml -Zs dd.msm view binary - macos 常用 hexdump, od, xxd xxd out/dd.obj - windows powershell format-hex out/dd.obj https://en.wikipedia.org/wiki/Microsoft_Macro_Assembler ==================== dosbox and config macos 把 dosbox.app 放入 /applications, 运行 dosbox, 执行 config -writeconf dosbox.conf 在 dosbox.app 所在目录新建 dosbox.conf http://www.vogons.org/viewtopic.php?t=33318 win10 安装 dosbox, 运行, 会在下面位置生成配置文件. 我不知道如何改变位置 C:\Users\王子美\AppData\Local\DOSBox\dosbox-0.74-3.conf 开始菜单的 dosbox 里面也有打开配置文件的条目 假设想让 c:\code\masm 做为 dosbox 的虚拟 c 盘 关闭 dosbox, 打开配置文件, 在最下面的 [autoexec] 节写 mount c c:\code\masm c: 禁用捕获鼠标: 配置文件里搜索 autolock=true, 改成 false 打开 dosbox 安装 masm. 假设安装在 c:\code\masm\8086\masm611, 要配置环境变量 关闭 dosbox, 打开配置文件, 在最下面的 [autoexec] 添加 set path=c:\8086\masm611\bin;c:\8086\masm611\binr;%path% [autoexec] 还可以添加这些不重要的语句 code view (cv) 帮助 set helpfiles=c:\8086\masm611\help\*.hlp 让 cv 使用预配置的 clrfile.cv4 和 current.sts, 就不再在当前目录生成这俩文件了 set init=c:\8086\masm611\init mount 是 dosbox 命令, 里面的路径是真实路径; set 和 c: 是 dos 命令, 里面的路径是虚拟的 dos 里的路径 常用命令 CTRL-F4 重新扫描目录 - 现在感觉不常用, vscode 里随便修改文件, dosbox 里没发现有缓存问题 CTRL-F10 释放鼠标捕获 ==================== online tools https://carlosrafaelgn.com.br/Asm86/ 32 bit assembly with debugging. unknown syntax, simple and fun https://godbolt.org/ 语言选 assembly, 编译器版本很多但种类不多, 没找到 16 位汇编 nasm 64 位代码的编译选项 -felf64 https://onlinedisassembler.com/odaweb/ 反汇编, 选项多 https://defuse.ca/online-x86-assembler.htm x86, x64 汇编和反汇编, 选项少, 易用, 有的汇编结果不正确 ==================== online emulator https://www.pcjs.org/ 看起来有很多硬件配置和软盘, 但网站很难用 - 机器的硬件配置是 xml 和 json 文件, 都是自定义语法, 不知道如何操作 打开一个机器的页面, 有哪些硬件, 能否更换, 等等, 都做不到 = 软件分类还可以, 都保存在软盘上, 可以用机器加载软盘 - 软件页面应该是软件介绍, 不该像现在这样加载一个预配置的机器, 软盘里放入该软件, 希望你在机器里安装它 当不想用这个配置的机器时, 没地方更换. 比如 https://www.pcjs.org/software/pcx86/sys/dos/microsoft/6.22/ https://www.pcjs.org/software/pcx86/lang/microsoft/masm/6.00/ + 软盘列表里有 the undocumented pc, 我看过这本书, 很喜欢. - bug? 预配置的机器在 c 盘里执行 dir 输出的是某个目录的名字, 比如德军总部是 c:/wolf3d, win95 是 c:/windows - 设想选择一个预配置的机器, 在上面安装软件, 然后 save machine, 下次直接打开这个保存的机器 点击 save machine 下载了一个 js 文件, 需要嵌入到 html 里. 第一个念头就是删掉此 js 并放弃 save machine - 设想选择一个预配置的机器, 在上面安装软件, 然后 save hd, 下次打开时先启动与硬盘配套的机器, 再用 mount 加载硬盘 安装, save hd, 刷新页面, 选择保存的 img 文件, 点 mount. 错误: unrecognized disk format - 机器的 caps 既不能检测也不能控制键盘的 caps lock, 反被其控制. 有时 caps 显示的状态和实际状态正相反 = 机器屏幕是 canvas. 图像精确; 无法复制命令行输出 - 不共享剪切板 (win95 能共享), 不共享文件系统 https://copy.sh/v86/?profile=msdos 预配置的 ms-dos 6.22, 有 c:/debug.com 和 c:/dos/debug.exe dir /w /on dos | more f3, f7 可以查看执行过的命令, 要用上下箭头切换, 先执行 doskey(.com). - 很消耗 cpu, 风扇不停的转 = https://copy.sh/v86/ 似乎能稍微定义硬件配置, 还没尝试 - caps 和 pcjs.org 的一样是纯粹的累赘 = 机器屏幕是 div. 图像不精确; 虽不能从屏幕复制输出但能从浏览器 f12 复制元素内容 - 不共享剪切板, 不共享文件系统 ==================== freedos in virtualbox http://wiki.freedos.org/wiki/index.php/VirtualBox 创建虚拟机, 加载 freedos 1.2 iso, win10 和 mac mojave 安装时一直报错 freedos invalid opcode at 0fae ... 下面的网页说在 "Install to harddisk" 处按 tab, 在 /boot/syslinux/memdisk 后加 raw KERNEL /boot/syslinux/memdisk -> KERNEL /boot/syslinux/memdisk raw https://sourceforge.net/p/freedos/bugs/177/ 虽然按 tab 后出现的命令行和他说的不大一样, 但仍能找到 /memdisk, 加上 raw 就能安装了 其他网页说在 bios 里把 AHCI 改成 IDE (legacy), 装完 freedos 后改回来, 感觉太麻烦没试 启动后发现需要 masm 和 code 目录, 这在 dosbox 根本不是问题, 挂载目录就完事了, 虚拟机里就开始麻烦 首先我记得以前能在 windows 里挂载 vhd, 现在右键 VirtualBox VMs\freedos 1.2\freedos 1.2.vhd 没那选项, 隐约觉得和 hyper-v 有关 然后尝试 VirtualBox 的共享文件夹, 设置完不知道咋用, 一看 reddit 说共享文件夹需要 vm addon, dos 没那东西 然后找到这个网页, 里面列出了好几种 win10 挂载 vhd 的办法 https://www.tenforums.com/tutorials/61391-mount-unmount-vhd-vhdx-file-windows-10-a.html 先尝试 powershell Mount-VHD, 说不认识该命令, 一查 msdn 说属于 hyper-v 模块, 至此确定和 hyper-v 有关, 但轻易也不想装它 然后尝试磁盘管理 diskmgmt.msc 里面 操作 > 附加 vhd, 终于成功挂载, 把两个目录拷贝到 vhd 里面了 2019.8.18 上面是昨天做的, 今天起来看 freedos 的网页 Chapter 6: Mount the FreeDOS image to transfer files http://wiki.freedos.org/wiki/index.php/VirtualBox_-_Chapter_6 这页面给的办法就是磁盘管理 > 附加 vhd macos 挂载 vhd freedos wiki 推荐用软件 Paragon VMDK Mounter, 点连接过去看到 Legacy Product, Unavailable since 06 Jun 2018 于是找其他方法 https://superuser.com/questions/554886/mount-a-vhd-virtualbox-in-osx /usr/bin/hdiutil attach -imagekey diskimage-class=CRawDiskImage "virtualbox vms/freedos 1.2/freedos 1.2.vhd" 往挂载的 vhd 里面拷贝 masm 和 code 目录之后, 一般还会在虚拟机的 c:/autoexec.bat 里把 ml.exe 所在目录加到 path 环境变量里 这个文件的属性有系统, 在 windows 里是隐藏的 ==================== faq ? 为什么很多汇编代码的关键字都是大写 ! 汇编时代的文本编辑器没有语法高亮 - 键盘没有小写按键的时期 - masm 加入大量毫无章法的关键字时期, 这时候一般的语法高亮也没啥用了 ==================== 欠缺的内容 x86, x64 protected mode ring0 驱动程序? 8086, x86, x64 without os 如何编译是个问题, 在另外的系统里编译? intel itanium architecture (formerly called IA-64) 这个还有必要吗? 我也没这 cpu 啊 gpu assembly programming masm 显然编译不了
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.