
; Storm C Compiler
; Euterpe:Science/Emperor/Projects/Squid.cpp
	mc68030
	mc68881
	XREF	_malloc
	XREF	_free
	XREF	endl__R07ostream
	XREF	op__leftshift__ostream__Td
	XREF	op__leftshift__ostream__TUj
	XREF	op__leftshift__ostream__Tj
	XREF	op__leftshift__ostream__TPCc
	XREF	op__leftshift__ostream__Tc
	XREF	opfx__ostream__T
	XREF	read__istream__TPci
	XREF	get__istream__TRc
	XREF	getline__istream__TPcic
	XREF	get__istream__TPcic
	XREF	op__rightshift__istream__TRi
	XREF	op__rightshift__istream__TRc
	XREF	op__rightshift__istream__TPc
	XREF	doallocate__streambuf__T
	XREF	xsgetn__streambuf__TPci
	XREF	xsputn__streambuf__TPCci
	XREF	underflow__streambuf__T
	XREF	overflow__streambuf__Ti
	XREF	setbuf__streambuf__TPcUi
	XREF	sputn__streambuf__TPCci
	XREF	_0dt__streambuf__T
	XREF	userword__ios__Ti
	XREF	init__ios__TP09streambuf
	XREF	_std__in
	XREF	_std__out
	XREF	_std__err
	XREF	_basefield__ios
	XREF	_adjustfield__ios
	XREF	_floatfield__ios
	XREF	_aNextBit__ios
	XREF	_aNextWord__ios
	XREF	_cin
	XREF	_cout
	XREF	_cerr
	XREF	_clog

	SECTION ":0",CODE


;Cell::Cell()
	XDEF	_0ct__Cell__T
_0ct__Cell__T
L31	EQU	0
	link	a5,#L31
	move.l	$8(a5),a0
L30
;    cx=0;
	clr.l	(a0)
;    cy=0;
	clr.l	4(a0)
;    a=0;
	clr.l	$8(a0)
;    b=0;
	clr.l	$C(a0)
	unlk	a5
	rts

;Cell::~Cell()
	XDEF	_0dt__Cell__T
_0dt__Cell__T
L33	EQU	0
	link	a5,#L33
L32
;Cell::~Cell()
	unlk	a5
	rts

;void Cell::set_cx(int stuff)
	XDEF	set_cx__Cell__Ti
set_cx__Cell__Ti
L35	EQU	0
	link	a5,#L35
	move.l	$C(a5),d0
	move.l	$8(a5),a0
L34
;    cx=stuff;
	move.l	d0,(a0)
	unlk	a5
	rts

;void Cell::set_cy(int stuff)
	XDEF	set_cy__Cell__Ti
set_cy__Cell__Ti
L37	EQU	0
	link	a5,#L37
	move.l	$C(a5),d0
	move.l	$8(a5),a0
L36
;    cy=stuff;
	move.l	d0,4(a0)
	unlk	a5
	rts

;void Cell::set_a(int stuff)
	XDEF	set_a__Cell__Ti
set_a__Cell__Ti
L39	EQU	0
	link	a5,#L39
	move.l	$C(a5),d0
	move.l	$8(a5),a0
L38
;    a=stuff;
	move.l	d0,$8(a0)
	unlk	a5
	rts

;void Cell::set_b(int stuff)
	XDEF	set_b__Cell__Ti
set_b__Cell__Ti
L41	EQU	0
	link	a5,#L41
	move.l	$C(a5),d0
	move.l	$8(a5),a0
L40
;    b=stuff;
	move.l	d0,$C(a0)
	unlk	a5
	rts

;int Cell::get_cx() const
	XDEF	get_cx__Cell__CT
get_cx__Cell__CT
L43	EQU	0
	link	a5,#L43
	move.l	$8(a5),a0
L42
	move.l	(a0),d0
	unlk	a5
	rts

;int Cell::get_cy() const
	XDEF	get_cy__Cell__CT
get_cy__Cell__CT
L45	EQU	0
	link	a5,#L45
	move.l	$8(a5),a0
L44
	move.l	4(a0),d0
	unlk	a5
	rts

;int Cell::get_a() const
	XDEF	get_a__Cell__CT
get_a__Cell__CT
L47	EQU	0
	link	a5,#L47
	move.l	$8(a5),a0
L46
	move.l	$8(a0),d0
	unlk	a5
	rts

;int Cell::get_b() const
	XDEF	get_b__Cell__CT
get_b__Cell__CT
L49	EQU	0
	link	a5,#L49
	move.l	$8(a5),a0
L48
	move.l	$C(a0),d0
	unlk	a5
	rts

;void main()
	XDEF	main_
main_
L75	EQU	-$C
	link	a5,#L75
	movem.l	d2/a2,-(a7)
L56
;    int x=0
	clr.l	-4(a5)
;    int x=0, i=0;
;    cout <<"combien d'objets? ";
	move.l	#L50,-(a7)
	move.l	_cout,a0
	cmp.w	#0,a0
	beq.b	L58
L57
	addq.w	#4,a0
L58
	move.l	a0,-(a7)
	jsr	op__leftshift__ostream__TPCc
	addq.w	#$8,a7
