forked from amberisvibin/chibi-pc09
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
f9e2afcc5d
|
@@ -1,5 +1,13 @@
|
|||||||
# chibi pc-09
|
# chibi pc-09
|
||||||
|
|
||||||
|
## Archived!
|
||||||
|
|
||||||
|
This repo has been archived, and the different parts have been migrated to other repos.
|
||||||
|
|
||||||
|
The PCB for prototype 1 has been moved to https://gitea.ambersplace.net/chibi/pc09-prototype-1
|
||||||
|
|
||||||
|
The firmware has been moved to https://gitea.ambersplace.net/chibi/chibi-firmware
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
@@ -1,33 +1,29 @@
|
|||||||
# Boot Firmware for CHIBI PC-09
|
# Boot Firmware for CHIBI PC-09
|
||||||
|
|
||||||
This is the firmware for the CHIBI PC-09. In the future it will provide the
|
TODO: Description of what the firmware does for the PC-09.
|
||||||
CHIBI with initialization code, a UART driver, some self test features.
|
|
||||||
|
|
||||||
## Building the Firmware
|
## Building the Firmware
|
||||||
|
|
||||||
Building the firmware from source requires [LWTOOLS](http://www.lwtools.ca/) for
|
You will need GNU `make`, and [`asm6809`](https://www.6809.org.uk/asm6809) to
|
||||||
building S-Records of the ROM, and `mot2bin` from
|
build the firmware. Obtaining a working copy of `asm6809` could be difficult if
|
||||||
[F9DASM](https://github.com/Arakula/f9dasm) for building binary images. A GNU
|
you aren't on Debian, Ubuntu, or Windows as instructions for building it are not
|
||||||
Make makefile is provided for building on Linux.
|
given on the `asm6809` website. Functional instructions for building from Git or
|
||||||
|
tarball are given here:
|
||||||
### Using the Makefile
|
|
||||||
|
|
||||||
To generate an S-Record run:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
make boot.s19
|
|
||||||
```
|
|
||||||
|
|
||||||
To generate a binary run:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
git clone https://www.6809.org.uk/git/asm6809.git
|
||||||
|
cd asm6809
|
||||||
|
./configure
|
||||||
make
|
make
|
||||||
|
sudo make install
|
||||||
```
|
```
|
||||||
|
|
||||||
The makefile also can clean up after itself:
|
From there all you should have to do to generate a `boot.bin` is:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clean
|
git clone https://github.com/amberisvibin/chibi-pc09.git
|
||||||
|
cd chibi-pc09/code/boot
|
||||||
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
## Firmware Licensing
|
## Firmware Licensing
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
TARGET := boot
|
TARGET := boot
|
||||||
TARGREC := $(TARGET).s19
|
|
||||||
TARGROM := $(TARGET).bin
|
TARGROM := $(TARGET).bin
|
||||||
SRCDIR := src/
|
SRCDIR := src/
|
||||||
BUILDDIR := build/
|
BUILDDIR := build/
|
||||||
@@ -23,7 +22,7 @@ INCS := $(wildcard $(SRCDIR)*.inc)
|
|||||||
|
|
||||||
AS := lwasm
|
AS := lwasm
|
||||||
LD := lwlink
|
LD := lwlink
|
||||||
FIX := objcopy
|
FIX := mot2bin
|
||||||
|
|
||||||
ASFLAGS := -f obj
|
ASFLAGS := -f obj
|
||||||
LDFLAGS := -f srec -m map.txt -s linkscript
|
LDFLAGS := -f srec -m map.txt -s linkscript
|
||||||
@@ -35,11 +34,11 @@ LDFLAGS := -f srec -m map.txt -s linkscript
|
|||||||
all: $(TARGROM)
|
all: $(TARGROM)
|
||||||
|
|
||||||
# Fix srec into flashable bin file
|
# Fix srec into flashable bin file
|
||||||
$(TARGROM): $(TARGREC)
|
$(TARGROM): $(TARGET).s19
|
||||||
$(FIX) -I srec -O binary $< $@
|
$(FIX) -out $@ $<
|
||||||
|
|
||||||
# Link objects
|
# Link objects
|
||||||
$(TARGREC): $(OBJS)
|
$(TARGET).s19: $(OBJS)
|
||||||
$(LD) $(LDFLAGS) -o $@ $^
|
$(LD) $(LDFLAGS) -o $@ $^
|
||||||
|
|
||||||
# Assemble objects
|
# Assemble objects
|
||||||
@@ -47,6 +46,7 @@ $(OBJS): $(BUILDDIR)%.o : $(SRCDIR)%.s
|
|||||||
-@mkdir -p $(BUILDDIR)
|
-@mkdir -p $(BUILDDIR)
|
||||||
$(AS) $(ASFLAGS) -o $@ $<
|
$(AS) $(ASFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
.IGNORE: clean
|
||||||
clean:
|
clean:
|
||||||
@echo 'Cleaning up intermediary files...'
|
@echo 'Cleaning up intermediary files...'
|
||||||
@rm -rv $(TARGROM) $(TARGREC) map.txt $(BUILDDIR)
|
@rm -rv $(TARGROM) $(TARGET).s19 map.txt $(BUILDDIR)
|
||||||
|
@@ -15,16 +15,6 @@ UART_BASE EQU $7F00 ; UART Base Address
|
|||||||
ROM_BASE EQU $8000 ; ROM Base Address and Entry Point
|
ROM_BASE EQU $8000 ; ROM Base Address and Entry Point
|
||||||
VECS_BASE EQU $FFF0 ; Vectors Base Address
|
VECS_BASE EQU $FFF0 ; Vectors Base Address
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;;
|
|
||||||
;; Stack Base Address and Size Information
|
|
||||||
;;
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
STACK_BOTTOM EQU $0100 ; Bottom address of system stack
|
|
||||||
STACK_DEPTH EQU $FF ; System stack's depth
|
|
||||||
STACK_TOP EQU STACK_BOTTOM+STACK_DEPTH ; Top address of system stack
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
;; UART Registers and Flags
|
;; UART Registers and Flags
|
||||||
|
@@ -16,19 +16,6 @@
|
|||||||
EXPORT RESET
|
EXPORT RESET
|
||||||
|
|
||||||
RESET
|
RESET
|
||||||
|
|
||||||
CLRSTACK
|
|
||||||
; Initialize the system stack
|
|
||||||
lda #$00 ; Initialize A & X to zero out the stack
|
|
||||||
ldx #$0000
|
|
||||||
NEXT@
|
|
||||||
sta STACK_BOTTOM,x ; Write a zero and progress to the next byte
|
|
||||||
leax 1,x
|
|
||||||
cmpx #STACK_DEPTH ; See if we're at the top of the stack yet
|
|
||||||
blo NEXT@ ; Loop if we aren't at the end yet
|
|
||||||
lds STACK_TOP ; Set S to top of newly cleared stack
|
|
||||||
|
|
||||||
SERINIT
|
|
||||||
; 8n1 Serial Enable DLAB
|
; 8n1 Serial Enable DLAB
|
||||||
lda #UARTF_LCR_WLS | UARTF_LCR_DLAB
|
lda #UARTF_LCR_WLS | UARTF_LCR_DLAB
|
||||||
sta UART_LCR
|
sta UART_LCR
|
||||||
@@ -41,9 +28,8 @@ SERINIT
|
|||||||
lda #(UARTF_MCR_RTS) ; Enable Request-to-Send
|
lda #(UARTF_MCR_RTS) ; Enable Request-to-Send
|
||||||
sta UART_MCR
|
sta UART_MCR
|
||||||
lda #'H ; send 'H'
|
lda #'H ; send 'H'
|
||||||
sta UART_THR
|
sta UART_BUFR
|
||||||
|
WAIT@
|
||||||
WAIT
|
|
||||||
sync ; Wait for interrupts
|
sync ; Wait for interrupts
|
||||||
nop
|
nop
|
||||||
bra WAIT
|
bra WAIT@
|
||||||
|
@@ -12,25 +12,9 @@
|
|||||||
|
|
||||||
SECTION SERIAL
|
SECTION SERIAL
|
||||||
|
|
||||||
EXPORT SETBAUD
|
|
||||||
EXPORT OUTCHAR
|
EXPORT OUTCHAR
|
||||||
EXPORT OUTSTR
|
EXPORT OUTSTR
|
||||||
|
|
||||||
; Initializes the UART.
|
|
||||||
; @param d: new divisor
|
|
||||||
SETBAUD
|
|
||||||
pshs a ; Preserve A
|
|
||||||
lda UART_LCR ; Set only the DLAB bit
|
|
||||||
ora #UARTF_LCR_DLAB
|
|
||||||
sta UART_LCR
|
|
||||||
puls a
|
|
||||||
sta UART_DLM ; Store new divisor
|
|
||||||
stb UART_DLL
|
|
||||||
lda UART_LCR ; Reset DLAB
|
|
||||||
anda #$FE
|
|
||||||
sta UART_LCR
|
|
||||||
rts
|
|
||||||
|
|
||||||
; Writes a char to the UART in non FIFO mode, preserves A.
|
; Writes a char to the UART in non FIFO mode, preserves A.
|
||||||
; @param b: char to write
|
; @param b: char to write
|
||||||
OUTCHAR
|
OUTCHAR
|
||||||
@@ -39,7 +23,7 @@ NOTREADY@
|
|||||||
lda UART_LSR ; if LSR.THRE == 1 then write
|
lda UART_LSR ; if LSR.THRE == 1 then write
|
||||||
anda UARTF_LSR_THRE
|
anda UARTF_LSR_THRE
|
||||||
bne NOTREADY@ ; Loop if UART not ready yet
|
bne NOTREADY@ ; Loop if UART not ready yet
|
||||||
stb UART_THR ; Write char
|
stb UART_BUFR ; Write char
|
||||||
puls a ; Restore A
|
puls a ; Restore A
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@@ -55,7 +39,7 @@ NOTREADY@ ; Loop point for UART waiting
|
|||||||
lda UART_LSR ; Wait for UART to be ready
|
lda UART_LSR ; Wait for UART to be ready
|
||||||
anda UARTF_LSR_THRE
|
anda UARTF_LSR_THRE
|
||||||
bne NOTREADY@
|
bne NOTREADY@
|
||||||
stb UART_THR ; Actually do our write
|
stb UART_BUFR ; Actually do our write
|
||||||
bra OUTSTR ; Reset for the next char
|
bra OUTSTR ; Reset for the next char
|
||||||
END@ ; Jump point for end of routine
|
END@ ; Jump point for end of routine
|
||||||
rts
|
rts
|
||||||
|
Reference in New Issue
Block a user