1#!/usr/bin/perl
2
3# Z88DK Z80 Macro Assembler
4#
5# Copyright (C) Gunther Strube, InterLogic 1993-99
6# Copyright (C) Paulo Custodio, 2011-2020
7# License: The Artistic License 2.0, http://www.perlfoundation.org/artistic_license_2_0
8# Repository: https://github.com/z88dk/z88dk
9#
10# Test new __head and __size keywords
11
12use strict;
13use warnings;
14use Test::More;
15require './t/test_utils.pl';
16
17my @testfiles = qw( testa.asm testa.lis testa.sym testa.o testa.map testa.bin
18					testb.asm testb.lis testb.sym testb.o
19				);
20
21my $asm = "
22	EXTERN __head, __tail, __size
23
24	DEFW __head
25	DEFW __tail
26	DEFW __size
27";
28
29#------------------------------------------------------------------------------
30t_z80asm_ok(0, $asm, "\x00\x00\x06\x00\x06\x00", "-r0x0000 -b");
31t_z80asm_ok(0, $asm, "\x00\xF0\x06\xF0\x06\x00", "-r0xF000 -b");
32
33#------------------------------------------------------------------------------
34unlink_testfiles(@testfiles);
35
36write_file('testa.asm', $asm);
37write_file('testb.asm', $asm);
38t_z80asm_capture("-b -r0x0000 testa.asm testb.asm", "", "", 0);
39t_binary(read_binfile('testa.bin'),
40		"\x00\x00\x0C\x00\x0C\x00".
41		"\x00\x00\x0C\x00\x0C\x00");
42
43t_z80asm_capture("-b -r0xF000 testa.asm testb.asm", "", "", 0);
44t_binary(read_binfile('testa.bin'),
45		"\x00\xF0\x0C\xF0\x0C\x00".
46		"\x00\xF0\x0C\xF0\x0C\x00");
47
48unlink_testfiles(@testfiles);
49done_testing();
50