diff --git a/.gitignore b/.gitignore index 537ecd2..c7802f4 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/wip-duuqnd/editor/binary-build.lisp b/editor/binary-build.lisp similarity index 100% rename from wip-duuqnd/editor/binary-build.lisp rename to editor/binary-build.lisp diff --git a/wip-duuqnd/editor/editor.asd b/editor/editor.asd similarity index 100% rename from wip-duuqnd/editor/editor.asd rename to editor/editor.asd diff --git a/wip-duuqnd/editor/editor.lisp b/editor/editor.lisp similarity index 100% rename from wip-duuqnd/editor/editor.lisp rename to editor/editor.lisp diff --git a/wip-duuqnd/editor/package.lisp b/editor/package.lisp similarity index 100% rename from wip-duuqnd/editor/package.lisp rename to editor/package.lisp diff --git a/host/Makefile b/host/Makefile new file mode 100644 index 0000000..2a4e790 --- /dev/null +++ b/host/Makefile @@ -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) diff --git a/wip-hugo/README.md b/host/README.md similarity index 100% rename from wip-hugo/README.md rename to host/README.md diff --git a/wip-hugo/retrodebugger_label_build_tool/end_file b/host/retrodebugger_label_build_tool/end_file similarity index 100% rename from wip-hugo/retrodebugger_label_build_tool/end_file rename to host/retrodebugger_label_build_tool/end_file diff --git a/wip-hugo/retrodebugger_label_build_tool/rdb_build_label.sh b/host/retrodebugger_label_build_tool/rdb_build_label.sh similarity index 100% rename from wip-hugo/retrodebugger_label_build_tool/rdb_build_label.sh rename to host/retrodebugger_label_build_tool/rdb_build_label.sh diff --git a/wip-hugo/retrodebugger_label_build_tool/start_file b/host/retrodebugger_label_build_tool/start_file similarity index 100% rename from wip-hugo/retrodebugger_label_build_tool/start_file rename to host/retrodebugger_label_build_tool/start_file diff --git a/wip-hugo/retrodebugger_label_build_tool/temp_file b/host/retrodebugger_label_build_tool/temp_file similarity index 100% rename from wip-hugo/retrodebugger_label_build_tool/temp_file rename to host/retrodebugger_label_build_tool/temp_file diff --git a/wip-hugo/run.sh b/host/run.sh similarity index 93% rename from wip-hugo/run.sh rename to host/run.sh index 725a15f..c53faaf 100755 --- a/wip-hugo/run.sh +++ b/host/run.sh @@ -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 & diff --git a/wip-hugo/run_retro_debugger.sh b/host/run_retro_debugger.sh similarity index 93% rename from wip-hugo/run_retro_debugger.sh rename to host/run_retro_debugger.sh index f4b7844..95ed63b 100755 --- a/wip-hugo/run_retro_debugger.sh +++ b/host/run_retro_debugger.sh @@ -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 & diff --git a/host/src/END.s b/host/src/END.s new file mode 100644 index 0000000..fe880d5 --- /dev/null +++ b/host/src/END.s @@ -0,0 +1,2 @@ +;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- +END_OF_PROGRAM: diff --git a/wip-hugo/STARTUP.s b/host/src/STARTUP.s similarity index 100% rename from wip-hugo/STARTUP.s rename to host/src/STARTUP.s diff --git a/wip-hugo/dubbel_buffer/raster_irqs.s b/host/src/dubbel_buffer/raster_irqs.s similarity index 100% rename from wip-hugo/dubbel_buffer/raster_irqs.s rename to host/src/dubbel_buffer/raster_irqs.s diff --git a/wip-duuqnd/loader.s b/host/src/loader.s similarity index 80% rename from wip-duuqnd/loader.s rename to host/src/loader.s index d1a16c3..2aa5360 100644 --- a/wip-duuqnd/loader.s +++ b/host/src/loader.s @@ -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 diff --git a/wip-hugo/END.s b/host/src/lookup_tables.s similarity index 100% rename from wip-hugo/END.s rename to host/src/lookup_tables.s diff --git a/wip-hugo/macros/16aritmatic.s b/host/src/macros/16aritmatic.s similarity index 100% rename from wip-hugo/macros/16aritmatic.s rename to host/src/macros/16aritmatic.s diff --git a/wip-dicander/macros/timer.s b/host/src/macros/timer.s similarity index 100% rename from wip-dicander/macros/timer.s rename to host/src/macros/timer.s diff --git a/host/src/mainloop.s b/host/src/mainloop.s new file mode 100644 index 0000000..61f670a --- /dev/null +++ b/host/src/mainloop.s @@ -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 diff --git a/wip-duuqnd/public.inc b/host/src/public.inc similarity index 100% rename from wip-duuqnd/public.inc rename to host/src/public.inc diff --git a/wip-hugo/routines/arithmatic/arithmatic.inc b/host/src/routines/arithmatic/arithmatic.inc similarity index 100% rename from wip-hugo/routines/arithmatic/arithmatic.inc rename to host/src/routines/arithmatic/arithmatic.inc diff --git a/wip-hugo/routines/arithmatic/div.s b/host/src/routines/arithmatic/div.s similarity index 100% rename from wip-hugo/routines/arithmatic/div.s rename to host/src/routines/arithmatic/div.s diff --git a/wip-hugo/routines/arithmatic/div_test.s b/host/src/routines/arithmatic/div_test.s similarity index 100% rename from wip-hugo/routines/arithmatic/div_test.s rename to host/src/routines/arithmatic/div_test.s diff --git a/wip-hugo/routines/arithmatic/mult.s b/host/src/routines/arithmatic/mult.s similarity index 100% rename from wip-hugo/routines/arithmatic/mult.s rename to host/src/routines/arithmatic/mult.s diff --git a/wip-hugo/routines/arithmatic/mult_test.s b/host/src/routines/arithmatic/mult_test.s similarity index 100% rename from wip-hugo/routines/arithmatic/mult_test.s rename to host/src/routines/arithmatic/mult_test.s diff --git a/wip-hugo/routines/circle/circle.inc b/host/src/routines/circle/circle.inc similarity index 100% rename from wip-hugo/routines/circle/circle.inc rename to host/src/routines/circle/circle.inc diff --git a/wip-hugo/routines/circle/circle.s b/host/src/routines/circle/circle.s similarity index 100% rename from wip-hugo/routines/circle/circle.s rename to host/src/routines/circle/circle.s diff --git a/wip-hugo/routines/circle/circle_test.s b/host/src/routines/circle/circle_test.s similarity index 100% rename from wip-hugo/routines/circle/circle_test.s rename to host/src/routines/circle/circle_test.s diff --git a/wip-hugo/routines/circle/circle_test_position.s b/host/src/routines/circle/circle_test_position.s similarity index 100% rename from wip-hugo/routines/circle/circle_test_position.s rename to host/src/routines/circle/circle_test_position.s diff --git a/wip-hugo/routines/circle/circle_test_size.s b/host/src/routines/circle/circle_test_size.s similarity index 100% rename from wip-hugo/routines/circle/circle_test_size.s rename to host/src/routines/circle/circle_test_size.s diff --git a/wip-hugo/routines/line/line.inc b/host/src/routines/line/line.inc similarity index 100% rename from wip-hugo/routines/line/line.inc rename to host/src/routines/line/line.inc diff --git a/wip-hugo/routines/line/line.s b/host/src/routines/line/line.s similarity index 100% rename from wip-hugo/routines/line/line.s rename to host/src/routines/line/line.s diff --git a/wip-hugo/routines/line/line_down.s b/host/src/routines/line/line_down.s similarity index 100% rename from wip-hugo/routines/line/line_down.s rename to host/src/routines/line/line_down.s diff --git a/wip-hugo/routines/line/line_down_inv.s b/host/src/routines/line/line_down_inv.s similarity index 100% rename from wip-hugo/routines/line/line_down_inv.s rename to host/src/routines/line/line_down_inv.s diff --git a/wip-hugo/routines/line/line_test.s b/host/src/routines/line/line_test.s similarity index 100% rename from wip-hugo/routines/line/line_test.s rename to host/src/routines/line/line_test.s diff --git a/wip-hugo/routines/line/line_test_extensive.s b/host/src/routines/line/line_test_extensive.s similarity index 100% rename from wip-hugo/routines/line/line_test_extensive.s rename to host/src/routines/line/line_test_extensive.s diff --git a/wip-hugo/routines/line/line_up.s b/host/src/routines/line/line_up.s similarity index 100% rename from wip-hugo/routines/line/line_up.s rename to host/src/routines/line/line_up.s diff --git a/wip-hugo/routines/line/line_up_inv.s b/host/src/routines/line/line_up_inv.s similarity index 100% rename from wip-hugo/routines/line/line_up_inv.s rename to host/src/routines/line/line_up_inv.s diff --git a/wip-hugo/routines/memory/mem.inc b/host/src/routines/memory/mem.inc similarity index 100% rename from wip-hugo/routines/memory/mem.inc rename to host/src/routines/memory/mem.inc diff --git a/wip-hugo/routines/memory/memcpy.s b/host/src/routines/memory/memcpy.s similarity index 100% rename from wip-hugo/routines/memory/memcpy.s rename to host/src/routines/memory/memcpy.s diff --git a/wip-hugo/routines/memory/memcpy_test.s b/host/src/routines/memory/memcpy_test.s similarity index 100% rename from wip-hugo/routines/memory/memcpy_test.s rename to host/src/routines/memory/memcpy_test.s diff --git a/wip-hugo/routines/memory/memset.s b/host/src/routines/memory/memset.s similarity index 100% rename from wip-hugo/routines/memory/memset.s rename to host/src/routines/memory/memset.s diff --git a/wip-hugo/routines/memory/memset_alt.s b/host/src/routines/memory/memset_alt.s similarity index 100% rename from wip-hugo/routines/memory/memset_alt.s rename to host/src/routines/memory/memset_alt.s diff --git a/wip-hugo/routines/memory/memset_test.s b/host/src/routines/memory/memset_test.s similarity index 100% rename from wip-hugo/routines/memory/memset_test.s rename to host/src/routines/memory/memset_test.s diff --git a/wip-hugo/routines/pixel/pixel.inc b/host/src/routines/pixel/pixel.inc similarity index 100% rename from wip-hugo/routines/pixel/pixel.inc rename to host/src/routines/pixel/pixel.inc diff --git a/wip-hugo/routines/pixel/pixel_calc.s b/host/src/routines/pixel/pixel_calc.s similarity index 100% rename from wip-hugo/routines/pixel/pixel_calc.s rename to host/src/routines/pixel/pixel_calc.s diff --git a/wip-hugo/routines/pixel/pixel_draw.s b/host/src/routines/pixel/pixel_draw.s similarity index 100% rename from wip-hugo/routines/pixel/pixel_draw.s rename to host/src/routines/pixel/pixel_draw.s diff --git a/wip-hugo/routines/pixel/pixel_test.s b/host/src/routines/pixel/pixel_test.s similarity index 100% rename from wip-hugo/routines/pixel/pixel_test.s rename to host/src/routines/pixel/pixel_test.s diff --git a/wip-hugo/routines/text/char.inc b/host/src/routines/text/char.inc similarity index 100% rename from wip-hugo/routines/text/char.inc rename to host/src/routines/text/char.inc diff --git a/wip-hugo/routines/text/char_draw.s b/host/src/routines/text/char_draw.s similarity index 100% rename from wip-hugo/routines/text/char_draw.s rename to host/src/routines/text/char_draw.s diff --git a/wip-hugo/routines/text/char_draw_test.s b/host/src/routines/text/char_draw_test.s similarity index 100% rename from wip-hugo/routines/text/char_draw_test.s rename to host/src/routines/text/char_draw_test.s diff --git a/wip-hugo/routines/triangle/lower_triangle.s b/host/src/routines/triangle/lower_triangle.s similarity index 100% rename from wip-hugo/routines/triangle/lower_triangle.s rename to host/src/routines/triangle/lower_triangle.s diff --git a/wip-hugo/routines/triangle/triangle.inc b/host/src/routines/triangle/triangle.inc similarity index 100% rename from wip-hugo/routines/triangle/triangle.inc rename to host/src/routines/triangle/triangle.inc diff --git a/wip-hugo/routines/triangle/triangle.s b/host/src/routines/triangle/triangle.s similarity index 100% rename from wip-hugo/routines/triangle/triangle.s rename to host/src/routines/triangle/triangle.s diff --git a/wip-hugo/routines/triangle/triangle_test.s b/host/src/routines/triangle/triangle_test.s similarity index 100% rename from wip-hugo/routines/triangle/triangle_test.s rename to host/src/routines/triangle/triangle_test.s diff --git a/wip-hugo/routines/triangle/upper_triangle.s b/host/src/routines/triangle/upper_triangle.s similarity index 100% rename from wip-hugo/routines/triangle/upper_triangle.s rename to host/src/routines/triangle/upper_triangle.s diff --git a/wip-hugo/source.s b/host/src/source.s similarity index 82% rename from wip-hugo/source.s rename to host/src/source.s index 9c0bfd3..0d63e58 100644 --- a/wip-hugo/source.s +++ b/host/src/source.s @@ -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" diff --git a/wip-duuqnd/user-side-compiler/asm-function.lisp b/user-side-compiler/asm-function.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/asm-function.lisp rename to user-side-compiler/asm-function.lisp diff --git a/wip-duuqnd/user-side-compiler/backend/code-generator.lisp b/user-side-compiler/backend/code-generator.lisp similarity index 99% rename from wip-duuqnd/user-side-compiler/backend/code-generator.lisp rename to user-side-compiler/backend/code-generator.lisp index 8b0aca2..13d6547 100644 --- a/wip-duuqnd/user-side-compiler/backend/code-generator.lisp +++ b/user-side-compiler/backend/code-generator.lisp @@ -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))) diff --git a/wip-duuqnd/user-side-compiler/backend/pre-assembly.lisp b/user-side-compiler/backend/pre-assembly.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/backend/pre-assembly.lisp rename to user-side-compiler/backend/pre-assembly.lisp diff --git a/wip-duuqnd/user-side-compiler/backend/value-allocator.lisp b/user-side-compiler/backend/value-allocator.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/backend/value-allocator.lisp rename to user-side-compiler/backend/value-allocator.lisp diff --git a/wip-duuqnd/user-side-compiler/binary-test-build.lisp b/user-side-compiler/binary-test-build.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/binary-test-build.lisp rename to user-side-compiler/binary-test-build.lisp diff --git a/wip-duuqnd/user-side-compiler/bytesquash.lisp b/user-side-compiler/bytesquash.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/bytesquash.lisp rename to user-side-compiler/bytesquash.lisp diff --git a/wip-duuqnd/user-side-compiler/error-handling.lisp b/user-side-compiler/error-handling.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/error-handling.lisp rename to user-side-compiler/error-handling.lisp diff --git a/wip-duuqnd/user-side-compiler/high-level.lisp b/user-side-compiler/high-level.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/high-level.lisp rename to user-side-compiler/high-level.lisp diff --git a/wip-duuqnd/user-side-compiler/instruction-list.txt b/user-side-compiler/instruction-list.txt similarity index 100% rename from wip-duuqnd/user-side-compiler/instruction-list.txt rename to user-side-compiler/instruction-list.txt diff --git a/wip-duuqnd/user-side-compiler/instruction.lisp b/user-side-compiler/instruction.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/instruction.lisp rename to user-side-compiler/instruction.lisp diff --git a/wip-duuqnd/user-side-compiler/interface.lisp b/user-side-compiler/interface.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/interface.lisp rename to user-side-compiler/interface.lisp diff --git a/wip-duuqnd/user-side-compiler/label.lisp b/user-side-compiler/label.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/label.lisp rename to user-side-compiler/label.lisp diff --git a/wip-duuqnd/user-side-compiler/middle/compile-node-to-ir.lisp b/user-side-compiler/middle/compile-node-to-ir.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/middle/compile-node-to-ir.lisp rename to user-side-compiler/middle/compile-node-to-ir.lisp diff --git a/wip-duuqnd/user-side-compiler/middle/data.lisp b/user-side-compiler/middle/data.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/middle/data.lisp rename to user-side-compiler/middle/data.lisp diff --git a/wip-duuqnd/user-side-compiler/middle/graph-manipulation.lisp b/user-side-compiler/middle/graph-manipulation.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/middle/graph-manipulation.lisp rename to user-side-compiler/middle/graph-manipulation.lisp diff --git a/wip-duuqnd/user-side-compiler/middle/instructions.lisp b/user-side-compiler/middle/instructions.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/middle/instructions.lisp rename to user-side-compiler/middle/instructions.lisp diff --git a/wip-duuqnd/user-side-compiler/middle/jigs.lisp b/user-side-compiler/middle/jigs.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/middle/jigs.lisp rename to user-side-compiler/middle/jigs.lisp diff --git a/wip-duuqnd/user-side-compiler/middle/optimizations.lisp b/user-side-compiler/middle/optimizations.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/middle/optimizations.lisp rename to user-side-compiler/middle/optimizations.lisp diff --git a/wip-duuqnd/user-side-compiler/middle/structure.lisp b/user-side-compiler/middle/structure.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/middle/structure.lisp rename to user-side-compiler/middle/structure.lisp diff --git a/wip-duuqnd/user-side-compiler/package.lisp b/user-side-compiler/package.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/package.lisp rename to user-side-compiler/package.lisp diff --git a/wip-duuqnd/user-side-compiler/parser.lisp b/user-side-compiler/parser.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/parser.lisp rename to user-side-compiler/parser.lisp diff --git a/wip-duuqnd/user-side-compiler/populate-asm-functions.lisp b/user-side-compiler/populate-asm-functions.lisp similarity index 96% rename from wip-duuqnd/user-side-compiler/populate-asm-functions.lisp rename to user-side-compiler/populate-asm-functions.lisp index 6ad339a..83d9dae 100644 --- a/wip-duuqnd/user-side-compiler/populate-asm-functions.lisp +++ b/user-side-compiler/populate-asm-functions.lisp @@ -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*)) diff --git a/wip-duuqnd/user-side-compiler/reference.lisp b/user-side-compiler/reference.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/reference.lisp rename to user-side-compiler/reference.lisp diff --git a/wip-duuqnd/user-side-compiler/s-print.lisp b/user-side-compiler/s-print.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/s-print.lisp rename to user-side-compiler/s-print.lisp diff --git a/wip-duuqnd/user-side-compiler/symbol-table.lisp b/user-side-compiler/symbol-table.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/symbol-table.lisp rename to user-side-compiler/symbol-table.lisp diff --git a/wip-duuqnd/user-side-compiler/tests/example-0.c6l b/user-side-compiler/tests/example-0.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/example-0.c6l rename to user-side-compiler/tests/example-0.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/example-1.c6l b/user-side-compiler/tests/example-1.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/example-1.c6l rename to user-side-compiler/tests/example-1.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/example-2.c6l b/user-side-compiler/tests/example-2.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/example-2.c6l rename to user-side-compiler/tests/example-2.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/example-3.c6l b/user-side-compiler/tests/example-3.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/example-3.c6l rename to user-side-compiler/tests/example-3.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/example-4.c6l b/user-side-compiler/tests/example-4.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/example-4.c6l rename to user-side-compiler/tests/example-4.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/example-5.c6l b/user-side-compiler/tests/example-5.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/example-5.c6l rename to user-side-compiler/tests/example-5.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/example-6.c6l b/user-side-compiler/tests/example-6.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/example-6.c6l rename to user-side-compiler/tests/example-6.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/invalid-exprs-1.c6l b/user-side-compiler/tests/invalid-exprs-1.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/invalid-exprs-1.c6l rename to user-side-compiler/tests/invalid-exprs-1.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/package.lisp b/user-side-compiler/tests/package.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/package.lisp rename to user-side-compiler/tests/package.lisp diff --git a/wip-duuqnd/user-side-compiler/tests/syntax-error-1.c6l b/user-side-compiler/tests/syntax-error-1.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/syntax-error-1.c6l rename to user-side-compiler/tests/syntax-error-1.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/syntax-error-2.c6l b/user-side-compiler/tests/syntax-error-2.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/syntax-error-2.c6l rename to user-side-compiler/tests/syntax-error-2.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/syntax-error-3.c6l b/user-side-compiler/tests/syntax-error-3.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/syntax-error-3.c6l rename to user-side-compiler/tests/syntax-error-3.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/syntax-error-4.c6l b/user-side-compiler/tests/syntax-error-4.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/syntax-error-4.c6l rename to user-side-compiler/tests/syntax-error-4.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/syntax-error-5.c6l b/user-side-compiler/tests/syntax-error-5.c6l similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/syntax-error-5.c6l rename to user-side-compiler/tests/syntax-error-5.c6l diff --git a/wip-duuqnd/user-side-compiler/tests/unit-tests.lisp b/user-side-compiler/tests/unit-tests.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/tests/unit-tests.lisp rename to user-side-compiler/tests/unit-tests.lisp diff --git a/wip-duuqnd/user-side-compiler/tokenizer.lisp b/user-side-compiler/tokenizer.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/tokenizer.lisp rename to user-side-compiler/tokenizer.lisp diff --git a/wip-duuqnd/user-side-compiler/toolkit.lisp b/user-side-compiler/toolkit.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/toolkit.lisp rename to user-side-compiler/toolkit.lisp diff --git a/wip-duuqnd/user-side-compiler/transform.lisp b/user-side-compiler/transform.lisp similarity index 100% rename from wip-duuqnd/user-side-compiler/transform.lisp rename to user-side-compiler/transform.lisp diff --git a/wip-duuqnd/user-side-compiler/user-side-compiler.asd b/user-side-compiler/user-side-compiler.asd similarity index 100% rename from wip-duuqnd/user-side-compiler/user-side-compiler.asd rename to user-side-compiler/user-side-compiler.asd diff --git a/wip-dicander/STARTUP.s b/wip-dicander/STARTUP.s deleted file mode 100755 index ce821b9..0000000 --- a/wip-dicander/STARTUP.s +++ /dev/null @@ -1,82 +0,0 @@ -.scope STARTUP -;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- -;;Settings positions -CR1 = $d011; ;Graphic settings -VIC_bank_settings = $DD00 ; Vic position -Screen_RAM_settings =$D018 ;Screen RAM position relative to VIC - -;;########## VIC_BANK ################ -;;# BITMAP | $4000 -$5F3F -;;# Unused? | $5F3F - $6000 -;;# SCREAN RAM (color) | $6000 -$63E7 -;;# Unused? | $63E8 - $7FFF -;;# -;;#################################### - -;;Memory positions -VIC_bank = $4000 -VIC_bank_end = VIC_bank + $3FFF - -Bitmap = VIC_bank -Bitmap_end = $5F3F - -Screen_RAM = $2000 + VIC_bank -Screen_RAM_end = Screen_RAM + $03E7 - -Character_generator_ROM = $D000 - -;;Free up memory -;;https://www.c64-wiki.com/wiki/Bank_Switching -;; -;;Set graphic mode [Standard bitmap mode] -;;https://www.c64-wiki.com/wiki/Standard_Bitmap_Mode -LDA #%10111111 ; ECM = False Extended color mode -AND CR1 -STA CR1 - -LDA #%00100000; BMM = True Bitmap mode -ORA CR1 -STA CR1 - -;;Set VIC bank to bank 1 -;;https://www.c64-wiki.com/wiki/VIC_bank -LDA #%11111110 ;bit_0 = False -AND VIC_bank_settings -STA VIC_bank_settings - -LDA #%00000010; bit_1 = True -ORA VIC_bank_settings -STA VIC_bank_settings - -;;Set Scren-RAM to offset 8 ;https://www.c64-wiki.com/wiki/53272 (offset is 8k byte = 1024*8-ich) -LDA #%10001111 ; bit_6 =bit_5=bit_4 = Falsw -AND Screen_RAM_settings -STA Screen_RAM_settings - -LDA #%10000000; bit_1 = True -ORA Screen_RAM_settings -STA Screen_RAM_settings - -;;Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM -Mov_16 >B_start, VIC_bank -Mov_16 >B_end, $5f3f -LDA #$00 -jsr memset - - -;;Sets the screen color to black and white -Mov_16 >B_start, Screen_RAM -Mov_16 >B_end, Screen_RAM_end -LDA #%11110000 -jsr memset -SEI ;Disable interups (not all) -;;Disable BASIC ROM mohahaha -LDA #%11111110 -AND $0001 -STA $0001 -;https://www.c64-wiki.com/wiki/Bank_Switching -;Disable IO, CHAREN =0 -;LDA #%11111011 -;AND $0001 -;STA $0001 -.endscope diff --git a/wip-dicander/macros/16bitarithmetic.s b/wip-dicander/macros/16bitarithmetic.s deleted file mode 100755 index 0f41cc9..0000000 --- a/wip-dicander/macros/16bitarithmetic.s +++ /dev/null @@ -1,140 +0,0 @@ -;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- - -;; A file containing 16-bit macro arithmatic. -;; You may add ,! ass a 5:th parameter to skipp flagg clearing. -;; This will make it run faster but will have unintended behavior. - -;;Se below for some fast 16bit logic -;;http://6502.org/tutorials/compare_beyond.html - -;; Addition always uses the A register -;; a = a + b -.macro Add_16 a_low, a_hi, b_low, b_hi, fast_unsafe -;; IF to run it fast -.ifblank fast_unsafe - CLC -.endif -.if .not .match ({b_low}, a) - LDA b_low -.endif ;;untested - ADC a_low - STA a_low -.if .match ({b_hi}, x) ;;Untested - TXA -.else - LDA b_hi -.endif - ADC a_hi - STA a_hi -.endmacro - - -;; Subtraction uses always uses A register -;; a = a - b -.macro Sub_16 a_low, a_hi, b_low, b_hi, fast_unsafe -;; IF to run it fast -.ifblank fast_unsafe - SEC -.endif -;; if b_low = A and b_hi =A -.if .match({b_low}, a) .and .match({b_hi}, a) ;;untested - .LOCAL rewrite - .LOCAL rewrite2 - STA rewrite +1 - STA rewrite2 + 1 - LDA a_low - rewrite: - SBC #b_low - STA a_low - LDA a_hi - rewrite2: - SBC #b_hi - STA a_hi -;; if b_low = A -.elseif .match({b_low}, a) ;;untested - .LOCAL rewrite - STA rewrite +1 - LDA a_low - rewrite: - SBC #b_low - STA a_low - LDA a_hi - SBC b_hi - STA a_hi -.elseif .match({b_hi}, a) ;;untested - .LOCAL rewrite - STA rewrite +1 - LDA a_low - SBC b_low - STA a_low - LDA a_hi - rewrite: - SBC #b_hi - STA a_hi -.else - LDA a_low - SBC b_low - STA a_low - LDA a_hi - SBC b_hi - STA a_hi -.endif -.endmacro - -;; Subtraction uses always uses A register -;; a = (A, a_hi) - b -.macro Sub_16_A a_low, a_hi, b_low, b_hi, fast_unsafe -;; IF to run it fast -.ifblank fast_unsafe - SEC -.endif - SBC b_low - STA a_low - LDA a_hi - SBC b_hi - STA a_hi -.endmacro - - -;; Multiplication of 2 -;; a = a*2 -.macro Mult_16 low_, hi_, NOT_ROL -;; IF NOT_ROL -.ifblank fast_unsafe - ASL low_ - ROL hi_ -.else - ROL low_ - ROL hi_ -.endif -.endmacro - -.macro Mov_16 a_low, a_hi, b_low, b_hi - LDA b_low - STA a_low - LDA b_hi - STA a_hi -.endmacro - -;;http://www.6502.org/tutorials/compare_beyond.html -;;Larger then operation, uses the A register -;;IF a < b then: jump to label -; C =0 if jump to LABEL -.macro Lag_16 a_low, a_hi, b_low, b_hi, label - .LOCAL LABEL - LDA a_hi - CMP b_hi - BCC label - BNE LABEL - LDA a_low -.if .match ({b_low}, a) - .LOCAL next - STY next +1 -next: - CMP #$ff -.else - CMP b_low -.endif - BCC label - LABEL: -.endmacro diff --git a/wip-dicander/routines/line/line.s b/wip-dicander/routines/line/line.s deleted file mode 100644 index 5b656e8..0000000 --- a/wip-dicander/routines/line/line.s +++ /dev/null @@ -1,47 +0,0 @@ -;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- - -.proc line; X_pos =< X_end skall alltid gälla - .include "line.inc" - ; dx_ = $0c - ; dy_ = $06 - ;;dx - SEC - LDA X_end - SBC X_pos - STA dx - BCC dx_no_underflow;; X_end >= X_pos - EOR #$ff ; Fix bit underflow - dx_no_underflow: - SEC - LDA Y_pos - SBC Y_end - STA dy - BCC down ;normal Y_pos < Y_end -up:; Y_pos > Y_end - STA dy - CMP dx - BCC shallow; dy < dx -steep: - jsr line_up_inv - RTS -shallow: ;dy =< dx - lda dx - jsr line_up - RTS -down: - EOR #$ff ; Fix bit underflow - STA dy - CMP dx - BCC shallow_; dy < dx -steep_: - jsr line_down_inv - RTS -shallow_: ;dy < dx - jsr line_down - RTS - - .include "line_down.s" - .include "line_down_inv.s" - .include "line_up.s" - .include "line_up_inv.s" -.endproc diff --git a/wip-dicander/routines/line/line_down.s b/wip-dicander/routines/line/line_down.s deleted file mode 100644 index e90ab7a..0000000 --- a/wip-dicander/routines/line/line_down.s +++ /dev/null @@ -1,116 +0,0 @@ -;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- - -;;drawing line from 2 cordinates -;;# (X_pos, Y_pos) # -;;# * # -;;# * # -;;# * # -;;# (X_end, Y_end) # -;;NOTE THAT X_pos <= X_end, Y_pos <= Y_end. Max 45deg! - -.proc line_down - - .include "line.inc"; Defines memory positions, ex X_pos - - ;;We need to clear this memory - LDA #$00 - STA V - Mult_16 >V, dy_2, dy_2 = dy (same address) - - ;; This is an Bresenham's line algorithm, se wikipedia bellow. - ;;https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm - ;; We need to compute the Value D = 2*dy - dx, - ;; but it may be or get negative. - ;; IN the loop we may set D = D -V - ;; Because math D needs to be at least >=V. - ;; V_max = %00000001 11111111 - ;; We therefor need to add this offset to V 00000001 11111111 - ;; and to its branch logic later in the loop. - - ;;D = 2*dy - dx + 2*255 - Mov_16 >D, dy_2, D, D, dy_2 - LDA >dy_2 - STA case_2 +1 - ;; Modifies LDA V - LDA >V - STA case_1 +1 - ;; Modifies SBC btp_mem_pos), Y - STA (>btp_mem_pos), Y -increment_pixel_x: - LSR byte_to_paint ; Rotates the pixel one bit to the left ON THE SCREEN. - BCC increment_pixel_x_end; We need to move to the next chunk -move_8px_left: - ;; Next chunk is 8 addresses away. Look in pixel_draw for more detail. - ;; -8. - ;; C = 1 therefore you se 07 - Add_16 >btp_mem_pos, D, D - Sub_16_A >D, V, # C=1 - LDY #$00 - ;; Switch to chunk bellow - ; C = 1 - ; So we subtract #$3F, #$01 +C - Add_16 >btp_mem_pos, D, dy_2, #V - Mult_16 >V, dx_2, D, dx_2, D, D, dx_2 - STA case_2 +1 - LDA V - STA case_1 +1 - LDA btp_mem_pos), Y - STA (>btp_mem_pos), Y -increment_y_pos: - INY - CPY #$08 - BNE increment_y_pos_end -move_8px_down: - LDY #$00 - Add_16 >btp_mem_pos, D, D, V, #btp_mem_pos, D, dx_2, #B_start, VIC_bank - Mov_16 >B_end, $5f3f - LDA #$00 - jsr memset - - - LDA #$00 - STA X_pos_ - LDA #$60 - STA Y_pos_ - LDA #$ff - STA X_end - LDA #$0 - STA Y_end -@loop: - LDA Y_pos_ - STA Y_pos - LDA X_pos_ - STA X_pos - jsr line - INC Y_end - LDA Y_end - CMP #$bb - BEQ end_ - jmp @loop -end_: - jmp exit -.endscope diff --git a/wip-dicander/routines/line/line_test_time.s b/wip-dicander/routines/line/line_test_time.s deleted file mode 100644 index 7006dde..0000000 --- a/wip-dicander/routines/line/line_test_time.s +++ /dev/null @@ -1,49 +0,0 @@ -;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- -.scope line_test_time - .include "line.inc" - - ;;START TIME HERE - - ;;for testing stuff - Y_pos_ = $0D - X_pos_ = $0E - Y_end_ = $10 - X_end_ = $11 - LDA #$00 - STA X_pos_ - LDA #$30 - STA Y_pos_ - LDA #$ff - STA X_end - LDA #$30 - STA Y_end - - -@loop:;; mem f1 - LDA Y_pos_ - STA Y_pos - LDA X_pos_ - STA X_pos - - jsr line - INC Y_end - LDA Y_end - CMP #$50 - BEQ end__ - jmp @loop -end__: - ;;Lets cleer bitmap - B_start = $FCFD - B_end = $FEFF - VIC_bank = $4000 - VIC_bank_end = VIC_bank + $3FFF - ;;Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM - Mov_16 >B_start, VIC_bank - Mov_16 >B_end, $5f3f - LDA #$00 - jsr memset - - - jmp exit - -.endscope diff --git a/wip-dicander/routines/line/line_up.s b/wip-dicander/routines/line/line_up.s deleted file mode 100644 index 3296bd3..0000000 --- a/wip-dicander/routines/line/line_up.s +++ /dev/null @@ -1,78 +0,0 @@ -;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- - -;;drawing line from 2 cordinates -;;# * (X_end, Y_end) # -;;# # -;;# * # -;;# * # -;;# (X_pos, Y_pos) # -;; -;;NOTE THAT X_pos <= X_end, Y_pos >= Y_end. Max 45deg! - -.proc line_up - ;; Look at line_down for referense - .include "line.inc"; Defines memory positions, ex X_pos - - LDA #$00 - STA V - Mult_16 >V, dy_2, D, dy_2, D, D, dy_2 - STA case_2 +1 - LDA V - STA case_1 +1 - LDA btp_mem_pos, btp_mem_pos), Y - STA (>btp_mem_pos), Y -increment_pixel_x: - LSR byte_to_paint - BCC increment_pixel_x_end -move_8px_left: - Add_16 >btp_mem_pos, D, D, V, #btp_mem_pos, D, dy_2, #) Y_end, X_pos <= X_end. Min 45deg! - -.proc line_up_inv - ;; Look at line_down for referense - .include "line.inc"; Defines memory positions, ex X_pos - - LDA #$00 - STA V - Mult_16 >V, dx_2, D, dx_2, D, D, dx_2 - STA case_2 +1 - LDA V - STA case_1 +1 - LDA btp_mem_pos), Y - STA (>btp_mem_pos), Y -decrement_y_pos: - DEY - CPY #$ff - BNE decrement_y_pos_end -move_8px_up: - LDY #$07 - Sub_16>btp_mem_pos, D, D, V, #btp_mem_pos, D, dx_2, #B_start - Sub_16 >A_start, B_start, #$00 - - ;;Lets move B_start lover-nibble to Y - LDY >B_start - LDA #$00 - STA >B_start -loop: - Lag_16 >B_end, B_start), Y - STA (>A_start), Y - ;Tip save time by counting downward, fast to check if Y ==0 // hugo - INY - TYA - CMP #$ff - BNE loop - ;; Fix overflow - LDY #$00 - INC B_start, $D000 - ;#### TEMP INIT DATA #### - Mov_16 >B_end, ($D000 +$1F3F) - LDA #$10 - STA code - LDA #$10 - STA X_pos - STA Y_pos - - VIC_bank = $4000 - VIC_bank_end = VIC_bank + $3FFF - Mov_16 >A_start, VIC_bank - ;We first need to clear some memory - ;Mov_16 >A_end, >A_end, #<(VIC_bank+100), #>(VIC_bank +100) - LDA #$00 - JSR memcpy - STA B_start ,X) - - Add_16 >B_start, B_start - CMP >B_end - BEQ test - jmp loop -test: - LDA B_start, X) - RTS -.endproc diff --git a/wip-dicander/routines/memory/pixel_draw.s b/wip-dicander/routines/memory/pixel_draw.s deleted file mode 100755 index 2138d70..0000000 --- a/wip-dicander/routines/memory/pixel_draw.s +++ /dev/null @@ -1,83 +0,0 @@ -;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- - -;;Screen print. Draws a pixel at a specified position. -;; Destroys A X Y -.proc pixel_draw; Draws a pixel at [Y = FB , X = FC, FD]. Y = 0 - 320, X= 0 - 200 - .include "mem.inc" - Bitmap = $4000 - Bitmap_end = $5F3F - ;; X = X_pos (mod 8) - LDA >X_pos ; X (mod 8) - AND #%00000111 - TAX - - ;;Store pixel in byte_to_paint - LDA #%10000000 - INX -@shift_btp: ;; check out SMB instruction here! //Hugo - DEX - BEQ end__;X=0 end this - CLC - ROR A - jmp @shift_btp -end__: - STA byte_to_paint - - ;;FIND THE POSITION IN MEMORY TO WRITE PIXEL - ;; + + + + + > X - ;; + - ;; + - ;;\/ - ;; Y - ;; - - ;;pos = x_offset - LDA #%11111000 - AND >X_pos - STA >btp_mem_pos - - LDA C - STA >B - LDA #$00 - STA C, C, C, B, C, C, C, btp_mem_pos, C, btp_mem_pos, Bitmap, ! - - ;;Let draw some stuff - LDA byte_to_paint ;; note that both bytes are used! - ORA (>btp_mem_pos), Y - STA (>btp_mem_pos), Y - RTS -.endproc diff --git a/wip-dicander/routines/text/char_draw.s b/wip-dicander/routines/text/char_draw.s deleted file mode 100644 index 65ed67a..0000000 --- a/wip-dicander/routines/text/char_draw.s +++ /dev/null @@ -1,83 +0,0 @@ -;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- -;; petski: https://www.c64-wiki.com/wiki/File:ASCII-Codes.gif -;;https://www.c64-wiki.com/wiki/Character_set -;; Takes in a PETSKI-code in CODE -;; And prints it ON X_pos, Y_pos -;; Note that this is the real positions divided by 8 -.proc char_draw - Character_generator_ROM = $D000 - Y_pos_offset = $F9F8 ;Reuses from Y_pos - X_pos_offset = $FAF7 - X_pos = $FA - Y_pos = $F9 - charset = $FB - code = $FE - petski_position = $FEFF ;reuses code:s memory - screen_position = $FCFD - - ;#### TEMP INIT DATA #### - LDA #$10 - STA code - LDA #04 - STA X_pos - LDA #02 - STA Y_pos - - ;;Do arithimatic to know where to read and write bytes. - initial: - ;We first need to clear some memory - LDA #$00 - STA petski_position, petski_position, petski_position, Character_generator_ROM, ! - - ;;Calculate screen_position to use - Mov_16 >screen_position, VIC_bank - - ;; Add the X_pos has a offset multiplier of *8 because 1 chunk = 8 addresses - ;; *8 - Mult_16 >X_pos_offset, X_pos_offset, X_pos_offset, screen_position, Y_pos_offset, Y_pos_offset, Y_pos_offset, Y_pos_offset, Y_pos_offset, Y_pos_offset, Y_pos_offset, Y_pos_offset, Y_pos_offset, screen_position, Y_pos_offset, petski_position), Y - STA (>screen_position), Y - DEY - BNE @loop - LDA (>petski_position), Y - STA (>screen_position), Y - RTS -.endproc diff --git a/wip-dicander/run.sh b/wip-dicander/run.sh deleted file mode 100755 index fe7c135..0000000 --- a/wip-dicander/run.sh +++ /dev/null @@ -1,10 +0,0 @@ -# !/bin/bash -killall x64sc - -#Note that program start at $080D -cl65 -o file.prg -u __EXEHDR__ -t c64 -C c64-asm.cfg -l file.list source.s \ -&& nohup flatpak run net.sf.VICE -windowypos 0 -windowxpos 960 -windowwidth 945 -windowheight 720 file.prg /dev/null & - -sleep 2 -rm source.o -rm file.prg diff --git a/wip-dicander/source.s b/wip-dicander/source.s deleted file mode 100755 index 19073bc..0000000 --- a/wip-dicander/source.s +++ /dev/null @@ -1,67 +0,0 @@ -;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- -.debuginfo + ; Generate debug info -;;Macros -.include "macros/16bitarithmetic.s" -;;inc files -.include "routines/memory/mem.inc" -;;Code to run -.include "STARTUP.s" -;.include "routines/line/line_test_time.s" -;;.include "routines/memory/memcpy_test.s" -;.include "fillscreen.s" -;Hacky hardcoding. I pick FC and FD to contain the 16 bit offset to the screen -LDA #$40 ;Remember kids, C64 is a little endian computer. Why, why why! Big endian makes more sense! -STA $FD ;THis means that the bitmap starts at $4000 -LDA #$00 -LDX #$60 -STA $FC - -mainloop: -;fill screen with white pixels -LDY #$00 -LDA #%10000000 ; Start out with setting the leftmost pixel to white in every byte in the bitmap -STA $FF ;$FF contains the pattern we are writing to part if the bitmap memory -STA $FE ;$FE conatins the most recent bit/pixel we are adding -;The idea is now to bitshift this to the right, until A is 0. When this happens it is time to update which byte we are working on -pixel_setting_loop: -LDA $FF -STA ($FC),Y -LDA $FE ;FE contains the most recent bit/pixel we are adding -LSR a -BNE more_pixels_in_byte -INC $FC -; if this overflows -BNE not_incrementing_other_byte -INC $FD -CPX $FD -; if the carry flag is zero, branch -BCC done_pixels -not_incrementing_other_byte: -LDA #%10000000 -STA $FE -STA $FF -more_pixels_in_byte: -STA $FE ;$FE conatins the most recent bit/pixel we are adding -ORA $FF ;Add the previous pixels. -STA $FF -JMP pixel_setting_loop -done_pixels: -;check is somebody has pressed space and if so exit, code blatantly stolen from Duuqnd -LDX #%01111111 -LDY #%00010000 -LDA #$ff -STA $DC02 -LDA #$00 -STA $DC03 -STX $DC00 -TYA -AND $DC01 -;Check if A is 0 -BEQ die -jmp mainloop -die: -;.include "routines/line/line.s" -;.include "routines/memory/pixel_draw.s" -.include "routines/memory/memset.s" -;.include "routines/memory/memcpy.s" - diff --git a/wip-hugo/build.sh b/wip-hugo/build.sh deleted file mode 100755 index 6f2a82d..0000000 --- a/wip-hugo/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -# !/bin/bash -#Note that program start at $080D -cl65 -o build/file.prg -u __EXEHDR__ -t c64 -C c64-asm.cfg -l build/program.lst source.s -Ln build/program.lbl \ - -#VICE do not like - -sed -i 's/-/m/g' program.lbl diff --git a/wip-hugo/build/new.labels.labels b/wip-hugo/build/new.labels.labels deleted file mode 100644 index 6dbbc15..0000000 --- a/wip-hugo/build/new.labels.labels +++ /dev/null @@ -1,684 +0,0 @@ -// Labels exported by RetroDebugger v0.64.72 on 2025/07/19 18:02:39 - -{ - Version: "1" - Segments: [ - { - Name: Default - CodeLabels: [ -{ - Address: "1444" - Name: .__BSS_LOAD__ - } -{ - Address: "1444" - Name: .__BSS_RUN__ - } -{ - Address: "0000" - Name: .__BSS_SIZE__ - } -{ - Address: "0001" - Name: .__EXEHDR__ - } -{ - Address: "0001" - Name: .__LOADADDR__ - } -{ - Address: "0000" - Name: .__ZP_FILEOFFS__ - } -{ - Address: "0002" - Name: .__ZP_LAST__ - } -{ - Address: "00FE" - Name: .__ZP_SIZE__ - } -{ - Address: "0002" - Name: .__ZP_START__ - } -{ - Address: "1404" - Name: .big_y_offset - } -{ - Address: "13CE" - Name: .binary_factor - } -{ - Address: "13C3" - Name: .log - } -{ - Address: "13BA" - Name: .inverse_factor_value - } -{ - Address: "13B9" - Name: .for_i_end - } -{ - Address: "13B1" - Name: .R_pos - } -{ - Address: "13B5" - Name: .R_neg - } -{ - Address: "13A4" - Name: .for_i - } -{ - Address: "139A" - Name: .div - } -{ - Address: "1399" - Name: .endloop - } -{ - Address: "138C" - Name: .loop - } -{ - Address: "138E" - Name: .start - } -{ - Address: "1387" - Name: .mult - } -{ - Address: "1377" - Name: .change_length - } -{ - Address: "1380" - Name: .y_overflow - } -{ - Address: "1370" - Name: .loop - } -{ - Address: "136E" - Name: .memcpy - } -{ - Address: "132F" - Name: .big_set_end - } -{ - Address: "1337" - Name: .small_set - } -{ - Address: "1030" - Name: .big_set - } -{ - Address: "1029" - Name: .memset - } -{ - Address: "0FFF" - Name: .move_data - } -{ - Address: "0FD6" - Name: .calculate_screen_position - } -{ - Address: "0FBC" - Name: .calculate_petski_position - } -{ - Address: "0FBC" - Name: .char_draw - } -{ - Address: "0FB3" - Name: .calc_byte_to_paint - } -{ - Address: "0F95" - Name: .pixel_calc - } -{ - Address: "0F90" - Name: .draw - } -{ - Address: "0F88" - Name: .calc_byte_to_paint - } -{ - Address: "0F6A" - Name: .pixel_draw - } -{ - Address: "0F68" - Name: .draw_lower_triangle - } -{ - Address: "0F5C" - Name: .draw_upper_triangle - } -{ - Address: "0F45" - Name: .BC_overflow - } -{ - Address: "0F5C" - Name: .BC_overflow_end - } -{ - Address: "0F28" - Name: .AB_overflow - } -{ - Address: "0F3C" - Name: .AB_overflow_end - } -{ - Address: "0F1F" - Name: .triangle - } -{ - Address: "0F1E" - Name: .end - } -{ - Address: "0EF9" - Name: .qbb_y_overflow - } -{ - Address: "0F15" - Name: .qbb_y_end - } -{ - Address: "0EF3" - Name: .qbb_y - } -{ - Address: "0ED9" - Name: .qdb_overflow - } -{ - Address: "0EF3" - Name: .qdb_y_end - } -{ - Address: "0ED5" - Name: .qdb_y - } -{ - Address: "0EBB" - Name: .qca_x_overflow - } -{ - Address: "0ED5" - Name: .qca_x_end - } -{ - Address: "0EB7" - Name: .qca_x - } -{ - Address: "0E9D" - Name: .qaa_x_overflow - } -{ - Address: "0EB7" - Name: .qaa_x_end - } -{ - Address: "0E99" - Name: .qaa_x - } -{ - Address: "0E95" - Name: .change_x - } -{ - Address: "0F15" - Name: .endif - } -{ - Address: "0E95" - Name: .if - } -{ - Address: "0E6C" - Name: .qcb_x_overflow - } -{ - Address: "0E87" - Name: .qcb_x_end - } -{ - Address: "0E68" - Name: .qcb_x - } -{ - Address: "0E4E" - Name: .qdb_x_overflow - } -{ - Address: "0E68" - Name: .qdb_x_end - } -{ - Address: "0E4A" - Name: .qdb_x - } -{ - Address: "0E2E" - Name: .qda_y_overflow - } -{ - Address: "0E4A" - Name: .qda_y_end - } -{ - Address: "0E28" - Name: .qda_y - } -{ - Address: "0E0E" - Name: .qaa_y_underflow - } -{ - Address: "0E28" - Name: .qaa_y_end - } -{ - Address: "0E0A" - Name: .qaa_y - } -{ - Address: "0E08" - Name: .change_Y - } -{ - Address: "0E00" - Name: .draw_qab - } -{ - Address: "0DF8" - Name: .draw_qbb - } -{ - Address: "0DF2" - Name: .draw_qdb - } -{ - Address: "0DEA" - Name: .draw_qcb - } -{ - Address: "0DE4" - Name: .draw_qca - } -{ - Address: "0DDC" - Name: .draw_qda - } -{ - Address: "0DD6" - Name: .draw_qba - } -{ - Address: "0DCE" - Name: .draw_qaa - } -{ - Address: "0DCE" - Name: .draw_pixels - } -{ - Address: "0DCE" - Name: .while_x_bigger_then_y - } -{ - Address: "0DB4" - Name: .draw_right_px_in_circle - } -{ - Address: "0D93" - Name: .draw_lower_px_in_circle - } -{ - Address: "0D75" - Name: .draw_left_px_in_circle - } -{ - Address: "0D57" - Name: .draw_upper_px_in_circle - } -{ - Address: "0D4B" - Name: .circle - } -{ - Address: "0D2A" - Name: .move_8px_left - } -{ - Address: "0D26" - Name: .increment_pixel_x - } -{ - Address: "0D1C" - Name: .LOCAL-MACRO_SYMBOL-002F - } -{ - Address: "0D4A" - Name: .end - } -{ - Address: "0CFD" - Name: .move_8px_up - } -{ - Address: "0D0B" - Name: .decrement_y_pos_end - } -{ - Address: "0CFA" - Name: .decrement_y_pos - } -{ - Address: "0CF4" - Name: .for_y - } -{ - Address: "0CDF" - Name: .end_selfmod - } -{ - Address: "0D1C" - Name: .case_1 - } -{ - Address: "0D3B" - Name: .case_2 - } -{ - Address: "0CCB" - Name: .selfmod - } -{ - Address: "0C90" - Name: .decrement_y_pos_end - } -{ - Address: "0C7F" - Name: .move_8px_up - } -{ - Address: "0C7C" - Name: .decrement_y_pos - } -{ - Address: "0C72" - Name: .LOCAL-MACRO_SYMBOL-0021 - } -{ - Address: "0C9F" - Name: .end - } -{ - Address: "0C53" - Name: .move_8px_left - } -{ - Address: "0C61" - Name: .increment_pixel_x_end - } -{ - Address: "0C4F" - Name: .increment_pixel_x - } -{ - Address: "0C49" - Name: .for_x - } -{ - Address: "0C35" - Name: .end_selfmod - } -{ - Address: "0C72" - Name: .case_1 - } -{ - Address: "0C90" - Name: .case_2 - } -{ - Address: "0C21" - Name: .selfmod - } -{ - Address: "0BD4" - Name: .move_8px_left - } -{ - Address: "0BD0" - Name: .increment_pixel_x - } -{ - Address: "0BC6" - Name: .LOCAL-MACRO_SYMBOL-0017 - } -{ - Address: "0BF5" - Name: .end - } -{ - Address: "0BA7" - Name: .move_8px_down - } -{ - Address: "0BB5" - Name: .increment_y_pos_end - } -{ - Address: "0BA4" - Name: .increment_y_pos - } -{ - Address: "0B9E" - Name: .for_y - } -{ - Address: "0B7D" - Name: .end_selfmod - } -{ - Address: "0BC6" - Name: .case_1 - } -{ - Address: "0BE6" - Name: .case_2 - } -{ - Address: "0B69" - Name: .selfmod - } -{ - Address: "0B2E" - Name: .decrement_y_pos_end - } -{ - Address: "0B1D" - Name: .move_8px_up - } -{ - Address: "0B1A" - Name: .decrement_y_pos - } -{ - Address: "0B10" - Name: .LOCAL-MACRO_SYMBOL-0009 - } -{ - Address: "0B3D" - Name: .end - } -{ - Address: "0AF1" - Name: .move_8px_right - } -{ - Address: "0AFF" - Name: .decrement_pixel_x_end - } -{ - Address: "0AED" - Name: .decrement_pixel_x - } -{ - Address: "0AE7" - Name: .for_x - } -{ - Address: "0AC7" - Name: .end_selfmod - } -{ - Address: "0B10" - Name: .case_1 - } -{ - Address: "0B2E" - Name: .case_2 - } -{ - Address: "0AB3" - Name: .selfmod - } -{ - Address: "0A88" - Name: .line_down - } -{ - Address: "0B3E" - Name: .line_down_inv - } -{ - Address: "0A80" - Name: .steep_ - } -{ - Address: "0A84" - Name: .shallow_ - } -{ - Address: "0BF6" - Name: .line_up - } -{ - Address: "0CA0" - Name: .line_up_inv - } -{ - Address: "0A6E" - Name: .steep - } -{ - Address: "0A72" - Name: .shallow - } -{ - Address: "0A68" - Name: .up - } -{ - Address: "0A78" - Name: .down - } -{ - Address: "0A5F" - Name: .dx_no_underflow - } -{ - Address: "0A54" - Name: .line - } -{ - Address: "0A51" - Name: .exit - } -{ - Address: "0A21" - Name: .end_test_y - } -{ - Address: "0A15" - Name: .test_y - } -{ - Address: "0A0B" - Name: .end_test_x - } -{ - Address: "09FF" - Name: .test_x - } -{ - Address: "09D0" - Name: .@loop - } -{ - Address: "09BE" - Name: .long_line_test_b - } -{ - Address: "09A9" - Name: .clear_screen_ - } -{ - Address: "0992" - Name: .@loop - } -{ - Address: "0980" - Name: .long_line_test_a - } -{ - Address: "096B" - Name: .clear_screen - } -{ - Address: "0954" - Name: .@loop - } -{ - Address: "08FE" - Name: .loop - } -{ - Address: "08C5" - Name: .loop - } -{ - Address: "0897" - Name: .NMI_routine_end - } -{ - Address: "0896" - Name: .NMI_routine - } - ] - } - ] -} diff --git a/wip-hugo/macros/timer.s b/wip-hugo/macros/timer.s deleted file mode 100644 index 92c7059..0000000 --- a/wip-hugo/macros/timer.s +++ /dev/null @@ -1,34 +0,0 @@ -;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- - -;; Max 0.9s -;; Exempel i kod: -;; -;; time_start -;; ... -;; time_stop -;; -;; Läs tiden genom att undersöka värdet i $f1 (BSD-format) -time = $f1 -.macro time_start - PHA - LDA $DC08 ; Bit 0..3: Tenth seconds in BCD-format, others may be 0 or 1 - ;;;;Clear all time data and set time =1. - AND #%11110000 - STA $DC08 - INC $DC08 - LDA $DC08 - ;;Time is only at bit 0 ..3 - AND #%00001111 - STA time - PLA -.endmacro - -.macro time_stop - PHA - LDA $DC08 ; Bit 0..3: Tenth seconds in BCD-format, others may be 0 or 1 - AND #%00001111 - SEC - SBC time - STA time - PLA -.endmacro diff --git a/wip-hugo/program.lbl b/wip-hugo/program.lbl deleted file mode 100644 index 2cec8a4..0000000 --- a/wip-hugo/program.lbl +++ /dev/null @@ -1,168 +0,0 @@ -al 001444 .__BSS_LOAD__ -al 001444 .__BSS_RUN__ -al 000000 .__BSS_SIZE__ -al 000001 .__EXEHDR__ -al 000001 .__LOADADDR__ -al 000000 .__ZP_FILEOFFS__ -al 000002 .__ZP_LAST__ -al 0000FE .__ZP_SIZE__ -al 000002 .__ZP_START__ -al 001404 .big_y_offset -al 0013CE .binary_factor -al 0013C3 .log -al 0013BA .inverse_factor_value -al 0013B9 .for_i_end -al 0013B1 .R_pos -al 0013B5 .R_neg -al 0013A4 .for_i -al 00139A .div -al 001399 .endloop -al 00138C .loop -al 00138E .start -al 001387 .mult -al 001377 .change_length -al 001380 .y_overflow -al 001370 .loop -al 00136E .memcpy -al 00132F .big_set_end -al 001337 .small_set -al 001030 .big_set -al 001029 .memset -al 000FFF .move_data -al 000FD6 .calculate_screen_position -al 000FBC .calculate_petski_position -al 000FBC .char_draw -al 000FB3 .calc_byte_to_paint -al 000F95 .pixel_calc -al 000F90 .draw -al 000F88 .calc_byte_to_paint -al 000F6A .pixel_draw -al 000F68 .draw_lower_triangle -al 000F5C .draw_upper_triangle -al 000F45 .BC_overflow -al 000F5C .BC_overflow_end -al 000F28 .AB_overflow -al 000F3C .AB_overflow_end -al 000F1F .triangle -al 000F1E .end -al 000EF9 .qbb_y_overflow -al 000F15 .qbb_y_end -al 000EF3 .qbb_y -al 000ED9 .qdb_overflow -al 000EF3 .qdb_y_end -al 000ED5 .qdb_y -al 000EBB .qca_x_overflow -al 000ED5 .qca_x_end -al 000EB7 .qca_x -al 000E9D .qaa_x_overflow -al 000EB7 .qaa_x_end -al 000E99 .qaa_x -al 000E95 .change_x -al 000F15 .endif -al 000E95 .if -al 000E6C .qcb_x_overflow -al 000E87 .qcb_x_end -al 000E68 .qcb_x -al 000E4E .qdb_x_overflow -al 000E68 .qdb_x_end -al 000E4A .qdb_x -al 000E2E .qda_y_overflow -al 000E4A .qda_y_end -al 000E28 .qda_y -al 000E0E .qaa_y_underflow -al 000E28 .qaa_y_end -al 000E0A .qaa_y -al 000E08 .change_Y -al 000E00 .draw_qab -al 000DF8 .draw_qbb -al 000DF2 .draw_qdb -al 000DEA .draw_qcb -al 000DE4 .draw_qca -al 000DDC .draw_qda -al 000DD6 .draw_qba -al 000DCE .draw_qaa -al 000DCE .draw_pixels -al 000DCE .while_x_bigger_then_y -al 000DB4 .draw_right_px_in_circle -al 000D93 .draw_lower_px_in_circle -al 000D75 .draw_left_px_in_circle -al 000D57 .draw_upper_px_in_circle -al 000D4B .circle -al 000D2A .move_8px_left -al 000D26 .increment_pixel_x -al 000D1C .LOCALmMACRO_SYMBOLm002F -al 000D4A .end -al 000CFD .move_8px_up -al 000D0B .decrement_y_pos_end -al 000CFA .decrement_y_pos -al 000CF4 .for_y -al 000CDF .end_selfmod -al 000D1C .case_1 -al 000D3B .case_2 -al 000CCB .selfmod -al 000C90 .decrement_y_pos_end -al 000C7F .move_8px_up -al 000C7C .decrement_y_pos -al 000C72 .LOCALmMACRO_SYMBOLm0021 -al 000C9F .end -al 000C53 .move_8px_left -al 000C61 .increment_pixel_x_end -al 000C4F .increment_pixel_x -al 000C49 .for_x -al 000C35 .end_selfmod -al 000C72 .case_1 -al 000C90 .case_2 -al 000C21 .selfmod -al 000BD4 .move_8px_left -al 000BD0 .increment_pixel_x -al 000BC6 .LOCALmMACRO_SYMBOLm0017 -al 000BF5 .end -al 000BA7 .move_8px_down -al 000BB5 .increment_y_pos_end -al 000BA4 .increment_y_pos -al 000B9E .for_y -al 000B7D .end_selfmod -al 000BC6 .case_1 -al 000BE6 .case_2 -al 000B69 .selfmod -al 000B2E .decrement_y_pos_end -al 000B1D .move_8px_up -al 000B1A .decrement_y_pos -al 000B10 .LOCALmMACRO_SYMBOLm0009 -al 000B3D .end -al 000AF1 .move_8px_right -al 000AFF .decrement_pixel_x_end -al 000AED .decrement_pixel_x -al 000AE7 .for_x -al 000AC7 .end_selfmod -al 000B10 .case_1 -al 000B2E .case_2 -al 000AB3 .selfmod -al 000A88 .line_down -al 000B3E .line_down_inv -al 000A80 .steep_ -al 000A84 .shallow_ -al 000BF6 .line_up -al 000CA0 .line_up_inv -al 000A6E .steep -al 000A72 .shallow -al 000A68 .up -al 000A78 .down -al 000A5F .dx_no_underflow -al 000A54 .line -al 000A51 .exit -al 000A21 .end_test_y -al 000A15 .test_y -al 000A0B .end_test_x -al 0009FF .test_x -al 0009D0 .@loop -al 0009BE .long_line_test_b -al 0009A9 .clear_screen_ -al 000992 .@loop -al 000980 .long_line_test_a -al 00096B .clear_screen -al 000954 .@loop -al 0008FE .loop -al 0008C5 .loop -al 000897 .NMI_routine_end -al 000896 .NMI_routine