WIP: Integration #3
123 changed files with 139 additions and 2009 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -2,7 +2,11 @@
|
||||||
*.prg
|
*.prg
|
||||||
*.o
|
*.o
|
||||||
*.lst
|
*.lst
|
||||||
*.lst
|
|
||||||
*.note
|
*.note
|
||||||
|
host/build/*
|
||||||
*.lbl
|
*.lbl
|
||||||
build/*
|
*.bin
|
||||||
|
*.labels
|
||||||
|
editor/c6le
|
||||||
|
editor/source-program_*.c6l
|
||||||
|
user-side-compiler/c6lc
|
||||||
|
|
20
host/Makefile
Normal file
20
host/Makefile
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
BINARY := host.prg
|
||||||
|
|
||||||
|
BUILD_DIR := ./build
|
||||||
|
SRC_DIR := ./src
|
||||||
|
|
||||||
|
SRCS := $(shell find $(SRC_DIR) -name '*.s' -or -name '*.inc')
|
||||||
|
TOPLEVEL := source.s
|
||||||
|
|
||||||
|
CL := cl65
|
||||||
|
|
||||||
|
CLFLAGS := -u __EXEHDR__ -t c64 -C c64-asm.cfg -l $(BUILD_DIR)/host.lst -Ln $(BUILD_DIR)/host.lbl
|
||||||
|
|
||||||
|
$(BUILD_DIR)/$(BINARY): $(SRCS)
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
$(CL) -o $@ $(CLFLAGS) $(SRC_DIR)/$(TOPLEVEL)
|
||||||
|
|
||||||
|
all: $(BUILD_DIR)/$(BINARY)
|
||||||
|
|
||||||
|
preview: userprog.bin $(SRCS)
|
||||||
|
$(CL) -o $@ -D EMULATOR_PREVIEW $(CLFLAGS) $(SRC_DIR)/$(TOPLEVEL)
|
|
@ -1,5 +1,5 @@
|
||||||
# !/bin/bash
|
# !/bin/bash
|
||||||
killall x64sc
|
killall x64sc
|
||||||
|
|
||||||
./build.sh \
|
make \
|
||||||
&& nohup flatpak run net.sf.VICE -windowypos 0 -windowxpos 960 -windowwidth 945 -windowheight 720 -moncommands program.lbl build/file.prg </dev/null &>/dev/null &
|
&& nohup flatpak run net.sf.VICE -windowypos 0 -windowxpos 960 -windowwidth 945 -windowheight 720 -moncommands program.lbl build/file.prg </dev/null &>/dev/null &
|
|
@ -1,4 +1,4 @@
|
||||||
# !/bin/bash
|
# !/bin/bash
|
||||||
./build.sh &&
|
make &&
|
||||||
./retrodebugger_label_build_tool/rdb_build_label.sh \
|
./retrodebugger_label_build_tool/rdb_build_label.sh \
|
||||||
&& nohup retrodebugger -b retrodebugger_label_build_tool/new.labels.labels -c64 ./build/file.prg </dev/null &>/dev/null &
|
&& nohup retrodebugger -b retrodebugger_label_build_tool/new.labels.labels -c64 ./build/file.prg </dev/null &>/dev/null &
|
2
host/src/END.s
Normal file
2
host/src/END.s
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
||||||
|
END_OF_PROGRAM:
|
|
@ -20,46 +20,46 @@
|
||||||
|
|
||||||
;; More documentation on the Joystick port can be found here: https://www.c64-wiki.com/wiki/Joystick
|
;; More documentation on the Joystick port can be found here: https://www.c64-wiki.com/wiki/Joystick
|
||||||
|
|
||||||
|
|
||||||
progdest = $fe
|
progdest = $fe
|
||||||
CLKMASK = %00000010
|
CLKMASK = %00000010
|
||||||
CTRL1 = $DC01
|
CTRL1 = $DC01
|
||||||
|
|
||||||
.org $80d
|
setup_loader:
|
||||||
coldstart: ;; Draw an at sign on screen to show that program has loaded
|
;; Bank out character ROM, I/O in
|
||||||
lda #$0
|
lda #%00000100
|
||||||
sta $400
|
ora $01
|
||||||
|
sta $01
|
||||||
|
|
||||||
|
lda #$00
|
||||||
sta progdest
|
sta progdest
|
||||||
lda #$c0
|
lda #$c0
|
||||||
sta progdest+1
|
sta progdest+1
|
||||||
waitstart: ;; Wait until joystick 2 has been pulled down to start the program
|
|
||||||
lda $dc00
|
|
||||||
and #$02
|
|
||||||
bne waitstart
|
|
||||||
|
|
||||||
;; Change border colour for debugging
|
|
||||||
lda #$03
|
|
||||||
sta $d020
|
|
||||||
teststart:
|
|
||||||
jsr check_for_load_start ; Check if start_bit is correct
|
|
||||||
bcs @error ; The routine sets carry in the event of an error
|
|
||||||
beq teststart
|
|
||||||
@doneforever:
|
|
||||||
jmp $c000 ; starts the program?
|
|
||||||
@error:
|
|
||||||
lda #1
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
check_for_load_start:
|
maybe_download_userprog:
|
||||||
|
;; Bank out character ROM, I/O in
|
||||||
|
lda #%00000100
|
||||||
|
ora $01
|
||||||
|
sta $01
|
||||||
|
|
||||||
lda #CLKMASK
|
lda #CLKMASK
|
||||||
bit CTRL1
|
bit CTRL1
|
||||||
bne start
|
bne download_userprog
|
||||||
|
|
||||||
lda #$00
|
lda #$00
|
||||||
rts
|
rts
|
||||||
start:
|
|
||||||
|
download_userprog:
|
||||||
|
.scope userprog_downloader
|
||||||
sei
|
sei
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
sta progdest
|
||||||
|
lda #$c0
|
||||||
|
sta progdest+1
|
||||||
|
|
||||||
;; change border color for debugging purposes
|
;; change border color for debugging purposes
|
||||||
ldx #$02
|
ldx #$02 ; X needed for more than that debug color
|
||||||
stx $d020
|
stx $d020
|
||||||
ldy #$00
|
ldy #$00
|
||||||
jmp new_byte
|
jmp new_byte
|
||||||
|
@ -70,6 +70,9 @@ wait_for_bit_start:
|
||||||
bit CTRL1
|
bit CTRL1
|
||||||
beq @loop
|
beq @loop
|
||||||
|
|
||||||
|
lda #$06
|
||||||
|
sta $d020
|
||||||
|
|
||||||
lda #CLKMASK
|
lda #CLKMASK
|
||||||
bit CTRL1
|
bit CTRL1
|
||||||
beq error
|
beq error
|
||||||
|
@ -122,7 +125,7 @@ wait_for_bit_end:
|
||||||
bit CTRL1
|
bit CTRL1
|
||||||
bne @loop
|
bne @loop
|
||||||
;; Debug show the clock is low
|
;; Debug show the clock is low
|
||||||
lda #$00
|
lda #$02
|
||||||
sta $d020
|
sta $d020
|
||||||
|
|
||||||
jmp wait_for_bit_start
|
jmp wait_for_bit_start
|
||||||
|
@ -137,9 +140,11 @@ error:
|
||||||
;; TODO
|
;; TODO
|
||||||
cli
|
cli
|
||||||
sec
|
sec
|
||||||
|
jmp $c000
|
||||||
rts
|
rts
|
||||||
|
|
||||||
BYTE = $400
|
BYTE = $400
|
||||||
LEN = $402
|
LEN = $402
|
||||||
stop: .word $0000
|
stop: .word $0000
|
||||||
loaded: .byte 0
|
loaded: .byte 0
|
||||||
|
.endscope
|
58
host/src/mainloop.s
Normal file
58
host/src/mainloop.s
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
||||||
|
.scope mainsetup
|
||||||
|
;; USERPROG = $C000
|
||||||
|
;; .repeat 4, I
|
||||||
|
;; ldy #$00
|
||||||
|
;; :
|
||||||
|
;; lda batch_userprog+(I*256),Y
|
||||||
|
;; sta USERPROG+(I*256),Y
|
||||||
|
;; dey
|
||||||
|
;; bne :-
|
||||||
|
;; .endrep
|
||||||
|
|
||||||
|
@waitstart: ;; Wait until joystick 2 has been pulled down to start the program
|
||||||
|
lda $dc00
|
||||||
|
and #$02
|
||||||
|
bne @waitstart
|
||||||
|
|
||||||
|
jsr setup_loader
|
||||||
|
inc $d020
|
||||||
|
@trying:
|
||||||
|
dec $d020
|
||||||
|
jsr maybe_download_userprog
|
||||||
|
beq @trying
|
||||||
|
.endscope
|
||||||
|
|
||||||
|
.scope mainloop
|
||||||
|
ml:
|
||||||
|
USERPROG = $C000
|
||||||
|
RASTER = $D012
|
||||||
|
;; Currently no code for fetching new programs, since we're testing with
|
||||||
|
;; batch compiled version of the whole to begin with.
|
||||||
|
|
||||||
|
;; Bank in character ROM
|
||||||
|
lda #%11111011
|
||||||
|
and $01
|
||||||
|
sta $01
|
||||||
|
|
||||||
|
;;jsr maybe_download_userprog
|
||||||
|
jsr USERPROG
|
||||||
|
|
||||||
|
;; Bank out character ROM, I/O in
|
||||||
|
lda #%00000100
|
||||||
|
ora $01
|
||||||
|
sta $01
|
||||||
|
@framewait:
|
||||||
|
ldy RASTER
|
||||||
|
cpy #$66
|
||||||
|
beq @framewait
|
||||||
|
inc FRAMECOUNT
|
||||||
|
jmp ml
|
||||||
|
.endscope
|
||||||
|
|
||||||
|
.proc time ; user-procedure
|
||||||
|
lda FRAMECOUNT
|
||||||
|
rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
FRAMECOUNT: .byte 0
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
||||||
.debuginfo + ; Generate debug info
|
.debuginfo + ; Generate debug info
|
||||||
|
.org $080D
|
||||||
;;Macros
|
;;Macros
|
||||||
.include "macros/16aritmatic.s"
|
.include "macros/16aritmatic.s"
|
||||||
;;inc files
|
;;inc files
|
||||||
|
@ -11,13 +12,18 @@
|
||||||
.include "STARTUP.s"
|
.include "STARTUP.s"
|
||||||
;.include "dubbel_buffer/raster_irqs.s"
|
;.include "dubbel_buffer/raster_irqs.s"
|
||||||
|
|
||||||
|
.include "mainloop.s"
|
||||||
|
.ifndef EMULATOR_PREVIEW
|
||||||
|
.include "loader.s"
|
||||||
|
.endif
|
||||||
|
|
||||||
;.include "routines/arithmatic/mult_test.s"
|
;.include "routines/arithmatic/mult_test.s"
|
||||||
;.include "routines/arithmatic/div_test.s"
|
;.include "routines/arithmatic/div_test.s"
|
||||||
;.include "routines/circle/circle_test.s"
|
;.include "routines/circle/circle_test.s"
|
||||||
;.include "routines/circle/circle_test_size.s"
|
;.include "routines/circle/circle_test_size.s"
|
||||||
;.include "routines/circle/circle_test_position.s"
|
;.include "routines/circle/circle_test_position.s"
|
||||||
;.include "routines/line/line_test.s"
|
;.include "routines/line/line_test.s"
|
||||||
.include "routines/line/line_test_extensive.s"
|
;.include "routines/line/line_test_extensive.s"
|
||||||
;.include "routines/text/char_draw_test.s"
|
;.include "routines/text/char_draw_test.s"
|
||||||
;.include "routines/pixel/pixel_test.s"
|
;.include "routines/pixel/pixel_test.s"
|
||||||
;.include "routines/memory/memcpy_test.s"
|
;.include "routines/memory/memcpy_test.s"
|
||||||
|
@ -26,7 +32,7 @@
|
||||||
;.include "routines/triangle/triangle_test.s"
|
;.include "routines/triangle/triangle_test.s"
|
||||||
exit:
|
exit:
|
||||||
JMP exit
|
JMP exit
|
||||||
.include "../wip-duuqnd/public.inc"
|
.include "public.inc"
|
||||||
.include "routines/line/line.s"
|
.include "routines/line/line.s"
|
||||||
.include "routines/circle/circle.s"
|
.include "routines/circle/circle.s"
|
||||||
.include "routines/triangle/triangle.s"
|
.include "routines/triangle/triangle.s"
|
||||||
|
@ -37,4 +43,12 @@ JMP exit
|
||||||
.include "routines/memory/memcpy.s"
|
.include "routines/memory/memcpy.s"
|
||||||
.include "routines/arithmatic/mult.s"
|
.include "routines/arithmatic/mult.s"
|
||||||
.include "routines/arithmatic/div.s"
|
.include "routines/arithmatic/div.s"
|
||||||
|
|
||||||
|
.include "lookup_tables.s"
|
||||||
|
|
||||||
|
.ifdef EMULATOR_PREVIEW
|
||||||
|
batch_userprog:
|
||||||
|
.incbin "../userprog.bin"
|
||||||
|
.endif
|
||||||
|
|
||||||
.include "END.s"
|
.include "END.s"
|
|
@ -50,8 +50,8 @@
|
||||||
;; TODO: Handle case of too many arguments (? not realistically needed)
|
;; TODO: Handle case of too many arguments (? not realistically needed)
|
||||||
t)
|
t)
|
||||||
|
|
||||||
(defparameter +argvec-offset+ #x00)
|
(defparameter +argvec-offset+ #xF0)
|
||||||
(defparameter +varvec-offset+ #x08)
|
(defparameter +varvec-offset+ #x20)
|
||||||
|
|
||||||
(defmacro with-variable-allocations (allocations &body body)
|
(defmacro with-variable-allocations (allocations &body body)
|
||||||
`(let ((*variable-allocations* (make-hash-table)))
|
`(let ((*variable-allocations* (make-hash-table)))
|
|
@ -68,8 +68,8 @@
|
||||||
(parse-asm-declaration main-text)
|
(parse-asm-declaration main-text)
|
||||||
(list name address declaration)))))
|
(list name address declaration)))))
|
||||||
|
|
||||||
(defparameter *program-listing-filepath* #P"../../wip-hugo/program.lst")
|
(defparameter *program-listing-filepath* #P"../host/build/program.lst")
|
||||||
(defparameter *program-build-filepath* #P"../../wip-hugo/build.sh")
|
(defparameter *program-build-filepath* #P"../host/build.sh")
|
||||||
|
|
||||||
(defun check-for-asm-build-script ()
|
(defun check-for-asm-build-script ()
|
||||||
(do ((path *program-build-filepath*))
|
(do ((path *program-build-filepath*))
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue