1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- {
- Copyright (c) 1998-2012 by Florian Klaempfl and others
- Generate i8086 assembler for constants
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
- }
- unit n8086con;
- {$i fpcdefs.inc}
- interface
- uses
- node,ncon,ncgcon,nx86con;
- type
- { tcgpointerconstnode }
- ti8086pointerconstnode = class(tcgpointerconstnode)
- procedure pass_generate_code;override;
- end;
- implementation
- uses
- systems,globals,globtype,
- symconst,symdef,
- defutil,
- cpubase,
- cga,cgx86,cgobj,cgbase,cgutils;
- {*****************************************************************************
- T8086POINTERCONSTNODE
- *****************************************************************************}
- procedure ti8086pointerconstnode.pass_generate_code;
- begin
- { far pointer? }
- if (typedef.typ=pointerdef) and (tpointerdef(typedef).x86pointertyp in [x86pt_far,x86pt_huge]) then
- begin
- location_reset(location,LOC_CONSTANT,OS_32);
- location.value:=longint(value);
- end
- else
- begin
- { an integer const. behaves as a memory reference }
- location_reset(location,LOC_CONSTANT,OS_ADDR);
- location.value:=aint(value);
- end;
- end;
- begin
- cpointerconstnode:=ti8086pointerconstnode;
- end.
|