From 36f2dcf255c4abcd285b065fa045fa3c1263b97a Mon Sep 17 00:00:00 2001 From: nino-porcino Date: Mon, 7 Feb 2022 09:26:32 +0100 Subject: [PATCH] remove VIC20 target --- README.md | 8 ---- kickc/vic20_8k.ld | 8 ---- kickc/vic20_8k.tgt | 14 ------ lib/apple1.h | 105 ++++++++++++--------------------------------- lib/screen1.h | 4 -- tools/build.bat | 4 -- tools/build.sh | 4 -- 7 files changed, 28 insertions(+), 119 deletions(-) delete mode 100644 kickc/vic20_8k.ld delete mode 100644 kickc/vic20_8k.tgt diff --git a/README.md b/README.md index cd53457..fba9ece 100644 --- a/README.md +++ b/README.md @@ -247,7 +247,6 @@ of the KickC compiler: - `apple1` - `apple1_jukebox` -- `vic20` #### Target "apple1" @@ -287,10 +286,3 @@ $0000-$00FF zero page: holds some C program variables $0280-$0FFF RAM: C program "Data" segment $4000-$7581 ROM: C program "Code" segment $7582-$7FFF ROM: C program "Data" segment (startup values) - -#### Target "vic20" - -This target has been used during the development of the library -where a custom made VIC-20 emulator was interfaced with -an emulated TMS9918, thus allowing running tests when -the real Apple-1 machine was not available. diff --git a/kickc/vic20_8k.ld b/kickc/vic20_8k.ld deleted file mode 100644 index ebbe3c4..0000000 --- a/kickc/vic20_8k.ld +++ /dev/null @@ -1,8 +0,0 @@ -// Commodore VIC 20 8k executable PRG file -.file [name="%O", type="prg", segments="Program"] -.segmentdef Program [segments="Basic, Code, Data"] -.segmentdef Basic [start=$1201] -.segmentdef Code [start=%P] -.segmentdef Data [startAfter="Code"] -.segment Basic -:BasicUpstart(%E) diff --git a/kickc/vic20_8k.tgt b/kickc/vic20_8k.tgt deleted file mode 100644 index 5b12787..0000000 --- a/kickc/vic20_8k.tgt +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Commodore VIC 20 8K executable PRG file", - "extension": "prg", - "link": "vic20_8k.ld", - "start_address": "0x120d", - "cpu": "MOS6502X", - "interrupt": "rom_min_vic20", - "emulator": "echo", - "defines": { - "__VIC20__": 1, - "VIC20": 1, - "__KICKC__": 1 - } -} diff --git a/lib/apple1.h b/lib/apple1.h index f5638e5..248acec 100644 --- a/lib/apple1.h +++ b/lib/apple1.h @@ -14,36 +14,23 @@ #pragma zp_reserve(0x2B) // MODE $00=XAM, $7F=STOR, $AE=BLOCK XAM #endif -#ifdef APPLE1 - // APPLE1 - const word WOZMON = 0xFF1F; // enters monitor - const word ECHO = 0xFFEF; // output ascii character in A (A not destroyed) - const word PRBYTE = 0xFFDC; // print hex byte in A (A destroyed) - const word KEY_DATA = 0xd010; // read key - const word KEY_CTRL = 0xd011; // control port - const word TERM_DATA = 0xd012; // write ascii - const word TERM_CTRL = 0xd013; // control port - const word INBUFFER = 0x0200; // woz monitor input buffer - const word INBUFSIZE = 0x80; // woz monitor input buffer size -#else - // VIC20 - const word ECHO = 0xFFD2; // chrout routine in kernal rom - const word GETIN = 0xFFE4; // GETIN keyboard read routine -#endif +// APPLE1 +const word WOZMON = 0xFF1F; // enters monitor +const word ECHO = 0xFFEF; // output ascii character in A (A not destroyed) +const word PRBYTE = 0xFFDC; // print hex byte in A (A destroyed) +const word KEY_DATA = 0xd010; // read key +const word KEY_CTRL = 0xd011; // control port +const word TERM_DATA = 0xd012; // write ascii +const word TERM_CTRL = 0xd013; // control port +const word INBUFFER = 0x0200; // woz monitor input buffer +const word INBUFSIZE = 0x80; // woz monitor input buffer size // prints a hex byte using the WOZMON routine void woz_print_hex(byte c) { - #ifdef APPLE1 - asm { - lda c - jsr PRBYTE - }; - #else - asm { - lda c - jsr ECHO - }; - #endif + asm { + lda c + jsr PRBYTE + }; } // print hex word @@ -68,65 +55,32 @@ void woz_puts(byte *s) { // returns to WOZMON prompt void woz_mon() { - #ifdef APPLE1 - asm { - jmp WOZMON - } - #endif + asm { + jmp WOZMON + } } // returns nonzero if a key has been pressed -inline byte apple1_iskeypressed() { - #ifdef APPLE1 - return PEEK(KEY_CTRL) & 0x80; - #else - return 0; - #endif +inline byte apple1_iskeypressed() { + return PEEK(KEY_CTRL) & 0x80; } // blocking keyboard read // reads a key from the apple-1 keyboard byte apple1_getkey() { - #ifdef APPLE1 - asm { - __wait: - lda KEY_CTRL - bpl __wait - } - return PEEK(KEY_DATA) & 0x7f; - #else - byte key; - byte const *keyptr = &key; - kickasm(uses keyptr, uses GETIN) {{ - __wait: - jsr GETIN - cmp #0 - beq __wait - sta keyptr - }} - return key; - #endif + asm { + __wait: + lda KEY_CTRL + bpl __wait + } + return PEEK(KEY_DATA) & 0x7f; } // non blocking keyboard read // reads a key and return 0 if no key is pressed byte apple1_readkey() { - #ifdef APPLE1 - if((PEEK(KEY_CTRL) & 0x80)==0) return 0; - else return PEEK(KEY_DATA) & 0x7f; - #else - byte key; - byte const *keyptr = &key; - kickasm(uses keyptr, uses GETIN) {{ - jsr GETIN - cmp #0 - bne __keypress - lda #0 - __keypress: - sta keyptr - }} - return key; - #endif + if((PEEK(KEY_CTRL) & 0x80)==0) return 0; + else return PEEK(KEY_DATA) & 0x7f; } void apple1_input_line(byte *buffer, byte max) { @@ -162,8 +116,6 @@ void apple1_input_line(byte *buffer, byte max) { buffer[x]=0; } -#ifdef APPLE1 - #include // for memcpy #define LOWRAM_START 0x280 @@ -175,6 +127,5 @@ inline void apple1_eprom_init() { // copy the initializaton data from ROM to lowram where "Data" segment is allocated memcpy((byte *)LOWRAM_START, (byte *)DATAINCODE, LOWRAM_SIZE); } -#endif -#endif \ No newline at end of file +#endif diff --git a/lib/screen1.h b/lib/screen1.h index 9f0ffe4..912e82b 100644 --- a/lib/screen1.h +++ b/lib/screen1.h @@ -67,11 +67,7 @@ void screen1_prepare() { } } -#ifdef VIC20 -#define CHR_BACKSPACE 20 -#else #define CHR_BACKSPACE 8 -#endif #define CHR_HOME 11 #define CHR_CLS 12 diff --git a/tools/build.bat b/tools/build.bat index 5cbde0f..6dd3db1 100644 --- a/tools/build.bat +++ b/tools/build.bat @@ -3,10 +3,6 @@ @SET TARGET=%1 @SET TMS9918=..\.. -@echo ======================== VIC20 =================================================== -call kickc -includedir %TMS9918%\lib -targetdir %TMS9918%\kickc\ -t vic20_8k %TARGET%.c -o out\%TARGET%_vic20.prg -e -copy out\%TARGET%.prg out\%TARGET%_vic20.prg - @echo ======================== APPLE 1 JUKEBOX ================================================= call kickc -includedir %TMS9918%\lib -targetdir %TMS9918%\kickc\ -t apple1_jukebox %TARGET%.c -o out\%TARGET%.prg -e call node %TMS9918%\tools\mkeprom out out\%TARGET%_jukebox.bin diff --git a/tools/build.sh b/tools/build.sh index b743995..bff79d1 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -5,10 +5,6 @@ TMS9918=../.. mkdir -p out -echo ======================== VIC20 =================================================== -kickc.sh -includedir ${TMS9918}/lib -targetdir ${TMS9918}/kickc/ -t vic20_8k ${TARGET}.c -o out/${TARGET}_vic20.prg -e -cp out/${TARGET}.prg out/${TARGET}_vic20.prg - echo ======================== APPLE 1 JUKEBOX ================================================= kickc.sh -includedir ${TMS9918}/lib -targetdir ${TMS9918}/kickc/ -t apple1_jukebox ${TARGET}.c -o out/${TARGET}.prg -e node ${TMS9918}/tools/mkeprom out out/${TARGET}_jukebox.bin