Code cleanup
This commit is contained in:
parent
9548197c2f
commit
4d953b47a2
11
Makefile
11
Makefile
|
@ -1,23 +1,24 @@
|
|||
AS := 64tass
|
||||
MP := minipro
|
||||
|
||||
ASFLAGS := --nostart \
|
||||
-I include \
|
||||
ASFLAGS := -I include \
|
||||
-I src \
|
||||
--m65816 \
|
||||
--nostart \
|
||||
--long-branch \
|
||||
--long-address \
|
||||
--m65816 \
|
||||
-Walign \
|
||||
-Wno-wrap-pc \
|
||||
-l kernel.list
|
||||
|
||||
MPFLAGS := -p SST39LF040@PLCC32
|
||||
|
||||
SOURCES := src/memory.s \
|
||||
src/main.s \
|
||||
src/boot.s \
|
||||
src/irq.s \
|
||||
src/led.s \
|
||||
src/vera.s
|
||||
src/vera.s \
|
||||
src/main.s
|
||||
|
||||
INCLUDES := $(wildcard include/*.i)
|
||||
|
||||
|
|
|
@ -4,4 +4,4 @@ UART3_TIMER_VALUE = (CPU_SPEED_HZ / (16 * UART3_BAUD_RATE) - 1)
|
|||
|
||||
.include "w65c816.i"
|
||||
.include "w65c265s.i"
|
||||
.include "vera.i"
|
||||
.include "vera.i"
|
||||
|
|
|
@ -30,6 +30,8 @@ save_registers .macro
|
|||
pha
|
||||
phx
|
||||
phy
|
||||
.short_a
|
||||
.long_i
|
||||
.endmacro
|
||||
|
||||
restore_registers .macro
|
||||
|
@ -39,5 +41,25 @@ restore_registers .macro
|
|||
plx
|
||||
pla
|
||||
plp
|
||||
.short_a
|
||||
.long_i
|
||||
.endmacro
|
||||
|
||||
|
||||
memcpy .macro dest, src, count
|
||||
.save_registers
|
||||
.long_a
|
||||
.long_i
|
||||
|
||||
ldx #<>src
|
||||
ldy #<>dest
|
||||
lda #count - 1
|
||||
|
||||
.if dest > src
|
||||
mvp #`src, #`dest
|
||||
.else
|
||||
mvn #`src, #`dest
|
||||
.endif
|
||||
.restore_registers
|
||||
.short_a
|
||||
.long_i
|
||||
.endmacro
|
20
kernel.list
20
kernel.list
|
@ -10,13 +10,14 @@ T0LH = $00df51
|
|||
AUTO_INC_320 = $e00000
|
||||
SSCR = $00df41
|
||||
UIER = $00df49
|
||||
VERA_SPI_DATA = 57118
|
||||
AUTO_INC_256 = $900000
|
||||
AUTO_INC_128 = $800000
|
||||
led_blink_red = $c1004d
|
||||
led_blink_red = $c00053
|
||||
VERA_DC_VIDEO = 57097
|
||||
VERA_DC_HSCALE = 57098
|
||||
AUTO_INC_NONE = $000000
|
||||
main = $c0ffc0
|
||||
main = $c0007a
|
||||
AUTO_INC_40 = $b00000
|
||||
VERA_DC_VSCALE = 57099
|
||||
VERA_CTRL = 57093
|
||||
|
@ -25,10 +26,9 @@ EIER = $00df47
|
|||
T2CH = $00df65
|
||||
T0CH = $00df61
|
||||
VERA_PSG_BASE = $1f9c0
|
||||
T0CL = $00df60
|
||||
VERA_L0_MAPBASE = 57102
|
||||
VERA_PALETTE_BASE= $1fa00
|
||||
led_red_on = $c10019
|
||||
led_red_on = $c0001f
|
||||
VERA_AUDIO_DATA = 57117
|
||||
VERA_TILESIZE8x8= $00
|
||||
VERA_SCANLINE_L = 57096
|
||||
|
@ -75,12 +75,12 @@ PDD3 = $00df07
|
|||
AUTO_INC_2 = $200000
|
||||
AUTO_INC_1 = $100000
|
||||
VERA_DC_VSTART = 57099
|
||||
led_init = $c0fffa
|
||||
led_init = $c00000
|
||||
VERA_DATA0 = 57091
|
||||
AUTO_INC_4 = $300000
|
||||
AUTO_INC_8 = $400000
|
||||
T7LL = $00df5e
|
||||
led_red_off = $c10033
|
||||
led_red_off = $c00039
|
||||
VERA_L_32W = $00
|
||||
VERA_L_128W = $20
|
||||
AUTO_INC_16 = $500000
|
||||
|
@ -90,7 +90,7 @@ VERA_L0_CONFIG = 57101
|
|||
VERA_DC_BORDER = 57100
|
||||
T7CH = $00df6f
|
||||
AUTO_INC_160 = $d00000
|
||||
vera_init = $c10071
|
||||
vera_init = $c00077
|
||||
T2LL = $00df54
|
||||
TIFR = $00df44
|
||||
T2LH = $00df55
|
||||
|
@ -108,7 +108,7 @@ PIR4 = $00df7c
|
|||
PIR3 = $00df7b
|
||||
PIR2 = $00df7a
|
||||
VERA_L_T256C = $08
|
||||
VERA_SPI_DATA = 57118
|
||||
VERA_L_BITMAP = $04
|
||||
T2CL = $00df64
|
||||
VERA_ADDR0_H = 57090
|
||||
VERA_SPI_CTRL = 57119
|
||||
|
@ -139,7 +139,7 @@ PDD4 = $00df24
|
|||
T3CL = $00df66
|
||||
T3CH = $00df67
|
||||
VERA_L1_MAPBASE = 57109
|
||||
delay = $c0ffee
|
||||
delay = $c000a8
|
||||
VERA_L0_HSCROLL_L= 57104
|
||||
VERA_L0_HSCROLL_H= 57105
|
||||
T6LH = $00df5d
|
||||
|
@ -158,7 +158,6 @@ empty_irq_handler= $008100
|
|||
VERA_TILESIZE16x8= $01
|
||||
VERA_AUDIO_CTRL = 57115
|
||||
VERA_DC_HSTART = 57097
|
||||
VERA_L_BITMAP = $04
|
||||
DISABLED = 0
|
||||
ARTD2 = $00df75
|
||||
ARTD3 = $00df77
|
||||
|
@ -166,6 +165,7 @@ ARTD0 = $00df71
|
|||
ARTD1 = $00df73
|
||||
T1LH = $00df53
|
||||
VERA_SPRITE_ATTR_BASE= $1fc00
|
||||
T0CL = $00df60
|
||||
BCR = $00df40
|
||||
VERA_L1_VSCROLL_L= 57113
|
||||
VERA_L1_VSCROLL_H= 57114
|
||||
|
|
Binary file not shown.
|
@ -1,4 +1,3 @@
|
|||
.section code
|
||||
.section boot
|
||||
.logical $008000
|
||||
|
||||
|
@ -37,4 +36,3 @@ w65c265s_init .proc
|
|||
|
||||
.endlogical
|
||||
.endsection boot
|
||||
.endsection code
|
|
@ -1,5 +1,3 @@
|
|||
.section code
|
||||
|
||||
.section irq_handlers
|
||||
.logical $008100
|
||||
|
||||
|
@ -67,6 +65,6 @@ irq_exit .proc
|
|||
.addr nmi_handler ; NMI (Native Mode)
|
||||
.addr empty_irq_handler ; RESERVED
|
||||
.addr empty_irq_handler ; RESERVED
|
||||
.fill 64, $EA
|
||||
.endlogical
|
||||
.endsection irq_vectors
|
||||
.endsection code
|
||||
.endsection irq_vectors
|
|
@ -1,4 +1,4 @@
|
|||
.section code
|
||||
.section kernel
|
||||
|
||||
led_init .proc
|
||||
.save_registers
|
||||
|
@ -58,7 +58,7 @@ led_green_off .proc
|
|||
.short_a
|
||||
.long_i
|
||||
|
||||
lda #%00100000
|
||||
lda #%00100000code
|
||||
trb PD5
|
||||
|
||||
.restore_registers
|
||||
|
@ -137,4 +137,4 @@ led_blink_blue .proc
|
|||
rtl
|
||||
.endproc
|
||||
|
||||
.endsection code
|
||||
.endsection kernel
|
17
src/main.s
17
src/main.s
|
@ -1,6 +1,7 @@
|
|||
.section code
|
||||
main .proc
|
||||
.section kernel
|
||||
|
||||
main .proc
|
||||
.page $FFFF
|
||||
.short_a
|
||||
.long_i
|
||||
|
||||
|
@ -18,20 +19,24 @@ main .proc
|
|||
|
||||
.fclk_select
|
||||
|
||||
jsl led_blink_red
|
||||
|
||||
jsl led_init
|
||||
|
||||
jsl led_blink_red
|
||||
|
||||
; Initialize the VERA
|
||||
jsl vera_init
|
||||
|
||||
idle:
|
||||
wai
|
||||
bra idle
|
||||
.endpage
|
||||
.endproc
|
||||
|
||||
; Delay X times.
|
||||
delay .proc
|
||||
.save_registers
|
||||
.short_a
|
||||
.long_i
|
||||
phy
|
||||
|
||||
loop_x
|
||||
|
@ -44,8 +49,8 @@ loop_y
|
|||
dex
|
||||
bne loop_x
|
||||
|
||||
ply
|
||||
.restore_registers
|
||||
rtl
|
||||
.endproc
|
||||
|
||||
.endsection
|
||||
.endsection kernel
|
36
src/memory.s
36
src/memory.s
|
@ -22,21 +22,49 @@
|
|||
.dsection zp
|
||||
|
||||
* = $C00000
|
||||
.dsection code
|
||||
.section code
|
||||
.dsection kernel
|
||||
|
||||
.fill $C08000 - *, $EA
|
||||
* = $C08000
|
||||
.dsection boot
|
||||
.cerror * > $C08100
|
||||
|
||||
.fill $C08100 - *, $EA
|
||||
* = $C08100
|
||||
.dsection irq_handlers
|
||||
.cerror * > $C08200
|
||||
|
||||
.fill $C0FF80 - *, $EA
|
||||
* = $C0FF80
|
||||
.dsection irq_vectors
|
||||
.cerror * > $C10000
|
||||
|
||||
.endsection code
|
||||
.fill $C80000 - *, $EA
|
||||
|
||||
.fill $C80000 - *, $EA
|
||||
* = $C10000
|
||||
.dsection code1
|
||||
.cerror * > $C20000
|
||||
|
||||
* = $C20000
|
||||
.dsection code2
|
||||
.cerror * > $C30000
|
||||
|
||||
* = $C30000
|
||||
.dsection code3
|
||||
.cerror * > $C40000
|
||||
|
||||
* = $C40000
|
||||
.dsection code4
|
||||
.cerror * > $C50000
|
||||
|
||||
* = $C50000
|
||||
.dsection code5
|
||||
.cerror * > $C60000
|
||||
|
||||
* = $C60000
|
||||
.dsection code6
|
||||
.cerror * > $C70000
|
||||
|
||||
* = $C70000
|
||||
.dsection code7
|
||||
.cerror * > $C80000
|
|
@ -1,4 +1,4 @@
|
|||
.section code
|
||||
.section kernel
|
||||
|
||||
vera_init .proc
|
||||
pha
|
||||
|
@ -7,4 +7,4 @@ vera_init .proc
|
|||
rtl
|
||||
.endproc
|
||||
|
||||
.endsection
|
||||
.endsection kernel
|
||||
|
|
Loading…
Reference in New Issue