中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-03 07:20
47,812 topics / 349,914 posts / today 0 new / 48,265 members
DOS开发编程 & 发展交流 (开发室) » How to access the BP register?
Printable Version  2,057 / 3
Floor1 yysn Posted 2010-11-08 05:43
初级用户 Posts 26 Credits 65
```c
// struct REGPACK reg;

reg.r_ax=0x1130;
reg.r_bx=reg_bx;
int86(0x10,&reg);

return MK_FP(reg.r_es,reg.r_bp);
```
Floor2 firstsail Posted 2010-11-08 10:00
高级用户 Posts 295 Credits 668 From 广东深圳
```c
// Get the starting address of the 8x8 character set
unsigned char* GetCharacterPoint()
{

unsigned short wSeg = 0;
unsigned short wOff = 0;

__asm push es
__asm push bp

__asm mov ax, 1130H
__asm mov bh, 03H // Get the starting address of the 8x8 font
__asm int 10h

__asm mov ax, bp
__asm pop bp // Very important, otherwise the program will crash
__asm mov wOff, ax

__asm mov ax, es
__asm mov wSeg, ax
__asm pop es

return ((unsigned char *)(unsigned long)MK_FP(wSeg, wOff));
}

[ Last edited by firstsail on 2010-11-8 at 10:02 ]
```
Floor3 yysn Posted 2010-11-08 15:23
初级用户 Posts 26 Credits 65
Uh, boss upstairs, I need C language, no inline assembly...
Floor4 netwinxp Posted 2010-11-26 08:21
高级用户 Posts 366 Credits 741
In C language, although you can declare register variables to use registers as much as possible for variables, bp is generally used to pass parameters. So even when using embedded assembly to use bp, you have to be very careful, otherwise the program is very easy to crash.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023