00001 ;/******************* 00002 ;*Project: 80X86 32BIT MULTI TASKING OPERATING SYSTEM 00003 ;*Function: assembly part of driver for MC6845 00004 ;* 00005 ;*File: cga_a.asm 00006 ;*Author: Book Chen 00007 ;*Date: 2010.01.01 00008 ;******************** 00009 ;*/ 00010 00011 global _CgaByteWrite 00012 global _CgaByteRead 00013 00014 [section .text] ;code section 00015 ;/******************** 00016 ;*function:_CgaByteWriteAsm 00017 ;*description:write a byte to graphic segment 00018 ;in c is CgaByteWrite(U32 Offset,U8 CharValue) 00019 ;*********************/ 00020 _CgaByteWrite: 00021 push ebp ;prestore ebp in stack 00022 mov ebp,esp ;assign esp to ebp 00023 push esi ;prestore ebp in stack 00024 mov eax,[ebp+8] ;get char offset 00025 mov esi,eax 00026 mov eax,[ebp+12] ;get char value 00027 mov [gs:esi],al ;show character on graphics memory...0x0000b800+edi?? 00028 pop esi 00029 pop ebp 00030 ret 00031 00032 ;/******************** 00033 ;*function:_CgaByteReadAsm 00034 ;*description:write a byte from graphic segment 00035 ;in c is CgaByteRead(U32 Offset) 00036 ;return byte in eax 00037 ;*********************/ 00038 _CgaByteRead: 00039 push ebp ;prestore ebp in stack 00040 mov ebp,esp ;assign esp to ebp 00041 push esi ;prestore ebp in stack 00042 mov eax,[ebp+8] ;get char offset 00043 mov esi,eax 00044 mov eax,[gs:esi] ;show character on graphics memory...0x0000b800+edi?? 00045 pop esi 00046 pop ebp 00047 ret
1.5.9