Keil C51

hh hudaklan at volny.cz
Sat Jun 17 10:51:21 CEST 2000


Ahoj,

posilam nekolik postrehu z manualu na KEIL C51 Compiler.

Asembler je mozne psat tez primo do zdrojoveho kodu C
     # pragma asm
        JMP $;
     # pragma endasm

Predavani parametru do asembleru
  
 typ parametru           char,1-byte ptr           int,2-byte ptr        long,float                generic ptr
1 parametr                  R7                           R6 (MSB),R7      R4 (MSB) - R7        R1,R2,R3
2 parametry                R5                           R4 (MSB),R5      R4 (MSB) - R7        R1,R2,R3
3 parametry                R3                           R2 (MSB),R3      --------------               R1,R2,R3

Predavani parametru z asembleru
typ parametru         registr                      poznamka
bit                        Carry-Flag
(unsigned char)      R7
(unsigned int)         R6,R7                      (MSB) R6, (LSB) R7
(unsigned long)      R4-R7                       (MSB) R4, (LSB) R7
float                      R4-R7                       32-bit IEEE- Format Exponent a Sign v R7
pointer                  R1,R2,R3                  (Selector) R3, (MSB) R2, (LSB) R1

Preklad a slinkovani uz posal pan Jancura.

Do xx.h vlozit deklaraci funkce
// skoky
void skoc(unsigned int kam);			// skoci na adresu kam

Do vlastniho programu potom volani funkce
 skoc(0);

Vlastni rutina v asembleru vypada napr. takto:

NAME 	SKOKY
;
PUBLIC	_SKOC

SKOKY  	SEGMENT  CODE

	RSEG  SKOKY

	USING 0
_SKOC:
	MOV   DPH,R6
	MOV   DPL,R7
	CLR   A
	JMP   @A+DPTR

	END

Snad Vam to pomuze.   HUDA






More information about the HW-list mailing list