小编Sur*_*K S的帖子

如何检查类型是否源自向量/列表/双端队列?

我正在使用 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)

c++ templates type-traits c++20 c++-templates

3
推荐指数
1
解决办法
176
查看次数

使用 BIOS int 13h 访问不同磁头中的扇区

我有一个每磁道有 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)

x86 assembly osdev bootloader x86-16

2
推荐指数
1
解决办法
1008
查看次数