diff options
Diffstat (limited to 'sw/z80/tests')
25 files changed, 95 insertions, 1513 deletions
diff --git a/sw/z80/tests/pio/build/crt0.rel b/sw/z80/tests/pio/build/crt0.rel deleted file mode 100644 index 809c0e6..0000000 --- a/sw/z80/tests/pio/build/crt0.rel +++ /dev/null @@ -1,86 +0,0 @@ -XL2 -H 14 areas 5 global symbols -M crt0 -S _main Ref0000 -S .__.ABS. Def0000 -A _CODE size A flags 0 addr 0 -S __clock Def0000 -S _exit Def0004 -A _HEADER size 0 flags 8 addr 0 -A _HEADER0 size 3 flags 8 addr 0 -A _HEADER1 size 2 flags 8 addr 8 -A _HEADER2 size 2 flags 8 addr 10 -A _HEADER3 size 2 flags 8 addr 18 -A _HEADER4 size 2 flags 8 addr 20 -A _HEADER5 size 2 flags 8 addr 28 -A _HEADER6 size 2 flags 8 addr 30 -A _HEADER7 size 2 flags 8 addr 38 -A _HEADER8 size C flags 8 addr 100 -A _HOME size 0 flags 0 addr 0 -A _INITIALIZER size 0 flags 0 addr 0 -A _GSINIT size 6 flags 0 addr 0 -S gsinit Def0000 -A _GSFINAL size 1 flags 0 addr 0 -A _DATA size 0 flags 0 addr 0 -A _INITIALIZED size 0 flags 0 addr 0 -A _BSEG size 0 flags 0 addr 0 -A _BSS size 0 flags 0 addr 0 -A _HEAP size 0 flags 0 addr 0 -T 00 00 -R 00 00 02 00 -T 00 00 C3 00 01 -R 00 00 02 00 00 03 0A 00 -T 08 00 -R 00 00 03 00 -T 08 00 ED 4D -R 00 00 03 00 -T 10 00 -R 00 00 04 00 -T 10 00 ED 4D -R 00 00 04 00 -T 18 00 -R 00 00 05 00 -T 18 00 ED 4D -R 00 00 05 00 -T 20 00 -R 00 00 06 00 -T 20 00 ED 4D -R 00 00 06 00 -T 28 00 -R 00 00 07 00 -T 28 00 ED 4D -R 00 00 07 00 -T 30 00 -R 00 00 08 00 -T 30 00 ED 4D -R 00 00 08 00 -T 38 00 -R 00 00 09 00 -T 38 00 ED 4D -R 00 00 09 00 -T 00 01 -R 00 00 0A 00 -T 00 01 -R 00 00 0A 00 -T 00 01 31 FF FF CD 00 00 CD 00 00 C3 04 00 -R 00 00 0A 00 00 06 0D 00 02 09 00 00 00 0C 00 00 -T 00 00 -R 00 00 00 00 -T 00 00 3E 02 CF C9 -R 00 00 00 00 -T 04 00 -R 00 00 00 00 -T 04 00 3E 00 CF -R 00 00 00 00 -T 07 00 -R 00 00 00 00 -T 07 00 76 18 FD -R 00 00 00 00 -T 00 00 -R 00 00 0D 00 -T 00 00 78 B1 28 02 ED B0 -R 00 00 0D 00 -T 06 00 -R 00 00 0D 00 -T 00 00 C9 -R 00 00 0E 00 diff --git a/sw/z80/tests/pio/build/main.asm b/sw/z80/tests/pio/build/main.asm deleted file mode 100644 index 453eead..0000000 --- a/sw/z80/tests/pio/build/main.asm +++ /dev/null @@ -1,80 +0,0 @@ -;-------------------------------------------------------- -; File Created by SDCC : free open source ANSI-C Compiler -; Version 3.6.0 #9615 (Linux) -;-------------------------------------------------------- - .module main - .optsdcc -mz80 - -;-------------------------------------------------------- -; Public variables in this module -;-------------------------------------------------------- - .globl _main - .globl _pio_write - .globl _pio_set_mode -;-------------------------------------------------------- -; special function registers -;-------------------------------------------------------- -;-------------------------------------------------------- -; ram data -;-------------------------------------------------------- - .area _DATA -;-------------------------------------------------------- -; ram data -;-------------------------------------------------------- - .area _INITIALIZED -;-------------------------------------------------------- -; absolute external ram data -;-------------------------------------------------------- - .area _DABS (ABS) -;-------------------------------------------------------- -; global & static initialisations -;-------------------------------------------------------- - .area _HOME - .area _GSINIT - .area _GSFINAL - .area _GSINIT -;-------------------------------------------------------- -; Home -;-------------------------------------------------------- - .area _HOME - .area _HOME -;-------------------------------------------------------- -; code -;-------------------------------------------------------- - .area _CODE -;main.c:3: void main(void) -; --------------------------------- -; Function main -; --------------------------------- -_main:: -;main.c:7: pio_set_mode(PIO_A, PIO_MODE_BYTE_OUT, 0); - xor a, a - push af - inc sp - ld hl,#0x0001 - push hl - ld l, #0x00 - push hl - call _pio_set_mode - pop af - pop af - inc sp -;main.c:9: while (1) { - ld c,#0x00 -00102$: -;main.c:10: pio_write(PIO_A, j++); - ld b,c - inc c - push bc - push bc - inc sp - ld hl,#0x0000 - push hl - call _pio_write - pop af - inc sp - pop bc - jr 00102$ - .area _CODE - .area _INITIALIZER - .area _CABS (ABS) diff --git a/sw/z80/tests/pio/build/main.lst b/sw/z80/tests/pio/build/main.lst deleted file mode 100644 index 4a1a872..0000000 --- a/sw/z80/tests/pio/build/main.lst +++ /dev/null @@ -1,80 +0,0 @@ - 1 ;-------------------------------------------------------- - 2 ; File Created by SDCC : free open source ANSI-C Compiler - 3 ; Version 3.6.0 #9615 (Linux) - 4 ;-------------------------------------------------------- - 5 .module main - 6 .optsdcc -mz80 - 7 - 8 ;-------------------------------------------------------- - 9 ; Public variables in this module - 10 ;-------------------------------------------------------- - 11 .globl _main - 12 .globl _pio_write - 13 .globl _pio_set_mode - 14 ;-------------------------------------------------------- - 15 ; special function registers - 16 ;-------------------------------------------------------- - 17 ;-------------------------------------------------------- - 18 ; ram data - 19 ;-------------------------------------------------------- - 20 .area _DATA - 21 ;-------------------------------------------------------- - 22 ; ram data - 23 ;-------------------------------------------------------- - 24 .area _INITIALIZED - 25 ;-------------------------------------------------------- - 26 ; absolute external ram data - 27 ;-------------------------------------------------------- - 28 .area _DABS (ABS) - 29 ;-------------------------------------------------------- - 30 ; global & static initialisations - 31 ;-------------------------------------------------------- - 32 .area _HOME - 33 .area _GSINIT - 34 .area _GSFINAL - 35 .area _GSINIT - 36 ;-------------------------------------------------------- - 37 ; Home - 38 ;-------------------------------------------------------- - 39 .area _HOME - 40 .area _HOME - 41 ;-------------------------------------------------------- - 42 ; code - 43 ;-------------------------------------------------------- - 44 .area _CODE - 45 ;main.c:3: void main(void) - 46 ; --------------------------------- - 47 ; Function main - 48 ; --------------------------------- - 0000 49 _main:: - 50 ;main.c:7: pio_set_mode(PIO_A, PIO_MODE_BYTE_OUT, 0); - 0000 AF [ 4] 51 xor a, a - 0001 F5 [11] 52 push af - 0002 33 [ 6] 53 inc sp - 0003 21 01 00 [10] 54 ld hl,#0x0001 - 0006 E5 [11] 55 push hl - 0007 2E 00 [ 7] 56 ld l, #0x00 - 0009 E5 [11] 57 push hl - 000A CDr00r00 [17] 58 call _pio_set_mode - 000D F1 [10] 59 pop af - 000E F1 [10] 60 pop af - 000F 33 [ 6] 61 inc sp - 62 ;main.c:9: while (1) { - 0010 0E 00 [ 7] 63 ld c,#0x00 - 0012 64 00102$: - 65 ;main.c:10: pio_write(PIO_A, j++); - 0012 41 [ 4] 66 ld b,c - 0013 0C [ 4] 67 inc c - 0014 C5 [11] 68 push bc - 0015 C5 [11] 69 push bc - 0016 33 [ 6] 70 inc sp - 0017 21 00 00 [10] 71 ld hl,#0x0000 - 001A E5 [11] 72 push hl - 001B CDr00r00 [17] 73 call _pio_write - 001E F1 [10] 74 pop af - 001F 33 [ 6] 75 inc sp - 0020 C1 [10] 76 pop bc - 0021 18 EF [12] 77 jr 00102$ - 78 .area _CODE - 79 .area _INITIALIZER - 80 .area _CABS (ABS) diff --git a/sw/z80/tests/pio/build/main.rel b/sw/z80/tests/pio/build/main.rel deleted file mode 100644 index bc2bd98..0000000 --- a/sw/z80/tests/pio/build/main.rel +++ /dev/null @@ -1,29 +0,0 @@ -XL2 -H 9 areas 4 global symbols -M main -O -mz80 -S _pio_set_mode Ref0000 -S .__.ABS. Def0000 -S _pio_write Ref0000 -A _CODE size 23 flags 0 addr 0 -S _main Def0000 -A _DATA size 0 flags 0 addr 0 -A _INITIALIZED size 0 flags 0 addr 0 -A _DABS size 0 flags 8 addr 0 -A _HOME size 0 flags 0 addr 0 -A _GSINIT size 0 flags 0 addr 0 -A _GSFINAL size 0 flags 0 addr 0 -A _INITIALIZER size 0 flags 0 addr 0 -A _CABS size 0 flags 8 addr 0 -T 00 00 -R 00 00 00 00 -T 00 00 AF F5 33 21 01 00 E5 2E 00 E5 CD 00 00 F1 -R 00 00 00 00 02 0D 00 00 -T 0E 00 F1 33 0E 00 -R 00 00 00 00 -T 12 00 -R 00 00 00 00 -T 12 00 41 0C C5 C5 33 21 00 00 E5 CD 00 00 F1 33 -R 00 00 00 00 02 0C 02 00 -T 20 00 C1 18 EF -R 00 00 00 00 diff --git a/sw/z80/tests/pio/build/main.sym b/sw/z80/tests/pio/build/main.sym deleted file mode 100644 index 08d28a3..0000000 --- a/sw/z80/tests/pio/build/main.sym +++ /dev/null @@ -1,29 +0,0 @@ -ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 1. -Hexadecimal [16-Bits] - -Symbol Table - - .__.$$$. = 2710 L - .__.ABS. = 0000 G - .__.CPU. = 0000 L - .__.H$L. = 0000 L - 0 _main 0000 GR - _pio_set_mode **** GX - _pio_write **** GX - - -ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 2. -Hexadecimal [16-Bits] - -Area Table - - 0 _CODE size 23 flags 0 - 1 _DATA size 0 flags 0 - 2 _INITIALIZED size 0 flags 0 - 3 _DABS size 0 flags 8 - 4 _HOME size 0 flags 0 - 5 _GSINIT size 0 flags 0 - 6 _GSFINAL size 0 flags 0 - 7 _INITIALIZER size 0 flags 0 - 8 _CABS size 0 flags 8 - diff --git a/sw/z80/tests/pio/build/pio_test.lk b/sw/z80/tests/pio/build/pio_test.lk deleted file mode 100644 index 20c32cc..0000000 --- a/sw/z80/tests/pio/build/pio_test.lk +++ /dev/null @@ -1,13 +0,0 @@ --mjwx --i build/pio_test.hex --b _CODE = 0x0800 --b _DATA = 0x2000 --k ../../drivers/build/ --k /usr/libexec/../share/sdcc/lib/z80 --k /usr/share/sdcc/lib/z80 --l drivers.a --l z80 -build/crt0.rel -build/main.rel - --e diff --git a/sw/z80/tests/pio/build/pio_test.map b/sw/z80/tests/pio/build/pio_test.map deleted file mode 100644 index e91ef69..0000000 --- a/sw/z80/tests/pio/build/pio_test.map +++ /dev/null @@ -1,213 +0,0 @@ -ASxxxx Linker V03.00 + NoICE + sdld, page 1. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -. .ABS. 00000000 00000000 = 0. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ - 00000000 .__.ABS. pio - 00000000 l__BSEG - 00000000 l__BSS - 00000000 l__CABS - 00000000 l__DABS - 00000000 l__DATA - 00000000 l__HEADER - 00000000 l__HEAP - 00000000 l__HOME - 00000000 s__CABS - 00000000 s__DABS - 00000000 s__HEADER - 00000000 s__HEADER0 - 00000000 s__HEADER1 - 00000000 s__HEADER2 - 00000000 s__HEADER3 - 00000000 s__HEADER4 - 00000000 s__HEADER5 - 00000000 s__HEADER6 - 00000000 s__HEADER7 - 00000000 s__HEADER8 - 00000001 l__GSFINAL - 00000002 l__HEADER1 - 00000002 l__HEADER2 - 00000002 l__HEADER3 - 00000002 l__HEADER4 - 00000002 l__HEADER5 - 00000002 l__HEADER6 - 00000002 l__HEADER7 - 00000003 l__HEADER0 - 00000004 l__INITIALIZED - 00000004 l__INITIALIZER - 00000006 l__GSINIT - 0000000C l__HEADER8 - 000000FD l__CODE - 00000800 s__CODE - 000008FD s__HOME - 000008FD s__INITIALIZER - 00000901 s__GSINIT - 00000907 s__GSFINAL - 00002000 s__DATA - 00002000 s__INITIALIZED - 00002004 s__BSEG - 00002004 s__BSS - 00002004 s__HEAP -ASxxxx Linker V03.00 + NoICE + sdld, page 2. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_CODE 00000800 000000FD = 253. bytes (REL,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ - 00000800 __clock crt0 - 00000804 _exit crt0 - 0000080A _main main - 0000082D __pio_data pio - 00000847 __pio_control pio - 00000861 _pio_set_mode pio - 0000089D _pio_set_interrupts pio - 000008B0 _pio_set_interrupts_mask pio - 000008D7 _pio_read pio - 000008ED _pio_write pio - -ASxxxx Linker V03.00 + NoICE + sdld, page 3. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER0 00000000 00000003 = 3. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 4. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER1 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 5. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER2 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 6. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER3 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 7. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER4 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 8. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER5 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 9. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER6 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 10. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER7 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 11. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER8 00000000 0000000C = 12. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 12. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_INITIALIZER 000008FD 00000004 = 4. bytes (REL,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 13. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_GSINIT 00000901 00000006 = 6. bytes (REL,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ - 00000901 gsinit crt0 - -ASxxxx Linker V03.00 + NoICE + sdld, page 14. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_GSFINAL 00000907 00000001 = 1. bytes (REL,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 15. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_INITIALIZED 00002000 00000004 = 4. bytes (REL,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 16. - -Files Linked [ module(s) ] - -build/crt0.rel [ crt0 ] -build/main.rel [ main ] - - -Libraries Linked [ object file ] - -../../drivers/build/drivers.a [ pio.rel ] - -ASxxxx Linker V03.00 + NoICE + sdld, page 17. - -User Base Address Definitions - -_CODE = 0x0800 -_DATA = 0x2000 - -
\ No newline at end of file diff --git a/sw/z80/tests/pio/build/pio_test.noi b/sw/z80/tests/pio/build/pio_test.noi deleted file mode 100644 index 3ddefe7..0000000 --- a/sw/z80/tests/pio/build/pio_test.noi +++ /dev/null @@ -1,57 +0,0 @@ -DEF .__.ABS. 0x0 -DEF l__BSEG 0x0 -DEF l__BSS 0x0 -DEF l__CABS 0x0 -DEF l__DABS 0x0 -DEF l__DATA 0x0 -DEF l__HEADER 0x0 -DEF l__HEAP 0x0 -DEF l__HOME 0x0 -DEF s__CABS 0x0 -DEF s__DABS 0x0 -DEF s__HEADER 0x0 -DEF s__HEADER0 0x0 -DEF s__HEADER1 0x0 -DEF s__HEADER2 0x0 -DEF s__HEADER3 0x0 -DEF s__HEADER4 0x0 -DEF s__HEADER5 0x0 -DEF s__HEADER6 0x0 -DEF s__HEADER7 0x0 -DEF s__HEADER8 0x0 -DEF l__GSFINAL 0x1 -DEF l__HEADER1 0x2 -DEF l__HEADER2 0x2 -DEF l__HEADER3 0x2 -DEF l__HEADER4 0x2 -DEF l__HEADER5 0x2 -DEF l__HEADER6 0x2 -DEF l__HEADER7 0x2 -DEF l__HEADER0 0x3 -DEF l__INITIALIZED 0x4 -DEF l__INITIALIZER 0x4 -DEF l__GSINIT 0x6 -DEF l__HEADER8 0xC -DEF l__CODE 0xFD -DEF s__CODE 0x800 -DEF s__HOME 0x8FD -DEF s__INITIALIZER 0x8FD -DEF s__GSINIT 0x901 -DEF s__GSFINAL 0x907 -DEF s__DATA 0x2000 -DEF s__INITIALIZED 0x2000 -DEF s__BSEG 0x2004 -DEF s__BSS 0x2004 -DEF s__HEAP 0x2004 -DEF __clock 0x800 -DEF _exit 0x804 -DEF _main 0x80A -DEF __pio_data 0x82D -DEF __pio_control 0x847 -DEF _pio_set_mode 0x861 -DEF _pio_set_interrupts 0x89D -DEF _pio_set_interrupts_mask 0x8B0 -DEF _pio_read 0x8D7 -DEF _pio_write 0x8ED -DEF gsinit 0x901 -LOAD build/pio_test.ihx diff --git a/sw/z80/tests/pio/crt0.s b/sw/z80/tests/pio/crt0.s index c272f06..eabe06c 100644 --- a/sw/z80/tests/pio/crt0.s +++ b/sw/z80/tests/pio/crt0.s @@ -1,104 +1,40 @@ -;-------------------------------------------------------------------------- -; crt0.s - Generic crt0.s for a Z80 -; -; Copyright (C) 2000, Michael Hope -; -; This library 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, or (at your option) any -; later version. -; -; This library 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 library; see the file COPYING. If not, write to the -; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, -; MA 02110-1301, USA. -; -; As a special exception, if you link this library with other files, -; some of which are compiled with SDCC, to produce an executable, -; this library does not by itself cause the resulting executable to -; be covered by the GNU General Public License. This exception does -; not however invalidate any other reasons why the executable file -; might be covered by the GNU General Public License. -;-------------------------------------------------------------------------- + .module crt0 + .area _HEADER (ABS) - .module crt0 - .globl _main +;; Reset vectors + .org 0 + jp init - .area _HEADER (ABS) - ;; Reset vector - .org 0 - jp init + .org 0x38 ; the instruction 0xff (not written) resets to this location + jp init - .org 0x08 - reti - .org 0x10 - reti - .org 0x18 - reti - .org 0x20 - reti - .org 0x28 - reti - .org 0x30 - reti - .org 0x38 - reti +;; main code + .org 0x100 + .globl _main - .org 0x100 init: - ;; Set stack pointer directly above top of memory. - ld sp,#0xFFFF - - ;; Initialise global variables - call gsinit - call _main - jp _exit - - ;; Ordering of segments for the linker. - .area _HOME - .area _CODE - .area _INITIALIZER - .area _GSINIT - .area _GSFINAL - - .area _DATA - .area _INITIALIZED - .area _BSEG - .area _BSS - .area _HEAP - - .area _CODE - -__clock:: - ld a,#2 - rst 0x08 - ret - -_exit:: - ;; Exit - special code to the emulator - ld a,#0 - rst 0x08 -1$: - halt - jr 1$ - - .area _GSINIT -gsinit:: - ; ld bc, #l__INITIALIZER - ld a, b - or a, c - jr Z, gsinit_next - ; ld de, #s__INITIALIZED - ; ld hl, #s__INITIALIZER - ldir - -gsinit_next: - - .area _GSFINAL - ret - + ;; Set stack pointer directly above top of memory. + ld sp,#0xffff + + ;; Start of the program + call _main + jp _exit + +_exit: + halt + ; jp _exit + +;; Ordering of segments for the linker. + .area _HOME + .area _CODE + .area _INITIALIZER + .area _GSINIT + .area _GSFINAL + + .area _DATA + .area _INITIALIZED + .area _BSEG + .area _BSS + .area _HEAP + + .area _CODE
\ No newline at end of file diff --git a/sw/z80/tests/pio/main.c b/sw/z80/tests/pio/main.c index 4b0bcdb..c1f3741 100644 --- a/sw/z80/tests/pio/main.c +++ b/sw/z80/tests/pio/main.c @@ -1,12 +1,17 @@ #include "pio.h" +#include <stdint.h> + void main(void) { - uint8_t j = 0; + uint8_t i = 0; pio_set_mode(PIO_A, PIO_MODE_BYTE_OUT, 0); while (1) { - pio_write(PIO_A, j++); + pio_write(PIO_A, i); + i = ~i; } + + // return; } diff --git a/sw/z80/tests/pio/makefile b/sw/z80/tests/pio/makefile index bd9d5bf..5c3716c 100644 --- a/sw/z80/tests/pio/makefile +++ b/sw/z80/tests/pio/makefile @@ -1,13 +1,13 @@ #### # source code settings # -NAME := pio_test +OSNAME := pio_test -CSOURCES := $(wildcard *.c) +CSOURCES := $(wildcard *.c) OBJECTS := $(patsubst %.c,build/%.rel,$(CSOURCES)) -HEXFILE := build/$(NAME).hex -BINARY := build/$(NAME).bin +HEXFILE := build/$(OSNAME).hex +BINARY := build/$(OSNAME).bin ### # compiler settings @@ -15,26 +15,31 @@ BINARY := build/$(NAME).bin CC := sdcc CFLAGS := -mz80 \ - -pedantic \ + --allow-unsafe-read \ -I . \ -I ../../arch \ -I ../../drivers/include \ -DDEBUG LDFLAGS := -mz80 \ - -L ../../drivers/build/ \ - -l drivers.a \ --no-std-crt0 build/crt0.rel \ - --code-loc 0x0800 \ - --data-loc 0x2000 + -L ../../drivers/build \ + -l drivers.a \ + -pedantic -.PHONY: dirs dis clean + # --code-loc 0x0120 \ + # --data-loc 0x2000 + +.PHONY: flash dirs dis clean all: $(BINARY) +flash: $(BINARY) + minipro -p M28C64 -w $< + # build binary $(BINARY): $(OBJECTS) dirs $(CC) $(LDFLAGS) $(OBJECTS) -o $(HEXFILE) - makebin -s 8192 $(HEXFILE) $(BINARY) + makebin -s 8192 -yo 1 $(HEXFILE) $(BINARY) $(OBJECTS): build/%.rel : %.c $(CSOURCES) dirs build/crt0.rel @printf "\n" @@ -48,9 +53,14 @@ dirs: mkdir -p build dis: $(BINARY) - @# z80dasm -a -l -g 0h $< -o build/$(OSNAME).s - dz80 -b -n $< + #dz80 -b -n $< + r2 -a z80 $< -A \ + -c 'afr main 0x200; \ + pd 0x10; \ + s 0x100; \ + pd 10; \ + s 0x200; \ + pd 0x40' \ clean: - - rm -rd build/* - - rm crt0.rel + - rm -rd build diff --git a/sw/z80/tests/ram/build/crt0.rel b/sw/z80/tests/ram/build/crt0.rel deleted file mode 100644 index b9ed132..0000000 --- a/sw/z80/tests/ram/build/crt0.rel +++ /dev/null @@ -1,75 +0,0 @@ -XL2 -H 15 areas 3 global symbols -M crt0 -S _main Ref0000 -S .__.ABS. Def0000 -A _CODE size 3 flags 0 addr 0 -S _exit Def0000 -A _HEADER size 0 flags 8 addr 0 -A _HEADER0 size 3 flags 8 addr 0 -A _HEADER1 size 2 flags 8 addr 8 -A _HEADER2 size 2 flags 8 addr 10 -A _HEADER3 size 2 flags 8 addr 18 -A _HEADER4 size 2 flags 8 addr 20 -A _HEADER5 size 2 flags 8 addr 28 -A _HEADER6 size 2 flags 8 addr 30 -A _HEADER7 size 2 flags 8 addr 38 -A _HEADER8 size 2 flags 8 addr 66 -A _HEADER9 size 9 flags 8 addr 100 -A _HOME size 0 flags 0 addr 0 -A _INITIALIZER size 0 flags 0 addr 0 -A _GSINIT size 0 flags 0 addr 0 -A _GSFINAL size 0 flags 0 addr 0 -A _DATA size 0 flags 0 addr 0 -A _INITIALIZED size 0 flags 0 addr 0 -A _BSEG size 0 flags 0 addr 0 -A _BSS size 0 flags 0 addr 0 -A _HEAP size 0 flags 0 addr 0 -T 00 00 -R 00 00 02 00 -T 00 00 C3 00 01 -R 00 00 02 00 00 03 0B 00 -T 08 00 -R 00 00 03 00 -T 08 00 ED 4D -R 00 00 03 00 -T 10 00 -R 00 00 04 00 -T 10 00 ED 4D -R 00 00 04 00 -T 18 00 -R 00 00 05 00 -T 18 00 ED 4D -R 00 00 05 00 -T 20 00 -R 00 00 06 00 -T 20 00 ED 4D -R 00 00 06 00 -T 28 00 -R 00 00 07 00 -T 28 00 ED 4D -R 00 00 07 00 -T 30 00 -R 00 00 08 00 -T 30 00 ED 4D -R 00 00 08 00 -T 38 00 -R 00 00 09 00 -T 38 00 ED 4D -R 00 00 09 00 -T 66 00 -R 00 00 0A 00 -T 66 00 ED 4D -R 00 00 0A 00 -T 00 01 -R 00 00 0B 00 -T 00 01 -R 00 00 0B 00 -T 00 01 31 FF FF CD 00 00 C3 00 00 -R 00 00 0B 00 02 06 00 00 00 09 00 00 -T 00 00 -R 00 00 00 00 -T 00 00 -R 00 00 00 00 -T 00 00 76 18 FD -R 00 00 00 00 diff --git a/sw/z80/tests/ram/build/main.asm b/sw/z80/tests/ram/build/main.asm deleted file mode 100644 index f3b8add..0000000 --- a/sw/z80/tests/ram/build/main.asm +++ /dev/null @@ -1,59 +0,0 @@ -;-------------------------------------------------------- -; File Created by SDCC : free open source ANSI-C Compiler -; Version 3.6.0 #9615 (Linux) -;-------------------------------------------------------- - .module main - .optsdcc -mz80 - -;-------------------------------------------------------- -; Public variables in this module -;-------------------------------------------------------- - .globl _main -;-------------------------------------------------------- -; special function registers -;-------------------------------------------------------- -;-------------------------------------------------------- -; ram data -;-------------------------------------------------------- - .area _DATA -;-------------------------------------------------------- -; ram data -;-------------------------------------------------------- - .area _INITIALIZED -;-------------------------------------------------------- -; absolute external ram data -;-------------------------------------------------------- - .area _DABS (ABS) -;-------------------------------------------------------- -; global & static initialisations -;-------------------------------------------------------- - .area _HOME - .area _GSINIT - .area _GSFINAL - .area _GSINIT -;-------------------------------------------------------- -; Home -;-------------------------------------------------------- - .area _HOME - .area _HOME -;-------------------------------------------------------- -; code -;-------------------------------------------------------- - .area _CODE -;main.c:2: void main(void) -; --------------------------------- -; Function main -; --------------------------------- -_main:: -;main.c:10: while (1) { - ld c,#0x00 -00102$: -;main.c:11: *mem = j++; - ld b,c - inc c - ld hl,#0x8200 - ld (hl),b - jr 00102$ - .area _CODE - .area _INITIALIZER - .area _CABS (ABS) diff --git a/sw/z80/tests/ram/build/main.lst b/sw/z80/tests/ram/build/main.lst deleted file mode 100644 index 17142d4..0000000 --- a/sw/z80/tests/ram/build/main.lst +++ /dev/null @@ -1,59 +0,0 @@ - 1 ;-------------------------------------------------------- - 2 ; File Created by SDCC : free open source ANSI-C Compiler - 3 ; Version 3.6.0 #9615 (Linux) - 4 ;-------------------------------------------------------- - 5 .module main - 6 .optsdcc -mz80 - 7 - 8 ;-------------------------------------------------------- - 9 ; Public variables in this module - 10 ;-------------------------------------------------------- - 11 .globl _main - 12 ;-------------------------------------------------------- - 13 ; special function registers - 14 ;-------------------------------------------------------- - 15 ;-------------------------------------------------------- - 16 ; ram data - 17 ;-------------------------------------------------------- - 18 .area _DATA - 19 ;-------------------------------------------------------- - 20 ; ram data - 21 ;-------------------------------------------------------- - 22 .area _INITIALIZED - 23 ;-------------------------------------------------------- - 24 ; absolute external ram data - 25 ;-------------------------------------------------------- - 26 .area _DABS (ABS) - 27 ;-------------------------------------------------------- - 28 ; global & static initialisations - 29 ;-------------------------------------------------------- - 30 .area _HOME - 31 .area _GSINIT - 32 .area _GSFINAL - 33 .area _GSINIT - 34 ;-------------------------------------------------------- - 35 ; Home - 36 ;-------------------------------------------------------- - 37 .area _HOME - 38 .area _HOME - 39 ;-------------------------------------------------------- - 40 ; code - 41 ;-------------------------------------------------------- - 42 .area _CODE - 43 ;main.c:2: void main(void) - 44 ; --------------------------------- - 45 ; Function main - 46 ; --------------------------------- - 0000 47 _main:: - 48 ;main.c:10: while (1) { - 0000 0E 00 [ 7] 49 ld c,#0x00 - 0002 50 00102$: - 51 ;main.c:11: *mem = j++; - 0002 41 [ 4] 52 ld b,c - 0003 0C [ 4] 53 inc c - 0004 21 00 82 [10] 54 ld hl,#0x8200 - 0007 70 [ 7] 55 ld (hl),b - 0008 18 F8 [12] 56 jr 00102$ - 57 .area _CODE - 58 .area _INITIALIZER - 59 .area _CABS (ABS) diff --git a/sw/z80/tests/ram/build/main.rel b/sw/z80/tests/ram/build/main.rel deleted file mode 100644 index cad7a3c..0000000 --- a/sw/z80/tests/ram/build/main.rel +++ /dev/null @@ -1,23 +0,0 @@ -XL2 -H 9 areas 2 global symbols -M main -O -mz80 -S .__.ABS. Def0000 -A _CODE size A flags 0 addr 0 -S _main Def0000 -A _DATA size 0 flags 0 addr 0 -A _INITIALIZED size 0 flags 0 addr 0 -A _DABS size 0 flags 8 addr 0 -A _HOME size 0 flags 0 addr 0 -A _GSINIT size 0 flags 0 addr 0 -A _GSFINAL size 0 flags 0 addr 0 -A _INITIALIZER size 0 flags 0 addr 0 -A _CABS size 0 flags 8 addr 0 -T 00 00 -R 00 00 00 00 -T 00 00 0E 00 -R 00 00 00 00 -T 02 00 -R 00 00 00 00 -T 02 00 41 0C 21 00 82 70 18 F8 -R 00 00 00 00 diff --git a/sw/z80/tests/ram/build/main.sym b/sw/z80/tests/ram/build/main.sym deleted file mode 100644 index d81bdc8..0000000 --- a/sw/z80/tests/ram/build/main.sym +++ /dev/null @@ -1,27 +0,0 @@ -ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 1. -Hexadecimal [16-Bits] - -Symbol Table - - .__.$$$. = 2710 L - .__.ABS. = 0000 G - .__.CPU. = 0000 L - .__.H$L. = 0000 L - 0 _main 0000 GR - - -ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 2. -Hexadecimal [16-Bits] - -Area Table - - 0 _CODE size A flags 0 - 1 _DATA size 0 flags 0 - 2 _INITIALIZED size 0 flags 0 - 3 _DABS size 0 flags 8 - 4 _HOME size 0 flags 0 - 5 _GSINIT size 0 flags 0 - 6 _GSFINAL size 0 flags 0 - 7 _INITIALIZER size 0 flags 0 - 8 _CABS size 0 flags 8 - diff --git a/sw/z80/tests/ram/build/ram_test.lk b/sw/z80/tests/ram/build/ram_test.lk deleted file mode 100644 index 724eb89..0000000 --- a/sw/z80/tests/ram/build/ram_test.lk +++ /dev/null @@ -1,11 +0,0 @@ --mjwx --i build/ram_test.hex --b _CODE = 0x0000 --b _DATA = 0x2000 --k /usr/libexec/../share/sdcc/lib/z80 --k /usr/share/sdcc/lib/z80 --l z80 -build/crt0.rel -build/main.rel - --e diff --git a/sw/z80/tests/ram/build/ram_test.map b/sw/z80/tests/ram/build/ram_test.map deleted file mode 100644 index 0d36247..0000000 --- a/sw/z80/tests/ram/build/ram_test.map +++ /dev/null @@ -1,174 +0,0 @@ -ASxxxx Linker V03.00 + NoICE + sdld, page 1. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -. .ABS. 00000000 00000000 = 0. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ - 00000000 .__.ABS. main - 00000000 l__BSEG - 00000000 l__BSS - 00000000 l__CABS - 00000000 l__DABS - 00000000 l__DATA - 00000000 l__GSFINAL - 00000000 l__GSINIT - 00000000 l__HEADER - 00000000 l__HEAP - 00000000 l__HOME - 00000000 l__INITIALIZED - 00000000 l__INITIALIZER - 00000000 s__CABS - 00000000 s__CODE - 00000000 s__DABS - 00000000 s__HEADER - 00000000 s__HEADER0 - 00000000 s__HEADER1 - 00000000 s__HEADER2 - 00000000 s__HEADER3 - 00000000 s__HEADER4 - 00000000 s__HEADER5 - 00000000 s__HEADER6 - 00000000 s__HEADER7 - 00000000 s__HEADER8 - 00000000 s__HEADER9 - 00000002 l__HEADER1 - 00000002 l__HEADER2 - 00000002 l__HEADER3 - 00000002 l__HEADER4 - 00000002 l__HEADER5 - 00000002 l__HEADER6 - 00000002 l__HEADER7 - 00000002 l__HEADER8 - 00000003 l__HEADER0 - 00000009 l__HEADER9 - 0000000D l__CODE - 0000000D s__GSFINAL - 0000000D s__GSINIT - 0000000D s__HOME - 0000000D s__INITIALIZER - 00002000 s__BSEG - 00002000 s__BSS - 00002000 s__DATA - 00002000 s__HEAP - 00002000 s__INITIALIZED - -ASxxxx Linker V03.00 + NoICE + sdld, page 2. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_CODE 00000000 0000000D = 13. bytes (REL,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ - 00000000 _exit crt0 - 00000003 _main main - -ASxxxx Linker V03.00 + NoICE + sdld, page 3. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER0 00000000 00000003 = 3. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 4. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER1 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 5. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER2 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 6. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER3 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 7. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER4 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 8. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER5 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 9. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER6 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 10. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER7 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 11. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER8 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 12. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER9 00000000 00000009 = 9. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 13. - -Files Linked [ module(s) ] - -build/crt0.rel [ crt0 ] -build/main.rel [ main ] - -ASxxxx Linker V03.00 + NoICE + sdld, page 14. - -User Base Address Definitions - -_CODE = 0x0000 -_DATA = 0x2000 - -
\ No newline at end of file diff --git a/sw/z80/tests/ram/build/ram_test.noi b/sw/z80/tests/ram/build/ram_test.noi deleted file mode 100644 index 94266c5..0000000 --- a/sw/z80/tests/ram/build/ram_test.noi +++ /dev/null @@ -1,50 +0,0 @@ -DEF .__.ABS. 0x0 -DEF l__BSEG 0x0 -DEF l__BSS 0x0 -DEF l__CABS 0x0 -DEF l__DABS 0x0 -DEF l__DATA 0x0 -DEF l__GSFINAL 0x0 -DEF l__GSINIT 0x0 -DEF l__HEADER 0x0 -DEF l__HEAP 0x0 -DEF l__HOME 0x0 -DEF l__INITIALIZED 0x0 -DEF l__INITIALIZER 0x0 -DEF s__CABS 0x0 -DEF s__CODE 0x0 -DEF s__DABS 0x0 -DEF s__HEADER 0x0 -DEF s__HEADER0 0x0 -DEF s__HEADER1 0x0 -DEF s__HEADER2 0x0 -DEF s__HEADER3 0x0 -DEF s__HEADER4 0x0 -DEF s__HEADER5 0x0 -DEF s__HEADER6 0x0 -DEF s__HEADER7 0x0 -DEF s__HEADER8 0x0 -DEF s__HEADER9 0x0 -DEF l__HEADER1 0x2 -DEF l__HEADER2 0x2 -DEF l__HEADER3 0x2 -DEF l__HEADER4 0x2 -DEF l__HEADER5 0x2 -DEF l__HEADER6 0x2 -DEF l__HEADER7 0x2 -DEF l__HEADER8 0x2 -DEF l__HEADER0 0x3 -DEF l__HEADER9 0x9 -DEF l__CODE 0xD -DEF s__GSFINAL 0xD -DEF s__GSINIT 0xD -DEF s__HOME 0xD -DEF s__INITIALIZER 0xD -DEF s__BSEG 0x2000 -DEF s__BSS 0x2000 -DEF s__DATA 0x2000 -DEF s__HEAP 0x2000 -DEF s__INITIALIZED 0x2000 -DEF _exit 0x0 -DEF _main 0x3 -LOAD build/ram_test.ihx diff --git a/sw/z80/tests/ram/build/test.lk b/sw/z80/tests/ram/build/test.lk deleted file mode 100644 index 03a8db4..0000000 --- a/sw/z80/tests/ram/build/test.lk +++ /dev/null @@ -1,11 +0,0 @@ --mjwx --i build/test.hex --b _CODE = 0x0000 --b _DATA = 0x2000 --k /usr/libexec/../share/sdcc/lib/z80 --k /usr/share/sdcc/lib/z80 --l z80 -build/crt0.rel -build/main.rel - --e diff --git a/sw/z80/tests/ram/build/test.map b/sw/z80/tests/ram/build/test.map deleted file mode 100644 index 07b953f..0000000 --- a/sw/z80/tests/ram/build/test.map +++ /dev/null @@ -1,162 +0,0 @@ -ASxxxx Linker V03.00 + NoICE + sdld, page 1. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -. .ABS. 00000000 00000000 = 0. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ - 00000000 .__.ABS. main - 00000000 l__BSEG - 00000000 l__BSS - 00000000 l__CABS - 00000000 l__DABS - 00000000 l__DATA - 00000000 l__GSFINAL - 00000000 l__GSINIT - 00000000 l__HEADER - 00000000 l__HEAP - 00000000 l__HOME - 00000000 l__INITIALIZED - 00000000 l__INITIALIZER - 00000000 s__CABS - 00000000 s__CODE - 00000000 s__DABS - 00000000 s__HEADER - 00000000 s__HEADER0 - 00000000 s__HEADER1 - 00000000 s__HEADER2 - 00000000 s__HEADER3 - 00000000 s__HEADER4 - 00000000 s__HEADER5 - 00000000 s__HEADER6 - 00000000 s__HEADER7 - 00000000 s__HEADER8 - 00000002 l__HEADER1 - 00000002 l__HEADER2 - 00000002 l__HEADER3 - 00000002 l__HEADER4 - 00000002 l__HEADER5 - 00000002 l__HEADER6 - 00000002 l__HEADER7 - 00000003 l__HEADER0 - 00000009 l__HEADER8 - 0000000D l__CODE - 0000000D s__GSFINAL - 0000000D s__GSINIT - 0000000D s__HOME - 0000000D s__INITIALIZER - 00002000 s__BSEG - 00002000 s__BSS - 00002000 s__DATA - 00002000 s__HEAP - 00002000 s__INITIALIZED -ASxxxx Linker V03.00 + NoICE + sdld, page 2. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_CODE 00000000 0000000D = 13. bytes (REL,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ - 00000000 _exit crt0 - 00000003 _main main - -ASxxxx Linker V03.00 + NoICE + sdld, page 3. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER0 00000000 00000003 = 3. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 4. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER1 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 5. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER2 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 6. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER3 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 7. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER4 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 8. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER5 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 9. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER6 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 10. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER7 00000000 00000002 = 2. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 11. -Hexadecimal [32-Bits] - -Area Addr Size Decimal Bytes (Attributes) --------------------------------- ---- ---- ------- ----- ------------ -_HEADER8 00000000 00000009 = 9. bytes (ABS,CON) - - Value Global Global Defined In Module - ----- -------------------------------- ------------------------ -ASxxxx Linker V03.00 + NoICE + sdld, page 12. - -Files Linked [ module(s) ] - -build/crt0.rel [ crt0 ] -build/main.rel [ main ] - -ASxxxx Linker V03.00 + NoICE + sdld, page 13. - -User Base Address Definitions - -_CODE = 0x0000 -_DATA = 0x2000 - -
\ No newline at end of file diff --git a/sw/z80/tests/ram/build/test.noi b/sw/z80/tests/ram/build/test.noi deleted file mode 100644 index 403beda..0000000 --- a/sw/z80/tests/ram/build/test.noi +++ /dev/null @@ -1,48 +0,0 @@ -DEF .__.ABS. 0x0 -DEF l__BSEG 0x0 -DEF l__BSS 0x0 -DEF l__CABS 0x0 -DEF l__DABS 0x0 -DEF l__DATA 0x0 -DEF l__GSFINAL 0x0 -DEF l__GSINIT 0x0 -DEF l__HEADER 0x0 -DEF l__HEAP 0x0 -DEF l__HOME 0x0 -DEF l__INITIALIZED 0x0 -DEF l__INITIALIZER 0x0 -DEF s__CABS 0x0 -DEF s__CODE 0x0 -DEF s__DABS 0x0 -DEF s__HEADER 0x0 -DEF s__HEADER0 0x0 -DEF s__HEADER1 0x0 -DEF s__HEADER2 0x0 -DEF s__HEADER3 0x0 -DEF s__HEADER4 0x0 -DEF s__HEADER5 0x0 -DEF s__HEADER6 0x0 -DEF s__HEADER7 0x0 -DEF s__HEADER8 0x0 -DEF l__HEADER1 0x2 -DEF l__HEADER2 0x2 -DEF l__HEADER3 0x2 -DEF l__HEADER4 0x2 -DEF l__HEADER5 0x2 -DEF l__HEADER6 0x2 -DEF l__HEADER7 0x2 -DEF l__HEADER0 0x3 -DEF l__HEADER8 0x9 -DEF l__CODE 0xD -DEF s__GSFINAL 0xD -DEF s__GSINIT 0xD -DEF s__HOME 0xD -DEF s__INITIALIZER 0xD -DEF s__BSEG 0x2000 -DEF s__BSS 0x2000 -DEF s__DATA 0x2000 -DEF s__HEAP 0x2000 -DEF s__INITIALIZED 0x2000 -DEF _exit 0x0 -DEF _main 0x3 -LOAD build/test.ihx diff --git a/sw/z80/tests/ram/build/test.z80 b/sw/z80/tests/ram/build/test.z80 deleted file mode 100644 index 25a162a..0000000 --- a/sw/z80/tests/ram/build/test.z80 +++ /dev/null @@ -1,73 +0,0 @@ -; -; DZ80 V3.4.1 Z80 Disassembly of build/test.bin -; 2017/09/26 09:42 -; - org 0x0 -; -X0000: halt -; - jr X0000 -; -X0003: ld c,0x0 -X0005: ld b,c - inc c - ld hl,X8200 - ld (hl),b - jr X0005 -; - rst 0x38 -; - org 0x10 -; - reti -; - rst 0x38 -; - org 0x18 -; - reti -; - rst 0x38 -; - org 0x20 -; - reti -; - rst 0x38 -; - org 0x28 -; - reti -; - rst 0x38 -; - org 0x30 -; - reti -; - rst 0x38 -; - org 0x38 -; - reti -; - rst 0x38 -; - org 0x100 -; - ld sp,Xffff - call X0003 - jp X0000 -; -; Miscellaneous equates -; -; These are addresses referenced in the code but -; which are in the middle of a multibyte instruction -; or are addresses outside the initialized space -; -X8200 equ 0x8200 -Xffff equ 0xffff -; - end -; - diff --git a/sw/z80/tests/ram/crt0.s b/sw/z80/tests/ram/crt0.s index d775e66..b0caa8c 100644 --- a/sw/z80/tests/ram/crt0.s +++ b/sw/z80/tests/ram/crt0.s @@ -1,38 +1,30 @@ .module crt0 - .globl _main - .area _HEADER (ABS) - ;; Reset vector + +;; Reset vectors .org 0 jp init - .org 0x08 - reti - .org 0x10 - reti - .org 0x18 - reti - .org 0x20 - reti - .org 0x28 - reti - .org 0x30 - reti - .org 0x38 - reti - .org 0x66 - reti + .org 0x38 ; the instruction 0xff (not written) resets to this location + jp init +;; main code .org 0x100 + .globl _main + init: ;; Set stack pointer directly above top of memory. - ld sp,#0xFFFF + ld sp,#0xffff ;; Start of the program call _main jp _exit - ;; Ordering of segments for the linker. +_exit: + halt + jp _exit + +;; Ordering of segments for the linker. .area _HOME .area _CODE .area _INITIALIZER @@ -45,9 +37,4 @@ init: .area _BSS .area _HEAP - .area _CODE - -_exit:: -1$: - halt - jr 1$ + .area _CODE
\ No newline at end of file diff --git a/sw/z80/tests/ram/makefile b/sw/z80/tests/ram/makefile index b8435a7..3db0a67 100644 --- a/sw/z80/tests/ram/makefile +++ b/sw/z80/tests/ram/makefile @@ -18,19 +18,23 @@ CFLAGS := -mz80 \ -I . \ -DDEBUG -LDFLAGS := -mz80 --no-std-crt0 build/crt0.rel \ - --std-c89 -pedantic \ - --code-loc 0x0000 --data-loc 0x2000 +LDFLAGS := -mz80 \ + --no-std-crt0 build/crt0.rel \ + -pedantic -.PHONY: dirs dis clean + # --code-loc 0x0120 \ + # --data-loc 0x2000 + +.PHONY: flash dirs dis clean all: $(BINARY) +flash: $(BINARY) + minipro -p M28C64 -w $< + # build binary $(BINARY): $(OBJECTS) dirs $(CC) $(LDFLAGS) $(OBJECTS) -o $(HEXFILE) - @# xxd -r -p $(HEXFILE) $(BINARY) - @# makebin -s 16384 $(HEXFILE) $(BINARY) - makebin -s 8192 $(HEXFILE) $(BINARY) + makebin -s 8192 -yo 1 $(HEXFILE) $(BINARY) $(OBJECTS): build/%.rel : %.c $(CSOURCES) dirs build/crt0.rel @printf "\n" @@ -44,9 +48,8 @@ dirs: mkdir -p build dis: $(BINARY) - @# z80dasm -a -l -g 0h $< -o build/$(OSNAME).s - dz80 -b -n $< + #dz80 -b -n $< + r2 -a z80 $< -c 'pd 0x10; s 0x100; pd 10; s 0x200; pd 10' clean: - - rm -rd build/* - - rm crt0.rel + - rm -rd build |