;    cin >>x;
	pea	-4(a5)
	move.l	_cin,a0
	cmp.w	#0,a0
	beq.b	L60
L59
	addq.w	#4,a0
L60
	move.l	a0,-(a7)
	jsr	op__rightshift__istream__TRi
	addq.w	#$8,a7
;    Cell *C = (Cell*) malloc(x*sizeof(Cell));
	move.l	-4(a5),d0
	moveq	#4,d1
	asl.l	d1,d0
	move.l	d0,-(a7)
	jsr	_malloc
	addq.w	#4,a7
	move.l	d0,a2
;    if(C==NULL)
	cmp.w	#0,a2
	bne.b	L64
L61
;    
;        cout <<"erreur d'allocation\n";
	move.l	#L51,-(a7)
	move.l	_cout,a0
	cmp.w	#0,a0
	beq.b	L63
L62
	addq.w	#4,a0
L63
	move.l	a0,-(a7)
	jsr	op__leftshift__ostream__TPCc
	addq.w	#$8,a7
	bra	L74
L64
;    
;        cout <<"allocation de " <<x <<" objets effectuée\n";
	move.l	#L52,-(a7)
	move.l	-4(a5),-(a7)
	move.l	#L53,-(a7)
	move.l	_cout,a0
	cmp.w	#0,a0
	beq.b	L66
L65
	addq.w	#4,a0
L66
	move.l	a0,-(a7)
	jsr	op__leftshift__ostream__TPCc
	addq.w	#$8,a7
	move.l	d0,-(a7)
	jsr	op__leftshift__ostream__Ti
	addq.w	#$8,a7
	move.l	d0,-(a7)
	jsr	op__leftshift__ostream__TPCc
	addq.w	#$8,a7
;        cout <<"la mémoire utilisée est de " <<x*sizeof(Cell)
	move.l	#L54,-(a7)
	move.l	-4(a5),d0
	moveq	#4,d1
	asl.l	d1,d0
	move.l	d0,-(a7)
	move.l	#L55,-(a7)
	move.l	_cout,a0
	cmp.w	#0,a0
	beq.b	L68
L67
	addq.w	#4,a0
L68
	move.l	a0,-(a7)
	jsr	op__leftshift__ostream__TPCc
	addq.w	#$8,a7
	move.l	d0,-(a7)
	jsr	op__leftshift__ostream__TUi
	addq.w	#$8,a7
	move.l	d0,-(a7)
	jsr	op__leftshift__ostream__TPCc
	addq.w	#$8,a7
;        for(i=0;
	moveq	#0,d2
	bra.b	L72
L69
;        
;            cout <<C[i].get_cx() <<endl;
	move.l	#endl__R07ostream,-(a7)
	move.l	d2,d0
	asl.l	#4,d0
	pea	0(a2,d0.l)
	jsr	get_cx__Cell__CT
	addq.w	#4,a7
	move.l	d0,-(a7)
	move.l	_cout,a0
	cmp.w	#0,a0
	beq.b	L71
L70
	addq.w	#4,a0
L71
	move.l	a0,-(a7)
	jsr	op__leftshift__ostream__Ti
	addq.w	#$8,a7
	move.l	d0,-(a7)
	jsr	op__leftshift__ostream__TPFR07ostreamR07ostreamp
	addq.w	#$8,a7
	addq.l	#1,d2
L72
	cmp.l	-4(a5),d2
	blt.b	L69
L73
;        free(C);
	move.l	a2,-(a7)
	jsr	_free
	addq.w	#4,a7
L74
	movem.l	(a7)+,d2/a2
	unlk	a5
	moveq	#0,d0
	rts

	XDEF	op__leftshift__ostream__TPFR07ostreamR07ostreamp
op__leftshift__ostream__TPFR07ostreamR07ostreamp
L77	EQU	0
	link	a5,#L77
	move.l	$C(a5),a0
	move.l	$8(a5),a1
L76
	move.l	a1,-(a7)
	jsr	(a0)
	addq.w	#4,a7
	unlk	a5
	rts

	XDEF	op__leftshift__ostream__TUi
op__leftshift__ostream__TUi
L79	EQU	0
	link	a5,#L79
	move.l	$C(a5),d0
	move.l	$8(a5),a0
L78
	move.l	d0,-(a7)
	move.l	a0,-(a7)
	jsr	op__leftshift__ostream__TUj
	addq.w	#$8,a7
	unlk	a5
	rts

	XDEF	op__leftshift__ostream__Ti
op__leftshift__ostream__Ti
L81	EQU	0
	link	a5,#L81
	move.l	$C(a5),d0
	move.l	$8(a5),a0
L80
	move.l	d0,-(a7)
	move.l	a0,-(a7)
	jsr	op__leftshift__ostream__Tj
	addq.w	#$8,a7
	unlk	a5
	rts

L52
	dc.b	' objets effectuée',$A,0
L54
	dc.b	' octets',$A,0
L53
	dc.b	'allocation de ',0
L50
	dc.b	'combien d'objets? ',0
L51
	dc.b	'erreur d'allocation',$A,0
L55
	dc.b	'la mémoire utilisée est de ',0

	END
