I am having troubles with the CMP instruction when comparing single words (2 bytes).
The following is my main.asm:
[org 0x7c00]
mov bx, HELLO_MSG
call print_string
mov bx, GOODBYE_MSG
call print_string
jmp $
%include "print_string.asm"
; Data
HELLO_MSG:
db 'Hello, World!', 0
GOODBYE_MSG:
db 'Goodbye!', 0
Run Code Online (Sandbox Code Playgroud)
This is the print_string.asm file:
print_string:
pusha
mov ah, 0x0e
loop:
call print_char
cmp word [bx], 0
jne loop
popa
ret
print_char:
mov al, [bx]
int 0x10
add bx, 1
ret
Run Code Online (Sandbox Code Playgroud)
This code …
首先我要说的是我开发基于 Cortex m4 的嵌入式设备应用程序。
我有引导加载程序和主应用程序常用的功能。现在我为引导加载程序和应用程序编译源文件两次。但我的双组 dfu 空间不足,我只想在 ROM 中使用这些功能一次。知道我怎样才能实现这个目标吗?
编辑:
在某些情况下使用函数指针可能存在危险,请检查我的问题 -使用指针函数 - 1 台设备上的 2 个独立应用程序
我正在用汇编语言开发一个操作系统。\n在某个时间我从 NASM 收到此错误:
\n\n\n\n\nos.asm:113: 错误: TIMES 值 -138 为负数
\n
我想把这个项目进行到底。只有这样的错误才让我绝望!
\n\n这是代码:
\n\nBITS 16\n\nstart:\n mov ax, 07C0h ; Set up 4K stack space after this bootloader\n add ax, 288 ; (4096 + 512) / 16 bytes per paragraph\n mov ss, ax\n mov sp, 4096\n mov ax, 07C0h ; Set data segment to where we're loaded\n mov ds, ax\n call cls\n MOV AH, 06h ; Scroll up function\n XOR AL, AL ; Clear entire screen\n XOR …Run Code Online (Sandbox Code Playgroud) 我编写 x86 引导加载程序已经有一段时间了,并且已经验证我的引导加载程序可以在 bochs 和 qemu 以及 vmware 上运行。但是,我在真实硬件 (Thinkpad T400) 上遇到磁盘读取错误,错误代码为 0x0880,但在 qemu 上却没有。
[bits 16]
[extern kernel]
[global isr_stub_table]
[global IDT_load]
[extern FortressLoader_IdtInit]
[extern FortressLoader_ChecmMemMap]
[extern X86TTY_Init]
[extern X86TTY_Clear]
[extern printf]
[global FortressLoader_HeapStart]
[global FortressLoader_HeapEnd]
[global startKernel]
section .boot
global boot
KERNEL_SIZE_SECTORS equ 128
jmp boot
TIMES 3-($-$$) DB 0x90
OEMname: db "mkfs.fat"
bytesPerSector: dw 512
sectPerCluster: db 1
reservedSectors: dw 1
numFAT: db 2
numRootDirEntries: dw 224
numSectors: dw 2880
mediaType: db 0xf0
numFATsectors: dw 9
sectorsPerTrack: …Run Code Online (Sandbox Code Playgroud) 我正在寻找开发一个简单的(开始)UEFI引导加载程序来加载ELF图像,并想知道是否有人有一个很好的入口点可能任何现有项目,或我可以用来开始的示例.
此外,我想知道是否有任何人有任何获得虚拟盒运行EFI应用程序的经验.我已经设置了一个带有EFI主板的虚拟机,但是可以创建一个EFI系统分区,以便加载(不使用操作系统),我所能实现的就是UEFI命令行.
典型的嵌入式引导加载程序用于结束引导加载的指令或指令集是什么?请容忍这个问题.我想知道在将控制转移到操作系统后,引导加载是否实际结束或是否存在某种无限循环.
我正在学习linux内核启动过程并尝试在我的beagleboard xM上安装linux.我在使用SD卡时遇到了两种方法.1.将MLO,initrd,uboot.bin和uImage放在一个分区中.2.在一个分区中使用MLO,uboot.bin和uImage,在第二个分区中使用预先构建的rootfs(Angstrom).
在第一种方法中,如何将initrd转换为第二个分区上的完整文件系统.当uboot从uImage中提取内核并将其粘贴到第二个分区时,内部会发生什么.哪些目录将被修改为init rootfs.如何调用内核的init进程.
STM32应用笔记2606对此进行了讨论,但没有简单的代码示例.
例如,我有以下代码(MikeOS).
jmp short bootloader_start ; Jump past disk description section
nop ; Pad out before disk description
...
...
OEMLabel db "MIKEBOOT" ; Disk label
BytesPerSector dw 512 ; Bytes per sector
SectorsPerCluster db 1 ; Sectors per cluster
ReservedForBoot dw 1 ; Reserved sectors for boot record
NumberOfFats db 2 ; Number of copies of the FAT
bootloader_start:
mov ax, 07C0h ; Set up 4K of stack space above buffer
add ax, 544 ; 8k buffer = …Run Code Online (Sandbox Code Playgroud) 编写在QEMU中作为引导加载程序运行的x86实模式汇编程序时遇到问题.我正在尝试通过BIOS中断0x10打印文本.我的代码是:
print:
pusha
.loop:
mov AL, [SI]
cmp AL, 0
je .end
call printChar
inc SI
jmp .loop
.end:
popa
ret
printChar:
pusha
mov AH, 0x0E
mov BH, 0
mov BL, 0x0F
int 0x10
popa
ret
Run Code Online (Sandbox Code Playgroud)
我[ORG 0x7c00]用作原点.我测试了printChar标签,并在AL中用一些字母调用它,它工作正常.当我尝试将内存地址加载到这样的消息时:
loadMsg db "Loading",0
mov SI, loadMessage
call print
Run Code Online (Sandbox Code Playgroud)
我在QEMU仿真器上输出像'U'这样的垃圾作为输出.昨天,我编写了一个与此类似的代码,完全没有问题.是什么导致了我的问题以及如何解决?