如何打印RTC使用汇编中断向量1ah [英] how to print RTC use Assembly interrupt vector 1ah

查看:140
本文介绍了如何打印RTC使用汇编中断向量1ah的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要输出一个中断1h. (RTC). 但是我不知道如何在控制台中打印RTC.我应该使用中断10h,还是有其他方法? 我已经尝试在Google中找到一些,然后直接将中断10如下所示.

I need to output an Interrupt 1h. (RTC). But I don't know how to print RTC in console. Should I use interrupt 10h, or is there another way? I already tried to find some in google, and I applied the interrupt 10 directly as below.

mov ah 0x02
int 0x1a

但是它不起作用.我知道代码很差. 请给我一些帮助.如果您能为我树立榜样,我将不胜感激.

But it's not working. I know that the code is poor. Please give me some help. If you can make example for me, I'd really appreciate it.

推荐答案

查看文档对于int 0x10,我们看到了许多功能.您没有指定尝试使用的对象,但是让我们来看一下 ah = 0x0e :

Looking at docs for int 0x10, we see a number of functions. You didn't specify which you tried to use, but let's look at ah=0x0e:

Expects: AH    0eH
         AL    character to write
         BL    (graphics modes only) foreground color number

要写的字符"是我们要显示的字符的 ascii 值.因此,例如,如果要写入字符"7",则可以将其ascii值(55 aka 0x37)放入al中.只需将0x7放入al即可成为BEL的ascii字符(并使扬声器发出蜂鸣声).

The 'character to write' is the ascii value of the character we want to display. So for example if you want to write the character '7', you would put the ascii value for it (55 aka 0x37) into al. Just putting 0x7 into al would be the ascii character for BEL (and would make the speaker beep).

那么,如果要打印数字1234,该怎么办?嗯,您需要分别使用49、50、51、52调用此函数4次.

So, what if you want to print the number 1234? Well, you would need to call this function 4 times, with each of 49, 50, 51, 52.

我知道,您想知道是否有某种方法可以输出字符串?当然.例如,有 INT 0x10,ax = 0x1300 .但是,您仍然需要将1234转换为适当的ascii字符,然后调用BIOS函数以输出您创建的字符串.

I know, you're wondering if there is some way to output a string? Sure. For example there is INT 0x10, ax=0x1300. However, you STILL need to turn 1234 into the appropriate ascii characters, then call the BIOS function to output the string you have created.

没有某种printf("%d")可以为我进行转换吗?不在BIOS中. BIOS功能被设计为非常低的级别.那就是为什么有操作系统,C运行时库等的(一部分),这样人们就不必编写所有这些垃圾邮件.

Isn't there some sort of printf("%d") that does that conversion for me? Not in the BIOS. BIOS functions are designed to be very low level. That's (part of) WHY there are operating systems, C runtime libraries, etc, so that people don't have to write all this junk.

如果您不想自己编写此类函数,则那里有asm库",其中包含用于执行此类操作的例程的集合.

If you don't want to write such a function yourself, there are asm 'libraries' out there that have collections of routines for performing this type of thing.

这篇关于如何打印RTC使用汇编中断向量1ah的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