The monitor's assembler takes GNU as directives (.org, .equ, .byte, .half, .word, .ascii, .string, .space, .align, .balign ...), # comments, 0x/0b numbers, '\n' constants, . for the current address, << >> ^ ~, %hi/%lo and the FP CSR short forms; the old ORG/DB/EQU/0FFH forms remain as aliases. The disassembler prints lower case and 0x hex as objdump does. The monitor is built with -msave-restore and puts .rodata first, to fit its ROM. BASIC gains UCASE$ and LCASE$. Manual, README and tests updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
/* The monitor: ROM 20000-27FFF (writes ignored), RAM 28000-29FFF (data only)
|
|
with the saved registers at 29E80h (crt0.S) and the stack below them. */
|
|
OUTPUT_ARCH("riscv")
|
|
ENTRY(_start)
|
|
MEMORY
|
|
{
|
|
ROM (rx) : ORIGIN = 0x20000, LENGTH = 0x8000
|
|
RAM (rw) : ORIGIN = 0x28000, LENGTH = 0x1B00
|
|
}
|
|
SECTIONS
|
|
{
|
|
.text : {
|
|
KEEP(*(.text.start))
|
|
/* the constants before the code: they are reached by LUI and ADDI,
|
|
and relaxation must never take them for gp-relative data, which
|
|
it would if the code (larger before relaxing) pushed them past
|
|
28000h */
|
|
*(.rodata .rodata.* .srodata .srodata.*)
|
|
*(.text .text.*)
|
|
. = ALIGN(4);
|
|
} > ROM
|
|
.data : ALIGN(4) {
|
|
__data_start = .;
|
|
*(.data .data.* .sdata .sdata.*)
|
|
. = ALIGN(4);
|
|
__data_end = .;
|
|
} > RAM AT > ROM
|
|
__data_load = LOADADDR(.data);
|
|
/* the monitor's gp (set in crt0.S): its variables in one instruction */
|
|
/* (0xC00, not 0x800: before relaxing, the ROM overflows into 28000h) */
|
|
__global_pointer$ = ORIGIN(RAM) + 0xC00;
|
|
.bss (NOLOAD) : ALIGN(4) {
|
|
__bss_start = .;
|
|
*(.sbss .sbss.* .bss .bss.* COMMON)
|
|
. = ALIGN(4);
|
|
__bss_end = .;
|
|
} > RAM
|
|
/DISCARD/ : { *(.comment) *(.riscv.attributes) }
|
|
}
|