forked from amberisvibin/chibi-pc09
Compare commits
1 Commits
main
...
7aac896cef
Author | SHA1 | Date | |
---|---|---|---|
7aac896cef
|
3
code/boot/.gitignore
vendored
3
code/boot/.gitignore
vendored
@@ -5,6 +5,3 @@
|
|||||||
*.s19
|
*.s19
|
||||||
map.txt
|
map.txt
|
||||||
build/
|
build/
|
||||||
|
|
||||||
# Build system generated files
|
|
||||||
src/version.s
|
|
||||||
|
@@ -15,14 +15,12 @@ Make makefile is provided for building on Linux.
|
|||||||
To generate an S-Record run:
|
To generate an S-Record run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make generate
|
|
||||||
make boot.s19
|
make boot.s19
|
||||||
```
|
```
|
||||||
|
|
||||||
To generate a binary run:
|
To generate a binary run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make generate
|
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
# Script to generate version information
|
|
||||||
|
|
||||||
# Current git tag
|
|
||||||
TAG="$(git describe --always --dirty --tags)"
|
|
||||||
DATE="$(date)"
|
|
||||||
|
|
||||||
# Output filename
|
|
||||||
OUTFILE='src/version.s'
|
|
||||||
|
|
||||||
sed -e "s/<TAG>/$TAG/g" -e "s/<DATE>/$DATE/g" <<EOF > "$OUTFILE"
|
|
||||||
; CHIBI PC-09 Prototype #1 Boot ROM -- Version Information
|
|
||||||
; Copyright (c) 2024-2025 Amber Zeller, Gale Faraday
|
|
||||||
; Licensed under MIT
|
|
||||||
|
|
||||||
; This file generated by genver.sh
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;;
|
|
||||||
;; Boot ROM Version & Build Information
|
|
||||||
;;
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
SECTION VERSION
|
|
||||||
|
|
||||||
EXPORT VERMSG
|
|
||||||
|
|
||||||
VERMSG
|
|
||||||
fcc "CHIBI PC-09 BOOT ROM <TAG>"
|
|
||||||
fcb \$0A
|
|
||||||
fcn "BUILT <DATE>"
|
|
||||||
EOF
|
|
@@ -3,4 +3,3 @@ section SERIAL
|
|||||||
section MEMTEST
|
section MEMTEST
|
||||||
|
|
||||||
section VECTORS high 100000
|
section VECTORS high 100000
|
||||||
section VERSION high
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# Makefile for CHIBI PC-09 Firmware
|
# Makefile for CHIBI PC-09 Firmware
|
||||||
|
|
||||||
.PHONY: generate all clean
|
.PHONY: all clean
|
||||||
.IGNORE: clean
|
.IGNORE: clean
|
||||||
.DEFAULT_GOAL := all
|
.DEFAULT_GOAL := all
|
||||||
|
|
||||||
@@ -13,7 +13,6 @@ TARGREC := $(TARGET).s19
|
|||||||
TARGROM := $(TARGET).bin
|
TARGROM := $(TARGET).bin
|
||||||
SRCDIR := src/
|
SRCDIR := src/
|
||||||
BUILDDIR := build/
|
BUILDDIR := build/
|
||||||
GENS := $(SRCDIR)version.s
|
|
||||||
SRCS := $(wildcard $(SRCDIR)*.s)
|
SRCS := $(wildcard $(SRCDIR)*.s)
|
||||||
OBJS := $(patsubst $(SRCDIR)%.s,$(BUILDDIR)%.o,$(SRCS))
|
OBJS := $(patsubst $(SRCDIR)%.s,$(BUILDDIR)%.o,$(SRCS))
|
||||||
INCS := $(wildcard $(SRCDIR)*.inc)
|
INCS := $(wildcard $(SRCDIR)*.inc)
|
||||||
@@ -48,12 +47,6 @@ $(OBJS): $(BUILDDIR)%.o : $(SRCDIR)%.s
|
|||||||
-@mkdir -p $(BUILDDIR)
|
-@mkdir -p $(BUILDDIR)
|
||||||
$(AS) $(ASFLAGS) -o $@ $<
|
$(AS) $(ASFLAGS) -o $@ $<
|
||||||
|
|
||||||
generate: $(GENS)
|
|
||||||
|
|
||||||
$(GENS):
|
|
||||||
./genver.sh
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo 'Cleaning up intermediary files...'
|
@echo 'Cleaning up intermediary files...'
|
||||||
@rm -rv $(TARGROM) $(TARGREC) map.txt $(BUILDDIR)
|
@rm -rv $(TARGROM) $(TARGREC) map.txt $(BUILDDIR)
|
||||||
@rm -rv $(GENS)
|
|
||||||
|
@@ -26,7 +26,7 @@ NEXT@
|
|||||||
leax 1,x
|
leax 1,x
|
||||||
cmpx #STACK_DEPTH ; See if we're at the top of the stack yet
|
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
|
blo NEXT@ ; Loop if we aren't at the end yet
|
||||||
lds #STACK_TOP ; Set S to top of newly cleared stack
|
lds STACK_TOP ; Set S to top of newly cleared stack
|
||||||
|
|
||||||
SERINIT
|
SERINIT
|
||||||
; 8n1 Serial Enable DLAB
|
; 8n1 Serial Enable DLAB
|
||||||
@@ -40,8 +40,8 @@ SERINIT
|
|||||||
sta UART_LCR
|
sta UART_LCR
|
||||||
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_BUFR
|
sta UART_THR
|
||||||
|
|
||||||
WAIT
|
WAIT
|
||||||
sync ; Wait for interrupts
|
sync ; Wait for interrupts
|
||||||
|
@@ -12,9 +12,25 @@
|
|||||||
|
|
||||||
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
|
||||||
@@ -23,7 +39,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_BUFR ; Write char
|
stb UART_THR ; Write char
|
||||||
puls a ; Restore A
|
puls a ; Restore A
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@@ -39,7 +55,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_BUFR ; Actually do our write
|
stb UART_THR ; 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