	.data
.savarea:
	.long	0
	.long	0
	.long	0
	.long	0
	.long	0
	.long	0
	.long	0

	.text
	.globl	_savelev
_savelev:
	moveml	#.S1,.savarea		; save a0-a6
	movb	_level,d0
	extw	d0
	muls	#0x1ab2,d0
	addl	_cell,d0
	movl	d0,a5				; a5 is pcel
	lea	a5@(0x1ab2),a6			; a6 is pesel
	movl	#_item,a4			; a4 is item[][]
	movl	#_iarg,a3			; a3 is iarg[][]
	movl	#_know,a2			; a2 is know[][]
	movl	#_mitem,a1			; a1 is mitem[][]
	movl	#_hitp,a0			; a0 is hitp[][]
	jra	.L20
.L20001:
	movw	a0@+,a5@
	movb	a1@+,a5@(2)
	movb	a2@+,a5@(5)
	movb	a3@+,a5@(4)
	movb	a4@+,a5@(3)
	addql	#6,a5
.L20:
	cmpl	a6,a5
	jcs	.L20001
	moveml	.savarea,#.S1
	rts
.S1 = 0x7f00	; address registers 0-6
| end

	.text
	.globl	_getleve
_getleve:
	moveml	#.S1,.savarea		; save a0-a6
	movb	_level,d0
	extw	d0
	muls	#0x1ab2,d0
	addl	_cell,d0
	movl	d0,a5				; a5 is pcel
	lea	a5@(0x1ab2),a6			; a6 is pesel
	movl	#_item,a4			; a4 is item[][]
	movl	#_iarg,a3			; a3 is iarg[][]
	movl	#_know,a2			; a2 is know[][]
	movl	#_mitem,a1			; a1 is mitem[][]
	movl	#_hitp,a0			; a0 is hitp[][]
	jra	.L24
.L20003:
	movw	a5@,a0@+
	movb	a5@(2),a1@+
	movb	a5@(5),a2@+
	movb	a5@(4),a3@+
	movb	a5@(3),a4@+
	addql	#6,a5
.L24:
	cmpl	a6,a5
	jcs	.L20003
	moveml	.savarea,#.S1
	rts
| end
	.data
