TURBO PASCAL |
Новости
|
50: How can I write inline code?A: In Turbo Pascal versions prior 6.0 assembler code could not be directly included in the code. Instead one had to assemble the code into inline statements. Consider the task of rebooting the PC (without disk closing and cache flushing). The assembler code for this is mov ax,$40 mov ds,ax mov wo [$72],$1234 jmp $FFFF:$0000 To assemble this code into an inline statement write the following file calling it e.g. debug.in. The empty line is important. Also carefully note that debug assumes hexadecimal notation. Do not use the $ designator in debug.in. .... begin debug.in, cut here .... a 100 mov ax,40 mov ds,ax mov wo [72],1234 jmp FFFF:0000 u 100 q .... end debug.in, cut here .... Give the following command debug < debug.in You'll get 0E9E:0100 B84000 MOV AX,0040 0E9E:0103 8ED8 MOV DS,AX 0E9E:0105 C70672003412 MOV WORD PTR [0072],1234 0E9E:010B EA0000FFFF JMP FFFF:0000 This translates into Inline ($B8/$40/$00/ $8E/$D8/ $C7/$06/$72/$00/$34/$12/ $EA/$00/$00/$FF/$FF); A2: You can also utilize an inline <--> asm converter called 36337 Apr 26 1988 ftp://garbo.uwasa.fi/pub/pc/turbopas/inlin219.zip inlin219.zip Inline assembler for Turbo Pascal, w/src, D.Baldwin It has two sources, inline.pas and uninline.pas which you can compile to do the conversions in both directions for you. For example, if you have a file test.asm containing the mov ax,$0040 mov ds,ax mov word ptr [$72],$1234 jmp far $FFFF:$0000 then "inline test.asm" will produce test.obj with the following, expected contents Inline( $B8/$40/$00/ {mov ax,$0040} $8E/$D8/ {mov ds,ax} $C7/$06/$72/$00/$34/$12/ {mov word ptr [$72],$1234} $EA/$00/$00/$FF/$FF); {jmp far $FFFF:$0000} |
(с)Все права защищены По всем интересующим вопросам прошу писать на электронный адрес |