WIP: Integration #3

Draft
duuqnd wants to merge 24 commits from integration into main
123 changed files with 139 additions and 2009 deletions

8
.gitignore vendored
View file

@ -2,7 +2,11 @@
*.prg
*.o
*.lst
*.lst
*.note
host/build/*
*.lbl
build/*
*.bin
*.labels
editor/c6le
editor/source-program_*.c6l
user-side-compiler/c6lc

20
host/Makefile Normal file
View 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)

View file

@ -1,5 +1,5 @@
# !/bin/bash
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 &

View file

@ -1,4 +1,4 @@
# !/bin/bash
./build.sh &&
make &&
./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 &

2
host/src/END.s Normal file
View file

@ -0,0 +1,2 @@
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
END_OF_PROGRAM:

View file

@ -20,46 +20,46 @@
;; More documentation on the Joystick port can be found here: https://www.c64-wiki.com/wiki/Joystick
progdest = $fe
CLKMASK = %00000010
CTRL1 = $DC01
.org $80d
coldstart: ;; Draw an at sign on screen to show that program has loaded
lda #$0
sta $400
setup_loader:
;; Bank out character ROM, I/O in
lda #%00000100
ora $01
sta $01
lda #$00
sta progdest
lda #$c0
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
check_for_load_start:
maybe_download_userprog:
;; Bank out character ROM, I/O in
lda #%00000100
ora $01
sta $01
lda #CLKMASK
bit CTRL1
bne start
bne download_userprog
lda #$00
rts
start:
download_userprog:
.scope userprog_downloader
sei
lda #$00
sta progdest
lda #$c0
sta progdest+1
;; change border color for debugging purposes
ldx #$02
ldx #$02 ; X needed for more than that debug color
stx $d020
ldy #$00
jmp new_byte
@ -70,6 +70,9 @@ wait_for_bit_start:
bit CTRL1
beq @loop
lda #$06
sta $d020
lda #CLKMASK
bit CTRL1
beq error
@ -122,7 +125,7 @@ wait_for_bit_end:
bit CTRL1
bne @loop
;; Debug show the clock is low
lda #$00
lda #$02
sta $d020
jmp wait_for_bit_start
@ -137,9 +140,11 @@ error:
;; TODO
cli
sec
jmp $c000
rts
BYTE = $400
LEN = $402
stop: .word $0000
loaded: .byte 0
.endscope

58
host/src/mainloop.s Normal file
View 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

View file

@ -3,6 +3,7 @@
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
.debuginfo + ; Generate debug info
.org $080D
;;Macros
.include "macros/16aritmatic.s"
;;inc files
@ -11,13 +12,18 @@
.include "STARTUP.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/div_test.s"
;.include "routines/circle/circle_test.s"
;.include "routines/circle/circle_test_size.s"
;.include "routines/circle/circle_test_position.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/pixel/pixel_test.s"
;.include "routines/memory/memcpy_test.s"
@ -26,7 +32,7 @@
;.include "routines/triangle/triangle_test.s"
exit:
JMP exit
.include "../wip-duuqnd/public.inc"
.include "public.inc"
.include "routines/line/line.s"
.include "routines/circle/circle.s"
.include "routines/triangle/triangle.s"
@ -37,4 +43,12 @@ JMP exit
.include "routines/memory/memcpy.s"
.include "routines/arithmatic/mult.s"
.include "routines/arithmatic/div.s"
.include "lookup_tables.s"
.ifdef EMULATOR_PREVIEW
batch_userprog:
.incbin "../userprog.bin"
.endif
.include "END.s"

View file

@ -50,8 +50,8 @@
;; TODO: Handle case of too many arguments (? not realistically needed)
t)
(defparameter +argvec-offset+ #x00)
(defparameter +varvec-offset+ #x08)
(defparameter +argvec-offset+ #xF0)
(defparameter +varvec-offset+ #x20)
(defmacro with-variable-allocations (allocations &body body)
`(let ((*variable-allocations* (make-hash-table)))

View file

@ -68,8 +68,8 @@
(parse-asm-declaration main-text)
(list name address declaration)))))
(defparameter *program-listing-filepath* #P"../../wip-hugo/program.lst")
(defparameter *program-build-filepath* #P"../../wip-hugo/build.sh")
(defparameter *program-listing-filepath* #P"../host/build/program.lst")
(defparameter *program-build-filepath* #P"../host/build.sh")
(defun check-for-asm-build-script ()
(do ((path *program-build-filepath*))

Some files were not shown because too many files have changed in this diff Show more