* rl78/crt0.S: Initialize .saddr. Avoid using SEL.

* rl78/rl78-sim.ld: Add .saddr/.frodata section.
* rl78/rl78.ld: Likewise.
* rl78/rl78-sim.ld: Make room for virtual register banks.
* rl78/rl78.ld: Likewise.

* rl78/vregs.h: New.
* rl78-sys.h: Use it.
* rl78/swrite.S: New.
* rl78/Makefile.in: Build it.
* rl78/write.c: Use it.
This commit is contained in:
DJ Delorie
2015-01-16 22:21:34 +00:00
parent a62dbcd6e0
commit 70e52cba1b
7 changed files with 86 additions and 61 deletions

View File

@@ -147,55 +147,45 @@ _start:
;; block move to initialize .data
;; we're copying from 00:[_romdatastart] to 0F:[_datastart]
;; and our data is not in the mirrored area.
mov es, #0
sel rb0 ; bank 0
movw hl, #__datastart
movw de, #__romdatastart
sel rb1 ; bank 1
movw ax, #__romdatacopysize
shrw ax,1
1:
movw bc, #__romdatacopysize
1:
movw ax, bc
cmpw ax, #0
bz $1f
decw ax
sel rb0 ; bank 0
movw ax, es:[de]
movw [hl], ax
incw de
incw de
incw hl
incw hl
sel rb1
decw bc
decw bc
movw ax, es:__romdatastart[bc]
movw __datastart[bc], ax
br $1b
1:
sel rb0 ; bank 0
1:
mov es, #0
movw bc, #__romsaddrcopysize
1:
movw ax, bc
cmpw ax, #0
bz $1f
decw bc
decw bc
movw ax, es:__romsaddrstart[bc]
movw __saddrstart[bc], ax
br $1b
1:
;; block fill to .bss
sel rb0 ; bank 0
movw hl, #__bssstart
movw bc, #__bsssize
movw ax, #0
sel rb1 ; bank 1
movw ax, #__bsssize
shrw ax,1
1:
cmpw ax, #0
1:
cmpw ax, bc
bz $1f
decw ax
sel rb0 ; bank 0
movw [hl], ax
incw hl
incw hl
sel rb1
movw __bssstart[bc], ax
decw bc
decw bc
br $1b
1:
sel rb0 ; bank 0
1:
call !!__rl78_init