我正在使用 C++20。我能够检查类型是否是某种向量/双端队列/列表,如下所示:
template <typename N> struct is_listish_trait {
static constexpr bool value = 0;
};
/* These are listish specializations */
template <typename N, typename A> struct is_listish_trait<std::vector<N, A>> {
static constexpr bool value = 1;
};
template <typename N, typename A> struct is_listish_trait<std::list<N, A>> {
static constexpr bool value = 1;
};
template <typename N, typename A> struct is_listish_trait<std::deque<N, A>> {
static constexpr bool value = 1;
};
template <typename T>
static constexpr bool is_listish = is_listish_trait<T>::value; …Run Code Online (Sandbox Code Playgroud) 我有一个每磁道有 63 个扇区的磁盘。(我假设,根据我的观察)我想使用 int 13h 读取 16 位引导加载程序上的扇区。例如,如果我想读取扇区号 63,我将执行以下操作:
mov dl,0x80;Drive number
mov dh,0 ;This is head number/platter number
mov ch,0 ;This is cylinder number
mov cl,63 ;Sector number
mov ah,0x02 ;interrupt function
mov al,1 ;Number of sectors to be read
xor bx,bx
mov es,bx ;Making es=0
mov bx,0x8000 ;Any random buffer address
int 0x13
Run Code Online (Sandbox Code Playgroud)
上面的代码按预期工作。
现在我想读取扇区 64。我相信它将是柱面 0,磁头 1,扇区 1。我使用:
mov dl,0x80;Drive number
mov dh,1 ;This is head number/platter number
mov ch,0 ;This is cylinder number
mov cl,1 ;Sector …Run Code Online (Sandbox Code Playgroud) assembly ×1
bootloader ×1
c++ ×1
c++20 ×1
osdev ×1
templates ×1
type-traits ×1
x86 ×1
x86-16 ×1