From a1c8860f63132f34258053bb90884b35ff264022 Mon Sep 17 00:00:00 2001 From: jede Date: Sun, 1 Oct 2017 23:23:03 +0200 Subject: [PATCH 001/254] telestrat : cgetc add for conio --- libsrc/telestrat/cgetc.s | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 libsrc/telestrat/cgetc.s diff --git a/libsrc/telestrat/cgetc.s b/libsrc/telestrat/cgetc.s new file mode 100644 index 000000000..85ea4fccb --- /dev/null +++ b/libsrc/telestrat/cgetc.s @@ -0,0 +1,15 @@ +; +; jede jede@oric.org 2017-10-01 +; + .export _cgetc + + .include "telestrat.inc" + +.proc _cgetc +loop: + BRK_TELEMON XRD0 + bcc key_pressed + jmp loop +key_pressed: + rts +.endproc From 56360ea0542bffc8f3143b770180dca6ed78401e Mon Sep 17 00:00:00 2001 From: jede Date: Mon, 2 Oct 2017 12:20:52 +0200 Subject: [PATCH 002/254] optimize --- libsrc/telestrat/cgetc.s | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libsrc/telestrat/cgetc.s b/libsrc/telestrat/cgetc.s index 85ea4fccb..591f966bc 100644 --- a/libsrc/telestrat/cgetc.s +++ b/libsrc/telestrat/cgetc.s @@ -8,8 +8,6 @@ .proc _cgetc loop: BRK_TELEMON XRD0 - bcc key_pressed - jmp loop -key_pressed: + bcs loop rts .endproc From ca4ed290d5964dbe833224d967d3707e20972278 Mon Sep 17 00:00:00 2001 From: Lauri Kasanen Date: Tue, 3 Oct 2017 18:46:39 +0300 Subject: [PATCH 003/254] cl65: Add support for --all-cdecl --- src/cl65/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cl65/main.c b/src/cl65/main.c index b209cb21d..565f20b45 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -752,6 +752,7 @@ static void Usage (void) "\n" "Long options:\n" " --add-source\t\t\tInclude source as comment\n" + " --all-cdecl\t\t\tMake functions default to __cdecl__\n" " --asm-args options\t\tPass options to the assembler\n" " --asm-define sym[=v]\t\tDefine an assembler symbol\n" " --asm-include-dir dir\t\tSet an assembler include directory\n" @@ -815,6 +816,14 @@ static void OptAddSource (const char* Opt attribute ((unused)), } +static void OptAllCDecl (const char* Opt attribute ((unused)), + const char* Arg attribute ((unused))) +/* Make functions default to __cdecl__ */ +{ + CmdAddArg (&CC65, "--all-cdecl"); +} + + static void OptAsmArgs (const char* Opt attribute ((unused)), const char* Arg) /* Pass arguments to the assembler */ @@ -1290,6 +1299,7 @@ int main (int argc, char* argv []) /* Program long options */ static const LongOpt OptTab[] = { { "--add-source", 0, OptAddSource }, + { "--all-cdecl", 0, OptAllCDecl }, { "--asm-args", 1, OptAsmArgs }, { "--asm-define", 1, OptAsmDefine }, { "--asm-include-dir", 1, OptAsmIncludeDir }, From a084ea8e42487602fdf6bb475fe44ce6edb01739 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Tue, 3 Oct 2017 21:58:52 +0200 Subject: [PATCH 004/254] Atari: split "setcursor" function out of cgetc.s source file into setcursor.s. This function is used by many other CONIO functions, and the user program not necessarily uses 'cgetc'. Having "setcursor" in a different object file saves space in this case and also allows the user program to override it (e.g. when not using GRAPHICS 0 mode). --- libsrc/atari/cgetc.s | 44 ++---------------------------------- libsrc/atari/setcursor.s | 48 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 42 deletions(-) create mode 100644 libsrc/atari/setcursor.s diff --git a/libsrc/atari/cgetc.s b/libsrc/atari/cgetc.s index 2e9ebcb31..f8d938dfb 100644 --- a/libsrc/atari/cgetc.s +++ b/libsrc/atari/cgetc.s @@ -6,9 +6,9 @@ ; .include "atari.inc" - .export _cgetc,setcursor + .export _cgetc + .import setcursor .import KEYBDV_handler - .import cursor,mul40 _cgetc: jsr setcursor @@ -29,43 +29,3 @@ _cgetc: pha rts .endif - -.proc setcursor - - ldy #0 - lda OLDCHR - sta (OLDADR),y - - lda ROWCRS - jsr mul40 - clc - adc SAVMSC ; add start of screen memory - sta OLDADR - txa - adc SAVMSC+1 - sta OLDADR+1 - lda COLCRS - adc OLDADR - sta OLDADR - bcc nc - inc OLDADR+1 -nc: lda (OLDADR),y - sta OLDCHR - - ldx cursor ; current cursor setting as requested by the user - beq off - ldx #0 - beq cont - -off: inx -cont: stx CRSINH ; update system variable - - beq turnon - and #$7f ; clear high bit / inverse flag -finish: sta (OLDADR),y ; update on-screen display - rts - -turnon: ora #$80 ; set high bit / inverse flag - bne finish - -.endproc diff --git a/libsrc/atari/setcursor.s b/libsrc/atari/setcursor.s new file mode 100644 index 000000000..cf596d4fe --- /dev/null +++ b/libsrc/atari/setcursor.s @@ -0,0 +1,48 @@ +; +; Christian Groessler, November-2002 +; +; cursor handling, internal function + + .include "atari.inc" + .import cursor,mul40 + .export setcursor + +.proc setcursor + + ldy #0 + lda OLDCHR + sta (OLDADR),y + + lda ROWCRS + jsr mul40 + clc + adc SAVMSC ; add start of screen memory + sta OLDADR + txa + adc SAVMSC+1 + sta OLDADR+1 + lda COLCRS + adc OLDADR + sta OLDADR + bcc nc + inc OLDADR+1 +nc: lda (OLDADR),y + sta OLDCHR + + ldx cursor ; current cursor setting as requested by the user + beq off + ldx #0 + beq cont + +off: inx +cont: stx CRSINH ; update system variable + + beq turnon + and #$7f ; clear high bit / inverse flag +finish: sta (OLDADR),y ; update on-screen display + rts + +turnon: ora #$80 ; set high bit / inverse flag + bne finish + +.endproc From ff12835ee2f59ff147b67f9e8d194b46fea02f94 Mon Sep 17 00:00:00 2001 From: jede Date: Sun, 8 Oct 2017 18:11:09 +0200 Subject: [PATCH 005/254] Adding cgetc --- libsrc/telestrat/cgetc.s | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libsrc/telestrat/cgetc.s b/libsrc/telestrat/cgetc.s index 591f966bc..9bdbf4818 100644 --- a/libsrc/telestrat/cgetc.s +++ b/libsrc/telestrat/cgetc.s @@ -3,9 +3,24 @@ ; .export _cgetc + .import cursor + + .include "telestrat.inc" .proc _cgetc + ; this routine could be quicker if we wrote in page 2 variables, but it's better to use telemon routine in that case, because telemon can manage 4 I/O + lda cursor ; if cursor equal to 0, then switch off cursor + beq switchoff_cursor + + ldx #$00 ; x is the first screen + BRK_TELEMON(XCSSCR) ; display cursor + jmp loop ; could be replaced by a bne/beq but 'jmp' is cleaner than a bne/beq which could expect some + +switchoff_cursor: + ldx #$00 ; x is the first screen + BRK_TELEMON(XCOSCR) ; switch off cursor + loop: BRK_TELEMON XRD0 bcs loop From a01c8c238c44195f3e13226c9d3ca9efd10d7fc6 Mon Sep 17 00:00:00 2001 From: jede Date: Sun, 8 Oct 2017 18:14:26 +0200 Subject: [PATCH 006/254] Correcting comments --- libsrc/telestrat/cgetc.s | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libsrc/telestrat/cgetc.s b/libsrc/telestrat/cgetc.s index 9bdbf4818..2b0fc7758 100644 --- a/libsrc/telestrat/cgetc.s +++ b/libsrc/telestrat/cgetc.s @@ -4,25 +4,25 @@ .export _cgetc .import cursor - .include "telestrat.inc" .proc _cgetc - ; this routine could be quicker if we wrote in page 2 variables, but it's better to use telemon routine in that case, because telemon can manage 4 I/O - lda cursor ; if cursor equal to 0, then switch off cursor + ; this routine could be quicker if we wrote in page 2 variables, + ; but it's better to use telemon routine in that case, because telemon can manage 4 I/O + lda cursor ; if cursor equal to 0, then switch off cursor beq switchoff_cursor ldx #$00 ; x is the first screen BRK_TELEMON(XCSSCR) ; display cursor - jmp loop ; could be replaced by a bne/beq but 'jmp' is cleaner than a bne/beq which could expect some + jmp loop ; could be replaced by a bne/beq but 'jmp' is cleaner than a bne/beq which could expect some matters switchoff_cursor: ldx #$00 ; x is the first screen BRK_TELEMON(XCOSCR) ; switch off cursor loop: - BRK_TELEMON XRD0 + BRK_TELEMON XRD0 ; waits until key is pressed bcs loop rts .endproc From bea5364b978b69125ec65adaa4f906ce062364a5 Mon Sep 17 00:00:00 2001 From: Greg King Date: Mon, 16 Oct 2017 09:39:33 -0400 Subject: [PATCH 007/254] Added commit ca4ed290d5964dbe833224d967d3707e20972278's command-line option to the cl65 document. --- doc/cl65.sgml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/cl65.sgml b/doc/cl65.sgml index 8b3c02cbb..ca5f9d2af 100644 --- a/doc/cl65.sgml +++ b/doc/cl65.sgml @@ -4,7 +4,7 @@ cl65 Users Guide <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> -<date>2017-05-24 +<date>2017-10-16 <abstract> cl65 is the compile & link utility for cc65, the 6502 C compiler. It was @@ -69,6 +69,7 @@ Short options: Long options: --add-source Include source as comment + --all-cdecl Make functions default to __cdecl__ --asm-args options Pass options to the assembler --asm-define sym[=v] Define an assembler symbol --asm-include-dir dir Set an assembler include directory From 256ba6bddf50dacd4c6c87ab54be6d4dca514dd2 Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 16 Oct 2017 16:06:18 +0200 Subject: [PATCH 008/254] Adding XSOUT : Send A register to RS232 --- asminc/telestrat.inc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 8e6a66bbd..71240b38b 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -119,13 +119,13 @@ XTEXT = $19 XHIRES = $1A XFILLM = $1C XMINMA = $1F -XVARS = $24 ; only in TELEMON 3.0, in telemon 2.4, it's XNOMFI ($24) -XFREAD = $27 ; only in TELEMON 3.0 -XOPEN = $30 ; only in TELEMON 3.0 +XVARS = $24 ; only in TELEMON 3.x, in telemon 2.4, it's XNOMFI ($24) +XFREAD = $27 ; only in TELEMON 3.x +XOPEN = $30 ; only in TELEMON 3.x XCOSCR = $34 ; switch off cursor XCSSCR = $35 ; switch on cursor -XCLOSE = $3A ; only in TELEMON 3.0 Close file -XFWRITE = $3B ; only in TELEMON 3.0 write file +XCLOSE = $3A ; only in TELEMON 3.x Close file +XFWRITE = $3B ; only in TELEMON 3.x write file XSONPS = $40 XOUPS = $42 XPLAY = $43 @@ -133,6 +133,7 @@ XSOUND = $44 XMUSIC = $45 XZAP = $46 XSHOOT = $47 +XSOUT = $67 ; Send A register to RS232, available in telemon 2.4 & 3.x XCIRCL = $8F XCURSE = $90 XPAPER = $92 From 2ee7cf03779916eb27874f0c5f85fc3054883e48 Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 16 Oct 2017 16:11:37 +0200 Subject: [PATCH 009/254] I/O identifiers added --- asminc/telestrat.inc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 71240b38b..64d127625 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -1,7 +1,7 @@ ; ; Oric Telemon definition -; Telemon 2.4 & Telemon 3.0 -; For telemon 3.0 check http://orix.oric.org +; Telemon 2.4 & Telemon 3.x +; For telemon 3.x check http://orix.oric.org ; @@ -15,6 +15,15 @@ FUNCTKEY = $A5 FNAME_LEN = 11 ; maximum length of file-name +; --------------------------------------------------------------------------- +; I/O Identifier +; this identifers are used for channel management +; + +XKBD = $80 ; Keyboard +XRSE = $83 ; RS232 in +XSCR = $88 ; Screen +XRSS = $90 ; RS232 out ; --------------------------------------------------------------------------- @@ -34,10 +43,7 @@ TR5 := $11 TR6 := $12 TR7 := $13 - - - -PTR_READ_DEST := $2C ; used for XFREAD and XWRITE only in telemon 3.0 +PTR_READ_DEST := $2C ; used for XFREAD and XWRITE only in telemon 3.x HRSX := $46 HRSY := $47 From db1319de4c92865cafa0a0b65f6ea254a416c8bd Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 16 Oct 2017 17:28:00 +0200 Subject: [PATCH 010/254] clrscr.s switch to text mode --- libsrc/telestrat/clrscr.s | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libsrc/telestrat/clrscr.s b/libsrc/telestrat/clrscr.s index f2b8fafc1..31c8ee205 100644 --- a/libsrc/telestrat/clrscr.s +++ b/libsrc/telestrat/clrscr.s @@ -9,6 +9,9 @@ .include "telestrat.inc" .proc _clrscr + ; Switch to text mode + BRK_TELEMON(XTEXT) + lda #<SCREEN ldy #>SCREEN sta RES From 7107019d6fc340e7a52c1d74a848d38eca868e64 Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 16 Oct 2017 17:33:10 +0200 Subject: [PATCH 011/254] Adding IRQVec --- asminc/telestrat.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 64d127625..b52e8ae37 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -58,7 +58,7 @@ HRS5 := $55 ; --------------------------------------------------------------------------- ; Low memory - +IRQVec := $02fb ; "fast" interrupt vector From 7b742647202f32447bd6617f194b14a0bd29325f Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 16 Oct 2017 17:34:32 +0200 Subject: [PATCH 012/254] irq.s added --- libsrc/telestrat/irq.s | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 libsrc/telestrat/irq.s diff --git a/libsrc/telestrat/irq.s b/libsrc/telestrat/irq.s new file mode 100644 index 000000000..9027f263e --- /dev/null +++ b/libsrc/telestrat/irq.s @@ -0,0 +1,59 @@ +; +; IRQ handling (Oric version) +; + + .export initirq, doneirq + .import callirq + + .include "telestrat.inc" + +; ------------------------------------------------------------------------ + +.segment "ONCE" + +initirq: + lda IRQVec + ldx IRQVec+1 + sta IRQInd+1 + stx IRQInd+2 + lda #<IRQStub + ldx #>IRQStub + jmp setvec + +; ------------------------------------------------------------------------ + +.code + +doneirq: + lda IRQInd+1 + ldx IRQInd+2 +setvec: sei + sta IRQVec + stx IRQVec+1 + cli + rts + +; ------------------------------------------------------------------------ + +.segment "LOWCODE" + +IRQStub: + cld ; Just to be sure + pha + txa + pha + tya + pha + jsr callirq ; Call the functions + pla + tay + pla + tax + pla + jmp IRQInd ; Jump to the saved IRQ vector + +; ------------------------------------------------------------------------ + +.data + +IRQInd: jmp $0000 From 18c94e123fabd3863341b2ed7093128f59d1916a Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 16 Oct 2017 18:08:48 +0200 Subject: [PATCH 013/254] tgi_clear, tgi_init, tgi_done, tgi_getmaxx, tgi_getmaxy are working --- libsrc/telestrat/libref.s | 8 + libsrc/telestrat/tgi/telestrat-228-200-3.s | 320 +++++++++++++++++++++ libsrc/telestrat/tgi/telestrat-240-200-2.s | 315 ++++++++++++++++++++ libsrc/telestrat/tgi_colors.s | 8 + libsrc/telestrat/tgi_stat_stddrv.s | 14 + 5 files changed, 665 insertions(+) create mode 100644 libsrc/telestrat/libref.s create mode 100644 libsrc/telestrat/tgi/telestrat-228-200-3.s create mode 100644 libsrc/telestrat/tgi/telestrat-240-200-2.s create mode 100644 libsrc/telestrat/tgi_colors.s create mode 100644 libsrc/telestrat/tgi_stat_stddrv.s diff --git a/libsrc/telestrat/libref.s b/libsrc/telestrat/libref.s new file mode 100644 index 000000000..bdd0a671a --- /dev/null +++ b/libsrc/telestrat/libref.s @@ -0,0 +1,8 @@ +; +; Jede (jede@oric.org), 2017-10-16 +; + + .export tgi_libref + .import _exit + +tgi_libref := _exit diff --git a/libsrc/telestrat/tgi/telestrat-228-200-3.s b/libsrc/telestrat/tgi/telestrat-228-200-3.s new file mode 100644 index 000000000..1e6a6fb5a --- /dev/null +++ b/libsrc/telestrat/tgi/telestrat-228-200-3.s @@ -0,0 +1,320 @@ +; +; Graphics driver for the 228x200x3 palette mode on the Atmos +; +; Stefan Haubenthal <polluks@sdf.lonestar.org> +; 2014-09-10, Greg King <gregdk@users.sf.net> +; + + .include "zeropage.inc" + + .include "tgi-kernel.inc" + .include "tgi-error.inc" + .include "telestrat.inc" + + .macpack generic + .macpack module + +XSIZE = 6 ; System font width +YSIZE = 8 ; System font height + +; ------------------------------------------------------------------------ +; Header. Includes jump table and constants. + + module_header _telestrat_228_200_3_tgi + +; The first part of the header is a structure that has a signature, +; and defines the capabilities of the driver. + + .byte "tgi" + .byte TGI_API_VERSION ; TGI API version number + .addr $0000 ; Library reference + .word 228 ; x resolution + .word 200 ; y resolution + .byte 3 ; Number of drawing colors + .byte 1 ; Number of screens available + .byte XSIZE ; System font x size + .byte YSIZE ; System font y size + .word $011C ; Aspect ratio (based on 4/3 display) + .byte 0 ; TGI driver flags + +; Next comes the jump table. Currently, all entries must be valid; +; and, may point to an RTS, for test versions (function not implemented). + + .addr INSTALL + .addr UNINSTALL + .addr INIT + .addr DONE + .addr GETERROR + .addr CONTROL + .addr CLEAR + .addr SETVIEWPAGE + .addr SETDRAWPAGE + .addr SETCOLOR + .addr SETPALETTE + .addr GETPALETTE + .addr GETDEFPALETTE + .addr SETPIXEL + .addr GETPIXEL + .addr LINE + .addr BAR + .addr TEXTSTYLE + .addr OUTTEXT + .addr 0 ; IRQ entry is unused + +; ------------------------------------------------------------------------ +; Data. + +; Variables mapped to the zero-page segment variables. These are +; used for passing parameters to the driver. + +X1 := ptr1 +Y1 := ptr2 +X2 := ptr3 +Y2 := ptr4 + +; Absolute variables used in the code + +.bss + +ERROR: .res 1 ; Error code +MODE: .res 1 ; Graphics mode +PALETTE: .res 2 + +; Constant table + +.rodata + +; Default colors: black background, white foreground +; (The third "color" actually flips a pixel +; between the foreground and background colors.) +; +DEFPALETTE: .byte 0, 1 + +.code + +; ------------------------------------------------------------------------ +; INIT: Changes an already installed device from text mode to graphics mode. +; Note that INIT/DONE may be called multiple times while the driver +; is loaded, while INSTALL is called only once. So, any code that is needed +; to initialize variables and so on must go here. Setting palette and +; clearing the screen are not needed because they are called by the graphics +; kernel later. +; The graphics kernel never will call INIT when a graphics mode is already +; active, so there is no need to protect against that. +; +; Must set an error code: YES +; + +INIT: + +; Switch into graphics mode. + BRK_TELEMON(XHIRES) + rts + +; Done, reset the error code. + +; ------------------------------------------------------------------------ +; GETERROR: Return the error code in A, and clear it. + +GETERROR: + ldx #TGI_ERR_OK + lda ERROR + stx ERROR + rts +; ------------------------------------------------------------------------ +; INSTALL routine. Is called after the driver is loaded into memory. May +; initialize anything that has to be done just once. Is probably empty +; most of the time. +; +; Must set an error code: NO +; + +INSTALL: + +; ------------------------------------------------------------------------ +; UNINSTALL routine. Is called before the driver is removed from memory. May +; clean up anything done by INSTALL, but probably is empty most of the time. +; +; Must set an error code: NO +; + +UNINSTALL: + rts + +; ------------------------------------------------------------------------ +; DONE: Will be called to switch the graphics device back into text mode. +; The graphics kernel never will call DONE when no graphics mode is active, +; so there is no need to protect against that. +; +; Must set an error code: NO +; + +DONE: + BRK_TELEMON(XTEXT) + rts +; ------------------------------------------------------------------------ +; CONTROL: Platform-/driver-specific entry point. +; +; Must set an error code: YES +; + +CONTROL: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; CLEAR: Clears the screen. +; +; Must set an error code: NO +; + +CLEAR: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). +; The page number already is checked to be valid, by the graphics kernel. +; +; Must set an error code: NO (will be called only if page OK) +; + +SETVIEWPAGE: + +; ------------------------------------------------------------------------ +; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n). +; The page number already is checked to be valid, by the graphics kernel. +; +; Must set an error code: NO (will be called only if page OK) +; + +SETDRAWPAGE: + rts + +; ------------------------------------------------------------------------ +; SETCOLOR: Set the drawing color (in A). The new color already is checked +; to be in a valid range (0..maxcolor-1). +; +; Must set an error code: NO (will be called only if color OK) +; + +SETCOLOR: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; SETPALETTE: Set the palette (not available with all drivers/hardware). +; A pointer to the palette is passed in ptr1. Must set an error if palettes +; are not supported. +; +; Must set an error code: YES +; + +SETPALETTE: + ; not done yet + rts + +flipcolor: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; GETPALETTE: Return the current palette in A/X. Even drivers that cannot +; set the palette should return the default palette here, so there's no +; way for this function to fail. +; +; Must set an error code: NO +; + +GETPALETTE: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; GETDEFPALETTE: Return the default palette for the driver in A/X. All +; drivers should return something reasonable here, even drivers that don't +; support palettes; otherwise, the caller has no way to determine the colors +; of the (not changeable) palette. +; +; Must set an error code: NO (all drivers must have a default palette) +; + +GETDEFPALETTE: + lda #<DEFPALETTE + ldx #>DEFPALETTE + rts + +; ------------------------------------------------------------------------ +; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing +; color. The co-ordinates passed to this function are never outside the +; visible screen area, so there is no need for clipping inside this function. +; +; Must set an error code: NO +; + +SETPIXEL: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; GETPIXEL: Read the color value of a pixel, and return it in A/X. The +; co-ordinates passed to this function are never outside the visible screen +; area, so there is no need for clipping inside this function. + +GETPIXEL: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and +; X2/Y2 = ptr3/ptr4, using the current drawing color. +; +; Must set an error code: NO +; + +LINE: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where +; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4, using the current drawing color. +; Contrary to most other functions, the graphics kernel will sort and clip +; the co-ordinates before calling the driver; so, on entry, the following +; conditions are valid: +; X1 <= X2 +; Y1 <= Y2 +; (X1 >= 0) && (X1 < XRES) +; (X2 >= 0) && (X2 < XRES) +; (Y1 >= 0) && (Y1 < YRES) +; (Y2 >= 0) && (Y2 < YRES) +; +; Must set an error code: NO +; + +BAR: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in the x +; and y directions is passed in X/Y, the text direction is passed in A. +; +; Must set an error code: NO +; + +TEXTSTYLE: + rts + + +; ------------------------------------------------------------------------ +; OUTTEXT: Output text at x/y = ptr1/ptr2, using the current color and the +; current text style. The text to output is given as a zero-terminated +; string with its address in ptr3. +; +; Must set an error code: NO +; + +OUTTEXT: + ; not done yet + rts diff --git a/libsrc/telestrat/tgi/telestrat-240-200-2.s b/libsrc/telestrat/tgi/telestrat-240-200-2.s new file mode 100644 index 000000000..0424fb6f7 --- /dev/null +++ b/libsrc/telestrat/tgi/telestrat-240-200-2.s @@ -0,0 +1,315 @@ +; +; Graphics driver for the 240x200x2 monochrome mode on the Atmos +; +; Stefan Haubenthal <polluks@sdf.lonestar.org> +; 2014-09-10, Greg King <gregdk@users.sf.net> +; + + .include "zeropage.inc" + + .include "tgi-kernel.inc" + .include "tgi-error.inc" + .include "telestrat.inc" + + .macpack generic + .macpack module + +XSIZE = 6 ; System font width +YSIZE = 8 ; System font height + +; ------------------------------------------------------------------------ +; Header. Includes jump table and constants. + + module_header _telestrat_240_200_2_tgi + +; First part of the header is a structure that has a magic and defines the +; capabilities of the driver + + .byte $74, $67, $69 ; "tgi" + .byte TGI_API_VERSION ; TGI API version number + .addr $0000 ; Library reference + .word 240 ; X resolution + .word 200 ; Y resolution + .byte 2 ; Number of drawing colors + .byte 1 ; Number of screens available + .byte XSIZE ; System font X size + .byte YSIZE ; System font Y size + .word $011C ; Aspect ratio (based on 4/3 display) + .byte 0 ; TGI driver flags + +; Next comes the jump table. Currently all entries must be valid and may point +; to an RTS for test versions (function not implemented). + + .addr INSTALL + .addr UNINSTALL + .addr INIT + .addr DONE + .addr GETERROR + .addr CONTROL + .addr CLEAR + .addr SETVIEWPAGE + .addr SETDRAWPAGE + .addr SETCOLOR + .addr SETPALETTE + .addr GETPALETTE + .addr GETDEFPALETTE + .addr SETPIXEL + .addr GETPIXEL + .addr LINE + .addr BAR + .addr TEXTSTYLE + .addr OUTTEXT + .addr 0 ; IRQ entry is unused + +; ------------------------------------------------------------------------ +; Data. + +; Variables mapped to the zero page segment variables. Some of these are +; used for passing parameters to the driver. + +X1 := ptr1 +Y1 := ptr2 +X2 := ptr3 +Y2 := ptr4 + +; Absolute variables used in the code + +.bss + +ERROR: .res 1 ; Error code +MODE: .res 1 ; Graphics mode + +; Constant table + +.rodata + +DEFPALETTE: .byte 0, 1 + +.code + +; ------------------------------------------------------------------------ +; INSTALL routine. Is called after the driver is loaded into memory. May +; initialize anything that has to be done just once. Is probably empty +; most of the time. +; +; Must set an error code: NO +; + +INSTALL: + +; ------------------------------------------------------------------------ +; UNINSTALL routine. Is called before the driver is removed from memory. May +; clean up anything done by INSTALL but is probably empty most of the time. +; +; Must set an error code: NO +; + +UNINSTALL: + rts + +; ------------------------------------------------------------------------ +; INIT: Changes an already installed device from text mode to graphics +; mode. +; Note that INIT/DONE may be called multiple times while the driver +; is loaded, while INSTALL is only called once, so any code that is needed +; to initializes variables and so on must go here. Setting palette and +; clearing the screen is not needed because this is called by the graphics +; kernel later. +; The graphics kernel will never call INIT when a graphics mode is already +; active, so there is no need to protect against that. +; +; Must set an error code: YES +; + +INIT: + +; Switch into graphics mode + + BRK_TELEMON(XHIRES) + rts +; Done, reset the error code + + lda #TGI_ERR_OK + sta ERROR + rts + +; ------------------------------------------------------------------------ +; DONE: Will be called to switch the graphics device back into text mode. +; The graphics kernel will never call DONE when no graphics mode is active, +; so there is no need to protect against that. +; +; Must set an error code: NO +; + +DONE: + BRK_TELEMON(XTEXT) + rts + +; ------------------------------------------------------------------------ +; GETERROR: Return the error code in A and clear it. + +GETERROR: + ldx #TGI_ERR_OK + lda ERROR + stx ERROR + rts + +; ------------------------------------------------------------------------ +; CONTROL: Platform/driver specific entry point. +; +; Must set an error code: YES +; + +CONTROL: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; CLEAR: Clears the screen. +; +; Must set an error code: NO +; + +CLEAR: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). +; The page number is already checked to be valid by the graphics kernel. +; +; Must set an error code: NO (will only be called if page ok) +; + +SETVIEWPAGE: + +; ------------------------------------------------------------------------ +; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n). +; The page number is already checked to be valid by the graphics kernel. +; +; Must set an error code: NO (will only be called if page ok) +; + +SETDRAWPAGE: + rts + +; ------------------------------------------------------------------------ +; SETCOLOR: Set the drawing color (in A). The new color is already checked +; to be in a valid range (0..maxcolor-1). +; +; Must set an error code: NO (will only be called if color ok) +; + +SETCOLOR: + ;not done yet + rts + +; ------------------------------------------------------------------------ +; SETPALETTE: Set the palette (not available with all drivers/hardware). +; A pointer to the palette is passed in ptr1. Must set an error if palettes +; are not supported +; +; Must set an error code: YES +; + +SETPALETTE: + lda #TGI_ERR_INV_FUNC ; This resolution has no palette + sta ERROR + rts + +; ------------------------------------------------------------------------ +; GETPALETTE: Return the current palette in A/X. Even drivers that cannot +; set the palette should return the default palette here, so there's no +; way for this function to fail. +; +; Must set an error code: NO +; + +GETPALETTE: + +; ------------------------------------------------------------------------ +; GETDEFPALETTE: Return the default palette for the driver in A/X. All +; drivers should return something reasonable here, even drivers that don't +; support palettes, otherwise the caller has no way to determine the colors +; of the (not changeable) palette. +; +; Must set an error code: NO (all drivers must have a default palette) +; + +GETDEFPALETTE: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing +; color. The coordinates passed to this function are never outside the +; visible screen area, so there is no need for clipping inside this function. +; +; Must set an error code: NO +; + +SETPIXEL: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; GETPIXEL: Read the color value of a pixel and return it in A/X. The +; coordinates passed to this function are never outside the visible screen +; area, so there is no need for clipping inside this function. + +GETPIXEL: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and +; X2/Y2 = ptr3/ptr4 using the current drawing color. +; +; Must set an error code: NO +; + +LINE: + ; not done yet + rts +; ------------------------------------------------------------------------ +; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where +; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4 using the current drawing color. +; Contrary to most other functions, the graphics kernel will sort and clip +; the coordinates before calling the driver, so on entry the following +; conditions are valid: +; X1 <= X2 +; Y1 <= Y2 +; (X1 >= 0) && (X1 < XRES) +; (X2 >= 0) && (X2 < XRES) +; (Y1 >= 0) && (Y1 < YRES) +; (Y2 >= 0) && (Y2 < YRES) +; +; Must set an error code: NO +; + +BAR: + ; not done yet + rts + +; ------------------------------------------------------------------------ +; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y +; direction is passend in X/Y, the text direction is passed in A. +; +; Must set an error code: NO +; + +TEXTSTYLE: + rts + + +; ------------------------------------------------------------------------ +; OUTTEXT: Output text at X/Y = ptr1/ptr2 using the current color and the +; current text style. The text to output is given as a zero terminated +; string with address in ptr3. +; +; Must set an error code: NO +; + +OUTTEXT: + ; Not done yet + rts diff --git a/libsrc/telestrat/tgi_colors.s b/libsrc/telestrat/tgi_colors.s new file mode 100644 index 000000000..6ef3729b4 --- /dev/null +++ b/libsrc/telestrat/tgi_colors.s @@ -0,0 +1,8 @@ +; +; Target-specific black & white values for use by the target-shared TGI kernel +; + + .include "tgi-kernel.inc" + + .export tgi_color_black:zp = $00 + .export tgi_color_white:zp = $01 diff --git a/libsrc/telestrat/tgi_stat_stddrv.s b/libsrc/telestrat/tgi_stat_stddrv.s new file mode 100644 index 000000000..2b0d96761 --- /dev/null +++ b/libsrc/telestrat/tgi_stat_stddrv.s @@ -0,0 +1,14 @@ +; +; Address of the static standard tgi driver +; +; Jede (jede@oric.org), 2017-10-15 +; +; const void tgi_static_stddrv[]; +; + + .export _tgi_static_stddrv + .import _telestrat_240_200_2_tgi + +.rodata + +_tgi_static_stddrv := _telestrat_240_200_2_tgi From 195b5f0a07e4efaf4675437aca0426be8006c69f Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 16 Oct 2017 18:15:53 +0200 Subject: [PATCH 014/254] Optimizing (from Polluks tip) --- libsrc/telestrat/cgetc.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsrc/telestrat/cgetc.s b/libsrc/telestrat/cgetc.s index 2b0fc7758..6a6b23318 100644 --- a/libsrc/telestrat/cgetc.s +++ b/libsrc/telestrat/cgetc.s @@ -10,7 +10,7 @@ .proc _cgetc ; this routine could be quicker if we wrote in page 2 variables, ; but it's better to use telemon routine in that case, because telemon can manage 4 I/O - lda cursor ; if cursor equal to 0, then switch off cursor + ldx cursor ; if cursor equal to 0, then switch off cursor beq switchoff_cursor ldx #$00 ; x is the first screen @@ -18,7 +18,7 @@ jmp loop ; could be replaced by a bne/beq but 'jmp' is cleaner than a bne/beq which could expect some matters switchoff_cursor: - ldx #$00 ; x is the first screen + ; at this step X is equal to $00, X must be set, because it's the id of the screen (telestrat can handle 4 virtuals screen) BRK_TELEMON(XCOSCR) ; switch off cursor loop: From f964fdbe56bd9f92a2c714df6e4351861993cc2f Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 16 Oct 2017 18:18:36 +0200 Subject: [PATCH 015/254] Correction : authors --- libsrc/telestrat/tgi/telestrat-228-200-3.s | 6 ++---- libsrc/telestrat/tgi/telestrat-240-200-2.s | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/libsrc/telestrat/tgi/telestrat-228-200-3.s b/libsrc/telestrat/tgi/telestrat-228-200-3.s index 1e6a6fb5a..1e42f2ede 100644 --- a/libsrc/telestrat/tgi/telestrat-228-200-3.s +++ b/libsrc/telestrat/tgi/telestrat-228-200-3.s @@ -1,9 +1,7 @@ ; -; Graphics driver for the 228x200x3 palette mode on the Atmos -; -; Stefan Haubenthal <polluks@sdf.lonestar.org> -; 2014-09-10, Greg King <gregdk@users.sf.net> +; Graphics driver for the 228x200x3 palette mode on the Telestrat ; +; Jede (jede@oric.org), 2017-10-15 .include "zeropage.inc" diff --git a/libsrc/telestrat/tgi/telestrat-240-200-2.s b/libsrc/telestrat/tgi/telestrat-240-200-2.s index 0424fb6f7..3dc90525a 100644 --- a/libsrc/telestrat/tgi/telestrat-240-200-2.s +++ b/libsrc/telestrat/tgi/telestrat-240-200-2.s @@ -1,9 +1,8 @@ ; ; Graphics driver for the 240x200x2 monochrome mode on the Atmos ; -; Stefan Haubenthal <polluks@sdf.lonestar.org> -; 2014-09-10, Greg King <gregdk@users.sf.net> -; +; Jede (jede@oric.org), 2017-10-15 + .include "zeropage.inc" From 351a5ab20a658c46b14f4c14e91aae263308da4e Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Fri, 20 Oct 2017 21:03:30 +0200 Subject: [PATCH 016/254] Now setPixel works in TGI. --- asminc/telestrat.inc | 48 ++++++++++++++- include/telestrat.h | 70 ++++++++++++++++++++++ libsrc/telestrat/tgi/telestrat-228-200-3.s | 24 +++++++- libsrc/telestrat/tgi/telestrat-240-200-2.s | 23 +++++-- 4 files changed, 155 insertions(+), 10 deletions(-) diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index b52e8ae37..7b6e52283 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -54,11 +54,43 @@ HRS3 := $51 HRS4 := $53 HRS5 := $55 +HRSFB := $57 +; RS232T +; b0-b3 : speed +; 1111 => 19200 bps (please note that telestrat can't handle this speed with stopping all IRQ except ACIA's one) +; 1100 => 9600 bps (default from telemon) +; 1110 => 4800 bps +; 1010 => 2400 bps +; 1000 => 1200 bps +; 0111 => 600 bps +; 0110 => 300 bps +; 0101 => 150 bps +; 0010 => 75 bps + +; b4 : 0 external clock, 1 internal clock +; b6-b5 : 00 8 bits +; 01 7 bits +; 10 6 bits +; 11 5 bits +; b7 : 0 a stop + +RS232T := $59 + +; RS232C +; b0-b3 : 0 +; b4 : 1 if echo +; b5 : 1 if parity +; b7-b6 : 00 in/out parity odd +; : 01 on/out parity even +; : 10 parity sent, answer not tested +; : 11 SPACE SENT, reception not tested + +RS232C := $5A ; --------------------------------------------------------------------------- ; Low memory -IRQVec := $02fb ; "fast" interrupt vector +IRQVec := $02FB ; "fast" interrupt vector @@ -84,7 +116,7 @@ PRA2 .byte ; Port Register A without handshaking .endstruct -.struct VIA2 ; Versatile Interface Adapter +.struct VIA2 ; Versatile Interface Adapter .res $0320 PRB .byte ; Port Register B PRA .byte ; Port Register A @@ -116,7 +148,7 @@ SCREEN := $BB80 ; --------------------------------------------------------------------------- ; ROM entries -; primitives telemon 2.4 +; telemon primitives (2.4 & 3.x) XRD0 = $08 XRDW0 = $0C XWR0 = $10 @@ -140,10 +172,19 @@ XMUSIC = $45 XZAP = $46 XSHOOT = $47 XSOUT = $67 ; Send A register to RS232, available in telemon 2.4 & 3.x +XHRSSE = $8C ; Put in X and Y +XDRAWA = $8D ; Draw a line +XDRAWR = $8E ; Draw a line XCIRCL = $8F XCURSE = $90 +XCURMO = $91 XPAPER = $92 XINK = $93 +XBOX = $94 +XABOX = $95 +XFILL = $96 +XCHAR = $97 +XSCHAR = $98 ; Draw a string XEXPLO = $9C XPING = $9D @@ -158,6 +199,7 @@ SCRX := $220 SCRY := $224 ADSCRL := $218 ADSCRH := $21C +HRSPAT := $2AA ; Hires pattern : it's used to draw pattern for a line or a circle IRQVECTOR := $2FA diff --git a/include/telestrat.h b/include/telestrat.h index 5a090647b..1865f19a0 100644 --- a/include/telestrat.h +++ b/include/telestrat.h @@ -30,6 +30,76 @@ + +/* Color defines */ +#define COLOR_BLACK 0x00 +#define COLOR_RED 0x01 +#define COLOR_GREEN 0x02 +#define COLOR_YELLOW 0x03 +#define COLOR_BLUE 0x04 +#define COLOR_MAGENTA 0x05 +#define COLOR_CYAN 0x06 +#define COLOR_WHITE 0x07 + +/* TGI color defines */ +/* White and red are swapped, so that the pallete +** driver is compatible with black-and-white drivers. +*/ +#define TGI_COLOR_BLACK COLOR_BLACK +#define TGI_COLOR_WHITE 1 +#define TGI_COLOR_GREEN COLOR_GREEN +#define TGI_COLOR_YELLOW COLOR_YELLOW +#define TGI_COLOR_BLUE COLOR_BLUE +#define TGI_COLOR_MAGENTA COLOR_MAGENTA +#define TGI_COLOR_CYAN COLOR_CYAN +#define TGI_COLOR_RED 7 + + +extern void telestrat_228_200_3_tgi[]; +extern void telestrat_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[] */ + +/* Define hardware */ +#include <_6522.h> +#define VIA (*(struct __6522*)0x300) + + + +/* These are defined to be FUNCT + NumberKey */ +#define CH_F1 0xB1 +#define CH_F2 0xB2 +#define CH_F3 0xB3 +#define CH_F4 0xB4 +#define CH_F5 0xB5 +#define CH_F6 0xB6 +#define CH_F7 0xB7 +#define CH_F8 0xB8 +#define CH_F9 0xB9 +#define CH_F10 0xB0 + + + +/* Character codes */ +#define CH_ULCORNER '+' +#define CH_URCORNER '+' +#define CH_LLCORNER '+' +#define CH_LRCORNER '+' +#define CH_TTEE '+' +#define CH_BTEE '+' +#define CH_LTEE '+' +#define CH_RTEE '+' +#define CH_CROSS '+' +#define CH_CURS_UP 11 +#define CH_CURS_DOWN 10 +#define CH_CURS_LEFT 8 +#define CH_CURS_RIGHT 9 +#define CH_DEL 127 +#define CH_ENTER 13 +#define CH_STOP 3 +#define CH_LIRA 95 +#define CH_ESC 27 + + + void oups(); void ping(); void zap(); diff --git a/libsrc/telestrat/tgi/telestrat-228-200-3.s b/libsrc/telestrat/tgi/telestrat-228-200-3.s index 1e42f2ede..e20c2c877 100644 --- a/libsrc/telestrat/tgi/telestrat-228-200-3.s +++ b/libsrc/telestrat/tgi/telestrat-228-200-3.s @@ -55,6 +55,7 @@ YSIZE = 8 ; System font height .addr GETPIXEL .addr LINE .addr BAR + .addr CIRCLE .addr TEXTSTYLE .addr OUTTEXT .addr 0 ; IRQ entry is unused @@ -107,10 +108,13 @@ INIT: ; Switch into graphics mode. BRK_TELEMON(XHIRES) - rts - + ; Done, reset the error code. + lda #TGI_ERR_OK + sta ERROR + rts + ; ------------------------------------------------------------------------ ; GETERROR: Return the error code in A, and clear it. @@ -251,7 +255,17 @@ GETDEFPALETTE: ; SETPIXEL: - ; not done yet + + lda X1 + sta HRS1 + lda Y1 + sta HRS2 + + lda #$80 + sta HRSFB + + BRK_TELEMON(XCURSE) + rts ; ------------------------------------------------------------------------ @@ -274,6 +288,10 @@ LINE: ; not done yet rts +CIRCLE: + ; not done yet + rts + ; ------------------------------------------------------------------------ ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where ; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4, using the current drawing color. diff --git a/libsrc/telestrat/tgi/telestrat-240-200-2.s b/libsrc/telestrat/tgi/telestrat-240-200-2.s index 3dc90525a..fcc1ce3f2 100644 --- a/libsrc/telestrat/tgi/telestrat-240-200-2.s +++ b/libsrc/telestrat/tgi/telestrat-240-200-2.s @@ -125,7 +125,7 @@ INIT: ; Switch into graphics mode BRK_TELEMON(XHIRES) - rts + ; Done, reset the error code lda #TGI_ERR_OK @@ -248,7 +248,17 @@ GETDEFPALETTE: ; SETPIXEL: - ; not done yet + + lda X1 + sta HRS1 + lda Y1 + sta HRS2 + + lda #$80 ; curset on + sta HRSFB + + BRK_TELEMON(XCURSE) + rts ; ------------------------------------------------------------------------ @@ -268,8 +278,13 @@ GETPIXEL: ; LINE: - ; not done yet - rts + ; not done yet + rts + +CIRCLE: + ; not done yet + rts + ; ------------------------------------------------------------------------ ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where ; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4 using the current drawing color. From 2b7d4fff5a69599d29281cfaf1b350fb9c342c06 Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Fri, 20 Oct 2017 21:29:16 +0200 Subject: [PATCH 017/254] comment correction --- asminc/telestrat.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 7b6e52283..424047725 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -58,7 +58,7 @@ HRSFB := $57 ; RS232T ; b0-b3 : speed -; 1111 => 19200 bps (please note that telestrat can't handle this speed with stopping all IRQ except ACIA's one) +; 1111 => 19200 bps (please note that telestrat can't handle this speed without stopping all IRQ except ACIA's one) ; 1100 => 9600 bps (default from telemon) ; 1110 => 4800 bps ; 1010 => 2400 bps From 93f202850ab2350da3e32a6a790248ca618c9a08 Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Sun, 22 Oct 2017 23:06:56 +0200 Subject: [PATCH 018/254] toascii.s added, doc updated, tgi_line & tgi_outtext are available --- asminc/telestrat.inc | 8 ++-- doc/telestrat.sgml | 19 ++++++++- libsrc/telestrat/tgi/telestrat-228-200-3.s | 40 +++++++++++++++++- libsrc/telestrat/tgi/telestrat-240-200-2.s | 49 +++++++++++++++++++--- libsrc/telestrat/toascii.s | 14 +++++++ 5 files changed, 117 insertions(+), 13 deletions(-) create mode 100644 libsrc/telestrat/toascii.s diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 424047725..352aa0657 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -152,7 +152,7 @@ SCREEN := $BB80 XRD0 = $08 XRDW0 = $0C XWR0 = $10 -XWSTR0 = $14 +XWSTR0 = $14 ; write a string in text mode XTEXT = $19 XHIRES = $1A XFILLM = $1C @@ -165,14 +165,14 @@ XCSSCR = $35 ; switch on cursor XCLOSE = $3A ; only in TELEMON 3.x Close file XFWRITE = $3B ; only in TELEMON 3.x write file XSONPS = $40 -XOUPS = $42 +XOUPS = $42 ; sends Oups sound into PSG XPLAY = $43 XSOUND = $44 XMUSIC = $45 XZAP = $46 XSHOOT = $47 XSOUT = $67 ; Send A register to RS232, available in telemon 2.4 & 3.x -XHRSSE = $8C ; Put in X and Y +XHRSSE = $8C ; Set hires position cursor XDRAWA = $8D ; Draw a line XDRAWR = $8E ; Draw a line XCIRCL = $8F @@ -184,7 +184,7 @@ XBOX = $94 XABOX = $95 XFILL = $96 XCHAR = $97 -XSCHAR = $98 ; Draw a string +XSCHAR = $98 ; Draw a string in hires XEXPLO = $9C XPING = $9D diff --git a/doc/telestrat.sgml b/doc/telestrat.sgml index fda4dee86..0c85c68c5 100644 --- a/doc/telestrat.sgml +++ b/doc/telestrat.sgml @@ -9,7 +9,7 @@ <date>2017-01-22 <abstract> -An overview over the Telestrat (Telemon 3.0 : http://orix.oric.org) runtime system as it is implemented for the cc65 C +An overview over the Telestrat (Telemon 2.4 & Telemon 3.x : http://orix.oric.org) runtime system as it is implemented for the cc65 C compiler.) </abstract> @@ -113,6 +113,21 @@ structures; accessing the struct fields will access the chip registers. <sect>Loadable drivers<p> +<sect1>TGI<p> + +TGI drivers is available on Oric Telestrat with some functions : + +<itemize> +<item> +<item>tgi_install +<item>tgi_init +<item>tgi_clear +<item>tgi_setpixel +<item>tgi_getmaxx +<item>tgi_getmaxy +</itemize> + + <sect1>Extended memory drivers<p> No extended memory drivers are currently available for the Telestrat. @@ -139,7 +154,7 @@ Telestrat manages also mouse, but it had been no handled yet in this version. <descrip> -Telestrat has a RS232 port, but it's not used +Telestrat has a RS232 port, but it's not usable in cc65. </descrip> diff --git a/libsrc/telestrat/tgi/telestrat-228-200-3.s b/libsrc/telestrat/tgi/telestrat-228-200-3.s index e20c2c877..a4313b092 100644 --- a/libsrc/telestrat/tgi/telestrat-228-200-3.s +++ b/libsrc/telestrat/tgi/telestrat-228-200-3.s @@ -286,9 +286,27 @@ GETPIXEL: LINE: ; not done yet + lda X1 + sta HRS1 + lda Y1 + sta HRS2 + + lda X2 + sta HRS3 + lda Y2 + sta HRS4 + + lda #$ff + sta HRSPAT + + BRK_TELEMON(XDRAWA) + rts + + CIRCLE: + ; not done yet rts @@ -332,5 +350,25 @@ TEXTSTYLE: ; OUTTEXT: - ; not done yet + ; put hires cursor in X & Y + lda #$00 + jsr SETPIXELSETMODE + + + ; count the length of the string + ldy #$00 +loop: + lda (ptr3),y + beq out + iny + bne loop +out: + ; XSCHAR routine from telemon needs to have the length of the string in X register + ; copy Y register to X register. It could be optimized in 65C02 with TYX + tya + tax + + lda ptr3 ; XSCHAR needs in A and Y the adress of the string + ldy ptr3+1 + BRK_TELEMON(XSCHAR) rts diff --git a/libsrc/telestrat/tgi/telestrat-240-200-2.s b/libsrc/telestrat/tgi/telestrat-240-200-2.s index fcc1ce3f2..8a30ddd45 100644 --- a/libsrc/telestrat/tgi/telestrat-240-200-2.s +++ b/libsrc/telestrat/tgi/telestrat-240-200-2.s @@ -125,7 +125,7 @@ INIT: ; Switch into graphics mode BRK_TELEMON(XHIRES) - + ; Done, reset the error code lda #TGI_ERR_OK @@ -248,14 +248,16 @@ GETDEFPALETTE: ; SETPIXEL: + lda #$80 ; curset on +SETPIXELSETMODE: + sta HRSFB lda X1 sta HRS1 lda Y1 sta HRS2 - lda #$80 ; curset on - sta HRSFB + BRK_TELEMON(XCURSE) @@ -278,9 +280,24 @@ GETPIXEL: ; LINE: - ; not done yet - rts + lda X1 + sta HRS1 + lda Y1 + sta HRS2 + + lda X2 + sta HRS3 + lda Y2 + sta HRS4 + + lda #$ff + sta HRSPAT + + BRK_TELEMON(XDRAWA) + + rts + CIRCLE: ; not done yet rts @@ -325,5 +342,25 @@ TEXTSTYLE: ; OUTTEXT: - ; Not done yet + ; put hires cursor in X & Y + lda #$00 + jsr SETPIXELSETMODE + + + ; count the length of the string + ldy #$00 +loop: + lda (ptr3),y + beq out + iny + bne loop +out: + ; XSCHAR routine from telemon needs to have the length of the string in X register + ; copy Y register to X register. It could be optimized in 65C02 with TYX + tya + tax + + lda ptr3 ; XSCHAR needs in A and Y the adress of the string + ldy ptr3+1 + BRK_TELEMON(XSCHAR) rts diff --git a/libsrc/telestrat/toascii.s b/libsrc/telestrat/toascii.s new file mode 100644 index 000000000..77f050021 --- /dev/null +++ b/libsrc/telestrat/toascii.s @@ -0,0 +1,14 @@ +; +; char __fastcall__ toascii (char c); +; /* Convert a target-specific character to ASCII. */ +; + +.export _toascii + +.proc _toascii + +; .X must be zero, on return. + ldx #>$0000 + rts + +.endproc From 0517a2c2ab75de45e3a3d80894edf2dff1f8e935 Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Sun, 22 Oct 2017 23:12:12 +0200 Subject: [PATCH 019/254] removing extra spaces --- libsrc/telestrat/tgi/telestrat-228-200-3.s | 2 -- 1 file changed, 2 deletions(-) diff --git a/libsrc/telestrat/tgi/telestrat-228-200-3.s b/libsrc/telestrat/tgi/telestrat-228-200-3.s index a4313b092..1ce4fc927 100644 --- a/libsrc/telestrat/tgi/telestrat-228-200-3.s +++ b/libsrc/telestrat/tgi/telestrat-228-200-3.s @@ -300,13 +300,11 @@ LINE: sta HRSPAT BRK_TELEMON(XDRAWA) - rts CIRCLE: - ; not done yet rts From c8d6ca908db019dfeacb924cfe44ffff73c823dc Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Mon, 23 Oct 2017 18:22:51 +0200 Subject: [PATCH 020/254] Minor style fix. --- src/cc65/expr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index acfd95fed..dfd5366bb 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -537,7 +537,7 @@ static void FunctionCall (ExprDesc* Expr) if (IsFuncPtr) { if (Func->WrappedCall) { - Warning("Calling a wrapped function via a pointer, wrapped-call will not be used"); + Warning ("Calling a wrapped function via a pointer, wrapped-call will not be used"); } /* If the function is not a fastcall function, load the pointer to From bd9b4ef60c9de6c4b2f0bad2a50d624daf066536 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Mon, 23 Oct 2017 18:35:06 +0200 Subject: [PATCH 021/254] Replaced three (logically) identical files with a single file. --- libsrc/atmos/toascii.s | 14 -------------- libsrc/{apple2 => common}/toascii.s | 2 +- libsrc/lynx/toascii.s | 16 ---------------- 3 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 libsrc/atmos/toascii.s rename libsrc/{apple2 => common}/toascii.s (87%) delete mode 100644 libsrc/lynx/toascii.s diff --git a/libsrc/atmos/toascii.s b/libsrc/atmos/toascii.s deleted file mode 100644 index 77f050021..000000000 --- a/libsrc/atmos/toascii.s +++ /dev/null @@ -1,14 +0,0 @@ -; -; char __fastcall__ toascii (char c); -; /* Convert a target-specific character to ASCII. */ -; - -.export _toascii - -.proc _toascii - -; .X must be zero, on return. - ldx #>$0000 - rts - -.endproc diff --git a/libsrc/apple2/toascii.s b/libsrc/common/toascii.s similarity index 87% rename from libsrc/apple2/toascii.s rename to libsrc/common/toascii.s index a3f946e64..5b1943aca 100644 --- a/libsrc/apple2/toascii.s +++ b/libsrc/common/toascii.s @@ -6,5 +6,5 @@ .export _toascii _toascii: - ldx #$00 + ldx #>$0000 rts diff --git a/libsrc/lynx/toascii.s b/libsrc/lynx/toascii.s deleted file mode 100644 index 2a2088688..000000000 --- a/libsrc/lynx/toascii.s +++ /dev/null @@ -1,16 +0,0 @@ -; -; unsigned char __fastcall__ toascii (unsigned char c); -; /* Convert a target specific character to ascii */ -; - -.export _toascii - -.proc _toascii - -; X must be zero on return - ldx #0 - -; Done! - rts - -.endproc From c0ce20e9ccb3eb0dfd57d7be8db7b00dafde7471 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Mon, 23 Oct 2017 18:57:28 +0200 Subject: [PATCH 022/254] Save/restore jmpvec as it is used by generated code - see g_callind(). --- libsrc/common/interrupt.s | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/libsrc/common/interrupt.s b/libsrc/common/interrupt.s index 950d3d787..6bdbb5fe4 100644 --- a/libsrc/common/interrupt.s +++ b/libsrc/common/interrupt.s @@ -8,7 +8,7 @@ .export _set_irq, _reset_irq .interruptor clevel_irq, 1 ; Export as low priority IRQ handler - .import popax, __ZP_START__ + .import popax, __ZP_START__, jmpvec .include "zeropage.inc" @@ -84,6 +84,12 @@ zpsave: .res zpsavespace dex bpl @L2 + ; Save jmpvec + lda jmpvec+1 + pha + lda jmpvec+2 + pha + ; Set C level interrupt stack lda irqsp ldx irqsp+1 @@ -93,15 +99,21 @@ zpsave: .res zpsavespace ; Call C level interrupt request handler jsr irqvec - ; Copy back our zero page content + ; Mark interrupt handled / not handled + lsr + + ; Restore our zero page content ldx #.sizeof(::zpsave)-1 -@L3: ldy zpsave,x - sty <__ZP_START__,x +@L3: lda zpsave,x + sta <__ZP_START__,x dex bpl @L3 - ; Mark interrupt handled / not handled and return - lsr + ; Restore jmpvec and return + pla + sta jmpvec+2 + pla + sta jmpvec+1 rts .endproc From 1403d797f0bd1818cbafb8f5311e745762098f5e Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 23 Oct 2017 20:52:22 +0200 Subject: [PATCH 023/254] Remove toascii.s --- libsrc/telestrat/toascii.s | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 libsrc/telestrat/toascii.s diff --git a/libsrc/telestrat/toascii.s b/libsrc/telestrat/toascii.s deleted file mode 100644 index 77f050021..000000000 --- a/libsrc/telestrat/toascii.s +++ /dev/null @@ -1,14 +0,0 @@ -; -; char __fastcall__ toascii (char c); -; /* Convert a target-specific character to ASCII. */ -; - -.export _toascii - -.proc _toascii - -; .X must be zero, on return. - ldx #>$0000 - rts - -.endproc From ed4458c1621d340b948acd08e431f3fb066b1a7c Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 23 Oct 2017 23:00:43 +0200 Subject: [PATCH 024/254] Comment correction --- asminc/telestrat.inc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 352aa0657..9b2202110 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -20,9 +20,9 @@ FNAME_LEN = 11 ; maximum length of file-name ; this identifers are used for channel management ; -XKBD = $80 ; Keyboard +XKBD = $80 ; keyboard XRSE = $83 ; RS232 in -XSCR = $88 ; Screen +XSCR = $88 ; screen XRSS = $90 ; RS232 out @@ -165,16 +165,16 @@ XCSSCR = $35 ; switch on cursor XCLOSE = $3A ; only in TELEMON 3.x Close file XFWRITE = $3B ; only in TELEMON 3.x write file XSONPS = $40 -XOUPS = $42 ; sends Oups sound into PSG +XOUPS = $42 ; send Oups sound into PSG XPLAY = $43 XSOUND = $44 XMUSIC = $45 XZAP = $46 XSHOOT = $47 -XSOUT = $67 ; Send A register to RS232, available in telemon 2.4 & 3.x -XHRSSE = $8C ; Set hires position cursor -XDRAWA = $8D ; Draw a line -XDRAWR = $8E ; Draw a line +XSOUT = $67 ; send A register to RS232, available in telemon 2.4 & 3.x +XHRSSE = $8C ; set hires position cursor +XDRAWA = $8D ; draw a line +XDRAWR = $8E ; draw a line XCIRCL = $8F XCURSE = $90 XCURMO = $91 @@ -184,7 +184,7 @@ XBOX = $94 XABOX = $95 XFILL = $96 XCHAR = $97 -XSCHAR = $98 ; Draw a string in hires +XSCHAR = $98 ; draw a string in hires XEXPLO = $9C XPING = $9D @@ -199,7 +199,7 @@ SCRX := $220 SCRY := $224 ADSCRL := $218 ADSCRH := $21C -HRSPAT := $2AA ; Hires pattern : it's used to draw pattern for a line or a circle +HRSPAT := $2AA ; hires pattern : it's used to draw pattern for a line or a circle IRQVECTOR := $2FA From ebfd218f62e94b91f80f8e9effef1e658926163a Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 23 Oct 2017 23:02:54 +0200 Subject: [PATCH 025/254] Comment correction --- asminc/telestrat.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 9b2202110..737c4b6ae 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -17,7 +17,7 @@ FNAME_LEN = 11 ; maximum length of file-name ; --------------------------------------------------------------------------- ; I/O Identifier -; this identifers are used for channel management +; theses identifers are used for channel management ; XKBD = $80 ; keyboard From 3bc0843afc7ed291ca3c8278631d159f9387013c Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 23 Oct 2017 23:25:08 +0200 Subject: [PATCH 026/254] FIX label for setpixelmode --- libsrc/telestrat/tgi/telestrat-228-200-3.s | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libsrc/telestrat/tgi/telestrat-228-200-3.s b/libsrc/telestrat/tgi/telestrat-228-200-3.s index 1ce4fc927..09c308e26 100644 --- a/libsrc/telestrat/tgi/telestrat-228-200-3.s +++ b/libsrc/telestrat/tgi/telestrat-228-200-3.s @@ -255,14 +255,16 @@ GETDEFPALETTE: ; SETPIXEL: + lda #$80 +SETPIXELSETMODE: + sta HRSFB lda X1 sta HRS1 lda Y1 sta HRS2 - lda #$80 - sta HRSFB + BRK_TELEMON(XCURSE) From 7435c2f3ca932a9945757cb0ec755ba6613b6157 Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Thu, 26 Oct 2017 22:00:12 +0200 Subject: [PATCH 027/254] Fix doc/telestrat.sgml --- doc/telestrat.sgml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/doc/telestrat.sgml b/doc/telestrat.sgml index 2d05f8985..d85dac2a3 100644 --- a/doc/telestrat.sgml +++ b/doc/telestrat.sgml @@ -9,10 +9,7 @@ <date>2017-01-22 <abstract> - -An overview over the Telestrat (Telemon 2.4 & Telemon 3.x : http://orix.oric.org) runtime system as it is implemented for the cc65 C -compiler.) - +An overview over the Telestrat (Telemon 2.4 & Telemon 3.x : http://orix.oric.org) runtime system as it is implemented for the cc65 C compiler. </abstract> <!-- Table of contents --> From 807b55862d7f51a8d1106a501d4be82d9c15e9de Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Sat, 28 Oct 2017 00:37:47 +0200 Subject: [PATCH 028/254] Now mkdir is working --- asminc/telestrat.inc | 1 + libsrc/telestrat/oserror.s | 17 +++++++++++++++++ libsrc/telestrat/sysmkdir.s | 30 ++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 libsrc/telestrat/oserror.s create mode 100644 libsrc/telestrat/sysmkdir.s diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 737c4b6ae..cb28919c2 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -171,6 +171,7 @@ XSOUND = $44 XMUSIC = $45 XZAP = $46 XSHOOT = $47 +XMKDIR = $4B ; create a folder. Only available in telemon 3.x XSOUT = $67 ; send A register to RS232, available in telemon 2.4 & 3.x XHRSSE = $8C ; set hires position cursor XDRAWA = $8D ; draw a line diff --git a/libsrc/telestrat/oserror.s b/libsrc/telestrat/oserror.s new file mode 100644 index 000000000..e3b9e619a --- /dev/null +++ b/libsrc/telestrat/oserror.s @@ -0,0 +1,17 @@ +; +; Jede, 2017-10-27 +; +; int __fastcall__ _osmaperrno (unsigned char oserror); +; /* Map a system specific error into a system independent code */ +; + + .include "errno.inc" + .export __osmaperrno + +.proc __osmaperrno + + lda #<EUNKNOWN + ldx #>EUNKNOWN + rts + +.endproc diff --git a/libsrc/telestrat/sysmkdir.s b/libsrc/telestrat/sysmkdir.s new file mode 100644 index 000000000..26d97c4b0 --- /dev/null +++ b/libsrc/telestrat/sysmkdir.s @@ -0,0 +1,30 @@ +; +; Jede (jede@oric.org), 2017-10-27 +; +; unsigned char _sysmkdir (const char* name, ...); +; + + .export __sysmkdir + .import addysp, popax + + .include "telestrat.inc" + .include "zeropage.inc" + + +__sysmkdir: + ; Throw away all parameters except the name + dey + dey + jsr addysp + + ; Get name + jsr popax + + ; Call telemon primitive + + BRK_TELEMON(XMKDIR) + + rts + + + From eae485dc64c0ea1aab567fe7500122beda9b9eb0 Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Sat, 28 Oct 2017 00:40:56 +0200 Subject: [PATCH 029/254] Empty item removed --- doc/telestrat.sgml | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/telestrat.sgml b/doc/telestrat.sgml index d85dac2a3..b640e5aa8 100644 --- a/doc/telestrat.sgml +++ b/doc/telestrat.sgml @@ -120,7 +120,6 @@ structures; accessing the struct fields will access the chip registers. TGI drivers is available on Oric Telestrat with some functions : <itemize> -<item> <item>tgi_install <item>tgi_init <item>tgi_clear From de1f80571aa0d4c45fbcc67b184d70da65bee0a3 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Tue, 31 Oct 2017 00:45:17 -0400 Subject: [PATCH 030/254] Fixed the way that the disassembler looks for the end of a segment. It checks only the bytes that actually were printed. It won't show a bad error message when disassembling address $0000. Fixes #506 on cc65's Github project. --- src/da65/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/da65/main.c b/src/da65/main.c index 0b0bf19e7..1454d01fb 100644 --- a/src/da65/main.c +++ b/src/da65/main.c @@ -350,6 +350,7 @@ static void OneOpcode (unsigned RemainingBytes) /* Disassemble one opcode */ { unsigned I; + unsigned OldPC = PC; /* Get the opcode from the current address */ unsigned char OPC = GetCodeByte (PC); @@ -476,7 +477,7 @@ static void OneOpcode (unsigned RemainingBytes) /* Change back to the default CODE segment if ** a named segment stops at the current address. */ - for (I = D->Size; I >= 1; --I) { + for (I = PC - OldPC; I > 0; --I) { if (IsSegmentEnd (PC - I)) { EndSegment (); break; From 9ee443199454323c497753ce16ebf1c381f56bea Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Thu, 2 Nov 2017 21:11:08 +0100 Subject: [PATCH 031/254] Add files via upload Alternative joystick interface --- libsrc/atmos/joy/atmos-ijk.s | 146 +++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 libsrc/atmos/joy/atmos-ijk.s diff --git a/libsrc/atmos/joy/atmos-ijk.s b/libsrc/atmos/joy/atmos-ijk.s new file mode 100644 index 000000000..f59f6b96a --- /dev/null +++ b/libsrc/atmos/joy/atmos-ijk.s @@ -0,0 +1,146 @@ +; +; IJK joystick driver for the Atmos +; Can be used multiple times when statically linked to the application. +; +; 2002-12-20, Based on Ullrich von Bassewitz's code. +; 2017-11-01, Stefan Haubenthal +; + + .include "joy-kernel.inc" + .include "joy-error.inc" + .include "atmos.inc" + + .macpack module + + +; ------------------------------------------------------------------------ +; Header. Includes jump table + + module_header _atmos_ijk_joy + +; Driver signature + + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number + +; Library reference + + .addr $0000 + +; Button state masks (8 values) + + .byte $10 ; JOY_UP + .byte $08 ; JOY_DOWN + .byte $01 ; JOY_LEFT + .byte $02 ; JOY_RIGHT + .byte $20 ; JOY_FIRE + .byte $00 ; Future expansion + .byte $00 ; Future expansion + .byte $00 ; Future expansion + +; Jump table. + + .addr INSTALL + .addr UNINSTALL + .addr COUNT + .addr READ + .addr 0 ; IRQ entry unused + +; ------------------------------------------------------------------------ +; Constants + +JOY_COUNT = 2 ; Number of joysticks we support + +.code + +; ------------------------------------------------------------------------ +; INSTALL routine. Is called after the driver is loaded into memory. If +; possible, check if the hardware is present and determine the amount of +; memory available. +; Must return an JOY_ERR_xx code in a/x. +; + +INSTALL: + lda #%11000000 + sta VIA::DDRA + sta VIA::PRA + lda VIA::PRA + and #%00100000 + bne ijkPresent + lda #<JOY_ERR_NO_DEVICE + .byte $2C ; Skip next opcode +ijkPresent: + lda #<JOY_ERR_OK + ldx #>JOY_ERR_OK +; rts ; Run into UNINSTALL instead + +; ------------------------------------------------------------------------ +; UNINSTALL routine. Is called before the driver is removed from memory. +; Can do cleanup or whatever. Must not return anything. +; + +UNINSTALL: + rts + + +; ------------------------------------------------------------------------ +; COUNT: Return the total number of available joysticks in a/x. +; + +COUNT: + lda #<JOY_COUNT + ldx #>JOY_COUNT + rts + +; ------------------------------------------------------------------------ +; READ: Read a particular joystick passed in A. +; + +READ: + bne right + + ; Ensure Printer Strobe is set to Output + lda #%10110111 + sta VIA::DDRB + ; Set Strobe Low + lda #%00000000 + sta VIA::PRB + ; Set Top two bits of PortA to Output and rest as Input + lda #%11000000 + sta VIA::DDRA + + ; Select Left Joystick + lda #%01111111 + sta VIA::PRA + ; Read back Left Joystick state + lda VIA::PRA + ; Mask out unused bits + and #%00011111 + ; Invert Bits + eor #%00011111 + ; Index table to conform to Generic Format + tax + lda GenericIJKBits,X + bne L1 + +right: + ; Select Right Joystick + lda #%10111111 + sta VIA::PRA + ; Read back Right Joystick state and rejig bits + lda VIA::PRA + and #%00011111 + eor #%00011111 + tax + lda GenericIJKBits,X + + ; Restore VIA PortA state +L1: ldx #%11111111 + stx VIA::DDRA + inx ; x=0 + rts + +.rodata +GenericIJKBits: + .byte 0,2,1,3,32,34,33,0,8,10,9,0,40,42,41,0 + .byte 16,18,17,0,48,50,49,0,0,0,0,0,0,0,0,0 From e64c42f224d62d514dabfc6842fb385cb502e884 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Fri, 3 Nov 2017 20:49:49 +0100 Subject: [PATCH 032/254] Update atmos.sgml --- doc/atmos.sgml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/atmos.sgml b/doc/atmos.sgml index 68f7f9d65..9e61fbd1c 100644 --- a/doc/atmos.sgml +++ b/doc/atmos.sgml @@ -159,7 +159,10 @@ No extended memory drivers are currently available for the Atmos. <descrip> <tag><tt/atmos-pase.joy (atmos_pase_joy)/</tag> - Supports two standard joysticks connected to the P.A.S.E. interface of the Atmos. + Supports two standard joysticks connected to a P.A.S.E. / Altai interface of the Atmos. + + <tag><tt/atmos-ijk.joy (atmos_ijk_joy)/</tag> + Supports two standard joysticks connected to an IJK interface of the Atmos. </descrip><p> From d3451bb299d726651b3fd002d1d314563e7a16b2 Mon Sep 17 00:00:00 2001 From: Piotr Fusik <fox@scene.pl> Date: Mon, 6 Nov 2017 19:46:26 +0100 Subject: [PATCH 033/254] Fix 256 codes of same length --- libsrc/zlib/inflatemem.s | 44 ++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/libsrc/zlib/inflatemem.s b/libsrc/zlib/inflatemem.s index 27802fbff..f49c5fc79 100644 --- a/libsrc/zlib/inflatemem.s +++ b/libsrc/zlib/inflatemem.s @@ -1,5 +1,5 @@ ; -; 2017-02-12, Piotr Fusik +; 2017-11-06, Piotr Fusik ; ; unsigned __fastcall__ inflatemem (char* dest, const char* source); ; @@ -103,7 +103,7 @@ inflate_blockLoop: ; ldy #0 sty getBit_buffer ; ignore bits until byte boundary jsr getWord ; skip the length we don't need - jsr getWord ; get the two's complement length + jsr getWord ; get the one's complement length sta inflateStored_pageCounter bcs inflateStored_firstByte ; jmp inflateStored_copyByte: @@ -332,7 +332,7 @@ inflateDynamic_storeControl: ; Build Huffman trees basing on code lengths (in bits) ; stored in the *SymbolCodeLength arrays buildHuffmanTree: -; Clear nBitCode_totalCount, nBitCode_literalCount, nBitCode_controlCount +; Clear nBitCode_literalCount, nBitCode_controlCount tya ; lda #0 buildHuffmanTree_clear: @@ -344,22 +344,20 @@ buildHuffmanTree_clear: buildHuffmanTree_countCodeLengths: ldx literalSymbolCodeLength,y inc nBitCode_literalCount,x - inc nBitCode_totalCount,x cpy #CONTROL_SYMBOLS bcs buildHuffmanTree_noControlSymbol ldx controlSymbolCodeLength,y inc nBitCode_controlCount,x - inc nBitCode_totalCount,x buildHuffmanTree_noControlSymbol: iny bne buildHuffmanTree_countCodeLengths ; Calculate offsets of symbols sorted by code length ; lda #0 - ldx #$100-3*TREE_SIZE + ldx #$100-4*TREE_SIZE buildHuffmanTree_calculateOffsets: - sta nBitCode_literalOffset+3*TREE_SIZE-$100,x + sta nBitCode_literalOffset+4*TREE_SIZE-$100,x clc - adc nBitCode_literalCount+3*TREE_SIZE-$100,x + adc nBitCode_literalCount+4*TREE_SIZE-$100,x inx bne buildHuffmanTree_calculateOffsets ; Put symbols in their place in the sorted array @@ -397,26 +395,26 @@ fetchCode_nextBit: rol a inx sec - sbc nBitCode_totalCount,x + sbc nBitCode_literalCount,x + bcc fetchCode_literal +; sec + sbc nBitCode_controlCount,x bcs fetchCode_nextBit ; clc - adc nBitCode_controlCount,x - bcs fetchCode_control + adc nBitCode_controlOffset,x + tax + lda codeToControlSymbol,x + and #$1f ; make distance symbols zero-based + tax +; sec + rts +fetchCode_literal: ; clc adc nBitCode_literalOffset,x tax lda codeToLiteralSymbol,x clc rts -fetchCode_control: -; sec - adc nBitCode_controlOffset-1,x - tax - lda codeToControlSymbol-1,x - and #$1f ; make distance symbols zero-based - tax - sec - rts ; Read A minus 1 bits, but no more than 8 getAMinus1BitsMax8: @@ -517,14 +515,12 @@ controlSymbolCodeLength: ; Huffman trees. nBitCode_clearFrom: -nBitCode_totalCount: - .res 2*TREE_SIZE nBitCode_literalCount: - .res TREE_SIZE + .res 2*TREE_SIZE nBitCode_controlCount: .res 2*TREE_SIZE nBitCode_literalOffset: - .res TREE_SIZE + .res 2*TREE_SIZE nBitCode_controlOffset: .res 2*TREE_SIZE From afcfba935594879742d85469d3cb1c38a25fa6f4 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Mon, 6 Nov 2017 21:02:14 +0100 Subject: [PATCH 034/254] Use macro actually defined in cbm_filetype.h. --- include/dirent.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dirent.h b/include/dirent.h index b5e1be135..124c7f224 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -107,7 +107,7 @@ struct dirent { #define _DE_ISREG(t) (((t) & _CBM_T_REG) != 0) #define _DE_ISDIR(t) ((t) == _CBM_T_DIR) -#define _DE_ISLBL(t) ((t) == _CBM_T_HDR) +#define _DE_ISLBL(t) ((t) == _CBM_T_HEADER) #define _DE_ISLNK(t) ((t) == _CBM_T_LNK) #elif defined(__LYNX__) From 84edf4cbfd22e5e20670769ea00adaeb27d12a6f Mon Sep 17 00:00:00 2001 From: Piotr Fusik <fox@scene.pl> Date: Tue, 7 Nov 2017 20:10:19 +0100 Subject: [PATCH 035/254] Fix more than 256 codes of same length. Fix all 256 literal codes of same length. --- libsrc/zlib/inflatemem.s | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/libsrc/zlib/inflatemem.s b/libsrc/zlib/inflatemem.s index f49c5fc79..bc89f2016 100644 --- a/libsrc/zlib/inflatemem.s +++ b/libsrc/zlib/inflatemem.s @@ -1,5 +1,5 @@ ; -; 2017-11-06, Piotr Fusik +; 2017-11-07, Piotr Fusik ; ; unsigned __fastcall__ inflatemem (char* dest, const char* source); ; @@ -344,6 +344,9 @@ buildHuffmanTree_clear: buildHuffmanTree_countCodeLengths: ldx literalSymbolCodeLength,y inc nBitCode_literalCount,x + bne buildHuffmanTree_notAllLiterals + stx allLiteralsCodeLength +buildHuffmanTree_notAllLiterals: cpy #CONTROL_SYMBOLS bcs buildHuffmanTree_noControlSymbol ldx controlSymbolCodeLength,y @@ -394,12 +397,33 @@ fetchCode_nextBit: jsr getBit rol a inx + bcs fetchCode_ge256 +; are all 256 literal codes of this length? + cpx allLiteralsCodeLength + beq fetchCode_allLiterals +; is it literal code of length X? sec sbc nBitCode_literalCount,x - bcc fetchCode_literal + bcs fetchCode_notLiteral +; literal code +; clc + adc nBitCode_literalOffset,x + tax + lda codeToLiteralSymbol,x +fetchCode_allLiterals: + clc + rts +; code >= 256, must be control +fetchCode_ge256: +; sec + sbc nBitCode_literalCount,x + sec +; is it control code of length X? +fetchCode_notLiteral: ; sec sbc nBitCode_controlCount,x bcs fetchCode_nextBit +; control code ; clc adc nBitCode_controlOffset,x tax @@ -408,13 +432,6 @@ fetchCode_nextBit: tax ; sec rts -fetchCode_literal: -; clc - adc nBitCode_literalOffset,x - tax - lda codeToLiteralSymbol,x - clc - rts ; Read A minus 1 bits, but no more than 8 getAMinus1BitsMax8: @@ -523,6 +540,8 @@ nBitCode_literalOffset: .res 2*TREE_SIZE nBitCode_controlOffset: .res 2*TREE_SIZE +allLiteralsCodeLength: + .res 1 codeToLiteralSymbol: .res 256 From e4a235b23370d3842ce1c048ecbcf23d4498cfe2 Mon Sep 17 00:00:00 2001 From: "U-AMAIISDOM\\fcaruso" <fcaruso@NCEL46741.iis.amadeus.net> Date: Thu, 9 Nov 2017 13:51:04 +0100 Subject: [PATCH 036/254] Correct bits in gamate joystick detection --- libsrc/gamate/joy/gamate-stdjoy.s | 1 + 1 file changed, 1 insertion(+) diff --git a/libsrc/gamate/joy/gamate-stdjoy.s b/libsrc/gamate/joy/gamate-stdjoy.s index d10eb6f41..f6b303dba 100644 --- a/libsrc/gamate/joy/gamate-stdjoy.s +++ b/libsrc/gamate/joy/gamate-stdjoy.s @@ -79,6 +79,7 @@ COUNT: READJOY: lda JOY_DATA + eor #$ff ldx #0 rts From bf0ae229691ccbdb17b57e0b865f30445f6b0b3e Mon Sep 17 00:00:00 2001 From: Fabrizio Caruso <Fabrizio_Caruso@hotmail.com> Date: Thu, 9 Nov 2017 16:36:06 +0100 Subject: [PATCH 037/254] Update gamate-stdjoy.s --- libsrc/gamate/joy/gamate-stdjoy.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/gamate/joy/gamate-stdjoy.s b/libsrc/gamate/joy/gamate-stdjoy.s index f6b303dba..a5bd24ef2 100644 --- a/libsrc/gamate/joy/gamate-stdjoy.s +++ b/libsrc/gamate/joy/gamate-stdjoy.s @@ -79,7 +79,7 @@ COUNT: READJOY: lda JOY_DATA - eor #$ff + eor #$ff ldx #0 rts From 0a61b061c70d538453c1ffe3f846f06f078c9b71 Mon Sep 17 00:00:00 2001 From: Fabrizio Caruso <Fabrizio_Caruso@hotmail.com> Date: Thu, 9 Nov 2017 16:42:52 +0100 Subject: [PATCH 038/254] Update gamate-stdjoy.s --- libsrc/gamate/joy/gamate-stdjoy.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/gamate/joy/gamate-stdjoy.s b/libsrc/gamate/joy/gamate-stdjoy.s index a5bd24ef2..801b40acd 100644 --- a/libsrc/gamate/joy/gamate-stdjoy.s +++ b/libsrc/gamate/joy/gamate-stdjoy.s @@ -79,7 +79,7 @@ COUNT: READJOY: lda JOY_DATA - eor #$ff + eor #$FF ldx #0 rts From 2fd99e9dece66a09336f50c9a67a04a81be18824 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Thu, 9 Nov 2017 17:36:21 +0100 Subject: [PATCH 039/254] Missing declaration --- include/atmos.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/atmos.h b/include/atmos.h index c642f9e2a..d9f6d103b 100644 --- a/include/atmos.h +++ b/include/atmos.h @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 2002 Debrune Jérome, <jede@oric.org> */ +/* (C) 2002 Debrune Jérome, <jede@oric.org> */ /* (C) 2003-2013 Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ @@ -129,6 +129,7 @@ /* The addresses of the static drivers */ extern void atmos_pase_joy[]; /* Referred to by joy_static_stddrv[] */ +extern void atmos_ijk_joy[]; extern void atmos_acia_ser[]; extern void atmos_228_200_3_tgi[]; extern void atmos_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[] */ From 64ed0a1937fe9ab172c7a12bfe06d9f06130470a Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Fri, 10 Nov 2017 10:58:01 +0100 Subject: [PATCH 040/254] Doc modified --- doc/telestrat.sgml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/telestrat.sgml b/doc/telestrat.sgml index b640e5aa8..76b3cdd30 100644 --- a/doc/telestrat.sgml +++ b/doc/telestrat.sgml @@ -120,12 +120,12 @@ structures; accessing the struct fields will access the chip registers. TGI drivers is available on Oric Telestrat with some functions : <itemize> +<item>tgi_done <item>tgi_install <item>tgi_init <item>tgi_clear +<item>tgi_line <item>tgi_setpixel -<item>tgi_getmaxx -<item>tgi_getmaxy </itemize> From 3c97a04b252df1903f03ef3b9883f2eed675d496 Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Sun, 12 Nov 2017 10:42:09 +0100 Subject: [PATCH 041/254] Fix cc65 doc for telestrat target --- doc/cc65.sgml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/cc65.sgml b/doc/cc65.sgml index cd94f50ac..11a5937b2 100644 --- a/doc/cc65.sgml +++ b/doc/cc65.sgml @@ -407,6 +407,7 @@ Here is a description of all the command line options: <item>sim6502 <item>sim65c02 <item>supervision + <item>telestrat <item>vic20 </itemize> @@ -941,6 +942,10 @@ The compiler defines several macros at startup: This macro is defined if the target is the Supervision (-t supervision). + <tag><tt>__TELESTRAT__</tt></tag> + + This macro is defined if the target is the Telestrat (-t telestrat). + <tag><tt>__TIME__</tt></tag> This macro expands to the time of translation of the preprocessing From 06794b221d0bd26c90baad71fbbd23ad5301fe16 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Mon, 13 Nov 2017 20:38:22 +0100 Subject: [PATCH 042/254] Made cbm_k_untlk() available. --- include/cbm.h | 1 + libsrc/cbm/c_untlk.s | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/cbm.h b/include/cbm.h index a4b232406..da63375b2 100644 --- a/include/cbm.h +++ b/include/cbm.h @@ -209,6 +209,7 @@ void __fastcall__ cbm_k_setnam (const char* Name); void __fastcall__ cbm_k_talk (unsigned char dev); void cbm_k_udtim (void); void cbm_k_unlsn (void); +void cbm_k_untlk (void); diff --git a/libsrc/cbm/c_untlk.s b/libsrc/cbm/c_untlk.s index 1d71c168b..3865564cd 100644 --- a/libsrc/cbm/c_untlk.s +++ b/libsrc/cbm/c_untlk.s @@ -1,11 +1,11 @@ ; ; Ullrich von Bassewitz, 03.06.1999 ; -; void cbm_untlk (void); +; void cbm_k_untlk (void); ; - .export _cbm_untlk + .export _cbm_k_untlk .import UNTLK -_cbm_untlk = UNTLK +_cbm_k_untlk = UNTLK From 4e0958eae6a8ff3361506aea09c1fb356ac46e93 Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Tue, 14 Nov 2017 22:04:57 +0100 Subject: [PATCH 043/254] Bug corrected : Fwrite did not return number of byte written. --- libsrc/telestrat/write.s | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/libsrc/telestrat/write.s b/libsrc/telestrat/write.s index 8c2bc08f7..4e059a311 100644 --- a/libsrc/telestrat/write.s +++ b/libsrc/telestrat/write.s @@ -17,7 +17,7 @@ sta ptr2 txa eor #$FF - sta ptr2+1 ; Remember -count-1 + sta ptr2+1 ; remember -count-1 jsr popax ; get buf sta ptr1 @@ -32,7 +32,7 @@ next: cmp #1 beq L1 - ; Here it's a file opened + ; here it's a file opened lda ptr1 sta PTR_READ_DEST lda ptr1+1 @@ -40,6 +40,16 @@ next: lda ptr3 ldy ptr3+1 BRK_TELEMON XFWRITE + ; compute nb of bytes written + + + lda PTR_READ_DEST+1 + sec + sbc ptr1+1 + tax + lda PTR_READ_DEST + sec + sbc ptr1 rts @@ -50,23 +60,23 @@ L1: inc ptr2 L2: ldy #0 lda (ptr1),y tax - cpx #$0A ; Check for \n + cpx #$0A ; check for \n bne L3 - BRK_TELEMON XWR0 ; Macro send char to screen (channel 0 in telemon terms) - lda #$0D ; return to the beggining of the line - BRK_TELEMON XWR0 ; Macro ; + BRK_TELEMON XWR0 ; macro send char to screen (channel 0 in telemon terms) + lda #$0D ; return to the beggining of the line + BRK_TELEMON XWR0 ; macro ldx #$0D L3: - BRK_TELEMON XWR0 ; Macro + BRK_TELEMON XWR0 ; macro inc ptr1 bne L1 inc ptr1+1 jmp L1 -; No error, return count + ; No error, return count L9: lda ptr3 ldx ptr3+1 From 9ead405938848f3ff8b1f4a8450dcd21e6bc68ec Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Wed, 15 Nov 2017 00:13:06 +0100 Subject: [PATCH 044/254] Creativision documentation enhancements. --- doc/creativision.sgml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/doc/creativision.sgml b/doc/creativision.sgml index 64623b3b2..29653ce0f 100644 --- a/doc/creativision.sgml +++ b/doc/creativision.sgml @@ -4,7 +4,7 @@ <title>VTech Creativision (aka Funvision) specific information for cc65 <author><url url="mailto:polluks+cc65@sdf.lonestar.org" name="Stefan A. Haubenthal"> -<date>2016-04-14 +<date>2017-11-15 <abstract> An overview over the Creativision runtime system as it is implemented for the @@ -31,14 +31,16 @@ more than one platform. Please see the function reference for more information. <sect>Binary format<p> The standard binary output format generated by the linker for the Creativision target -is a 4 kbyte machine language program. It is of course possible to change -this behaviour by using one of the different linker configs. +is a 4 KB ROM image. To create an 8 KB ROM a custom linker script has +to be used. <sect>Memory layout<p> -cc65 generated programs with the default setup run with the I/O area enabled, -which gives a usable memory range of $B000 - $BEFF. -More ROM may need additional bankswitching code. +cc65 generated programs with the default setup are 4 KB in size, +occupying $B000 - $BFFF. Usable memory space for the +user program is $B000 - $BEFF. $BF00 - +$BFFF is reserved for the runtime and cartridge configuration +area. Special locations: @@ -47,11 +49,15 @@ Special locations: The text screen is located at VRAM $1000. <tag/Stack/ - The C runtime stack is located at $3FF and growing downwards. + The C runtime stack is located at $03FF and growing downwards. + + <tag/RAM/ + The available RAM for cc65 programs of an unexpanded Creativision + starts at $01FA and ends at $03FF. <tag/Heap/ - The C heap is located at the end of the program and grows towards the C - runtime stack. + The C heap is located at the end of the program's data area and + grows towards the C runtime stack. </descrip><p> From 12bfed04b1cc7cf224e95afebe13d75d7978730f Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 06:53:26 +0100 Subject: [PATCH 045/254] Create supervision-stdjoy.s --- libsrc/supervision/joy/supervision-stdjoy.s | 93 +++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 libsrc/supervision/joy/supervision-stdjoy.s diff --git a/libsrc/supervision/joy/supervision-stdjoy.s b/libsrc/supervision/joy/supervision-stdjoy.s new file mode 100644 index 000000000..2d89aa6cb --- /dev/null +++ b/libsrc/supervision/joy/supervision-stdjoy.s @@ -0,0 +1,93 @@ +; +; Standard joystick driver for the Supervision +; + + .include "joy-kernel.inc" + .include "joy-error.inc" + .include "supervision.inc" + + .macpack module + + +; ------------------------------------------------------------------------ +; Header. Includes jump table + + module_header _supervision_stdjoy_joy + +; Driver signature + + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number + +; Library reference + + .addr $0000 + +; Button state masks (8 values) + + .byte $08 ; JOY_UP + .byte $04 ; JOY_DOWN + .byte $02 ; JOY_LEFT + .byte $01 ; JOY_RIGHT + .byte $20 ; JOY_FIRE_A + .byte $10 ; JOY_FIRE_B + .byte $40 ; JOY_SELECT + .byte $80 ; JOY_START + +; Jump table. + + .addr INSTALL + .addr UNINSTALL + .addr COUNT + .addr READJOY + .addr 0 ; IRQ entry unused + +; ------------------------------------------------------------------------ +; Constants + +JOY_COUNT = 1 ; Number of joysticks we support + + +.code + +; ------------------------------------------------------------------------ +; INSTALL routine. Is called after the driver is loaded into memory. If +; possible, check if the hardware is present and determine the amount of +; memory available. +; Must return an JOY_ERR_xx code in a/x. +; + +INSTALL: + lda #<JOY_ERR_OK + ldx #>JOY_ERR_OK + +; rts ; Run into UNINSTALL instead + +; ------------------------------------------------------------------------ +; DEINSTALL routine. Is called before the driver is removed from memory. +; Can do cleanup or whatever. Must not return anything. +; + +UNINSTALL: + rts + + +; ------------------------------------------------------------------------ +; COUNT: Return the total number of available joysticks in a/x. +; +;unsigned char __fastcall__ joy_count (void); + +COUNT: + lda #<JOY_COUNT + ldx #>JOY_COUNT + rts + +; ------------------------------------------------------------------------ +; READ: Read a particular joystick passed in A. +; +;unsigned char __fastcall__ joy_read (unsigned char joystick); + +READJOY: + lda sv_control + ldx #0 + rts From 949c2aa76f9bd0178567786530afbcbde6f45320 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 06:57:02 +0100 Subject: [PATCH 046/254] Add files via upload --- libsrc/supervision/joy_stat_stddrv.s | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 libsrc/supervision/joy_stat_stddrv.s diff --git a/libsrc/supervision/joy_stat_stddrv.s b/libsrc/supervision/joy_stat_stddrv.s new file mode 100644 index 000000000..345b5f164 --- /dev/null +++ b/libsrc/supervision/joy_stat_stddrv.s @@ -0,0 +1,14 @@ +; +; Address of the static standard joystick driver +; +; Oliver Schmidt, 2012-11-01 +; +; const void joy_static_stddrv[]; +; + + .export _joy_static_stddrv + .import _supervision_stdjoy_joy + +.rodata + +_joy_static_stddrv := _supervision_stdjoy_joy From e9c16e62e76ab0e9fde2e836451be72418234350 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 09:51:35 +0100 Subject: [PATCH 047/254] Fix docs for #453 --- doc/funcref.sgml | 37 +++++++++++++++++++++++++++---------- doc/gamate.sgml | 7 +++++++ doc/supervision.sgml | 19 ++++++------------- 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 1d5ee7c19..e634a4f6f 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -4,7 +4,7 @@ <title>cc65 function reference <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> -<date>2017-09-02 +<date>2017-11-21 <abstract> cc65 is a C compiler for 6502 based systems. This function reference describes @@ -352,10 +352,10 @@ function. <sect1><tt/gamate.h/<label id="gamate.h"><p> -<!-- <itemize> --> +<itemize> <!-- <item><ref id="get_tv" name="get_tv"> --> -<!-- <item><ref id="waitvblank" name="waitvblank"> --> -<!-- </itemize> --> +<item><ref id="waitvsync" name="waitvsync"> +</itemize> (incomplete) @@ -437,10 +437,10 @@ function. <sect1><tt/nes.h/<label id="nes.h"><p> -<!-- <itemize> --> +<itemize> <!-- <item><ref id="get_tv" name="get_tv"> --> -<!-- <item><ref id="waitvsync" name="waitvsync"> --> -<!-- </itemize> --> +<item><ref id="waitvsync" name="waitvsync"> +</itemize> (incomplete) @@ -455,10 +455,10 @@ It does not declare any functions. <sect1><tt/pce.h/<label id="pce.h"><p> -<!-- <itemize> --> +<itemize> <!-- <item><ref id="get_tv" name="get_tv"> --> -<!-- <item><ref id="waitvblank" name="waitvblank"> --> -<!-- </itemize> --> +<item><ref id="waitvsync" name="waitvsync"> +</itemize> (incomplete) @@ -7612,6 +7612,23 @@ used in presence of a prototype. </quote> +<sect1>waitvsync<label id="waitvsync"><p> + +<quote> +<descrip> +<tag/Function/Wait until the start of the next frame. +<tag/Header/ +<tt/<ref id="gamate.h" name="gamate.h">/, +<tt/<ref id="nes.h" name="nes.h">/, +<tt/<ref id="pce.h" name="pce.h">/ +<tag/Declaration/<tt/void waitvsync (void);/ +<tag/Description/Wait for vertical sync to reduce flickering. +<tag/Availability/Platforms above +<tag/Example/None. +</descrip> +</quote> + + <sect1>wherex<label id="wherex"><p> <quote> diff --git a/doc/gamate.sgml b/doc/gamate.sgml index 14b1a27e9..0948c20c4 100644 --- a/doc/gamate.sgml +++ b/doc/gamate.sgml @@ -44,6 +44,13 @@ by an external program. Such an utility is provided in util/gamate/gamate-fixcar Programs containing Gamate specific code may use the <tt/gamate.h/ header file. +<sect1>Gamate specific functions<p> + +<itemize> +<item>waitvsync</item> +</itemize> + + <sect1>Hardware access<p> The following pseudo variables declared in the <tt/gamate.inc/ include file do diff --git a/doc/supervision.sgml b/doc/supervision.sgml index cf2af7967..c2ed425dd 100644 --- a/doc/supervision.sgml +++ b/doc/supervision.sgml @@ -63,14 +63,6 @@ Special locations: Programs containing Supervision specific code may use the <tt/supervision.h/ header file. -<sect1>Supervision specific functions<p> - -<itemize> -<item>waitvsync</item> -</itemize> - - - <sect1>Hardware access<p> The following pseudo variables declared in the <tt/supervision.inc/ include file do @@ -102,11 +94,12 @@ No extended memory drivers are currently available for the Supervision. <sect1>Joystick drivers<p> -No joystick drivers are currently available for the Supervision. -<!--A joystick driver for the standard buttons is available, but must be -statically linked, because no file I/O is available. See the documentation for -the <url url="co65.html" name="co65 utility"> for information on how to do -that.--> +<descrip> + + <tag><tt/supervision-stdjoy.joy (supervision_stdjoy_joy)/</tag> + A joystick driver for the standard two buttons joypad is available. + +</descrip><p> <sect1>Mouse drivers<p> From 40f960f7336b306c4d4d44fc88bed428a5a3ff19 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 09:59:31 +0100 Subject: [PATCH 048/254] Date --- doc/supervision.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/supervision.sgml b/doc/supervision.sgml index c2ed425dd..153746025 100644 --- a/doc/supervision.sgml +++ b/doc/supervision.sgml @@ -4,7 +4,7 @@ <title>Watara Supervision specific information for cc65 <author><url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal"> -<date>2014-04-12 +<date>2017-11-21 <abstract> An overview over the Supervision runtime system as it is implemented for the From f9b4e0b574e290a13ffa9e4ea580a2dcff48acab Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 10:12:35 +0100 Subject: [PATCH 049/254] Update supervision.h --- include/supervision.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/supervision.h b/include/supervision.h index ffece4ecb..464c59e05 100644 --- a/include/supervision.h +++ b/include/supervision.h @@ -105,9 +105,10 @@ extern unsigned char sv_nmi_counter; extern unsigned char sv_timer_irq_counter; extern unsigned char sv_timer_dma_counter; +/* The addresses of the static drivers */ +extern void supervision_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ + /* End of supervision.h */ #endif - - From e49744ecd065a958efd9d8ed90993f60b6fdf656 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 10:22:53 +0100 Subject: [PATCH 050/254] New API --- include/supervision.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/supervision.h b/include/supervision.h index 464c59e05..492346492 100644 --- a/include/supervision.h +++ b/include/supervision.h @@ -105,6 +105,26 @@ extern unsigned char sv_nmi_counter; extern unsigned char sv_timer_irq_counter; extern unsigned char sv_timer_dma_counter; +/* Masks for joy_read */ +#define JOY_UP_MASK 0x08 +#define JOY_DOWN_MASK 0x04 +#define JOY_LEFT_MASK 0x02 +#define JOY_RIGHT_MASK 0x01 +#define JOY_BTN_1_MASK 0x20 +#define JOY_BTN_2_MASK 0x10 +#define JOY_BTN_3_MASK 0x80 +#define JOY_BTN_4_MASK 0x40 + +#define JOY_BTN_A_MASK JOY_BTN_1_MASK +#define JOY_BTN_B_MASk JOY_BTN_2_MASK +#define JOY_START_MASK JOY_BTN_3_MASK +#define JOY_SELECT_MASK JOY_BTN_4_MASK + +#define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK) +#define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK) +#define JOY_START(v) ((v) & JOY_START_MASK) +#define JOY_SELECT(v) ((v) & JOY_SELECT_MASK) + /* The addresses of the static drivers */ extern void supervision_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ From f8f464846aff3fd1c1fbedb2cb4a05073fe14541 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 10:27:08 +0100 Subject: [PATCH 051/254] directive removed --- libsrc/supervision/joy_stat_stddrv.s | 2 -- 1 file changed, 2 deletions(-) diff --git a/libsrc/supervision/joy_stat_stddrv.s b/libsrc/supervision/joy_stat_stddrv.s index 345b5f164..4daa13e34 100644 --- a/libsrc/supervision/joy_stat_stddrv.s +++ b/libsrc/supervision/joy_stat_stddrv.s @@ -9,6 +9,4 @@ .export _joy_static_stddrv .import _supervision_stdjoy_joy -.rodata - _joy_static_stddrv := _supervision_stdjoy_joy From c4baf9588e1ef203bc49fe34a8cfc83a8c5942b5 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 10:29:35 +0100 Subject: [PATCH 052/254] directive removed --- libsrc/gamate/joy_stat_stddrv.s | 2 -- 1 file changed, 2 deletions(-) diff --git a/libsrc/gamate/joy_stat_stddrv.s b/libsrc/gamate/joy_stat_stddrv.s index 75016450a..94537b210 100644 --- a/libsrc/gamate/joy_stat_stddrv.s +++ b/libsrc/gamate/joy_stat_stddrv.s @@ -9,6 +9,4 @@ .export _joy_static_stddrv .import _gamate_stdjoy_joy -.rodata - _joy_static_stddrv := _gamate_stdjoy_joy From 7d1c92dc129da98ec113817095f169d7266049ee Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 10:33:48 +0100 Subject: [PATCH 053/254] New API --- libsrc/supervision/joy/supervision-stdjoy.s | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/libsrc/supervision/joy/supervision-stdjoy.s b/libsrc/supervision/joy/supervision-stdjoy.s index 2d89aa6cb..f6a325740 100644 --- a/libsrc/supervision/joy/supervision-stdjoy.s +++ b/libsrc/supervision/joy/supervision-stdjoy.s @@ -23,17 +23,6 @@ .addr $0000 -; Button state masks (8 values) - - .byte $08 ; JOY_UP - .byte $04 ; JOY_DOWN - .byte $02 ; JOY_LEFT - .byte $01 ; JOY_RIGHT - .byte $20 ; JOY_FIRE_A - .byte $10 ; JOY_FIRE_B - .byte $40 ; JOY_SELECT - .byte $80 ; JOY_START - ; Jump table. .addr INSTALL From f2e12b4715519787214639f718a442708f142e25 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 10:56:35 +0100 Subject: [PATCH 054/254] defined DYN_DRV --- include/supervision.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/supervision.h b/include/supervision.h index 492346492..f3ae1c25e 100644 --- a/include/supervision.h +++ b/include/supervision.h @@ -125,6 +125,9 @@ extern unsigned char sv_timer_dma_counter; #define JOY_START(v) ((v) & JOY_START_MASK) #define JOY_SELECT(v) ((v) & JOY_SELECT_MASK) +/* No support for dynamically loadable drivers */ +#define DYN_DRV 0 + /* The addresses of the static drivers */ extern void supervision_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ From 6034b68f0681c2edcf999a7f71cbb006f3b6e3e8 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Tue, 21 Nov 2017 22:42:43 +0100 Subject: [PATCH 055/254] Bumped API version. Removal of the joy_masks array with https://github.com/cc65/cc65/commit/7f52a770d9c6a43dde67689032bb3a4848eb6b30 was exactly the very type of change asking for a new API version. --- asminc/joy-kernel.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asminc/joy-kernel.inc b/asminc/joy-kernel.inc index ba969da1d..c8cc29820 100644 --- a/asminc/joy-kernel.inc +++ b/asminc/joy-kernel.inc @@ -55,7 +55,7 @@ ;------------------------------------------------------------------------------ ; The JOY API version, stored in JOY_HDR::VERSION -JOY_API_VERSION = $03 +JOY_API_VERSION = $04 ;------------------------------------------------------------------------------ ; Variables From ab54f920245c1ba0447cff1e3c6b93253438f043 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Tue, 21 Nov 2017 23:03:50 +0100 Subject: [PATCH 056/254] Make use of C library waitvsync(). --- samples/fire.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/samples/fire.c b/samples/fire.c index 44eb07c88..40eff0707 100644 --- a/samples/fire.c +++ b/samples/fire.c @@ -17,6 +17,7 @@ #include <string.h> /* for memset */ #include <time.h> #include <conio.h> +#include <cbm.h> @@ -60,9 +61,9 @@ #ifdef DOVSYNC -# define waitvsync() while ((signed char)VIC.ctrl1 >= 0) +# define WAITVSYNC() waitvsync() #else -# define waitvsync() +# define WAITVSYNC() #endif @@ -203,12 +204,12 @@ int main (void) while (!kbhit()) { /* Build page 1, then make it visible */ fire (SCREEN1); - waitvsync (); + WAITVSYNC (); outb (&VIC.addr, PAGE1); /* Build page 2, then make it visible */ fire (SCREEN2); - waitvsync (); + WAITVSYNC (); outb (&VIC.addr, PAGE2); /* Count frames */ From 44b13c1ca08c31289c2509d6626aa8bc56b601b6 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 22 Nov 2017 01:02:02 +0100 Subject: [PATCH 057/254] Subversion fallback If you use don't use Git to access the repository, you will still get a revision number. --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 8b41ceb9c..b70a3ffab 100644 --- a/src/Makefile +++ b/src/Makefile @@ -55,7 +55,7 @@ endif ifdef GIT_SHA $(info GIT_SHA: $(GIT_SHA)) else - GIT_SHA := $(shell git rev-parse --short HEAD 2>$(NULLDEV)) + GIT_SHA := $(shell git rev-parse --short HEAD 2>$(NULLDEV) || svnversion -n) ifneq ($(words $(GIT_SHA)),1) GIT_SHA := N/A $(info GIT_SHA: N/A) From 61b2264327c1756d2f883c9beb59aed3ae7c9c01 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 22 Nov 2017 01:35:42 +0100 Subject: [PATCH 058/254] Fix docs for #526 funcref.sgml is still growing and growing, how about outsourcing all TGI functions into tgi.sgml? --- doc/funcref.sgml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index e634a4f6f..e1ae5f8d8 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -184,6 +184,7 @@ function. <!-- <item><ref id="cbm_save" name="cbm_save"> --> <!-- <item><ref id="cbm_write" name="cbm_write"> --> <!-- <item><ref id="get_tv" name="get_tv"> --> +<item><ref id="waitvsync" name="waitvsync"> <item><ref id="kbrepeat" name="kbrepeat"> </itemize> @@ -362,7 +363,7 @@ function. <sect1><tt/geos.h/<label id="geos.h"><p> -(incomplete) +<url url="geos.html" name="GEOS API">. <sect1><tt/joystick.h/<label id="joystick.h"><p> @@ -7618,6 +7619,7 @@ used in presence of a prototype. <descrip> <tag/Function/Wait until the start of the next frame. <tag/Header/ +<tt/<ref id="cbm.h" name="cbm.h">/, <tt/<ref id="gamate.h" name="gamate.h">/, <tt/<ref id="nes.h" name="nes.h">/, <tt/<ref id="pce.h" name="pce.h">/ From 7e4db1fdd6c417d7f9919cf0f1f6ec4c699709df Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 22 Nov 2017 18:17:43 +0100 Subject: [PATCH 059/254] Option removed --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index b70a3ffab..5d45180a0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -55,7 +55,7 @@ endif ifdef GIT_SHA $(info GIT_SHA: $(GIT_SHA)) else - GIT_SHA := $(shell git rev-parse --short HEAD 2>$(NULLDEV) || svnversion -n) + GIT_SHA := $(shell git rev-parse --short HEAD 2>$(NULLDEV) || svnversion) ifneq ($(words $(GIT_SHA)),1) GIT_SHA := N/A $(info GIT_SHA: N/A) From 19122872311ef46a13d5bbbe33417ae133c96e4a Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Sat, 25 Nov 2017 13:25:01 -0500 Subject: [PATCH 060/254] Added missing names for the CIA registers in the C64/C128. --- asminc/c128.inc | 30 ++++++++++++++++++------------ asminc/c64.inc | 30 ++++++++++++++++++------------ 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/asminc/c128.inc b/asminc/c128.inc index 9e9acc5a8..745a3ad6d 100644 --- a/asminc/c128.inc +++ b/asminc/c128.inc @@ -171,30 +171,36 @@ VDC_INDEX := $D600 VDC_DATA := $D601 ; --------------------------------------------------------------------------- -; I/O: CIAs +; I/O: Complex Interface Adapters CIA1 := $DC00 -CIA1_PRA := $DC00 -CIA1_PRB := $DC01 -CIA1_DDRA := $DC02 -CIA1_DDRB := $DC03 -CIA1_TOD10 := $DC08 -CIA1_TODSEC := $DC09 -CIA1_TODMIN := $DC0A -CIA1_TODHR := $DC0B -CIA1_ICR := $DC0D -CIA1_CRA := $DC0E -CIA1_CRB := $DC0F +CIA1_PRA := $DC00 ; Port A +CIA1_PRB := $DC01 ; Port B +CIA1_DDRA := $DC02 ; Data direction register for port A +CIA1_DDRB := $DC03 ; Data direction register for port B +CIA1_TA := $DC04 ; 16-bit timer A +CIA1_TB := $DC06 ; 16-bit timer B +CIA1_TOD10 := $DC08 ; Time-of-day tenths of a second +CIA1_TODSEC := $DC09 ; Time-of-day seconds +CIA1_TODMIN := $DC0A ; Time-of-day minutes +CIA1_TODHR := $DC0B ; Time-of-day hours +CIA1_SDR := $DC0C ; Serial data register +CIA1_ICR := $DC0D ; Interrupt control register +CIA1_CRA := $DC0E ; Control register for timer A +CIA1_CRB := $DC0F ; Control register for timer B CIA2 := $DD00 CIA2_PRA := $DD00 CIA2_PRB := $DD01 CIA2_DDRA := $DD02 CIA2_DDRB := $DD03 +CIA2_TA := $DD04 +CIA2_TB := $DD06 CIA2_TOD10 := $DD08 CIA2_TODSEC := $DD09 CIA2_TODMIN := $DD0A CIA2_TODHR := $DD0B +CIA2_SDR := $DD0C CIA2_ICR := $DD0D CIA2_CRA := $DD0E CIA2_CRB := $DD0F diff --git a/asminc/c64.inc b/asminc/c64.inc index 00b66a64f..c12f8e64b 100644 --- a/asminc/c64.inc +++ b/asminc/c64.inc @@ -165,30 +165,36 @@ VDC_INDEX := $D600 VDC_DATA := $D601 ; --------------------------------------------------------------------------- -; I/O: CIAs +; I/O: Complex Interface Adapters CIA1 := $DC00 -CIA1_PRA := $DC00 -CIA1_PRB := $DC01 -CIA1_DDRA := $DC02 -CIA1_DDRB := $DC03 -CIA1_TOD10 := $DC08 -CIA1_TODSEC := $DC09 -CIA1_TODMIN := $DC0A -CIA1_TODHR := $DC0B -CIA1_ICR := $DC0D -CIA1_CRA := $DC0E -CIA1_CRB := $DC0F +CIA1_PRA := $DC00 ; Port A +CIA1_PRB := $DC01 ; Port B +CIA1_DDRA := $DC02 ; Data direction register for port A +CIA1_DDRB := $DC03 ; Data direction register for port B +CIA1_TA := $DC04 ; 16-bit timer A +CIA1_TB := $DC06 ; 16-bit timer B +CIA1_TOD10 := $DC08 ; Time-of-day tenths of a second +CIA1_TODSEC := $DC09 ; Time-of-day seconds +CIA1_TODMIN := $DC0A ; Time-of-day minutes +CIA1_TODHR := $DC0B ; Time-of-day hours +CIA1_SDR := $DC0C ; Serial data register +CIA1_ICR := $DC0D ; Interrupt control register +CIA1_CRA := $DC0E ; Control register for timer A +CIA1_CRB := $DC0F ; Control register for timer B CIA2 := $DD00 CIA2_PRA := $DD00 CIA2_PRB := $DD01 CIA2_DDRA := $DD02 CIA2_DDRB := $DD03 +CIA2_TA := $DD04 +CIA2_TB := $DD06 CIA2_TOD10 := $DD08 CIA2_TODSEC := $DD09 CIA2_TODMIN := $DD0A CIA2_TODHR := $DD0B +CIA2_SDR := $DD0C CIA2_ICR := $DD0D CIA2_CRA := $DD0E CIA2_CRB := $DD0F From 41df21855af7de8d6dde7be632dfc8e7af2cda6b Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Sat, 25 Nov 2017 19:31:36 +0100 Subject: [PATCH 061/254] Splitting of funcref --- doc/funcref.sgml | 1021 +-------------------------------------------- doc/index.sgml | 3 + doc/tgi.sgml | 1037 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1042 insertions(+), 1019 deletions(-) create mode 100644 doc/tgi.sgml diff --git a/doc/funcref.sgml b/doc/funcref.sgml index e634a4f6f..f74630ae3 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -676,52 +676,8 @@ communication. <sect1><tt/tgi.h/<label id="tgi.h"><p> -<itemize> -<item><ref id="tgi_arc" name="tgi_arc"> -<item><ref id="tgi_bar" name="tgi_bar"> -<item><ref id="tgi_circle" name="tgi_circle"> -<item><ref id="tgi_clear" name="tgi_clear"> -<item><ref id="tgi_done" name="tgi_done"> -<item><ref id="tgi_ellipse" name="tgi_ellipse"> -<item><ref id="tgi_free_vectorfont" name="tgi_free_vectorfont"> -<item><ref id="tgi_getaspectratio" name="tgi_getaspectratio"> -<item><ref id="tgi_getcolor" name="tgi_getcolor"> -<item><ref id="tgi_getcolorcount" name="tgi_getcolorcount"> -<item><ref id="tgi_getdefpalette" name="tgi_getdefpalette"> -<item><ref id="tgi_geterror" name="tgi_geterror"> -<item><ref id="tgi_geterrormsg" name="tgi_geterrormsg"> -<item><ref id="tgi_getmaxcolor" name="tgi_getmaxcolor"> -<item><ref id="tgi_getmaxx" name="tgi_getmaxx"> -<item><ref id="tgi_getmaxy" name="tgi_getmaxy"> -<item><ref id="tgi_getpagecount" name="tgi_getpagecount"> -<item><ref id="tgi_getpalette" name="tgi_getpalette"> -<item><ref id="tgi_getpixel" name="tgi_getpixel"> -<item><ref id="tgi_gettextheight" name="tgi_gettextheight"> -<item><ref id="tgi_gettextwidth" name="tgi_gettextwidth"> -<item><ref id="tgi_getxres" name="tgi_getxres"> -<item><ref id="tgi_getyres" name="tgi_getyres"> -<item><ref id="tgi_gotoxy" name="tgi_gotoxy"> -<item><ref id="tgi_init" name="tgi_init"> -<item><ref id="tgi_install" name="tgi_install"> -<item><ref id="tgi_install_vectorfont" name="tgi_install_vectorfont"> -<item><ref id="tgi_ioctl" name="tgi_ioctl"> -<item><ref id="tgi_line" name="tgi_line"> -<item><ref id="tgi_lineto" name="tgi_lineto"> -<item><ref id="tgi_load_driver" name="tgi_load_driver"> -<item><ref id="tgi_load_vectorfont" name="tgi_load_vectorfont"> -<item><ref id="tgi_outtext" name="tgi_outtext"> -<item><ref id="tgi_outtextxy" name="tgi_outtextxy"> -<item><ref id="tgi_setaspectratio" name="tgi_setaspectratio"> -<item><ref id="tgi_setcolor" name="tgi_setcolor"> -<item><ref id="tgi_setdrawpage" name="tgi_setdrawpage"> -<item><ref id="tgi_setpalette" name="tgi_setpalette"> -<item><ref id="tgi_setpixel" name="tgi_setpixel"> -<item><ref id="tgi_setviewpage" name="tgi_setviewpage"> -<item><ref id="tgi_settextscale" name="tgi_settextscale"> -<item><ref id="tgi_settextstyle" name="tgi_settextstyle"> -<item><ref id="tgi_uninstall" name="tgi_uninstall"> -<item><ref id="tgi_unload" name="tgi_unload"> -</itemize> +<url url="tgi.html" name="Tiny Graphics Interface">. + <sect1><tt/time.h/<label id="time.h"><p> @@ -6389,979 +6345,6 @@ be used in presence of a prototype. </quote> -<sect1>tgi_arc<label id="tgi_arc"><p> - -<quote> -<descrip> -<tag/Function/Draw an elliptic arc in the current color. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_arc (int x, int y, -unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/ -<tag/Description/The function draws an elliptic arc with center at x/y and -radii rx/ry using the current drawing color. The arc covers the angle -between sa and ea (startangle and endangle), which must be in the range -0..360. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -<item>The function behaves unexpectedly or may crash if the angles are out -of range. -</itemize> -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_bar" name="tgi_bar">, -<ref id="tgi_circle" name="tgi_circle">, -<ref id="tgi_ellipse" name="tgi_ellipse">, -<ref id="tgi_pieslice" name="tgi_pieslice">, -<ref id="tgi_setcolor" name="tgi_setcolor"> -<tag/Example/<verb> -/* Draw the upper half of an ellipse */ -tgi_setcolor(TGI_COLOR_BLUE); -tgi_arc (50, 50, 40, 20, 0, 180); -</verb> -</descrip> -</quote> - - -<sect1>tgi_bar<label id="tgi_bar"><p> - -<quote> -<descrip> -<tag/Function/The function fills a rectangle on the drawpage with the current -color. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);/ -<tag/Description/The function fills a rectangle on the drawpage with the current -color. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi function -<tag/Example/<verb> -tgi_setcolor(TGI_COLOR_GREEN); -tgi_bar(10, 10, 100, 60); -</verb> -</descrip> -</quote> - - -<sect1>tgi_circle<label id="tgi_circle"><p> - -<quote> -<descrip> -<tag/Function/The function draws a circle in the current color. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_circle (int x, int y, unsigned char radius);/ -<tag/Description/The function draws a circle in the current color. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_arc" name="tgi_arc">, -<ref id="tgi_bar" name="tgi_bar">, -<ref id="tgi_ellipse" name="tgi_ellipse">, -<ref id="tgi_pieslice" name="tgi_pieslice">, -<ref id="tgi_setcolor" name="tgi_setcolor"> -<tag/Example/<verb> -tgi_setcolor(TGI_COLOR_BLACK); -tgi_circle(50, 40, 40); -</verb> -</descrip> -</quote> - - -<sect1>tgi_clear<label id="tgi_clear"><p> - -<quote> -<descrip> -<tag/Function/Clear the drawpage -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void tgi_clear (void);/ -<tag/Description/Clear the drawpage -<tag/Availability/cc65 -<tag/See also/Other tgi functions -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_done<label id="tgi_done"><p> - -<quote> -<descrip> -<tag/Function/End graphics mode, switch back to text mode. -Will NOT uninstall or unload the driver! -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void tgi_done (void);/ -<tag/Description/End graphics mode, switch back to text mode. -Will NOT uninstall or unload the driver! -<tag/Availability/cc65 -<tag/See also/Other tgi functions -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_ellipse<label id="tgi_ellipse"><p> - -<quote> -<descrip> -<tag/Function/The function draws an ellipse in the current color. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_ellipse (int x, int y, unsigned char rx, unsigned char ry);/ -<tag/Description/The function draws an ellipse at position x/y with radii -rx and ry, using the current drawing color. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_arc" name="tgi_arc">, -<ref id="tgi_bar" name="tgi_bar">, -<ref id="tgi_circle" name="tgi_circle">, -<ref id="tgi_pieslice" name="tgi_pieslice">, -<ref id="tgi_setcolor" name="tgi_setcolor"> -<tag/Example/<verb> -tgi_setcolor(TGI_COLOR_RED); -tgi_ellipse (50, 40, 40, 20); -</verb> -</descrip> -</quote> - - -<sect1>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p> - -<quote> -<descrip> -<tag/Function/Free a vector font that was previously loaded into memory. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_free_vectorfont (const tgi_vectorfont* font);/ -<tag/Description/Free a vector font that was previously loaded into memory. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">, -<ref id="tgi_install_vectorfont" name="tgi_install_vectorfont"> -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_getaspectratio<label id="tgi_getaspectratio"><p> - -<quote> <descrip> <tag/Function/Return the pixel aspect ratio. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned tgi_getaspectratio (void);/ -<tag/Description/The function returns the pixel aspect ratio for the current -driver and display as an 8.8 fixed point value. It may be used to correct -geometric shapes so they look correct on the display. As an example, a circle -with a radius of 100 pixels may look elliptic on some driver/display -combinations if the aspect ratio is not 1.00. -<tag/Notes/<itemize> -<item>The aspect ratio is encoded in the TGI driver which assumes a "standard" -monitor for the given platform. The aspect ratio may be wrong if another -monitor is used. -<item>No TGI function will use the aspect ratio. It is up to the programmer to -make use of it. -<item>The <ref id="tgi_setaspectratio" name="tgi_setaspectratio"> function can -be used to change the aspect ratio for a loaded driver. The value is not reset -by <ref id="tgi_init" name="tgi_init">, so if a driver is linked statically to -an application, switching into and out of graphics mode will not restore the -original aspect ratio. -</itemize> -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_setaspectratio" name="tgi_setaspectratio"> -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_getcolor<label id="tgi_getcolor"><p> - -<quote> -<descrip> -<tag/Function/Return the current drawing color. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned char tgi_getcolor (void);/ -<tag/Description/The actual color is an index to a palette. During tgi_init -you will get a default palette. The number of colors depend on the platform. -All platforms recognize at least TGI_COLOR_BLACK and TGI_COLOR_WHITE. But some -platforms have many more predefined colors. If you paint using TGI_COLOR_GREEN -and then you change the green of the palette to blue using tgi_setpalette then -after this painting in TGI_COLOR_GREEN will actually be blue. -<tag/Availability/cc65 -<tag/See also/Other tgi functions -<tag/Example/<verb> -color = tgi_getcolor(); -</verb> -</descrip> -</quote> - - -<sect1>tgi_getcolorcount<label id="tgi_getcolorcount"><p> - -<quote> -<descrip> -<tag/Function/Get the number of available colors. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned char tgi_getcolorcount (void);/ -<tag/Description/Tgi platforms use indexed color palettes. This function -returns the number of entries we can use in the palette. -<tag/Availability/cc65 -<tag/See also/Other tgi functions -<tag/Example/<verb> -if (tgi_getcolorcount() == 2) { - printf("Only monochrome graphics is supported\n"); -} -</verb> -</descrip> -</quote> - - -<sect1>tgi_getdefpalette<label id="tgi_getdefpalette"><p> - -<quote> -<descrip> -<tag/Function/Get the palette installed by default. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/const unsigned char* tgi_getdefpalette (void);/ -<tag/Description/The tgi driver has a default palette that is active at startup. -The named colors TGI_COLOR_BLACK, TGI_COLOR_WHITE, TGI_COLOR_RED... need this -palette to work correctly. -<tag/Availability/cc65 -<tag/See also/Other tgi functions -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_geterror<label id="tgi_geterror"><p> - -<quote> -<descrip> -<tag/Function/Return the error code for the last operation. -This will also clear the error. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned char tgi_geterror (void);/ -<tag/Description/Return the error code for the last operation. -This will also clear the error. -<tag/Availability/cc65 -<tag/See also/Other tgi functions -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_geterrormsg<label id="tgi_geterrormsg"><p> - -<quote> -<descrip> -<tag/Function/Get an error message describing the error. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/const char* __fastcall__ tgi_geterrormsg (unsigned char code);/ -<tag/Description/Get an error message describing the error. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p> - -<quote> -<descrip> -<tag/Function/Get the highest index of the palette. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned char tgi_getmaxcolor (void);/ -<tag/Description/Get the highest index of the palette. -<tag/Availability/cc65 -<tag/See also/Other tgi functions -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_getmaxx<label id="tgi_getmaxx"><p> - -<quote> -<descrip> -<tag/Function/Get the maximum x coordinate that can be used on this screen. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned tgi_getmaxx (void);/ -<tag/Description/Get the maximum x coordinate that can be used on this screen. -<tag/Availability/cc65 -<tag/See also/Other tgi functions -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_getmaxy<label id="tgi_getmaxy"><p> - -<quote> -<descrip> -<tag/Function/Get the maximum y coordinate that can be used on this screen. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned tgi_getmaxy (void);/ -<tag/Description/Get the maximum y coordinate that can be used on this screen. -<tag/Availability/cc65 -<tag/See also/Other tgi functions -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_getpagecount<label id="tgi_getpagecount"><p> - -<quote> -<descrip> -<tag/Function/Return the number of screen pages available. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned tgi_getpagecount (void);/ -<tag/Description/Return the number of screen pages available. -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_setdrawpage" name="tgi_setdrawpage">, -<ref id="tgi_setviewpage" name="tgi_setviewpage"> -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_getpalette<label id="tgi_getpalette"><p> - -<quote> -<descrip> -<tag/Function/Get the palette installed. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/const unsigned char* tgi_getpalette (void);/ -<tag/Description/Get the palette installed. -<tag/Availability/cc65 -<tag/See also/Other tgi functions -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_getpixel<label id="tgi_getpixel"><p> - -<quote> -<descrip> -<tag/Function/Get the color of a pixel from the viewpage. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned char __fastcall__ tgi_getpixel (int x, int y);/ -<tag/Description/Get the color of a pixel from the viewpage. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_getxres<label id="tgi_getxres"><p> - -<quote> -<descrip> -<tag/Function/Get number of horisontal pixels on the screen. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned tgi_getxres (void);/ -<tag/Description/Get number of horisontal pixels on the screen. -This is same as tgi_maxx()+1. -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_getyres<label id="tgi_getyres"><p> - -<quote> -<descrip> -<tag/Function/Get number of vertical pixels on the screen. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned tgi_getyres (void);/ -<tag/Description/Get number of vertical pixels on the screen. -This is same as tgi_maxy()+1. -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_gotoxy<label id="tgi_gotoxy"><p> - -<quote> -<descrip> -<tag/Function/Set graphics cursor at x, y. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_gotoxy (int x, int y);/ -<tag/Description/Set graphics cursor at x, y. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_init<label id="tgi_init"><p> - -<quote> -<descrip> -<tag/Function/Initialize the already loaded graphics driver. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void tgi_init (void);/ -<tag/Description/The tgi_init function will set the default palette to the -hardware. -<tag/Notes/<itemize> -<item><tt/tgi_init/ will not clear the screen. This allows switching between -text and graphics mode on platforms that have separate memory areas for the -screens. If you want the screen cleared, call <tt/<ref id="tgi_clear" -name="tgi_clear">/ after <tt/tgi_init/. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/<verb> -tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it. -tgi_init(); //Set up the default palette and clear the screen. -</verb> -</descrip> -</quote> - - -<sect1>tgi_install<label id="tgi_install"><p> - -<quote> -<descrip> -<tag/Function/Install an already loaded driver and return an error code. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned char __fastcall__ tgi_install (void* driver);/ -<tag/Description/The function installs a driver that was already loaded into -memory (or linked statically to the program). It returns an error code -(<tt/TGI_ERR_OK/ in case of success). -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only be -used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_load_driver" name="tgi_load_driver">, -<ref id="tgi_uninstall" name="tgi_uninstall">, -<ref id="tgi_unload" name="tgi_unload"> -<tag/Example/<verb> -tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it. -tgi_init(); //Set up the default palette and clear the screen. -</verb> -</descrip> -</quote> - - -<sect1>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p> - -<quote> -<descrip> -<tag/Function/Install an already loaded driver and return an error code. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_install_vectorfont (const tgi_vectorfont* font);/ -<tag/Description/ -Install a vector font for use. More than one vector font can be loaded, -but only one can be active. This function is used to tell which one. Call -with a NULL pointer to uninstall the currently installed font. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only be -used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">, -<ref id="tgi_free_vectorfont" name="tgi_free_vectorfont"> -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_ioctl<label id="tgi_ioctl"><p> - -<quote> -<descrip> -<tag/Function/Platform dependent code extensions. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data);/ -<tag/Description/Some platforms have extra display hardware that is not -supported by standard tgi functions. You can extend the driver to support -this extra hardware using tgi_ioctl functions. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -<item>These functions are not easily portable to other cc65 platforms. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/<verb> -#define tgi_sprite(spr) tgi_ioctl(0, (void*)(spr)) -#define tgi_flip() tgi_ioctl(1, (void*)0) -#define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol)) -#define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate)) -#define tgi_busy() tgi_ioctl(4, (void*)0) -#define tgi_updatedisplay() tgi_ioctl(4, (void*)1) -if (!tgi_busy()) { - tgi_sprite(&background); - tgi_setcolor(TGI_COLOR_BLUE); - tgi_outttextxy(20,40,"Hello World"); - tgi_updatedisplay(); -} -</verb> -</descrip> -</quote> - - -<sect1>tgi_line<label id="tgi_line"><p> - -<quote> -<descrip> -<tag/Function/Draw a line in the current drawing color. -The graphics cursor will be set to x2/y2 by this call. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);/ -<tag/Description/Draw a line in the current drawing color. -The graphics cursor will be set to x2/y2 by this call. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_lineto<label id="tgi_lineto"><p> - -<quote> -<descrip> -<tag/Function/Draw a line in the current drawing color from the graphics -cursor to the new end point. The graphics cursor will be updated to x2/y2. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_lineto (int x2, int y2);/ -<tag/Description/Draw a line in the current drawing color from the graphics -cursor to the new end point. The graphics cursor will be updated to x2/y2. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_load_driver<label id="tgi_load_driver"><p> - -<quote> -<descrip> -<tag/Function/Load and install the given driver. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_load_driver (const char *name);/ -<tag/Description/Load and install the driver by name. -Will just load the driver and check if loading was successful. -Will not switch to graphics mode. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p> - -<quote> -<descrip> -<tag/Function/Load the given vector font. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/const tgi_vectorfont* __fastcall__ tgi_load_vectorfont (const char* name);/ -<tag/Description/ -Load a vector font into memory and return it. In case of errors, NULL is -returned and an error is set, which can be retrieved using tgi_geterror. -To use the font, it has to be installed using tgi_install_vectorfont. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">, -<ref id="tgi_free_vectorfont" name="tgi_free_vectorfont"> -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_outtext<label id="tgi_outtext"><p> - -<quote> -<descrip> -<tag/Function/Output text at the current graphics cursor position. -The graphics cursor is moved to the end of the text. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_outtext (const char* s);/ -<tag/Description/Output text at the current graphics cursor position. -The graphics cursor is moved to the end of the text. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_outtextxy<label id="tgi_outtextxy"><p> - -<quote> -<descrip> -<tag/Function/Output text at the given cursor position. -The graphics cursor is moved to the end of the text. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_outtextxy (int x, int y, const char* s);/ -<tag/Description/Output text at the given cursor position. -The graphics cursor is moved to the end of the text. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_pieslice<label id="tgi_pieslice"><p> - -<quote> -<descrip> -<tag/Function/Draw an elliptic pie slice in the current color. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_pie slice (int x, int y, -unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/ -<tag/Description/The function draws an elliptic pie slice with center at x/y -and radii rx/ry using the current drawing color. The pie slice covers the angle -between sa and ea (startangle and endangle), which must be in the range -0..360. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -<item>The function behaves unexpectedly or may crash if the angles are out -of range. -</itemize> -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_bar" name="tgi_arc">, -<ref id="tgi_bar" name="tgi_bar">, -<ref id="tgi_circle" name="tgi_circle">, -<ref id="tgi_ellipse" name="tgi_ellipse">, -<ref id="tgi_setcolor" name="tgi_setcolor"> -<tag/Example/<verb> -/* Draw the closed upper half of an ellipse */ -tgi_setcolor(TGI_COLOR_BLUE); -tgi_pieslice (50, 50, 40, 20, 0, 180); -</verb> -</descrip> -</quote> - - -<sect1>tgi_setaspectratio<label id="tgi_setaspectratio"><p> - -<quote> <descrip> <tag/Function/Set the pixel aspect ratio. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_setaspectratio (unsigned ratio);/ -<tag/Description/The function sets the pixel aspect ratio for the current -driver and display. The argument is an 8.8 fixed point value. The aspect ratio -may be used to correct geometric shapes so they look correct on a given -display. As an example, a circle with a radius of 100 pixels may look elliptic -on some driver/display combinations if the aspect ratio is not 1.00. -<tag/Notes/<itemize> -<item>The aspect ratio is encoded in the TGI driver which assumes a "standard" -monitor for the given platform. The aspect ratio may be wrong if another -monitor is used. -<item>No TGI function will use the aspect ratio. It is up to the programmer to -make use of it. -<item>The <tt/tgi_setaspectratio/ function can be used to change the aspect -ratio for a loaded driver. The value is not reset by <ref id="tgi_init" -name="tgi_init">, so if a driver is linked statically to an application, -switching into and out of graphics mode will not restore the original aspect -ratio. -<item>The function is available only as a fastcall function; so, it may be used -only in the presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_getaspectratio" name="tgi_getaspectratio"> -<tag/Example/None. -</descrip> -</quote> - - -<sect1>tgi_setcolor<label id="tgi_setcolor"><p> - -<quote> -<descrip> -<tag/Function/Set color to be used in future draw operations. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_setcolor (unsigned char color);/ -<tag/Description/Set color to be used in future draw operations. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/<verb> -tgi_setcolor(TGI_COLOR_BLACK); -tgi_bar(0,0,30,30); -tgi_setcolor(TGI_COLOR_WHITE); -tgi_bar(10,10,20,20); -</verb> -</descrip> -</quote> - -<sect1>tgi_setdrawpage<label id="tgi_setdrawpage"><p> - -<quote> -<descrip> -<tag/Function/Set the page for drawing. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_setdrawpage (unsigned char page);/ -<tag/Description/If the drawpage and the viewpage are the same then all drawing -is seen immediately as it is drawn. For double buffered games you can set the -drawpage to a different page than the viewpage. This lets you draw the next -screen in the background and when the screen is ready you display it. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/<verb> -tgi_setdrawpage(1); -tgi_outtextxy(10, 10, "Hello World"); -tgi_setviewpage(1); // Show page 1 -tgi_setdrawpage(0); -tgi_outtextxy(10, 10, "Creating next frame"); -... -tgi_setviewpage(0); // Show page 0 -</verb> -</descrip> -</quote> - -<sect1>tgi_setpalette<label id="tgi_setpalette"><p> - -<quote> -<descrip> -<tag/Function/Set the palette (not available with all drivers/hardware). -Palette is a pointer to as many entries as there are colors. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_setpalette (const unsigned char* palette);/ -<tag/Description/Set the palette (not available with all drivers/hardware). -Palette is a pointer to as many entries as there are colors. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - -<sect1>tgi_setpixel<label id="tgi_setpixel"><p> - -<quote> -<descrip> -<tag/Function/Plot a pixel on the drawpage with the current color. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_setpixel (int x, int y);/ -<tag/Description/Plot a pixel on the drawpage with the current color. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - -<sect1>tgi_setviewpage<label id="tgi_setviewpage"><p> - -<quote> -<descrip> -<tag/Function/Set page to be visible on screen. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_setviewpage (unsigned char page);/ -<tag/Description/If the drawpage and the viewpage are the same then all drawing -is seen immediately as it is drawn. For double buffered games you can set the -drawpage to a different page than the viewpage. This lets you draw the next -screen in the background and when the screen is ready you display it. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/<verb> -tgi_setdrawpage(1); -tgi_outtextxy(10, 10, "Hello World"); -tgi_setviewpage(1); // Show page 1 -tgi_setdrawpage(0); -tgi_outtextxy(10, 10, "Creating next frame"); -... -tgi_setviewpage(0); // Show page 0 -</verb> -</descrip> -</quote> - -<sect1>tgi_gettextheight<label id="tgi_gettextheight"><p> - -<quote> -<descrip> -<tag/Function/Calculate the height of the text in pixels according to -the current text style. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/ -<tag/Description/Calculate the height of the text in pixels according to -the current text style. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - -<sect1>tgi_settextscale<label id="tgi_settextscale"><p> - -<quote> -<descrip> -<tag/Function/Set the scaling for text output. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_settextscale (unsigned width, unsigned height);/ -<tag/Description/ -Set the scaling for text output. The scaling factors for width and height -are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_settextstyle" name="tgi_settextstyle"> -<tag/Example/None. -</descrip> -</quote> - -<sect1>tgi_settextstyle<label id="tgi_settextstyle"><p> - -<quote> -<descrip> -<tag/Function/Set the style for text output. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir, unsigned char font);/ -<tag/Description/Set the style for text output. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/ -<ref id="tgi_settextscale" name="tgi_settextscale"> -<tag/Example/None. -</descrip> -</quote> - -<sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p> - -<quote> -<descrip> -<tag/Function/Calculate the width of the text in pixels according to the current text style. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/ -<tag/Description/Calculate the width of the text in pixels according to the current text style. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - -<sect1>tgi_uninstall<label id="tgi_uninstall"><p> - -<quote> -<descrip> -<tag/Function/Uninstall the currently loaded driver but do not unload it. -Will call tgi_done if necessary. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void tgi_uninstall (void);/ -<tag/Description/Uninstall the currently loaded driver but do not unload it. -Will call tgi_done if necessary. -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - -<sect1>tgi_unload<label id="tgi_unload"><p> - -<quote> -<descrip> -<tag/Function/Uninstall, then unload the currently loaded driver. -Will call tgi_done if necessary. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void tgi_unload (void);/ -<tag/Description/Uninstall, then unload the currently loaded driver. -Will call tgi_done if necessary. -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - <sect1>time<label id="time"><p> <quote> diff --git a/doc/index.sgml b/doc/index.sgml index 99b4f10b5..a7aa06037 100644 --- a/doc/index.sgml +++ b/doc/index.sgml @@ -85,6 +85,9 @@ <tag><htmlurl url="dio.html" name="dio.html"></tag> Low-level disk I/O API. + <tag><htmlurl url="tgi.html" name="tgi.html"></tag> + Tiny Graphics Interface. + <tag><htmlurl url="geos.html" name="geos.html"></tag> The GEOSLib manual. diff --git a/doc/tgi.sgml b/doc/tgi.sgml new file mode 100644 index 000000000..3bab58f57 --- /dev/null +++ b/doc/tgi.sgml @@ -0,0 +1,1037 @@ +<!doctype linuxdoc system> + +<article> +<title>Tiny Graphics Interface +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> +<date>2017-11-23 + +<abstract> +The cc65 library provides functions for platform independent graphics. +Include the tgi.h header file to get the necessary definitions. +</abstract> + +<!-- Table of contents --> +<itemize> +<item><ref id="tgi_arc" name="tgi_arc"> +<item><ref id="tgi_bar" name="tgi_bar"> +<item><ref id="tgi_circle" name="tgi_circle"> +<item><ref id="tgi_clear" name="tgi_clear"> +<item><ref id="tgi_done" name="tgi_done"> +<item><ref id="tgi_ellipse" name="tgi_ellipse"> +<item><ref id="tgi_free_vectorfont" name="tgi_free_vectorfont"> +<item><ref id="tgi_getaspectratio" name="tgi_getaspectratio"> +<item><ref id="tgi_getcolor" name="tgi_getcolor"> +<item><ref id="tgi_getcolorcount" name="tgi_getcolorcount"> +<item><ref id="tgi_getdefpalette" name="tgi_getdefpalette"> +<item><ref id="tgi_geterror" name="tgi_geterror"> +<item><ref id="tgi_geterrormsg" name="tgi_geterrormsg"> +<item><ref id="tgi_getmaxcolor" name="tgi_getmaxcolor"> +<item><ref id="tgi_getmaxx" name="tgi_getmaxx"> +<item><ref id="tgi_getmaxy" name="tgi_getmaxy"> +<item><ref id="tgi_getpagecount" name="tgi_getpagecount"> +<item><ref id="tgi_getpalette" name="tgi_getpalette"> +<item><ref id="tgi_getpixel" name="tgi_getpixel"> +<item><ref id="tgi_gettextheight" name="tgi_gettextheight"> +<item><ref id="tgi_gettextwidth" name="tgi_gettextwidth"> +<item><ref id="tgi_getxres" name="tgi_getxres"> +<item><ref id="tgi_getyres" name="tgi_getyres"> +<item><ref id="tgi_gotoxy" name="tgi_gotoxy"> +<item><ref id="tgi_init" name="tgi_init"> +<item><ref id="tgi_install" name="tgi_install"> +<item><ref id="tgi_install_vectorfont" name="tgi_install_vectorfont"> +<item><ref id="tgi_ioctl" name="tgi_ioctl"> +<item><ref id="tgi_line" name="tgi_line"> +<item><ref id="tgi_lineto" name="tgi_lineto"> +<item><ref id="tgi_load_driver" name="tgi_load_driver"> +<item><ref id="tgi_load_vectorfont" name="tgi_load_vectorfont"> +<item><ref id="tgi_outtext" name="tgi_outtext"> +<item><ref id="tgi_outtextxy" name="tgi_outtextxy"> +<item><ref id="tgi_setaspectratio" name="tgi_setaspectratio"> +<item><ref id="tgi_setcolor" name="tgi_setcolor"> +<item><ref id="tgi_setdrawpage" name="tgi_setdrawpage"> +<item><ref id="tgi_setpalette" name="tgi_setpalette"> +<item><ref id="tgi_setpixel" name="tgi_setpixel"> +<item><ref id="tgi_setviewpage" name="tgi_setviewpage"> +<item><ref id="tgi_settextscale" name="tgi_settextscale"> +<item><ref id="tgi_settextstyle" name="tgi_settextstyle"> +<item><ref id="tgi_uninstall" name="tgi_uninstall"> +<item><ref id="tgi_unload" name="tgi_unload"> +</itemize> + +<!-- Begin the document --> + +<sect1>tgi_arc<label id="tgi_arc"><p> + +<quote> +<descrip> +<tag/Function/Draw an elliptic arc in the current color. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_arc (int x, int y, +unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/ +<tag/Description/The function draws an elliptic arc with center at x/y and +radii rx/ry using the current drawing color. The arc covers the angle +between sa and ea (startangle and endangle), which must be in the range +0..360. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +<item>The function behaves unexpectedly or may crash if the angles are out +of range. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_bar" name="tgi_bar">, +<ref id="tgi_circle" name="tgi_circle">, +<ref id="tgi_ellipse" name="tgi_ellipse">, +<ref id="tgi_pieslice" name="tgi_pieslice">, +<ref id="tgi_setcolor" name="tgi_setcolor"> +<tag/Example/<verb> +/* Draw the upper half of an ellipse */ +tgi_setcolor(TGI_COLOR_BLUE); +tgi_arc (50, 50, 40, 20, 0, 180); +</verb> +</descrip> +</quote> + + +<sect1>tgi_bar<label id="tgi_bar"><p> + +<quote> +<descrip> +<tag/Function/The function fills a rectangle on the drawpage with the current +color. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);/ +<tag/Description/The function fills a rectangle on the drawpage with the current +color. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi function +<tag/Example/<verb> +tgi_setcolor(TGI_COLOR_GREEN); +tgi_bar(10, 10, 100, 60); +</verb> +</descrip> +</quote> + + +<sect1>tgi_circle<label id="tgi_circle"><p> + +<quote> +<descrip> +<tag/Function/The function draws a circle in the current color. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_circle (int x, int y, unsigned char radius);/ +<tag/Description/The function draws a circle in the current color. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_arc" name="tgi_arc">, +<ref id="tgi_bar" name="tgi_bar">, +<ref id="tgi_ellipse" name="tgi_ellipse">, +<ref id="tgi_pieslice" name="tgi_pieslice">, +<ref id="tgi_setcolor" name="tgi_setcolor"> +<tag/Example/<verb> +tgi_setcolor(TGI_COLOR_BLACK); +tgi_circle(50, 40, 40); +</verb> +</descrip> +</quote> + + +<sect1>tgi_clear<label id="tgi_clear"><p> + +<quote> +<descrip> +<tag/Function/Clear the drawpage +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void tgi_clear (void);/ +<tag/Description/Clear the drawpage +<tag/Availability/cc65 +<tag/See also/Other tgi functions +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_done<label id="tgi_done"><p> + +<quote> +<descrip> +<tag/Function/End graphics mode, switch back to text mode. +Will NOT uninstall or unload the driver! +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void tgi_done (void);/ +<tag/Description/End graphics mode, switch back to text mode. +Will NOT uninstall or unload the driver! +<tag/Availability/cc65 +<tag/See also/Other tgi functions +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_ellipse<label id="tgi_ellipse"><p> + +<quote> +<descrip> +<tag/Function/The function draws an ellipse in the current color. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_ellipse (int x, int y, unsigned char rx, unsigned char ry);/ +<tag/Description/The function draws an ellipse at position x/y with radii +rx and ry, using the current drawing color. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_arc" name="tgi_arc">, +<ref id="tgi_bar" name="tgi_bar">, +<ref id="tgi_circle" name="tgi_circle">, +<ref id="tgi_pieslice" name="tgi_pieslice">, +<ref id="tgi_setcolor" name="tgi_setcolor"> +<tag/Example/<verb> +tgi_setcolor(TGI_COLOR_RED); +tgi_ellipse (50, 40, 40, 20); +</verb> +</descrip> +</quote> + + +<sect1>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p> + +<quote> +<descrip> +<tag/Function/Free a vector font that was previously loaded into memory. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_free_vectorfont (const tgi_vectorfont* font);/ +<tag/Description/Free a vector font that was previously loaded into memory. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">, +<ref id="tgi_install_vectorfont" name="tgi_install_vectorfont"> +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_getaspectratio<label id="tgi_getaspectratio"><p> + +<quote> <descrip> <tag/Function/Return the pixel aspect ratio. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned tgi_getaspectratio (void);/ +<tag/Description/The function returns the pixel aspect ratio for the current +driver and display as an 8.8 fixed point value. It may be used to correct +geometric shapes so they look correct on the display. As an example, a circle +with a radius of 100 pixels may look elliptic on some driver/display +combinations if the aspect ratio is not 1.00. +<tag/Notes/<itemize> +<item>The aspect ratio is encoded in the TGI driver which assumes a "standard" +monitor for the given platform. The aspect ratio may be wrong if another +monitor is used. +<item>No TGI function will use the aspect ratio. It is up to the programmer to +make use of it. +<item>The <ref id="tgi_setaspectratio" name="tgi_setaspectratio"> function can +be used to change the aspect ratio for a loaded driver. The value is not reset +by <ref id="tgi_init" name="tgi_init">, so if a driver is linked statically to +an application, switching into and out of graphics mode will not restore the +original aspect ratio. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_setaspectratio" name="tgi_setaspectratio"> +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_getcolor<label id="tgi_getcolor"><p> + +<quote> +<descrip> +<tag/Function/Return the current drawing color. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned char tgi_getcolor (void);/ +<tag/Description/The actual color is an index to a palette. During tgi_init +you will get a default palette. The number of colors depend on the platform. +All platforms recognize at least TGI_COLOR_BLACK and TGI_COLOR_WHITE. But some +platforms have many more predefined colors. If you paint using TGI_COLOR_GREEN +and then you change the green of the palette to blue using tgi_setpalette then +after this painting in TGI_COLOR_GREEN will actually be blue. +<tag/Availability/cc65 +<tag/See also/Other tgi functions +<tag/Example/<verb> +color = tgi_getcolor(); +</verb> +</descrip> +</quote> + + +<sect1>tgi_getcolorcount<label id="tgi_getcolorcount"><p> + +<quote> +<descrip> +<tag/Function/Get the number of available colors. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned char tgi_getcolorcount (void);/ +<tag/Description/Tgi platforms use indexed color palettes. This function +returns the number of entries we can use in the palette. +<tag/Availability/cc65 +<tag/See also/Other tgi functions +<tag/Example/<verb> +if (tgi_getcolorcount() == 2) { + printf("Only monochrome graphics is supported\n"); +} +</verb> +</descrip> +</quote> + + +<sect1>tgi_getdefpalette<label id="tgi_getdefpalette"><p> + +<quote> +<descrip> +<tag/Function/Get the palette installed by default. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/const unsigned char* tgi_getdefpalette (void);/ +<tag/Description/The tgi driver has a default palette that is active at startup. +The named colors TGI_COLOR_BLACK, TGI_COLOR_WHITE, TGI_COLOR_RED... need this +palette to work correctly. +<tag/Availability/cc65 +<tag/See also/Other tgi functions +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_geterror<label id="tgi_geterror"><p> + +<quote> +<descrip> +<tag/Function/Return the error code for the last operation. +This will also clear the error. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned char tgi_geterror (void);/ +<tag/Description/Return the error code for the last operation. +This will also clear the error. +<tag/Availability/cc65 +<tag/See also/Other tgi functions +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_geterrormsg<label id="tgi_geterrormsg"><p> + +<quote> +<descrip> +<tag/Function/Get an error message describing the error. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/const char* __fastcall__ tgi_geterrormsg (unsigned char code);/ +<tag/Description/Get an error message describing the error. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p> + +<quote> +<descrip> +<tag/Function/Get the highest index of the palette. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned char tgi_getmaxcolor (void);/ +<tag/Description/Get the highest index of the palette. +<tag/Availability/cc65 +<tag/See also/Other tgi functions +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_getmaxx<label id="tgi_getmaxx"><p> + +<quote> +<descrip> +<tag/Function/Get the maximum x coordinate that can be used on this screen. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned tgi_getmaxx (void);/ +<tag/Description/Get the maximum x coordinate that can be used on this screen. +<tag/Availability/cc65 +<tag/See also/Other tgi functions +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_getmaxy<label id="tgi_getmaxy"><p> + +<quote> +<descrip> +<tag/Function/Get the maximum y coordinate that can be used on this screen. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned tgi_getmaxy (void);/ +<tag/Description/Get the maximum y coordinate that can be used on this screen. +<tag/Availability/cc65 +<tag/See also/Other tgi functions +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_getpagecount<label id="tgi_getpagecount"><p> + +<quote> +<descrip> +<tag/Function/Return the number of screen pages available. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned tgi_getpagecount (void);/ +<tag/Description/Return the number of screen pages available. +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_setdrawpage" name="tgi_setdrawpage">, +<ref id="tgi_setviewpage" name="tgi_setviewpage"> +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_getpalette<label id="tgi_getpalette"><p> + +<quote> +<descrip> +<tag/Function/Get the palette installed. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/const unsigned char* tgi_getpalette (void);/ +<tag/Description/Get the palette installed. +<tag/Availability/cc65 +<tag/See also/Other tgi functions +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_getpixel<label id="tgi_getpixel"><p> + +<quote> +<descrip> +<tag/Function/Get the color of a pixel from the viewpage. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned char __fastcall__ tgi_getpixel (int x, int y);/ +<tag/Description/Get the color of a pixel from the viewpage. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_getxres<label id="tgi_getxres"><p> + +<quote> +<descrip> +<tag/Function/Get number of horisontal pixels on the screen. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned tgi_getxres (void);/ +<tag/Description/Get number of horisontal pixels on the screen. +This is same as tgi_maxx()+1. +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_getyres<label id="tgi_getyres"><p> + +<quote> +<descrip> +<tag/Function/Get number of vertical pixels on the screen. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned tgi_getyres (void);/ +<tag/Description/Get number of vertical pixels on the screen. +This is same as tgi_maxy()+1. +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_gotoxy<label id="tgi_gotoxy"><p> + +<quote> +<descrip> +<tag/Function/Set graphics cursor at x, y. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_gotoxy (int x, int y);/ +<tag/Description/Set graphics cursor at x, y. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_init<label id="tgi_init"><p> + +<quote> +<descrip> +<tag/Function/Initialize the already loaded graphics driver. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void tgi_init (void);/ +<tag/Description/The tgi_init function will set the default palette to the +hardware. +<tag/Notes/<itemize> +<item><tt/tgi_init/ will not clear the screen. This allows switching between +text and graphics mode on platforms that have separate memory areas for the +screens. If you want the screen cleared, call <tt/<ref id="tgi_clear" +name="tgi_clear">/ after <tt/tgi_init/. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/<verb> +tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it. +tgi_init(); //Set up the default palette and clear the screen. +</verb> +</descrip> +</quote> + + +<sect1>tgi_install<label id="tgi_install"><p> + +<quote> +<descrip> +<tag/Function/Install an already loaded driver and return an error code. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned char __fastcall__ tgi_install (void* driver);/ +<tag/Description/The function installs a driver that was already loaded into +memory (or linked statically to the program). It returns an error code +(<tt/TGI_ERR_OK/ in case of success). +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only be +used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_load_driver" name="tgi_load_driver">, +<ref id="tgi_uninstall" name="tgi_uninstall">, +<ref id="tgi_unload" name="tgi_unload"> +<tag/Example/<verb> +tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it. +tgi_init(); //Set up the default palette and clear the screen. +</verb> +</descrip> +</quote> + + +<sect1>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p> + +<quote> +<descrip> +<tag/Function/Install an already loaded driver and return an error code. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_install_vectorfont (const tgi_vectorfont* font);/ +<tag/Description/ +Install a vector font for use. More than one vector font can be loaded, +but only one can be active. This function is used to tell which one. Call +with a NULL pointer to uninstall the currently installed font. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only be +used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">, +<ref id="tgi_free_vectorfont" name="tgi_free_vectorfont"> +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_ioctl<label id="tgi_ioctl"><p> + +<quote> +<descrip> +<tag/Function/Platform dependent code extensions. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data);/ +<tag/Description/Some platforms have extra display hardware that is not +supported by standard tgi functions. You can extend the driver to support +this extra hardware using tgi_ioctl functions. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +<item>These functions are not easily portable to other cc65 platforms. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/<verb> +#define tgi_sprite(spr) tgi_ioctl(0, (void*)(spr)) +#define tgi_flip() tgi_ioctl(1, (void*)0) +#define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol)) +#define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate)) +#define tgi_busy() tgi_ioctl(4, (void*)0) +#define tgi_updatedisplay() tgi_ioctl(4, (void*)1) +if (!tgi_busy()) { + tgi_sprite(&background); + tgi_setcolor(TGI_COLOR_BLUE); + tgi_outttextxy(20,40,"Hello World"); + tgi_updatedisplay(); +} +</verb> +</descrip> +</quote> + + +<sect1>tgi_line<label id="tgi_line"><p> + +<quote> +<descrip> +<tag/Function/Draw a line in the current drawing color. +The graphics cursor will be set to x2/y2 by this call. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);/ +<tag/Description/Draw a line in the current drawing color. +The graphics cursor will be set to x2/y2 by this call. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_lineto<label id="tgi_lineto"><p> + +<quote> +<descrip> +<tag/Function/Draw a line in the current drawing color from the graphics +cursor to the new end point. The graphics cursor will be updated to x2/y2. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_lineto (int x2, int y2);/ +<tag/Description/Draw a line in the current drawing color from the graphics +cursor to the new end point. The graphics cursor will be updated to x2/y2. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_load_driver<label id="tgi_load_driver"><p> + +<quote> +<descrip> +<tag/Function/Load and install the given driver. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_load_driver (const char *name);/ +<tag/Description/Load and install the driver by name. +Will just load the driver and check if loading was successful. +Will not switch to graphics mode. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p> + +<quote> +<descrip> +<tag/Function/Load the given vector font. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/const tgi_vectorfont* __fastcall__ tgi_load_vectorfont (const char* name);/ +<tag/Description/ +Load a vector font into memory and return it. In case of errors, NULL is +returned and an error is set, which can be retrieved using tgi_geterror. +To use the font, it has to be installed using tgi_install_vectorfont. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">, +<ref id="tgi_free_vectorfont" name="tgi_free_vectorfont"> +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_outtext<label id="tgi_outtext"><p> + +<quote> +<descrip> +<tag/Function/Output text at the current graphics cursor position. +The graphics cursor is moved to the end of the text. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_outtext (const char* s);/ +<tag/Description/Output text at the current graphics cursor position. +The graphics cursor is moved to the end of the text. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_outtextxy<label id="tgi_outtextxy"><p> + +<quote> +<descrip> +<tag/Function/Output text at the given cursor position. +The graphics cursor is moved to the end of the text. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_outtextxy (int x, int y, const char* s);/ +<tag/Description/Output text at the given cursor position. +The graphics cursor is moved to the end of the text. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_pieslice<label id="tgi_pieslice"><p> + +<quote> +<descrip> +<tag/Function/Draw an elliptic pie slice in the current color. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_pie slice (int x, int y, +unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);/ +<tag/Description/The function draws an elliptic pie slice with center at x/y +and radii rx/ry using the current drawing color. The pie slice covers the angle +between sa and ea (startangle and endangle), which must be in the range +0..360. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +<item>The function behaves unexpectedly or may crash if the angles are out +of range. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_bar" name="tgi_arc">, +<ref id="tgi_bar" name="tgi_bar">, +<ref id="tgi_circle" name="tgi_circle">, +<ref id="tgi_ellipse" name="tgi_ellipse">, +<ref id="tgi_setcolor" name="tgi_setcolor"> +<tag/Example/<verb> +/* Draw the closed upper half of an ellipse */ +tgi_setcolor(TGI_COLOR_BLUE); +tgi_pieslice (50, 50, 40, 20, 0, 180); +</verb> +</descrip> +</quote> + + +<sect1>tgi_setaspectratio<label id="tgi_setaspectratio"><p> + +<quote> <descrip> <tag/Function/Set the pixel aspect ratio. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_setaspectratio (unsigned ratio);/ +<tag/Description/The function sets the pixel aspect ratio for the current +driver and display. The argument is an 8.8 fixed point value. The aspect ratio +may be used to correct geometric shapes so they look correct on a given +display. As an example, a circle with a radius of 100 pixels may look elliptic +on some driver/display combinations if the aspect ratio is not 1.00. +<tag/Notes/<itemize> +<item>The aspect ratio is encoded in the TGI driver which assumes a "standard" +monitor for the given platform. The aspect ratio may be wrong if another +monitor is used. +<item>No TGI function will use the aspect ratio. It is up to the programmer to +make use of it. +<item>The <tt/tgi_setaspectratio/ function can be used to change the aspect +ratio for a loaded driver. The value is not reset by <ref id="tgi_init" +name="tgi_init">, so if a driver is linked statically to an application, +switching into and out of graphics mode will not restore the original aspect +ratio. +<item>The function is available only as a fastcall function; so, it may be used +only in the presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_getaspectratio" name="tgi_getaspectratio"> +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_setcolor<label id="tgi_setcolor"><p> + +<quote> +<descrip> +<tag/Function/Set color to be used in future draw operations. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_setcolor (unsigned char color);/ +<tag/Description/Set color to be used in future draw operations. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/<verb> +tgi_setcolor(TGI_COLOR_BLACK); +tgi_bar(0,0,30,30); +tgi_setcolor(TGI_COLOR_WHITE); +tgi_bar(10,10,20,20); +</verb> +</descrip> +</quote> + +<sect1>tgi_setdrawpage<label id="tgi_setdrawpage"><p> + +<quote> +<descrip> +<tag/Function/Set the page for drawing. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_setdrawpage (unsigned char page);/ +<tag/Description/If the drawpage and the viewpage are the same then all drawing +is seen immediately as it is drawn. For double buffered games you can set the +drawpage to a different page than the viewpage. This lets you draw the next +screen in the background and when the screen is ready you display it. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/<verb> +tgi_setdrawpage(1); +tgi_outtextxy(10, 10, "Hello World"); +tgi_setviewpage(1); // Show page 1 +tgi_setdrawpage(0); +tgi_outtextxy(10, 10, "Creating next frame"); +... +tgi_setviewpage(0); // Show page 0 +</verb> +</descrip> +</quote> + +<sect1>tgi_setpalette<label id="tgi_setpalette"><p> + +<quote> +<descrip> +<tag/Function/Set the palette (not available with all drivers/hardware). +Palette is a pointer to as many entries as there are colors. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_setpalette (const unsigned char* palette);/ +<tag/Description/Set the palette (not available with all drivers/hardware). +Palette is a pointer to as many entries as there are colors. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + +<sect1>tgi_setpixel<label id="tgi_setpixel"><p> + +<quote> +<descrip> +<tag/Function/Plot a pixel on the drawpage with the current color. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_setpixel (int x, int y);/ +<tag/Description/Plot a pixel on the drawpage with the current color. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + +<sect1>tgi_setviewpage<label id="tgi_setviewpage"><p> + +<quote> +<descrip> +<tag/Function/Set page to be visible on screen. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_setviewpage (unsigned char page);/ +<tag/Description/If the drawpage and the viewpage are the same then all drawing +is seen immediately as it is drawn. For double buffered games you can set the +drawpage to a different page than the viewpage. This lets you draw the next +screen in the background and when the screen is ready you display it. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/<verb> +tgi_setdrawpage(1); +tgi_outtextxy(10, 10, "Hello World"); +tgi_setviewpage(1); // Show page 1 +tgi_setdrawpage(0); +tgi_outtextxy(10, 10, "Creating next frame"); +... +tgi_setviewpage(0); // Show page 0 +</verb> +</descrip> +</quote> + +<sect1>tgi_gettextheight<label id="tgi_gettextheight"><p> + +<quote> +<descrip> +<tag/Function/Calculate the height of the text in pixels according to +the current text style. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/ +<tag/Description/Calculate the height of the text in pixels according to +the current text style. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + +<sect1>tgi_settextscale<label id="tgi_settextscale"><p> + +<quote> +<descrip> +<tag/Function/Set the scaling for text output. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_settextscale (unsigned width, unsigned height);/ +<tag/Description/ +Set the scaling for text output. The scaling factors for width and height +are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_settextstyle" name="tgi_settextstyle"> +<tag/Example/None. +</descrip> +</quote> + +<sect1>tgi_settextstyle<label id="tgi_settextstyle"><p> + +<quote> +<descrip> +<tag/Function/Set the style for text output. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir, unsigned char font);/ +<tag/Description/Set the style for text output. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="tgi_settextscale" name="tgi_settextscale"> +<tag/Example/None. +</descrip> +</quote> + +<sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p> + +<quote> +<descrip> +<tag/Function/Calculate the width of the text in pixels according to the current text style. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/ +<tag/Description/Calculate the width of the text in pixels according to the current text style. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + +<sect1>tgi_uninstall<label id="tgi_uninstall"><p> + +<quote> +<descrip> +<tag/Function/Uninstall the currently loaded driver but do not unload it. +Will call tgi_done if necessary. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void tgi_uninstall (void);/ +<tag/Description/Uninstall the currently loaded driver but do not unload it. +Will call tgi_done if necessary. +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + +<sect1>tgi_unload<label id="tgi_unload"><p> + +<quote> +<descrip> +<tag/Function/Uninstall, then unload the currently loaded driver. +Will call tgi_done if necessary. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/void tgi_unload (void);/ +<tag/Description/Uninstall, then unload the currently loaded driver. +Will call tgi_done if necessary. +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + + +</article> From aa30f50fbef509caf5a5d034d60c2217f888aef4 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Sat, 25 Nov 2017 22:39:41 +0100 Subject: [PATCH 062/254] Update tgi.sgml Fixed toc. --- doc/tgi.sgml | 47 +---------------------------------------------- 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/doc/tgi.sgml b/doc/tgi.sgml index 3bab58f57..d9253cf09 100644 --- a/doc/tgi.sgml +++ b/doc/tgi.sgml @@ -11,52 +11,7 @@ Include the tgi.h header file to get the necessary definitions. </abstract> <!-- Table of contents --> -<itemize> -<item><ref id="tgi_arc" name="tgi_arc"> -<item><ref id="tgi_bar" name="tgi_bar"> -<item><ref id="tgi_circle" name="tgi_circle"> -<item><ref id="tgi_clear" name="tgi_clear"> -<item><ref id="tgi_done" name="tgi_done"> -<item><ref id="tgi_ellipse" name="tgi_ellipse"> -<item><ref id="tgi_free_vectorfont" name="tgi_free_vectorfont"> -<item><ref id="tgi_getaspectratio" name="tgi_getaspectratio"> -<item><ref id="tgi_getcolor" name="tgi_getcolor"> -<item><ref id="tgi_getcolorcount" name="tgi_getcolorcount"> -<item><ref id="tgi_getdefpalette" name="tgi_getdefpalette"> -<item><ref id="tgi_geterror" name="tgi_geterror"> -<item><ref id="tgi_geterrormsg" name="tgi_geterrormsg"> -<item><ref id="tgi_getmaxcolor" name="tgi_getmaxcolor"> -<item><ref id="tgi_getmaxx" name="tgi_getmaxx"> -<item><ref id="tgi_getmaxy" name="tgi_getmaxy"> -<item><ref id="tgi_getpagecount" name="tgi_getpagecount"> -<item><ref id="tgi_getpalette" name="tgi_getpalette"> -<item><ref id="tgi_getpixel" name="tgi_getpixel"> -<item><ref id="tgi_gettextheight" name="tgi_gettextheight"> -<item><ref id="tgi_gettextwidth" name="tgi_gettextwidth"> -<item><ref id="tgi_getxres" name="tgi_getxres"> -<item><ref id="tgi_getyres" name="tgi_getyres"> -<item><ref id="tgi_gotoxy" name="tgi_gotoxy"> -<item><ref id="tgi_init" name="tgi_init"> -<item><ref id="tgi_install" name="tgi_install"> -<item><ref id="tgi_install_vectorfont" name="tgi_install_vectorfont"> -<item><ref id="tgi_ioctl" name="tgi_ioctl"> -<item><ref id="tgi_line" name="tgi_line"> -<item><ref id="tgi_lineto" name="tgi_lineto"> -<item><ref id="tgi_load_driver" name="tgi_load_driver"> -<item><ref id="tgi_load_vectorfont" name="tgi_load_vectorfont"> -<item><ref id="tgi_outtext" name="tgi_outtext"> -<item><ref id="tgi_outtextxy" name="tgi_outtextxy"> -<item><ref id="tgi_setaspectratio" name="tgi_setaspectratio"> -<item><ref id="tgi_setcolor" name="tgi_setcolor"> -<item><ref id="tgi_setdrawpage" name="tgi_setdrawpage"> -<item><ref id="tgi_setpalette" name="tgi_setpalette"> -<item><ref id="tgi_setpixel" name="tgi_setpixel"> -<item><ref id="tgi_setviewpage" name="tgi_setviewpage"> -<item><ref id="tgi_settextscale" name="tgi_settextscale"> -<item><ref id="tgi_settextstyle" name="tgi_settextstyle"> -<item><ref id="tgi_uninstall" name="tgi_uninstall"> -<item><ref id="tgi_unload" name="tgi_unload"> -</itemize> +<toc> <!-- Begin the document --> From 9725c4493401faac39d1f302569c4461f3bb11f5 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Sat, 25 Nov 2017 23:09:19 +0100 Subject: [PATCH 063/254] Update tgi.sgml I should take more attention of Travis. --- doc/tgi.sgml | 90 ++++++++++++++++++++++++++-------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/doc/tgi.sgml b/doc/tgi.sgml index d9253cf09..722583893 100644 --- a/doc/tgi.sgml +++ b/doc/tgi.sgml @@ -15,7 +15,7 @@ Include the tgi.h header file to get the necessary definitions. <!-- Begin the document --> -<sect1>tgi_arc<label id="tgi_arc"><p> +<sect>tgi_arc<label id="tgi_arc"><p> <quote> <descrip> @@ -49,7 +49,7 @@ tgi_arc (50, 50, 40, 20, 0, 180); </quote> -<sect1>tgi_bar<label id="tgi_bar"><p> +<sect>tgi_bar<label id="tgi_bar"><p> <quote> <descrip> @@ -73,7 +73,7 @@ tgi_bar(10, 10, 100, 60); </quote> -<sect1>tgi_circle<label id="tgi_circle"><p> +<sect>tgi_circle<label id="tgi_circle"><p> <quote> <descrip> @@ -100,7 +100,7 @@ tgi_circle(50, 40, 40); </quote> -<sect1>tgi_clear<label id="tgi_clear"><p> +<sect>tgi_clear<label id="tgi_clear"><p> <quote> <descrip> @@ -115,7 +115,7 @@ tgi_circle(50, 40, 40); </quote> -<sect1>tgi_done<label id="tgi_done"><p> +<sect>tgi_done<label id="tgi_done"><p> <quote> <descrip> @@ -132,7 +132,7 @@ Will NOT uninstall or unload the driver! </quote> -<sect1>tgi_ellipse<label id="tgi_ellipse"><p> +<sect>tgi_ellipse<label id="tgi_ellipse"><p> <quote> <descrip> @@ -160,7 +160,7 @@ tgi_ellipse (50, 40, 40, 20); </quote> -<sect1>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p> +<sect>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p> <quote> <descrip> @@ -181,7 +181,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_getaspectratio<label id="tgi_getaspectratio"><p> +<sect>tgi_getaspectratio<label id="tgi_getaspectratio"><p> <quote> <descrip> <tag/Function/Return the pixel aspect ratio. <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ @@ -211,7 +211,7 @@ original aspect ratio. </quote> -<sect1>tgi_getcolor<label id="tgi_getcolor"><p> +<sect>tgi_getcolor<label id="tgi_getcolor"><p> <quote> <descrip> @@ -233,7 +233,7 @@ color = tgi_getcolor(); </quote> -<sect1>tgi_getcolorcount<label id="tgi_getcolorcount"><p> +<sect>tgi_getcolorcount<label id="tgi_getcolorcount"><p> <quote> <descrip> @@ -253,7 +253,7 @@ if (tgi_getcolorcount() == 2) { </quote> -<sect1>tgi_getdefpalette<label id="tgi_getdefpalette"><p> +<sect>tgi_getdefpalette<label id="tgi_getdefpalette"><p> <quote> <descrip> @@ -270,7 +270,7 @@ palette to work correctly. </quote> -<sect1>tgi_geterror<label id="tgi_geterror"><p> +<sect>tgi_geterror<label id="tgi_geterror"><p> <quote> <descrip> @@ -287,7 +287,7 @@ This will also clear the error. </quote> -<sect1>tgi_geterrormsg<label id="tgi_geterrormsg"><p> +<sect>tgi_geterrormsg<label id="tgi_geterrormsg"><p> <quote> <descrip> @@ -306,7 +306,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p> +<sect>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p> <quote> <descrip> @@ -321,7 +321,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_getmaxx<label id="tgi_getmaxx"><p> +<sect>tgi_getmaxx<label id="tgi_getmaxx"><p> <quote> <descrip> @@ -336,7 +336,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_getmaxy<label id="tgi_getmaxy"><p> +<sect>tgi_getmaxy<label id="tgi_getmaxy"><p> <quote> <descrip> @@ -351,7 +351,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_getpagecount<label id="tgi_getpagecount"><p> +<sect>tgi_getpagecount<label id="tgi_getpagecount"><p> <quote> <descrip> @@ -368,7 +368,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_getpalette<label id="tgi_getpalette"><p> +<sect>tgi_getpalette<label id="tgi_getpalette"><p> <quote> <descrip> @@ -383,7 +383,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_getpixel<label id="tgi_getpixel"><p> +<sect>tgi_getpixel<label id="tgi_getpixel"><p> <quote> <descrip> @@ -402,7 +402,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_getxres<label id="tgi_getxres"><p> +<sect>tgi_getxres<label id="tgi_getxres"><p> <quote> <descrip> @@ -418,7 +418,7 @@ This is same as tgi_maxx()+1. </quote> -<sect1>tgi_getyres<label id="tgi_getyres"><p> +<sect>tgi_getyres<label id="tgi_getyres"><p> <quote> <descrip> @@ -434,7 +434,7 @@ This is same as tgi_maxy()+1. </quote> -<sect1>tgi_gotoxy<label id="tgi_gotoxy"><p> +<sect>tgi_gotoxy<label id="tgi_gotoxy"><p> <quote> <descrip> @@ -453,7 +453,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_init<label id="tgi_init"><p> +<sect>tgi_init<label id="tgi_init"><p> <quote> <descrip> @@ -478,7 +478,7 @@ tgi_init(); //Set up the default palette and clear the screen. </quote> -<sect1>tgi_install<label id="tgi_install"><p> +<sect>tgi_install<label id="tgi_install"><p> <quote> <descrip> @@ -505,7 +505,7 @@ tgi_init(); //Set up the default palette and clear the screen. </quote> -<sect1>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p> +<sect>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p> <quote> <descrip> @@ -529,7 +529,7 @@ used in presence of a prototype. </quote> -<sect1>tgi_ioctl<label id="tgi_ioctl"><p> +<sect>tgi_ioctl<label id="tgi_ioctl"><p> <quote> <descrip> @@ -564,7 +564,7 @@ if (!tgi_busy()) { </quote> -<sect1>tgi_line<label id="tgi_line"><p> +<sect>tgi_line<label id="tgi_line"><p> <quote> <descrip> @@ -585,7 +585,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_lineto<label id="tgi_lineto"><p> +<sect>tgi_lineto<label id="tgi_lineto"><p> <quote> <descrip> @@ -606,7 +606,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_load_driver<label id="tgi_load_driver"><p> +<sect>tgi_load_driver<label id="tgi_load_driver"><p> <quote> <descrip> @@ -627,7 +627,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p> +<sect>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p> <quote> <descrip> @@ -651,7 +651,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_outtext<label id="tgi_outtext"><p> +<sect>tgi_outtext<label id="tgi_outtext"><p> <quote> <descrip> @@ -672,7 +672,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_outtextxy<label id="tgi_outtextxy"><p> +<sect>tgi_outtextxy<label id="tgi_outtextxy"><p> <quote> <descrip> @@ -693,7 +693,7 @@ be used in presence of a prototype. </quote> -<sect1>tgi_pieslice<label id="tgi_pieslice"><p> +<sect>tgi_pieslice<label id="tgi_pieslice"><p> <quote> <descrip> @@ -727,7 +727,7 @@ tgi_pieslice (50, 50, 40, 20, 0, 180); </quote> -<sect1>tgi_setaspectratio<label id="tgi_setaspectratio"><p> +<sect>tgi_setaspectratio<label id="tgi_setaspectratio"><p> <quote> <descrip> <tag/Function/Set the pixel aspect ratio. <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ @@ -759,7 +759,7 @@ only in the presence of a prototype. </quote> -<sect1>tgi_setcolor<label id="tgi_setcolor"><p> +<sect>tgi_setcolor<label id="tgi_setcolor"><p> <quote> <descrip> @@ -782,7 +782,7 @@ tgi_bar(10,10,20,20); </descrip> </quote> -<sect1>tgi_setdrawpage<label id="tgi_setdrawpage"><p> +<sect>tgi_setdrawpage<label id="tgi_setdrawpage"><p> <quote> <descrip> @@ -811,7 +811,7 @@ tgi_setviewpage(0); // Show page 0 </descrip> </quote> -<sect1>tgi_setpalette<label id="tgi_setpalette"><p> +<sect>tgi_setpalette<label id="tgi_setpalette"><p> <quote> <descrip> @@ -831,7 +831,7 @@ be used in presence of a prototype. </descrip> </quote> -<sect1>tgi_setpixel<label id="tgi_setpixel"><p> +<sect>tgi_setpixel<label id="tgi_setpixel"><p> <quote> <descrip> @@ -849,7 +849,7 @@ be used in presence of a prototype. </descrip> </quote> -<sect1>tgi_setviewpage<label id="tgi_setviewpage"><p> +<sect>tgi_setviewpage<label id="tgi_setviewpage"><p> <quote> <descrip> @@ -878,7 +878,7 @@ tgi_setviewpage(0); // Show page 0 </descrip> </quote> -<sect1>tgi_gettextheight<label id="tgi_gettextheight"><p> +<sect>tgi_gettextheight<label id="tgi_gettextheight"><p> <quote> <descrip> @@ -898,7 +898,7 @@ be used in presence of a prototype. </descrip> </quote> -<sect1>tgi_settextscale<label id="tgi_settextscale"><p> +<sect>tgi_settextscale<label id="tgi_settextscale"><p> <quote> <descrip> @@ -919,7 +919,7 @@ be used in presence of a prototype. </descrip> </quote> -<sect1>tgi_settextstyle<label id="tgi_settextstyle"><p> +<sect>tgi_settextstyle<label id="tgi_settextstyle"><p> <quote> <descrip> @@ -938,7 +938,7 @@ be used in presence of a prototype. </descrip> </quote> -<sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p> +<sect>tgi_gettextwidth<label id="tgi_gettextwidth"><p> <quote> <descrip> @@ -956,7 +956,7 @@ be used in presence of a prototype. </descrip> </quote> -<sect1>tgi_uninstall<label id="tgi_uninstall"><p> +<sect>tgi_uninstall<label id="tgi_uninstall"><p> <quote> <descrip> @@ -972,7 +972,7 @@ Will call tgi_done if necessary. </descrip> </quote> -<sect1>tgi_unload<label id="tgi_unload"><p> +<sect>tgi_unload<label id="tgi_unload"><p> <quote> <descrip> From fa9a1cf2dc0e8fd654ecc4a694e92deeac6a7c6d Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Sat, 25 Nov 2017 23:32:52 +0100 Subject: [PATCH 064/254] Update tgi.sgml Added missing ref. --- doc/tgi.sgml | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/tgi.sgml b/doc/tgi.sgml index 722583893..23b5ce6ae 100644 --- a/doc/tgi.sgml +++ b/doc/tgi.sgml @@ -11,6 +11,7 @@ Include the tgi.h header file to get the necessary definitions. </abstract> <!-- Table of contents --> +<tt/tgi.h/<label id="tgi.h"><p> <toc> <!-- Begin the document --> From a029c006605b5e124069d22fb1efcd956ec81b43 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Thu, 30 Nov 2017 11:38:12 -0500 Subject: [PATCH 065/254] Fixed a Table-Of-Contents bug in the TGI document. The <toc> tag can't be put inside of a section. It isn't needed, anyway; we can get a TOC by putting the header as a section, and the functions as subsections. --- doc/tgi.sgml | 112 ++++++++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 51 deletions(-) diff --git a/doc/tgi.sgml b/doc/tgi.sgml index 23b5ce6ae..fc60653a3 100644 --- a/doc/tgi.sgml +++ b/doc/tgi.sgml @@ -2,21 +2,21 @@ <article> <title>Tiny Graphics Interface -<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>2017-11-23 +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> +<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">,<newline> +<url url="mailto:greg.king5@verizon.net" name="Greg King"> +<date>2017-11-26 <abstract> The cc65 library provides functions for platform independent graphics. Include the tgi.h header file to get the necessary definitions. </abstract> -<!-- Table of contents --> -<tt/tgi.h/<label id="tgi.h"><p> -<toc> - <!-- Begin the document --> -<sect>tgi_arc<label id="tgi_arc"><p> +<sect>tgi.h<label id="tgi.h"> + +<sect1>tgi_arc<label id="tgi_arc"><p> <quote> <descrip> @@ -50,7 +50,7 @@ tgi_arc (50, 50, 40, 20, 0, 180); </quote> -<sect>tgi_bar<label id="tgi_bar"><p> +<sect1>tgi_bar<label id="tgi_bar"><p> <quote> <descrip> @@ -74,7 +74,7 @@ tgi_bar(10, 10, 100, 60); </quote> -<sect>tgi_circle<label id="tgi_circle"><p> +<sect1>tgi_circle<label id="tgi_circle"><p> <quote> <descrip> @@ -101,7 +101,7 @@ tgi_circle(50, 40, 40); </quote> -<sect>tgi_clear<label id="tgi_clear"><p> +<sect1>tgi_clear<label id="tgi_clear"><p> <quote> <descrip> @@ -116,7 +116,7 @@ tgi_circle(50, 40, 40); </quote> -<sect>tgi_done<label id="tgi_done"><p> +<sect1>tgi_done<label id="tgi_done"><p> <quote> <descrip> @@ -133,7 +133,7 @@ Will NOT uninstall or unload the driver! </quote> -<sect>tgi_ellipse<label id="tgi_ellipse"><p> +<sect1>tgi_ellipse<label id="tgi_ellipse"><p> <quote> <descrip> @@ -161,7 +161,7 @@ tgi_ellipse (50, 40, 40, 20); </quote> -<sect>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p> +<sect1>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p> <quote> <descrip> @@ -182,7 +182,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_getaspectratio<label id="tgi_getaspectratio"><p> +<sect1>tgi_getaspectratio<label id="tgi_getaspectratio"><p> <quote> <descrip> <tag/Function/Return the pixel aspect ratio. <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ @@ -212,7 +212,7 @@ original aspect ratio. </quote> -<sect>tgi_getcolor<label id="tgi_getcolor"><p> +<sect1>tgi_getcolor<label id="tgi_getcolor"><p> <quote> <descrip> @@ -234,7 +234,7 @@ color = tgi_getcolor(); </quote> -<sect>tgi_getcolorcount<label id="tgi_getcolorcount"><p> +<sect1>tgi_getcolorcount<label id="tgi_getcolorcount"><p> <quote> <descrip> @@ -254,7 +254,7 @@ if (tgi_getcolorcount() == 2) { </quote> -<sect>tgi_getdefpalette<label id="tgi_getdefpalette"><p> +<sect1>tgi_getdefpalette<label id="tgi_getdefpalette"><p> <quote> <descrip> @@ -271,7 +271,7 @@ palette to work correctly. </quote> -<sect>tgi_geterror<label id="tgi_geterror"><p> +<sect1>tgi_geterror<label id="tgi_geterror"><p> <quote> <descrip> @@ -288,7 +288,7 @@ This will also clear the error. </quote> -<sect>tgi_geterrormsg<label id="tgi_geterrormsg"><p> +<sect1>tgi_geterrormsg<label id="tgi_geterrormsg"><p> <quote> <descrip> @@ -307,7 +307,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p> +<sect1>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p> <quote> <descrip> @@ -322,7 +322,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_getmaxx<label id="tgi_getmaxx"><p> +<sect1>tgi_getmaxx<label id="tgi_getmaxx"><p> <quote> <descrip> @@ -337,7 +337,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_getmaxy<label id="tgi_getmaxy"><p> +<sect1>tgi_getmaxy<label id="tgi_getmaxy"><p> <quote> <descrip> @@ -352,7 +352,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_getpagecount<label id="tgi_getpagecount"><p> +<sect1>tgi_getpagecount<label id="tgi_getpagecount"><p> <quote> <descrip> @@ -369,7 +369,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_getpalette<label id="tgi_getpalette"><p> +<sect1>tgi_getpalette<label id="tgi_getpalette"><p> <quote> <descrip> @@ -384,7 +384,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_getpixel<label id="tgi_getpixel"><p> +<sect1>tgi_getpixel<label id="tgi_getpixel"><p> <quote> <descrip> @@ -403,7 +403,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_getxres<label id="tgi_getxres"><p> +<sect1>tgi_getxres<label id="tgi_getxres"><p> <quote> <descrip> @@ -419,7 +419,7 @@ This is same as tgi_maxx()+1. </quote> -<sect>tgi_getyres<label id="tgi_getyres"><p> +<sect1>tgi_getyres<label id="tgi_getyres"><p> <quote> <descrip> @@ -435,7 +435,7 @@ This is same as tgi_maxy()+1. </quote> -<sect>tgi_gotoxy<label id="tgi_gotoxy"><p> +<sect1>tgi_gotoxy<label id="tgi_gotoxy"><p> <quote> <descrip> @@ -454,7 +454,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_init<label id="tgi_init"><p> +<sect1>tgi_init<label id="tgi_init"><p> <quote> <descrip> @@ -479,7 +479,7 @@ tgi_init(); //Set up the default palette and clear the screen. </quote> -<sect>tgi_install<label id="tgi_install"><p> +<sect1>tgi_install<label id="tgi_install"><p> <quote> <descrip> @@ -506,7 +506,7 @@ tgi_init(); //Set up the default palette and clear the screen. </quote> -<sect>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p> +<sect1>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p> <quote> <descrip> @@ -530,7 +530,7 @@ used in presence of a prototype. </quote> -<sect>tgi_ioctl<label id="tgi_ioctl"><p> +<sect1>tgi_ioctl<label id="tgi_ioctl"><p> <quote> <descrip> @@ -565,7 +565,7 @@ if (!tgi_busy()) { </quote> -<sect>tgi_line<label id="tgi_line"><p> +<sect1>tgi_line<label id="tgi_line"><p> <quote> <descrip> @@ -586,7 +586,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_lineto<label id="tgi_lineto"><p> +<sect1>tgi_lineto<label id="tgi_lineto"><p> <quote> <descrip> @@ -607,7 +607,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_load_driver<label id="tgi_load_driver"><p> +<sect1>tgi_load_driver<label id="tgi_load_driver"><p> <quote> <descrip> @@ -628,7 +628,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p> +<sect1>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p> <quote> <descrip> @@ -652,7 +652,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_outtext<label id="tgi_outtext"><p> +<sect1>tgi_outtext<label id="tgi_outtext"><p> <quote> <descrip> @@ -673,7 +673,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_outtextxy<label id="tgi_outtextxy"><p> +<sect1>tgi_outtextxy<label id="tgi_outtextxy"><p> <quote> <descrip> @@ -694,7 +694,7 @@ be used in presence of a prototype. </quote> -<sect>tgi_pieslice<label id="tgi_pieslice"><p> +<sect1>tgi_pieslice<label id="tgi_pieslice"><p> <quote> <descrip> @@ -728,7 +728,7 @@ tgi_pieslice (50, 50, 40, 20, 0, 180); </quote> -<sect>tgi_setaspectratio<label id="tgi_setaspectratio"><p> +<sect1>tgi_setaspectratio<label id="tgi_setaspectratio"><p> <quote> <descrip> <tag/Function/Set the pixel aspect ratio. <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ @@ -760,7 +760,7 @@ only in the presence of a prototype. </quote> -<sect>tgi_setcolor<label id="tgi_setcolor"><p> +<sect1>tgi_setcolor<label id="tgi_setcolor"><p> <quote> <descrip> @@ -783,7 +783,8 @@ tgi_bar(10,10,20,20); </descrip> </quote> -<sect>tgi_setdrawpage<label id="tgi_setdrawpage"><p> + +<sect1>tgi_setdrawpage<label id="tgi_setdrawpage"><p> <quote> <descrip> @@ -812,7 +813,8 @@ tgi_setviewpage(0); // Show page 0 </descrip> </quote> -<sect>tgi_setpalette<label id="tgi_setpalette"><p> + +<sect1>tgi_setpalette<label id="tgi_setpalette"><p> <quote> <descrip> @@ -832,7 +834,8 @@ be used in presence of a prototype. </descrip> </quote> -<sect>tgi_setpixel<label id="tgi_setpixel"><p> + +<sect1>tgi_setpixel<label id="tgi_setpixel"><p> <quote> <descrip> @@ -850,7 +853,8 @@ be used in presence of a prototype. </descrip> </quote> -<sect>tgi_setviewpage<label id="tgi_setviewpage"><p> + +<sect1>tgi_setviewpage<label id="tgi_setviewpage"><p> <quote> <descrip> @@ -879,7 +883,8 @@ tgi_setviewpage(0); // Show page 0 </descrip> </quote> -<sect>tgi_gettextheight<label id="tgi_gettextheight"><p> + +<sect1>tgi_gettextheight<label id="tgi_gettextheight"><p> <quote> <descrip> @@ -899,7 +904,8 @@ be used in presence of a prototype. </descrip> </quote> -<sect>tgi_settextscale<label id="tgi_settextscale"><p> + +<sect1>tgi_settextscale<label id="tgi_settextscale"><p> <quote> <descrip> @@ -920,7 +926,8 @@ be used in presence of a prototype. </descrip> </quote> -<sect>tgi_settextstyle<label id="tgi_settextstyle"><p> + +<sect1>tgi_settextstyle<label id="tgi_settextstyle"><p> <quote> <descrip> @@ -939,7 +946,8 @@ be used in presence of a prototype. </descrip> </quote> -<sect>tgi_gettextwidth<label id="tgi_gettextwidth"><p> + +<sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p> <quote> <descrip> @@ -957,7 +965,8 @@ be used in presence of a prototype. </descrip> </quote> -<sect>tgi_uninstall<label id="tgi_uninstall"><p> + +<sect1>tgi_uninstall<label id="tgi_uninstall"><p> <quote> <descrip> @@ -973,7 +982,8 @@ Will call tgi_done if necessary. </descrip> </quote> -<sect>tgi_unload<label id="tgi_unload"><p> + +<sect1>tgi_unload<label id="tgi_unload"><p> <quote> <descrip> From ad9b7c0bfa4e80b4fe2f634720bcffd00225d103 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Thu, 30 Nov 2017 11:56:38 -0500 Subject: [PATCH 066/254] Fixed the sort order of the function descriptions in the TGI document. --- doc/tgi.sgml | 114 +++++++++++++++++++++++++-------------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/doc/tgi.sgml b/doc/tgi.sgml index fc60653a3..cf90fd198 100644 --- a/doc/tgi.sgml +++ b/doc/tgi.sgml @@ -5,7 +5,7 @@ <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> <url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">,<newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> -<date>2017-11-26 +<date>2017-11-30 <abstract> The cc65 library provides functions for platform independent graphics. @@ -403,6 +403,46 @@ be used in presence of a prototype. </quote> +<sect1>tgi_gettextheight<label id="tgi_gettextheight"><p> + +<quote> +<descrip> +<tag/Function/Calculate the height of the text in pixels according to +the current text style. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/ +<tag/Description/Calculate the height of the text in pixels according to +the current text style. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + + +<sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p> + +<quote> +<descrip> +<tag/Function/Calculate the width of the text in pixels according to the current text style. +<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ +<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/ +<tag/Description/Calculate the width of the text in pixels according to the current text style. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/Other tgi functions. +<tag/Example/None. +</descrip> +</quote> + + <sect1>tgi_getxres<label id="tgi_getxres"><p> <quote> @@ -854,57 +894,6 @@ be used in presence of a prototype. </quote> -<sect1>tgi_setviewpage<label id="tgi_setviewpage"><p> - -<quote> -<descrip> -<tag/Function/Set page to be visible on screen. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/void __fastcall__ tgi_setviewpage (unsigned char page);/ -<tag/Description/If the drawpage and the viewpage are the same then all drawing -is seen immediately as it is drawn. For double buffered games you can set the -drawpage to a different page than the viewpage. This lets you draw the next -screen in the background and when the screen is ready you display it. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/<verb> -tgi_setdrawpage(1); -tgi_outtextxy(10, 10, "Hello World"); -tgi_setviewpage(1); // Show page 1 -tgi_setdrawpage(0); -tgi_outtextxy(10, 10, "Creating next frame"); -... -tgi_setviewpage(0); // Show page 0 -</verb> -</descrip> -</quote> - - -<sect1>tgi_gettextheight<label id="tgi_gettextheight"><p> - -<quote> -<descrip> -<tag/Function/Calculate the height of the text in pixels according to -the current text style. -<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/ -<tag/Description/Calculate the height of the text in pixels according to -the current text style. -<tag/Notes/<itemize> -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/cc65 -<tag/See also/Other tgi functions. -<tag/Example/None. -</descrip> -</quote> - - <sect1>tgi_settextscale<label id="tgi_settextscale"><p> <quote> @@ -947,21 +936,32 @@ be used in presence of a prototype. </quote> -<sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p> +<sect1>tgi_setviewpage<label id="tgi_setviewpage"><p> <quote> <descrip> -<tag/Function/Calculate the width of the text in pixels according to the current text style. +<tag/Function/Set page to be visible on screen. <tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/ -<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/ -<tag/Description/Calculate the width of the text in pixels according to the current text style. +<tag/Declaration/<tt/void __fastcall__ tgi_setviewpage (unsigned char page);/ +<tag/Description/If the drawpage and the viewpage are the same then all drawing +is seen immediately as it is drawn. For double buffered games you can set the +drawpage to a different page than the viewpage. This lets you draw the next +screen in the background and when the screen is ready you display it. <tag/Notes/<itemize> <item>The function is only available as fastcall function, so it may only be used in presence of a prototype. </itemize> <tag/Availability/cc65 <tag/See also/Other tgi functions. -<tag/Example/None. +<tag/Example/<verb> +tgi_setdrawpage(1); +tgi_outtextxy(10, 10, "Hello World"); +tgi_setviewpage(1); // Show page 1 +tgi_setdrawpage(0); +tgi_outtextxy(10, 10, "Creating next frame"); +... +tgi_setviewpage(0); // Show page 0 +</verb> </descrip> </quote> From e485e96de09b3913465af5e942488e202327c7ad Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Thu, 30 Nov 2017 19:17:45 +0100 Subject: [PATCH 067/254] Suppress potential svnversion error output. --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 5d45180a0..524651428 100644 --- a/src/Makefile +++ b/src/Makefile @@ -55,7 +55,7 @@ endif ifdef GIT_SHA $(info GIT_SHA: $(GIT_SHA)) else - GIT_SHA := $(shell git rev-parse --short HEAD 2>$(NULLDEV) || svnversion) + GIT_SHA := $(shell git rev-parse --short HEAD 2>$(NULLDEV) || svnversion 2>$(NULLDEV)) ifneq ($(words $(GIT_SHA)),1) GIT_SHA := N/A $(info GIT_SHA: N/A) From 563185998fd071e48682d1abb8f2a7925505ba76 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Sat, 2 Dec 2017 11:04:59 +0100 Subject: [PATCH 068/254] Removed CBM chartype table. --- libsrc/osic1p/ctype.s | 418 +++++++++++++++--------------------------- 1 file changed, 144 insertions(+), 274 deletions(-) diff --git a/libsrc/osic1p/ctype.s b/libsrc/osic1p/ctype.s index fa901c189..35968f982 100644 --- a/libsrc/osic1p/ctype.s +++ b/libsrc/osic1p/ctype.s @@ -1,289 +1,159 @@ ; +; Ullrich von Bassewitz, 2003-10-10 +; ; Character specification table. ; -; Ullrich von Bassewitz, 02.06.1998 -; 2003-05-02, Greg King -; -; Copied from cbm/ctype.s -; The following 256-byte-wide table specifies attributes for the isxxx type -; of functions. Doing it by a table means some overhead in space, but it + .include "ctype.inc" + +; The tables are readonly, put them into the rodata segment + +.rodata + +; The following 256 byte wide table specifies attributes for the isxxx type +; of functions. Doing it by a table means some overhead in space, but it ; has major advantages: ; -; * It is fast. If it weren't for the slow parameter-passing of cc65, -; one even could define C-language macroes for the isxxx functions -; (as it usually is done, on other platforms). +; * It is fast. If it weren't for the slow parameter passing of cc65, one +; could even define macros for the isxxx functions (this is usually +; done on other platforms). ; -; * It is highly portable. The only unportable part is the table itself; +; * It is highly portable. The only unportable part is the table itself, ; all real code goes into the common library. ; ; * We save some code in the isxxx functions. -; This table is taken from Craig S. Bruce's technical docs. for the ACE OS. - - .include "ctype.inc" - -; The table is read-only, put it into the RODATA segment. - - .rodata __ctype: - .byte CT_CTRL ; 0/00 ___rvs_@___ - .byte CT_CTRL ; 1/01 ___rvs_a___ - .byte CT_CTRL ; 2/02 ___rvs_b___ - .byte CT_CTRL ; 3/03 ___rvs_c___ - .byte CT_CTRL ; 4/04 ___rvs_d___ - .byte CT_CTRL ; 5/05 ___rvs_e___ - .byte CT_CTRL ; 6/06 ___rvs_f___ - .byte CT_CTRL ; 7/07 _BEL/rvs_g_ - .byte CT_CTRL ; 8/08 ___rvs_h___ - .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB ; 9/09 _TAB/rvs_i_ - .byte CT_CTRL | CT_OTHER_WS ; 10/0a _BOL/rvs_j_ - .byte CT_CTRL ; 11/0b ___rvs_k___ - .byte CT_CTRL ; 12/0c ___rvs_l___ - .byte CT_CTRL | CT_OTHER_WS ; 13/0d _CR_/rvs_m_ - .byte CT_CTRL ; 14/0e ___rvs_n___ - .byte CT_CTRL ; 15/0f ___rvs_o___ - .byte CT_CTRL ; 16/10 ___rvs_p___ - .byte CT_CTRL | CT_OTHER_WS ; 17/11 _VT_/rvs_q_ - .byte CT_CTRL ; 18/12 ___rvs_r___ - .byte CT_CTRL | CT_OTHER_WS ; 19/13 HOME/rvs_s_ - .byte CT_CTRL | CT_OTHER_WS ; 20/14 _BS_/rvs_t_ - .byte CT_CTRL ; 21/15 ___rvs_u___ - .byte CT_CTRL ; 22/16 ___rvs_v___ - .byte CT_CTRL ; 23/17 ___rvs_w___ - .byte CT_CTRL ; 24/18 ___rvs_x___ - .byte CT_CTRL ; 25/19 ___rvs_y___ - .byte CT_CTRL ; 26/1a ___rvs_z___ - .byte CT_CTRL ; 27/1b ___rvs_[___ - .byte CT_CTRL ; 28/1c ___rvs_\___ - .byte CT_CTRL | CT_OTHER_WS ; 29/1d cursr-right - .byte CT_CTRL ; 30/1e ___rvs_^___ - .byte CT_CTRL ; 31/1f _rvs_under_ - .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___ - .byte $00 ; 33/21 _____!_____ - .byte $00 ; 34/22 _____"_____ - .byte $00 ; 35/23 _____#_____ - .byte $00 ; 36/24 _____$_____ - .byte $00 ; 37/25 _____%_____ - .byte $00 ; 38/26 _____&_____ - .byte $00 ; 39/27 _____'_____ - .byte $00 ; 40/28 _____(_____ - .byte $00 ; 41/29 _____)_____ - .byte $00 ; 42/2a _____*_____ - .byte $00 ; 43/2b _____+_____ - .byte $00 ; 44/2c _____,_____ - .byte $00 ; 45/2d _____-_____ - .byte $00 ; 46/2e _____._____ - .byte $00 ; 47/2f _____/_____ - .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____ - .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____ - .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____ - .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____ - .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____ - .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____ - .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____ - .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____ - .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____ - .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____ - .byte $00 ; 58/3a _____:_____ - .byte $00 ; 59/3b _____;_____ - .byte $00 ; 60/3c _____<_____ - .byte $00 ; 61/3d _____=_____ - .byte $00 ; 62/3e _____>_____ - .byte $00 ; 63/3f _____?_____ + .byte CT_CTRL ; 0/00 ___ctrl_@___ + .byte CT_CTRL ; 1/01 ___ctrl_A___ + .byte CT_CTRL ; 2/02 ___ctrl_B___ + .byte CT_CTRL ; 3/03 ___ctrl_C___ + .byte CT_CTRL ; 4/04 ___ctrl_D___ + .byte CT_CTRL ; 5/05 ___ctrl_E___ + .byte CT_CTRL ; 6/06 ___ctrl_F___ + .byte CT_CTRL ; 7/07 ___ctrl_G___ + .byte CT_CTRL ; 8/08 ___ctrl_H___ + .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB + ; 9/09 ___ctrl_I___ + .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___ + .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___ + .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___ + .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___ + .byte CT_CTRL ; 14/0e ___ctrl_N___ + .byte CT_CTRL ; 15/0f ___ctrl_O___ + .byte CT_CTRL ; 16/10 ___ctrl_P___ + .byte CT_CTRL ; 17/11 ___ctrl_Q___ + .byte CT_CTRL ; 18/12 ___ctrl_R___ + .byte CT_CTRL ; 19/13 ___ctrl_S___ + .byte CT_CTRL ; 20/14 ___ctrl_T___ + .byte CT_CTRL ; 21/15 ___ctrl_U___ + .byte CT_CTRL ; 22/16 ___ctrl_V___ + .byte CT_CTRL ; 23/17 ___ctrl_W___ + .byte CT_CTRL ; 24/18 ___ctrl_X___ + .byte CT_CTRL ; 25/19 ___ctrl_Y___ + .byte CT_CTRL ; 26/1a ___ctrl_Z___ + .byte CT_CTRL ; 27/1b ___ctrl_[___ + .byte CT_CTRL ; 28/1c ___ctrl_\___ + .byte CT_CTRL ; 29/1d ___ctrl_]___ + .byte CT_CTRL ; 30/1e ___ctrl_^___ + .byte CT_CTRL ; 31/1f ___ctrl_____ + .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___ + .byte CT_NONE ; 33/21 _____!_____ + .byte CT_NONE ; 34/22 _____"_____ + .byte CT_NONE ; 35/23 _____#_____ + .byte CT_NONE ; 36/24 _____$_____ + .byte CT_NONE ; 37/25 _____%_____ + .byte CT_NONE ; 38/26 _____&_____ + .byte CT_NONE ; 39/27 _____'_____ + .byte CT_NONE ; 40/28 _____(_____ + .byte CT_NONE ; 41/29 _____)_____ + .byte CT_NONE ; 42/2a _____*_____ + .byte CT_NONE ; 43/2b _____+_____ + .byte CT_NONE ; 44/2c _____,_____ + .byte CT_NONE ; 45/2d _____-_____ + .byte CT_NONE ; 46/2e _____._____ + .byte CT_NONE ; 47/2f _____/_____ + .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____ + .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____ + .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____ + .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____ + .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____ + .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____ + .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____ + .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____ + .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____ + .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____ + .byte CT_NONE ; 58/3a _____:_____ + .byte CT_NONE ; 59/3b _____;_____ + .byte CT_NONE ; 60/3c _____<_____ + .byte CT_NONE ; 61/3d _____=_____ + .byte CT_NONE ; 62/3e _____>_____ + .byte CT_NONE ; 63/3f _____?_____ - .byte $00 ; 64/40 _____@_____ - .byte CT_LOWER | CT_XDIGIT ; 65/41 _____a_____ - .byte CT_LOWER | CT_XDIGIT ; 66/42 _____b_____ - .byte CT_LOWER | CT_XDIGIT ; 67/43 _____c_____ - .byte CT_LOWER | CT_XDIGIT ; 68/44 _____d_____ - .byte CT_LOWER | CT_XDIGIT ; 69/45 _____e_____ - .byte CT_LOWER | CT_XDIGIT ; 70/46 _____f_____ - .byte CT_LOWER ; 71/47 _____g_____ - .byte CT_LOWER ; 72/48 _____h_____ - .byte CT_LOWER ; 73/49 _____i_____ - .byte CT_LOWER ; 74/4a _____j_____ - .byte CT_LOWER ; 75/4b _____k_____ - .byte CT_LOWER ; 76/4c _____l_____ - .byte CT_LOWER ; 77/4d _____m_____ - .byte CT_LOWER ; 78/4e _____n_____ - .byte CT_LOWER ; 79/4f _____o_____ - .byte CT_LOWER ; 80/50 _____p_____ - .byte CT_LOWER ; 81/51 _____q_____ - .byte CT_LOWER ; 82/52 _____r_____ - .byte CT_LOWER ; 83/53 _____s_____ - .byte CT_LOWER ; 84/54 _____t_____ - .byte CT_LOWER ; 85/55 _____u_____ - .byte CT_LOWER ; 86/56 _____v_____ - .byte CT_LOWER ; 87/57 _____w_____ - .byte CT_LOWER ; 88/58 _____x_____ - .byte CT_LOWER ; 89/59 _____y_____ - .byte CT_LOWER ; 90/5a _____z_____ - .byte $00 ; 91/5b _____[_____ - .byte $00 ; 92/5c _____\_____ - .byte $00 ; 93/5d _____]_____ - .byte $00 ; 94/5e _____^_____ - .byte $00 ; 95/5f _UNDERLINE_ - .byte $00 ; 96/60 _A`_grave__ - .byte $00 ; 97/61 _A'_acute__ - .byte $00 ; 98/62 _A^_circum_ - .byte $00 ; 99/63 _A~_tilde__ - .byte $00 ; 100/64 _A"_dieres_ - .byte $00 ; 101/65 _A__ring___ - .byte $00 ; 102/66 _AE________ - .byte $00 ; 103/67 _C,cedilla_ - .byte $00 ; 104/68 _E`_grave__ - .byte $00 ; 105/69 _E'_acute__ - .byte $00 ; 106/6a _E^_circum_ - .byte $00 ; 107/6b _E"_dieres_ - .byte $00 ; 108/6c _I`_grave__ - .byte $00 ; 109/6d _I'_acute__ - .byte $00 ; 110/6e _I^_circum_ - .byte $00 ; 111/6f _I"_dieres_ - .byte $00 ; 112/70 _D-_Eth_lr_ - .byte $00 ; 113/71 _N~_tilde__ - .byte $00 ; 114/72 _O`_grave__ - .byte $00 ; 115/73 _O'_acute__ - .byte $00 ; 116/74 _O^_circum_ - .byte $00 ; 117/75 _O~_tilde__ - .byte $00 ; 118/76 _O"_dieres_ - .byte $00 ; 119/77 __multiply_ - .byte $00 ; 120/78 _O/_slash__ - .byte $00 ; 121/79 _U`_grave__ - .byte $00 ; 122/7a _U'_acute__ - .byte $00 ; 123/7b _U^_circum_ - .byte $00 ; 124/7c _U"_dieres_ - .byte $00 ; 125/7d _Y'_acute__ - .byte $00 ; 126/7e _cap_thorn_ - .byte $00 ; 127/7f _Es-sed_B__ + .byte CT_NONE ; 64/40 _____@_____ + .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____ + .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____ + .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____ + .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____ + .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____ + .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____ + .byte CT_UPPER ; 71/47 _____G_____ + .byte CT_UPPER ; 72/48 _____H_____ + .byte CT_UPPER ; 73/49 _____I_____ + .byte CT_UPPER ; 74/4a _____J_____ + .byte CT_UPPER ; 75/4b _____K_____ + .byte CT_UPPER ; 76/4c _____L_____ + .byte CT_UPPER ; 77/4d _____M_____ + .byte CT_UPPER ; 78/4e _____N_____ + .byte CT_UPPER ; 79/4f _____O_____ + .byte CT_UPPER ; 80/50 _____P_____ + .byte CT_UPPER ; 81/51 _____Q_____ + .byte CT_UPPER ; 82/52 _____R_____ + .byte CT_UPPER ; 83/53 _____S_____ + .byte CT_UPPER ; 84/54 _____T_____ + .byte CT_UPPER ; 85/55 _____U_____ + .byte CT_UPPER ; 86/56 _____V_____ + .byte CT_UPPER ; 87/57 _____W_____ + .byte CT_UPPER ; 88/58 _____X_____ + .byte CT_UPPER ; 89/59 _____Y_____ + .byte CT_UPPER ; 90/5a _____Z_____ + .byte CT_NONE ; 91/5b _____[_____ + .byte CT_NONE ; 92/5c _____\_____ + .byte CT_NONE ; 93/5d _____]_____ + .byte CT_NONE ; 94/5e _____^_____ + .byte CT_NONE ; 95/5f _UNDERLINE_ + .byte CT_NONE ; 96/60 ___grave___ + .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____ + .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____ + .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____ + .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____ + .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____ + .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____ + .byte CT_LOWER ; 103/67 _____g_____ + .byte CT_LOWER ; 104/68 _____h_____ + .byte CT_LOWER ; 105/69 _____i_____ + .byte CT_LOWER ; 106/6a _____j_____ + .byte CT_LOWER ; 107/6b _____k_____ + .byte CT_LOWER ; 108/6c _____l_____ + .byte CT_LOWER ; 109/6d _____m_____ + .byte CT_LOWER ; 110/6e _____n_____ + .byte CT_LOWER ; 111/6f _____o_____ + .byte CT_LOWER ; 112/70 _____p_____ + .byte CT_LOWER ; 113/71 _____q_____ + .byte CT_LOWER ; 114/72 _____r_____ + .byte CT_LOWER ; 115/73 _____s_____ + .byte CT_LOWER ; 116/74 _____t_____ + .byte CT_LOWER ; 117/75 _____u_____ + .byte CT_LOWER ; 118/76 _____v_____ + .byte CT_LOWER ; 119/77 _____w_____ + .byte CT_LOWER ; 120/78 _____x_____ + .byte CT_LOWER ; 121/79 _____y_____ + .byte CT_LOWER ; 122/7a _____z_____ + .byte CT_NONE ; 123/7b _____{_____ + .byte CT_NONE ; 124/7c _____|_____ + .byte CT_NONE ; 125/7d _____}_____ + .byte CT_NONE ; 126/7e _____~_____ + .byte CT_OTHER_WS ; 127/7f ____DEL____ - .byte CT_CTRL ; 128/80 __bullet___ - .byte CT_CTRL ; 129/81 __v_line___ - .byte CT_CTRL ; 130/82 __h_line___ - .byte CT_CTRL ; 131/83 ___cross___ - .byte CT_CTRL ; 132/84 _tl_corner_ - .byte CT_CTRL ; 133/85 _tr_corner_ - .byte CT_CTRL ; 134/86 _bl_corner_ - .byte CT_CTRL ; 135/87 _br_corner_ - .byte CT_CTRL ; 136/88 ___l_tee___ - .byte CT_CTRL ; 137/89 ___r_tee___ - .byte CT_CTRL ; 138/8a ___t_tee___ - .byte CT_CTRL ; 139/8b ___b_tee___ - .byte CT_CTRL ; 140/8c ___heart___ - .byte CT_CTRL | CT_OTHER_WS ; 141/8d _CR/diamond - .byte CT_CTRL ; 142/8e ___club____ - .byte CT_CTRL ; 143/8f ___spade___ - .byte CT_CTRL ; 144/90 _s_circle__ - .byte CT_CTRL | CT_OTHER_WS ; 145/91 _cursor-up_ - .byte CT_CTRL ; 146/92 ___pound___ - .byte CT_CTRL | CT_OTHER_WS ; 147/93 _CLS/check_ - .byte CT_CTRL | CT_OTHER_WS ; 148/94 __INSert___ - .byte CT_CTRL ; 149/95 ____+/-____ - .byte CT_CTRL ; 150/96 __divide___ - .byte CT_CTRL ; 151/97 __degree___ - .byte CT_CTRL ; 152/98 _c_checker_ - .byte CT_CTRL ; 153/99 _f_checker_ - .byte CT_CTRL ; 154/9a _solid_sq__ - .byte CT_CTRL ; 155/9b __cr_char__ - .byte CT_CTRL ; 156/9c _up_arrow__ - .byte CT_CTRL | CT_OTHER_WS ; 157/9d cursor-left - .byte CT_CTRL ; 158/9e _left_arro_ - .byte CT_CTRL ; 159/9f _right_arr_ - .byte CT_SPACE | CT_SPACE_TAB ; 160/a0 _req space_ - .byte $00 ; 161/a1 _!_invertd_ - .byte $00 ; 162/a2 ___cent____ - .byte $00 ; 163/a3 ___pound___ - .byte $00 ; 164/a4 __currency_ - .byte $00 ; 165/a5 ____yen____ - .byte $00 ; 166/a6 _|_broken__ - .byte $00 ; 167/a7 __section__ - .byte $00 ; 168/a8 __umulaut__ - .byte $00 ; 169/a9 _copyright_ - .byte $00 ; 170/aa __fem_ord__ - .byte $00 ; 171/ab _l_ang_quo_ - .byte $00 ; 172/ac ____not____ - .byte $00 ; 173/ad _syl_hyphn_ - .byte $00 ; 174/ae _registerd_ - .byte $00 ; 175/af _overline__ - .byte $00 ; 176/b0 __degrees__ - .byte $00 ; 177/b1 ____+/-____ - .byte $00 ; 178/b2 _2_supersc_ - .byte $00 ; 179/b3 _3_supersc_ - .byte $00 ; 180/b4 ___acute___ - .byte $00 ; 181/b5 ____mu_____ - .byte $00 ; 182/b6 _paragraph_ - .byte $00 ; 183/b7 __mid_dot__ - .byte $00 ; 184/b8 __cedilla__ - .byte $00 ; 185/b9 _1_supersc_ - .byte $00 ; 186/ba __mas_ord__ - .byte $00 ; 187/bb _r_ang_quo_ - .byte $00 ; 188/bc ____1/4____ - .byte $00 ; 189/bd ____1/2____ - .byte $00 ; 190/be ____3/4____ - .byte $00 ; 191/bf _?_invertd_ - - .byte $00 ; 192/c0 _____`_____ - .byte CT_UPPER | CT_XDIGIT ; 193/c1 _____A_____ - .byte CT_UPPER | CT_XDIGIT ; 194/c2 _____B_____ - .byte CT_UPPER | CT_XDIGIT ; 195/c3 _____C_____ - .byte CT_UPPER | CT_XDIGIT ; 196/c4 _____D_____ - .byte CT_UPPER | CT_XDIGIT ; 197/c5 _____E_____ - .byte CT_UPPER | CT_XDIGIT ; 198/c6 _____F_____ - .byte CT_UPPER ; 199/c7 _____G_____ - .byte CT_UPPER ; 200/c8 _____H_____ - .byte CT_UPPER ; 201/c9 _____I_____ - .byte CT_UPPER ; 202/ca _____J_____ - .byte CT_UPPER ; 203/cb _____K_____ - .byte CT_UPPER ; 204/cc _____L_____ - .byte CT_UPPER ; 205/cd _____M_____ - .byte CT_UPPER ; 206/ce _____N_____ - .byte CT_UPPER ; 207/cf _____O_____ - .byte CT_UPPER ; 208/d0 _____P_____ - .byte CT_UPPER ; 209/d1 _____Q_____ - .byte CT_UPPER ; 210/d2 _____R_____ - .byte CT_UPPER ; 211/d3 _____S_____ - .byte CT_UPPER ; 212/d4 _____T_____ - .byte CT_UPPER ; 213/d5 _____U_____ - .byte CT_UPPER ; 214/d6 _____V_____ - .byte CT_UPPER ; 215/d7 _____W_____ - .byte CT_UPPER ; 216/d8 _____X_____ - .byte CT_UPPER ; 217/d9 _____Y_____ - .byte CT_UPPER ; 218/da _____Z_____ - .byte $00 ; 219/db _____{_____ - .byte $00 ; 220/dc _____|_____ - .byte $00 ; 221/dd _____}_____ - .byte $00 ; 222/de _____~_____ - .byte $00 ; 223/df ___HOUSE___ - .byte $00 ; 224/e0 _a`_grave__ - .byte $00 ; 225/e1 _a'_acute__ - .byte $00 ; 226/e2 _a^_circum_ - .byte $00 ; 227/e3 _a~_tilde__ - .byte $00 ; 228/e4 _a"_dieres_ - .byte $00 ; 229/e5 _a__ring___ - .byte $00 ; 230/e6 _ae________ - .byte $00 ; 231/e7 _c,cedilla_ - .byte $00 ; 232/e8 _e`_grave__ - .byte $00 ; 233/e9 _e'_acute__ - .byte $00 ; 234/ea _e^_circum_ - .byte $00 ; 235/eb _e"_dieres_ - .byte $00 ; 236/ec _i`_grave__ - .byte $00 ; 237/ed _i'_acute__ - .byte $00 ; 238/ee _i^_circum_ - .byte $00 ; 239/ef _i"_dieres_ - .byte $00 ; 240/f0 _o^x_Eth_s_ - .byte $00 ; 241/f1 _n~_tilda__ - .byte $00 ; 242/f2 _o`_grave__ - .byte $00 ; 243/f3 _o'_acute__ - .byte $00 ; 244/f4 _o^_circum_ - .byte $00 ; 245/f5 _o~_tilde__ - .byte $00 ; 246/f6 _o"_dieres_ - .byte $00 ; 247/f7 __divide___ - .byte $00 ; 248/f8 _o/_slash__ - .byte $00 ; 249/f9 _u`_grave__ - .byte $00 ; 250/fa _u'_acute__ - .byte $00 ; 251/fb _u^_circum_ - .byte $00 ; 252/fc _u"_dieres_ - .byte $00 ; 253/fd _y'_acute__ - .byte $00 ; 254/fe _sm_thorn__ - .byte $00 ; 255/ff _y"_dieres_ + .res 128, CT_NONE ; 128-255 From 947b09ad96902cc2a4d775660c77fd496a3bedbd Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Thu, 7 Dec 2017 20:39:28 +0100 Subject: [PATCH 069/254] Removed OPC_EOR_abx duplicate. --- asminc/opcodes.inc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/asminc/opcodes.inc b/asminc/opcodes.inc index 96cdefb65..aa7a65f00 100644 --- a/asminc/opcodes.inc +++ b/asminc/opcodes.inc @@ -241,12 +241,11 @@ OPC_BIT_abx = $3C ; OPC_NOP = $44 ; doublet ; OPC_NOP = $4B ; doublet -OPC_EOR_izp = $52 +OPC_EOR_izp = $52 ; OPC_NOP = $53 ; doublet ; OPC_NOP = $54 ; doublet ; OPC_NOP = $5A ; doublet ; OPC_NOP = $5B ; doublet -OPC_EOR_abx = $5C ; OPC_NOP = $62 ; doublet ; OPC_NOP = $63 ; doublet From 8902730756f7dc6037cea35ea08c7511eb89cb4b Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Mon, 11 Dec 2017 19:49:14 +0100 Subject: [PATCH 070/254] cbm stuff from greggs pull request --- asminc/c128.inc | 12 ++- doc/funcref.sgml | 121 +++++++++++++++++++++++- include/cbm610.h | 4 +- include/conio.h | 20 ++++ include/pet.h | 1 + libsrc/c128/cpeekc.s | 65 +++++++++++++ libsrc/c128/cpeekcolor.s | 56 ++++++++++++ libsrc/c128/cpeekrevers.s | 51 +++++++++++ libsrc/c128/cpeeks.s | 15 +++ libsrc/cbm/cpeekc.s | 53 +++++++++++ libsrc/cbm/cpeekcolor.s | 28 ++++++ libsrc/cbm/cpeekrevers.s | 35 +++++++ libsrc/cbm/cpeeks.s | 93 +++++++++++++++++++ libsrc/cbm510/cpeekcolor.s | 24 +++++ libsrc/cbm510/doesclrscr.s | 16 ++++ libsrc/cbm610/cpeekc.s | 45 +++++++++ libsrc/cbm610/cpeekcolor.s | 8 ++ libsrc/cbm610/cpeekrevers.s | 29 ++++++ libsrc/cbm610/cpeeks.s | 82 +++++++++++++++++ libsrc/pet/cpeekcolor.s | 8 ++ testcode/lib/cpeek-test.c | 177 ++++++++++++++++++++++++++++++++++++ 21 files changed, 936 insertions(+), 7 deletions(-) create mode 100644 libsrc/c128/cpeekc.s create mode 100644 libsrc/c128/cpeekcolor.s create mode 100644 libsrc/c128/cpeekrevers.s create mode 100644 libsrc/c128/cpeeks.s create mode 100644 libsrc/cbm/cpeekc.s create mode 100644 libsrc/cbm/cpeekcolor.s create mode 100644 libsrc/cbm/cpeekrevers.s create mode 100644 libsrc/cbm/cpeeks.s create mode 100644 libsrc/cbm510/cpeekcolor.s create mode 100644 libsrc/cbm510/doesclrscr.s create mode 100644 libsrc/cbm610/cpeekc.s create mode 100644 libsrc/cbm610/cpeekcolor.s create mode 100644 libsrc/cbm610/cpeekrevers.s create mode 100644 libsrc/cbm610/cpeeks.s create mode 100644 libsrc/pet/cpeekcolor.s create mode 100644 testcode/lib/cpeek-test.c diff --git a/asminc/c128.inc b/asminc/c128.inc index 745a3ad6d..45ac3935b 100644 --- a/asminc/c128.inc +++ b/asminc/c128.inc @@ -15,7 +15,7 @@ FNAM := $BB ; Address of filename FNAM_BANK := $C7 ; Bank for filename KEY_COUNT := $D0 ; Number of keys in input buffer FKEY_COUNT := $D1 ; Characters for function key -MODE := $D7 ; 40/80 column mode flag +MODE := $D7 ; 40-/80-column mode (bit 7: 80 columns) CURS_X := $EC ; Cursor column CURS_Y := $EB ; Cursor row SCREEN_PTR := $E0 ; Pointer to current char in text screen @@ -167,8 +167,14 @@ SID_Read3 := $D41C ; --------------------------------------------------------------------------- ; I/O: VDC (128 only) -VDC_INDEX := $D600 -VDC_DATA := $D601 +VDC_INDEX := $D600 ; register address port +VDC_DATA := $D601 ; data port + +; Registers +VDC_DATA_HI = 18 ; video RAM address (big endian) +VDC_DATA_LO = 19 +VDC_CSET = 28 +VDC_RAM_RW = 31 ; RAM port ; --------------------------------------------------------------------------- ; I/O: Complex Interface Adapters diff --git a/doc/funcref.sgml b/doc/funcref.sgml index d997e0a8f..b198adcf8 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -4,7 +4,7 @@ <title>cc65 function reference <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> -<date>2017-11-21 +<date>2017-12-09 <abstract> cc65 is a C compiler for 6502 based systems. This function reference describes @@ -240,6 +240,10 @@ function. <item><ref id="chline" name="chline"> <item><ref id="chlinexy" name="chlinexy"> <item><ref id="clrscr" name="clrscr"> +<item><ref id="cpeekc" name="cpeekc"> +<item><ref id="cpeekcolor" name="cpeekcolor"> +<item><ref id="cpeekrevers" name="cpeekrevers"> +<item><ref id="cpeeks" name="cpeeks"> <item><ref id="cprintf" name="cprintf"> <item><ref id="cputc" name="cputc"> <item><ref id="cputcxy" name="cputcxy"> @@ -2363,6 +2367,121 @@ be used in presence of a prototype. </quote> +<sect1>cpeekc<label id="cpeekc"><p> + +<quote> +<descrip> +<tag/Function/Get a character from the display memory. +<tag/Header/<tt/<ref id="conio.h" name="conio.h">/ +<tag/Declaration/<tt/char cpeekc (void);/ +<tag/Description/The function gets the character that's at the current location +of the cursor in the display screen RAM. That character is converted, if +needed, into the encoding that can be passed to <tt/cputc()/. +<tag/Notes/<itemize> +<item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was +done to make it obvious that peeking doesn't move the cursor in any way. Your +program must place the cursor where it wants to peek before it calls any of +those functions. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="cpeekcolor" name="cpeekcolor">, +<ref id="cpeekrevers" name="cpeekrevers">, +<ref id="cpeeks" name="cpeeks">, +<ref id="cputc" name="cputc"> +<tag/Example/None. +</descrip> +</quote> + + +<sect1>cpeekcolor<label id="cpeekcolor"><p> + +<quote> +<descrip> +<tag/Function/Get a color from the display memory. +<tag/Header/<tt/<ref id="conio.h" name="conio.h">/ +<tag/Declaration/<tt/unsigned char cpeekcolor (void);/ +<tag/Description/The function gets the color number that's at the current +location of the cursor in the display screen RAM. That number can be passed to +<tt/textcolor()/. +<tag/Notes/<itemize> +<item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was +done to make it obvious that peeking doesn't move the cursor in any way. Your +program must place the cursor where it wants to peek before it calls any of +those functions. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="cpeekc" name="cpeekc">, +<ref id="cpeekrevers" name="cpeekrevers">, +<ref id="cpeeks" name="cpeeks">, +<ref id="cputc" name="cputc">, +<ref id="textcolor" name="textcolor"> +<tag/Example/None. +</descrip> +</quote> + + +<sect1>cpeekrevers<label id="cpeekrevers"><p> + +<quote> +<descrip> +<tag/Function/Get a reverse-character attribute from the display memory. +<tag/Header/<tt/<ref id="conio.h" name="conio.h">/ +<tag/Declaration/<tt/unsigned char cpeekrevers (void);/ +<tag/Description/The function gets the "reverse-mode" attribute of the +character that's at the current location of the cursor in the display screen +RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/. +<tag/Notes/<itemize> +<item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was +done to make it obvious that peeking doesn't move the cursor in any way. Your +program must place the cursor where it wants to peek before it calls any of +those functions. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="cpeekc" name="cpeekc">, +<ref id="cpeekcolor" name="cpeekcolor">, +<ref id="cpeeks" name="cpeeks">, +<ref id="cputc" name="cputc">, +<ref id="revers" name="revers"> +<tag/Example/None. +</descrip> +</quote> + + +<sect1>cpeeks<label id="cpeeks"><p> + +<quote> +<descrip> +<tag/Function/Get a string from the display memory. +<tag/Header/<tt/<ref id="conio.h" name="conio.h">/ +<tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/ +<tag/Description/The function gets a fixed-length string ('\0'-terminated) of +characters that start at the current location of the cursor in the display +screen RAM. Those characters are converted, if needed, into the encoding that +can be passed to <tt/cputs()/. The first argument must point to a RAM area +that's large enough to hold "length + 1" bytes. +<tag/Notes/<itemize> +<item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was +done to make it obvious that peeking doesn't move the cursor in any way. Your +program must place the cursor where it wants to peek before it calls any of +those functions. +<item>The function is available as only a fastcall function; +so, it may be used only in the presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="cpeekc" name="cpeekc">, +<ref id="cpeekcolor" name="cpeekcolor">, +<ref id="cpeekrevers" name="cpeekrevers">, +<ref id="cputc" name="cputc">, +<ref id="cputs" name="cputs"> +<tag/Example/None. +</descrip> +</quote> + + <sect1>creat<label id="creat"><p> <quote> diff --git a/include/cbm610.h b/include/cbm610.h index 79d498431..b0486044b 100644 --- a/include/cbm610.h +++ b/include/cbm610.h @@ -144,11 +144,9 @@ void __fastcall__ pokewsys (unsigned addr, unsigned val); #define _textcolor(color) COLOR_WHITE #define _bgcolor(color) COLOR_BLACK #define _bordercolor(color) COLOR_BLACK +#define _cpeekcolor(color) COLOR_WHITE /* End of cbm610.h */ #endif - - - diff --git a/include/conio.h b/include/conio.h index baf55dd08..9cd505766 100644 --- a/include/conio.h +++ b/include/conio.h @@ -148,6 +148,23 @@ int cscanf (const char* format, ...); int __fastcall__ vcscanf (const char* format, va_list ap); /* Like vscanf(), but uses direct keyboard input */ +char cpeekc (void); +/* Return the character from the current cursor position */ + +unsigned char cpeekcolor (void); +/* Return the color from the current cursor position */ + +unsigned char cpeekrevers (void); +/* Return the reverse attribute from the current cursor position. +** If the character is reversed, then return 1; return 0 otherwise. +*/ + +void __fastcall__ cpeeks (char* s, unsigned int length); +/* Return a string of the characters that start at the current cursor position. +** Put the string into the buffer to which "s" points. The string will have +** "length" characters, then will be '\0'-terminated. +*/ + unsigned char __fastcall__ cursor (unsigned char onoff); /* If onoff is 1, a cursor is displayed when waiting for keyboard input. If ** onoff is 0, the cursor is hidden when waiting for keyboard input. The @@ -224,6 +241,9 @@ void __fastcall__ cputhex16 (unsigned val); #if defined(_bordercolor) # define bordercolor(x) _bordercolor(x) #endif +#if defined(_cpeekcolor) +# define cpeekcolor(x) _cpeekcolor(x) +#endif diff --git a/include/pet.h b/include/pet.h index e9659d524..249d8b608 100644 --- a/include/pet.h +++ b/include/pet.h @@ -105,6 +105,7 @@ extern void pet_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ #define _textcolor(color) COLOR_WHITE #define _bgcolor(color) COLOR_BLACK #define _bordercolor(color) COLOR_BLACK +#define _cpeekcolor(color) COLOR_WHITE diff --git a/libsrc/c128/cpeekc.s b/libsrc/c128/cpeekc.s new file mode 100644 index 000000000..ce6bb4ff5 --- /dev/null +++ b/libsrc/c128/cpeekc.s @@ -0,0 +1,65 @@ +; +; 2016-02-28, Groepaz +; 2017-06-26, Greg King +; +; char cpeekc (void); +; + + .export _cpeekc + + .import plot, popa + + .include "zeropage.inc" + .include "c128.inc" + + +_cpeekc: + lda MODE + bmi @c80 + + ldy CURS_X + lda (SCREEN_PTR),y ; get char + +@return: + and #<~$80 ; remove reverse flag + +; Convert the screen code into a PetSCII code. +; $00 - $1F: +$40 +; $20 - $3F +; $40 - $7F: +$80 + + cmp #$20 + bcs @sk1 ;(bge) + ora #$40 + rts + +@sk1: cmp #$40 + bcc @end ;(blt) + ora #$80 +@end: ldx #0 + rts + +@c80: + lda SCREEN_PTR + ldy SCREEN_PTR+1 + clc + adc CURS_X + bcc @s + iny + + ; get byte from VDC mem +@s: ldx #VDC_DATA_LO + stx VDC_INDEX +@L0: bit VDC_INDEX + bpl @L0 + sta VDC_DATA + dex + stx VDC_INDEX + sty VDC_DATA + + ldx #VDC_RAM_RW + stx VDC_INDEX +@L1: bit VDC_INDEX + bpl @L1 ; wait for blanking + lda VDC_DATA + jmp @return diff --git a/libsrc/c128/cpeekcolor.s b/libsrc/c128/cpeekcolor.s new file mode 100644 index 000000000..9a8c3bfdc --- /dev/null +++ b/libsrc/c128/cpeekcolor.s @@ -0,0 +1,56 @@ +; +; 2016-02-28, Groepaz +; 2017-06-26, Greg King +; +; unsigned char cpeekcolor (void); +; + + .export _cpeekcolor + + .include "c128.inc" + + +_cpeekcolor: + bit MODE + bmi @c80 + + ldy CURS_X + lda (CRAM_PTR),y ; get color + and #$0F + ldx #>$0000 + rts + +@c80: lda CRAM_PTR + ldy CRAM_PTR+1 + clc + adc CURS_X + bcc @s + iny + + ; get byte from VDC mem +@s: ldx #VDC_DATA_LO + stx VDC_INDEX +@L0: bit VDC_INDEX + bpl @L0 + sta VDC_DATA + dex + stx VDC_INDEX + sty VDC_DATA + + ldx #VDC_RAM_RW + stx VDC_INDEX +@L1: bit VDC_INDEX + bpl @L1 ; wait for blanking + lda VDC_DATA + and #$0F + +; translate VDC->VIC colour + +vdctovic: + ldy #$0F + 1 +@L2: dey + cmp $CE5C,y + bne @L2 + tya + ldx #>$0000 + rts diff --git a/libsrc/c128/cpeekrevers.s b/libsrc/c128/cpeekrevers.s new file mode 100644 index 000000000..c36e4ac44 --- /dev/null +++ b/libsrc/c128/cpeekrevers.s @@ -0,0 +1,51 @@ +; +; 2016-02-28, Groepaz +; 2017-06-26, Greg King +; +; unsigned char cpeekrevers (void); +; + + .export _cpeekrevers + + .include "zeropage.inc" + .include "c128.inc" + + +_cpeekrevers: + lda MODE + bmi @c80 + + ldy CURS_X + lda (SCREEN_PTR),y ; get char + +@return: + and #$80 ; get reverse flag + asl a + tax ; ldx #>$0000 + rol a ; return boolean value + rts + +@c80: + lda SCREEN_PTR + ldy SCREEN_PTR+1 + clc + adc CURS_X + bcc @s + iny + + ; get byte from VDC mem +@s: ldx #VDC_DATA_LO + stx VDC_INDEX +@L0: bit VDC_INDEX + bpl @L0 + sta VDC_DATA + dex + stx VDC_INDEX + sty VDC_DATA + + ldx #VDC_RAM_RW + stx VDC_INDEX +@L1: bit VDC_INDEX + bpl @L1 ; wait for blanking + lda VDC_DATA + jmp @return diff --git a/libsrc/c128/cpeeks.s b/libsrc/c128/cpeeks.s new file mode 100644 index 000000000..c9d806ef3 --- /dev/null +++ b/libsrc/c128/cpeeks.s @@ -0,0 +1,15 @@ +; +; 2017-11-23, Greg King +; +; void cpeeks (char* s, unsigned length); +; +; C128 can't use "cbm/cpeeks.s" because both 40 and 80 columns must be handled. +; Stub file, for now, so that its library can be built. + + .export _cpeeks + + .import popax + + +_cpeeks: + jmp popax ; pop s diff --git a/libsrc/cbm/cpeekc.s b/libsrc/cbm/cpeekc.s new file mode 100644 index 000000000..05c7fc718 --- /dev/null +++ b/libsrc/cbm/cpeekc.s @@ -0,0 +1,53 @@ +; +; 2016-02-28, Groepaz +; 2017-06-22, Greg King +; +; char cpeekc (void); +; + + .export _cpeekc + +; Get a system-specific file. +; Note: The cbm610, and c128 targets need special +; versions that handle RAM banking and the 80-column VDC. + +.if .def(__C16__) + .include "plus4.inc" ; both C16 and Plus4 +.elseif .def(__C64__) + .include "c64.inc" +.elseif .def(__CBM510__) + .import CURS_X: zp, SCREEN_PTR: zp + .include "cbm510.inc" +.elseif .def(__PET__) + .include "pet.inc" +.elseif .def(__VIC20__) + .include "vic20.inc" +.endif + + +_cpeekc: + ldy CURS_X + lda (SCREEN_PTR),y ; get screen code + ldx #>$0000 + and #<~$80 ; remove reverse bit + +; Convert the screen code into a PetSCII code. +; $00 - $1F: +$40 +; $20 - $3F +; $40 - $5f: +$20 +; $60 - $7F: +$40 + + cmp #$20 + bcs @sk1 ;(bge) + ora #$40 + rts + +@sk1: cmp #$40 + bcc @end ;(blt) + cmp #$60 + bcc @sk2 ;(blt) + ;sec + adc #$20 - $01 +@sk2: ;clc ; both above cmp and adc clear carry flag + adc #$20 +@end: rts diff --git a/libsrc/cbm/cpeekcolor.s b/libsrc/cbm/cpeekcolor.s new file mode 100644 index 000000000..9c961b771 --- /dev/null +++ b/libsrc/cbm/cpeekcolor.s @@ -0,0 +1,28 @@ +; +; 2016-02-28, Groepaz +; 2017-06-22, Greg King +; +; unsigned char cpeekcolor (void); +; + + .export _cpeekcolor + +; Get a system-specific file. +; Note: The cbm510, cbm610, c128, and Pet targets need special +; versions that handle RAM banking, the 80-column VDC, and monochrome. + +.if .def(__C16__) + .include "plus4.inc" ; both C16 and Plus4 +.elseif .def(__C64__) + .include "c64.inc" +.elseif .def(__VIC20__) + .include "vic20.inc" +.endif + + +_cpeekcolor: + ldy CURS_X + lda (CRAM_PTR),y ; get color + and #$0F + ldx #>$0000 + rts diff --git a/libsrc/cbm/cpeekrevers.s b/libsrc/cbm/cpeekrevers.s new file mode 100644 index 000000000..e8e210167 --- /dev/null +++ b/libsrc/cbm/cpeekrevers.s @@ -0,0 +1,35 @@ +; +; 2016-02-28, Groepaz +; 2017-06-15, Greg King +; +; unsigned char cpeekrevers (void); +; + + .export _cpeekrevers + +; Get a system-specific file. +; Note: The cbm610, and c128 targets need special +; versions that handle RAM banking and the 80-column VDC. + +.if .def(__C16__) + .include "plus4.inc" ; both C16 and Plus4 +.elseif .def(__C64__) + .include "c64.inc" +.elseif .def(__CBM510__) + .import CURS_X: zp, SCREEN_PTR: zp + .include "cbm510.inc" +.elseif .def(__PET__) + .include "pet.inc" +.elseif .def(__VIC20__) + .include "vic20.inc" +.endif + + +_cpeekrevers: + ldy CURS_X + lda (SCREEN_PTR),y ; get screen code + and #$80 ; get reverse bit + asl a + tax ; ldx #>$0000 + rol a ; return boolean value + rts diff --git a/libsrc/cbm/cpeeks.s b/libsrc/cbm/cpeeks.s new file mode 100644 index 000000000..215998e37 --- /dev/null +++ b/libsrc/cbm/cpeeks.s @@ -0,0 +1,93 @@ +; +; 2017-07-05, Greg King +; +; void cpeeks (char* s, unsigned length); +; + + .export _cpeeks + + .import popax + .importzp ptr1, ptr2, ptr3, tmp1, tmp2 + + .macpack generic + +; Get a system-specific file. +; Note: The cbm610, and c128 targets need special +; versions that handle RAM banking and the 80-column VDC. + +.if .def(__C16__) + .include "plus4.inc" ; both C16 and Plus4 +.elseif .def(__C64__) + .include "c64.inc" +.elseif .def(__CBM510__) + .import CURS_X: zp, SCREEN_PTR: zp + .include "cbm510.inc" +.elseif .def(__PET__) + .include "pet.inc" +.elseif .def(__VIC20__) + .include "vic20.inc" +.endif + + +_cpeeks: + eor #<$FFFF ; counting a word upward is faster + sta ptr3 ; so, we use -(length + 1) + txa + eor #>$FFFF + sta ptr3+1 + + lda SCREEN_PTR + ldx SCREEN_PTR+1 + sta ptr2 + stx ptr2+1 + ldy CURS_X + sty tmp2 + + jsr popax + sta tmp1 ; (will be a .Y index) + stx ptr1+1 + ldx #<$0000 + stx ptr1 + bze L3 ; branch always + +L4: ldy tmp2 + lda (ptr2),y ; get char + iny + bnz L2 + inc ptr2+1 +L2: sty tmp2 + and #<~$80 ; remove reverse bit + +; Convert the screen code into a PetSCII code. +; $00 - $1F: +$40 +; $20 - $3F +; $40 - $5f: +$20 +; $60 - $7F: +$40 + + cmp #$20 + blt @sk1 ;(bcc) + cmp #$40 + blt L5 + cmp #$60 + blt @sk2 ;(bcc) + clc +@sk1: adc #$20 +@sk2: ;clc ; both above cmp and adc clear carry flag + adc #$20 + +L5: ldy tmp1 + sta (ptr1),y + iny + bnz L1 + inc ptr1+1 +L1: sty tmp1 + +L3: inc ptr3 ; count length + bnz L4 + inc ptr3+1 + bnz L4 + + txa ; terminate the string + ldy tmp1 + sta (ptr1),y + rts diff --git a/libsrc/cbm510/cpeekcolor.s b/libsrc/cbm510/cpeekcolor.s new file mode 100644 index 000000000..44c0a1595 --- /dev/null +++ b/libsrc/cbm510/cpeekcolor.s @@ -0,0 +1,24 @@ +; +; 2016-02-28, Groepaz +; 2017-06-19, Greg King +; +; unsigned char cpeekcolor (void); +; + + .export _cpeekcolor + + .import CURS_X: zp, CRAM_PTR: zp + + .include "cbm510.inc" + + +_cpeekcolor: + ldx IndReg + lda #$0F + sta IndReg + ldy CURS_X + lda (CRAM_PTR),y ; get color + stx IndReg + and #$0F + ldx #>$0000 + rts diff --git a/libsrc/cbm510/doesclrscr.s b/libsrc/cbm510/doesclrscr.s new file mode 100644 index 000000000..e0f57374c --- /dev/null +++ b/libsrc/cbm510/doesclrscr.s @@ -0,0 +1,16 @@ +; +; 2016-06, Christian Groessler +; 2017-07-05, Greg King +; +; unsigned char doesclrscrafterexit (void); +; +; Returns 0/1 if, after program termination, the screen isn't/is cleared. +; + + .import return1 + +; cc65's CBM510 programs switch to a display screen in the program RAM bank; +; then, they switch back to the system bank when they exit. +; The screen is cleared. + + .export _doesclrscrafterexit := return1 diff --git a/libsrc/cbm610/cpeekc.s b/libsrc/cbm610/cpeekc.s new file mode 100644 index 000000000..295d096f3 --- /dev/null +++ b/libsrc/cbm610/cpeekc.s @@ -0,0 +1,45 @@ +; +; 2016-02-28, Groepaz +; 2017-06-19, Greg King +; +; char cpeekc (void); +; + + .export _cpeekc + + .import CURS_X: zp, CharPtr: zp + + .include "cbm610.inc" + + +_cpeekc: + ldx IndReg + ldy #$0F + sty IndReg + + ldy CURS_X + lda (CharPtr),y ; get char from system bank + stx IndReg + ldx #>$0000 + and #<~$80 ; remove reverse bit + +; Convert the screen code into a PetSCII code. +; $00 - $1F: +$40 +; $20 - $3F +; $40 - $5f: +$20 +; $60 - $7F: +$40 + + cmp #$20 + bcs @sk1 ;(bge) + ora #$40 + rts + +@sk1: cmp #$40 + bcc @end ;(blt) + cmp #$60 + bcc @sk2 ;(blt) + ;sec + adc #$20 - $01 +@sk2: ;clc ; both above cmp and adc clear carry flag + adc #$20 +@end: rts diff --git a/libsrc/cbm610/cpeekcolor.s b/libsrc/cbm610/cpeekcolor.s new file mode 100644 index 000000000..ed275ec95 --- /dev/null +++ b/libsrc/cbm610/cpeekcolor.s @@ -0,0 +1,8 @@ +; +; 2017-06-03, Greg King +; +; unsigned char cpeekcolor (void); +; + + .import return1 + .export _cpeekcolor := return1 ; always COLOR_WHITE diff --git a/libsrc/cbm610/cpeekrevers.s b/libsrc/cbm610/cpeekrevers.s new file mode 100644 index 000000000..52e166e85 --- /dev/null +++ b/libsrc/cbm610/cpeekrevers.s @@ -0,0 +1,29 @@ +; +; 2016-02-28, Groepaz +; 2017-06-19, Greg King +; +; unsigned char cpeekrevers (void); +; + + .export _cpeekrevers + + .import plot + .import CURS_X: zp, CharPtr: zp + + .include "cbm610.inc" + + +_cpeekrevers: + ldx IndReg + ldy #$0F + sty IndReg + + ldy CURS_X + lda (CharPtr),y ; get char from system bank + stx IndReg + ldx #>$0000 + and #$80 ; get reverse bit + asl a + tax ; ldx #>$0000 + rol a ; return boolean value + rts diff --git a/libsrc/cbm610/cpeeks.s b/libsrc/cbm610/cpeeks.s new file mode 100644 index 000000000..91aae8957 --- /dev/null +++ b/libsrc/cbm610/cpeeks.s @@ -0,0 +1,82 @@ +; +; 2017-07-05, Greg King +; +; void cpeeks (char* s, unsigned length); +; + + .export _cpeeks + + .import popax + .importzp ptr1, ptr2, ptr3, tmp1, tmp2 + .importzp CURS_X, SCREEN_PTR + + .include "cbm610.inc" + .macpack generic + + +_cpeeks: + eor #<$FFFF ; counting a word upward is faster + sta ptr3 ; so, we use -(length + 1) + txa + eor #>$FFFF + sta ptr3+1 + + lda SCREEN_PTR + ldx SCREEN_PTR+1 + sta ptr2 + stx ptr2+1 + ldy CURS_X + sty tmp2 + + jsr popax + sta tmp1 ; (will be a .Y index) + stx ptr1+1 + ldx IndReg + ldy #<$0000 + sty ptr1 + bze L3 ; branch always + +L4: ldy #$0F + sty IndReg + ldy tmp2 + lda (ptr2),y ; get char from system bank + stx IndReg + iny + bnz L2 + inc ptr2+1 +L2: sty tmp2 + and #<~$80 ; remove reverse bit + +; Convert the screen code into a PetSCII code. +; $00 - $1F: +$40 +; $20 - $3F +; $40 - $5f: +$20 +; $60 - $7F: +$40 + + cmp #$20 + blt @sk1 ;(bcc) + cmp #$40 + blt L5 + cmp #$60 + blt @sk2 ;(bcc) + clc +@sk1: adc #$20 +@sk2: ;clc ; both above cmp and adc clear carry flag + adc #$20 + +L5: ldy tmp1 + sta (ptr1),y + iny + bnz L1 + inc ptr1+1 +L1: sty tmp1 + +L3: inc ptr3 ; count length + bnz L4 + inc ptr3+1 + bnz L4 + + lda #$00 ; terminate the string + ldy tmp1 + sta (ptr1),y + rts diff --git a/libsrc/pet/cpeekcolor.s b/libsrc/pet/cpeekcolor.s new file mode 100644 index 000000000..ed275ec95 --- /dev/null +++ b/libsrc/pet/cpeekcolor.s @@ -0,0 +1,8 @@ +; +; 2017-06-03, Greg King +; +; unsigned char cpeekcolor (void); +; + + .import return1 + .export _cpeekcolor := return1 ; always COLOR_WHITE diff --git a/testcode/lib/cpeek-test.c b/testcode/lib/cpeek-test.c new file mode 100644 index 000000000..27923432b --- /dev/null +++ b/testcode/lib/cpeek-test.c @@ -0,0 +1,177 @@ +/* Test that the cpeek...() functions are the inverses of cputc(), +** revers(), and textcolor() for the full range of character codes. +** +** 2017-07-15, Greg King +*/ + +#include <conio.h> +#include <cc65.h> + +/* Standard location of the screen */ + +#if defined(__C128__) || defined(__C64__) +/* only 40-column screen */ +# define SCREEN_RAM ((unsigned char*)0x0400) +#elif defined(__C16__) /* Plus4 also */ +# define SCREEN_RAM ((unsigned char*)0x0C00) +#elif defined(__CBM510__) +# define SCREEN_RAM ((unsigned char*)0xF000) +#elif defined(__CBM610__) +# define SCREEN_RAM ((unsigned char*)0xD000) +#elif defined(__PET__) +# define SCREEN_RAM ((unsigned char*)0x0800) +#elif defined(__VIC20__) +# define SCREEN_RAM ((unsigned char*)0x1000) +#else +# error This program cannot test that target. +# define SCREEN_RAM ((unsigned char*)0) +#endif + +static unsigned char width; + + +/* Move the cursor backward one char with +** the recognition of a row change. +*/ +static void chBack (void) +{ + unsigned char y = wherey (); + unsigned char x = wherex (); + + if (x == 0) { + x = width; + --y; + } + --x; + + gotoxy (x, y); +} + + +/* Move the cursor forward one char with +** the recognition of a row change. +*/ +static void chForth (void) +{ + unsigned char y = wherey (); + unsigned char x = wherex (); + + if (++x >= width) { + x = 0; + ++y; + } + + gotoxy (x, y); +} + + +/* A hack to get an unmodified byte from the +** screen memory at the current cursor position. +*/ +static unsigned char peekChWithoutTranslation (void) +{ +#if defined(__CBM610__) + return peekbsys ((unsigned)&SCREEN_RAM[wherey () * width + wherex ()]); +#else + return SCREEN_RAM[wherey () * width + wherex ()]; +#endif +} + + +/* A test which outputs the given char, reads it back from +** screen memory, outputs the returned char at the next position, +** then compares the two screen memory bytes for identity. +** +** Note: cpeekc() must be tested indirectly because some platforms "fold" their +** character code-set into a smaller screen code-set. Therefore, cpeekc() might +** return an equivalent, but not equal, character to the one that was cputc(). +*/ +static unsigned char testCPeekC (char ch) +{ + unsigned char ch2_a, ch2_b, ch2_c; + + /* Test the given char-code, but not the + ** special characters NEWLINE and RETURN + ** (they don't put anything on the screen). + */ + if (('\n' == ch) || ('\r' == ch) + ) { + return 1; + } + + /* Output the char to the screen. */ + cputc (ch); + + /* Move the cursor pos. to the previous output. */ + chBack (); + + /* Get back the written char without any translation. */ + ch2_b = peekChWithoutTranslation (); + + /* Get back the written char, + ** including the translation, screen-code -> text. + */ + ch2_a = cpeekc (); + + /* Move the cursor to the following writing position. */ + chForth (); + + /* Output again the char which was read back by cpeekc(). */ + cputc (ch2_a); + + /* Move the cursor pos. to the second output. */ + chBack (); + + /* Get back the second written char without any translation; + ** and, compare it to the first untranslated char. + */ + ch2_c = peekChWithoutTranslation (); + if (ch2_c != ch2_b) { + /* The test was NOT succesful. + ** Output a diagnostic; and, return FAILURE. + */ + revers(0); + cprintf ("\r\nError on char: %#x was %#x instead.", ch, ch2_a); + cprintf ("\r\nRaw screen codes: %#x, %#x.", ch2_b, ch2_c); + return 0; + } + + /* The test was succesful. + ** Move the cursor to the following writing position. + */ + chForth (); + return 1; +} + + +/* The main code initiates the screen for the tests, and sets the reverse flag. +** Then, it calls testCPeekC() for every char within 0..255. +** Returns zero for success, one for failure. +*/ +int main (void) +{ + unsigned char i; + int ret = 0; + + clrscr (); + revers (1); + screensize (&width, &i); + +#if defined(__VIC20__) + /* The VIC-20's screen is too small to hold the full test. */ + i = 2; +#else + i = 0; +#endif + do { + if (!testCPeekC (i)) { + ret = 1; + break; + } + } while (++i != 0); /* will wrap around when finished */ + + if (doesclrscrafterexit()) { + cgetc(); + } + return ret; +} From a54b4bebde59962594734e89c9765b4dd3d4eb74 Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Mon, 11 Dec 2017 21:15:29 +0100 Subject: [PATCH 071/254] PET screen memory is at $8000, not $0800 --- testcode/lib/cpeek-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcode/lib/cpeek-test.c b/testcode/lib/cpeek-test.c index 27923432b..86bdc74ee 100644 --- a/testcode/lib/cpeek-test.c +++ b/testcode/lib/cpeek-test.c @@ -19,7 +19,7 @@ #elif defined(__CBM610__) # define SCREEN_RAM ((unsigned char*)0xD000) #elif defined(__PET__) -# define SCREEN_RAM ((unsigned char*)0x0800) +# define SCREEN_RAM ((unsigned char*)0x8000) #elif defined(__VIC20__) # define SCREEN_RAM ((unsigned char*)0x1000) #else From 9a609f6766f62ff0b609c6174bbaf24b8e2b8eb8 Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Mon, 11 Dec 2017 21:53:00 +0100 Subject: [PATCH 072/254] fix petscii conversion for C128 --- libsrc/c128/cpeekc.s | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libsrc/c128/cpeekc.s b/libsrc/c128/cpeekc.s index ce6bb4ff5..9d64388a4 100644 --- a/libsrc/c128/cpeekc.s +++ b/libsrc/c128/cpeekc.s @@ -26,7 +26,8 @@ _cpeekc: ; Convert the screen code into a PetSCII code. ; $00 - $1F: +$40 ; $20 - $3F -; $40 - $7F: +$80 +; $40 - $5f: +$20 +; $60 - $7F: +$40 cmp #$20 bcs @sk1 ;(bge) @@ -35,9 +36,13 @@ _cpeekc: @sk1: cmp #$40 bcc @end ;(blt) - ora #$80 -@end: ldx #0 - rts + cmp #$60 + bcc @sk2 ;(blt) + ;sec + adc #$20 - $01 +@sk2: ;clc ; both above cmp and adc clear carry flag + adc #$20 +@end: rts @c80: lda SCREEN_PTR From 74b5540f76c8e8ab09c219e871e7cae826d59731 Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Tue, 12 Dec 2017 03:48:43 +0100 Subject: [PATCH 073/254] copy cpeeks from generic version, this at least makes it work for 40 columns --- libsrc/c128/cpeeks.s | 72 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/libsrc/c128/cpeeks.s b/libsrc/c128/cpeeks.s index c9d806ef3..e0723e694 100644 --- a/libsrc/c128/cpeeks.s +++ b/libsrc/c128/cpeeks.s @@ -1,15 +1,79 @@ ; -; 2017-11-23, Greg King +; 2017-07-05, Greg King ; ; void cpeeks (char* s, unsigned length); ; -; C128 can't use "cbm/cpeeks.s" because both 40 and 80 columns must be handled. -; Stub file, for now, so that its library can be built. .export _cpeeks .import popax + .importzp ptr1, ptr2, ptr3, tmp1, tmp2 + .macpack generic + +; FIXME c128 needs special version that handles the 80-column VDC. + + .include "c128.inc" _cpeeks: - jmp popax ; pop s + eor #<$FFFF ; counting a word upward is faster + sta ptr3 ; so, we use -(length + 1) + txa + eor #>$FFFF + sta ptr3+1 + + lda SCREEN_PTR + ldx SCREEN_PTR+1 + sta ptr2 + stx ptr2+1 + ldy CURS_X + sty tmp2 + + jsr popax + sta tmp1 ; (will be a .Y index) + stx ptr1+1 + ldx #<$0000 + stx ptr1 + bze L3 ; branch always + +L4: ldy tmp2 + lda (ptr2),y ; get char + iny + bnz L2 + inc ptr2+1 +L2: sty tmp2 + and #<~$80 ; remove reverse bit + +; Convert the screen code into a PetSCII code. +; $00 - $1F: +$40 +; $20 - $3F +; $40 - $5f: +$20 +; $60 - $7F: +$40 + + cmp #$20 + blt @sk1 ;(bcc) + cmp #$40 + blt L5 + cmp #$60 + blt @sk2 ;(bcc) + clc +@sk1: adc #$20 +@sk2: ;clc ; both above cmp and adc clear carry flag + adc #$20 + +L5: ldy tmp1 + sta (ptr1),y + iny + bnz L1 + inc ptr1+1 +L1: sty tmp1 + +L3: inc ptr3 ; count length + bnz L4 + inc ptr3+1 + bnz L4 + + txa ; terminate the string + ldy tmp1 + sta (ptr1),y + rts From 4d95e578f45d3ab0df41237ab67c4eab04f7e345 Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Tue, 12 Dec 2017 03:49:07 +0100 Subject: [PATCH 074/254] added missing tests --- testcode/lib/cpeek-test.c | 99 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/testcode/lib/cpeek-test.c b/testcode/lib/cpeek-test.c index 86bdc74ee..d02972202 100644 --- a/testcode/lib/cpeek-test.c +++ b/testcode/lib/cpeek-test.c @@ -16,6 +16,7 @@ # define SCREEN_RAM ((unsigned char*)0x0C00) #elif defined(__CBM510__) # define SCREEN_RAM ((unsigned char*)0xF000) +# define COLOR_RAM ((unsigned char*)0xd400) #elif defined(__CBM610__) # define SCREEN_RAM ((unsigned char*)0xD000) #elif defined(__PET__) @@ -77,6 +78,18 @@ static unsigned char peekChWithoutTranslation (void) #endif } +/* as above, but for color ram */ +static unsigned char peekColWithoutTranslation (void) +{ +#if defined(__CBM610__) || defined (__PET__) + return COLOR_WHITE; +#elif defined(__C128__) || defined(__C64__) || defined(__VIC20__) || defined(__CBM510__) + return COLOR_RAM[wherey () * width + wherex ()] & 0x0f; +#else + return COLOR_RAM[wherey () * width + wherex ()]; +#endif +} + /* A test which outputs the given char, reads it back from ** screen memory, outputs the returned char at the next position, @@ -133,6 +146,7 @@ static unsigned char testCPeekC (char ch) revers(0); cprintf ("\r\nError on char: %#x was %#x instead.", ch, ch2_a); cprintf ("\r\nRaw screen codes: %#x, %#x.", ch2_b, ch2_c); + cprintf ("\r\nscreen width: %#d", width); return 0; } @@ -143,18 +157,70 @@ static unsigned char testCPeekC (char ch) return 1; } +static unsigned char testCPeekCol (char ch) +{ + unsigned char ch2_a, ch2_b, ch2_c; + + /* Output the char to the screen. */ + textcolor (ch); + cputc ('*'); + + /* Move the cursor pos. to the previous output. */ + chBack (); + + /* Get back the written char without any translation. */ + ch2_b = peekColWithoutTranslation (); + + /* Get back the written char, + ** including the translation, screen-code -> text. + */ + ch2_a = cpeekcolor (); + + /* Move the cursor to the following writing position. */ + chForth (); + + /* Output again the char which was read back by cpeekc(). */ + textcolor (ch2_a); + cputc ('x'); + + /* Move the cursor pos. to the second output. */ + chBack (); + + /* Get back the second written char without any translation; + ** and, compare it to the first untranslated char. + */ + ch2_c = peekColWithoutTranslation (); + if (ch2_c != ch2_b) { + /* The test was NOT succesful. + ** Output a diagnostic; and, return FAILURE. + */ + revers(0); + cprintf ("\r\nError on color: %#x was %#x instead.", ch, ch2_a); + cprintf ("\r\nRaw color codes: %#x, %#x.", ch2_b, ch2_c); + return 0; + } + + /* The test was succesful. + ** Move the cursor to the following writing position. + */ + chForth (); + return 1; +} /* The main code initiates the screen for the tests, and sets the reverse flag. ** Then, it calls testCPeekC() for every char within 0..255. +** Then, it calls testCPeekCol() for each color ** Returns zero for success, one for failure. */ int main (void) { - unsigned char i; + unsigned char i, c1, c2; + char s[10]; int ret = 0; clrscr (); revers (1); + textcolor(1); screensize (&width, &i); #if defined(__VIC20__) @@ -166,10 +232,39 @@ int main (void) do { if (!testCPeekC (i)) { ret = 1; - break; + goto exiterror; } } while (++i != 0); /* will wrap around when finished */ + /* test colors */ + clrscr (); + revers (0); +#if defined (__CBM610__) || defined (__PET__) + cprintf("no COLOR_RAM\n\r"); +#else + cprintf("COLOR_RAM at $%04x\n\r", COLOR_RAM); +#endif + do { + if (!testCPeekCol (i)) { + ret = 1; + goto exiterror; + } + } while (++i != 16); /* max 16 colors */ + + /* test revers */ + textcolor(1); cputc('\n'); cputc('\r'); + revers(0); cputc('*'); chBack (); c1 = cpeekrevers(); chForth(); + revers(1); cputc('*'); chBack (); c2 = cpeekrevers(); chForth(); + cputc('\n'); cputc('\r'); + revers(c1); cputc('*'); + revers(c2); cputc('*'); + + /* test cpeeks() */ + revers(0); + cprintf("\n\rtest1234"); gotox(0); cpeeks(s, 8); cputs("\n"); + cputs(s); + +exiterror: if (doesclrscrafterexit()) { cgetc(); } From 4da22fc6a095258e8ee16a6659ca4a90585c18f1 Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Tue, 12 Dec 2017 04:32:39 +0100 Subject: [PATCH 075/254] fix cpeeks for CBM610 --- libsrc/cbm610/cpeeks.s | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libsrc/cbm610/cpeeks.s b/libsrc/cbm610/cpeeks.s index 91aae8957..352521bcc 100644 --- a/libsrc/cbm610/cpeeks.s +++ b/libsrc/cbm610/cpeeks.s @@ -8,7 +8,7 @@ .import popax .importzp ptr1, ptr2, ptr3, tmp1, tmp2 - .importzp CURS_X, SCREEN_PTR + .importzp CURS_X, CharPtr .include "cbm610.inc" .macpack generic @@ -21,8 +21,8 @@ _cpeeks: eor #>$FFFF sta ptr3+1 - lda SCREEN_PTR - ldx SCREEN_PTR+1 + lda CharPtr + ldx CharPtr+1 sta ptr2 stx ptr2+1 ldy CURS_X From 892732f3403e187026d518bdeb690de66408b8eb Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Tue, 12 Dec 2017 17:05:24 +0100 Subject: [PATCH 076/254] fix cpeeks() for C128 VDC --- libsrc/c128/cpeeks.s | 80 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/libsrc/c128/cpeeks.s b/libsrc/c128/cpeeks.s index e0723e694..12c3349e4 100644 --- a/libsrc/c128/cpeeks.s +++ b/libsrc/c128/cpeeks.s @@ -1,5 +1,6 @@ ; ; 2017-07-05, Greg King +; 2017-12-12, Groepaz ; ; void cpeeks (char* s, unsigned length); ; @@ -22,6 +23,9 @@ _cpeeks: eor #>$FFFF sta ptr3+1 + lda MODE + bmi c80 + lda SCREEN_PTR ldx SCREEN_PTR+1 sta ptr2 @@ -77,3 +81,79 @@ L3: inc ptr3 ; count length ldy tmp1 sta (ptr1),y rts + + ;----------------------------------------------------------- +c80: + lda SCREEN_PTR + clc + adc CURS_X + sta ptr2 + lda SCREEN_PTR+1 + adc #0 + sta ptr2+1 + + jsr popax + sta tmp1 ; (will be a .Y index) + stx ptr1+1 + ldx #<$0000 + stx ptr1 + bze L3a ; branch always + +L4a: + lda ptr2 + ldy ptr2+1 + inc ptr2 + bne @s + inc ptr2+1 +@s: + ; get byte from VDC mem + ldx #VDC_DATA_LO + stx VDC_INDEX +@L0: bit VDC_INDEX + bpl @L0 + sta VDC_DATA + dex + stx VDC_INDEX + sty VDC_DATA + + ldx #VDC_RAM_RW + stx VDC_INDEX +@L1: bit VDC_INDEX + bpl @L1 ; wait for blanking + lda VDC_DATA + + and #<~$80 ; remove reverse bit + +; Convert the screen code into a PetSCII code. +; $00 - $1F: +$40 +; $20 - $3F +; $40 - $5f: +$20 +; $60 - $7F: +$40 + + cmp #$20 + blt @sk1 ;(bcc) + cmp #$40 + blt L5a + cmp #$60 + blt @sk2 ;(bcc) + clc +@sk1: adc #$20 +@sk2: ;clc ; both above cmp and adc clear carry flag + adc #$20 + +L5a: ldy tmp1 + sta (ptr1),y + iny + bnz L1a + inc ptr1+1 +L1a: sty tmp1 + +L3a: inc ptr3 ; count length + bnz L4a + inc ptr3+1 + bnz L4a + + lda #0 ; terminate the string + ldy tmp1 + sta (ptr1),y + rts From 2957acd133c6eb7436a984d704575b1c2b77d0f3 Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Tue, 12 Dec 2017 17:05:52 +0100 Subject: [PATCH 077/254] some tweaks to testprog --- testcode/lib/cpeek-test.c | 53 +++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/testcode/lib/cpeek-test.c b/testcode/lib/cpeek-test.c index d02972202..5f3bfc524 100644 --- a/testcode/lib/cpeek-test.c +++ b/testcode/lib/cpeek-test.c @@ -2,6 +2,7 @@ ** revers(), and textcolor() for the full range of character codes. ** ** 2017-07-15, Greg King +** 2017-12-12, Groepaz */ #include <conio.h> @@ -139,7 +140,12 @@ static unsigned char testCPeekC (char ch) ** and, compare it to the first untranslated char. */ ch2_c = peekChWithoutTranslation (); - if (ch2_c != ch2_b) { + if ((ch2_c != ch2_b) +#if defined(__C128__) + /* VDC memory is not accessable */ + && (width == 40) +#endif + ){ /* The test was NOT succesful. ** Output a diagnostic; and, return FAILURE. */ @@ -190,7 +196,12 @@ static unsigned char testCPeekCol (char ch) ** and, compare it to the first untranslated char. */ ch2_c = peekColWithoutTranslation (); - if (ch2_c != ch2_b) { + if ((ch2_c != ch2_b) +#if defined(__C128__) + /* VDC memory is not accessable */ + && (width == 40) +#endif + ){ /* The test was NOT succesful. ** Output a diagnostic; and, return FAILURE. */ @@ -221,6 +232,7 @@ int main (void) clrscr (); revers (1); textcolor(1); + bgcolor(0); screensize (&width, &i); #if defined(__VIC20__) @@ -236,14 +248,29 @@ int main (void) } } while (++i != 0); /* will wrap around when finished */ - /* test colors */ - clrscr (); - revers (0); -#if defined (__CBM610__) || defined (__PET__) - cprintf("no COLOR_RAM\n\r"); -#else - cprintf("COLOR_RAM at $%04x\n\r", COLOR_RAM); +#if defined(__VIC20__) + cgetc(); #endif + + /* test colors */ +#if defined(__VIC20__) + clrscr (); +#endif + revers (0); + textcolor(1); + +#if defined (__CBM610__) || defined (__PET__) + cprintf("\n\rno COLOR_RAM\n\r"); +#elif defined (__C128__) + if (width == 40) { + cprintf("\n\rCOLOR_RAM at $%04x\n\r", COLOR_RAM); + } else { + cprintf("\n\rno COLOR_RAM\n\r"); + } +#else + cprintf("\n\rCOLOR_RAM at $%04x\n\r", COLOR_RAM); +#endif + do { if (!testCPeekCol (i)) { ret = 1; @@ -253,11 +280,11 @@ int main (void) /* test revers */ textcolor(1); cputc('\n'); cputc('\r'); - revers(0); cputc('*'); chBack (); c1 = cpeekrevers(); chForth(); - revers(1); cputc('*'); chBack (); c2 = cpeekrevers(); chForth(); + revers(0); cputc('x'); chBack (); c1 = cpeekrevers(); chForth(); + revers(1); cputc('X'); chBack (); c2 = cpeekrevers(); chForth(); cputc('\n'); cputc('\r'); - revers(c1); cputc('*'); - revers(c2); cputc('*'); + revers(c1); cputc('o'); + revers(c2); cputc('O'); /* test cpeeks() */ revers(0); From 6faef87b49a7c310b8bb939f89b565ed28da7776 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Fri, 15 Dec 2017 23:51:39 +0100 Subject: [PATCH 078/254] Fixed Oric-1 compatibility #550 --- asminc/atmos.inc | 6 ++ doc/funcref.sgml | 172 +++++++++++++++++++++++++++++++++++++++++-- libsrc/atmos/atmos.s | 47 ++++++++++-- 3 files changed, 211 insertions(+), 14 deletions(-) diff --git a/asminc/atmos.inc b/asminc/atmos.inc index 4c3c442fa..8edcf7dc2 100644 --- a/asminc/atmos.inc +++ b/asminc/atmos.inc @@ -104,8 +104,14 @@ PRINT := $F77C ; Sound Effects PING := $FA9F +PING1 := $FA85 SHOOT := $FAB5 +SHOOT1 := $FA9B EXPLODE := $FACB +EXPLODE1 := $FAB1 ZAP := $FAE1 +ZAP1 := $FAC7 TICK := $FB14 +TICK1 := $FAFA TOCK := $FB2A +TOCK1 := $FB10 diff --git a/doc/funcref.sgml b/doc/funcref.sgml index f74630ae3..62413d6af 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -115,18 +115,16 @@ function. <sect1><tt/atmos.h/<label id="atmos.h"><p> <itemize> +<item><ref id="atmos_explode" name="atmos_explode"> <item><ref id="atmos_load" name="atmos_load"> +<item><ref id="atmos_ping" name="atmos_ping"> <item><ref id="atmos_save" name="atmos_save"> -<!-- <item><ref id="atmos_explode" name="atmos_explode"> --> -<!-- <item><ref id="atmos_ping" name="atmos_ping"> --> -<!-- <item><ref id="atmos_shoot" name="atmos_shoot"> --> -<!-- <item><ref id="atmos_tick" name="atmos_tick"> --> -<!-- <item><ref id="atmos_tock" name="atmos_tock"> --> -<!-- <item><ref id="atmos_zap" name="atmos_zap"> --> +<item><ref id="atmos_shoot" name="atmos_shoot"> +<item><ref id="atmos_tick" name="atmos_tick"> +<item><ref id="atmos_tock" name="atmos_tock"> +<item><ref id="atmos_zap" name="atmos_zap"> </itemize> -(incomplete) - <sect1><tt/c128.h/<label id="c128.h"><p> @@ -674,6 +672,20 @@ communication. (incomplete) +<sect1><tt/telestrat.h/<label id="telestrat.h"><p> + +<itemize> +<item><ref id="atmos_explode" name="explode"> +<item><ref id="atmos_ping" name="ping"> +<item><ref id="atmos_shoot" name="shoot"> +<item><ref id="atmos_zap" name="zap"> +<!-- <item><ref id="kbdclick1" name="kbdclick1"> --> +<!-- <item><ref id="oups" name="oups"> --> +</itemize> + +(incomplete) + + <sect1><tt/tgi.h/<label id="tgi.h"><p> <url url="tgi.html" name="Tiny Graphics Interface">. @@ -1333,6 +1345,30 @@ used in presence of a prototype. </quote> +<sect1>atmos_explode<label id="atmos_explode"><p> + +<quote> +<descrip> +<tag/Function/Bomb sound effect. +<tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/ +<tag/Declaration/<tt/void __fastcall__ atmos_explode(void);/ +<tag/Description/<tt/atmos_explode/ plays the BASIC sound. +<tag/Notes/<itemize> +<item>The function is available only as a fastcall function; so, it may be used +only in the presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="atmos_ping" name="atmos_ping">, +<ref id="atmos_shoot" name="atmos_shoot">, +<ref id="atmos_tick" name="atmos_tick">, +<ref id="atmos_tock" name="atmos_tock">, +<ref id="atmos_zap" name="atmos_zap"> +<tag/Example/None. +</descrip> +</quote> + + <sect1>atmos_load<label id="atmos_load"><p> <quote> @@ -1353,6 +1389,30 @@ only in the presence of a prototype. </quote> +<sect1>atmos_ping<label id="atmos_ping"><p> + +<quote> +<descrip> +<tag/Function/Bell or ricochet sound effect. +<tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/ +<tag/Declaration/<tt/void __fastcall__ atmos_ping(void);/ +<tag/Description/<tt/atmos_ping/ plays the BASIC sound. +<tag/Notes/<itemize> +<item>The function is available only as a fastcall function; so, it may be used +only in the presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="atmos_explode" name="atmos_explode">, +<ref id="atmos_shoot" name="atmos_shoot">, +<ref id="atmos_tick" name="atmos_tick">, +<ref id="atmos_tock" name="atmos_tock">, +<ref id="atmos_zap" name="atmos_zap"> +<tag/Example/None. +</descrip> +</quote> + + <sect1>atmos_save<label id="atmos_save"><p> <quote> @@ -1375,6 +1435,102 @@ atmos_save("hires", 0xa000, 0xc000); </quote> +<sect1>atmos_shoot<label id="atmos_shoot"><p> + +<quote> +<descrip> +<tag/Function/Pistol sound effect. +<tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/ +<tag/Declaration/<tt/void __fastcall__ atmos_shoot(void);/ +<tag/Description/<tt/atmos_shoot/ plays the BASIC sound. +<tag/Notes/<itemize> +<item>The function is available only as a fastcall function; so, it may be used +only in the presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="atmos_explode" name="atmos_explode">, +<ref id="atmos_ping" name="atmos_ping">, +<ref id="atmos_tick" name="atmos_tick">, +<ref id="atmos_tock" name="atmos_tock">, +<ref id="atmos_zap" name="atmos_zap"> +<tag/Example/None. +</descrip> +</quote> + + +<sect1>atmos_tick<label id="atmos_tick"><p> + +<quote> +<descrip> +<tag/Function/High-pitch click. +<tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/ +<tag/Declaration/<tt/void __fastcall__ atmos_tick(void);/ +<tag/Description/<tt/atmos_tick/ plays the system sound. +<tag/Notes/<itemize> +<item>The function is available only as a fastcall function; so, it may be used +only in the presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="atmos_explode" name="atmos_explode">, +<ref id="atmos_ping" name="atmos_ping">, +<ref id="atmos_shoot" name="atmos_shoot">, +<ref id="atmos_tock" name="atmos_tock">, +<ref id="atmos_zap" name="atmos_zap"> +<tag/Example/None. +</descrip> +</quote> + + +<sect1>atmos_tock<label id="atmos_tock"><p> + +<quote> +<descrip> +<tag/Function/Low-pitch click. +<tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/ +<tag/Declaration/<tt/void __fastcall__ atmos_tock(void);/ +<tag/Description/<tt/atmos_tock/ plays the system sound. +<tag/Notes/<itemize> +<item>The function is available only as a fastcall function; so, it may be used +only in the presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="atmos_explode" name="atmos_explode">, +<ref id="atmos_ping" name="atmos_ping">, +<ref id="atmos_shoot" name="atmos_shoot">, +<ref id="atmos_tick" name="atmos_tick">, +<ref id="atmos_zap" name="atmos_zap"> +<tag/Example/None. +</descrip> +</quote> + + +<sect1>atmos_zap<label id="atmos_zap"><p> + +<quote> +<descrip> +<tag/Function/Raygun sound effect. +<tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/ +<tag/Declaration/<tt/void __fastcall__ atmos_zap(void);/ +<tag/Description/<tt/atmos_zap/ plays the BASIC sound. +<tag/Notes/<itemize> +<item>The function is available only as a fastcall function; so, it may be used +only in the presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="atmos_explode" name="atmos_explode">, +<ref id="atmos_ping" name="atmos_ping">, +<ref id="atmos_shoot" name="atmos_shoot">, +<ref id="atmos_tick" name="atmos_tick">, +<ref id="atmos_tock" name="atmos_tock"> +<tag/Example/None. +</descrip> +</quote> + + <sect1>atoi<label id="atoi"><p> <quote> diff --git a/libsrc/atmos/atmos.s b/libsrc/atmos/atmos.s index 6b5a4a49c..c50204fa5 100644 --- a/libsrc/atmos/atmos.s +++ b/libsrc/atmos/atmos.s @@ -7,9 +7,44 @@ .include "atmos.inc" -_atmos_ping := PING -_atmos_shoot := SHOOT -_atmos_explode := EXPLODE -_atmos_zap := ZAP -_atmos_tick := TICK -_atmos_tock := TOCK +.proc _atmos_ping + bit $31 + bvs L1 ; Atmos? + jmp PING +L1: jmp PING1 +.endproc + +.proc _atmos_shoot + lda $31 + bvs L1 ; Atmos? + jmp SHOOT +L1: jmp SHOOT1 +.endproc + +.proc _atmos_explode + lda $31 + bvs L1 ; Atmos? + jmp EXPLODE +L1: jmp EXPLODE1 +.endproc + +.proc _atmos_zap + lda $31 + bvs L1 ; Atmos? + jmp ZAP +L1: jmp ZAP1 +.endproc + +.proc _atmos_tick + lda $31 + bvs L1 ; Atmos? + jmp TICK +L1: jmp TICK1 +.endproc + +.proc _atmos_tock + lda $31 + bvs L1 ; Atmos? + jmp TOCK +L1: jmp TOCK1 +.endproc From 41fab61253493516efb48f722f409dcbd317be3f Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Sat, 16 Dec 2017 00:41:00 +0100 Subject: [PATCH 079/254] Fixed memory config #551 --- cfg/c16.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg/c16.cfg b/cfg/c16.cfg index b67c66b96..9f54730af 100644 --- a/cfg/c16.cfg +++ b/cfg/c16.cfg @@ -7,7 +7,7 @@ MEMORY { ZP: file = "", define = yes, start = $0002, size = $001A; LOADADDR: file = %O, start = $0FFF, size = $0002; HEADER: file = %O, start = $1001, size = $000C; - MAIN: file = %O, start = $100D, size = $6FF3 - __STACKSIZE__; + MAIN: file = %O, start = $100D, size = $3FF3 - __STACKSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; From 6452fbac89d85b538a80bf535674d15346cb92d7 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Sat, 16 Dec 2017 01:04:05 +0100 Subject: [PATCH 080/254] Added new config #551 --- cfg/c16-32k.cfg | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 cfg/c16-32k.cfg diff --git a/cfg/c16-32k.cfg b/cfg/c16-32k.cfg new file mode 100644 index 000000000..f2ce53d05 --- /dev/null +++ b/cfg/c16-32k.cfg @@ -0,0 +1,39 @@ +SYMBOLS { + __LOADADDR__: type = import; + __EXEHDR__: type = import; + __STACKSIZE__: type = weak, value = $0800; # 2k stack +} +MEMORY { + ZP: file = "", define = yes, start = $0002, size = $001A; + LOADADDR: file = %O, start = $0FFF, size = $0002; + HEADER: file = %O, start = $1001, size = $000C; + MAIN: file = %O, start = $100D, size = $7FF3 - __STACKSIZE__; +} +SEGMENTS { + ZEROPAGE: load = ZP, type = zp; + LOADADDR: load = LOADADDR, type = ro; + EXEHDR: load = HEADER, type = ro; + STARTUP: load = MAIN, type = ro; + LOWCODE: load = MAIN, type = ro, optional = yes; + ONCE: load = MAIN, type = ro, optional = yes; + CODE: load = MAIN, type = ro; + RODATA: load = MAIN, type = ro; + DATA: load = MAIN, type = rw; + INIT: load = MAIN, type = bss; + BSS: load = MAIN, type = bss, define = yes; +} +FEATURES { + CONDES: type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__, + segment = ONCE; + CONDES: type = destructor, + label = __DESTRUCTOR_TABLE__, + count = __DESTRUCTOR_COUNT__, + segment = RODATA; + CONDES: type = interruptor, + label = __INTERRUPTOR_TABLE__, + count = __INTERRUPTOR_COUNT__, + segment = RODATA, + import = __CALLIRQ__; +} From afb758bd6c7fff09386515e023dda16d76cf9d84 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Sat, 16 Dec 2017 02:35:00 +0100 Subject: [PATCH 081/254] Update c16-32k.cfg --- cfg/c16-32k.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg/c16-32k.cfg b/cfg/c16-32k.cfg index f2ce53d05..b67c66b96 100644 --- a/cfg/c16-32k.cfg +++ b/cfg/c16-32k.cfg @@ -7,7 +7,7 @@ MEMORY { ZP: file = "", define = yes, start = $0002, size = $001A; LOADADDR: file = %O, start = $0FFF, size = $0002; HEADER: file = %O, start = $1001, size = $000C; - MAIN: file = %O, start = $100D, size = $7FF3 - __STACKSIZE__; + MAIN: file = %O, start = $100D, size = $6FF3 - __STACKSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; From b4fe03e49ff27b787ce287d3333935c3cab7dab7 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Sat, 16 Dec 2017 02:36:31 +0100 Subject: [PATCH 082/254] Update c16.cfg --- cfg/c16.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg/c16.cfg b/cfg/c16.cfg index 9f54730af..8016c6d0f 100644 --- a/cfg/c16.cfg +++ b/cfg/c16.cfg @@ -7,7 +7,7 @@ MEMORY { ZP: file = "", define = yes, start = $0002, size = $001A; LOADADDR: file = %O, start = $0FFF, size = $0002; HEADER: file = %O, start = $1001, size = $000C; - MAIN: file = %O, start = $100D, size = $3FF3 - __STACKSIZE__; + MAIN: file = %O, start = $100D, size = $2FF3 - __STACKSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; From 6497da262a72790e748df1214e95a99cbf814ba5 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Sun, 17 Dec 2017 18:45:57 +0100 Subject: [PATCH 083/254] oops I made a mistake. --- libsrc/atmos/atmos.s | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libsrc/atmos/atmos.s b/libsrc/atmos/atmos.s index c50204fa5..5822be8d9 100644 --- a/libsrc/atmos/atmos.s +++ b/libsrc/atmos/atmos.s @@ -15,35 +15,35 @@ L1: jmp PING1 .endproc .proc _atmos_shoot - lda $31 + bit $31 bvs L1 ; Atmos? jmp SHOOT L1: jmp SHOOT1 .endproc .proc _atmos_explode - lda $31 + bit $31 bvs L1 ; Atmos? jmp EXPLODE L1: jmp EXPLODE1 .endproc .proc _atmos_zap - lda $31 + bit $31 bvs L1 ; Atmos? jmp ZAP L1: jmp ZAP1 .endproc .proc _atmos_tick - lda $31 + bit $31 bvs L1 ; Atmos? jmp TICK L1: jmp TICK1 .endproc .proc _atmos_tock - lda $31 + bit $31 bvs L1 ; Atmos? jmp TOCK L1: jmp TOCK1 From 98e2b79ef4f25aa1c8158c95e5f14f1733fb74be Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Mon, 18 Dec 2017 19:19:59 +0100 Subject: [PATCH 084/254] Optimizing the stack size --- cfg/c16.cfg | 2 +- cfg/creativision.cfg | 2 +- cfg/vic20-32k.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cfg/c16.cfg b/cfg/c16.cfg index 8016c6d0f..41545d473 100644 --- a/cfg/c16.cfg +++ b/cfg/c16.cfg @@ -1,7 +1,7 @@ SYMBOLS { __LOADADDR__: type = import; __EXEHDR__: type = import; - __STACKSIZE__: type = weak, value = $0800; # 2k stack + __STACKSIZE__: type = weak, value = $0400; # 1k stack } MEMORY { ZP: file = "", define = yes, start = $0002, size = $001A; diff --git a/cfg/creativision.cfg b/cfg/creativision.cfg index 9e4ecd8ce..289984df0 100644 --- a/cfg/creativision.cfg +++ b/cfg/creativision.cfg @@ -3,7 +3,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0020, size = $00E0; - RAM: file = "", define = yes, start = $01FA, size = $0206; + RAM: file = "", define = yes, start = $01FA, size = $0206 - __STACKSIZE__; ROM: file = %O, define = yes, start = $B000, size = $1000, fill = yes, fillval = $FF; } SEGMENTS { diff --git a/cfg/vic20-32k.cfg b/cfg/vic20-32k.cfg index 28dd661ad..fe53d46ab 100644 --- a/cfg/vic20-32k.cfg +++ b/cfg/vic20-32k.cfg @@ -3,7 +3,7 @@ SYMBOLS { __LOADADDR__: type = import; __EXEHDR__: type = import; - __STACKSIZE__: type = weak, value = $0400; # 1k stack + __STACKSIZE__: type = weak, value = $0800; # 2k stack } MEMORY { ZP: file = "", define = yes, start = $0002, size = $001A; From c8dd88efad29864da56aa3663318f810dcf88c36 Mon Sep 17 00:00:00 2001 From: greg-king5 <greg.king5@verizon.net> Date: Mon, 18 Dec 2017 17:09:06 -0500 Subject: [PATCH 085/254] Added missing "break;" statements to a "switch" statement. --- src/common/xsprintf.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/common/xsprintf.c b/src/common/xsprintf.c index d50ad7a68..a7d26d5ef 100644 --- a/src/common/xsprintf.c +++ b/src/common/xsprintf.c @@ -352,14 +352,14 @@ static void StoreOffset (PrintfCtrl* P) /* Store the current output offset (%n format spec) */ { switch (P->LengthMod) { - case lmChar: *va_arg (P->ap, int*) = P->BufFill; - case lmShort: *va_arg (P->ap, int*) = P->BufFill; - case lmInt: *va_arg (P->ap, int*) = P->BufFill; - case lmLong: *va_arg (P->ap, long*) = P->BufFill; - case lmIntMax: *va_arg (P->ap, intmax_t*) = P->BufFill; - case lmSizeT: *va_arg (P->ap, size_t*) = P->BufFill; - case lmPtrDiffT: *va_arg (P->ap, ptrdiff_t*) = P->BufFill; - default: FAIL ("Invalid size modifier for %n format spec in xvsnprintf"); + case lmChar: *va_arg (P->ap, int*) = P->BufFill; break; + case lmShort: *va_arg (P->ap, int*) = P->BufFill; break; + case lmInt: *va_arg (P->ap, int*) = P->BufFill; break; + case lmLong: *va_arg (P->ap, long*) = P->BufFill; break; + case lmIntMax: *va_arg (P->ap, intmax_t*) = P->BufFill; break; + case lmSizeT: *va_arg (P->ap, size_t*) = P->BufFill; break; + case lmPtrDiffT: *va_arg (P->ap, ptrdiff_t*) = P->BufFill; break; + default: FAIL ("Invalid size modifier for %n format spec. in xvsnprintf()"); } } From 0543ecabe2624e0ec73df1e090f386c6d96a3a1e Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Thu, 28 Dec 2017 01:58:03 +0100 Subject: [PATCH 086/254] added peek functions for soft80 --- libsrc/c64/extra/soft80.s | 19 ++++ libsrc/c64/extra/soft80mono.s | 19 ++++ libsrc/c64/soft80_cpeekc.s | 168 +++++++++++++++++++++++++++++ libsrc/c64/soft80_cpeekcolor.s | 19 ++++ libsrc/c64/soft80_cpeekrevers.s | 10 ++ libsrc/c64/soft80_cpeeks.s | 71 ++++++++++++ libsrc/c64/soft80mono_cpeekcolor.s | 17 +++ 7 files changed, 323 insertions(+) create mode 100644 libsrc/c64/soft80_cpeekc.s create mode 100644 libsrc/c64/soft80_cpeekcolor.s create mode 100644 libsrc/c64/soft80_cpeekrevers.s create mode 100644 libsrc/c64/soft80_cpeeks.s create mode 100644 libsrc/c64/soft80mono_cpeekcolor.s diff --git a/libsrc/c64/extra/soft80.s b/libsrc/c64/extra/soft80.s index d445c85c0..0ea28cfaf 100644 --- a/libsrc/c64/extra/soft80.s +++ b/libsrc/c64/extra/soft80.s @@ -15,6 +15,22 @@ .export _textcolor := soft80_textcolor ; color.s .export _bgcolor := soft80_bgcolor ; color.s + ; soft80_cpeekc.s + .import soft80_cpeekc + .export _cpeekc := soft80_cpeekc ; cpeekc.s + + ; soft80_cpeekcolor.s + .import soft80_cpeekcolor + .export _cpeekcolor := soft80_cpeekcolor ; cpeekcolor.s + + ; soft80_cpeekrevers.s + .import soft80_cpeekrevers + .export _cpeekrevers := soft80_cpeekrevers ; cpeekrevers.s + + ; soft80_cpeeks.s + .import soft80_cpeeks + .export _cpeeks := soft80_cpeeks ; cpeeks.s + ; soft80_cputc.s .import soft80_cputc .import soft80_cputcxy @@ -50,3 +66,6 @@ ; Chars used by chline () and cvline () .exportzp chlinechar = CH_HLINE .exportzp cvlinechar = CH_VLINE + + .import return1 + .export _doesclrscrafterexit := return1 diff --git a/libsrc/c64/extra/soft80mono.s b/libsrc/c64/extra/soft80mono.s index 6fd2c687c..700cbcb6c 100644 --- a/libsrc/c64/extra/soft80mono.s +++ b/libsrc/c64/extra/soft80mono.s @@ -18,6 +18,22 @@ .export _textcolor := soft80mono_textcolor ; color.s .export _bgcolor := soft80mono_bgcolor ; color.s + ; soft80mono_cpeekc.s + .import soft80_cpeekc + .export _cpeekc := soft80_cpeekc ; cpeekc.s + + ; soft80mono_cpeekcolor.s + .import soft80mono_cpeekcolor + .export _cpeekcolor := soft80mono_cpeekcolor ; cpeekcolor.s + + ; soft80mono_cpeekrevers.s + .import soft80_cpeekrevers + .export _cpeekrevers := soft80_cpeekrevers ; cpeekrevers.s + + ; soft80mono_cpeeks.s + .import soft80_cpeeks + .export _cpeeks := soft80_cpeeks ; cpeeks.s + ; soft80mono_cputc.s .import soft80mono_cputc .import soft80mono_cputcxy @@ -53,3 +69,6 @@ ; Chars used by chline () and cvline () .exportzp chlinechar = CH_HLINE .exportzp cvlinechar = CH_VLINE + + .import return1 + .export _doesclrscrafterexit := return1 diff --git a/libsrc/c64/soft80_cpeekc.s b/libsrc/c64/soft80_cpeekc.s new file mode 100644 index 000000000..2801ade97 --- /dev/null +++ b/libsrc/c64/soft80_cpeekc.s @@ -0,0 +1,168 @@ + + .export soft80_cpeekc, soft80_cpeekchar + + .include "c64.inc" + .include "soft80.inc" + + .macpack longbranch + + .segment "CODE" + +soft80_cpeekc: + jsr soft80_cpeekchar + ldx #0 + rts + +soft80_cpeekchar: + + sei + ;;dec $01 ;; assumed = $36 + ;;dec $01 ;; assumed = $36 + lda #$34 + sta $01 + + lda CURS_X + and #$01 + + jne @l1a + + ; test non-inverted character (left side) + + ldx #0 +@l2aa: + ldy #0 + +;; stx $d020 + + .repeat 8,line +;; jsr readdirect + lda (SCREEN_PTR),y + and #$f0 +; sta $e100,y + cmp soft80_hi_charset+(line*$80),x +; cmp #0 + bne @l2b + .if (line < 7) + iny + .endif + .endrepeat + + +@backok: +;inc $d020 +; inc $01 +; inc $01 + lda #$36 + sta $01 + cli + txa ; return char in A + ; sec +; sbc #$20 + ldx #$00 ; revers flag +;inc $d020 + rts +@l2b: +;jmp * + inx + cpx #$80 + jne @l2aa + + ; test inverted character (left side) + + ldx #0 +@l2aa2: + ldy #0 + +;; stx $d020 + + .repeat 8,line +;; jsr readdirect + lda (SCREEN_PTR),y + and #$f0 + eor #$f0 + cmp soft80_hi_charset+(line*$80),x +; cmp #0 + bne @l2b2 + .if (line < 7) + iny + .endif + .endrepeat + +@backokrevers: +;inc $d020 +; inc $01 +; inc $01 + lda #$36 + sta $01 + cli + txa ; return char in A + ; sec +; sbc #$20 + ldx #$01 ; revers flag +;inc $d020 + rts + +@l2b2: + inx + cpx #$80 + jne @l2aa2 + +@backerr: +;inc $d020 + ;; inc $01 +;; inc $01 + lda #$36 + sta $01 + cli + ldx #0 + txa + + rts + + ; test non-inverted character (right side) + +@l1a: + ldx #0 +@l1aa: + ldy #0 + .repeat 8,line +;; jsr readdirect + lda (SCREEN_PTR),y + and #$0f + eor soft80_lo_charset+(line*$80),x + bne @l2bb + .if line < 7 + iny + .endif + .endrepeat + jmp @backok +@l2bb: + inx + cpx #$80 + bne @l1aa + + ; test inverted character (right side) + + ldx #0 +@l1aa2: + ldy #0 + .repeat 8,line +;; jsr readdirect + lda (SCREEN_PTR),y + and #$0f + eor #$0f + eor soft80_lo_charset+(line*$80),x + bne @l2bb2 + .if line < 7 + iny + .endif + .endrepeat + jmp @backokrevers +@l2bb2: + inx + cpx #$80 + bne @l1aa2 + + + jmp @backerr + diff --git a/libsrc/c64/soft80_cpeekcolor.s b/libsrc/c64/soft80_cpeekcolor.s new file mode 100644 index 000000000..c8f1c6e43 --- /dev/null +++ b/libsrc/c64/soft80_cpeekcolor.s @@ -0,0 +1,19 @@ +; +; 2017-12-27, Groepaz +; +; unsigned char cpeekcolor (void); +; + + .export soft80_cpeekcolor + + .include "c64.inc" + .include "soft80.inc" + + .segment "CODE" + +soft80_cpeekcolor: + ldy #0 + lda (CRAM_PTR),y + and #$0f + ldx #0 + rts diff --git a/libsrc/c64/soft80_cpeekrevers.s b/libsrc/c64/soft80_cpeekrevers.s new file mode 100644 index 000000000..6fc0c166a --- /dev/null +++ b/libsrc/c64/soft80_cpeekrevers.s @@ -0,0 +1,10 @@ + + .import soft80_cpeekchar + + .export soft80_cpeekrevers + +soft80_cpeekrevers: + jsr soft80_cpeekchar + txa + ldx #0 + rts diff --git a/libsrc/c64/soft80_cpeeks.s b/libsrc/c64/soft80_cpeeks.s new file mode 100644 index 000000000..837afef1e --- /dev/null +++ b/libsrc/c64/soft80_cpeeks.s @@ -0,0 +1,71 @@ +; +; 2017-12-27, groepaz +; +; void cpeeks (char* s, unsigned length); +; + .export soft80_cpeeks + .import soft80_cpeekc, soft80_kplot, popax + + .importzp ptr1, ptr2 + + .include "c64.inc" + .include "soft80.inc" + +soft80_cpeeks: + eor #<$FFFF ; counting a word upward is faster + sta ptr2 ; so, we use -(length + 1) + txa + eor #>$FFFF + sta ptr2+1 + + jsr popax + sta ptr1 + stx ptr1+1 + + ; save current cursor position + lda CURS_X + pha + lda CURS_Y + pha + + ; get the string +@lp: + jsr soft80_cpeekc + ldy #0 + sta (ptr1),y + + ; advance cursor position + ldy CURS_X + ldx CURS_Y + iny + cpy #charsperline + bne @sk2 + ldy #0 + inx +@sk2: + sty CURS_X + stx CURS_Y + clc + jsr soft80_kplot + + inc ptr1 + bne @sk + inc ptr1+1 +@sk: + inc ptr2 + bne @lp + inc ptr2+1 + bne @lp + + ; terminate the string + lda #0 + ldy #0 + sta (ptr1),y + + ; restore the cursor position + pla + tax ; CURS_Y + pla + tay ; CURS_X + clc + jmp soft80_kplot diff --git a/libsrc/c64/soft80mono_cpeekcolor.s b/libsrc/c64/soft80mono_cpeekcolor.s new file mode 100644 index 000000000..a03875a74 --- /dev/null +++ b/libsrc/c64/soft80mono_cpeekcolor.s @@ -0,0 +1,17 @@ +; +; 2017-12-27, Groepaz +; +; unsigned char cpeekcolor (void); +; + + .export soft80mono_cpeekcolor + + .include "c64.inc" + .include "soft80.inc" + + .segment "CODE" + +soft80mono_cpeekcolor: + lda CHARCOLOR + ldx #0 + rts From 142ba126348839e6a01bf160b61628a30ac4ba94 Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Thu, 28 Dec 2017 01:58:58 +0100 Subject: [PATCH 087/254] updated testprog --- testcode/lib/cpeek-test.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/testcode/lib/cpeek-test.c b/testcode/lib/cpeek-test.c index 5f3bfc524..ffcdb8bf1 100644 --- a/testcode/lib/cpeek-test.c +++ b/testcode/lib/cpeek-test.c @@ -113,6 +113,17 @@ static unsigned char testCPeekC (char ch) return 1; } + /* toggle revers mode every few chars so cpeekc gets tested for both */ + revers ((ch >> 3) & 1); + + /* output additional space every now and then, that way not only even or only + odd half of the character cell will be tested */ +#if defined(__C64__) + if ((width == 80) && ((ch % 17) == 0)) { + cputc(' '); + } +#endif + /* Output the char to the screen. */ cputc (ch); @@ -141,8 +152,8 @@ static unsigned char testCPeekC (char ch) */ ch2_c = peekChWithoutTranslation (); if ((ch2_c != ch2_b) -#if defined(__C128__) - /* VDC memory is not accessable */ +#if defined(__C128__) || defined(__C64__) + /* VDC memory is not accessable, soft80 has no "videoram" */ && (width == 40) #endif ){ @@ -230,7 +241,7 @@ int main (void) int ret = 0; clrscr (); - revers (1); + revers (0); textcolor(1); bgcolor(0); screensize (&width, &i); @@ -261,7 +272,7 @@ int main (void) #if defined (__CBM610__) || defined (__PET__) cprintf("\n\rno COLOR_RAM\n\r"); -#elif defined (__C128__) +#elif defined (__C128__) || defined (__C64__) if (width == 40) { cprintf("\n\rCOLOR_RAM at $%04x\n\r", COLOR_RAM); } else { From f207a60365c7a226f907b3218f73e3163be1223d Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Thu, 28 Dec 2017 02:26:23 +0100 Subject: [PATCH 088/254] some cleanup --- libsrc/c64/soft80_cpeekc.s | 57 +++++++++------------------------ libsrc/c64/soft80_cpeekrevers.s | 5 +++ 2 files changed, 20 insertions(+), 42 deletions(-) diff --git a/libsrc/c64/soft80_cpeekc.s b/libsrc/c64/soft80_cpeekc.s index 2801ade97..63ad635e7 100644 --- a/libsrc/c64/soft80_cpeekc.s +++ b/libsrc/c64/soft80_cpeekc.s @@ -1,3 +1,8 @@ +; +; 2017-12-28, Groepaz +; +; char cpeekc (void); +; .export soft80_cpeekc, soft80_cpeekchar @@ -16,8 +21,6 @@ soft80_cpeekc: soft80_cpeekchar: sei - ;;dec $01 ;; assumed = $36 - ;;dec $01 ;; assumed = $36 lda #$34 sta $01 @@ -32,105 +35,77 @@ soft80_cpeekchar: @l2aa: ldy #0 -;; stx $d020 - .repeat 8,line -;; jsr readdirect lda (SCREEN_PTR),y and #$f0 -; sta $e100,y cmp soft80_hi_charset+(line*$80),x -; cmp #0 bne @l2b .if (line < 7) iny .endif .endrepeat - @backok: -;inc $d020 -; inc $01 -; inc $01 lda #$36 sta $01 cli txa ; return char in A - ; sec -; sbc #$20 ldx #$00 ; revers flag -;inc $d020 rts @l2b: -;jmp * inx cpx #$80 jne @l2aa ; test inverted character (left side) - + ldx #0 @l2aa2: ldy #0 -;; stx $d020 - .repeat 8,line -;; jsr readdirect lda (SCREEN_PTR),y and #$f0 eor #$f0 cmp soft80_hi_charset+(line*$80),x -; cmp #0 bne @l2b2 .if (line < 7) iny .endif .endrepeat - + @backokrevers: -;inc $d020 -; inc $01 -; inc $01 lda #$36 sta $01 cli txa ; return char in A - ; sec -; sbc #$20 ldx #$01 ; revers flag -;inc $d020 rts - + @l2b2: inx cpx #$80 jne @l2aa2 - + @backerr: -;inc $d020 - ;; inc $01 -;; inc $01 lda #$36 sta $01 cli ldx #0 txa - rts ; test non-inverted character (right side) - + @l1a: ldx #0 @l1aa: ldy #0 .repeat 8,line -;; jsr readdirect lda (SCREEN_PTR),y and #$0f eor soft80_lo_charset+(line*$80),x - bne @l2bb + bne @l2bb .if line < 7 iny .endif @@ -140,19 +115,18 @@ soft80_cpeekchar: inx cpx #$80 bne @l1aa - + ; test inverted character (right side) - + ldx #0 @l1aa2: ldy #0 .repeat 8,line -;; jsr readdirect lda (SCREEN_PTR),y and #$0f eor #$0f eor soft80_lo_charset+(line*$80),x - bne @l2bb2 + bne @l2bb2 .if line < 7 iny .endif @@ -162,7 +136,6 @@ soft80_cpeekchar: inx cpx #$80 bne @l1aa2 - - + jmp @backerr diff --git a/libsrc/c64/soft80_cpeekrevers.s b/libsrc/c64/soft80_cpeekrevers.s index 6fc0c166a..779636ed5 100644 --- a/libsrc/c64/soft80_cpeekrevers.s +++ b/libsrc/c64/soft80_cpeekrevers.s @@ -1,3 +1,8 @@ +; +; 2017-12-28, Groepaz +; +; unsigned char cpeekrevers (void); +; .import soft80_cpeekchar From 30c6018887060df7286ac6d411182c4996da96a2 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Thu, 28 Dec 2017 04:54:18 +0100 Subject: [PATCH 089/254] Implementation of getfirstdevice/getnextdevice for Atari. --- libsrc/atari/getdevice.s | 78 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 libsrc/atari/getdevice.s diff --git a/libsrc/atari/getdevice.s b/libsrc/atari/getdevice.s new file mode 100644 index 000000000..e0e700436 --- /dev/null +++ b/libsrc/atari/getdevice.s @@ -0,0 +1,78 @@ +; +; Oliver Schmidt, 2012-09-04 +; Christian Groessler, 2017-12-28 +; +; unsigned char getfirstdevice (void); +; unsigned char __fastcall__ getnextdevice (unsigned char device); +; + + .include "atari.inc" + .export _getfirstdevice + .export _getnextdevice + +MAX_DIO_DEVICES = 8 + +;------------------------------------------------------------------------------ +; _getfirstdevice + +_getfirstdevice: + lda #$FF + ; Fall through + +;------------------------------------------------------------------------------ +; _getnextdevice + +_getnextdevice: + tax +next: inx + cpx #MAX_DIO_DEVICES + beq none + + jsr check_device + bmi next + +done: txa + ldx #$00 + rts + +none: ldx #255 ; INVALID_DEVICE (see include/device.h) + bne done ; jump always + +;------------------------------------------------------------------------------ +; check_device - checks if a disk device is present +; input: X - device id (0 = D1, 1 = D2, ...) +; output: NF - 0/1 for detected/not detected +; X register preserved + +check_device: + txa + pha + lda #SIO_STAT + sta DCOMND ; set command into DCB + lda #%01000000 ; direction value, "receive data" + sta DSTATS ; set data flow directon + lda #15 + sta DTIMLO ; value got from DOS source + lda #4 + sta DAUX1 ; set sector # (dummy: 4) + sta DBYTLO ; # of bytes to transfer + lda #0 + sta DAUX2 + sta DBYTHI + lda #>DVSTAT + sta DBUFHI + lda #<DVSTAT + sta DBUFLO ; set buffer address into DCB + lda #DISKID ; SIO bus ID of diskette drive + sta DDEVIC + inx + stx DUNIT ; unit number (1-based) + + jsr SIOV ; execute SIO command + + pla + tax + lda DSTATS + rts + + .end From 783408080cd89ec954b5bab65d56625e90b9294e Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Thu, 28 Dec 2017 17:52:27 +0100 Subject: [PATCH 090/254] convert to petscii --- libsrc/c64/soft80_cpeekc.s | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libsrc/c64/soft80_cpeekc.s b/libsrc/c64/soft80_cpeekc.s index 63ad635e7..576d50fc1 100644 --- a/libsrc/c64/soft80_cpeekc.s +++ b/libsrc/c64/soft80_cpeekc.s @@ -15,6 +15,13 @@ soft80_cpeekc: jsr soft80_cpeekchar + ; 0-1F -> A0-BF + ; 20-7F -> 20-7F + cmp #$20 + bcs @sk + ;clc + adc #$a0 +@sk: ldx #0 rts From b08839cac4ba6386b2227782131f1f264dbe5719 Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Sun, 31 Dec 2017 15:49:17 +0100 Subject: [PATCH 091/254] Added libray to none target --- doc/customizing.sgml | 41 +++++++++++++++++++---------------------- libsrc/Makefile | 3 ++- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/doc/customizing.sgml b/doc/customizing.sgml index e502f2e9d..d8f6ef6be 100644 --- a/doc/customizing.sgml +++ b/doc/customizing.sgml @@ -302,23 +302,20 @@ also forcing a BRK instruction into the CPU. <sect>Custom Run-Time Library Creation<p> The next step in customizing the cc65 toolset is creating a run-time -library for the targeted hardware. The easiest way to do this is to -modify a standard library from the cc65 distribution. In this example, -there is no console I/O, mouse, joystick, etc. in the system, so it is -most appropriate to use the simplest library as the base, which is for -the Watara Supervision and is named "supervision.lib" in the -lib directory of the distribution. +library for the targeted hardware. The recommended way to do this is to +modify the platform-independent standard library of the cc65 distribution. +It is named "none.lib" in the lib directory of the distribution. -The only modification required is to replace the <tt>crt0</tt> module in -the supervision.lib library with custom startup code. This is simply -done by first copying the library and giving it a new name, compiling -the startup code with ca65, and finally using the ar65 archiver to -replace the module in the new library. The steps are shown below: +When using "none.lib" we need to supply our own <tt>crt0<tt> +module with custom startup code. This is simply done by first copying the +the library and giving it a new name, compiling the startup code with ca65, +and finally using the ar65 archiver to add the module to the new library. +The steps are shown below: <tscreen><verb> -$ copy "C:\Program Files\cc65\lib\supervision.lib" sbc.lib -$ ca65 crt0.s -$ ar65 a sbc.lib crt0.o + cp /usr/local/share/cc65/lib/none.lib sbc.lib + ca65 crt0.s + ar65 a sbc.lib crt0.o </verb></tscreen> <sect>Interrupt Service Routine Definition<p> @@ -706,14 +703,14 @@ that can be used as the initialization data for the Xilinx Block RAM used for code storage: <tscreen><verb> -$ cc65 -t none -O --cpu 65sc02 main.c -$ ca65 --cpu 65sc02 main.s -$ ca65 --cpu 65sc02 rs232_tx.s -$ ca65 --cpu 65sc02 interrupt.s -$ ca65 --cpu 65sc02 vectors.s -$ ca65 --cpu 65sc02 wait.s -$ ld65 -C sbc.cfg -m main.map interrupt.o vectors.o wait.o rs232_tx.o - main.o sbc.lib + cc65 -t none -O --cpu 65sc02 main.c + ca65 --cpu 65sc02 main.s + ca65 --cpu 65sc02 rs232_tx.s + ca65 --cpu 65sc02 interrupt.s + ca65 --cpu 65sc02 vectors.s + ca65 --cpu 65sc02 wait.s + ld65 -C sbc.cfg -m main.map interrupt.o vectors.o wait.o + rs232_tx.o main.o sbc.lib </verb></tscreen> During the C-level code compilation phase (<tt>cc65</tt>), assumptions diff --git a/libsrc/Makefile b/libsrc/Makefile index 0583b6761..2ac0c78f0 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -32,7 +32,8 @@ TARGETS = apple2 \ sim6502 \ sim65c02 \ supervision \ - telestrat + telestrat \ + none DRVTYPES = emd \ joy \ From d9ba279e8935e61181249fd088af33b9c021fb70 Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Mon, 1 Jan 2018 01:34:53 +0100 Subject: [PATCH 092/254] Fixed a typo in doc/customizing.sqml --- doc/customizing.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/customizing.sgml b/doc/customizing.sgml index d8f6ef6be..1ae49f3c0 100644 --- a/doc/customizing.sgml +++ b/doc/customizing.sgml @@ -306,7 +306,7 @@ library for the targeted hardware. The recommended way to do this is to modify the platform-independent standard library of the cc65 distribution. It is named "none.lib" in the lib directory of the distribution. -When using "none.lib" we need to supply our own <tt>crt0<tt> +When using "none.lib" we need to supply our own <tt>crt0</tt> module with custom startup code. This is simply done by first copying the the library and giving it a new name, compiling the startup code with ca65, and finally using the ar65 archiver to add the module to the new library. From 4abe12c729330dda3822b0356dbdf0737829d097 Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Mon, 1 Jan 2018 14:01:25 +0100 Subject: [PATCH 093/254] fix spelling --- testcode/lib/cpeek-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcode/lib/cpeek-test.c b/testcode/lib/cpeek-test.c index ffcdb8bf1..aef4cb4e3 100644 --- a/testcode/lib/cpeek-test.c +++ b/testcode/lib/cpeek-test.c @@ -153,7 +153,7 @@ static unsigned char testCPeekC (char ch) ch2_c = peekChWithoutTranslation (); if ((ch2_c != ch2_b) #if defined(__C128__) || defined(__C64__) - /* VDC memory is not accessable, soft80 has no "videoram" */ + /* VDC memory is not accessible, soft80 has no "videoram" */ && (width == 40) #endif ){ From 040134e7750f81a6a3b54856c4a1bf38d9244b5c Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Tue, 2 Jan 2018 13:48:30 +0100 Subject: [PATCH 094/254] Fixed typo. --- testcode/lib/cpeek-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcode/lib/cpeek-test.c b/testcode/lib/cpeek-test.c index aef4cb4e3..1777bce4a 100644 --- a/testcode/lib/cpeek-test.c +++ b/testcode/lib/cpeek-test.c @@ -209,7 +209,7 @@ static unsigned char testCPeekCol (char ch) ch2_c = peekColWithoutTranslation (); if ((ch2_c != ch2_b) #if defined(__C128__) - /* VDC memory is not accessable */ + /* VDC memory is not accessible */ && (width == 40) #endif ){ From 26350714ee3a78771061b77b6d20a472f1e40585 Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Tue, 2 Jan 2018 15:15:27 +0100 Subject: [PATCH 095/254] Renamed none.lib to no-platform.lib --- doc/customizing.sgml | 9 ++++----- libsrc/Makefile | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/customizing.sgml b/doc/customizing.sgml index 1ae49f3c0..29c525e00 100644 --- a/doc/customizing.sgml +++ b/doc/customizing.sgml @@ -81,7 +81,6 @@ SEGMENTS { ZEROPAGE: load = ZP, type = zp, define = yes; DATA: load = ROM, type = rw, define = yes, run = RAM; BSS: load = RAM, type = bss, define = yes; - HEAP: load = RAM, type = bss, optional = yes; STARTUP: load = ROM, type = ro; ONCE: load = ROM, type = ro, optional = yes; CODE: load = ROM, type = ro; @@ -95,7 +94,6 @@ The meaning of each of these segments is as follows. <p><tt> ZEROPAGE: </tt>Data in page 0, defined by ZP as starting at $0 with length $100 <p><tt> DATA: </tt>Initialized data that can be modified by the program, stored in RAM <p><tt> BSS: </tt>Uninitialized data stored in RAM (used for variable storage) -<p><tt> HEAP: </tt>Uninitialized C-level heap storage in RAM, optional <p><tt> STARTUP: </tt>The program initialization code, stored in ROM <p><tt> ONCE: </tt>The code run once to initialize the system, stored in ROM <p><tt> CODE: </tt>The program code, stored in ROM @@ -304,16 +302,17 @@ also forcing a BRK instruction into the CPU. The next step in customizing the cc65 toolset is creating a run-time library for the targeted hardware. The recommended way to do this is to modify the platform-independent standard library of the cc65 distribution. -It is named "none.lib" in the lib directory of the distribution. +It is named "no-platform.lib" in the lib directory of the +cc65 distribution. -When using "none.lib" we need to supply our own <tt>crt0</tt> +When using "no-platform.lib" we need to supply our own <tt>crt0</tt> module with custom startup code. This is simply done by first copying the the library and giving it a new name, compiling the startup code with ca65, and finally using the ar65 archiver to add the module to the new library. The steps are shown below: <tscreen><verb> - cp /usr/local/share/cc65/lib/none.lib sbc.lib + cp /usr/local/share/cc65/lib/no-platform.lib sbc.lib ca65 crt0.s ar65 a sbc.lib crt0.o </verb></tscreen> diff --git a/libsrc/Makefile b/libsrc/Makefile index 2ac0c78f0..c742ad0c7 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -33,7 +33,7 @@ TARGETS = apple2 \ sim65c02 \ supervision \ telestrat \ - none + no-platform DRVTYPES = emd \ joy \ From 72bb32fcda47e24b584e13666ab675d19d9d4a8b Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Tue, 2 Jan 2018 15:32:27 +0100 Subject: [PATCH 096/254] Revert "Renamed none.lib to no-platform.lib" This reverts commit 26350714ee3a78771061b77b6d20a472f1e40585. It breaks the build --- doc/customizing.sgml | 7 +++---- libsrc/Makefile | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/customizing.sgml b/doc/customizing.sgml index 29c525e00..5eb73b648 100644 --- a/doc/customizing.sgml +++ b/doc/customizing.sgml @@ -302,17 +302,16 @@ also forcing a BRK instruction into the CPU. The next step in customizing the cc65 toolset is creating a run-time library for the targeted hardware. The recommended way to do this is to modify the platform-independent standard library of the cc65 distribution. -It is named "no-platform.lib" in the lib directory of the -cc65 distribution. +It is named "none.lib" in the lib directory of the distribution. -When using "no-platform.lib" we need to supply our own <tt>crt0</tt> +When using "none.lib" we need to supply our own <tt>crt0</tt> module with custom startup code. This is simply done by first copying the the library and giving it a new name, compiling the startup code with ca65, and finally using the ar65 archiver to add the module to the new library. The steps are shown below: <tscreen><verb> - cp /usr/local/share/cc65/lib/no-platform.lib sbc.lib + cp /usr/local/share/cc65/lib/none.lib sbc.lib ca65 crt0.s ar65 a sbc.lib crt0.o </verb></tscreen> diff --git a/libsrc/Makefile b/libsrc/Makefile index c742ad0c7..2ac0c78f0 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -33,7 +33,7 @@ TARGETS = apple2 \ sim65c02 \ supervision \ telestrat \ - no-platform + none DRVTYPES = emd \ joy \ From 14909f12fed0a2f5687ca4152116404234308d09 Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Thu, 4 Jan 2018 11:17:20 +0100 Subject: [PATCH 097/254] Implemented the requested changes. Moved none to its alphabetic place in the Makefile Reverted all changes to doc/customizing.sgml --- doc/customizing.sgml | 43 ++++++++++++++++++++++++------------------- libsrc/Makefile | 4 ++-- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/doc/customizing.sgml b/doc/customizing.sgml index 5eb73b648..e502f2e9d 100644 --- a/doc/customizing.sgml +++ b/doc/customizing.sgml @@ -81,6 +81,7 @@ SEGMENTS { ZEROPAGE: load = ZP, type = zp, define = yes; DATA: load = ROM, type = rw, define = yes, run = RAM; BSS: load = RAM, type = bss, define = yes; + HEAP: load = RAM, type = bss, optional = yes; STARTUP: load = ROM, type = ro; ONCE: load = ROM, type = ro, optional = yes; CODE: load = ROM, type = ro; @@ -94,6 +95,7 @@ The meaning of each of these segments is as follows. <p><tt> ZEROPAGE: </tt>Data in page 0, defined by ZP as starting at $0 with length $100 <p><tt> DATA: </tt>Initialized data that can be modified by the program, stored in RAM <p><tt> BSS: </tt>Uninitialized data stored in RAM (used for variable storage) +<p><tt> HEAP: </tt>Uninitialized C-level heap storage in RAM, optional <p><tt> STARTUP: </tt>The program initialization code, stored in ROM <p><tt> ONCE: </tt>The code run once to initialize the system, stored in ROM <p><tt> CODE: </tt>The program code, stored in ROM @@ -300,20 +302,23 @@ also forcing a BRK instruction into the CPU. <sect>Custom Run-Time Library Creation<p> The next step in customizing the cc65 toolset is creating a run-time -library for the targeted hardware. The recommended way to do this is to -modify the platform-independent standard library of the cc65 distribution. -It is named "none.lib" in the lib directory of the distribution. +library for the targeted hardware. The easiest way to do this is to +modify a standard library from the cc65 distribution. In this example, +there is no console I/O, mouse, joystick, etc. in the system, so it is +most appropriate to use the simplest library as the base, which is for +the Watara Supervision and is named "supervision.lib" in the +lib directory of the distribution. -When using "none.lib" we need to supply our own <tt>crt0</tt> -module with custom startup code. This is simply done by first copying the -the library and giving it a new name, compiling the startup code with ca65, -and finally using the ar65 archiver to add the module to the new library. -The steps are shown below: +The only modification required is to replace the <tt>crt0</tt> module in +the supervision.lib library with custom startup code. This is simply +done by first copying the library and giving it a new name, compiling +the startup code with ca65, and finally using the ar65 archiver to +replace the module in the new library. The steps are shown below: <tscreen><verb> - cp /usr/local/share/cc65/lib/none.lib sbc.lib - ca65 crt0.s - ar65 a sbc.lib crt0.o +$ copy "C:\Program Files\cc65\lib\supervision.lib" sbc.lib +$ ca65 crt0.s +$ ar65 a sbc.lib crt0.o </verb></tscreen> <sect>Interrupt Service Routine Definition<p> @@ -701,14 +706,14 @@ that can be used as the initialization data for the Xilinx Block RAM used for code storage: <tscreen><verb> - cc65 -t none -O --cpu 65sc02 main.c - ca65 --cpu 65sc02 main.s - ca65 --cpu 65sc02 rs232_tx.s - ca65 --cpu 65sc02 interrupt.s - ca65 --cpu 65sc02 vectors.s - ca65 --cpu 65sc02 wait.s - ld65 -C sbc.cfg -m main.map interrupt.o vectors.o wait.o - rs232_tx.o main.o sbc.lib +$ cc65 -t none -O --cpu 65sc02 main.c +$ ca65 --cpu 65sc02 main.s +$ ca65 --cpu 65sc02 rs232_tx.s +$ ca65 --cpu 65sc02 interrupt.s +$ ca65 --cpu 65sc02 vectors.s +$ ca65 --cpu 65sc02 wait.s +$ ld65 -C sbc.cfg -m main.map interrupt.o vectors.o wait.o rs232_tx.o + main.o sbc.lib </verb></tscreen> During the C-level code compilation phase (<tt>cc65</tt>), assumptions diff --git a/libsrc/Makefile b/libsrc/Makefile index 2ac0c78f0..0d0cd320b 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -27,13 +27,13 @@ TARGETS = apple2 \ gamate \ lynx \ nes \ + none \ osic1p \ pce \ sim6502 \ sim65c02 \ supervision \ - telestrat \ - none + telestrat DRVTYPES = emd \ joy \ From 98b2b2544db2390978c0532040a7922ed7d55bc2 Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Thu, 4 Jan 2018 12:07:35 +0100 Subject: [PATCH 098/254] Added crt0 to none.lib --- cfg/none.cfg | 1 + libsrc/none/crt0.s | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 libsrc/none/crt0.s diff --git a/cfg/none.cfg b/cfg/none.cfg index 6742da7c8..44bbcdfec 100644 --- a/cfg/none.cfg +++ b/cfg/none.cfg @@ -7,6 +7,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; + STARTUP: load = MAIN, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes; ONCE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = rw; diff --git a/libsrc/none/crt0.s b/libsrc/none/crt0.s new file mode 100644 index 000000000..fb26fb2af --- /dev/null +++ b/libsrc/none/crt0.s @@ -0,0 +1,25 @@ + .export _exit + .export __STARTUP__ : absolute = 1 ; Mark as startup + .import zerobss, _main + .import initlib, donelib + .import __MAIN_START__, __MAIN_SIZE__ ; Linker generated + .import __STACKSIZE__ ; Linker generated + + .include "zeropage.inc" + + .segment "STARTUP" + + cld + ldx #$FF + txs + lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) + ldx #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) + sta sp + stx sp+1 + jsr zerobss + jsr initlib + jsr _main +_exit: pha + jsr donelib + pla + brk From 884dfcf3c15672fc7caa9b0b709d49b3f2672ca6 Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Thu, 4 Jan 2018 12:22:42 +0100 Subject: [PATCH 099/254] Fixed none.lib missing symbols --- cfg/none.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg/none.cfg b/cfg/none.cfg index 44bbcdfec..cb8dbd400 100644 --- a/cfg/none.cfg +++ b/cfg/none.cfg @@ -3,7 +3,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0000, size = $0001F; - MAIN: file = %O, start = %S, size = $10000 - __STACKSIZE__; + MAIN: file = %O, start = %S, size = $10000 - __STACKSIZE__, define = yes; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; From 4759d3956e50d18b85c1a650777d0b6bd0bda90f Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Thu, 4 Jan 2018 13:54:00 +0100 Subject: [PATCH 100/254] Removed initialization of the stack from none.lib --- libsrc/none/crt0.s | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libsrc/none/crt0.s b/libsrc/none/crt0.s index fb26fb2af..7858ad839 100644 --- a/libsrc/none/crt0.s +++ b/libsrc/none/crt0.s @@ -9,9 +9,6 @@ .segment "STARTUP" - cld - ldx #$FF - txs lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) sta sp @@ -22,4 +19,4 @@ _exit: pha jsr donelib pla - brk + rts From 60c68b11113f40da67b5ddae379c0b571d4f2bc7 Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Thu, 4 Jan 2018 17:11:44 +0100 Subject: [PATCH 101/254] cl65 now links against none.lib when using --target none --- src/cl65/main.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/cl65/main.c b/src/cl65/main.c index 565f20b45..5a2103b24 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -380,19 +380,14 @@ static void CmdPrint (CmdDesc* Cmd, FILE* F) static void SetTargetFiles (void) /* Set the target system files */ { - /* Determine the names of the target specific library file */ - if (Target != TGT_NONE) { + /* Get a pointer to the system name and its length */ + const char* TargetName = GetTargetName (Target); + unsigned TargetNameLen = strlen (TargetName); - /* Get a pointer to the system name and its length */ - const char* TargetName = GetTargetName (Target); - unsigned TargetNameLen = strlen (TargetName); - - /* Set the library file */ - TargetLib = xmalloc (TargetNameLen + 4 + 1); - memcpy (TargetLib, TargetName, TargetNameLen); - strcpy (TargetLib + TargetNameLen, ".lib"); - - } + /* Set the library file */ + TargetLib = xmalloc (TargetNameLen + 4 + 1); + memcpy (TargetLib, TargetName, TargetNameLen); + strcpy (TargetLib + TargetNameLen, ".lib"); } From ef993f2fcf0fde941a40e0fd6022596b6558e0a9 Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Thu, 4 Jan 2018 21:29:58 +0100 Subject: [PATCH 102/254] none.cfg consistency changes --- cfg/none.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg/none.cfg b/cfg/none.cfg index cb8dbd400..f82e9707f 100644 --- a/cfg/none.cfg +++ b/cfg/none.cfg @@ -3,7 +3,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0000, size = $0001F; - MAIN: file = %O, start = %S, size = $10000 - __STACKSIZE__, define = yes; + MAIN: file = %O, define = yes, start = %S, size = $10000 - __STACKSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; From cea833208454a9667eebc2361df56cfd4184822c Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Thu, 4 Jan 2018 22:01:44 +0100 Subject: [PATCH 103/254] Fixed none.cfg --- cfg/none.cfg | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cfg/none.cfg b/cfg/none.cfg index f82e9707f..26f5379cd 100644 --- a/cfg/none.cfg +++ b/cfg/none.cfg @@ -1,9 +1,14 @@ +FEATURES { + STARTADDRESS: default = $1000; +} SYMBOLS { - __STACKSIZE__: type = weak, value = $0800; # 2k stack + __STACKSIZE__: type = weak, value = $0800; # 2k stack + __STACKSTART__: type = weak, value = $8000; + __ZPSTART__: type = weak, value = $0080; } MEMORY { - ZP: file = "", define = yes, start = $0000, size = $0001F; - MAIN: file = %O, define = yes, start = %S, size = $10000 - __STACKSIZE__; + ZP: file = "", define = yes, start = __ZPSTART__, size = $001F; + MAIN: file = %O, define = yes, start = %S, size = __STACKSTART__ - __STACKSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; From 45482b4fb1fdf69d149cbdd5aa7aafdbc816020d Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Thu, 4 Jan 2018 22:14:01 +0100 Subject: [PATCH 104/254] Fixed none/crt0.s to respect none.cfg --- libsrc/none/crt0.s | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libsrc/none/crt0.s b/libsrc/none/crt0.s index 7858ad839..a90f60d26 100644 --- a/libsrc/none/crt0.s +++ b/libsrc/none/crt0.s @@ -2,15 +2,14 @@ .export __STARTUP__ : absolute = 1 ; Mark as startup .import zerobss, _main .import initlib, donelib - .import __MAIN_START__, __MAIN_SIZE__ ; Linker generated - .import __STACKSIZE__ ; Linker generated + .import __STACKSTART__, __STACKSIZE__ ; Linker generated .include "zeropage.inc" .segment "STARTUP" - lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) - ldx #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) + lda #<__STACKSTART__ + lda #>__STACKSTART__ sta sp stx sp+1 jsr zerobss From aa34aed7dd87984dda900f3b171a87da3d361095 Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Thu, 4 Jan 2018 22:27:39 +0100 Subject: [PATCH 105/254] Fixed unused import and export of none.cfg and none/crt0.s --- cfg/none.cfg | 2 +- libsrc/none/crt0.s | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cfg/none.cfg b/cfg/none.cfg index 26f5379cd..cedd2d839 100644 --- a/cfg/none.cfg +++ b/cfg/none.cfg @@ -8,7 +8,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = __ZPSTART__, size = $001F; - MAIN: file = %O, define = yes, start = %S, size = __STACKSTART__ - __STACKSIZE__; + MAIN: file = %O, start = %S, size = __STACKSTART__ - __STACKSIZE__ - %S; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; diff --git a/libsrc/none/crt0.s b/libsrc/none/crt0.s index a90f60d26..288d0dc29 100644 --- a/libsrc/none/crt0.s +++ b/libsrc/none/crt0.s @@ -2,7 +2,7 @@ .export __STARTUP__ : absolute = 1 ; Mark as startup .import zerobss, _main .import initlib, donelib - .import __STACKSTART__, __STACKSIZE__ ; Linker generated + .import __STACKSTART__ ; Linker generated .include "zeropage.inc" From 94077404f9ecd6fd6d4354509bfbd3f34a1a63a5 Mon Sep 17 00:00:00 2001 From: bauen1 <j2468h@gmail.com> Date: Fri, 5 Jan 2018 10:39:23 +0100 Subject: [PATCH 106/254] Added ctype.s to none.lib as suggested by oliverschmidt --- libsrc/none/ctype.s | 159 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 libsrc/none/ctype.s diff --git a/libsrc/none/ctype.s b/libsrc/none/ctype.s new file mode 100644 index 000000000..35968f982 --- /dev/null +++ b/libsrc/none/ctype.s @@ -0,0 +1,159 @@ +; +; Ullrich von Bassewitz, 2003-10-10 +; +; Character specification table. +; + + .include "ctype.inc" + +; The tables are readonly, put them into the rodata segment + +.rodata + +; The following 256 byte wide table specifies attributes for the isxxx type +; of functions. Doing it by a table means some overhead in space, but it +; has major advantages: +; +; * It is fast. If it weren't for the slow parameter passing of cc65, one +; could even define macros for the isxxx functions (this is usually +; done on other platforms). +; +; * It is highly portable. The only unportable part is the table itself, +; all real code goes into the common library. +; +; * We save some code in the isxxx functions. + + +__ctype: + .byte CT_CTRL ; 0/00 ___ctrl_@___ + .byte CT_CTRL ; 1/01 ___ctrl_A___ + .byte CT_CTRL ; 2/02 ___ctrl_B___ + .byte CT_CTRL ; 3/03 ___ctrl_C___ + .byte CT_CTRL ; 4/04 ___ctrl_D___ + .byte CT_CTRL ; 5/05 ___ctrl_E___ + .byte CT_CTRL ; 6/06 ___ctrl_F___ + .byte CT_CTRL ; 7/07 ___ctrl_G___ + .byte CT_CTRL ; 8/08 ___ctrl_H___ + .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB + ; 9/09 ___ctrl_I___ + .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___ + .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___ + .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___ + .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___ + .byte CT_CTRL ; 14/0e ___ctrl_N___ + .byte CT_CTRL ; 15/0f ___ctrl_O___ + .byte CT_CTRL ; 16/10 ___ctrl_P___ + .byte CT_CTRL ; 17/11 ___ctrl_Q___ + .byte CT_CTRL ; 18/12 ___ctrl_R___ + .byte CT_CTRL ; 19/13 ___ctrl_S___ + .byte CT_CTRL ; 20/14 ___ctrl_T___ + .byte CT_CTRL ; 21/15 ___ctrl_U___ + .byte CT_CTRL ; 22/16 ___ctrl_V___ + .byte CT_CTRL ; 23/17 ___ctrl_W___ + .byte CT_CTRL ; 24/18 ___ctrl_X___ + .byte CT_CTRL ; 25/19 ___ctrl_Y___ + .byte CT_CTRL ; 26/1a ___ctrl_Z___ + .byte CT_CTRL ; 27/1b ___ctrl_[___ + .byte CT_CTRL ; 28/1c ___ctrl_\___ + .byte CT_CTRL ; 29/1d ___ctrl_]___ + .byte CT_CTRL ; 30/1e ___ctrl_^___ + .byte CT_CTRL ; 31/1f ___ctrl_____ + .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___ + .byte CT_NONE ; 33/21 _____!_____ + .byte CT_NONE ; 34/22 _____"_____ + .byte CT_NONE ; 35/23 _____#_____ + .byte CT_NONE ; 36/24 _____$_____ + .byte CT_NONE ; 37/25 _____%_____ + .byte CT_NONE ; 38/26 _____&_____ + .byte CT_NONE ; 39/27 _____'_____ + .byte CT_NONE ; 40/28 _____(_____ + .byte CT_NONE ; 41/29 _____)_____ + .byte CT_NONE ; 42/2a _____*_____ + .byte CT_NONE ; 43/2b _____+_____ + .byte CT_NONE ; 44/2c _____,_____ + .byte CT_NONE ; 45/2d _____-_____ + .byte CT_NONE ; 46/2e _____._____ + .byte CT_NONE ; 47/2f _____/_____ + .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____ + .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____ + .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____ + .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____ + .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____ + .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____ + .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____ + .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____ + .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____ + .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____ + .byte CT_NONE ; 58/3a _____:_____ + .byte CT_NONE ; 59/3b _____;_____ + .byte CT_NONE ; 60/3c _____<_____ + .byte CT_NONE ; 61/3d _____=_____ + .byte CT_NONE ; 62/3e _____>_____ + .byte CT_NONE ; 63/3f _____?_____ + + .byte CT_NONE ; 64/40 _____@_____ + .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____ + .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____ + .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____ + .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____ + .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____ + .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____ + .byte CT_UPPER ; 71/47 _____G_____ + .byte CT_UPPER ; 72/48 _____H_____ + .byte CT_UPPER ; 73/49 _____I_____ + .byte CT_UPPER ; 74/4a _____J_____ + .byte CT_UPPER ; 75/4b _____K_____ + .byte CT_UPPER ; 76/4c _____L_____ + .byte CT_UPPER ; 77/4d _____M_____ + .byte CT_UPPER ; 78/4e _____N_____ + .byte CT_UPPER ; 79/4f _____O_____ + .byte CT_UPPER ; 80/50 _____P_____ + .byte CT_UPPER ; 81/51 _____Q_____ + .byte CT_UPPER ; 82/52 _____R_____ + .byte CT_UPPER ; 83/53 _____S_____ + .byte CT_UPPER ; 84/54 _____T_____ + .byte CT_UPPER ; 85/55 _____U_____ + .byte CT_UPPER ; 86/56 _____V_____ + .byte CT_UPPER ; 87/57 _____W_____ + .byte CT_UPPER ; 88/58 _____X_____ + .byte CT_UPPER ; 89/59 _____Y_____ + .byte CT_UPPER ; 90/5a _____Z_____ + .byte CT_NONE ; 91/5b _____[_____ + .byte CT_NONE ; 92/5c _____\_____ + .byte CT_NONE ; 93/5d _____]_____ + .byte CT_NONE ; 94/5e _____^_____ + .byte CT_NONE ; 95/5f _UNDERLINE_ + .byte CT_NONE ; 96/60 ___grave___ + .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____ + .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____ + .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____ + .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____ + .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____ + .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____ + .byte CT_LOWER ; 103/67 _____g_____ + .byte CT_LOWER ; 104/68 _____h_____ + .byte CT_LOWER ; 105/69 _____i_____ + .byte CT_LOWER ; 106/6a _____j_____ + .byte CT_LOWER ; 107/6b _____k_____ + .byte CT_LOWER ; 108/6c _____l_____ + .byte CT_LOWER ; 109/6d _____m_____ + .byte CT_LOWER ; 110/6e _____n_____ + .byte CT_LOWER ; 111/6f _____o_____ + .byte CT_LOWER ; 112/70 _____p_____ + .byte CT_LOWER ; 113/71 _____q_____ + .byte CT_LOWER ; 114/72 _____r_____ + .byte CT_LOWER ; 115/73 _____s_____ + .byte CT_LOWER ; 116/74 _____t_____ + .byte CT_LOWER ; 117/75 _____u_____ + .byte CT_LOWER ; 118/76 _____v_____ + .byte CT_LOWER ; 119/77 _____w_____ + .byte CT_LOWER ; 120/78 _____x_____ + .byte CT_LOWER ; 121/79 _____y_____ + .byte CT_LOWER ; 122/7a _____z_____ + .byte CT_NONE ; 123/7b _____{_____ + .byte CT_NONE ; 124/7c _____|_____ + .byte CT_NONE ; 125/7d _____}_____ + .byte CT_NONE ; 126/7e _____~_____ + .byte CT_OTHER_WS ; 127/7f ____DEL____ + + .res 128, CT_NONE ; 128-255 From e7aabce8e9724ed6493abfac1329f9c8a4634a54 Mon Sep 17 00:00:00 2001 From: prandeamus <prandeamus@btinternet.com> Date: Sun, 7 Jan 2018 18:57:48 +0000 Subject: [PATCH 107/254] Complain if unsupported flags are provided after -O --- src/cc65/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cc65/main.c b/src/cc65/main.c index d3d298876..f8361f41c 100644 --- a/src/cc65/main.c +++ b/src/cc65/main.c @@ -986,6 +986,9 @@ int main (int argc, char* argv[]) case 's': IS_Set (&InlineStdFuncs, 1); break; + default: + UnknownOption (Arg); + break; } } break; From da22c90d33fcd4466f770f54755dbb886530f6ee Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Tue, 9 Jan 2018 04:48:39 -0500 Subject: [PATCH 108/254] Shrank Telestrat initcwd.s by 3 bytes. Changing when a loop test is done allowed the removal of an extra STA instruction. --- libsrc/telestrat/initcwd.s | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/libsrc/telestrat/initcwd.s b/libsrc/telestrat/initcwd.s index f359ebeb4..dc3c53257 100644 --- a/libsrc/telestrat/initcwd.s +++ b/libsrc/telestrat/initcwd.s @@ -10,22 +10,19 @@ initcwd: - ldx #PWD_PTR BRK_TELEMON XVARS - + sta ptr1 sty ptr1+1 - + ldy #$00 - -loop: +loop: lda (ptr1),y - beq done sta __cwd,y + beq done iny bne loop - -done: - sta __cwd,y + +done: rts From c67e90dd19497286f02e02f9c0d2641a509ddaa6 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Mon, 8 Jan 2018 12:47:00 -0500 Subject: [PATCH 109/254] Changed the type of a compiler variable that holds either integers or pointers. The change allows cc65 to be compiled on 64-bit Windows, without getting warnings. That OS is actually 32 bits with 64-bit pointers. Its pointers are "long long" instead of "long". The change uses type-names that are configured for the actual pointer width. --- src/cc65/codegen.c | 19 ++++++++++--------- src/cc65/codegen.h | 13 +++++++------ src/cc65/expr.c | 10 +++++----- src/cc65/exprdesc.c | 3 +-- src/cc65/exprdesc.h | 3 ++- src/common/inttypes.h | 21 ++++++++++----------- 6 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/cc65/codegen.c b/src/cc65/codegen.c index dfc06fccc..9e5102728 100644 --- a/src/cc65/codegen.c +++ b/src/cc65/codegen.c @@ -40,6 +40,7 @@ /* common */ #include "check.h" #include "cpu.h" +#include "inttypes.h" #include "strbuf.h" #include "xmalloc.h" #include "xsprintf.h" @@ -92,7 +93,7 @@ static void CheckLocalOffs (unsigned Offs) -static const char* GetLabelName (unsigned Flags, unsigned long Label, long Offs) +static const char* GetLabelName (unsigned Flags, uintptr_t Label, long Offs) { static char Buf [256]; /* Label name */ @@ -119,7 +120,7 @@ static const char* GetLabelName (unsigned Flags, unsigned long Label, long Offs) case CF_ABSOLUTE: /* Absolute address */ - xsprintf (Buf, sizeof (Buf), "$%04X", (int)((Label+Offs) & 0xFFFF)); + xsprintf (Buf, sizeof (Buf), "$%04X", (unsigned)((Label+Offs) & 0xFFFF)); break; case CF_REGVAR: @@ -729,7 +730,7 @@ void g_getimmed (unsigned Flags, unsigned long Val, long Offs) -void g_getstatic (unsigned flags, unsigned long label, long offs) +void g_getstatic (unsigned flags, uintptr_t label, long offs) /* Fetch an static memory cell into the primary register */ { /* Create the correct label name */ @@ -1008,7 +1009,7 @@ void g_leavariadic (int Offs) -void g_putstatic (unsigned flags, unsigned long label, long offs) +void g_putstatic (unsigned flags, uintptr_t label, long offs) /* Store the primary register into the specified static memory cell */ { /* Create the correct label name */ @@ -1584,7 +1585,7 @@ void g_addlocal (unsigned flags, int offs) -void g_addstatic (unsigned flags, unsigned long label, long offs) +void g_addstatic (unsigned flags, uintptr_t label, long offs) /* Add a static variable to ax */ { unsigned L; @@ -1634,7 +1635,7 @@ void g_addstatic (unsigned flags, unsigned long label, long offs) -void g_addeqstatic (unsigned flags, unsigned long label, long offs, +void g_addeqstatic (unsigned flags, uintptr_t label, long offs, unsigned long val) /* Emit += for a static variable */ { @@ -1857,7 +1858,7 @@ void g_addeqind (unsigned flags, unsigned offs, unsigned long val) -void g_subeqstatic (unsigned flags, unsigned long label, long offs, +void g_subeqstatic (unsigned flags, uintptr_t label, long offs, unsigned long val) /* Emit -= for a static variable */ { @@ -2093,7 +2094,7 @@ void g_addaddr_local (unsigned flags attribute ((unused)), int offs) -void g_addaddr_static (unsigned flags, unsigned long label, long offs) +void g_addaddr_static (unsigned flags, uintptr_t label, long offs) /* Add the address of a static variable to ax */ { /* Create the correct label name */ @@ -4276,7 +4277,7 @@ void g_initstatic (unsigned InitLabel, unsigned VarLabel, unsigned Size) g_getimmed (CF_STATIC, InitLabel, 0); AddCodeLine ("jsr pushax"); g_getimmed (CF_INT | CF_UNSIGNED | CF_CONST, Size, 0); - AddCodeLine ("jsr %s", GetLabelName (CF_EXTERNAL, (unsigned long) "memcpy", 0)); + AddCodeLine ("jsr %s", GetLabelName (CF_EXTERNAL, (uintptr_t) "memcpy", 0)); } } diff --git a/src/cc65/codegen.h b/src/cc65/codegen.h index 4ad375618..bbad0f125 100644 --- a/src/cc65/codegen.h +++ b/src/cc65/codegen.h @@ -40,6 +40,7 @@ /* common */ #include "coll.h" +#include "inttypes.h" /* cc65 */ #include "segments.h" @@ -266,7 +267,7 @@ void g_restore_regvars (int StackOffs, int RegOffs, unsigned Bytes); void g_getimmed (unsigned Flags, unsigned long Val, long Offs); /* Load a constant into the primary register */ -void g_getstatic (unsigned Flags, unsigned long Label, long Offs); +void g_getstatic (unsigned Flags, uintptr_t Label, long Offs); /* Fetch an static memory cell into the primary register */ void g_getlocal (unsigned Flags, int Offs); @@ -293,7 +294,7 @@ void g_leavariadic (int Offs); -void g_putstatic (unsigned flags, unsigned long label, long offs); +void g_putstatic (unsigned flags, uintptr_t label, long offs); /* Store the primary register into the specified static memory cell */ void g_putlocal (unsigned Flags, int Offs, long Val); @@ -315,7 +316,7 @@ void g_putind (unsigned flags, unsigned offs); void g_addlocal (unsigned flags, int offs); /* Add a local variable to ax */ -void g_addstatic (unsigned flags, unsigned long label, long offs); +void g_addstatic (unsigned flags, uintptr_t label, long offs); /* Add a static variable to ax */ @@ -326,7 +327,7 @@ void g_addstatic (unsigned flags, unsigned long label, long offs); -void g_addeqstatic (unsigned flags, unsigned long label, long offs, +void g_addeqstatic (unsigned flags, uintptr_t label, long offs, unsigned long val); /* Emit += for a static variable */ @@ -336,7 +337,7 @@ void g_addeqlocal (unsigned flags, int offs, unsigned long val); void g_addeqind (unsigned flags, unsigned offs, unsigned long val); /* Emit += for the location with address in ax */ -void g_subeqstatic (unsigned flags, unsigned long label, long offs, +void g_subeqstatic (unsigned flags, uintptr_t label, long offs, unsigned long val); /* Emit -= for a static variable */ @@ -357,7 +358,7 @@ void g_subeqind (unsigned flags, unsigned offs, unsigned long val); void g_addaddr_local (unsigned flags, int offs); /* Add the address of a local variable to ax */ -void g_addaddr_static (unsigned flags, unsigned long label, long offs); +void g_addaddr_static (unsigned flags, uintptr_t label, long offs); /* Add the address of a static variable to ax */ diff --git a/src/cc65/expr.c b/src/cc65/expr.c index dfd5366bb..43971caae 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1,7 +1,7 @@ /* expr.c ** ** 1998-06-21, Ullrich von Bassewitz -** 2015-06-26, Greg King +** 2017-12-05, Greg King */ @@ -731,7 +731,7 @@ static void Primary (ExprDesc* E) } else if ((Sym->Flags & SC_FUNC) == SC_FUNC) { /* Function */ E->Flags = E_LOC_GLOBAL | E_RTYPE_LVAL; - E->Name = (unsigned long) Sym->Name; + E->Name = (uintptr_t) Sym->Name; } else if ((Sym->Flags & SC_AUTO) == SC_AUTO) { /* Local variable. If this is a parameter for a variadic ** function, we have to add some address calculations, and the @@ -754,7 +754,7 @@ static void Primary (ExprDesc* E) /* Static variable */ if (Sym->Flags & (SC_EXTERN | SC_STORAGE)) { E->Flags = E_LOC_GLOBAL | E_RTYPE_LVAL; - E->Name = (unsigned long) Sym->Name; + E->Name = (uintptr_t) Sym->Name; } else { E->Flags = E_LOC_STATIC | E_RTYPE_LVAL; E->Name = Sym->V.Label; @@ -798,7 +798,7 @@ static void Primary (ExprDesc* E) Sym = AddGlobalSym (Ident, GetImplicitFuncType(), SC_EXTERN | SC_REF | SC_FUNC); E->Type = Sym->Type; E->Flags = E_LOC_GLOBAL | E_RTYPE_RVAL; - E->Name = (unsigned long) Sym->Name; + E->Name = (uintptr_t) Sym->Name; } else { /* Undeclared Variable */ Sym = AddLocalSym (Ident, type_int, SC_AUTO | SC_REF, 0); @@ -1308,7 +1308,7 @@ static void hie11 (ExprDesc *Expr) ** Since we don't have a name, invent one. */ ED_MakeConstAbs (Expr, 0, GetImplicitFuncType ()); - Expr->Name = (long) IllegalFunc; + Expr->Name = (uintptr_t) IllegalFunc; } /* Call the function */ FunctionCall (Expr); diff --git a/src/cc65/exprdesc.c b/src/cc65/exprdesc.c index 405c277a0..46377ac6b 100644 --- a/src/cc65/exprdesc.c +++ b/src/cc65/exprdesc.c @@ -44,7 +44,6 @@ #include "exprdesc.h" #include "stackptr.h" #include "symentry.h" -#include "exprdesc.h" @@ -361,7 +360,7 @@ void PrintExprDesc (FILE* F, ExprDesc* E) if (Sep != '(') { fputc (')', F); } - fprintf (F, "\nName: 0x%08lX\n", E->Name); + fprintf (F, "\nName: 0x%08lX\n", (unsigned long)E->Name); } diff --git a/src/cc65/exprdesc.h b/src/cc65/exprdesc.h index 99a17313e..e86534902 100644 --- a/src/cc65/exprdesc.h +++ b/src/cc65/exprdesc.h @@ -43,6 +43,7 @@ /* common */ #include "fp.h" #include "inline.h" +#include "inttypes.h" /* cc65 */ #include "asmcode.h" @@ -98,7 +99,7 @@ struct ExprDesc { struct SymEntry* Sym; /* Symbol table entry if known */ Type* Type; /* Type array of expression */ unsigned Flags; - unsigned long Name; /* Name or label number */ + uintptr_t Name; /* Name pointer or label number */ long IVal; /* Integer value if expression constant */ Double FVal; /* Floating point value */ struct Literal* LVal; /* Literal value */ diff --git a/src/common/inttypes.h b/src/common/inttypes.h index 0d9cb75fc..29ac778ef 100644 --- a/src/common/inttypes.h +++ b/src/common/inttypes.h @@ -38,29 +38,28 @@ -/* If we have stdint.h, include it, otherwise try some quesswork on types. +/* If we have <stdint.h>, include it; otherwise, adapt types from <stddef.h>. ** gcc and msvc don't define __STDC_VERSION__ without special flags, so check -** for them explicitly. Undefined symbols are replaced by zero, so a check for -** defined(__GNUC__) or defined(_MSC_VER) is not necessary. +** for them explicitly. Undefined symbols are replaced by zero; so, checks for +** defined(__GNUC__) and defined(_MSC_VER) aren't necessary. */ #if (__STDC_VERSION__ >= 199901) || (__GNUC__ >= 3) || (_MSC_VER >= 1600) #include <stdint.h> #else -/* Assume long is the largest type available, and assume that pointers can be -** safely converted into this type and back. +/* Assume that ptrdiff_t and size_t are wide enough to hold pointers. +** Assume that they are the widest type. */ -typedef long intptr_t; -typedef unsigned long uintptr_t; -typedef long intmax_t; -typedef unsigned long uintmax_t; - +#include <stddef.h> +typedef ptrdiff_t intptr_t; +typedef size_t uintptr_t; +typedef ptrdiff_t intmax_t; +typedef size_t uintmax_t; #endif /* End of inttypes.h */ - #endif From f0708db792504dc0639d170a51d72b9379f64624 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Thu, 11 Jan 2018 13:15:19 +0100 Subject: [PATCH 110/254] crt0.s ("none" target): fix initialization of sp variable. --- libsrc/none/crt0.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/none/crt0.s b/libsrc/none/crt0.s index 288d0dc29..596fbcd46 100644 --- a/libsrc/none/crt0.s +++ b/libsrc/none/crt0.s @@ -9,7 +9,7 @@ .segment "STARTUP" lda #<__STACKSTART__ - lda #>__STACKSTART__ + ldx #>__STACKSTART__ sta sp stx sp+1 jsr zerobss From c23f264fe456c27ecef382d6d1e3e579eb40c7cd Mon Sep 17 00:00:00 2001 From: prandeamus <prandeamus@btinternet.com> Date: Sat, 13 Jan 2018 18:30:53 +0000 Subject: [PATCH 111/254] Call ParaVirtHooks on JMP (indirect) --- src/sim65/6502.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sim65/6502.c b/src/sim65/6502.c index 1febef657..bf8033f40 100644 --- a/src/sim65/6502.c +++ b/src/sim65/6502.c @@ -1266,6 +1266,8 @@ static void OPC_6502_6C (void) Cycles = 6; Regs.PC = MemReadWord(Lo); } + + ParaVirtHooks (&Regs); } From 009f56afb6b26e12b18aeb8e38cf9521590d5ebf Mon Sep 17 00:00:00 2001 From: prandeamus <prandeamus@btinternet.com> Date: Sat, 13 Jan 2018 22:42:39 +0000 Subject: [PATCH 112/254] 65C02 version too. --- src/sim65/6502.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sim65/6502.c b/src/sim65/6502.c index bf8033f40..e1d313f93 100644 --- a/src/sim65/6502.c +++ b/src/sim65/6502.c @@ -1278,6 +1278,8 @@ static void OPC_65C02_6C (void) /* 6502 bug fixed here */ Cycles = 5; Regs.PC = MemReadWord (MemReadWord (Regs.PC+1)); + + ParaVirtHooks (&Regs); } From 1a95be9c3a28c0f5423f39564d968effd48351cb Mon Sep 17 00:00:00 2001 From: prandeamus <prandeamus@btinternet.com> Date: Sun, 14 Jan 2018 19:42:29 +0000 Subject: [PATCH 113/254] 65C02 JMP (ind,x) opcode 7C --- src/sim65/6502.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sim65/6502.c b/src/sim65/6502.c index e1d313f93..0d0adbf8b 100644 --- a/src/sim65/6502.c +++ b/src/sim65/6502.c @@ -1434,6 +1434,8 @@ static void OPC_65SC02_7C (void) PC = Regs.PC; Adr = MemReadWord (PC+1); Regs.PC = MemReadWord(Adr+Regs.XR); + + ParaVirtHooks (&Regs); } From 811424cc1b28d4f19882b6b7c59afffbae0f12d6 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Thu, 18 Jan 2018 12:37:21 +0100 Subject: [PATCH 114/254] Added recently published ProDOS version. --- include/apple2.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/apple2.h b/include/apple2.h index 421b5db6c..31e56a95a 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -134,6 +134,7 @@ extern unsigned char _dos_type; ** ProDOS 8 2.0.1 - 0x21 ** ProDOS 8 2.0.2 - 0x22 ** ProDOS 8 2.0.3 - 0x23 +** ProDOS 8 2.4.x - 0x24 */ From 2ef6514e47629357da7cd336de8489e8f1e548c4 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Fri, 19 Jan 2018 15:18:43 +0100 Subject: [PATCH 115/254] atari5200: put default display list into its own memory area This avoids 1K boundary crossing of the display list. Fix for issue #560. --- cfg/atari5200.cfg | 15 +++++++++------ libsrc/atari5200/conioscreen.s | 5 ++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cfg/atari5200.cfg b/cfg/atari5200.cfg index 3db8765d6..14d5faa98 100644 --- a/cfg/atari5200.cfg +++ b/cfg/atari5200.cfg @@ -1,16 +1,18 @@ SYMBOLS { __CARTSIZE__: type = weak, value = $4000; # possible values: $4000 and $8000 + __DLISTSIZE__: type = weak, value = $0000; __CART_ENTRY__: type = import; __STACKSIZE__: type = weak, value = $0400; # 4 pages stack __RESERVED_MEMORY__: type = export, value = $01E0; # space for 20x24 screen buffer (default display list is in ROM) } MEMORY { - ZP: file = "", start = $001D, size = $00E3, define = yes; - RAM: file = "", start = $021C, size = $4000 - __STACKSIZE__ - __RESERVED_MEMORY__ - $021C, define = yes; - ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - $18, define = yes, fill = yes, fillval = $FF; - CARTNAME: file = %O, start = $BFE8, size = $0014 fill = yes, fillval = $40; - CARTYEAR: file = %O, start = $BFFC, size = $0002 fill = yes, fillval = $59; - CARTENTRY: file = %O, start = $BFFE, size = $0002; + ZP: file = "", start = $001D, size = $00E3, define = yes; + RAM: file = "", start = $021C, size = $4000 - __STACKSIZE__ - __RESERVED_MEMORY__ - $021C, define = yes; + ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - __DLISTSIZE__ - $18, define = yes, fill = yes, fillval = $FF; + DLIST: file = %O, start = $BFE8 - __DLISTSIZE__, size = __DLISTSIZE__; + CARTNAME: file = %O, start = $BFE8, size = $0014 fill = yes, fillval = $40; + CARTYEAR: file = %O, start = $BFFC, size = $0002 fill = yes, fillval = $59; + CARTENTRY: file = %O, start = $BFFE, size = $0002; } SEGMENTS { ZEROPAGE: load = ZP, type = zp, optional = yes; @@ -22,6 +24,7 @@ SEGMENTS { RODATA: load = ROM, type = ro, optional = yes; DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes; BSS: load = RAM, type = bss, define = yes, optional = yes; + DLIST: load = DLIST, type = ro, define = yes, optional = yes; CARTNAME: load = CARTNAME, type = ro, define = yes; CARTYEAR: load = CARTYEAR, type = ro, define = yes; CARTENTRY: load = CARTENTRY, type = ro, define = yes; diff --git a/libsrc/atari5200/conioscreen.s b/libsrc/atari5200/conioscreen.s index 2e86001c2..4bd6d51e2 100644 --- a/libsrc/atari5200/conioscreen.s +++ b/libsrc/atari5200/conioscreen.s @@ -58,7 +58,7 @@ clrscr: sta (SAVMSC),y rts - .segment "RODATA" + .segment "DLIST" ; display list for 20x24 text mode @@ -78,6 +78,9 @@ dlist: .repeat 3 ; end of display list +.export __DLISTSIZE__ +__DLISTSIZE__ = * - dlist + .assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary" .end From 643152fb38d576d0115a7ec01895e8f92fe6730e Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Sun, 21 Jan 2018 15:40:22 +0100 Subject: [PATCH 116/254] Fix last change, put display list at beginning of ROM. --- cfg/atari5200.cfg | 12 +++++------- libsrc/atari5200/conioscreen.s | 3 --- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/cfg/atari5200.cfg b/cfg/atari5200.cfg index 14d5faa98..b1f863d21 100644 --- a/cfg/atari5200.cfg +++ b/cfg/atari5200.cfg @@ -1,6 +1,5 @@ SYMBOLS { __CARTSIZE__: type = weak, value = $4000; # possible values: $4000 and $8000 - __DLISTSIZE__: type = weak, value = $0000; __CART_ENTRY__: type = import; __STACKSIZE__: type = weak, value = $0400; # 4 pages stack __RESERVED_MEMORY__: type = export, value = $01E0; # space for 20x24 screen buffer (default display list is in ROM) @@ -8,8 +7,7 @@ SYMBOLS { MEMORY { ZP: file = "", start = $001D, size = $00E3, define = yes; RAM: file = "", start = $021C, size = $4000 - __STACKSIZE__ - __RESERVED_MEMORY__ - $021C, define = yes; - ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - __DLISTSIZE__ - $18, define = yes, fill = yes, fillval = $FF; - DLIST: file = %O, start = $BFE8 - __DLISTSIZE__, size = __DLISTSIZE__; + ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - $18, define = yes, fill = yes, fillval = $FF; CARTNAME: file = %O, start = $BFE8, size = $0014 fill = yes, fillval = $40; CARTYEAR: file = %O, start = $BFFC, size = $0002 fill = yes, fillval = $59; CARTENTRY: file = %O, start = $BFFE, size = $0002; @@ -17,6 +15,7 @@ MEMORY { SEGMENTS { ZEROPAGE: load = ZP, type = zp, optional = yes; EXTZP: load = ZP, type = zp, optional = yes; + DLIST: load = ROM , type = ro, define = yes, optional = yes; STARTUP: load = ROM, type = ro, define = yes, optional = yes; LOWCODE: load = ROM, type = ro, define = yes, optional = yes; ONCE: load = ROM, type = ro, optional = yes; @@ -24,10 +23,9 @@ SEGMENTS { RODATA: load = ROM, type = ro, optional = yes; DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes; BSS: load = RAM, type = bss, define = yes, optional = yes; - DLIST: load = DLIST, type = ro, define = yes, optional = yes; - CARTNAME: load = CARTNAME, type = ro, define = yes; - CARTYEAR: load = CARTYEAR, type = ro, define = yes; - CARTENTRY: load = CARTENTRY, type = ro, define = yes; + CARTNAME: load = CARTNAME, type = ro; + CARTYEAR: load = CARTYEAR, type = ro; + CARTENTRY: load = CARTENTRY, type = ro; } FEATURES { CONDES: type = constructor, diff --git a/libsrc/atari5200/conioscreen.s b/libsrc/atari5200/conioscreen.s index 4bd6d51e2..30c0e0788 100644 --- a/libsrc/atari5200/conioscreen.s +++ b/libsrc/atari5200/conioscreen.s @@ -78,9 +78,6 @@ dlist: .repeat 3 ; end of display list -.export __DLISTSIZE__ -__DLISTSIZE__ = * - dlist - .assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary" .end From 356c73f2cff0131fc9e04d160bdd6a6b923c7108 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Sun, 21 Jan 2018 15:42:12 +0100 Subject: [PATCH 117/254] atari5200.cfg: fix formatting --- cfg/atari5200.cfg | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cfg/atari5200.cfg b/cfg/atari5200.cfg index b1f863d21..e8f6d44a5 100644 --- a/cfg/atari5200.cfg +++ b/cfg/atari5200.cfg @@ -5,12 +5,12 @@ SYMBOLS { __RESERVED_MEMORY__: type = export, value = $01E0; # space for 20x24 screen buffer (default display list is in ROM) } MEMORY { - ZP: file = "", start = $001D, size = $00E3, define = yes; - RAM: file = "", start = $021C, size = $4000 - __STACKSIZE__ - __RESERVED_MEMORY__ - $021C, define = yes; - ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - $18, define = yes, fill = yes, fillval = $FF; - CARTNAME: file = %O, start = $BFE8, size = $0014 fill = yes, fillval = $40; - CARTYEAR: file = %O, start = $BFFC, size = $0002 fill = yes, fillval = $59; - CARTENTRY: file = %O, start = $BFFE, size = $0002; + ZP: file = "", start = $001D, size = $00E3, define = yes; + RAM: file = "", start = $021C, size = $4000 - __STACKSIZE__ - __RESERVED_MEMORY__ - $021C, define = yes; + ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - $18, define = yes, fill = yes, fillval = $FF; + CARTNAME: file = %O, start = $BFE8, size = $0014 fill = yes, fillval = $40; + CARTYEAR: file = %O, start = $BFFC, size = $0002 fill = yes, fillval = $59; + CARTENTRY: file = %O, start = $BFFE, size = $0002; } SEGMENTS { ZEROPAGE: load = ZP, type = zp, optional = yes; From caa40866c3ebdf3d2540b072aac1462d6afe9b33 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 23 Jan 2018 13:02:47 +0100 Subject: [PATCH 118/254] Moved initcgetc to initcputc --- libsrc/atmos/cgetc.s | 12 ------------ libsrc/atmos/cputc.s | 11 +++++++++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/libsrc/atmos/cgetc.s b/libsrc/atmos/cgetc.s index f1d727a50..72cd9407a 100644 --- a/libsrc/atmos/cgetc.s +++ b/libsrc/atmos/cgetc.s @@ -6,7 +6,6 @@ ; .export _cgetc - .constructor initcgetc .import cursor .forceimport disable_caps @@ -53,14 +52,3 @@ @L3: rts .endproc - -; ------------------------------------------------------------------------ -; Switch the cursor off. Code goes into the ONCE segment, -; which will be reused after it is run. - -.segment "ONCE" - -initcgetc: - lsr STATUS - asl STATUS ; Clear bit zero - rts diff --git a/libsrc/atmos/cputc.s b/libsrc/atmos/cputc.s index a0ef14b70..f1ce5f2b7 100644 --- a/libsrc/atmos/cputc.s +++ b/libsrc/atmos/cputc.s @@ -8,6 +8,7 @@ .export _cputcxy, _cputc .export setscrptr, putchar + .constructor initcputc .import rvs .import popax .importzp ptr2 @@ -95,3 +96,13 @@ ScrTabHi: .byte >(SCREEN + Line * SCREEN_XSIZE) .endrep +; ------------------------------------------------------------------------ +; Switch the cursor off. Code goes into the ONCE segment, +; which will be reused after it is run. + +.segment "ONCE" + +initcputc: + lsr STATUS + asl STATUS ; Clear bit zero + rts From 855aceaba8f78f66cf5134ae707b4cee11c6e9e9 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Mon, 29 Jan 2018 17:46:36 +0100 Subject: [PATCH 119/254] Added Apple II linker configs for programs including a hires screen. The Apple II hires screen buffer is located at $2000 (and can't be moved). The usual way to get along with this is to load the cc65 program above the hires screen buffer at $4000. However, that means that it becomes difficult to make good use of the memory below the hires screen buffer. The simplest approach is to add that memory to the heap. But there are programs containing just lots of code and not much data. One could think of moving the code to the area below the hires screen after loading (like it is done with the code for the language card). But if the program is really large (and already contains code to be moved to the language card) it won't just fit into memory in the first place. The alternative is to load the program at the usual $803 and have it "cover" the hires screen buffer. Of course the part of the program that actually "covers" the hires screen buffer mustn't contain anything necessary for the program. The downside of this approach is that the program file on disk contains 8kB that can't be used by the program. But instead of just containing zeros the program can as well contain a hires screen picture that can be displayed right after startup. Now the user can have code loaded below the hires screen buffer by setting the code-name to LOWCODE. However, he needs to explicitly do so. Otherwise the memory below the hires screen is totally wasted. Trivia: Allowing to do this hires screen buffer "covering" was the very reason to change tgi_init() to not clear the hires screen anymore. --- cfg/apple2-hgr.cfg | 52 +++++++++++++++++++++++++++++++++ cfg/apple2enh-hgr.cfg | 52 +++++++++++++++++++++++++++++++++ testcode/lib/apple2/hgrtest.c | 26 +++++++++++++++++ testcode/lib/apple2/werner.pic | Bin 0 -> 8184 bytes testcode/lib/apple2/werner.s | 2 ++ 5 files changed, 132 insertions(+) create mode 100644 cfg/apple2-hgr.cfg create mode 100644 cfg/apple2enh-hgr.cfg create mode 100644 testcode/lib/apple2/hgrtest.c create mode 100644 testcode/lib/apple2/werner.pic create mode 100644 testcode/lib/apple2/werner.s diff --git a/cfg/apple2-hgr.cfg b/cfg/apple2-hgr.cfg new file mode 100644 index 000000000..540578b25 --- /dev/null +++ b/cfg/apple2-hgr.cfg @@ -0,0 +1,52 @@ +# Configuration for programs including a hires screen (with 6KB LOWCODE) + +FEATURES { + STARTADDRESS: default = $0803; +} +SYMBOLS { + __EXEHDR__: type = import; + __STACKSIZE__: type = weak, value = $0800; # 2k stack + __HIMEM__: type = weak, value = $9600; # Presumed RAM end + __LCADDR__: type = weak, value = $D400; # Behind quit code + __LCSIZE__: type = weak, value = $0C00; # Rest of bank two + __MAIN_START__: type = export, value = %S; + __MAIN_LAST__: type = export, value = __HIGH_LAST__; +} +MEMORY { + ZP: file = "", define = yes, start = $0080, size = $001A; + HEADER: file = %O, start = %S - 4, size = $0004; + LOW: file = %O, fill = yes, start = %S, size = $2000 - %S; + HGR: file = %O, fill = yes, start = $2000, size = $2000; + HIGH: file = %O, define = yes, start = $4000, size = __HIMEM__ - $4000; + BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; + LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; +} +SEGMENTS { + ZEROPAGE: load = ZP, type = zp; + EXEHDR: load = HEADER, type = ro; + STARTUP: load = LOW, type = ro; + LOWCODE: load = LOW, type = ro, optional = yes; + HGR: load = HGR, type = rw, optional = yes; + CODE: load = HIGH, type = ro; + RODATA: load = HIGH, type = ro; + DATA: load = HIGH, type = rw; + INIT: load = HIGH, type = rw; + ONCE: load = HIGH, type = ro, define = yes; + LC: load = HIGH, run = LC, type = ro, optional = yes; + BSS: load = BSS, type = bss, define = yes; +} +FEATURES { + CONDES: type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__, + segment = ONCE; + CONDES: type = destructor, + label = __DESTRUCTOR_TABLE__, + count = __DESTRUCTOR_COUNT__, + segment = RODATA; + CONDES: type = interruptor, + label = __INTERRUPTOR_TABLE__, + count = __INTERRUPTOR_COUNT__, + segment = RODATA, + import = __CALLIRQ__; +} diff --git a/cfg/apple2enh-hgr.cfg b/cfg/apple2enh-hgr.cfg new file mode 100644 index 000000000..540578b25 --- /dev/null +++ b/cfg/apple2enh-hgr.cfg @@ -0,0 +1,52 @@ +# Configuration for programs including a hires screen (with 6KB LOWCODE) + +FEATURES { + STARTADDRESS: default = $0803; +} +SYMBOLS { + __EXEHDR__: type = import; + __STACKSIZE__: type = weak, value = $0800; # 2k stack + __HIMEM__: type = weak, value = $9600; # Presumed RAM end + __LCADDR__: type = weak, value = $D400; # Behind quit code + __LCSIZE__: type = weak, value = $0C00; # Rest of bank two + __MAIN_START__: type = export, value = %S; + __MAIN_LAST__: type = export, value = __HIGH_LAST__; +} +MEMORY { + ZP: file = "", define = yes, start = $0080, size = $001A; + HEADER: file = %O, start = %S - 4, size = $0004; + LOW: file = %O, fill = yes, start = %S, size = $2000 - %S; + HGR: file = %O, fill = yes, start = $2000, size = $2000; + HIGH: file = %O, define = yes, start = $4000, size = __HIMEM__ - $4000; + BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; + LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; +} +SEGMENTS { + ZEROPAGE: load = ZP, type = zp; + EXEHDR: load = HEADER, type = ro; + STARTUP: load = LOW, type = ro; + LOWCODE: load = LOW, type = ro, optional = yes; + HGR: load = HGR, type = rw, optional = yes; + CODE: load = HIGH, type = ro; + RODATA: load = HIGH, type = ro; + DATA: load = HIGH, type = rw; + INIT: load = HIGH, type = rw; + ONCE: load = HIGH, type = ro, define = yes; + LC: load = HIGH, run = LC, type = ro, optional = yes; + BSS: load = BSS, type = bss, define = yes; +} +FEATURES { + CONDES: type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__, + segment = ONCE; + CONDES: type = destructor, + label = __DESTRUCTOR_TABLE__, + count = __DESTRUCTOR_COUNT__, + segment = RODATA; + CONDES: type = interruptor, + label = __INTERRUPTOR_TABLE__, + count = __INTERRUPTOR_COUNT__, + segment = RODATA, + import = __CALLIRQ__; +} diff --git a/testcode/lib/apple2/hgrtest.c b/testcode/lib/apple2/hgrtest.c new file mode 100644 index 000000000..7323cbb73 --- /dev/null +++ b/testcode/lib/apple2/hgrtest.c @@ -0,0 +1,26 @@ +// cl65 -t apple2 -C apple2-hgr.cfg hgrtest.c werner.s + +#include <tgi.h> +#include <conio.h> + +#pragma code-name (push, "LOWCODE") + +void say (const char* text) +{ + tgi_setcolor (TGI_COLOR_BLACK); + tgi_outtextxy (41, 33, text); +} + +#pragma code-name (pop) + +void main (void) +{ + tgi_install (a2_hi_tgi); + tgi_init (); + cgetc (); + + say ("Hi Dude !"); + cgetc (); + + tgi_uninstall (); +} diff --git a/testcode/lib/apple2/werner.pic b/testcode/lib/apple2/werner.pic new file mode 100644 index 0000000000000000000000000000000000000000..2405e2409470d0de0e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ode 100644 index 000000000..6456ade13 --- /dev/null +++ b/testcode/lib/apple2/werner.s @@ -0,0 +1,2 @@ +.segment "HGR" +.incbin "werner.pic" From 80b09ba9fc42f65b84f91ea2d170325abe84fac1 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Wed, 31 Jan 2018 08:54:48 +0100 Subject: [PATCH 120/254] Significantly simplified recently added linker config files. I just forgot about the 'start' segment attribute - which makes the scenario at hand dead easy. --- cfg/apple2-hgr.cfg | 34 +++++++++++++++------------------- cfg/apple2enh-hgr.cfg | 34 +++++++++++++++------------------- 2 files changed, 30 insertions(+), 38 deletions(-) diff --git a/cfg/apple2-hgr.cfg b/cfg/apple2-hgr.cfg index 540578b25..536491c67 100644 --- a/cfg/apple2-hgr.cfg +++ b/cfg/apple2-hgr.cfg @@ -4,35 +4,31 @@ FEATURES { STARTADDRESS: default = $0803; } SYMBOLS { - __EXEHDR__: type = import; - __STACKSIZE__: type = weak, value = $0800; # 2k stack - __HIMEM__: type = weak, value = $9600; # Presumed RAM end - __LCADDR__: type = weak, value = $D400; # Behind quit code - __LCSIZE__: type = weak, value = $0C00; # Rest of bank two - __MAIN_START__: type = export, value = %S; - __MAIN_LAST__: type = export, value = __HIGH_LAST__; + __EXEHDR__: type = import; + __STACKSIZE__: type = weak, value = $0800; # 2k stack + __HIMEM__: type = weak, value = $9600; # Presumed RAM end + __LCADDR__: type = weak, value = $D400; # Behind quit code + __LCSIZE__: type = weak, value = $0C00; # Rest of bank two } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; HEADER: file = %O, start = %S - 4, size = $0004; - LOW: file = %O, fill = yes, start = %S, size = $2000 - %S; - HGR: file = %O, fill = yes, start = $2000, size = $2000; - HIGH: file = %O, define = yes, start = $4000, size = __HIMEM__ - $4000; + MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; EXEHDR: load = HEADER, type = ro; - STARTUP: load = LOW, type = ro; - LOWCODE: load = LOW, type = ro, optional = yes; - HGR: load = HGR, type = rw, optional = yes; - CODE: load = HIGH, type = ro; - RODATA: load = HIGH, type = ro; - DATA: load = HIGH, type = rw; - INIT: load = HIGH, type = rw; - ONCE: load = HIGH, type = ro, define = yes; - LC: load = HIGH, run = LC, type = ro, optional = yes; + STARTUP: load = MAIN, type = ro; + LOWCODE: load = MAIN, type = ro, optional = yes; + HGR: load = MAIN, type = rw, optional = yes, start = $2000; + CODE: load = MAIN, type = ro start = $4000; + RODATA: load = MAIN, type = ro; + DATA: load = MAIN, type = rw; + INIT: load = MAIN, type = rw; + ONCE: load = MAIN, type = ro, define = yes; + LC: load = MAIN, run = LC, type = ro, optional = yes; BSS: load = BSS, type = bss, define = yes; } FEATURES { diff --git a/cfg/apple2enh-hgr.cfg b/cfg/apple2enh-hgr.cfg index 540578b25..536491c67 100644 --- a/cfg/apple2enh-hgr.cfg +++ b/cfg/apple2enh-hgr.cfg @@ -4,35 +4,31 @@ FEATURES { STARTADDRESS: default = $0803; } SYMBOLS { - __EXEHDR__: type = import; - __STACKSIZE__: type = weak, value = $0800; # 2k stack - __HIMEM__: type = weak, value = $9600; # Presumed RAM end - __LCADDR__: type = weak, value = $D400; # Behind quit code - __LCSIZE__: type = weak, value = $0C00; # Rest of bank two - __MAIN_START__: type = export, value = %S; - __MAIN_LAST__: type = export, value = __HIGH_LAST__; + __EXEHDR__: type = import; + __STACKSIZE__: type = weak, value = $0800; # 2k stack + __HIMEM__: type = weak, value = $9600; # Presumed RAM end + __LCADDR__: type = weak, value = $D400; # Behind quit code + __LCSIZE__: type = weak, value = $0C00; # Rest of bank two } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; HEADER: file = %O, start = %S - 4, size = $0004; - LOW: file = %O, fill = yes, start = %S, size = $2000 - %S; - HGR: file = %O, fill = yes, start = $2000, size = $2000; - HIGH: file = %O, define = yes, start = $4000, size = __HIMEM__ - $4000; + MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; EXEHDR: load = HEADER, type = ro; - STARTUP: load = LOW, type = ro; - LOWCODE: load = LOW, type = ro, optional = yes; - HGR: load = HGR, type = rw, optional = yes; - CODE: load = HIGH, type = ro; - RODATA: load = HIGH, type = ro; - DATA: load = HIGH, type = rw; - INIT: load = HIGH, type = rw; - ONCE: load = HIGH, type = ro, define = yes; - LC: load = HIGH, run = LC, type = ro, optional = yes; + STARTUP: load = MAIN, type = ro; + LOWCODE: load = MAIN, type = ro, optional = yes; + HGR: load = MAIN, type = rw, optional = yes, start = $2000; + CODE: load = MAIN, type = ro start = $4000; + RODATA: load = MAIN, type = ro; + DATA: load = MAIN, type = rw; + INIT: load = MAIN, type = rw; + ONCE: load = MAIN, type = ro, define = yes; + LC: load = MAIN, run = LC, type = ro, optional = yes; BSS: load = BSS, type = bss, define = yes; } FEATURES { From 38049d22ba54945e33d3b392fd4bb46b4b14773e Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Wed, 31 Jan 2018 14:53:31 +0100 Subject: [PATCH 121/254] Provide symbole for RAM memory area. The RAM memory area symbols are referred by the startup code. The 64k and 128k variant say "for assembler" so it may be not necessary to do that there. However given the "limited" state of documentation for the target I don't assign too much value to those statements. Additionally it's unclear to me why two variants provide symbols for the ROM memory. --- cfg/supervision-128k.cfg | 4 ++-- cfg/supervision-16k.cfg | 6 +++--- cfg/supervision-64k.cfg | 4 ++-- cfg/supervision.cfg | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cfg/supervision-128k.cfg b/cfg/supervision-128k.cfg index 0304e2c02..a03ab0e1b 100644 --- a/cfg/supervision-128k.cfg +++ b/cfg/supervision-128k.cfg @@ -2,13 +2,13 @@ # for assembler # ld65 config file -# ld65 --config supervision.cfg -o <prog>.bin <prog>.o +# ld65 --config supervision-128k.cfg -o <prog>.bin <prog>.o SYMBOLS { __STACKSIZE__: type = weak, value = $0100; # 1 page stack } MEMORY { - RAM: file = "", start = $0000, size = $2000 - __STACKSIZE__; + RAM: file = "", start = $0000, size = $2000 - __STACKSIZE__, define = yes; VRAM: file = "", start = $4000, size = $2000; BANKROM1: file = %O, start = $8000, size = $4000, fill = yes, fillval = $FF; BANKROM2: file = %O, start = $8000, size = $4000, fill = yes, fillval = $FF; diff --git a/cfg/supervision-16k.cfg b/cfg/supervision-16k.cfg index 86c8fface..e0b54be23 100644 --- a/cfg/supervision-16k.cfg +++ b/cfg/supervision-16k.cfg @@ -1,7 +1,7 @@ # supervision 16kbyte cartridge # ld65 config file -# ld65 --config supervision16.cfg -o <prog>.bin <prog>.o +# ld65 --config supervision-16k.cfg -o <prog>.bin <prog>.o SYMBOLS { __STACKSIZE__: type = weak, value = $0100; # 1 page stack @@ -9,9 +9,9 @@ SYMBOLS { MEMORY { ZP: file = "", start = $0000, size = $0100; CPUSTACK: file = "", start = $0100, size = $0100; - RAM: file = "", start = $0200, size = $1E00 - __STACKSIZE__; + RAM: file = "", start = $0200, size = $1E00 - __STACKSIZE__, define = yes; VRAM: file = "", start = $4000, size = $2000; - ROM: file = %O, start = $C000, size = $4000, fill = yes, fillval = $ff, define=yes; + ROM: file = %O, start = $C000, size = $4000, fill = yes, fillval = $FF, define = yes; } SEGMENTS { ZEROPAGE: load = ZP, type = zp, define = yes; diff --git a/cfg/supervision-64k.cfg b/cfg/supervision-64k.cfg index 8a7665c30..9d5f15e45 100644 --- a/cfg/supervision-64k.cfg +++ b/cfg/supervision-64k.cfg @@ -2,13 +2,13 @@ # for assembler # ld65 config file -# ld65 --config supervision.cfg -o <prog>.bin <prog>.o +# ld65 --config supervision-64k.cfg -o <prog>.bin <prog>.o SYMBOLS { __STACKSIZE__: type = weak, value = $0100; # 1 page stack } MEMORY { - RAM: file = "", start = $0000, size = $2000 - __STACKSIZE__; + RAM: file = "", start = $0000, size = $2000 - __STACKSIZE__, define = yes; VRAM: file = "", start = $4000, size = $2000; BANKROM1: file = %O, start = $8000, size = $4000, fill = yes, fillval = $FF; BANKROM2: file = %O, start = $8000, size = $4000, fill = yes, fillval = $FF; diff --git a/cfg/supervision.cfg b/cfg/supervision.cfg index 2d20e3461..d9f189f2b 100644 --- a/cfg/supervision.cfg +++ b/cfg/supervision.cfg @@ -8,7 +8,7 @@ SYMBOLS { MEMORY { ZP: file = "", start = $0000, size = $0100; CPUSTACK: file = "", start = $0100, size = $0100; - RAM: file = "", start = $0200, size = $1E00 - __STACKSIZE__; + RAM: file = "", start = $0200, size = $1E00 - __STACKSIZE__, define = yes; VRAM: file = "", start = $4000, size = $2000; ROM: file = %O, start = $8000, size = $8000, fill = yes, fillval = $FF, define = yes; } From 19ed94fe25fb834bb002ece6a0201173fc709027 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Wed, 31 Jan 2018 15:06:37 +0100 Subject: [PATCH 122/254] Adjust alternative ProDOS 8 I/O buffer allocation module to linker configs. The Apple II linker configs don't define symbols for the STARTP segment anymore. There refer to the load/start address in the same way the executable file header does. --- libsrc/apple2/extra/iobuf-0800.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsrc/apple2/extra/iobuf-0800.s b/libsrc/apple2/extra/iobuf-0800.s index 0ad7a751f..7ed832ed3 100644 --- a/libsrc/apple2/extra/iobuf-0800.s +++ b/libsrc/apple2/extra/iobuf-0800.s @@ -7,7 +7,7 @@ .constructor initiobuf .export iobuf_alloc, iobuf_free - .import __STARTUP_RUN__ + .import __MAIN_START__ .import incsp2, popax .include "zeropage.inc" @@ -18,7 +18,7 @@ initiobuf: ; Convert end address highbyte to table index - lda #>__STARTUP_RUN__ + lda #>__MAIN_START__ sec sbc #>$0800 lsr From 58bfe28244d1edc96d73c43dd9716ee05fafad5f Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Wed, 31 Jan 2018 23:52:08 +0100 Subject: [PATCH 123/254] Updated AppleCommander URL. --- doc/apple2.sgml | 2 +- doc/apple2enh.sgml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/apple2.sgml b/doc/apple2.sgml index 33a878223..05b4ef9ba 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -39,7 +39,7 @@ containing the load address and load length. The default load address is $803. <bf/AppleCommander 1.3.5/ or later (available at <url -url="http://applecommander.sourceforge.net/">) includes the option <tt/-cc65/ +url="https://applecommander.github.io/">) includes the option <tt/-cc65/ that allows to put binary files with a DOS 3.3 header onto disk images containing DOS 3.3 as well as ProDOS 8. diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml index 4f5202543..136f074b5 100644 --- a/doc/apple2enh.sgml +++ b/doc/apple2enh.sgml @@ -39,7 +39,7 @@ containing the load address and load length. The default load address is $803. <bf/AppleCommander 1.3.5/ or later (available at <url -url="http://applecommander.sourceforge.net/">) includes the option <tt/-cc65/ +url="https://applecommander.github.io/">) includes the option <tt/-cc65/ that allows to put binary files with a DOS 3.3 header onto disk images containing DOS 3.3 as well as ProDOS 8. From ef5461a32c144ee82c95f46bbe41de894babaa4b Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Thu, 1 Feb 2018 00:18:07 +0100 Subject: [PATCH 124/254] Mention the recently added linker configs. --- doc/apple2.sgml | 39 +++++++++++++++++++++++++++++++++++++-- doc/apple2enh.sgml | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/doc/apple2.sgml b/doc/apple2.sgml index 05b4ef9ba..822dd564e 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -168,9 +168,44 @@ Parameters: </descrip><p> +<sect1><tt/apple2-hgr.cfg/<p> + +Configuration for a program including a hires page. See <tt>testcode/lib/apple/hgrtest.c</tt> +for an example of such a program. + +Parameters: + +<descrip> + + <tag><tt/STARTADDRESS:/ Program start address</tag> + Default: $803. Use <tt/-S <addr>/ to set a different start address. + + <tag><tt/__EXEHDR__:/ Executable file header</tag> + Default: DOS 3.3 header (address and length). Use <tt/-D __EXEHDR__=0/ to omit + the header. + + <tag><tt/__STACKSIZE__:/ C runtime stack size</tag> + Default: $800. Use <tt/-D __STACKSIZE__=<size>/ to set a different + stack size. + + <tag><tt/__HIMEM__:/ Highest usable memory address presumed at link time</tag> + Default: $9600. Use <tt/-D __HIMEM__=<addr>/ to set a different + highest usable address. + + <tag><tt/__LCADDR__:/ Address of code in the Language Card</tag> + Default: $D400. Use <tt/-D __LCADDR__=<addr>/ to set a different + code address. + + <tag><tt/__LCSIZE__:/ Size of code in the Language Card</tag> + Default: $C00. Use <tt/-D __LCSIZE__=<size>/ to set a different + code size. + +</descrip><p> + + <sect1><tt/apple2-overlay.cfg/<p> -Configuration for overlay programs with the up to nine overlays. The overlay files +Configuration for an overlay program with up to nine overlays. The overlay files don't include the DOS 3.3 header. See <tt>samples/overlaydemo.c</tt> for more information on overlays. @@ -210,7 +245,7 @@ Parameters: <sect1><tt/apple2-asm.cfg/<p> -Configuration for a assembler programs which don't need a special setup. +Configuration for an assembler program that doesn't need a special setup. Parameters: diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml index 136f074b5..3a53b6b8c 100644 --- a/doc/apple2enh.sgml +++ b/doc/apple2enh.sgml @@ -168,9 +168,44 @@ Parameters: </descrip><p> +<sect1><tt/apple2enh-hgr.cfg/<p> + +Configuration for a program including a hires page. See <tt>testcode/lib/apple/hgrtest.c</tt> +for an example of such a program. + +Parameters: + +<descrip> + + <tag><tt/STARTADDRESS:/ Program start address</tag> + Default: $803. Use <tt/-S <addr>/ to set a different start address. + + <tag><tt/__EXEHDR__:/ Executable file header</tag> + Default: DOS 3.3 header (address and length). Use <tt/-D __EXEHDR__=0/ to omit + the header. + + <tag><tt/__STACKSIZE__:/ C runtime stack size</tag> + Default: $800. Use <tt/-D __STACKSIZE__=<size>/ to set a different + stack size. + + <tag><tt/__HIMEM__:/ Highest usable memory address presumed at link time</tag> + Default: $9600. Use <tt/-D __HIMEM__=<addr>/ to set a different + highest usable address. + + <tag><tt/__LCADDR__:/ Address of code in the Language Card</tag> + Default: $D400. Use <tt/-D __LCADDR__=<addr>/ to set a different + code address. + + <tag><tt/__LCSIZE__:/ Size of code in the Language Card</tag> + Default: $C00. Use <tt/-D __LCSIZE__=<size>/ to set a different + code size. + +</descrip><p> + + <sect1><tt/apple2enh-overlay.cfg/<p> -Configuration for overlay programs with the up to nine overlays. The overlay files +Configuration for an overlay program with up to nine overlays. The overlay files don't include the DOS 3.3 header. See <tt>samples/overlaydemo.c</tt> for more information on overlays. @@ -210,7 +245,7 @@ Parameters: <sect1><tt/apple2enh-asm.cfg/<p> -Configuration for a assembler programs which don't need a special setup. +Configuration for an assembler program that doesn't need a special setup. Parameters: From 5145235b978e42ffe49641477ef6427de51c1cc0 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Thu, 1 Feb 2018 21:46:56 +0100 Subject: [PATCH 125/254] Updated AppleCommander URL. --- samples/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Makefile b/samples/Makefile index 59841d655..2bcfa08c3 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -44,7 +44,7 @@ ifneq ($(filter disk samples.%,$(MAKECMDGOALS)),) # This one comes with VICE C1541 ?= c1541 - # For this one see http://applecommander.sourceforge.net/ + # For this one see https://applecommander.github.io/ AC ?= ac.jar # For this one see http://www.horus.com/~hias/atari/ From 9031320dff93ea93c97f82b3890d79558086ec79 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Thu, 1 Feb 2018 21:50:54 +0100 Subject: [PATCH 126/254] Added Makefile for recently added linker config test program. --- testcode/lib/apple2/Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 testcode/lib/apple2/Makefile diff --git a/testcode/lib/apple2/Makefile b/testcode/lib/apple2/Makefile new file mode 100644 index 000000000..87dadcbe7 --- /dev/null +++ b/testcode/lib/apple2/Makefile @@ -0,0 +1,12 @@ +# For this one see https://applecommander.github.io/ +AC ?= ac.jar + +CL = cl65 +CLFLAGS = -t apple2 -C apple2-hgr.cfg -Oirs + +hgrtest.dsk: hgrtest + cp prodos.dsk $@ + java -jar $(AC) -cc65 $@ hgrtest bin <hgrtest + +hgrtest: hgrtest.c werner.s + $(CL) $(CLFLAGS) -m hgrtest.map $^ From 27dacca4d38b54b7a44e9d0b1a7e4fc948c14df8 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Thu, 1 Feb 2018 22:06:59 +0100 Subject: [PATCH 127/254] Added missing dummy libref. --- libsrc/supervision/libref.s | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 libsrc/supervision/libref.s diff --git a/libsrc/supervision/libref.s b/libsrc/supervision/libref.s new file mode 100644 index 000000000..e4afa7eb1 --- /dev/null +++ b/libsrc/supervision/libref.s @@ -0,0 +1,8 @@ +; +; Oliver Schmidt, 2013-05-31 +; + + .export joy_libref + .import _exit + +joy_libref := _exit From 1976d6cd32f909babc5f6f26c9c068f47abb95bc Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Thu, 1 Feb 2018 22:38:36 +0100 Subject: [PATCH 128/254] Removed IRQ support from joystick drivers. All but one joystick drivers didn't use IRQs. Espsecially when the joystick driver kernel was the only .interruptor this meant quite some unnecessary overhead because it pulled in the whole IRQ infrastructure. I was told that the one driver using IRQs (the DXS/HIT-4 Player joystick driver for the C64) can be reworked to not do it. Until this is done that driver is defunct. --- asminc/joy-kernel.inc | 3 +-- libsrc/apple2/joy/a2.stdjoy.s | 1 - libsrc/atari/joy/atrmj8.s | 1 - libsrc/atari/joy/atrstd.s | 1 - libsrc/atari5200/joy/atr5200std.s | 1 - libsrc/atmos/joy/atmos-ijk.s | 12 ------------ libsrc/atmos/joy/atmos-pase.s | 1 - libsrc/c128/joy/c128-ptvjoy.s | 1 - libsrc/c128/joy/c128-stdjoy.s | 1 - libsrc/c64/joy/c64-hitjoy.s | 1 - libsrc/c64/joy/c64-numpad.s | 1 - libsrc/c64/joy/c64-ptvjoy.s | 1 - libsrc/c64/joy/c64-stdjoy.s | 1 - libsrc/cbm510/joy/cbm510-std.s | 1 - libsrc/creativision/joy/creativision-stdjoy.s | 1 - libsrc/gamate/joy/gamate-stdjoy.s | 1 - libsrc/joystick/joy-kernel.s | 18 +----------------- libsrc/joystick/joy_read.s | 2 -- libsrc/lynx/joy/lynx-stdjoy.s | 1 - libsrc/nes/joy/nes-stdjoy.s | 1 - libsrc/pce/joy/pce-stdjoy.s | 1 - libsrc/pet/joy/pet-ptvjoy.s | 1 - libsrc/pet/joy/pet-stdjoy.s | 1 - libsrc/plus4/joy/plus4-stdjoy.s | 1 - libsrc/supervision/joy/supervision-stdjoy.s | 1 - libsrc/vic20/joy/vic20-ptvjoy.s | 1 - libsrc/vic20/joy/vic20-stdjoy.s | 1 - 27 files changed, 2 insertions(+), 56 deletions(-) diff --git a/asminc/joy-kernel.inc b/asminc/joy-kernel.inc index c8cc29820..ef729fe3c 100644 --- a/asminc/joy-kernel.inc +++ b/asminc/joy-kernel.inc @@ -48,14 +48,13 @@ UNINSTALL .addr ; UNINSTALL routine COUNT .addr ; COUNT routine READ .addr ; READ routine - IRQ .addr ; IRQ routine .endstruct .endstruct ;------------------------------------------------------------------------------ ; The JOY API version, stored in JOY_HDR::VERSION -JOY_API_VERSION = $04 +JOY_API_VERSION = $05 ;------------------------------------------------------------------------------ ; Variables diff --git a/libsrc/apple2/joy/a2.stdjoy.s b/libsrc/apple2/joy/a2.stdjoy.s index ed2083255..7e90f7b98 100644 --- a/libsrc/apple2/joy/a2.stdjoy.s +++ b/libsrc/apple2/joy/a2.stdjoy.s @@ -52,7 +52,6 @@ PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ not used ; ------------------------------------------------------------------------ diff --git a/libsrc/atari/joy/atrmj8.s b/libsrc/atari/joy/atrmj8.s index 0e8cd2a0a..9b02485d6 100644 --- a/libsrc/atari/joy/atrmj8.s +++ b/libsrc/atari/joy/atrmj8.s @@ -41,7 +41,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry not used ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/atari/joy/atrstd.s b/libsrc/atari/joy/atrstd.s index 0c8799e21..0c49499f8 100644 --- a/libsrc/atari/joy/atrstd.s +++ b/libsrc/atari/joy/atrstd.s @@ -40,7 +40,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry not used ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/atari5200/joy/atr5200std.s b/libsrc/atari5200/joy/atr5200std.s index 0b8b93b63..041dc6830 100644 --- a/libsrc/atari5200/joy/atr5200std.s +++ b/libsrc/atari5200/joy/atr5200std.s @@ -33,7 +33,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry not used .code diff --git a/libsrc/atmos/joy/atmos-ijk.s b/libsrc/atmos/joy/atmos-ijk.s index f59f6b96a..6e75a3e0b 100644 --- a/libsrc/atmos/joy/atmos-ijk.s +++ b/libsrc/atmos/joy/atmos-ijk.s @@ -27,24 +27,12 @@ .addr $0000 -; Button state masks (8 values) - - .byte $10 ; JOY_UP - .byte $08 ; JOY_DOWN - .byte $01 ; JOY_LEFT - .byte $02 ; JOY_RIGHT - .byte $20 ; JOY_FIRE - .byte $00 ; Future expansion - .byte $00 ; Future expansion - .byte $00 ; Future expansion - ; Jump table. .addr INSTALL .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/atmos/joy/atmos-pase.s b/libsrc/atmos/joy/atmos-pase.s index 637571c04..fd64901c9 100644 --- a/libsrc/atmos/joy/atmos-pase.s +++ b/libsrc/atmos/joy/atmos-pase.s @@ -34,7 +34,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/c128/joy/c128-ptvjoy.s b/libsrc/c128/joy/c128-ptvjoy.s index c9ae39a47..180f7667d 100644 --- a/libsrc/c128/joy/c128-ptvjoy.s +++ b/libsrc/c128/joy/c128-ptvjoy.s @@ -36,7 +36,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/c128/joy/c128-stdjoy.s b/libsrc/c128/joy/c128-stdjoy.s index 943361da5..bf2e2fea7 100644 --- a/libsrc/c128/joy/c128-stdjoy.s +++ b/libsrc/c128/joy/c128-stdjoy.s @@ -36,7 +36,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry not used ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/c64/joy/c64-hitjoy.s b/libsrc/c64/joy/c64-hitjoy.s index 10c936399..9f6c0b4dd 100644 --- a/libsrc/c64/joy/c64-hitjoy.s +++ b/libsrc/c64/joy/c64-hitjoy.s @@ -35,7 +35,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr IRQ ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/c64/joy/c64-numpad.s b/libsrc/c64/joy/c64-numpad.s index 5ed7af187..0ccdc4fcd 100644 --- a/libsrc/c64/joy/c64-numpad.s +++ b/libsrc/c64/joy/c64-numpad.s @@ -36,7 +36,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/c64/joy/c64-ptvjoy.s b/libsrc/c64/joy/c64-ptvjoy.s index af5c27e13..a772fb5f6 100644 --- a/libsrc/c64/joy/c64-ptvjoy.s +++ b/libsrc/c64/joy/c64-ptvjoy.s @@ -35,7 +35,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/c64/joy/c64-stdjoy.s b/libsrc/c64/joy/c64-stdjoy.s index 930ad6227..c983d81bb 100644 --- a/libsrc/c64/joy/c64-stdjoy.s +++ b/libsrc/c64/joy/c64-stdjoy.s @@ -35,7 +35,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/cbm510/joy/cbm510-std.s b/libsrc/cbm510/joy/cbm510-std.s index 0c2efc12d..4e47fc1a0 100644 --- a/libsrc/cbm510/joy/cbm510-std.s +++ b/libsrc/cbm510/joy/cbm510-std.s @@ -36,7 +36,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/creativision/joy/creativision-stdjoy.s b/libsrc/creativision/joy/creativision-stdjoy.s index 9a5afc42b..5cf46c39f 100644 --- a/libsrc/creativision/joy/creativision-stdjoy.s +++ b/libsrc/creativision/joy/creativision-stdjoy.s @@ -33,7 +33,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry not used ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/gamate/joy/gamate-stdjoy.s b/libsrc/gamate/joy/gamate-stdjoy.s index 801b40acd..8f927cdf5 100644 --- a/libsrc/gamate/joy/gamate-stdjoy.s +++ b/libsrc/gamate/joy/gamate-stdjoy.s @@ -30,7 +30,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/joystick/joy-kernel.s b/libsrc/joystick/joy-kernel.s index 0746709e9..c2d50c8d8 100644 --- a/libsrc/joystick/joy-kernel.s +++ b/libsrc/joystick/joy-kernel.s @@ -6,7 +6,6 @@ .import joy_libref .importzp ptr1 - .interruptor joy_irq ; Export as IRQ handler .include "joy-kernel.inc" .include "joy-error.inc" @@ -26,7 +25,6 @@ joy_install: jmp $0000 joy_uninstall: jmp $0000 joy_count: jmp $0000 joy_read: jmp $0000 -joy_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes ; Driver header signature .rodata @@ -73,18 +71,7 @@ _joy_install: cpy #(JOY_HDR::JUMPTAB + .sizeof(JOY_HDR::JUMPTAB)) bne @L1 - jsr joy_install ; Call driver install routine - tay ; Test error code - bne @L2 ; Bail out if install had errors - -; Install the IRQ vector if the driver needs it. A/X contains the error code -; from joy_install, so don't use it. - - ldy joy_irq+2 ; Check high byte of IRQ vector - beq @L2 ; Jump if vector invalid - ldy #$4C ; JMP opcode - sty joy_irq ; Activate IRQ routine -@L2: rts + jmp joy_install ; Call driver install routine ; Driver signature invalid @@ -108,9 +95,6 @@ copy: lda (ptr1),y ; */ _joy_uninstall: - lda #$60 ; RTS opcode - sta joy_irq ; Disable IRQ entry point - jsr joy_uninstall ; Call the driver routine _joy_clear_ptr: ; External entry point diff --git a/libsrc/joystick/joy_read.s b/libsrc/joystick/joy_read.s index f76d9dfb7..151600aee 100644 --- a/libsrc/joystick/joy_read.s +++ b/libsrc/joystick/joy_read.s @@ -8,5 +8,3 @@ .include "joy-kernel.inc" _joy_read = joy_read ; Use driver entry - - diff --git a/libsrc/lynx/joy/lynx-stdjoy.s b/libsrc/lynx/joy/lynx-stdjoy.s index 2e91cc43b..c81a97dbf 100644 --- a/libsrc/lynx/joy/lynx-stdjoy.s +++ b/libsrc/lynx/joy/lynx-stdjoy.s @@ -37,7 +37,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/nes/joy/nes-stdjoy.s b/libsrc/nes/joy/nes-stdjoy.s index 3032e9330..63caf364b 100644 --- a/libsrc/nes/joy/nes-stdjoy.s +++ b/libsrc/nes/joy/nes-stdjoy.s @@ -35,7 +35,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/pce/joy/pce-stdjoy.s b/libsrc/pce/joy/pce-stdjoy.s index ab25134dd..c0f338f90 100644 --- a/libsrc/pce/joy/pce-stdjoy.s +++ b/libsrc/pce/joy/pce-stdjoy.s @@ -30,7 +30,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/pet/joy/pet-ptvjoy.s b/libsrc/pet/joy/pet-ptvjoy.s index 3bb368355..7620013be 100644 --- a/libsrc/pet/joy/pet-ptvjoy.s +++ b/libsrc/pet/joy/pet-ptvjoy.s @@ -34,7 +34,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/pet/joy/pet-stdjoy.s b/libsrc/pet/joy/pet-stdjoy.s index 29c6de627..85b742302 100644 --- a/libsrc/pet/joy/pet-stdjoy.s +++ b/libsrc/pet/joy/pet-stdjoy.s @@ -33,7 +33,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/plus4/joy/plus4-stdjoy.s b/libsrc/plus4/joy/plus4-stdjoy.s index d998b2699..e8e85fedc 100644 --- a/libsrc/plus4/joy/plus4-stdjoy.s +++ b/libsrc/plus4/joy/plus4-stdjoy.s @@ -37,7 +37,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/supervision/joy/supervision-stdjoy.s b/libsrc/supervision/joy/supervision-stdjoy.s index f6a325740..d233a8600 100644 --- a/libsrc/supervision/joy/supervision-stdjoy.s +++ b/libsrc/supervision/joy/supervision-stdjoy.s @@ -29,7 +29,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/vic20/joy/vic20-ptvjoy.s b/libsrc/vic20/joy/vic20-ptvjoy.s index 3b1db402a..bf0ff128e 100644 --- a/libsrc/vic20/joy/vic20-ptvjoy.s +++ b/libsrc/vic20/joy/vic20-ptvjoy.s @@ -36,7 +36,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/vic20/joy/vic20-stdjoy.s b/libsrc/vic20/joy/vic20-stdjoy.s index 67299cc1a..e5539c653 100644 --- a/libsrc/vic20/joy/vic20-stdjoy.s +++ b/libsrc/vic20/joy/vic20-stdjoy.s @@ -36,7 +36,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants From f15cd3e468f68454706b44ff167570f7fea5886b Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Fri, 2 Feb 2018 12:02:52 +0100 Subject: [PATCH 129/254] Removed IRQ support from joystick drivers. --- include/joystick/joy-kernel.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/joystick/joy-kernel.h b/include/joystick/joy-kernel.h index e984291f7..783508247 100644 --- a/include/joystick/joy-kernel.h +++ b/include/joystick/joy-kernel.h @@ -59,7 +59,6 @@ typedef struct { void* uninstall; /* UNINSTALL routine */ void* count; /* COUNT routine */ void* read; /* READ routine */ - void* irq; /* IRQ routine */ } joy_drv_header; From 935f68f686ae13b93522d73bb0f9996eb9527489 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Fri, 2 Feb 2018 12:28:22 +0100 Subject: [PATCH 130/254] Harmonized the style of including headers from headers. We surely don't care about some file I/O on host machines in 2018 ;-) --- include/ace.h | 2 -- include/apple2.h | 3 ++- include/apple2enh.h | 5 +---- include/atari.h | 2 ++ include/atari2600.h | 8 +++++++- include/c16.h | 2 -- include/cbm.h | 5 +---- include/geos.h | 37 ++----------------------------------- include/geos/gdisk.h | 2 -- include/geos/gfile.h | 2 -- include/geos/ggraph.h | 2 -- include/geos/gmemory.h | 2 -- include/geos/gmenu.h | 2 -- include/geos/gprocess.h | 2 -- include/geos/gsym.h | 2 -- include/lynx.h | 5 +++++ include/plus4.h | 2 -- include/stdio.h | 11 ++--------- 18 files changed, 22 insertions(+), 74 deletions(-) diff --git a/include/ace.h b/include/ace.h index fba672227..8ce86e18f 100644 --- a/include/ace.h +++ b/include/ace.h @@ -45,9 +45,7 @@ -#ifndef _STDDEF_H #include <stddef.h> -#endif diff --git a/include/apple2.h b/include/apple2.h index 31e56a95a..f217ad04c 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -41,9 +41,10 @@ # error This module may only be used when compiling for the Apple ][! #endif - #include <apple2_filetype.h> + + /*****************************************************************************/ /* Data */ /*****************************************************************************/ diff --git a/include/apple2enh.h b/include/apple2enh.h index cc62f70b7..77328b5ed 100644 --- a/include/apple2enh.h +++ b/include/apple2enh.h @@ -42,10 +42,7 @@ -/* If not already done, include the apple2.h header file */ -#if !defined(_APPLE2_H) -# include <apple2.h> -#endif +#include <apple2.h> diff --git a/include/atari.h b/include/atari.h index bf1af7d7b..4bed8d7a7 100644 --- a/include/atari.h +++ b/include/atari.h @@ -355,5 +355,7 @@ struct __iocb { #define IOCB_GETCWD 0x30 /* get current directory (MyDOS/SpartaDOS) */ #define IOCB_FORMAT 0xFE /* format */ + + /* End of atari.h */ #endif diff --git a/include/atari2600.h b/include/atari2600.h index 1eb51a2dd..a6b5cda47 100644 --- a/include/atari2600.h +++ b/include/atari2600.h @@ -8,9 +8,13 @@ /* */ /*****************************************************************************/ + + #ifndef _ATARI2600_H #define _ATARI2600_H + + /* Check for errors */ #if !defined(__ATARI2600__) # error This module may only be used when compiling for the Atari 2600! @@ -22,5 +26,7 @@ #include <_riot.h> #define RIOT (*(struct __riot*)0x0280) + + /* End of atari2600.h */ -#endif /* #ifndef _ATARI2600_H */ +#endif diff --git a/include/c16.h b/include/c16.h index d49ca6fd4..c039218f9 100644 --- a/include/c16.h +++ b/include/c16.h @@ -47,9 +47,7 @@ /* Include the base header file for the 264 series. include file. */ -#ifndef _CBM264_H #include <cbm264.h> -#endif diff --git a/include/cbm.h b/include/cbm.h index da63375b2..1395f700f 100644 --- a/include/cbm.h +++ b/include/cbm.h @@ -46,10 +46,7 @@ /* We need NULL. */ - -#if !defined(_STDDEF_H) -# include <stddef.h> -#endif +#include <stddef.h> /* Load the system-specific files here, if needed. */ #if defined(__C64__) && !defined(_C64_H) diff --git a/include/geos.h b/include/geos.h index ae356d679..3f760b6ad 100644 --- a/include/geos.h +++ b/include/geos.h @@ -19,53 +19,19 @@ -#ifndef _GCONST_H #include <geos/gconst.h> -#endif - -#ifndef _GSTRUCT_H #include <geos/gstruct.h> -#endif - -#ifndef _GSYM_H #include <geos/gsym.h> -#endif - -#ifndef _GDISK_H #include <geos/gdisk.h> -#endif - -#ifndef _GFILE_H #include <geos/gfile.h> -#endif - -#ifndef _GPROCESS_H #include <geos/gprocess.h> -#endif - -#ifndef _GGRAPH_H #include <geos/ggraph.h> -#endif - -#ifndef _GMENU_H #include <geos/gmenu.h> -#endif - -#ifndef _GSPRITE_H #include <geos/gsprite.h> -#endif - -#ifndef _GMEMORY_H #include <geos/gmemory.h> -#endif - -#ifndef _GSYS_H #include <geos/gsys.h> -#endif - -#ifndef _GDLGBOX_H #include <geos/gdlgbox.h> -#endif + #define CH_ULCORNER '+' @@ -140,5 +106,6 @@ #define JOY_BTN_1_MASK 0x10 + /* End of geos.h */ #endif diff --git a/include/geos/gdisk.h b/include/geos/gdisk.h index f65d7d301..30305a2fc 100644 --- a/include/geos/gdisk.h +++ b/include/geos/gdisk.h @@ -7,9 +7,7 @@ #ifndef _GDISK_H #define _GDISK_H -#ifndef _GSTRUCT_H #include <geos/gstruct.h> -#endif char __fastcall__ ReadBuff(struct tr_se *myTrSe); char __fastcall__ WriteBuff(struct tr_se *myTrSe); diff --git a/include/geos/gfile.h b/include/geos/gfile.h index d7667d8ec..ec7a75bbc 100644 --- a/include/geos/gfile.h +++ b/include/geos/gfile.h @@ -7,9 +7,7 @@ #ifndef _GFILE_H #define _GFILE_H -#ifndef _GSTRUCT_H #include <geos/gstruct.h> -#endif struct filehandle *Get1stDirEntry(void); struct filehandle *GetNxtDirEntry(void); diff --git a/include/geos/ggraph.h b/include/geos/ggraph.h index 961ec2d80..35e02c198 100644 --- a/include/geos/ggraph.h +++ b/include/geos/ggraph.h @@ -7,9 +7,7 @@ #ifndef _GGRAPH_H #define _GGRAPH_H -#ifndef _GSTRUCT_H #include <geos/gstruct.h> -#endif void __fastcall__ SetPattern(char newpattern); diff --git a/include/geos/gmemory.h b/include/geos/gmemory.h index 3fba5cb5b..ba8e9f211 100644 --- a/include/geos/gmemory.h +++ b/include/geos/gmemory.h @@ -7,9 +7,7 @@ #ifndef _GMEMORY_H #define _GMEMORY_H -#ifndef _GSTRUCT_H #include <geos/gstruct.h> -#endif void __fastcall__ CopyString(char *dest, const char *source); char __fastcall__ CmpString(const char *dest, const char *source); diff --git a/include/geos/gmenu.h b/include/geos/gmenu.h index 3175b6cf3..89caa2c02 100644 --- a/include/geos/gmenu.h +++ b/include/geos/gmenu.h @@ -7,9 +7,7 @@ #ifndef _GMENU_H #define _GMENU_H -#ifndef _GSTRUCT_H #include <geos/gstruct.h> -#endif void __fastcall__ DoMenu(struct menu *myMenu); void ReDoMenu(void); diff --git a/include/geos/gprocess.h b/include/geos/gprocess.h index 6fab2ecfa..000003f32 100644 --- a/include/geos/gprocess.h +++ b/include/geos/gprocess.h @@ -7,9 +7,7 @@ #ifndef _GPROCESS_H #define _GPROCESS_H -#ifndef _GSTRUCT_H #include <geos/gstruct.h> -#endif void __fastcall__ InitProcesses(char number, struct process *proctab); void __fastcall__ RestartProcess(char number); diff --git a/include/geos/gsym.h b/include/geos/gsym.h index 085046674..2b2c8fbb2 100644 --- a/include/geos/gsym.h +++ b/include/geos/gsym.h @@ -7,9 +7,7 @@ #ifndef _GSYM_H #define _GSYM_H -#ifndef _GSTRUCT_H #include <geos/gstruct.h> -#endif #define r0 (*(unsigned*)(R_BASE + 0x00)) #define r0L (*(char*)(R_BASE + 0x00)) diff --git a/include/lynx.h b/include/lynx.h index 3629f322e..4b0390a13 100644 --- a/include/lynx.h +++ b/include/lynx.h @@ -123,6 +123,8 @@ extern void lynx_160_102_16_tgi[]; /* Referred to by tgi_static_stddrv[] */ /* Sound support */ /*****************************************************************************/ + + void lynx_snd_init (void); /* Initialize the sound driver */ @@ -144,6 +146,8 @@ void __fastcall__ lynx_snd_stop_channel (unsigned char channel); unsigned char lynx_snd_active(void); /* Show which channels are active */ + + /*****************************************************************************/ /* Accessing the cart */ /*****************************************************************************/ @@ -209,5 +213,6 @@ unsigned __fastcall__ lynx_eewrite (unsigned cell, unsigned val); #define SUZY (*(struct __suzy*)0xFC00) + /* End of lynx.h */ #endif diff --git a/include/plus4.h b/include/plus4.h index 840e8b342..81e3c5286 100644 --- a/include/plus4.h +++ b/include/plus4.h @@ -47,9 +47,7 @@ /* Include the base header file for the 264 series. include file. */ -#ifndef _CBM264_H #include <cbm264.h> -#endif /* Define hardware */ #include <_6551.h> diff --git a/include/stdio.h b/include/stdio.h index a3facd513..73dc05bdb 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -38,12 +38,8 @@ -#ifndef _STDDEF_H -# include <stddef.h> -#endif -#ifndef _STDARG_H -# include <stdarg.h> -#endif +#include <stddef.h> +#include <stdarg.h> @@ -147,6 +143,3 @@ void __fastcall__ _poserror (const char* msg); /* cc65 */ /* End of stdio.h */ #endif - - - From 2cf1bb89be0fec491d3c24cd238325651d0e55fb Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Fri, 2 Feb 2018 12:35:40 +0100 Subject: [PATCH 131/254] Removed ACE header. There's no code in the tool chain to set __ACE__ nor is there an ace.lib C library. --- include/ace.h | 117 -------------------------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 include/ace.h diff --git a/include/ace.h b/include/ace.h deleted file mode 100644 index 8ce86e18f..000000000 --- a/include/ace.h +++ /dev/null @@ -1,117 +0,0 @@ -/*****************************************************************************/ -/* */ -/* ace.h */ -/* */ -/* ACE system-specific definitions */ -/* */ -/* */ -/* */ -/* (C) 1998-2015, Ullrich von Bassewitz */ -/* Roemerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ -/* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ -/* Permission is granted to anyone to use this software for any purpose, */ -/* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ -/* 1. The origin of this software must not be misrepresented; you must not */ -/* claim that you wrote the original software. If you use this software */ -/* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ -/* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ -/*****************************************************************************/ - - - -#ifndef _ACE_H -#define _ACE_H - - - -/* Check for errors */ -#if !defined(__ACE__) -# error This module may only be used when compiling for the ACE os! -#endif - - - -#include <stddef.h> - - - -struct aceDirentBuf { - unsigned long ad_size; /* Size in bytes */ - unsigned char ad_date [8]; /* YY:YY:MM:DD:HH:MM:SS:TW */ - char ad_type [4]; /* File type as ASCIIZ string */ - unsigned char ad_flags; /* File flags */ - unsigned char ad_usage; /* More flags */ - unsigned char ad_namelen; /* Length of name */ - char ad_name [17]; /* Name itself, ASCIIZ */ -}; - -int __cdecl__ aceDirOpen (char* dir); -int __cdecl__ aceDirClose (int handle); -int __cdecl__ aceDirRead (int handle, struct aceDirentBuf* buf); - -/* Type of an ACE key. Key in low byte, shift mask in high byte */ -typedef unsigned int aceKey; - -/* #defines for the shift mask returned by aceConGetKey */ -#define aceSH_KEY 0x00FF /* Mask key itself */ -#define aceSH_MASK 0xFF00 /* Mask shift mask */ -#define aceSH_EXT 0x2000 /* Extended key */ -#define aceSH_CAPS 0x1000 /* Caps lock key */ -#define aceSH_ALT 0x0800 /* Alternate key */ -#define aceSH_CTRL 0x0400 /* Ctrl key */ -#define aceSH_CBM 0x0200 /* Commodore key */ -#define aceSH_SHIFT 0x0100 /* Shift key */ - -/* #defines for the options in aceConSetOpt/aceConGetOpt */ -#define aceOP_PUTMASK 1 /* Console put mask */ -#define aceOP_CHARCOLOR 2 /* Character color */ -#define aceOP_CHARATTR 3 /* Character attribute */ -#define aceOP_FILLCOLOR 4 /* Fill color */ -#define aceOP_FILLATTR 5 /* Fill attribute */ -#define aceOP_CRSCOLOR 6 /* Cursor color */ -#define aceOP_CRSWRAP 7 /* Force cursor wrap */ -#define aceOP_SHSCROLL 8 /* Shift keys for scrolling */ -#define aceOP_MOUSCALE 9 /* Mouse scaling */ -#define aceOP_RPTDELAY 10 /* Key repeat delay */ -#define aceOP_RPTRATE 11 /* Key repeat rate */ - -/* Console functions */ -void __cdecl__ aceConWrite (char* buf, size_t count); -void __cdecl__ aceConPutLit (int c); -void __cdecl__ aceConPos (unsigned x, unsigned y); -void __cdecl__ aceConGetPos (unsigned* x, unsigned* y); -unsigned aceConGetX (void); -unsigned aceConGetY (void); -char __cdecl__* aceConInput (char* buf, unsigned initial); -int aceConStopKey (void); -aceKey aceConGetKey (void); -int __cdecl__ aceConKeyAvail (aceKey* key); -void __cdecl__ aceConKeyMat (char* matrix); -void __cdecl__ aceConSetOpt (unsigned char opt, unsigned char val); -int __cdecl__ aceConGetOpt (unsigned char opt); - -/* Misc stuff */ -int __cdecl__ aceMiscIoPeek (unsigned addr); -void __cdecl__ aceMiscIoPoke (unsigned addr, unsigned char val); - - - -/* End of ace.h */ -#endif - - - From d7afadb2fe62a2154ad5bcb949644da17e4ac7c6 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Fri, 2 Feb 2018 12:59:05 +0100 Subject: [PATCH 132/254] Factored out target specific inclusion of target header. So far conio.h included the target header to get the CH_... and COLOR_... macros. However tgi.h never did the same to get the TGI_COLOR_... macros. And some time ago the JOY_..._MASK macros moved from joystick.h into the target header yet joystick.h didn't include the target header. Why wasn't that issue detected so far? Because about every program using TGI and/or the joystick uses CONIO too and therefore includes the target header that way. However, conceptually it's clean to factor out the target header inclusion and have tgi.h and joystick.h do it like conio.h. Apart from that user code may make direct use of target.h too. --- include/conio.h | 44 ++++------------------------ include/joystick.h | 7 +++-- include/target.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++ include/tgi.h | 6 +--- 4 files changed, 84 insertions(+), 46 deletions(-) create mode 100644 include/target.h diff --git a/include/conio.h b/include/conio.h index 9cd505766..72421af86 100644 --- a/include/conio.h +++ b/include/conio.h @@ -54,40 +54,8 @@ -#if !defined(_STDARG_H) -# include <stdarg.h> -#endif - -/* Include the correct machine-specific file */ -#if defined(__APPLE2ENH__) -# include <apple2enh.h> -#elif defined(__APPLE2__) -# include <apple2.h> -#elif defined(__ATARI5200__) -# include <atari5200.h> -#elif defined(__ATARI__) -# include <atari.h> -#elif defined(__ATMOS__) -# include <atmos.h> -#elif defined(__CBM__) -# include <cbm.h> -#elif defined(__CREATIVISION__) -# include <creativision.h> -#elif defined(__GAMATE__) -# include <gamate.h> -#elif defined(__GEOS__) -# include <geos.h> -#elif defined(__LUNIX__) -# include <lunix.h> -#elif defined(__LYNX__) -# include <lynx.h> -#elif defined(__NES__) -# include <nes.h> -#elif defined(__OSIC1P__) -# include <osic1p.h> -#elif defined(__PCE__) -# include <pce.h> -#endif +#include <stdarg.h> +#include <target.h> @@ -232,16 +200,16 @@ void __fastcall__ cputhex16 (unsigned val); ** the macro will give access to the actual function. */ -#if defined(_textcolor) +#ifdef _textcolor # define textcolor(x) _textcolor(x) #endif -#if defined(_bgcolor) +#ifdef _bgcolor # define bgcolor(x) _bgcolor(x) #endif -#if defined(_bordercolor) +#ifdef _bordercolor # define bordercolor(x) _bordercolor(x) #endif -#if defined(_cpeekcolor) +#ifdef _cpeekcolor # define cpeekcolor(x) _cpeekcolor(x) #endif diff --git a/include/joystick.h b/include/joystick.h index 26f339fe4..b6771c381 100644 --- a/include/joystick.h +++ b/include/joystick.h @@ -38,6 +38,10 @@ +#include <target.h> + + + /*****************************************************************************/ /* Definitions */ /*****************************************************************************/ @@ -103,6 +107,3 @@ unsigned char __fastcall__ joy_read (unsigned char joystick); /* End of joystick.h */ #endif - - - diff --git a/include/target.h b/include/target.h new file mode 100644 index 000000000..af401ec35 --- /dev/null +++ b/include/target.h @@ -0,0 +1,73 @@ +/*****************************************************************************/ +/* */ +/* target.h */ +/* */ +/* Target specific definitions */ +/* */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ +/* warranty. In no event will the authors be held liable for any damages */ +/* arising from the use of this software. */ +/* */ +/* Permission is granted to anyone to use this software for any purpose, */ +/* including commercial applications, and to alter it and redistribute it */ +/* freely, subject to the following restrictions: */ +/* */ +/* 1. The origin of this software must not be misrepresented; you must not */ +/* claim that you wrote the original software. If you use this software */ +/* in a product, an acknowledgment in the product documentation would be */ +/* appreciated but is not required. */ +/* 2. Altered source versions must be plainly marked as such, and must not */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ +/*****************************************************************************/ + + + +#ifndef _TARGET_H +#define _TARGET_H + + + +/* Include the correct target specific file */ +#if defined(__APPLE2ENH__) +# include <apple2enh.h> +#elif defined(__APPLE2__) +# include <apple2.h> +#elif defined(__ATARI__) +# include <atari.h> +#elif defined(__ATARI2600__) +# include <atari2600.h> +#elif defined(__ATARI5200__) +# include <atari5200.h> +#elif defined(__ATMOS__) +# include <atmos.h> +#elif defined(__CBM__) +# include <cbm.h> +#elif defined(__CREATIVISION__) +# include <creativision.h> +#elif defined(__GAMATE__) +# include <gamate.h> +#elif defined(__GEOS__) +# include <geos.h> +#elif defined(__LYNX__) +# include <lynx.h> +#elif defined(__NES__) +# include <nes.h> +#elif defined(__OSIC1P__) +# include <osic1p.h> +#elif defined(__PCE__) +# include <pce.h> +#elif defined(__SUPERVISION__) +# include <supervision.h> +#elif defined(__TELESTRAT__) +# include <telestrat.h> +#endif + + + +/* End of target.h */ +#endif diff --git a/include/tgi.h b/include/tgi.h index 02dff8868..f458180c5 100644 --- a/include/tgi.h +++ b/include/tgi.h @@ -38,9 +38,8 @@ -#ifndef _TGI_ERROR_H #include <tgi/tgi-error.h> -#endif +#include <target.h> @@ -284,6 +283,3 @@ int __fastcall__ tgi_imulround (int rhs, int lhs); /* End of tgi.h */ #endif - - - From 7521ae888a5a0f40273d554fb06355fc3572f57d Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Fri, 2 Feb 2018 14:46:57 +0100 Subject: [PATCH 133/254] Marked Apple II EXEHDR segment as optional. The docs say "Use -D __EXEHDR__=0 to omit the header." so it should work without generating a linker warning. --- cfg/apple2-hgr.cfg | 2 +- cfg/apple2-overlay.cfg | 2 +- cfg/apple2.cfg | 2 +- cfg/apple2enh-hgr.cfg | 2 +- cfg/apple2enh-overlay.cfg | 2 +- cfg/apple2enh.cfg | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cfg/apple2-hgr.cfg b/cfg/apple2-hgr.cfg index 536491c67..b11dd12bc 100644 --- a/cfg/apple2-hgr.cfg +++ b/cfg/apple2-hgr.cfg @@ -19,7 +19,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; HGR: load = MAIN, type = rw, optional = yes, start = $2000; diff --git a/cfg/apple2-overlay.cfg b/cfg/apple2-overlay.cfg index e6a5ae25c..d5476d264 100644 --- a/cfg/apple2-overlay.cfg +++ b/cfg/apple2-overlay.cfg @@ -36,7 +36,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro, define = yes; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; diff --git a/cfg/apple2.cfg b/cfg/apple2.cfg index eba2a0e66..bbe45839d 100644 --- a/cfg/apple2.cfg +++ b/cfg/apple2.cfg @@ -19,7 +19,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; diff --git a/cfg/apple2enh-hgr.cfg b/cfg/apple2enh-hgr.cfg index 536491c67..b11dd12bc 100644 --- a/cfg/apple2enh-hgr.cfg +++ b/cfg/apple2enh-hgr.cfg @@ -19,7 +19,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; HGR: load = MAIN, type = rw, optional = yes, start = $2000; diff --git a/cfg/apple2enh-overlay.cfg b/cfg/apple2enh-overlay.cfg index e6a5ae25c..d5476d264 100644 --- a/cfg/apple2enh-overlay.cfg +++ b/cfg/apple2enh-overlay.cfg @@ -36,7 +36,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro, define = yes; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; diff --git a/cfg/apple2enh.cfg b/cfg/apple2enh.cfg index eba2a0e66..bbe45839d 100644 --- a/cfg/apple2enh.cfg +++ b/cfg/apple2enh.cfg @@ -19,7 +19,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; From dacee3b9edd1167a050add3dc5be4e661d1d877c Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Fri, 2 Feb 2018 18:15:45 +0100 Subject: [PATCH 134/254] Removed IRQ support from TGI drivers. All but one TGI drivers didn't use IRQs. Especially when the TGI driver kernel was the only .interruptor this meant quite some unnecessary overhead because it pulled in the whole IRQ infrastructure. The one driver using IRQs (the graphics driver for the 160x102x16 mode on the Lynx) now uses a library reference to set up a JMP to its IRQ handler. --- asminc/tgi-kernel.inc | 3 +-- libsrc/apple2/tgi/a2.hi.s | 1 - libsrc/apple2/tgi/a2.lo.s | 1 - libsrc/atari/tgi/atari_tgi_common.inc | 1 - libsrc/atmos/tgi/atmos-228-200-3.s | 1 - libsrc/atmos/tgi/atmos-240-200-2.s | 1 - libsrc/c128/tgi/c128-vdc.s | 1 - libsrc/c128/tgi/c128-vdc2.s | 1 - libsrc/c64/tgi/c64-hi.s | 1 - libsrc/geos-cbm/tgi/geos-tgi.s | 1 - libsrc/lynx/libref.s | 3 +-- libsrc/lynx/tgi/lynx-160-102-16.s | 30 +++++++++++++++------- libsrc/lynx/tgi_irq.s | 11 ++++++++ libsrc/nes/tgi/nes-64-56-2.s | 1 - libsrc/telestrat/tgi/telestrat-228-200-3.s | 1 - libsrc/telestrat/tgi/telestrat-240-200-2.s | 1 - libsrc/tgi/tgi-kernel.s | 18 +++---------- 17 files changed, 37 insertions(+), 40 deletions(-) create mode 100644 libsrc/lynx/tgi_irq.s diff --git a/asminc/tgi-kernel.inc b/asminc/tgi-kernel.inc index e9f2f6aa9..fba78afff 100644 --- a/asminc/tgi-kernel.inc +++ b/asminc/tgi-kernel.inc @@ -70,14 +70,13 @@ BAR .addr ; BAR routine TEXTSTYLE .addr ; TEXTSTYLE routine OUTTEXT .addr ; OUTTEXT routine - IRQ .addr ; IRQ routine .endstruct .endstruct ;------------------------------------------------------------------------------ ; The TGI API version, stored at TGI_HDR_VERSION -TGI_API_VERSION = $05 +TGI_API_VERSION = $06 ;------------------------------------------------------------------------------ ; Bitmapped tgi driver flags, stored in TGI_HDR::VARS::FLAGS. diff --git a/libsrc/apple2/tgi/a2.hi.s b/libsrc/apple2/tgi/a2.hi.s index 18f5724b5..e06b4a617 100644 --- a/libsrc/apple2/tgi/a2.hi.s +++ b/libsrc/apple2/tgi/a2.hi.s @@ -115,7 +115,6 @@ pages: .byte 2 ; Number of screens available .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ diff --git a/libsrc/apple2/tgi/a2.lo.s b/libsrc/apple2/tgi/a2.lo.s index 045b0044f..7238463a9 100644 --- a/libsrc/apple2/tgi/a2.lo.s +++ b/libsrc/apple2/tgi/a2.lo.s @@ -85,7 +85,6 @@ Y2 := ptr4 .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ diff --git a/libsrc/atari/tgi/atari_tgi_common.inc b/libsrc/atari/tgi/atari_tgi_common.inc index f4ef68165..cd486d91b 100644 --- a/libsrc/atari/tgi/atari_tgi_common.inc +++ b/libsrc/atari/tgi/atari_tgi_common.inc @@ -68,7 +68,6 @@ libref: .addr $0000 ; Library reference .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ****************************************************************************** diff --git a/libsrc/atmos/tgi/atmos-228-200-3.s b/libsrc/atmos/tgi/atmos-228-200-3.s index ae9b0f775..98d2cef96 100644 --- a/libsrc/atmos/tgi/atmos-228-200-3.s +++ b/libsrc/atmos/tgi/atmos-228-200-3.s @@ -59,7 +59,6 @@ YSIZE = 8 ; System font height .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/atmos/tgi/atmos-240-200-2.s b/libsrc/atmos/tgi/atmos-240-200-2.s index 943ec5389..2643e08fd 100644 --- a/libsrc/atmos/tgi/atmos-240-200-2.s +++ b/libsrc/atmos/tgi/atmos-240-200-2.s @@ -59,7 +59,6 @@ YSIZE = 8 ; System font height .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/c128/tgi/c128-vdc.s b/libsrc/c128/tgi/c128-vdc.s index 5100f7f7d..f48b530f6 100644 --- a/libsrc/c128/tgi/c128-vdc.s +++ b/libsrc/c128/tgi/c128-vdc.s @@ -88,7 +88,6 @@ pages: .byte 1 ; Number of screens available .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/c128/tgi/c128-vdc2.s b/libsrc/c128/tgi/c128-vdc2.s index a7238e877..4b7b17c57 100644 --- a/libsrc/c128/tgi/c128-vdc2.s +++ b/libsrc/c128/tgi/c128-vdc2.s @@ -89,7 +89,6 @@ pages: .byte 0 ; Number of screens available .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/c64/tgi/c64-hi.s b/libsrc/c64/tgi/c64-hi.s index 580220ecc..8368c6ba2 100644 --- a/libsrc/c64/tgi/c64-hi.s +++ b/libsrc/c64/tgi/c64-hi.s @@ -57,7 +57,6 @@ .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/geos-cbm/tgi/geos-tgi.s b/libsrc/geos-cbm/tgi/geos-tgi.s index 5a1af65e4..08927e6c1 100644 --- a/libsrc/geos-cbm/tgi/geos-tgi.s +++ b/libsrc/geos-cbm/tgi/geos-tgi.s @@ -74,7 +74,6 @@ aspect: .word $00D4 ; Aspect ratio (based on 4/3 display) .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/lynx/libref.s b/libsrc/lynx/libref.s index 62c78b8c5..0bda1e7e8 100644 --- a/libsrc/lynx/libref.s +++ b/libsrc/lynx/libref.s @@ -2,9 +2,8 @@ ; Oliver Schmidt, 2013-05-31 ; - .export joy_libref, ser_libref, tgi_libref + .export joy_libref, ser_libref .import _exit joy_libref := _exit ser_libref := _exit -tgi_libref := _exit diff --git a/libsrc/lynx/tgi/lynx-160-102-16.s b/libsrc/lynx/tgi/lynx-160-102-16.s index e6659631b..04bdaae04 100644 --- a/libsrc/lynx/tgi/lynx-160-102-16.s +++ b/libsrc/lynx/tgi/lynx-160-102-16.s @@ -29,7 +29,7 @@ .byte $74, $67, $69 ; "tgi" .byte TGI_API_VERSION ; TGI API version number - .addr $0000 ; Library reference +libref: .addr $0000 ; Library reference .word 160 ; X resolution .word 102 ; Y resolution .byte 16 ; Number of drawing colors @@ -64,7 +64,6 @@ .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr IRQ ; ------------------------------------------------------------------------ @@ -164,6 +163,18 @@ INSTALL: stz BGINDEX stz DRAWPAGE stz SWAPREQUEST + lda libref + ldx libref+1 + sta ptr1 + stx ptr1+1 + ldy #1 + lda #<irq + sta (ptr1),y + iny + lda #>irq + sta (ptr1),y + lda #$4C ; Jump opcode + sta (ptr1) ; Activate IRQ routine rts @@ -175,6 +186,12 @@ INSTALL: ; UNINSTALL: + lda libref + ldx libref+1 + sta ptr1 + stx ptr1+1 + lda #$60 ; RTS opcode + sta (ptr1) ; Disable IRQ routine rts @@ -466,14 +483,10 @@ SETDRAWPAGE: stx DRAWPAGEH rts -; ------------------------------------------------------------------------ -; IRQ: VBL interrupt handler -; - -IRQ: +irq: lda INTSET ; Poll all pending interrupts and #VBL_INTERRUPT - beq IRQEND ; Exit if not a VBL interrupt + beq @L0 ; Exit if not a VBL interrupt lda SWAPREQUEST beq @L0 @@ -485,7 +498,6 @@ IRQ: jsr SETDRAWPAGE stz SWAPREQUEST @L0: -IRQEND: clc rts diff --git a/libsrc/lynx/tgi_irq.s b/libsrc/lynx/tgi_irq.s new file mode 100644 index 000000000..3968dc0b5 --- /dev/null +++ b/libsrc/lynx/tgi_irq.s @@ -0,0 +1,11 @@ +; +; Oliver Schmidt, 2018-02-02 +; + + .export tgi_libref + .interruptor tgi_irq ; Export as IRQ handler + + .data + +tgi_libref: +tgi_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes diff --git a/libsrc/nes/tgi/nes-64-56-2.s b/libsrc/nes/tgi/nes-64-56-2.s index 70e23e119..e4dcb56ce 100644 --- a/libsrc/nes/tgi/nes-64-56-2.s +++ b/libsrc/nes/tgi/nes-64-56-2.s @@ -60,7 +60,6 @@ yres: .word 56 ; Max Y resolution .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/telestrat/tgi/telestrat-228-200-3.s b/libsrc/telestrat/tgi/telestrat-228-200-3.s index 09c308e26..ce501f0bf 100644 --- a/libsrc/telestrat/tgi/telestrat-228-200-3.s +++ b/libsrc/telestrat/tgi/telestrat-228-200-3.s @@ -58,7 +58,6 @@ YSIZE = 8 ; System font height .addr CIRCLE .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/telestrat/tgi/telestrat-240-200-2.s b/libsrc/telestrat/tgi/telestrat-240-200-2.s index 8a30ddd45..3ee918c4f 100644 --- a/libsrc/telestrat/tgi/telestrat-240-200-2.s +++ b/libsrc/telestrat/tgi/telestrat-240-200-2.s @@ -58,7 +58,6 @@ YSIZE = 8 ; System font height .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/tgi/tgi-kernel.s b/libsrc/tgi/tgi-kernel.s index ed65760af..3a388b6dc 100644 --- a/libsrc/tgi/tgi-kernel.s +++ b/libsrc/tgi/tgi-kernel.s @@ -6,7 +6,6 @@ .import tgi_libref .importzp ptr1 - .interruptor tgi_irq ; Export as IRQ handler .include "tgi-kernel.inc" .include "tgi-error.inc" @@ -81,7 +80,6 @@ tgi_line: jmp $0000 tgi_bar: jmp $0000 tgi_textstyle: jmp $0000 tgi_outtext: jmp $0000 -tgi_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes ; Driver header signature .rodata @@ -144,20 +142,13 @@ _tgi_install: dex bpl @L3 -; Install the IRQ vector if the driver needs it. - - lda tgi_irq+2 ; Check high byte of IRQ vector - beq @L4 ; Jump if vector invalid - lda #$4C ; Jump opcode - sta tgi_irq ; Activate IRQ routine - ; Initialize some other variables lda #$00 -@L4: ldx #csize-1 -@L5: sta cstart,x ; Clear error/mode/curx/cury/... + ldx #csize-1 +@L4: sta cstart,x ; Clear error/mode/curx/cury/... dex - bpl @L5 + bpl @L4 rts @@ -206,9 +197,6 @@ _tgi_uninstall: jsr tgi_uninstall ; Allow the driver to clean up - lda #$60 ; RTS opcode - sta tgi_irq ; Disable IRQ entry point - ; Clear driver pointer and error code tgi_clear_ptr: From ae4e9fab8c1156a15b6db2250ad23356f1909611 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Fri, 2 Feb 2018 18:28:52 +0100 Subject: [PATCH 135/254] Atari: CONSOL port of GTIA is readable and writable. Adjust include/_gtia.h accordingly. --- include/_gtia.h | 108 ++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/include/_gtia.h b/include/_gtia.h index 424628f19..0542efa2f 100644 --- a/include/_gtia.h +++ b/include/_gtia.h @@ -34,63 +34,65 @@ /* Define a structure with the gtia register offsets */ struct __gtia_write { - unsigned char hposp0; /* horizontal position player 0 */ - unsigned char hposp1; /* horizontal position player 1 */ - unsigned char hposp2; /* horizontal position player 2 */ - unsigned char hposp3; /* horizontal position player 3 */ - unsigned char hposm0; /* horizontal position missile 0 */ - unsigned char hposm1; /* horizontal position missile 1 */ - unsigned char hposm2; /* horizontal position missile 2 */ - unsigned char hposm3; /* horizontal position missile 3 */ - unsigned char sizep0; /* size of player 0 */ - unsigned char sizep1; /* size of player 1 */ - unsigned char sizep2; /* size of player 2 */ - unsigned char sizep3; /* size of player 3 */ - unsigned char sizem; /* size of missiles */ - unsigned char grafp0; /* graphics shape player 0 */ - unsigned char grafp1; /* graphics shape player 1 */ - unsigned char grafp2; /* graphics shape player 2 */ - unsigned char grafp3; /* graphics shape player 3 */ - unsigned char grafm; /* graphics shape missiles */ - unsigned char colpm0; /* color player and missile 0 */ - unsigned char colpm1; /* color player and missile 1 */ - unsigned char colpm2; /* color player and missile 2 */ - unsigned char colpm3; /* color player and missile 3 */ - unsigned char colpf0; /* color playfield 0 */ - unsigned char colpf1; /* color playfield 1 */ - unsigned char colpf2; /* color playfield 2 */ - unsigned char colpf3; /* color playfield 3 */ - unsigned char colbk; /* color background */ - unsigned char prior; /* priority selection */ - unsigned char vdelay; /* vertical delay */ - unsigned char gractl; /* stick/paddle latch, p/m control */ - unsigned char hitclr; /* clear p/m collision */ - unsigned char consol; /* console buttons */ + unsigned char hposp0; /* 0x00: horizontal position player 0 */ + unsigned char hposp1; /* 0x01: horizontal position player 1 */ + unsigned char hposp2; /* 0x02: horizontal position player 2 */ + unsigned char hposp3; /* 0x03: horizontal position player 3 */ + unsigned char hposm0; /* 0x04: horizontal position missile 0 */ + unsigned char hposm1; /* 0x05: horizontal position missile 1 */ + unsigned char hposm2; /* 0x06: horizontal position missile 2 */ + unsigned char hposm3; /* 0x07: horizontal position missile 3 */ + unsigned char sizep0; /* 0x08: size of player 0 */ + unsigned char sizep1; /* 0x09: size of player 1 */ + unsigned char sizep2; /* 0x0A: size of player 2 */ + unsigned char sizep3; /* 0x0B: size of player 3 */ + unsigned char sizem; /* 0x0C: size of missiles */ + unsigned char grafp0; /* 0x0D: graphics shape player 0 */ + unsigned char grafp1; /* 0x0E: graphics shape player 1 */ + unsigned char grafp2; /* 0x0F: graphics shape player 2 */ + unsigned char grafp3; /* 0x10: graphics shape player 3 */ + unsigned char grafm; /* 0x11: graphics shape missiles */ + unsigned char colpm0; /* 0x12: color player and missile 0 */ + unsigned char colpm1; /* 0x13: color player and missile 1 */ + unsigned char colpm2; /* 0x14: color player and missile 2 */ + unsigned char colpm3; /* 0x15: color player and missile 3 */ + unsigned char colpf0; /* 0x16: color playfield 0 */ + unsigned char colpf1; /* 0x17: color playfield 1 */ + unsigned char colpf2; /* 0x18: color playfield 2 */ + unsigned char colpf3; /* 0x19: color playfield 3 */ + unsigned char colbk; /* 0x1A: color background */ + unsigned char prior; /* 0x1B: priority selection */ + unsigned char vdelay; /* 0x1C: vertical delay */ + unsigned char gractl; /* 0x1D: stick/paddle latch, p/m control */ + unsigned char hitclr; /* 0x1E: clear p/m collision */ + unsigned char consol; /* 0x1F: builtin speaker */ }; /* Define a structure with the gtia register offsets */ struct __gtia_read { - unsigned char m0pf; /* missile 0 to playfield collision */ - unsigned char m1pf; /* missile 1 to playfield collision */ - unsigned char m2pf; /* missile 2 to playfield collision */ - unsigned char m3pf; /* missile 3 to playfield collision */ - unsigned char p0pf; /* player 0 to playfield collision */ - unsigned char p1pf; /* player 1 to playfield collision */ - unsigned char p2pf; /* player 2 to playfield collision */ - unsigned char p3pf; /* player 3 to playfield collision */ - unsigned char m0pl; /* missile 0 to player collision */ - unsigned char m1pl; /* missile 1 to player collision */ - unsigned char m2pl; /* missile 2 to player collision */ - unsigned char m3pl; /* missile 3 to player collision */ - unsigned char p0pl; /* player 0 to player collision */ - unsigned char p1pl; /* player 1 to player collision */ - unsigned char p2pl; /* player 2 to player collision */ - unsigned char p3pl; /* player 3 to player collision */ - unsigned char trig0; /* joystick trigger 0 */ - unsigned char trig1; /* joystick trigger 1 */ - unsigned char trig2; /* joystick trigger 2 */ - unsigned char trig3; /* joystick trigger 3 */ - unsigned char pal; /* pal/ntsc flag */ + unsigned char m0pf; /* 0x00: missile 0 to playfield collision */ + unsigned char m1pf; /* 0x01: missile 1 to playfield collision */ + unsigned char m2pf; /* 0x02: missile 2 to playfield collision */ + unsigned char m3pf; /* 0x03: missile 3 to playfield collision */ + unsigned char p0pf; /* 0x04: player 0 to playfield collision */ + unsigned char p1pf; /* 0x05: player 1 to playfield collision */ + unsigned char p2pf; /* 0x06: player 2 to playfield collision */ + unsigned char p3pf; /* 0x07: player 3 to playfield collision */ + unsigned char m0pl; /* 0x08: missile 0 to player collision */ + unsigned char m1pl; /* 0x09: missile 1 to player collision */ + unsigned char m2pl; /* 0x0A: missile 2 to player collision */ + unsigned char m3pl; /* 0x0B: missile 3 to player collision */ + unsigned char p0pl; /* 0x0C: player 0 to player collision */ + unsigned char p1pl; /* 0x0D: player 1 to player collision */ + unsigned char p2pl; /* 0x0E: player 2 to player collision */ + unsigned char p3pl; /* 0x0F: player 3 to player collision */ + unsigned char trig0; /* 0x10: joystick trigger 0 */ + unsigned char trig1; /* 0x11: joystick trigger 1 */ + unsigned char trig2; /* 0x12: joystick trigger 2 */ + unsigned char trig3; /* 0x13: joystick trigger 3 */ + unsigned char pal; /* 0x14: pal/ntsc flag */ + unsigned char unused[10]; + unsigned char consol; /* 0x1F: console buttons */ }; /* End of _gtia.h */ From e9cbd42b18510e0de5c7f6c563a6eed643db33ff Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Tue, 6 Feb 2018 08:52:36 -0500 Subject: [PATCH 136/254] Normalized the definitions of structs in <supervision.h>. The change matches the way that I/O register structures are defined in other headers. The names are defined as "struct", instead of as "pointer to struct". --- include/supervision.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/supervision.h b/include/supervision.h index f3ae1c25e..cce037910 100644 --- a/include/supervision.h +++ b/include/supervision.h @@ -54,28 +54,28 @@ struct __sv_lcd { unsigned char xpos; unsigned char ypos; }; -#define SV_LCD ((struct __sv_lcd*)0x2000) +#define SV_LCD (*(struct __sv_lcd*)0x2000) struct __sv_tone { unsigned delay; unsigned char control; unsigned char timer; }; -#define SV_RIGHT ((struct __sv_tone*)0x2010) -#define SV_LEFT ((struct __sv_tone*)0x2014) +#define SV_RIGHT (*(struct __sv_tone*)0x2010) +#define SV_LEFT (*(struct __sv_tone*)0x2014) struct __sv_noise { unsigned char volume; /* and frequency */ unsigned char timer; unsigned char control; }; -#define SV_NOISE ((struct __sv_noise*)0x2028) +#define SV_NOISE (*(struct __sv_noise*)0x2028) struct __io_port { unsigned char in; unsigned char out; }; -#define IO_PORT ((struct __io_port*)(0x2021) +#define IO_PORT (*(struct __io_port*)0x2021) struct __sv_dma { unsigned start; @@ -83,7 +83,7 @@ struct __sv_dma { unsigned char control; unsigned char on; }; -#define SV_DMA ((struct __sv_dma*)0x2018) +#define SV_DMA (*(struct __sv_dma*)0x2018) #define SV_CONTROL (*(unsigned char*)0x2020) From a227089ba1b71edf2fc46080faea3fc8fa0e3a2d Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 7 Feb 2018 00:11:55 +0100 Subject: [PATCH 137/254] Added missing documentation of header --- doc/funcref.sgml | 185 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 177 insertions(+), 8 deletions(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 15830b2a2..7a7bdb1ee 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -4,7 +4,7 @@ <title>cc65 function reference <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> -<date>2017-12-09 +<date>2018-02-06 <abstract> cc65 is a C compiler for 6502 based systems. This function reference describes @@ -293,6 +293,16 @@ function. (incomplete) +<sect1><tt/device.h/<label id="device.h"><p> + +<itemize> +<item><ref id="getcurrentdevice" name="getcurrentdevice"> +<item><ref id="getdevicedir" name="getdevicedir"> +<item><ref id="getfirstdevice" name="getfirstdevice"> +<item><ref id="getnextdevice" name="getnextdevice"> +</itemize> + + <sect1><tt/dio.h/<label id="dio.h"><p> <url url="dio.html" name="Low-level disk I/O API">. @@ -313,8 +323,6 @@ function. <item><ref id="telldir" name="telldir"> </itemize> -(incomplete) - <sect1><tt/em.h/<label id="em.h"><p> @@ -661,9 +669,11 @@ communication. <item><ref id="strlen" name="strlen"> <item><ref id="strlower" name="strlower"> <item><ref id="strlwr" name="strlwr"> +<item><ref id="strncasecmp" name="strncasecmp"> <item><ref id="strncat" name="strncat"> <item><ref id="strncmp" name="strncmp"> <item><ref id="strncpy" name="strncpy"> +<item><ref id="strnicmp" name="strnicmp"> <item><ref id="strqtok" name="strqtok"> <item><ref id="strrchr" name="strrchr"> <item><ref id="strspn" name="strspn"> @@ -674,8 +684,6 @@ communication. <item><ref id="strupr" name="strupr"> </itemize> -(incomplete) - <sect1><tt/telestrat.h/<label id="telestrat.h"><p> @@ -2930,9 +2938,9 @@ exits. <tag/Availability/cc65 <tag/Example/<verb> /* Hello World */ -#include <stdio.h> -#include <unistd.h> -#include <cc65.h> +#include <stdio.h> +#include <unistd.h> +#include <cc65.h> int main(void) { printf("Hello World\n"); @@ -3450,6 +3458,111 @@ returns one of the constants<itemize> </quote> +<sect1>getcurrentdevice<label id="getcurrentdevice"><p> + +<quote> +<descrip> +<tag/Function/Get current device. +<tag/Header/<tt/<ref id="device.h" name="device.h">/ +<tag/Declaration/<tt/unsigned char getcurrentdevice (void);/ +<tag/Description/The function returns the current device. +<tag/Notes/<itemize> +<item> +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="getdevicedir" name="getdevicedir">, +<ref id="getfirstdevice" name="getfirstdevice">, +<ref id="getnextdevice" name="getnextdevice"> +<tag/Example/<verb> +puts (getdevicedir (getcurrentdevice (), buf, sizeof buf)); +</verb> +</descrip> +</quote> + + +<sect1>getdevicedir<label id="getdevicedir"><p> + +<quote> +<descrip> +<tag/Function/Get device directory. +<tag/Header/<tt/<ref id="device.h" name="device.h">/ +<tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/ +<tag/Description/The function returns the current directory of <tt/device/. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="getcwd" name="getcwd">, +<ref id="getcurrentdevice" name="getcurrentdevice">, +<ref id="getfirstdevice" name="getfirstdevice">, +<ref id="getnextdevice" name="getnextdevice"> +<tag/Example/<verb> +puts (getdevicedir (getcurrentdevice (), buf, sizeof buf)); +</verb> +</descrip> +</quote> + + +<sect1>getfirstdevice<label id="getfirstdevice"><p> + +<quote> +<descrip> +<tag/Function/Get first device. +<tag/Header/<tt/<ref id="device.h" name="device.h">/ +<tag/Declaration/<tt/unsigned char getfirstdevice (void);/ +<tag/Description/The function returns the first device. +The value 255 indicates no device. +<tag/Notes/<itemize> +<item> +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="getcurrentdevice" name="getcurrentdevice">, +<ref id="getdevicedir" name="getdevicedir">, +<ref id="getnextdevice" name="getnextdevice"> +<tag/Example/<verb> +unsigned char dev = getfirstdevice (); +while (dev != 255) { + printf ("%d\n", dev); + dev = getnextdevice (dev); + } +</verb> +</descrip> +</quote> + + +<sect1>getnextdevice<label id="getnextdevice"><p> + +<quote> +<descrip> +<tag/Function/Get next device. +<tag/Header/<tt/<ref id="device.h" name="device.h">/ +<tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/ +<tag/Description/The function returns the next device after <tt/device/. +The value 255 indicates no further device. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="getcurrentdevice" name="getcurrentdevice">, +<ref id="getdevicedir" name="getdevicedir">, +<ref id="getfirstdevice" name="getfirstdevice"> +<tag/Example/<verb> +unsigned char dev = getfirstdevice (); +while (dev != 255) { + printf ("%d\n", dev); + dev = getnextdevice (dev); + } +</verb> +</descrip> +</quote> + + <sect1>getenv<label id="getenv"><p> <quote> @@ -6284,6 +6397,34 @@ See <tt/strlower/. </quote> +<sect1>strncasecmp<label id="strncasecmp"><p> + +<quote> +<descrip> +<tag/Function/Compare two strings case insensitive. +<tag/Header/<tt/<ref id="string.h" name="string.h">/ +<tag/Declaration/<tt/int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count);/ +<tag/Description/The <tt/strncasecmp/ function compares the two strings passed +as parameters without case sensitivity. It returns a value that is less than +zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, +and a value greater than zero if <tt/s1/ is greater than <tt/s2/. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +<item>The function is not available in strict ANSI mode. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="strcmp" name="strcmp">, +<ref id="strcoll" name="strcoll">, +<ref id="stricmp" name="stricmp">, +<ref id="strncmp" name="strncmp">, +<ref id="strxfrm" name="strxfrm"> +<tag/Example/None. +</descrip> +</quote> + + <sect1>strncat<label id="strncat"><p> <quote> @@ -6377,6 +6518,34 @@ strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0'; </quote> +<sect1>strnicmp<label id="strnicmp"><p> + +<quote> +<descrip> +<tag/Function/Compare two strings case insensitive. +<tag/Header/<tt/<ref id="string.h" name="string.h">/ +<tag/Declaration/<tt/int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count);/ +<tag/Description/The <tt/strnicmp/ function compares the two strings passed as +parameters without case sensitivity. It returns a value that is less than zero +if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a +value greater than zero if <tt/s1/ is greater than <tt/s2/. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +<item>The function is not available in strict ANSI mode. +</itemize> +<tag/Availability/cc65 +<tag/See also/ +<ref id="strcasecmp" name="strcasecmp">, +<ref id="strcmp" name="strcmp">, +<ref id="strcoll" name="strcoll">, +<ref id="strncmp" name="strncmp">, +<ref id="strxfrm" name="strxfrm"> +<tag/Example/None. +</descrip> +</quote> + + <sect1>strqtok<label id="strqtok"><p> <quote> From a48f998162aa6d2c3134821de00c2c1c72dc5e11 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 7 Feb 2018 01:55:56 +0100 Subject: [PATCH 138/254] Added missing function --- doc/funcref.sgml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 7a7bdb1ee..a442f5e08 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -4,7 +4,7 @@ <title>cc65 function reference <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> -<date>2018-02-06 +<date>2018-02-07 <abstract> cc65 is a C compiler for 6502 based systems. This function reference describes @@ -726,7 +726,7 @@ communication. <itemize> <!-- <item><ref id="chdir" name="chdir"> --> <item><ref id="exec" name="exec"> -<!-- <item><ref id="getcwd" name="getcwd"> --> +<item><ref id="getcwd" name="getcwd"> <item><ref id="getopt" name="getopt"> <!-- <item><ref id="lseek" name="lseek"> --> <!-- <item><ref id="mkdir" name="mkdir"> --> @@ -3481,6 +3481,24 @@ puts (getdevicedir (getcurrentdevice (), buf, sizeof buf)); </quote> +<sect1>getcwd<label id="getcwd"><p> + +<quote> +<descrip> +<tag/Function/Get current working directory. +<tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/ +<tag/Declaration/<tt/char* __fastcall__ getcwd (char* buf, size_t size);/ +<tag/Description/The function will return the current working directory. +<tag/Notes/<itemize> +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/POSIX 1003.1 +<tag/Example/None. +</descrip> +</quote> + + <sect1>getdevicedir<label id="getdevicedir"><p> <quote> From b69ee802fde17ea8126144dbab9f5cc51dca42a4 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 7 Feb 2018 03:07:30 +0100 Subject: [PATCH 139/254] Sorted --- doc/funcref.sgml | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index a442f5e08..83fc36a6b 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -3524,6 +3524,29 @@ puts (getdevicedir (getcurrentdevice (), buf, sizeof buf)); </quote> +<sect1>getenv<label id="getenv"><p> + +<quote> +<descrip> +<tag/Function/Return a value from the environment. +<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/ +<tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/ +<tag/Description/The function searches the environment for an entry that +matches <tt/name/ and returns its value. The environment consists of a list +of strings in the form <tt/name=value/. If there is no match, <tt/getenv/ +returns <tt/NULL/. +<tag/Notes/<itemize> +<item>What exactly is stored in the environment depends on the machine the +program is running on. +<item>The function is only available as fastcall function, so it may only +be used in presence of a prototype. +</itemize> +<tag/Availability/ISO 9899 +<tag/Example/None. +</descrip> +</quote> + + <sect1>getfirstdevice<label id="getfirstdevice"><p> <quote> @@ -3581,29 +3604,6 @@ while (dev != 255) { </quote> -<sect1>getenv<label id="getenv"><p> - -<quote> -<descrip> -<tag/Function/Return a value from the environment. -<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/ -<tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/ -<tag/Description/The function searches the environment for an entry that -matches <tt/name/ and returns its value. The environment consists of a list -of strings in the form <tt/name=value/. If there is no match, <tt/getenv/ -returns <tt/NULL/. -<tag/Notes/<itemize> -<item>What exactly is stored in the environment depends on the machine the -program is running on. -<item>The function is only available as fastcall function, so it may only -be used in presence of a prototype. -</itemize> -<tag/Availability/ISO 9899 -<tag/Example/None. -</descrip> -</quote> - - <sect1>getopt<label id="getopt"><p> <quote> From 4d7098f2f223934ab50787c2e7923e16d160c4b8 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 7 Feb 2018 16:23:49 +0100 Subject: [PATCH 140/254] Requested changes --- doc/funcref.sgml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 83fc36a6b..c083f467e 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -3466,6 +3466,9 @@ returns one of the constants<itemize> <tag/Header/<tt/<ref id="device.h" name="device.h">/ <tag/Declaration/<tt/unsigned char getcurrentdevice (void);/ <tag/Description/The function returns the current device. +It allows to access the current device with the <ref id="dio.h" +name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O +functions"> requiring a 'device' parameter. <tag/Notes/<itemize> <item> </itemize> @@ -3475,7 +3478,7 @@ returns one of the constants<itemize> <ref id="getfirstdevice" name="getfirstdevice">, <ref id="getnextdevice" name="getnextdevice"> <tag/Example/<verb> -puts (getdevicedir (getcurrentdevice (), buf, sizeof buf)); +dio_open (getcurrentdevice ()); </verb> </descrip> </quote> @@ -3506,7 +3509,9 @@ be used in presence of a prototype. <tag/Function/Get device directory. <tag/Header/<tt/<ref id="device.h" name="device.h">/ <tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/ -<tag/Description/The function returns the current directory of <tt/device/. +<tag/Description/The function returns the directory representing <tt/device/. +It allows to access the device on filesystem level by calling chdir() with +the directory returned. <tag/Notes/<itemize> <item>The function is only available as fastcall function, so it may only be used in presence of a prototype. @@ -3518,7 +3523,7 @@ be used in presence of a prototype. <ref id="getfirstdevice" name="getfirstdevice">, <ref id="getnextdevice" name="getnextdevice"> <tag/Example/<verb> -puts (getdevicedir (getcurrentdevice (), buf, sizeof buf)); +chdir (getdevicedir (device, buf, sizeof buf)); </verb> </descrip> </quote> @@ -3555,7 +3560,7 @@ be used in presence of a prototype. <tag/Header/<tt/<ref id="device.h" name="device.h">/ <tag/Declaration/<tt/unsigned char getfirstdevice (void);/ <tag/Description/The function returns the first device. -The value 255 indicates no device. +The constant <tt/INVALID_DEVICE/ indicates no device. <tag/Notes/<itemize> <item> </itemize> @@ -3566,7 +3571,7 @@ The value 255 indicates no device. <ref id="getnextdevice" name="getnextdevice"> <tag/Example/<verb> unsigned char dev = getfirstdevice (); -while (dev != 255) { +while (dev != INVALID_DEVICE) { printf ("%d\n", dev); dev = getnextdevice (dev); } @@ -3583,7 +3588,7 @@ while (dev != 255) { <tag/Header/<tt/<ref id="device.h" name="device.h">/ <tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/ <tag/Description/The function returns the next device after <tt/device/. -The value 255 indicates no further device. +The constant <tt/INVALID_DEVICE/ indicates no further device. <tag/Notes/<itemize> <item>The function is only available as fastcall function, so it may only be used in presence of a prototype. @@ -3595,7 +3600,7 @@ be used in presence of a prototype. <ref id="getfirstdevice" name="getfirstdevice"> <tag/Example/<verb> unsigned char dev = getfirstdevice (); -while (dev != 255) { +while (dev != INVALID_DEVICE) { printf ("%d\n", dev); dev = getnextdevice (dev); } From 54f8dea29b8ef5398749845037c73ecb88905f11 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 7 Feb 2018 17:23:23 +0100 Subject: [PATCH 141/254] Added note --- doc/funcref.sgml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index c083f467e..90185a261 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -3513,6 +3513,8 @@ be used in presence of a prototype. It allows to access the device on filesystem level by calling chdir() with the directory returned. <tag/Notes/<itemize> +<item>Calling getdevicedir() <em/does/ check for a (formatted) disk in a +floppy-disk-type device and returns NULL if that check fails. <item>The function is only available as fastcall function, so it may only be used in presence of a prototype. </itemize> @@ -3525,6 +3527,7 @@ be used in presence of a prototype. <tag/Example/<verb> chdir (getdevicedir (device, buf, sizeof buf)); </verb> +cf. <tt/samples/enumdevdir.c/ </descrip> </quote> From 46bdc016dbff1b4e8a10375f41a8f572b7b2934c Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 7 Feb 2018 18:08:40 +0100 Subject: [PATCH 142/254] Removed empty notes --- doc/funcref.sgml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 90185a261..c3d8f9869 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -3469,9 +3469,6 @@ returns one of the constants<itemize> It allows to access the current device with the <ref id="dio.h" name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O functions"> requiring a 'device' parameter. -<tag/Notes/<itemize> -<item> -</itemize> <tag/Availability/cc65 <tag/See also/ <ref id="getdevicedir" name="getdevicedir">, @@ -3564,9 +3561,6 @@ be used in presence of a prototype. <tag/Declaration/<tt/unsigned char getfirstdevice (void);/ <tag/Description/The function returns the first device. The constant <tt/INVALID_DEVICE/ indicates no device. -<tag/Notes/<itemize> -<item> -</itemize> <tag/Availability/cc65 <tag/See also/ <ref id="getcurrentdevice" name="getcurrentdevice">, From 89799cd02eb950e89e757b2db66b972b5be4a003 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Sat, 10 Feb 2018 00:08:28 +0100 Subject: [PATCH 143/254] More notes --- doc/funcref.sgml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index c3d8f9869..bbab694fa 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -3561,6 +3561,10 @@ be used in presence of a prototype. <tag/Declaration/<tt/unsigned char getfirstdevice (void);/ <tag/Description/The function returns the first device. The constant <tt/INVALID_DEVICE/ indicates no device. +<tag/Notes/<itemize> +<item>Calling getfirstdevice() does <em/not/ turn on the motor of a +drive-type device and does <em/not/ check for a disk in the drive. +</itemize> <tag/Availability/cc65 <tag/See also/ <ref id="getcurrentdevice" name="getcurrentdevice">, @@ -3587,6 +3591,8 @@ while (dev != INVALID_DEVICE) { <tag/Description/The function returns the next device after <tt/device/. The constant <tt/INVALID_DEVICE/ indicates no further device. <tag/Notes/<itemize> +<item>Calling getnextdevice() does <em/not/ turn on the motor of a +drive-type device and does <em/not/ check for a disk in the drive. <item>The function is only available as fastcall function, so it may only be used in presence of a prototype. </itemize> From b65981fc3a0d4a7903c9b2800b03959c9f368b89 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Sat, 10 Feb 2018 11:29:50 +0100 Subject: [PATCH 144/254] Reduced default stack size to a reasonable value. The unexpanded Creativision has only $206 bytes of RAM available to cc65 programs. So it's a bad idea(tm) to reserve $180 bytes for the software stack. $40 bytes seems a much better default (aka guess). --- cfg/creativision.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg/creativision.cfg b/cfg/creativision.cfg index 289984df0..2eb9ac427 100644 --- a/cfg/creativision.cfg +++ b/cfg/creativision.cfg @@ -1,5 +1,5 @@ SYMBOLS { - __STACKSIZE__: type = weak, value = $0180; + __STACKSIZE__: type = weak, value = $0040; } MEMORY { ZP: file = "", define = yes, start = $0020, size = $00E0; From 6f6fd33caef12e2ecd14d5e15fb200f6cda47529 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Sat, 10 Feb 2018 11:45:50 +0100 Subject: [PATCH 145/254] Added size_t. --- include/device.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/device.h b/include/device.h index 68b1c807a..b0a5f5e76 100644 --- a/include/device.h +++ b/include/device.h @@ -35,6 +35,13 @@ +#ifndef _HAVE_size_t +typedef unsigned size_t; +#define _HAVE_size_t +#endif + + + /*****************************************************************************/ /* Data */ /*****************************************************************************/ From 33f05d1162d987b653ce03f0edf427c779ef1a53 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Sat, 10 Feb 2018 16:14:53 -0500 Subject: [PATCH 146/254] Added a definition for the CBM610's first CIA chip. --- include/cbm610.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/cbm610.h b/include/cbm610.h index b0486044b..de7aa50f8 100644 --- a/include/cbm610.h +++ b/include/cbm610.h @@ -85,7 +85,8 @@ #define SID (*(struct __sid*)0xDA00) #include <_6526.h> -#define CIA (*(struct __6526*)0xDC00) +#define CIA1 (*(struct __6526*)0xDB00) +#define CIA2 (*(struct __6526*)0xDC00) #include <_6551.h> #define ACIA (*(struct __6551*)0xDD00) From d93f84f4bc079e9ea20542a492101bf4dc3730ec Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Tue, 13 Feb 2018 19:19:40 -0800 Subject: [PATCH 147/254] Improved GeOS version detection. --- include/geos/gsys.h | 2 + libsrc/geos-cbm/geossym2.inc | 2 + libsrc/geos-cbm/system/get_ostype.s | 18 ++++++++- samples/geos/geosver.c | 58 +++++++++++++++++++++++++++++ samples/geos/geosverres.grc | 8 ++++ 5 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 samples/geos/geosver.c create mode 100644 samples/geos/geosverres.grc diff --git a/include/geos/gsys.h b/include/geos/gsys.h index 284c38b63..b60c9884b 100644 --- a/include/geos/gsys.h +++ b/include/geos/gsys.h @@ -31,6 +31,8 @@ char get_ostype(void); #define GEOS4 0x04 /* plus4 geos is not or'ed with version */ #define GEOS128 0x80 /* version flags */ +#define MEGAPATCH3 0x03 +#define GATEWAY 0x08 #define GEOS_V10 0x10 #define GEOS_V11 0x11 #define GEOS_V12 0x12 /* ??? not sure */ diff --git a/libsrc/geos-cbm/geossym2.inc b/libsrc/geos-cbm/geossym2.inc index cdcbc24dc..c756280a9 100644 --- a/libsrc/geos-cbm/geossym2.inc +++ b/libsrc/geos-cbm/geossym2.inc @@ -4,8 +4,10 @@ ;4-2-99 bootName = $c006 +gatewayFlag = $c007 version = $c00f nationality = $c010 sysFlgCopy = $c012 c128Flag = $c013 +mp3Flag = $c014 dateCopy = $c018 \ No newline at end of file diff --git a/libsrc/geos-cbm/system/get_ostype.s b/libsrc/geos-cbm/system/get_ostype.s index 492ce132d..827630f0b 100644 --- a/libsrc/geos-cbm/system/get_ostype.s +++ b/libsrc/geos-cbm/system/get_ostype.s @@ -3,8 +3,8 @@ ; ; 10.09.2001 ; -; Plus4 and GEOS 1.1 detection by -; Marco van den Heuvel, 2010-02-02 +; Plus4, Gateway, MP3 and GEOS 1.1 detection by +; Marco van den Heuvel, 2018-02-07 ; ; unsigned char get_ostype (void); @@ -26,6 +26,12 @@ _get_ostype: and #%11110000 cmp #$10 beq geos10 + lda gatewayFlag + cmp #$41 + beq gateway + lda mp3Flag + cmp #$4d + beq megapatch3 lda c128Flag ; we're on at least 2.0 cmp #$18 beq geos_on_plus4 @@ -40,6 +46,14 @@ geos11: geos_on_plus4: lda #$04 rts +gateway: + lda #$08 + ora c128Flag + rts +megapatch3: + lda #$03 + ora c128Flag + rts _get_tv: jsr _get_ostype diff --git a/samples/geos/geosver.c b/samples/geos/geosver.c new file mode 100644 index 000000000..673b7e1f7 --- /dev/null +++ b/samples/geos/geosver.c @@ -0,0 +1,58 @@ +#include <geos.h> +#include <conio.h> + +// Let's define the window we're operating +struct window wholeScreen = {0, SC_PIX_HEIGHT-1, 0, SC_PIX_WIDTH-1}; + + +void main (void) +{ + unsigned char os = get_ostype(); + unsigned char *machine = NULL; + unsigned char *version = NULL; + unsigned char good = 1; + + SetPattern(0); + InitDrawWindow(&wholeScreen); + Rectangle(); + gotoxy(0, 4); + if (os == GEOS4) { + machine = "plus4"; + version = "GeOS v3.5"; + } else { + if ((os & GEOS128) == GEOS128) { + machine = "c128"; + } else { + machine = "c64"; + } + os &= 0x7f; + if (os == GEOS_V10) { + version = "GeOS v1.0"; + } else if (os == GEOS_V11) { + version = "GeOS v1.1"; + } else if (os == GEOS_V12) { + version = "GeOS v1.2"; + } else if (os == GEOS_V20) { + version = "GeOS v2.0"; + } else if (os == MEGAPATCH3) { + version = "MegaPatch 3"; + } else if (os == GATEWAY) { + version = "GateWay"; + } else if ((os & WHEELS) == WHEELS) { + version = "Wheels"; + } else { + version = "Unknown GeOS version"; + good = 0; + } + } + + if (good) { + cprintf("%s (%s)", version, machine); + } else { + cprintf("%s (%s) (%d)", version, machine, os); + } + + Sleep(10*50); + + return; +} diff --git a/samples/geos/geosverres.grc b/samples/geos/geosverres.grc new file mode 100644 index 000000000..cac9ed698 --- /dev/null +++ b/samples/geos/geosverres.grc @@ -0,0 +1,8 @@ + +; this is the resource file for geosver.c, a GEOS application example + +HEADER APPLICATION "geosver" "GeOSver" "V1.0" { +dostype USR +author "Marco van den Heuvel" +info "This is a C prog compiled with cc65 and GEOSLib." +} From e17b9177dea44ed453a1ad77e0c9a2ea9569938d Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Wed, 14 Feb 2018 10:22:10 -0800 Subject: [PATCH 148/254] Fixed GeOS -> GEOS and added newline to geossym2.inc. --- libsrc/geos-cbm/geossym2.inc | 3 ++- samples/geos/geosver.c | 12 ++++++------ samples/geos/geosverres.grc | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/libsrc/geos-cbm/geossym2.inc b/libsrc/geos-cbm/geossym2.inc index c756280a9..02a2fd44b 100644 --- a/libsrc/geos-cbm/geossym2.inc +++ b/libsrc/geos-cbm/geossym2.inc @@ -10,4 +10,5 @@ nationality = $c010 sysFlgCopy = $c012 c128Flag = $c013 mp3Flag = $c014 -dateCopy = $c018 \ No newline at end of file +dateCopy = $c018 + diff --git a/samples/geos/geosver.c b/samples/geos/geosver.c index 673b7e1f7..77a15ada7 100644 --- a/samples/geos/geosver.c +++ b/samples/geos/geosver.c @@ -18,7 +18,7 @@ void main (void) gotoxy(0, 4); if (os == GEOS4) { machine = "plus4"; - version = "GeOS v3.5"; + version = "GEOS v3.5"; } else { if ((os & GEOS128) == GEOS128) { machine = "c128"; @@ -27,13 +27,13 @@ void main (void) } os &= 0x7f; if (os == GEOS_V10) { - version = "GeOS v1.0"; + version = "GEOS v1.0"; } else if (os == GEOS_V11) { - version = "GeOS v1.1"; + version = "GEOS v1.1"; } else if (os == GEOS_V12) { - version = "GeOS v1.2"; + version = "GEOS v1.2"; } else if (os == GEOS_V20) { - version = "GeOS v2.0"; + version = "GEOS v2.0"; } else if (os == MEGAPATCH3) { version = "MegaPatch 3"; } else if (os == GATEWAY) { @@ -41,7 +41,7 @@ void main (void) } else if ((os & WHEELS) == WHEELS) { version = "Wheels"; } else { - version = "Unknown GeOS version"; + version = "Unknown GEOS version"; good = 0; } } diff --git a/samples/geos/geosverres.grc b/samples/geos/geosverres.grc index cac9ed698..9a3d72a26 100644 --- a/samples/geos/geosverres.grc +++ b/samples/geos/geosverres.grc @@ -1,7 +1,7 @@ ; this is the resource file for geosver.c, a GEOS application example -HEADER APPLICATION "geosver" "GeOSver" "V1.0" { +HEADER APPLICATION "geosver" "GEOSver" "V1.0" { dostype USR author "Marco van den Heuvel" info "This is a C prog compiled with cc65 and GEOSLib." From b0ef67d14cf90c1ec12dea7f79f97884ea708981 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Thu, 15 Feb 2018 15:24:58 -0800 Subject: [PATCH 149/254] Added GEOS 1.3 and 1.5 detection. --- include/geos/gsys.h | 4 +++- libsrc/geos-cbm/system/get_ostype.s | 10 ++++++++++ samples/geos/geosver.c | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/geos/gsys.h b/include/geos/gsys.h index b60c9884b..1753492e5 100644 --- a/include/geos/gsys.h +++ b/include/geos/gsys.h @@ -35,7 +35,9 @@ char get_ostype(void); #define GATEWAY 0x08 #define GEOS_V10 0x10 #define GEOS_V11 0x11 -#define GEOS_V12 0x12 /* ??? not sure */ +#define GEOS_V12 0x12 +#define GEOS_V13 0x13 +#define GEOS_V15 0x15 #define GEOS_V20 0x20 #define WHEELS 0x40 /* only Wheels? */ diff --git a/libsrc/geos-cbm/system/get_ostype.s b/libsrc/geos-cbm/system/get_ostype.s index 827630f0b..6e6731952 100644 --- a/libsrc/geos-cbm/system/get_ostype.s +++ b/libsrc/geos-cbm/system/get_ostype.s @@ -26,6 +26,8 @@ _get_ostype: and #%11110000 cmp #$10 beq geos10 + cmp #$13 ; either 1.3 or 1.5 + beq geos13check lda gatewayFlag cmp #$41 beq gateway @@ -37,6 +39,7 @@ _get_ostype: beq geos_on_plus4 ora version rts +geos13: geos10: lda version rts @@ -54,6 +57,13 @@ megapatch3: lda #$03 ora c128Flag rts +geos13check: + lda mp3Flag + cmp #$03 + bne geos13 +geos15: + lda #$15 + rts _get_tv: jsr _get_ostype diff --git a/samples/geos/geosver.c b/samples/geos/geosver.c index 77a15ada7..1402d148e 100644 --- a/samples/geos/geosver.c +++ b/samples/geos/geosver.c @@ -32,6 +32,10 @@ void main (void) version = "GEOS v1.1"; } else if (os == GEOS_V12) { version = "GEOS v1.2"; + } else if (os == GEOS_V13) { + version = "GEOS v1.3"; + } else if (os == GEOS_V15) { + version = "GEOS v1.5"; } else if (os == GEOS_V20) { version = "GEOS v2.0"; } else if (os == MEGAPATCH3) { From 83890e56eb61933ee45985de368d5f80d56eab77 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Thu, 22 Feb 2018 13:30:50 +0100 Subject: [PATCH 150/254] Update dio.sgml --- doc/dio.sgml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/dio.sgml b/doc/dio.sgml index c85992a4a..39aac251c 100644 --- a/doc/dio.sgml +++ b/doc/dio.sgml @@ -25,8 +25,7 @@ released with the <tt>dio_close</tt> function. dhandle_t __fastcall__ dio_open (unsigned char device); </verb></tscreen> -The <tt>device</tt> specifies the device to access, with 0 being the first -device, 1 the second, and so on. +The <tt>device</tt> specifies the device to access. <tscreen><verb> unsigned char __fastcall__ dio_close (dhandle_t handle); From 3a0506ccb3582ea4677c000d9a4a581c46e3914f Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Fri, 23 Feb 2018 16:06:49 -0500 Subject: [PATCH 151/254] Changed the PC-Engine's configuration file, so that the command line can build 8K, 16K, and 32K carts. Adjusted the PCE's document, the start-up code, and the PCE library test makefile. That makefile shows how to post-process the linker's output file. --- cfg/pce.cfg | 43 +++++++++++-------------- doc/pce.sgml | 61 +++++++++++++++++++++++++---------- libsrc/pce/crt0.s | 68 +++++++++++++++++---------------------- testcode/lib/pce/Makefile | 25 +++++++++++--- testcode/lib/pce/conio.c | 2 +- 5 files changed, 115 insertions(+), 84 deletions(-) diff --git a/cfg/pce.cfg b/cfg/pce.cfg index 6332f8eff..77f8c5c97 100644 --- a/cfg/pce.cfg +++ b/cfg/pce.cfg @@ -1,34 +1,29 @@ -# linker config to produce simple NEC PC-Engine cartridge (.pce) - +# linker config. to produce a NEC PC-Engine 8K, 16K, or 32K image (.bin) SYMBOLS { + __CARTSIZE__: type = weak, value = $2000; # $2000, $4000, or $8000 __STACKSIZE__: type = weak, value = $0300; # 3 pages stack } - MEMORY { - # FIXME: is this correct? the first 3? bytes cant be used? - ZP: file = "", start = $0003, size = $00FD, type = rw, define = yes; - - # reset-bank and hardware vectors - ROM0: file = %O, start = $E000, size = $1FF6, fill = yes, define = yes; - ROMV: file = %O, start = $FFF6, size = $000A, fill = yes; - - # first RAM page (also contains stack and zeropage) - RAM: file = "", start = $2200, size = $1e00, define = yes; + ZP: file = "", start = $0000, size = $0100, define = yes; + # RAM bank + MAIN: file = "", start = $2200, size = $1E00 - __STACKSIZE__, define = yes; + # ROM banks, before swapping, and after mapping + ROM: file = %O, start = $10000 - __CARTSIZE__, size = __CARTSIZE__, fill = yes, fillval = $FF; } - SEGMENTS { - ZEROPAGE: load = ZP, type = zp, define = yes; - EXTZP: load = ZP, type = zp, define = yes, optional = yes; - APPZP: load = ZP, type = zp, define = yes, optional = yes; - STARTUP: load = ROM0, type = ro, define = yes; - ONCE: load = ROM0, type = ro, optional = yes; - CODE: load = ROM0, type = ro, define = yes; - RODATA: load = ROM0, type = ro, define = yes; - DATA: load = ROM0, run = RAM, type = rw, define = yes; - BSS: load = RAM, type = bss, define = yes; - VECTORS: load = ROMV, type = rw, define = yes; + ZEROPAGE: load = ZP, type = zp; + EXTZP: load = ZP, type = zp, optional = yes; + APPZP: load = ZP, type = zp, optional = yes; + DATA: load = ROM, run = MAIN, type = rw, define = yes; + INIT: load = MAIN, type = bss, optional = yes; + BSS: load = MAIN, type = bss, define = yes; + RODATA: load = ROM, type = ro; + CODE: load = ROM, type = ro; + LOWCODE: load = ROM, type = ro, optional = yes; + ONCE: load = ROM, type = ro, optional = yes; + STARTUP: load = ROM, type = ro, start = $FFF6 - $0066; + VECTORS: load = ROM, type = ro, start = $FFF6; } - FEATURES { CONDES: type = constructor, label = __CONSTRUCTOR_TABLE__, diff --git a/doc/pce.sgml b/doc/pce.sgml index 927df8f5c..bc7dcf5c8 100644 --- a/doc/pce.sgml +++ b/doc/pce.sgml @@ -3,9 +3,9 @@ <article> <title>PC-Engine (TurboGrafx) System specific information for cc65 -<author> -<url url="mailto:groepaz@gmx.net" name="Groepaz/Hitmen"> -<date>2016-09-29 +<author><url url="mailto:groepaz@gmx.net" name="Groepaz/Hitmen">,<newline> +<url url="mailto:greg.king5@verizon.net" name="Greg King"> +<date>2018-02-12 <abstract> An overview over the PCE runtime system as it is implemented for the @@ -30,11 +30,36 @@ more than one platform. Please see the function reference for more information. + <sect>Binary format<p> -The standard binary output format generated by the linker for the PCE target -is a cartridge image with no header. It is of course possible to change this -behaviour by using a modified startup file and linker config. +The binary output file generated by the linker, for the PCE target, is an +image, with no header, that has 8K bytes in the wrong place. That file must be +post-processed; the 8K at the end must be moved to the front of the image. + +On POSIX systems, the <tt/dd/ command and the shell give a convenient way to do +it. Here is an example of their use: +<tscreen><verb> +dd if=conio.bin bs=8K skip=3 > conio.pce +dd if=conio.bin bs=8K count=3 >> conio.pce +</verb></tscreen> +The first command grabs the last 8K of a 32K file, and writes it as the first +part of a new file. The second command reads all but the last part of the old +file, and appends it to the new file. +<tscreen><verb> ++--------+--------+--------+--------+ +| Bank 1 | Bank 2 | Bank 3 | Bank 0 | <-- "conio.bin" ++--------+--------+--------+--------+ + ++--------+--------+--------+--------+ +| Bank 0 | Bank 1 | Bank 2 | Bank 3 | <-- "conio.pce" ++--------+--------+--------+--------+ +</verb></tscreen> +<em/Note/: That <tt/.pce/ file shows the format of the ROM cartridge that is +plugged into a PC-Engine. But, that <tt/.bin/ file shows what programs +actually see when they execute the code in that cartridge. + + <sect>Memory layout<p> @@ -52,19 +77,23 @@ Special locations: <tag/Stack/ The C runtime stack is located in system RAM at $3FFF and growing downwards. - <tag/BSS and Data/ - - The BSS (uninitialized variables) and Data (initialized variables) sections are - placed one after the other into system RAM at $2000. + <tag/Data and BSS/ + The Data (initialized variables) and BSS (uninitialized variables) sections are + placed one after the other into system RAM at $2200. <tag/Heap/ - The C heap is located after the end of the Data section and grows towards the C + The C heap is located after the end of the BSS section; and, grows towards the C runtime stack. <tag/Code/ - The startup code is located at $E000 in the System/Hardware bank. Further - code can be placed in other ROM banks, this must be done manually however. + In an 8K ROM cartridge, code and read-only data are located between + $E000 and $FFF5 in the System bank. + In a 16K cartridge, code and read-only data are located between $C000 + and $FFF5. + + In a 32K cartridge, code and read-only data are located between $8000 + and $FFF5. </descrip><p> @@ -171,7 +200,8 @@ following functions (and a few others): <sect>Other hints<p> <itemize> -<item>a good emulator to use for PC-Engine is "mednafen" (<url url="http://mednafen.fobby.net/">) +<item><url url="https://mednafen.github.io/" name= "Mednafen"> is a good +emulator to use for the PC-Engine. </itemize> some useful resources on PCE coding: @@ -210,6 +240,3 @@ freely, subject to the following restrictions: </enum> </article> - - - diff --git a/libsrc/pce/crt0.s b/libsrc/pce/crt0.s index 80b32c089..75ffb7f05 100644 --- a/libsrc/pce/crt0.s +++ b/libsrc/pce/crt0.s @@ -4,33 +4,26 @@ ; by Groepaz/Hitmen <groepaz@gmx.net> ; based on code by Ullrich von Bassewitz <uz@cc65.org> ; -; This must be the *first* file on the linker command line +; 2018-02-11, Greg King ; .export _exit .export __STARTUP__ : absolute = 1 ; Mark as startup .import initlib, donelib - .import push0, _main, zerobss - .import initheap + .import push0, _main .import IRQStub - ; Linker generated - .import __RAM_START__, __RAM_SIZE__ - .import __ROM0_START__, __ROM0_SIZE__ - .import __ROM_START__, __ROM_SIZE__ - .import __STARTUP_LOAD__,__STARTUP_RUN__, __STARTUP_SIZE__ - .import __CODE_LOAD__,__CODE_RUN__, __CODE_SIZE__ - .import __RODATA_LOAD__,__RODATA_RUN__, __RODATA_SIZE__ - .import __DATA_LOAD__,__DATA_RUN__, __DATA_SIZE__ - .import __BSS_SIZE__ + ; Linker-generated + .import __CARTSIZE__ + .import __DATA_LOAD__, __DATA_RUN__, __DATA_SIZE__ + .import __BSS_RUN__, __BSS_SIZE__ + .import __MAIN_START__, __MAIN_SIZE__, __STACKSIZE__ .include "pce.inc" .include "extzp.inc" .importzp sp - .importzp ptr1,ptr2 - .importzp tmp1,tmp2,tmp3 ; ------------------------------------------------------------------------ ; Place the startup code in a special segment. @@ -53,29 +46,27 @@ start: ldx #$FF ; Stack top ($21FF) txs - ; At startup all MPRs are set to 0, so init them - lda #$ff - tam #%00000001 ; 0000-1FFF = Hardware page + ; At power-on, most MPRs have random values; so, initiate them. + lda #$FF + tam #%00000001 ; $0000-$1FFF = Hardware bank lda #$F8 - tam #%00000010 ; 2000-3FFF = Work RAM - - ; FIXME: setup a larger block of memory to use with C-code + tam #%00000010 ; $2000-$3FFF = Work RAM ;lda #$F7 - ;tam #%00000100 ; 4000-5FFF = Save RAM - ;lda #1 - ;tam #%00001000 ; 6000-7FFF Page 2 - ;lda #2 - ;tam #%00010000 ; 8000-9FFF Page 3 - ;lda #3 - ;tam #%00100000 ; A000-BFFF Page 4 + ;tam #%00000100 ; $4000-$47FF = 2K Battery-backed RAM ;lda #4 - ;tam #%01000000 ; C000-DFFF Page 5 - ;lda #0 - ;tam #%10000000 ; e000-fFFF hucard/syscard bank 0 + ;tam #%00001000 ; $6000-$7FFF - ; Clear work RAM (2000-3FFF) - stz <$00 - tii $2000, $2001, $1FFF + lda #$01 + ldx #>$8000 + cpx #>__CARTSIZE__ + bcc @L1 ;(blt) + tam #%00010000 ; $8000-$9FFF = ROM bank 1 (32K block of ROM) + inc a + tam #%00100000 ; $A000-$BFFF = ROM bank 2 + inc a +@L1: tam #%01000000 ; $C000-$DFFF = ROM bank 3 (32K) or 1 (16K) + ;lda #$00 ; (The reset default) + ;tam #%10000000 ; $E000-$FFFF hucard/syscard bank 0 ; Initialize hardware stz TIMER_CTRL ; Timer off @@ -91,15 +82,16 @@ start: lda #$05 sta IRQ_MASK ; IRQ1=on - ; Clear the BSS data - jsr zerobss - ; Copy the .data segment to RAM tii __DATA_LOAD__, __DATA_RUN__, __DATA_SIZE__ + ; Clear the .bss segment + stz __BSS_RUN__ + tii __BSS_RUN__, __BSS_RUN__ + 1, __BSS_SIZE__ - 1 + ; Set up the stack - lda #<(__RAM_START__+__RAM_SIZE__) - ldx #>(__RAM_START__+__RAM_SIZE__) + lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) + ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) sta sp stx sp + 1 diff --git a/testcode/lib/pce/Makefile b/testcode/lib/pce/Makefile index 9a4dd7506..a4a495c9a 100644 --- a/testcode/lib/pce/Makefile +++ b/testcode/lib/pce/Makefile @@ -1,12 +1,29 @@ .PHONY: all clean test +# Size of cartridge to generate. +# Possible values: +# 8K = 0x2000 +# 16K = 0x4000 +# 32K = 0x8000 +CARTSIZE := 0x2000 + +ifeq (${CARTSIZE},0x8000) +COUNT := 3 +else +COUNT := 1 +endif + all: conio.pce -conio.pce: conio.c - ../../../bin/cl65 -t pce conio.c --mapfile conio.map -o conio.pce +%.pce: %.bin + dd if=$< bs=8K skip=${COUNT} > $@ + dd if=$< bs=8K count=${COUNT} >> $@ + +%.bin: %.c ../../../lib/pce.lib + ../../../bin/cl65 -t pce $< -Wl -D__CARTSIZE__=${CARTSIZE} -m $*.map -o $@ clean: - $(RM) conio.o conio.pce conio.map + $(RM) conio.o conio.??? test: conio.pce - mednafen -force_module pce conio.pce + mednafen -force_module pce $< diff --git a/testcode/lib/pce/conio.c b/testcode/lib/pce/conio.c index ed3f86240..858f01918 100644 --- a/testcode/lib/pce/conio.c +++ b/testcode/lib/pce/conio.c @@ -45,7 +45,7 @@ void main(void) p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15] ); } - memcpy(p, main, 0); /* test that a zero length doesn't copy 64K */ + memcpy(p, main, i = 0); /* test that a zero length doesn't copy 64K */ gotoxy(0,ysize - 1); for (i = 0; i < xsize; ++i) { From 8476360e9f5f3737eb740e8faffdeece2e4847aa Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Mon, 24 Aug 2015 02:53:47 -0400 Subject: [PATCH 152/254] Fixed bugs in geos-cbm's dio_open(). * Trying to open an unused drive would leave a byte on the hardware stack. * Too high device numbers weren't caught. --- libsrc/geos-cbm/disk/dio_openclose.s | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libsrc/geos-cbm/disk/dio_openclose.s b/libsrc/geos-cbm/disk/dio_openclose.s index ec5aa8795..72e3e32e9 100644 --- a/libsrc/geos-cbm/disk/dio_openclose.s +++ b/libsrc/geos-cbm/disk/dio_openclose.s @@ -1,8 +1,8 @@ ; -; Maciej 'YTM/Elysium' Witkowiak +; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak +; 2015-08-24, Greg King ; ; based on Atari version by Christian Groessler -; 2.7.2001 ; ; dhandle_t __fastcall__ dio_open (unsigned char device); ; unsigned char __fastcall__ dio_close (dhandle_t handle); @@ -27,11 +27,13 @@ sectsizetab: .code _dio_open: - pha + cmp #4 + bcs _inv_drive tax lda driveType,x ; check if there's a device beq _inv_drive txa + pha clc adc #8 ; normalize devnum sta curDevice From 6fd56bf9b6b594a722bc508b6dfc7c1f21fdc3b4 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Thu, 27 Aug 2015 04:02:26 -0400 Subject: [PATCH 153/254] Fixed bugs in the geos-cbm DIO sector-number converter functions. * The 16-bit comparison code actually didn't compare the high byte. * This implementation supports only the 1541, 1571, and 1581; but, it didn't exclude the other drive types that GEOS supports. * Two error code numbers were swapped. * A 1571 converter didn't catch sector numbers that are too high. * A 1581 converter didn't catch sector numbers that are too high. --- libsrc/geos-cbm/disk/dio_cts.s | 10 +++++----- libsrc/geos-cbm/disk/dio_stc.s | 23 ++++++++++++----------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/libsrc/geos-cbm/disk/dio_cts.s b/libsrc/geos-cbm/disk/dio_cts.s index 8be343641..043e1f8d8 100644 --- a/libsrc/geos-cbm/disk/dio_cts.s +++ b/libsrc/geos-cbm/disk/dio_cts.s @@ -1,6 +1,6 @@ ; -; Maciej 'YTM/Elysium' Witkowiak -; 2.7.2001 +; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak +; 2015-08-26, Greg King ; ; ; unsigned char __fastcall__ dio_phys_to_log (dhandle_t handle, @@ -59,7 +59,7 @@ _dio_phys_to_log: lda (ptr3),y tay lda driveType,y - and #%00000011 ; this is for RamDrive compatibility + and #%00001111 ; remove ramDisk flags cmp #DRV_1541 beq dio_cts1541 cmp #DRV_1571 @@ -67,7 +67,7 @@ _dio_phys_to_log: cmp #DRV_1581 beq dio_cts1581 - lda #DEV_NOT_FOUND ; unknown device + lda #INCOMPATIBLE ; unsupported device ldx #0 beq ret @@ -91,7 +91,7 @@ _inv_data: lda #INV_TRACK .byte $2c _inv_hand: - lda #INCOMPATIBLE + lda #DEV_NOT_FOUND ldx #0 beq ret diff --git a/libsrc/geos-cbm/disk/dio_stc.s b/libsrc/geos-cbm/disk/dio_stc.s index 586e3f3db..7398edb63 100644 --- a/libsrc/geos-cbm/disk/dio_stc.s +++ b/libsrc/geos-cbm/disk/dio_stc.s @@ -1,6 +1,6 @@ ; -; Maciej 'YTM/Elysium' Witkowiak -; 2.7.2001 +; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak +; 2015-08-27, Greg King ; ; unsigned char __fastcall__ dio_log_to_phys (dhandle_t handle, ; unsigned *sectnum, /* input */ @@ -55,7 +55,7 @@ _dio_log_to_phys: lda (ptr3),y tay lda driveType,y - and #%00000011 ; this is for RamDrive compatibility + and #%00001111 ; remove ramDisk flags cmp #DRV_1541 beq dio_stc1541 cmp #DRV_1571 @@ -63,7 +63,7 @@ _dio_log_to_phys: cmp #DRV_1581 beq dio_stc1581 - lda #DEV_NOT_FOUND ; unknown device + lda #INCOMPATIBLE ; unsupported device ldx #0 beq _ret @@ -86,7 +86,7 @@ _inv_data: lda #INV_TRACK .byte $2c _inv_hand: - lda #INCOMPATIBLE + lda #DEV_NOT_FOUND ldx #0 beq _ret @@ -102,8 +102,8 @@ _loop41: bne _nxt lda tmp1 cmp sectab_1541_l+1,x - bcc _found -_nxt: inx +_nxt: bcc _found + inx cpx #35 bne _loop41 beq _inv_data @@ -124,12 +124,11 @@ dio_stc1571: ; - fall down to 1541 lda tmp2 cmp #>683 - bne _cnt71 + bne _if71 lda tmp1 cmp #<683 - bcc dio_stc1541 +_if71: bcc dio_stc1541 -_cnt71: lda tmp1 sec sbc #<683 @@ -138,6 +137,8 @@ _cnt71: sbc #>683 sta tmp2 jsr dio_stc1541 ; will fall through here + tay + bne _ret ; result beyond track 70 ldy #diopp_track lda (ptr1),y @@ -166,7 +167,7 @@ _sub81: lda tmp1 sbc #0 sta tmp2 inx - cpx #81 + cpx #80 bne _loop81 beq _inv_data From 39b4b6838ff3a72432ae2b0d9af4de360c344672 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Thu, 27 Aug 2015 05:10:01 -0400 Subject: [PATCH 154/254] Made dio_read(), dio_write(), and dio_write_verify() catch sector number conversion errors. --- libsrc/geos-cbm/disk/dio_read.s | 8 +++++--- libsrc/geos-cbm/disk/dio_write.s | 8 ++++++-- libsrc/geos-cbm/disk/dio_writev.s | 8 +++++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/libsrc/geos-cbm/disk/dio_read.s b/libsrc/geos-cbm/disk/dio_read.s index db46c9b69..ac19f9afa 100644 --- a/libsrc/geos-cbm/disk/dio_read.s +++ b/libsrc/geos-cbm/disk/dio_read.s @@ -1,6 +1,6 @@ ; -; Maciej 'YTM/Elysium' Witkowiak -; 2.7.2001 +; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak +; 2015-08-27, Greg King ; ; this file provides the _dio_read function ; @@ -15,7 +15,9 @@ _dio_read: jsr dio_params + tay + bne err jsr ReadBlock stx __oserror txa - rts +err: rts diff --git a/libsrc/geos-cbm/disk/dio_write.s b/libsrc/geos-cbm/disk/dio_write.s index 14267803a..a5f747519 100644 --- a/libsrc/geos-cbm/disk/dio_write.s +++ b/libsrc/geos-cbm/disk/dio_write.s @@ -1,6 +1,6 @@ ; -; Maciej 'YTM/Elysium' Witkowiak -; 2.7.2001 +; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak +; 2015-08-27, Greg King ; ; this file provides the _dio_write function ; @@ -15,5 +15,9 @@ _dio_write: jsr dio_params + tay + bne err jsr WriteBlock jmp setoserror + +err: rts diff --git a/libsrc/geos-cbm/disk/dio_writev.s b/libsrc/geos-cbm/disk/dio_writev.s index 7cb9b029f..9b36ed096 100644 --- a/libsrc/geos-cbm/disk/dio_writev.s +++ b/libsrc/geos-cbm/disk/dio_writev.s @@ -1,6 +1,6 @@ ; -; Maciej 'YTM/Elysium' Witkowiak -; 2.7.2001 +; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak +; 2015-08-27, Greg King ; ; this file provides the _dio_write function ; @@ -15,7 +15,9 @@ _dio_write_verify: jsr dio_params + tay + bne err jsr VerWriteBlock stx __oserror txa - rts +err: rts From 924364d73d08d1b4b8c5162b8667f682133a6e9a Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Sun, 25 Feb 2018 22:38:58 +0000 Subject: [PATCH 155/254] Small typo --- doc/atari.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/atari.sgml b/doc/atari.sgml index 6cbff6208..459e8e745 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -394,7 +394,7 @@ under different mappings, defining remapped strings works only flawlessly with static array initialization: <verb> -#include <atari\_screen\_charmap.h> +#include <atari_screen_charmap.h> char pcScreenMappingString[] = "Hello Atari!"; #include <atari_atascii_charmap.h> From 33f602f9ad5582e8df7e1c0bd89433301f35b79f Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Mon, 26 Feb 2018 15:07:13 -0500 Subject: [PATCH 156/254] Shortenned the CBM close() by a byte and a cycle. --- libsrc/cbm/close.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/cbm/close.s b/libsrc/cbm/close.s index 004b88df9..b43c07b57 100644 --- a/libsrc/cbm/close.s +++ b/libsrc/cbm/close.s @@ -40,7 +40,7 @@ lda #LFN_CLOSED sta fdtab,x - lda tmp2 ; Get the handle + txa ; Get handle clc adc #LFN_OFFS ; Make LFN from handle jsr CLOSE From 122def9f124f82ccb6af1b7269b040429e0e88b7 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Mon, 26 Feb 2018 19:19:13 -0800 Subject: [PATCH 157/254] Added proper 65sc02, 65ce02 and 4510 detection. --- include/6502.h | 2 ++ libsrc/common/getcpu.s | 34 ++++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/include/6502.h b/include/6502.h index 31398e5c1..55083b036 100644 --- a/include/6502.h +++ b/include/6502.h @@ -51,6 +51,8 @@ typedef unsigned size_t; #define CPU_65C02 1 #define CPU_65816 2 #define CPU_4510 3 +#define CPU_65SC02 4 +#define CPU_65CE02 5 unsigned char getcpu (void); /* Detect the CPU the program is running on */ diff --git a/libsrc/common/getcpu.s b/libsrc/common/getcpu.s index 1e60a5d39..764e73a84 100644 --- a/libsrc/common/getcpu.s +++ b/libsrc/common/getcpu.s @@ -10,9 +10,11 @@ ; Subroutine to detect an 816. Returns ; ; - carry clear and 0 in A for a NMOS 6502 CPU -; - carry set and 1 in A for some CMOS 6502 CPU +; - carry set and 1 in A for a 65c02 ; - carry set and 2 in A for a 65816 ; - carry set and 3 in A for a 4510 +; - carry set and 4 in A for a 65sc02 +; - carry set and 5 in A for a 65ce02 ; ; This function uses a $1A opcode which is a INA on the 816 and ignored ; (interpreted as a NOP) on a NMOS 6502. There are several CMOS versions @@ -27,20 +29,40 @@ _getcpu: cmp #1 bcc @L9 -; This is at least a 65C02, check for a 4510 +; This is at least a 65C02, check for a 65ce02/4510 - .byte $42,$ea ; neg on 4510, nop #$ea on 65c02, wdm $ea on 65816 + .byte $42,$ea ; neg on 65ce02/4510, nop #$ea on 65c02, wdm $ea on 65816 cmp #1 - bne @L8 + beq @L6 + +; check for 4510 + + lda #5 ; CPU_65CE02 constant + .byte $5c ; map on 4510, aug on 65ce02 (acts like 4 byte nop) + lda #3 ; CPU_4510 constant + nop + bne @L9 + +; check for 65sc02 + +@L6: ldy $f7 + ldx #$00 + stx $f7 + .byte $f7,$f7 ; nop nop on 65sc02, smb7 $f7 on 65c02 and 65816 + ldx $f7 + sty $f7 + cpx #$00 + bne @L7 + lda #4 ; CPU_65SC02 constant + bne @L9 ; check for 65816; after 4510, because $eb there is row (rotate word) - xba ; .byte $eb, put $01 in B accu +@L7: xba ; .byte $eb, put $01 in B accu dec a ; .byte $3a, A=$00 if 65C02 xba ; .byte $eb, get $01 back if 65816 inc a ; .byte $1a, make $01/$02 .byte $2c ; bit instruction to skip next command -@L8: lda #3 ; CPU_4510 constant @L9: ldx #0 ; Load high byte of word rts From e3779978b2a894eaa1ffa7682b8ccf20b9cf4ce5 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Mon, 26 Feb 2018 19:19:13 -0800 Subject: [PATCH 158/254] Added proper 65sc02, 65ce02 and 4510 detection. --- include/6502.h | 2 ++ libsrc/common/getcpu.s | 34 ++++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/include/6502.h b/include/6502.h index 31398e5c1..55083b036 100644 --- a/include/6502.h +++ b/include/6502.h @@ -51,6 +51,8 @@ typedef unsigned size_t; #define CPU_65C02 1 #define CPU_65816 2 #define CPU_4510 3 +#define CPU_65SC02 4 +#define CPU_65CE02 5 unsigned char getcpu (void); /* Detect the CPU the program is running on */ diff --git a/libsrc/common/getcpu.s b/libsrc/common/getcpu.s index 1e60a5d39..764e73a84 100644 --- a/libsrc/common/getcpu.s +++ b/libsrc/common/getcpu.s @@ -10,9 +10,11 @@ ; Subroutine to detect an 816. Returns ; ; - carry clear and 0 in A for a NMOS 6502 CPU -; - carry set and 1 in A for some CMOS 6502 CPU +; - carry set and 1 in A for a 65c02 ; - carry set and 2 in A for a 65816 ; - carry set and 3 in A for a 4510 +; - carry set and 4 in A for a 65sc02 +; - carry set and 5 in A for a 65ce02 ; ; This function uses a $1A opcode which is a INA on the 816 and ignored ; (interpreted as a NOP) on a NMOS 6502. There are several CMOS versions @@ -27,20 +29,40 @@ _getcpu: cmp #1 bcc @L9 -; This is at least a 65C02, check for a 4510 +; This is at least a 65C02, check for a 65ce02/4510 - .byte $42,$ea ; neg on 4510, nop #$ea on 65c02, wdm $ea on 65816 + .byte $42,$ea ; neg on 65ce02/4510, nop #$ea on 65c02, wdm $ea on 65816 cmp #1 - bne @L8 + beq @L6 + +; check for 4510 + + lda #5 ; CPU_65CE02 constant + .byte $5c ; map on 4510, aug on 65ce02 (acts like 4 byte nop) + lda #3 ; CPU_4510 constant + nop + bne @L9 + +; check for 65sc02 + +@L6: ldy $f7 + ldx #$00 + stx $f7 + .byte $f7,$f7 ; nop nop on 65sc02, smb7 $f7 on 65c02 and 65816 + ldx $f7 + sty $f7 + cpx #$00 + bne @L7 + lda #4 ; CPU_65SC02 constant + bne @L9 ; check for 65816; after 4510, because $eb there is row (rotate word) - xba ; .byte $eb, put $01 in B accu +@L7: xba ; .byte $eb, put $01 in B accu dec a ; .byte $3a, A=$00 if 65C02 xba ; .byte $eb, get $01 back if 65816 inc a ; .byte $1a, make $01/$02 .byte $2c ; bit instruction to skip next command -@L8: lda #3 ; CPU_4510 constant @L9: ldx #0 ; Load high byte of word rts From e79e779aba9aa463b7d4c5fa1f0beaf6016d5793 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Mon, 26 Feb 2018 19:30:25 -0800 Subject: [PATCH 159/254] Removed bit opcode, not needed anymore. --- libsrc/common/getcpu.s | 1 - 1 file changed, 1 deletion(-) diff --git a/libsrc/common/getcpu.s b/libsrc/common/getcpu.s index 764e73a84..f7ac3c170 100644 --- a/libsrc/common/getcpu.s +++ b/libsrc/common/getcpu.s @@ -62,7 +62,6 @@ _getcpu: dec a ; .byte $3a, A=$00 if 65C02 xba ; .byte $eb, get $01 back if 65816 inc a ; .byte $1a, make $01/$02 - .byte $2c ; bit instruction to skip next command @L9: ldx #0 ; Load high byte of word rts From 5d029af79ee46d4e57aa583c6d47cab333be5c02 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Tue, 27 Feb 2018 11:44:34 -0800 Subject: [PATCH 160/254] Fixed the 65816/65802 detection. --- libsrc/common/getcpu.s | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/libsrc/common/getcpu.s b/libsrc/common/getcpu.s index f7ac3c170..05a6d0143 100644 --- a/libsrc/common/getcpu.s +++ b/libsrc/common/getcpu.s @@ -35,7 +35,7 @@ _getcpu: cmp #1 beq @L6 -; check for 4510 +; This is at least a 65ce02, check for 4510 lda #5 ; CPU_65CE02 constant .byte $5c ; map on 4510, aug on 65ce02 (acts like 4 byte nop) @@ -43,25 +43,26 @@ _getcpu: nop bne @L9 +; Check for 65816/65802 +@L6: xba ; .byte $eb, put $01 in B accu (nop on 65c02/65sc02) + dec a ; .byte $3a, A=$00 + xba ; .byte $eb, A=$01 if 65816/65802 and A=$00 if 65c02/65sc02 + inc a ; .byte $1a, A=$02 if 65816/65802 and A=$01 if 65c02/65sc02 + cmp #2 + beq @L9 + ; check for 65sc02 -@L6: ldy $f7 - ldx #$00 + ldy $f7 + ldx #0 stx $f7 - .byte $f7,$f7 ; nop nop on 65sc02, smb7 $f7 on 65c02 and 65816 + .byte $f7,$f7 ; nop nop on 65sc02, smb7 $f7 on 65c02 ldx $f7 sty $f7 cpx #$00 - bne @L7 - lda #4 ; CPU_65SC02 constant bne @L9 + lda #4 ; CPU_65SC02 constant -; check for 65816; after 4510, because $eb there is row (rotate word) - -@L7: xba ; .byte $eb, put $01 in B accu - dec a ; .byte $3a, A=$00 if 65C02 - xba ; .byte $eb, get $01 back if 65816 - inc a ; .byte $1a, make $01/$02 @L9: ldx #0 ; Load high byte of word rts From 85467231ab1ec3d707c80ca1edbe353b492ae573 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 28 Feb 2018 00:24:28 +0000 Subject: [PATCH 161/254] Update More conio targets --- doc/library.sgml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/library.sgml b/doc/library.sgml index 9b923c308..c36605844 100644 --- a/doc/library.sgml +++ b/doc/library.sgml @@ -4,7 +4,7 @@ <title>cc65 Library Overview <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>2014-04-12 +<date>2018-02-28 <abstract> An overview over the runtime and C libraries that come with the cc65 compiler, @@ -43,7 +43,7 @@ Functions that are <em/not/ available: <itemize> <item><tt>tmpfile/tmpnam</tt> <p> - <item><tt>system</tt> + <item><tt>system</tt> (cc65 alternative <tt>exec</tt>) <p> <item>All functions that handle floating point numbers in some manner. <p> @@ -172,10 +172,15 @@ portable. conio implementations exist for the following targets: <item>plus4 (or expanded c16/c116) <item>cbm510 (40 column video) <item>cbm610 (all CBM series-II computers with 80 column video) + <item>creativision + <item>gamate <item>geos-apple <item>geos-cbm <item>nes + <item>osic1p + <item>pce <item>pet (all CBM PET systems except the 2001) + <item>telestrat <item>vic20 </itemize> @@ -204,6 +209,7 @@ the following targets: <item>atarixl <item>c64 <item>c128 + <item>cbm510 </itemize> The available functions are declared in <tt/mouse.h/. @@ -235,6 +241,3 @@ freely, subject to the following restrictions: </enum> </article> - - - From 549f09db9c83b4720af04c44b68b324a108849ef Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Wed, 28 Feb 2018 14:59:52 -0500 Subject: [PATCH 162/254] Made two indirect jumps through the zero-page go through page $20 on the PC-Engine. --- libsrc/pce/call.s | 16 ++++++++++++++++ libsrc/pce/callptr4.s | 14 ++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 libsrc/pce/call.s create mode 100644 libsrc/pce/callptr4.s diff --git a/libsrc/pce/call.s b/libsrc/pce/call.s new file mode 100644 index 000000000..f99879866 --- /dev/null +++ b/libsrc/pce/call.s @@ -0,0 +1,16 @@ +; +; CC65 runtime: call function via pointer in ax +; +; 1998-08-06, Ullrich von Bassewitz +; 2018-02-28, Greg King +; + + .export callax + .importzp ptr1 + +callax: sta ptr1 + stx ptr1+1 + +; The PC-Engine puts the zero-page at $2000. + + jmp (ptr1 + $2000) ; go there diff --git a/libsrc/pce/callptr4.s b/libsrc/pce/callptr4.s new file mode 100644 index 000000000..7829cdb8e --- /dev/null +++ b/libsrc/pce/callptr4.s @@ -0,0 +1,14 @@ +; +; CC65 runtime: call function via pointer in ptr4 +; +; 2018-02-28, Greg King +; + + .export callptr4 + .importzp ptr4 + +callptr4: + +; The PC-Engine puts the zero-page at $2000. + + jmp (ptr4 + $2000) From 102d486207ddbcab5b136cab8eb475cdf13cb4a6 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Thu, 1 Mar 2018 08:55:29 -0800 Subject: [PATCH 163/254] Updated getcpu() function documentation. --- doc/funcref.sgml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index bbab694fa..de7bd31a2 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -3448,6 +3448,9 @@ returns one of the constants<itemize> <item><tt/CPU_6502/ <item><tt/CPU_65C02/ <item><tt/CPU_65816/ +<item><tt/CPU_4510/ +<item><tt/CPU_65SC02/ +<item><tt/CPU_65CE02/ </itemize> <tag/Notes/<itemize> <item>Other, more exotic CPU types are not disinguished. From 5a9d908007b255c2d6896cdc73a50e5cad20bb25 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Thu, 1 Mar 2018 14:57:42 -0800 Subject: [PATCH 164/254] Added 2a03/2a07 and HuC6280 detection. --- doc/funcref.sgml | 2 ++ include/6502.h | 2 ++ libsrc/common/getcpu.s | 50 ++++++++++++++++++++++++++++++------------ 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index de7bd31a2..235a0d40f 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -3451,6 +3451,8 @@ returns one of the constants<itemize> <item><tt/CPU_4510/ <item><tt/CPU_65SC02/ <item><tt/CPU_65CE02/ +<item><tt/CPU_HUC6280/ +<item><tt/CPU_2A0x/ </itemize> <tag/Notes/<itemize> <item>Other, more exotic CPU types are not disinguished. diff --git a/include/6502.h b/include/6502.h index 55083b036..642a608a8 100644 --- a/include/6502.h +++ b/include/6502.h @@ -53,6 +53,8 @@ typedef unsigned size_t; #define CPU_4510 3 #define CPU_65SC02 4 #define CPU_65CE02 5 +#define CPU_HUC6280 6 +#define CPU_2A0x 7 unsigned char getcpu (void); /* Detect the CPU the program is running on */ diff --git a/libsrc/common/getcpu.s b/libsrc/common/getcpu.s index 05a6d0143..bc71a4340 100644 --- a/libsrc/common/getcpu.s +++ b/libsrc/common/getcpu.s @@ -10,11 +10,13 @@ ; Subroutine to detect an 816. Returns ; ; - carry clear and 0 in A for a NMOS 6502 CPU -; - carry set and 1 in A for a 65c02 +; - carry set and 1 in A for a 65C02 ; - carry set and 2 in A for a 65816 ; - carry set and 3 in A for a 4510 -; - carry set and 4 in A for a 65sc02 -; - carry set and 5 in A for a 65ce02 +; - carry set and 4 in A for a 65SC02 +; - carry set and 5 in A for a 65CE02 +; - carry set and 6 in A for a HuC6280 +; - carry clear and 7 in A for a 2a03/2a07 ; ; This function uses a $1A opcode which is a INA on the 816 and ignored ; (interpreted as a NOP) on a NMOS 6502. There are several CMOS versions @@ -27,40 +29,60 @@ _getcpu: lda #0 inc a ; .byte $1A ; nop on nmos, inc on every cmos cmp #1 - bcc @L9 + bcc @L8 -; This is at least a 65C02, check for a 65ce02/4510 +; This is at least a 65C02, check for a 65CE02/4510 - .byte $42,$ea ; neg on 65ce02/4510, nop #$ea on 65c02, wdm $ea on 65816 + .byte $42,$ea ; neg on 65CE02/4510, nop #$ea on 65C02, wdm $ea on 65816 cmp #1 beq @L6 -; This is at least a 65ce02, check for 4510 +; This is at least a 65CE02, check for 4510 lda #5 ; CPU_65CE02 constant - .byte $5c ; map on 4510, aug on 65ce02 (acts like 4 byte nop) + .byte $5c ; map on 4510, aug on 65CE02 (acts like 4 byte nop) lda #3 ; CPU_4510 constant nop bne @L9 +; 6502 type of cpu, check for a 2a03/2a07 +@L8: + sed ; set decimal mode, no decimal mode on the 2a03/2a07 + lda #9 + clc + adc #1 ; $01+$09 = $10 on 6502, $01+$09 = $0a on 2a03/2a07 + cld + cmp #10 + bne @L5 + lda #0 ; CPU_6502 constant + beq @L9 +@L5: + lda #7 ; CPU_2A0x constant + bne @L9 + +; 65C02 cpu type, check for HuC6280 +@L4: ldx #6 ; CPU_HUC6280 constant + .byte $22,$ea ; sax nop on HuC6280 (A=$06, X=$01), nop #$ea on 65C02 (A=$01, X=$06) + bne @L9 + ; Check for 65816/65802 -@L6: xba ; .byte $eb, put $01 in B accu (nop on 65c02/65sc02) +@L6: xba ; .byte $eb, put $01 in B accu (nop on 65C02/65SC02) dec a ; .byte $3a, A=$00 - xba ; .byte $eb, A=$01 if 65816/65802 and A=$00 if 65c02/65sc02 - inc a ; .byte $1a, A=$02 if 65816/65802 and A=$01 if 65c02/65sc02 + xba ; .byte $eb, A=$01 if 65816/65802 and A=$00 if 65C02/65SC02 + inc a ; .byte $1a, A=$02 if 65816/65802 and A=$01 if 65C02/65SC02 cmp #2 beq @L9 -; check for 65sc02 +; check for 65SC02 ldy $f7 ldx #0 stx $f7 - .byte $f7,$f7 ; nop nop on 65sc02, smb7 $f7 on 65c02 + .byte $f7,$f7 ; nop nop on 65SC02, smb7 $f7 on 65C02 ldx $f7 sty $f7 cpx #$00 - bne @L9 + bne @L4 lda #4 ; CPU_65SC02 constant @L9: ldx #0 ; Load high byte of word From 57abfcd581abd5c674e42cfdd8857b574efcaa9d Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Fri, 2 Mar 2018 22:16:59 +0100 Subject: [PATCH 165/254] Joystick drivers don't depend on interrupts anymore. --- doc/apple2.sgml | 3 +-- doc/apple2enh.sgml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/apple2.sgml b/doc/apple2.sgml index 822dd564e..43651c7fa 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -470,8 +470,7 @@ BASIC.SYSTEM) there are some limitations for DOS 3.3: <tag/Interrupts/ There's no <tt/interruptor/ support. Any attempt to use it yields the message 'FAILED TO ALLOC INTERRUPT' on program startup. This implicitly means that - joystick, mouse and RS232 device drivers are not functional as they depend on - interrupts. + mouse and RS232 device drivers are not functional as they depend on interrupts. </descrip><p> diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml index 3a53b6b8c..3f335d028 100644 --- a/doc/apple2enh.sgml +++ b/doc/apple2enh.sgml @@ -471,8 +471,7 @@ BASIC.SYSTEM) there are some limitations for DOS 3.3: <tag/Interrupts/ There's no <tt/interruptor/ support. Any attempt to use it yields the message 'Failed to alloc interrupt' on program startup. This implicitly means that - joystick, mouse and RS232 device drivers are not functional as they depend on - interrupts. + mouse and RS232 device drivers are not functional as they depend on interrupts. </descrip><p> From b37e06da8fc1fbbf57fcbcbb4744879c14c6a20a Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Fri, 2 Mar 2018 14:09:02 -0800 Subject: [PATCH 166/254] Fixed hex digits case. --- libsrc/common/getcpu.s | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/libsrc/common/getcpu.s b/libsrc/common/getcpu.s index bc71a4340..7fe002f65 100644 --- a/libsrc/common/getcpu.s +++ b/libsrc/common/getcpu.s @@ -33,14 +33,14 @@ _getcpu: ; This is at least a 65C02, check for a 65CE02/4510 - .byte $42,$ea ; neg on 65CE02/4510, nop #$ea on 65C02, wdm $ea on 65816 + .byte $42,$EA ; neg on 65CE02/4510, nop #$EA on 65C02, wdm $EA on 65816 cmp #1 beq @L6 ; This is at least a 65CE02, check for 4510 lda #5 ; CPU_65CE02 constant - .byte $5c ; map on 4510, aug on 65CE02 (acts like 4 byte nop) + .byte $5C ; map on 4510, aug on 65CE02 (acts like 4 byte nop) lda #3 ; CPU_4510 constant nop bne @L9 @@ -50,7 +50,7 @@ _getcpu: sed ; set decimal mode, no decimal mode on the 2a03/2a07 lda #9 clc - adc #1 ; $01+$09 = $10 on 6502, $01+$09 = $0a on 2a03/2a07 + adc #1 ; $01+$09 = $10 on 6502, $01+$09 = $0A on 2a03/2a07 cld cmp #10 bne @L5 @@ -62,25 +62,25 @@ _getcpu: ; 65C02 cpu type, check for HuC6280 @L4: ldx #6 ; CPU_HUC6280 constant - .byte $22,$ea ; sax nop on HuC6280 (A=$06, X=$01), nop #$ea on 65C02 (A=$01, X=$06) + .byte $22,$EA ; sax nop on HuC6280 (A=$06, X=$01), nop #$EA on 65C02 (A=$01, X=$06) bne @L9 ; Check for 65816/65802 -@L6: xba ; .byte $eb, put $01 in B accu (nop on 65C02/65SC02) - dec a ; .byte $3a, A=$00 - xba ; .byte $eb, A=$01 if 65816/65802 and A=$00 if 65C02/65SC02 - inc a ; .byte $1a, A=$02 if 65816/65802 and A=$01 if 65C02/65SC02 +@L6: xba ; .byte $EB, put $01 in B accu (nop on 65C02/65SC02) + dec a ; .byte $3A, A=$00 + xba ; .byte $EB, A=$01 if 65816/65802 and A=$00 if 65C02/65SC02 + inc a ; .byte $1A, A=$02 if 65816/65802 and A=$01 if 65C02/65SC02 cmp #2 beq @L9 ; check for 65SC02 - ldy $f7 + ldy $F7 ldx #0 - stx $f7 - .byte $f7,$f7 ; nop nop on 65SC02, smb7 $f7 on 65C02 - ldx $f7 - sty $f7 + stx $F7 + .byte $F7,$F7 ; nop nop on 65SC02, smb7 $F7 on 65C02 + ldx $F7 + sty $F7 cpx #$00 bne @L4 lda #4 ; CPU_65SC02 constant From c3610aa971d2894c9eeded09552320bf7fb03a82 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Mon, 5 Mar 2018 20:08:17 +0100 Subject: [PATCH 167/254] Updated from Visual Studio 2013 to Visual Studio 2015. --- src/.gitignore | 2 ++ src/ar65.vcxproj | 6 +++--- src/ca65.vcxproj | 6 +++--- src/cc65.vcxproj | 6 +++--- src/chrcvt65.vcxproj | 6 +++--- src/cl65.vcxproj | 6 +++--- src/co65.vcxproj | 6 +++--- src/common.vcxproj | 6 +++--- src/da65.vcxproj | 6 +++--- src/grc65.vcxproj | 6 +++--- src/ld65.vcxproj | 6 +++--- src/od65.vcxproj | 6 +++--- src/sim65.vcxproj | 6 +++--- src/sp65.vcxproj | 6 +++--- 14 files changed, 41 insertions(+), 39 deletions(-) diff --git a/src/.gitignore b/src/.gitignore index d2b9fe751..a2c8bb5d4 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -2,5 +2,7 @@ ipch/ *.suo *.sdf *.opensdf +*.VC.db +*.VC.VC.opendb *.vcxproj.filters *.vcxproj.user diff --git a/src/ar65.vcxproj b/src/ar65.vcxproj index b077134ce..003a5fa69 100644 --- a/src/ar65.vcxproj +++ b/src/ar65.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/ca65.vcxproj b/src/ca65.vcxproj index 4e02fa2a9..fb7cf2e26 100644 --- a/src/ca65.vcxproj +++ b/src/ca65.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/cc65.vcxproj b/src/cc65.vcxproj index 70f43dc73..12573e862 100644 --- a/src/cc65.vcxproj +++ b/src/cc65.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/chrcvt65.vcxproj b/src/chrcvt65.vcxproj index 1daf7cae9..d120399d1 100644 --- a/src/chrcvt65.vcxproj +++ b/src/chrcvt65.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/cl65.vcxproj b/src/cl65.vcxproj index 64c1126b1..b6ceb161a 100644 --- a/src/cl65.vcxproj +++ b/src/cl65.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/co65.vcxproj b/src/co65.vcxproj index c66c8aac8..89eed36e1 100644 --- a/src/co65.vcxproj +++ b/src/co65.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/common.vcxproj b/src/common.vcxproj index 39fea35e5..644d6da85 100644 --- a/src/common.vcxproj +++ b/src/common.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -115,13 +115,13 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/da65.vcxproj b/src/da65.vcxproj index 2695edc08..06af7505d 100644 --- a/src/da65.vcxproj +++ b/src/da65.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/grc65.vcxproj b/src/grc65.vcxproj index 211ad7cce..afac0cce1 100644 --- a/src/grc65.vcxproj +++ b/src/grc65.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/ld65.vcxproj b/src/ld65.vcxproj index acb9b4240..cc5598aad 100644 --- a/src/ld65.vcxproj +++ b/src/ld65.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/od65.vcxproj b/src/od65.vcxproj index c788ac961..2ace26001 100644 --- a/src/od65.vcxproj +++ b/src/od65.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/sim65.vcxproj b/src/sim65.vcxproj index f87b4db6b..9ba0980ba 100644 --- a/src/sim65.vcxproj +++ b/src/sim65.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/sp65.vcxproj b/src/sp65.vcxproj index 8db98346c..6e7d992d4 100644 --- a/src/sp65.vcxproj +++ b/src/sp65.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -18,12 +18,12 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> From 19f3229f45262da83c910650c382f5bdd510d022 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Mon, 5 Mar 2018 20:44:32 +0100 Subject: [PATCH 168/254] Made 'wrapped call' code build with VS 2015. --- src/cc65/pragma.c | 2 +- src/cc65/wrappedcall.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cc65/pragma.c b/src/cc65/pragma.c index 25bc29d43..64ea4a1aa 100644 --- a/src/cc65/pragma.c +++ b/src/cc65/pragma.c @@ -525,7 +525,7 @@ static void WrappedCallPragma (StrBuf* B) /* Check if the name is valid */ if (Entry && Entry->Flags & SC_FUNC) { - PushWrappedCall(Entry, Val); + PushWrappedCall(Entry, (unsigned char) Val); Entry->Flags |= SC_REF; Entry->V.F.Func->Flags |= FD_CALL_WRAPPER; diff --git a/src/cc65/wrappedcall.c b/src/cc65/wrappedcall.c index 2d11245fd..18cb507ac 100644 --- a/src/cc65/wrappedcall.c +++ b/src/cc65/wrappedcall.c @@ -97,6 +97,6 @@ void GetWrappedCall (void **Ptr, unsigned char *Val) } else { long Temp; IPS_Get (&WrappedCalls, &Temp, Ptr); - *Val = Temp; + *Val = (unsigned char) Temp; } } From bc58bf572cf317f54580018cf12968693768228d Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Mon, 5 Mar 2018 22:31:10 +0100 Subject: [PATCH 169/254] Fixed -W cmdline option handling. Reverted part of https://github.com/cc65/cc65/commit/3157e4be1ec7f2a5ac61ca45b232cd07c5e30483 as it actually introduced a regression. It doesn't make sense to check for Arg[3] == '\0' _before_ checking Arg[2] != '\0'. This made the Win32 builds fail to correctly parse e.g. cl65 -W unused-var test.c --- src/cl65/main.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/cl65/main.c b/src/cl65/main.c index 5a2103b24..afd3e97e3 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -1444,35 +1444,24 @@ int main (int argc, char* argv []) /* Print version number */ OptVersion (Arg, 0); break; - + case 'E': /* Forward -E to compiler */ CmdAddArg (&CC65, Arg); DisableAssemblingAndLinking (); break; - + case 'W': - /* avoid && with'\0' in if clauses */ - if (Arg[3] == '\0') { - switch (Arg[2]) { - case 'a': - /* -Wa: Pass options to assembler */ - OptAsmArgs (Arg, GetArg (&I, 3)); - break; - case 'c': - /* -Wc: Pass options to compiler - ** Remember -Wc sub arguments in cc65 arg struct - */ - OptCCArgs (Arg, GetArg (&I, 3)); - break; - case 'l': - /* -Wl: Pass options to linker */ - OptLdArgs (Arg, GetArg (&I, 3)); - break; - default: - UnknownOption (Arg); - break; - } + if (Arg[2] == 'a' && Arg[3] == '\0') { + /* -Wa: Pass options to assembler */ + OptAsmArgs (Arg, GetArg (&I, 3)); + } else if (Arg[2] == 'c' && Arg[3] == '\0') { + /* -Wc: Pass options to compiler */ + /* Remember -Wc sub arguments in cc65 arg struct */ + OptCCArgs (Arg, GetArg (&I, 3)); + } else if (Arg[2] == 'l' && Arg[3] == '\0') { + /* -Wl: Pass options to linker */ + OptLdArgs (Arg, GetArg (&I, 3)); } else { /* Anything else: Suppress warnings (compiler) */ CmdAddArg2 (&CC65, "-W", GetArg (&I, 2)); From 40e93dd931a9d9893f29490a434d28a64b830289 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Mon, 5 Mar 2018 15:01:55 -0800 Subject: [PATCH 170/254] Improved reu size detection. --- libsrc/c128/emd/c128-reu.s | 59 ++++++++++++++++++++++++++++++------- libsrc/c64/emd/c64-reu.s | 60 +++++++++++++++++++++++++++++++------- 2 files changed, 99 insertions(+), 20 deletions(-) diff --git a/libsrc/c128/emd/c128-reu.s b/libsrc/c128/emd/c128-reu.s index a858c591e..3b191c666 100644 --- a/libsrc/c128/emd/c128-reu.s +++ b/libsrc/c128/emd/c128-reu.s @@ -92,17 +92,56 @@ INSTALL: cmp REU_REUADDR ; Check for presence of REU bne nodevice - ldy #>(128*4) ; Assume 128KB - lda REU_STATUS - and #$10 ; Check size bit - beq @L1 - ldy #>(256*4) ; 256KB when size bit is set -@L1: sty pagecount+1 - +; determine the size + php + sei ldy #$FF - sty curpage - sty curpage+1 ; Invalidate the current page - txa ; X = A = EM_ERR_OK +loop: + sty window + jsr reu_size_check_common + ldx #%10110000 + stx REU_COMMAND + dey + cpy #$FF + bne loop + iny +size_loop: + jsr reu_size_check_common + ldx #%10110001 + stx REU_COMMAND + cpy window + bne size_found + iny + bne size_loop +size_found: + plp + ldx #$00 + cpy #$00 ; too many pages, shave off 2 + bne pagecount_ok + dex + dex + dey +pagecount_ok: + stx pagecount + sty pagecount+1 + lda #<EM_ERR_OK + ldx #>EM_ERR_OK + rts + +; common REU setup for size check +reu_size_check_common: + sty REU_REUADDR+2 + ldx #<window + stx REU_C64ADDR + ldx #>window + stx REU_C64ADDR+1 + ldx #$00 + stx REU_REUADDR + stx REU_REUADDR+1 + stx REU_COUNT+1 + stx REU_CONTROL + inx + stx REU_COUNT rts ; No REU found diff --git a/libsrc/c64/emd/c64-reu.s b/libsrc/c64/emd/c64-reu.s index 0779505be..5bbed2f3a 100644 --- a/libsrc/c64/emd/c64-reu.s +++ b/libsrc/c64/emd/c64-reu.s @@ -92,19 +92,59 @@ INSTALL: cmp REU_REUADDR ; Check for presence of REU bne nodevice - ldy #>(128*4) ; Assume 128KB - lda REU_STATUS - and #$10 ; Check size bit - beq @L1 - ldy #>(256*4) ; 256KB when size bit is set -@L1: sty pagecount+1 - +; determine the size + php + sei ldy #$FF - sty curpage - sty curpage+1 ; Invalidate the current page - txa ; X = A = EM_ERR_OK +loop: + sty window + jsr reu_size_check_common + ldx #%10110000 + stx REU_COMMAND + dey + cpy #$FF + bne loop + iny +size_loop: + jsr reu_size_check_common + ldx #%10110001 + stx REU_COMMAND + cpy window + bne size_found + iny + bne size_loop +size_found: + plp + ldx #$00 + cpy #$00 ; too many pages, shave off 2 + bne pagecount_ok + dex + dex + dey +pagecount_ok: + stx pagecount + sty pagecount+1 + lda #<EM_ERR_OK + ldx #>EM_ERR_OK rts +; common REU setup for size check +reu_size_check_common: + sty REU_REUADDR+2 + ldx #<window + stx REU_C64ADDR + ldx #>window + stx REU_C64ADDR+1 + ldx #$00 + stx REU_REUADDR + stx REU_REUADDR+1 + stx REU_COUNT+1 + stx REU_CONTROL + inx + stx REU_COUNT + rts + + ; No REU found nodevice: From b78328057722e68df7d110056af016abbe9c9f7e Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Mon, 5 Mar 2018 17:46:51 -0800 Subject: [PATCH 171/254] Replaced reu commands with defined constants. --- libsrc/c128/emd/c128-reu.s | 6 ++++-- libsrc/c64/emd/c64-reu.s | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libsrc/c128/emd/c128-reu.s b/libsrc/c128/emd/c128-reu.s index 3b191c666..3ded00d67 100644 --- a/libsrc/c128/emd/c128-reu.s +++ b/libsrc/c128/emd/c128-reu.s @@ -55,6 +55,8 @@ REU_TRIGGER = $FF00 ; REU command trigger OP_COPYFROM = $ED OP_COPYTO = $EC +OP_COPYFROM_ALOAD = $B1 +OP_COPYTO_ALOAD = $B0 ; ------------------------------------------------------------------------ ; Data. @@ -99,7 +101,7 @@ INSTALL: loop: sty window jsr reu_size_check_common - ldx #%10110000 + ldx #OP_COPYTO_ALOAD stx REU_COMMAND dey cpy #$FF @@ -107,7 +109,7 @@ loop: iny size_loop: jsr reu_size_check_common - ldx #%10110001 + ldx #OP_COPYFROM_ALOAD stx REU_COMMAND cpy window bne size_found diff --git a/libsrc/c64/emd/c64-reu.s b/libsrc/c64/emd/c64-reu.s index 5bbed2f3a..bf7bb4fb0 100644 --- a/libsrc/c64/emd/c64-reu.s +++ b/libsrc/c64/emd/c64-reu.s @@ -55,6 +55,9 @@ REU_TRIGGER = $FF00 ; REU command trigger OP_COPYFROM = $ED OP_COPYTO = $EC +OP_COPYFROM_ALOAD = $B1 +OP_COPYTO_ALOAD = $B0 + ; ------------------------------------------------------------------------ ; Data. @@ -99,7 +102,7 @@ INSTALL: loop: sty window jsr reu_size_check_common - ldx #%10110000 + ldx #OP_COPYTO_ALOAD stx REU_COMMAND dey cpy #$FF @@ -107,7 +110,7 @@ loop: iny size_loop: jsr reu_size_check_common - ldx #%10110001 + ldx #OP_COPYFROM_ALOAD stx REU_COMMAND cpy window bne size_found From 223750cde9abc860549dc6b28c6f4d2c577e0d19 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Tue, 6 Mar 2018 20:43:08 +0100 Subject: [PATCH 172/254] CC65_HOME is gone for quite some time by now. --- doc/using-make.sgml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/doc/using-make.sgml b/doc/using-make.sgml index 0c3c13a6e..e0e99a99c 100644 --- a/doc/using-make.sgml +++ b/doc/using-make.sgml @@ -58,7 +58,7 @@ SOURCES = foo.c bar.c PROGRAM = foobar ifdef CC65_TARGET -CC = $(CC65_HOME)/bin/cl65 +CC = cl65 CFLAGS = -t $(CC65_TARGET) --create-dep $(<:.c=.d) -O LDFLAGS = -t $(CC65_TARGET) -m $(PROGRAM).map else @@ -104,12 +104,6 @@ best done on the GNU Make command line like this: make CC65_TARGET=c64 </verb></tscreen> -The sample Makefile presumes the variable <tt/CC65_HOME/ to point to the -directory cc65 is located in. Again there are several ways to define this -variable but as its value typically won't change often it is best done as an -environment variable. On Windows the cc65 .exe installer package takes care -of creating a <tt/CC65_HOME/ environment variable. - <sect1>Understanding the sample Makefile<p> From c0d8021fd5795b9ed58c11dbf9a376bdbcbc367a Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Tue, 6 Mar 2018 23:36:11 +0100 Subject: [PATCH 173/254] add comment on linking, tweak a bit for easier debugging --- testcode/lib/joy-test.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/testcode/lib/joy-test.c b/testcode/lib/joy-test.c index fdd83bb4e..51cbb53e2 100644 --- a/testcode/lib/joy-test.c +++ b/testcode/lib/joy-test.c @@ -5,7 +5,6 @@ #include <conio.h> #include <joystick.h> - #ifdef JOYSTICK_DRIVER /* A statically linked driver was named on the compiler's command line. @@ -13,6 +12,22 @@ */ # undef DYN_DRV # define DYN_DRV 0 + +/* + * link existing drivers like this: + * + * cl65 -DJOYSTICK_DRIVER=c64_hitjoy_joy -o joy-test.prg joy-test.c + * + * for testing a new driver you will have to uncomment the define below, and + * link your driver like this: + * + * co65 ../../target/c64/drv/joy/c64-hitjoy.joy -o hitjoy.s --code-label _hitjoy + * cl65 -DJOYSTICK_DRIVER=hitjoy -o joy-test.prg joy-test.c hitjoy.s + * +*/ + +/* extern char JOYSTICK_DRIVER; */ + #else /* Use a dynamically loaded driver, by default. */ @@ -27,13 +42,16 @@ int main (void) unsigned char j; unsigned char count; unsigned char i; + unsigned char Res; + + clrscr (); #if DYN_DRV - unsigned char Res = joy_load_driver (joy_stddrv); + Res = joy_load_driver (joy_stddrv); #elif defined(JOYSTICK_DRIVER) - unsigned char Res = joy_install (&JOYSTICK_DRIVER); + Res = joy_install (&JOYSTICK_DRIVER); #else - unsigned char Res = joy_install (&joy_static_stddrv); + Res = joy_install (&joy_static_stddrv); #endif if (Res != JOY_ERR_OK) { @@ -44,7 +62,6 @@ int main (void) exit (EXIT_FAILURE); } - clrscr (); count = joy_count (); #if defined(__ATARI5200__) || defined(__CREATIVISION__) cprintf ("JOYSTICKS: %d", count); @@ -56,21 +73,21 @@ int main (void) gotoxy (0, i+1); j = joy_read (i); #if defined(__ATARI5200__) || defined(__CREATIVISION__) - cprintf ("%1d:%-3s%-3s%-3s%-3s%-3s%-3s", + cprintf ("%1d:%-3s%-3s%-3s%-3s%-3s %02x", i, JOY_UP(j)? " U " : " - ", JOY_DOWN(j)? " D " : " - ", JOY_LEFT(j)? " L " : " - ", JOY_RIGHT(j)? " R " : " - ", - JOY_BTN_1(j)? " 1 " : " - "); + JOY_BTN_1(j)? " 1 " : " - ", j); #else - cprintf ("%2d: %-6s%-6s%-6s%-6s%-6s%-6s", + cprintf ("%2d: %-6s%-6s%-6s%-6s%-6s %02x", i, JOY_UP(j)? " up " : " ---- ", JOY_DOWN(j)? " down " : " ---- ", JOY_LEFT(j)? " left " : " ---- ", JOY_RIGHT(j)? "right " : " ---- ", - JOY_BTN_1(j)? "button" : " ---- "); + JOY_BTN_1(j)? "button" : " ---- ", j); #endif } } From 38fedfd78bdc81032495365e7cd76665d7b3b14f Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Wed, 7 Mar 2018 00:19:14 +0100 Subject: [PATCH 174/254] also show pressed key, so we can verify keyboard works with the joystick driver --- testcode/lib/joy-test.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/testcode/lib/joy-test.c b/testcode/lib/joy-test.c index 51cbb53e2..167534137 100644 --- a/testcode/lib/joy-test.c +++ b/testcode/lib/joy-test.c @@ -43,6 +43,7 @@ int main (void) unsigned char count; unsigned char i; unsigned char Res; + unsigned char ch, kb; clrscr (); @@ -90,6 +91,14 @@ int main (void) JOY_BTN_1(j)? "button" : " ---- ", j); #endif } + + /* show pressed key, so we can verify keyboard is working */ + kb = kbhit(); + ch = kb ? cgetc() : ' '; + gotoxy (1, i+2); + revers(kb); + cprintf("kbd: %c", ch); + revers(0); } return 0; } From 3afbed48e068f5c467d122229c80c48fe21063c4 Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Wed, 7 Mar 2018 00:20:42 +0100 Subject: [PATCH 175/254] tweak driver to no more use IRQ --- libsrc/c64/joy/c64-hitjoy.s | 48 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/libsrc/c64/joy/c64-hitjoy.s b/libsrc/c64/joy/c64-hitjoy.s index 9f6c0b4dd..3b4a0b909 100644 --- a/libsrc/c64/joy/c64-hitjoy.s +++ b/libsrc/c64/joy/c64-hitjoy.s @@ -73,13 +73,22 @@ UNINSTALL: rts ; ------------------------------------------------------------------------ -; IRQ entry point. Is called from the C layer as a subroutine in the -; interrupt. The routine MUST return carry set if the interrupt has been -; 'handled' - which means that the interrupt source is gone. Otherwise it -; MUST return carry clear. +; COUNT: Return the total number of available joysticks in a/x. +; -IRQ: ; cia 2 setup +COUNT: lda #<JOY_COUNT + ldx #>JOY_COUNT + rts +; ------------------------------------------------------------------------ +; READ: Read a particular joystick passed in A. +; + +readadapter: + + sei + + ; cia 2 setup ldy #$00 ; port b direction sty $dd03 ; => input @@ -143,32 +152,24 @@ IRQ: ; cia 2 setup sta temp4 fire: - ; Default Value: $40/64 on PAL - ; $42/66 on NTSC + ; FIXME: to be really 100% correct this should restore the correct timer + ; values for the respective machine (PAL: $4025, NTSC: $4295) + ; however, this should hardly be a problem in a real world program + lda #$41 sta $dc05 - ; Default Value: $25/37 on PAL - ; $95/149 on NTSC lda #0 sta $dc04 - ; We do never "handle" the interrupt, we use it just as a timer. - clc + cli rts -; ------------------------------------------------------------------------ -; COUNT: Return the total number of available joysticks in a/x. -; +READ: + pha + jsr readadapter + pla -COUNT: lda #<JOY_COUNT - ldx #>JOY_COUNT - rts - -; ------------------------------------------------------------------------ -; READ: Read a particular joystick passed in A. -; - -READ: tax ; Joystick number into X + tax ; Joystick number into X bne joy2 ; Read joystick 1 @@ -214,4 +215,3 @@ joy4: lda temp4 eor #$1F ldx #0 rts - From 2418c0e0af7d070e0748c58cfa0f77ab54bff4a2 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Tue, 6 Mar 2018 18:00:36 -0800 Subject: [PATCH 176/254] Updated documentation for the reu emd. --- doc/c128.sgml | 6 ++---- doc/c64.sgml | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/doc/c128.sgml b/doc/c128.sgml index 460621be0..f133d8d4c 100644 --- a/doc/c128.sgml +++ b/doc/c128.sgml @@ -221,10 +221,8 @@ missing on VDC, and are translated to the two colors missing from the VIC palett Will test the hardware for the available RAM. <tag><tt/c128-reu.emd (c128_reu_emd)/</tag> - A driver for the CBM REUs. The driver will determine from the connected REU - if it supports 128KB of RAM or more. In the latter case, 256KB are assumed, - but since there are no range checks, the application can use more memory if - it has better knowledge about the hardware than the driver. + A driver for the CBM REUs. The driver will test the connected REU to find + out how much RAM is present. <tag><tt/c128-vdc.emd (c128_vdc_emd)/</tag> A driver for the VDC memory of the C128, written and contributed by Maciej diff --git a/doc/c64.sgml b/doc/c64.sgml index 9ab9b96c3..7cca1aa09 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -300,10 +300,8 @@ Note that the graphics drivers are incompatible with the Will test the hardware for the available RAM. <tag><tt/c64-reu.emd (c64_reu_emd)/</tag> - A driver for the CBM REUs. The driver will determine from the connected REU - if it supports 128KB of RAM or more. In the latter case, 256KB are assumed, - but since there are no range checks, the application can use more memory if - it has better knowledge about the hardware than the driver. + A driver for the CBM REUs. The driver will test the connected REU to find + out how much RAM is present. <tag><tt/c64-vdc.emd (c64_vdc_emd)/</tag> A driver for the VDC memory of the C128. Written and contributed by Maciej From a32c50a6bc4e8e23e9f8e3178304fc4c9717aaa6 Mon Sep 17 00:00:00 2001 From: Piotr Fusik <fox@scene.pl> Date: Wed, 7 Mar 2018 20:45:50 +0100 Subject: [PATCH 177/254] Optimize deceaxy. --- libsrc/runtime/ldec.s | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/libsrc/runtime/ldec.s b/libsrc/runtime/ldec.s index 53b60095d..ee7ed3fd4 100644 --- a/libsrc/runtime/ldec.s +++ b/libsrc/runtime/ldec.s @@ -1,5 +1,6 @@ ; -; Ullrich von Bassewitz, 29.12.1999 +; Piotr Fusik, 07.03.2018 +; originally by Ullrich von Bassewitz ; ; CC65 runtime: Decrement eax by value in Y ; @@ -11,16 +12,13 @@ deceaxy: sty tmp1 sec sbc tmp1 - sta tmp1 - txa - sbc #0 - tax - lda sreg - sbc #0 - sta sreg - lda sreg+1 - sbc #0 - sta sreg+1 - lda tmp1 - rts + bcs @L9 + dex + cpx #$ff + bne @L9 + dec sreg + cpx sreg + bne @L9 + dec sreg+1 +@L9: rts From 5251b67d73c2977412aaed6da2d3769b6be57003 Mon Sep 17 00:00:00 2001 From: Piotr Fusik <fox@scene.pl> Date: Wed, 7 Mar 2018 21:01:29 +0100 Subject: [PATCH 178/254] Fix comment typos. --- libsrc/runtime/incaxy.s | 2 +- libsrc/runtime/incsp2.s | 2 +- libsrc/runtime/jmpvec.s | 2 +- libsrc/runtime/mulax3.s | 2 +- libsrc/runtime/mulax5.s | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libsrc/runtime/incaxy.s b/libsrc/runtime/incaxy.s index 0ee7d879f..faeacf709 100644 --- a/libsrc/runtime/incaxy.s +++ b/libsrc/runtime/incaxy.s @@ -1,7 +1,7 @@ ; ; Ullrich von Bassewitz, 05.08.1998 ; -; CC65 runtime: Increment ax by valie in y +; CC65 runtime: Increment ax by value in y ; .export incaxy, incax4 diff --git a/libsrc/runtime/incsp2.s b/libsrc/runtime/incsp2.s index 067154b86..0ed0ffcdf 100644 --- a/libsrc/runtime/incsp2.s +++ b/libsrc/runtime/incsp2.s @@ -2,7 +2,7 @@ ; Ullrich von Bassewitz, 25.10.2000 ; ; CC65 runtime: Increment the stackpointer by 2. For performance reasons, -; this modules does also contain the popax function. +; this module also contains the popax function. .export popax, incsp2 .importzp sp diff --git a/libsrc/runtime/jmpvec.s b/libsrc/runtime/jmpvec.s index ed77a0789..29a18b1db 100644 --- a/libsrc/runtime/jmpvec.s +++ b/libsrc/runtime/jmpvec.s @@ -1,7 +1,7 @@ ; ; Ullrich von Bassewitz, 2002-12-26 ; -; CC65 runtime: Jump vector that resides in the data segment so it's address +; CC65 runtime: Jump vector that resides in the data segment so its address ; may be patched at runtime. ; diff --git a/libsrc/runtime/mulax3.s b/libsrc/runtime/mulax3.s index c35b05dcc..472bc60ec 100644 --- a/libsrc/runtime/mulax3.s +++ b/libsrc/runtime/mulax3.s @@ -1,7 +1,7 @@ ; ; Ullrich von Bassewitz, 04.10.2001 ; -; CC65 runtime: Multiply the primary register +; CC65 runtime: Multiply the primary register by 3 ; .export mulax3 diff --git a/libsrc/runtime/mulax5.s b/libsrc/runtime/mulax5.s index 9af599806..7e5ed11d9 100644 --- a/libsrc/runtime/mulax5.s +++ b/libsrc/runtime/mulax5.s @@ -1,7 +1,7 @@ ; ; Ullrich von Bassewitz, 04.10.2001 ; -; CC65 runtime: Multiply the primary register +; CC65 runtime: Multiply the primary register by 5 ; .export mulax5 From 8e759067376d6c45e5d11d5af274eaea42ca9403 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Wed, 7 Mar 2018 23:04:33 +0100 Subject: [PATCH 179/254] Switched Apple II output format to AppleSingle. Although the primary target OS for the Apple II for sure isn't DOS 3.3 but ProDOS 8 the Apple II binary files contained a DOS 3.3 4-byte header. Recently I was made aware of the AppleSingle file format. That format is a much better way to transport Apple II meta data from the cc65 toolchain to the ProDOS 8 file system. Therefore I asked AppleCommander to support the AppleSingle file format. Now that there's an AppleCommander BETA with AppleSingle support it's the right time for this change. I bumped version to 2.17 because of this from the perspective of Apple II users of course incompatible change. --- cfg/apple2-asm.cfg | 5 +++- cfg/apple2-hgr.cfg | 3 ++- cfg/apple2-overlay.cfg | 13 ++++++----- cfg/apple2-system.cfg | 14 ++++++++---- cfg/apple2.cfg | 3 ++- cfg/apple2enh-asm.cfg | 5 +++- cfg/apple2enh-hgr.cfg | 3 ++- cfg/apple2enh-overlay.cfg | 13 ++++++----- cfg/apple2enh-system.cfg | 14 ++++++++---- cfg/apple2enh.cfg | 3 ++- doc/apple2.sgml | 48 +++++++++++++++++---------------------- doc/apple2enh.sgml | 48 +++++++++++++++++---------------------- doc/intro.sgml | 13 +++++------ libsrc/apple2/exehdr.s | 32 ++++++++++++++++++++++---- samples/Makefile | 8 +++---- src/common/version.c | 2 +- 16 files changed, 129 insertions(+), 98 deletions(-) diff --git a/cfg/apple2-asm.cfg b/cfg/apple2-asm.cfg index 8e5abefc5..76bca1b86 100644 --- a/cfg/apple2-asm.cfg +++ b/cfg/apple2-asm.cfg @@ -3,9 +3,12 @@ FEATURES { STARTADDRESS: default = $0803; } +SYMBOLS { + __FILETYPE__: type = weak, value = $0006; # ProDOS file type +} MEMORY { ZP: file = "", start = $0000, size = $00FF; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S, size = $C000 - %S; BSS: file = "", start = __MAIN_LAST__, size = $C000 - __MAIN_LAST__; } diff --git a/cfg/apple2-hgr.cfg b/cfg/apple2-hgr.cfg index b11dd12bc..3ccf7b6f3 100644 --- a/cfg/apple2-hgr.cfg +++ b/cfg/apple2-hgr.cfg @@ -5,6 +5,7 @@ FEATURES { } SYMBOLS { __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $0006; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $9600; # Presumed RAM end __LCADDR__: type = weak, value = $D400; # Behind quit code @@ -12,7 +13,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; diff --git a/cfg/apple2-overlay.cfg b/cfg/apple2-overlay.cfg index d5476d264..a0b7678c1 100644 --- a/cfg/apple2-overlay.cfg +++ b/cfg/apple2-overlay.cfg @@ -1,10 +1,10 @@ # Configuration for overlay programs (overlays located below main program) -# The overlay files don't include the 4 byte DOS 3.3 header so use AppleCommander like this: -# java -jar ac.jar -cc65 mydisk.dsk myprog bin < myprog -# java -jar ac.jar -p mydisk.dsk myprog.1 bin < myprog.1 -# java -jar ac.jar -p mydisk.dsk myprog.2 bin < myprog.2 -# java -jar ac.jar -p mydisk.dsk myprog.3 bin < myprog.3 +# The overlay files are raw binary files so use AppleCommander like this: +# java -jar ac.jar -as mydisk.dsk myprog < myprog +# java -jar ac.jar -p mydisk.dsk myprog.1 bin < myprog.1 +# java -jar ac.jar -p mydisk.dsk myprog.2 bin < myprog.2 +# java -jar ac.jar -p mydisk.dsk myprog.3 bin < myprog.3 # ... FEATURES { @@ -12,6 +12,7 @@ FEATURES { } SYMBOLS { __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $0006; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $9600; # Presumed RAM end __LCADDR__: type = weak, value = $D400; # Behind quit code @@ -20,7 +21,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __OVERLAYSIZE__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; diff --git a/cfg/apple2-system.cfg b/cfg/apple2-system.cfg index f4684d9c2..0170feb93 100644 --- a/cfg/apple2-system.cfg +++ b/cfg/apple2-system.cfg @@ -1,18 +1,22 @@ -# Configuration for ProDOS 8 system programs (without the header) +# Configuration for ProDOS 8 system programs (allowing for 3KB in LC) SYMBOLS { + __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $00FF; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __LCADDR__: type = weak, value = $D400; # Behind quit code __LCSIZE__: type = weak, value = $0C00; # Rest of bank two } MEMORY { - ZP: file = "", define = yes, start = $0080, size = $001A; - MAIN: file = %O, start = $2000, size = $BF00 - $2000; - BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__; - LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; + ZP: file = "", define = yes, start = $0080, size = $001A; + HEADER: file = %O, start = $2000 - $003A, size = $003A; + MAIN: file = %O, define = yes, start = $2000, size = $BF00 - $2000; + BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__; + LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; diff --git a/cfg/apple2.cfg b/cfg/apple2.cfg index bbe45839d..a6809cf89 100644 --- a/cfg/apple2.cfg +++ b/cfg/apple2.cfg @@ -5,6 +5,7 @@ FEATURES { } SYMBOLS { __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $0006; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $9600; # Presumed RAM end __LCADDR__: type = weak, value = $D400; # Behind quit code @@ -12,7 +13,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; diff --git a/cfg/apple2enh-asm.cfg b/cfg/apple2enh-asm.cfg index 8e5abefc5..76bca1b86 100644 --- a/cfg/apple2enh-asm.cfg +++ b/cfg/apple2enh-asm.cfg @@ -3,9 +3,12 @@ FEATURES { STARTADDRESS: default = $0803; } +SYMBOLS { + __FILETYPE__: type = weak, value = $0006; # ProDOS file type +} MEMORY { ZP: file = "", start = $0000, size = $00FF; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S, size = $C000 - %S; BSS: file = "", start = __MAIN_LAST__, size = $C000 - __MAIN_LAST__; } diff --git a/cfg/apple2enh-hgr.cfg b/cfg/apple2enh-hgr.cfg index b11dd12bc..3ccf7b6f3 100644 --- a/cfg/apple2enh-hgr.cfg +++ b/cfg/apple2enh-hgr.cfg @@ -5,6 +5,7 @@ FEATURES { } SYMBOLS { __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $0006; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $9600; # Presumed RAM end __LCADDR__: type = weak, value = $D400; # Behind quit code @@ -12,7 +13,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; diff --git a/cfg/apple2enh-overlay.cfg b/cfg/apple2enh-overlay.cfg index d5476d264..a0b7678c1 100644 --- a/cfg/apple2enh-overlay.cfg +++ b/cfg/apple2enh-overlay.cfg @@ -1,10 +1,10 @@ # Configuration for overlay programs (overlays located below main program) -# The overlay files don't include the 4 byte DOS 3.3 header so use AppleCommander like this: -# java -jar ac.jar -cc65 mydisk.dsk myprog bin < myprog -# java -jar ac.jar -p mydisk.dsk myprog.1 bin < myprog.1 -# java -jar ac.jar -p mydisk.dsk myprog.2 bin < myprog.2 -# java -jar ac.jar -p mydisk.dsk myprog.3 bin < myprog.3 +# The overlay files are raw binary files so use AppleCommander like this: +# java -jar ac.jar -as mydisk.dsk myprog < myprog +# java -jar ac.jar -p mydisk.dsk myprog.1 bin < myprog.1 +# java -jar ac.jar -p mydisk.dsk myprog.2 bin < myprog.2 +# java -jar ac.jar -p mydisk.dsk myprog.3 bin < myprog.3 # ... FEATURES { @@ -12,6 +12,7 @@ FEATURES { } SYMBOLS { __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $0006; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $9600; # Presumed RAM end __LCADDR__: type = weak, value = $D400; # Behind quit code @@ -20,7 +21,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __OVERLAYSIZE__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; diff --git a/cfg/apple2enh-system.cfg b/cfg/apple2enh-system.cfg index f4684d9c2..0170feb93 100644 --- a/cfg/apple2enh-system.cfg +++ b/cfg/apple2enh-system.cfg @@ -1,18 +1,22 @@ -# Configuration for ProDOS 8 system programs (without the header) +# Configuration for ProDOS 8 system programs (allowing for 3KB in LC) SYMBOLS { + __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $00FF; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __LCADDR__: type = weak, value = $D400; # Behind quit code __LCSIZE__: type = weak, value = $0C00; # Rest of bank two } MEMORY { - ZP: file = "", define = yes, start = $0080, size = $001A; - MAIN: file = %O, start = $2000, size = $BF00 - $2000; - BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__; - LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; + ZP: file = "", define = yes, start = $0080, size = $001A; + HEADER: file = %O, start = $2000 - $003A, size = $003A; + MAIN: file = %O, define = yes, start = $2000, size = $BF00 - $2000; + BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__; + LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; diff --git a/cfg/apple2enh.cfg b/cfg/apple2enh.cfg index bbe45839d..a6809cf89 100644 --- a/cfg/apple2enh.cfg +++ b/cfg/apple2enh.cfg @@ -5,6 +5,7 @@ FEATURES { } SYMBOLS { __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $0006; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $9600; # Presumed RAM end __LCADDR__: type = weak, value = $D400; # Behind quit code @@ -12,7 +13,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; diff --git a/doc/apple2.sgml b/doc/apple2.sgml index 43651c7fa..eef0eed3d 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -34,20 +34,14 @@ more information. <sect>Binary format<p> The standard binary file format generated by the linker for the -Apple ][ target is a binary program with a 4 byte DOS 3.3 header -containing the load address and load length. The default load address is -$803. +Apple ][ target is an <url name="AppleSingle" +url="http://kaiser-edv.de/documents/AppleSingle_AppleDouble.pdf"> file. +The default load address is $803. -<bf/AppleCommander 1.3.5/ or later (available at <url -url="https://applecommander.github.io/">) includes the option <tt/-cc65/ -that allows to put binary files with a DOS 3.3 header onto disk images -containing DOS 3.3 as well as ProDOS 8. - -For ProDOS 8 system programs the load address is fixed to $2000 so there -is no need for a header. Thus the linker configuration -<ref id="apple-sys-cfg" name="apple2-system.cfg"> for those programs -omits the DOS 3.3 header. The right AppleCommander option to put system files -without a header on a ProDOS 8 disk image is <tt/-p/. +<bf/AppleCommander 1.4.0/ or later (available at <url +url="https://applecommander.github.io/">) includes the option <tt/-as/ that +allows to put AppleSingle files onto disk images containing DOS 3.3 as well +as ProDOS 8. <sect>Memory layout<p> @@ -121,9 +115,8 @@ Parameters: <tag><tt/STARTADDRESS:/ Program start address</tag> Default: $803. Use <tt/-S <addr>/ to set a different start address. - <tag><tt/__EXEHDR__:/ Executable file header</tag> - Default: DOS 3.3 header (address and length). Use <tt/-D __EXEHDR__=0/ to omit - the header. + <tag><tt/__EXEHDR__:/ AppleSingle executable file header</tag> + Default: Yes. Use <tt/-D __EXEHDR__=0/ to omit the AppleSingle header. <tag><tt/__STACKSIZE__:/ C runtime stack size</tag> Default: $800. Use <tt/-D __STACKSIZE__=<size>/ to set a different @@ -153,6 +146,9 @@ Parameters: <descrip> + <tag><tt/__EXEHDR__:/ AppleSingle executable file header</tag> + Default: Yes. Use <tt/-D __EXEHDR__=0/ to omit the AppleSingle header. + <tag><tt/__STACKSIZE__:/ C runtime stack size</tag> Default: $800. Use <tt/-D __STACKSIZE__=<size>/ to set a different stack size. @@ -180,9 +176,8 @@ Parameters: <tag><tt/STARTADDRESS:/ Program start address</tag> Default: $803. Use <tt/-S <addr>/ to set a different start address. - <tag><tt/__EXEHDR__:/ Executable file header</tag> - Default: DOS 3.3 header (address and length). Use <tt/-D __EXEHDR__=0/ to omit - the header. + <tag><tt/__EXEHDR__:/ AppleSingle executable file header</tag> + Default: Yes. Use <tt/-D __EXEHDR__=0/ to omit the AppleSingle header. <tag><tt/__STACKSIZE__:/ C runtime stack size</tag> Default: $800. Use <tt/-D __STACKSIZE__=<size>/ to set a different @@ -206,7 +201,7 @@ Parameters: <sect1><tt/apple2-overlay.cfg/<p> Configuration for an overlay program with up to nine overlays. The overlay files -don't include the DOS 3.3 header. See <tt>samples/overlaydemo.c</tt> for more +don't include the AppleSingle header. See <tt>samples/overlaydemo.c</tt> for more information on overlays. Parameters: @@ -216,9 +211,8 @@ Parameters: <tag><tt/STARTADDRESS:/ Program start address</tag> Default: $803. Use <tt/-S <addr>/ to set a different start address. - <tag><tt/__EXEHDR__:/ Executable file header</tag> - Default: DOS 3.3 header (address and length). Use <tt/-D __EXEHDR__=0/ to omit - the header. + <tag><tt/__EXEHDR__:/ AppleSingle executable file header</tag> + Default: Yes. Use <tt/-D __EXEHDR__=0/ to omit the AppleSingle header. <tag><tt/__STACKSIZE__:/ C runtime stack size</tag> Default: $800. Use <tt/-D __STACKSIZE__=<size>/ to set a different @@ -254,9 +248,8 @@ Parameters: <tag><tt/STARTADDRESS:/ Program start address</tag> Default: $803. Use <tt/-S <addr>/ to set a different start address. - <tag><tt/__EXEHDR__:/ Executable file header</tag> - Default: No header. Use <tt/-u __EXEHDR__ apple2.lib/ to add a DOS 3.3 header - (address and length). + <tag><tt/__EXEHDR__:/ AppleSingle executable file header</tag> + Default: No. Use <tt/-u __EXEHDR__ apple2.lib/ to add the AppleSingle header. </descrip><p> @@ -281,7 +274,8 @@ program (i.e. quits to the ProDOS dispatcher). Using LOADER.SYSTEM is as simple as copying it to the ProDOS 8 directory of the program to load under name <program>.SYSTEM as a system program. For -example the program <tt/MYPROG/ is loaded by <tt/MYPROG.SYSTEM/. +example the program <tt/MYPROG/ is loaded by <tt/MYPROG.SYSTEM/. The right +AppleCommander option to put LOADER.SYSTEM on a ProDOS 8 disk image is <tt/-p/. <sect1>Heap<p> diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml index 3f335d028..b40523aba 100644 --- a/doc/apple2enh.sgml +++ b/doc/apple2enh.sgml @@ -34,20 +34,14 @@ more information. <sect>Binary format<p> The standard binary file format generated by the linker for the -enhanced Apple //e target is a binary program with a 4 byte DOS 3.3 header -containing the load address and load length. The default load address is -$803. +enhanced Apple //e target is an <url name="AppleSingle" +url="http://kaiser-edv.de/documents/AppleSingle_AppleDouble.pdf"> file. +The default load address is $803. -<bf/AppleCommander 1.3.5/ or later (available at <url -url="https://applecommander.github.io/">) includes the option <tt/-cc65/ -that allows to put binary files with a DOS 3.3 header onto disk images -containing DOS 3.3 as well as ProDOS 8. - -For ProDOS 8 system programs the load address is fixed to $2000 so there -is no need for a header. Thus the linker configuration -<ref id="apple-sys-cfg" name="apple2enh-system.cfg"> for those programs -omits the DOS 3.3 header. The right AppleCommander option to put system files -without a header on a ProDOS 8 disk image is <tt/-p/. +<bf/AppleCommander 1.4.0/ or later (available at <url +url="https://applecommander.github.io/">) includes the option <tt/-as/ that +allows to put AppleSingle files onto disk images containing DOS 3.3 as well +as ProDOS 8. <sect>Memory layout<p> @@ -121,9 +115,8 @@ Parameters: <tag><tt/STARTADDRESS:/ Program start address</tag> Default: $803. Use <tt/-S <addr>/ to set a different start address. - <tag><tt/__EXEHDR__:/ Executable file header</tag> - Default: DOS 3.3 header (address and length). Use <tt/-D __EXEHDR__=0/ to omit - the header. + <tag><tt/__EXEHDR__:/ AppleSingle executable file header</tag> + Default: Yes. Use <tt/-D __EXEHDR__=0/ to omit the AppleSingle header. <tag><tt/__STACKSIZE__:/ C runtime stack size</tag> Default: $800. Use <tt/-D __STACKSIZE__=<size>/ to set a different @@ -153,6 +146,9 @@ Parameters: <descrip> + <tag><tt/__EXEHDR__:/ AppleSingle executable file header</tag> + Default: Yes. Use <tt/-D __EXEHDR__=0/ to omit the AppleSingle header. + <tag><tt/__STACKSIZE__:/ C runtime stack size</tag> Default: $800. Use <tt/-D __STACKSIZE__=<size>/ to set a different stack size. @@ -180,9 +176,8 @@ Parameters: <tag><tt/STARTADDRESS:/ Program start address</tag> Default: $803. Use <tt/-S <addr>/ to set a different start address. - <tag><tt/__EXEHDR__:/ Executable file header</tag> - Default: DOS 3.3 header (address and length). Use <tt/-D __EXEHDR__=0/ to omit - the header. + <tag><tt/__EXEHDR__:/ AppleSingle executable file header</tag> + Default: Yes. Use <tt/-D __EXEHDR__=0/ to omit the AppleSingle header. <tag><tt/__STACKSIZE__:/ C runtime stack size</tag> Default: $800. Use <tt/-D __STACKSIZE__=<size>/ to set a different @@ -206,7 +201,7 @@ Parameters: <sect1><tt/apple2enh-overlay.cfg/<p> Configuration for an overlay program with up to nine overlays. The overlay files -don't include the DOS 3.3 header. See <tt>samples/overlaydemo.c</tt> for more +don't include the AppleSingle header. See <tt>samples/overlaydemo.c</tt> for more information on overlays. Parameters: @@ -216,9 +211,8 @@ Parameters: <tag><tt/STARTADDRESS:/ Program start address</tag> Default: $803. Use <tt/-S <addr>/ to set a different start address. - <tag><tt/__EXEHDR__:/ Executable file header</tag> - Default: DOS 3.3 header (address and length). Use <tt/-D __EXEHDR__=0/ to omit - the header. + <tag><tt/__EXEHDR__:/ AppleSingle executable file header</tag> + Default: Yes. Use <tt/-D __EXEHDR__=0/ to omit the AppleSingle header. <tag><tt/__STACKSIZE__:/ C runtime stack size</tag> Default: $800. Use <tt/-D __STACKSIZE__=<size>/ to set a different @@ -254,9 +248,8 @@ Parameters: <tag><tt/STARTADDRESS:/ Program start address</tag> Default: $803. Use <tt/-S <addr>/ to set a different start address. - <tag><tt/__EXEHDR__:/ Executable file header</tag> - Default: No header. Use <tt/-u __EXEHDR__ apple2enh.lib/ to add a DOS 3.3 header - (address and length). + <tag><tt/__EXEHDR__:/ AppleSingle executable file header</tag> + Default: No. Use <tt/-u __EXEHDR__ apple2enh.lib/ to add the AppleSingle header. </descrip><p> @@ -281,7 +274,8 @@ program (i.e. quits to the ProDOS dispatcher). Using LOADER.SYSTEM is as simple as copying it to the ProDOS 8 directory of the program to load under name <program>.SYSTEM as a system program. For -example the program <tt/MYPROG/ is loaded by <tt/MYPROG.SYSTEM/. +example the program <tt/MYPROG/ is loaded by <tt/MYPROG.SYSTEM/. The right +AppleCommander option to put LOADER.SYSTEM on a ProDOS 8 disk image is <tt/-p/. <sect1>Heap<p> diff --git a/doc/intro.sgml b/doc/intro.sgml index bb8965c60..47516e671 100644 --- a/doc/intro.sgml +++ b/doc/intro.sgml @@ -246,13 +246,13 @@ varies in its start and exit conditions. <sect2>AppleWin<p> Available at <url -url="http://applewin.berlios.de/">: +url="https://github.com/AppleWin/AppleWin">: Emulates Apple ][/enhanced Apple //e computers, with sound, video, joysticks, serial port, and disk images. Includes monitor. Only for Windows. The package comes with a DOS 3.3 disk (called "master.dsk") image; -however, you will need <bf/AppleCommander 1.3.5/ or later (available at <url -url="http://applecommander.sourceforge.net/">). +however, you will need <bf/AppleCommander 1.4.0/ or later (available at <url +url="https://applecommander.github.io/">). Compile the tutorial with @@ -270,14 +270,13 @@ the <tt/master.dsk/ which comes with <bf/AppleWin/, and rename it to <tt/cc65.dsk/, then use <bf/AppleCommander/: <tscreen><verb> -java -jar ac.jar -cc65 cc65.dsk test B < hello +java -jar ac.jar -as cc65.dsk test < hello </verb></tscreen> Note that a convention in the Apple world is that "hello" is the file which is run automatically upon booting a DOS disk, sort of like the "autoexec.bat" of -the MSDOS/Windows world. We've avoided that in the example, however. Also, -the <tt/B/ parameter must be in caps., and "test" is the name of the program as -it will appear on the Apple disk. +the MSDOS/Windows world. We've avoided that in the example, however by using +"test" as the name of the program as it will appear on the Apple disk. Start the emulator, click on the <bf/Disk 1/ icon, and point to <bf/cc65.dsk/; then, click the big Apple logo, to boot the system. Then, type this on the diff --git a/libsrc/apple2/exehdr.s b/libsrc/apple2/exehdr.s index 778eee903..72ea390e9 100644 --- a/libsrc/apple2/exehdr.s +++ b/libsrc/apple2/exehdr.s @@ -1,16 +1,40 @@ ; ; Oliver Schmidt, 2012-06-10 ; -; This module supplies a 4 byte DOS 3.3 header -; containing the load address and load length. +; This module supplies an AppleSingle version 2 file header + entry with +; ID 11 according to https://tools.ietf.org/rfc/rfc1740.txt Appendix A. ; .export __EXEHDR__ : absolute = 1 ; Linker referenced + .import __FILETYPE__ ; Linker generated .import __MAIN_START__, __MAIN_LAST__ ; Linker generated +; ------------------------------------------------------------------------ + +; Data Fork +ID01_LENGTH = __MAIN_LAST__ - __MAIN_START__ +ID01_OFFSET = ID01 - START + +; ProDOS File Info +ID11_LENGTH = ID01 - ID11 +ID11_OFFSET = ID11 - START + ; ------------------------------------------------------------------------ .segment "EXEHDR" - .addr __MAIN_START__ ; Load address - .word __MAIN_LAST__ - __MAIN_START__ ; Load length +START: .byte $00, $05, $16, $00 ; Magic number + .byte $00, $02, $00, $00 ; Version number + .res 16 ; Filler + .byte 0, 2 ; Number of entries + .byte 0, 0, 0, 1 ; Entry ID 1 - Data Fork + .byte 0, 0, >ID01_OFFSET, <ID01_OFFSET ; Offset + .byte 0, 0, >ID01_LENGTH, <ID01_LENGTH ; Length + .byte 0, 0, 0, 11 ; Entry ID 11 - ProDOS File Info + .byte 0, 0, >ID11_OFFSET, <ID11_OFFSET ; Offset + .byte 0, 0, >ID11_LENGTH, <ID11_LENGTH ; Length +ID11: .byte 0, %11000011 ; Access - Destroy, Rename, Write, Read + .byte >__FILETYPE__, <__FILETYPE__ ; File Type + .byte 0, 0 ; Auxiliary Type high + .byte >__MAIN_START__, <__MAIN_START__ ; Auxiliary Type low +ID01: diff --git a/samples/Makefile b/samples/Makefile index 2bcfa08c3..6a6d93bc1 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -188,15 +188,15 @@ samples.d64: samples $(foreach file,$(EMD) $(MOU) $(TGI),$(D64_WRITE_recipe)) # -------------------------------------------------------------------------- -# Rule to make an Apple II disk with all samples. Needs the Apple Commander -# program available at http://applecommander.sourceforge.net/ and a template -# disk named 'prodos.dsk'. +# Rule to make an Apple II disk with all samples. Needs the AppleCommander +# program available at https://applecommander.github.io/ and a template disk +# named 'prodos.dsk'. define DSK_WRITE_BIN_recipe $(if $(findstring BF00,$(LDFLAGS_$(notdir $(file))_$(SYS))), \ java -jar $(AC) -p $@ $(notdir $(file)).system sys <$(TARGET_PATH)/$(SYS)/util/loader.system) -java -jar $(AC) -cc65 $@ $(notdir $(file)) bin <$(file) +java -jar $(AC) -as $@ $(notdir $(file)) <$(file) endef # DSK_WRITE_BIN_recipe diff --git a/src/common/version.c b/src/common/version.c index bf0a6bf71..1f1e8093e 100644 --- a/src/common/version.c +++ b/src/common/version.c @@ -47,7 +47,7 @@ #define VER_MAJOR 2U -#define VER_MINOR 16U +#define VER_MINOR 17U From 85e480db3d0623c5b313c5eb3c5976cc3d6f89d7 Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Thu, 8 Mar 2018 04:05:10 +0100 Subject: [PATCH 180/254] style fixes --- testcode/lib/joy-test.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/testcode/lib/joy-test.c b/testcode/lib/joy-test.c index 167534137..3d584bf9d 100644 --- a/testcode/lib/joy-test.c +++ b/testcode/lib/joy-test.c @@ -14,16 +14,16 @@ # define DYN_DRV 0 /* - * link existing drivers like this: - * - * cl65 -DJOYSTICK_DRIVER=c64_hitjoy_joy -o joy-test.prg joy-test.c - * - * for testing a new driver you will have to uncomment the define below, and - * link your driver like this: - * - * co65 ../../target/c64/drv/joy/c64-hitjoy.joy -o hitjoy.s --code-label _hitjoy - * cl65 -DJOYSTICK_DRIVER=hitjoy -o joy-test.prg joy-test.c hitjoy.s - * +** link existing drivers like this: +** +** cl65 -DJOYSTICK_DRIVER=c64_hitjoy_joy -o joy-test.prg joy-test.c +** +** for testing a new driver you will have to uncomment the define below, and +** link your driver like this: +** +** co65 ../../target/c64/drv/joy/c64-hitjoy.joy -o hitjoy.s --code-label _hitjoy +** cl65 -DJOYSTICK_DRIVER=hitjoy -o joy-test.prg joy-test.c hitjoy.s +** */ /* extern char JOYSTICK_DRIVER; */ @@ -93,12 +93,12 @@ int main (void) } /* show pressed key, so we can verify keyboard is working */ - kb = kbhit(); - ch = kb ? cgetc() : ' '; + kb = kbhit (); + ch = kb ? cgetc () : ' '; gotoxy (1, i+2); - revers(kb); - cprintf("kbd: %c", ch); - revers(0); + revers (kb); + cprintf ("kbd: %c", ch); + revers (0); } return 0; } From 970c5f6184ca48a6db7118063ce284855cc63787 Mon Sep 17 00:00:00 2001 From: Piotr Fusik <fox@scene.pl> Date: Thu, 8 Mar 2018 22:10:11 +0100 Subject: [PATCH 181/254] Add comments. --- libsrc/runtime/ldec.s | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libsrc/runtime/ldec.s b/libsrc/runtime/ldec.s index ee7ed3fd4..e7e891119 100644 --- a/libsrc/runtime/ldec.s +++ b/libsrc/runtime/ldec.s @@ -13,12 +13,15 @@ deceaxy: sec sbc tmp1 bcs @L9 +; borrow from X dex cpx #$ff bne @L9 +; X wrapped from zero to $ff, borrow from sreg dec sreg cpx sreg bne @L9 +; sreg wrapped from zero to $ff, borrow from sreg+1 dec sreg+1 @L9: rts From 22d4b0d497e72779bcc328987fc69bca4a402178 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Thu, 8 Mar 2018 16:06:33 -0800 Subject: [PATCH 182/254] Improved tv timing detection for the c64. --- asminc/get_tv.inc | 2 ++ include/cbm.h | 4 +++- libsrc/c64/get_tv.s | 43 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/asminc/get_tv.inc b/asminc/get_tv.inc index 47e0d9c2a..2d4b5b253 100644 --- a/asminc/get_tv.inc +++ b/asminc/get_tv.inc @@ -11,6 +11,8 @@ .enum TV NTSC PAL + NTSC_OLD + PAL_N OTHER .endenum diff --git a/include/cbm.h b/include/cbm.h index 1395f700f..b121050af 100644 --- a/include/cbm.h +++ b/include/cbm.h @@ -150,7 +150,9 @@ struct cbm_dirent { #define TV_NTSC 0 #define TV_PAL 1 -#define TV_OTHER 2 +#define TV_NTSC_OLD 2 +#define TV_PAL_N 3 +#define TV_OTHER 4 unsigned char get_tv (void); /* Return the video mode the machine is using. */ diff --git a/libsrc/c64/get_tv.s b/libsrc/c64/get_tv.s index 4f46b8d64..8c73f6fa4 100644 --- a/libsrc/c64/get_tv.s +++ b/libsrc/c64/get_tv.s @@ -3,6 +3,11 @@ ; ; unsigned char get_tv (void); ; /* Return the video mode the machine is using */ +; +; Changed to actually detect the mode instead of using a flag +; Marco van den Heuvel, 2018-03-08 +; +; The detection goes wrong on accelerated machines for now. ; .include "c64.inc" @@ -13,8 +18,42 @@ .proc _get_tv - lda PALFLAG - ldx #0 + php + sei +timing_loop_0: + lda VIC_HLINE +timing_loop_1: + cmp VIC_HLINE + beq timing_loop_1 + bmi timing_loop_0 + and #$03 + cmp #$01 + bne check_ntsc + lda #TV::NTSC_OLD ; NTSC OLD constant + bne detected +check_ntsc: + cmp #$03 + bcc ntsc + +; check for PAL and PAL-N + + ldx #$00 + lda #$10 +timing_loop_2: + inx + cmp VIC_HLINE + bne timing_loop_2 + lda #TV::PAL ; PAL constant + cpx #$70 + bcc detected + lda #TV::PAL_N ; PAL-N constant +detected: + ldx #$00 + plp rts +ntsc: + lda #TV::NTSC ; NTSC constant + beq detected + .endproc From 18ada212e7dda94d30e7df9b00f58f856bb8fc50 Mon Sep 17 00:00:00 2001 From: Piotr Fusik <fox@scene.pl> Date: Fri, 9 Mar 2018 18:48:24 +0100 Subject: [PATCH 183/254] Fix coding style. --- libsrc/runtime/ldec.s | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/libsrc/runtime/ldec.s b/libsrc/runtime/ldec.s index e7e891119..f8e59d5c0 100644 --- a/libsrc/runtime/ldec.s +++ b/libsrc/runtime/ldec.s @@ -1,5 +1,5 @@ ; -; Piotr Fusik, 07.03.2018 +; Piotr Fusik, 09.03.2018 ; originally by Ullrich von Bassewitz ; ; CC65 runtime: Decrement eax by value in Y @@ -13,15 +13,24 @@ deceaxy: sec sbc tmp1 bcs @L9 -; borrow from X + +; Borrow from X. + dex - cpx #$ff + cpx #$FF bne @L9 -; X wrapped from zero to $ff, borrow from sreg + +; X wrapped from zero to $FF, borrow from sreg. + dec sreg cpx sreg bne @L9 -; sreg wrapped from zero to $ff, borrow from sreg+1 + +; sreg wrapped from zero to $FF, borrow from sreg+1. + dec sreg+1 + +; Done. + @L9: rts From 0eb1eb625fac71db5c0bfd79e6847a29be867d22 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Fri, 9 Mar 2018 10:46:02 -0800 Subject: [PATCH 184/254] Undo my previous commit. --- asminc/get_tv.inc | 2 -- include/cbm.h | 4 +--- libsrc/c64/get_tv.s | 43 ++----------------------------------------- 3 files changed, 3 insertions(+), 46 deletions(-) diff --git a/asminc/get_tv.inc b/asminc/get_tv.inc index 2d4b5b253..47e0d9c2a 100644 --- a/asminc/get_tv.inc +++ b/asminc/get_tv.inc @@ -11,8 +11,6 @@ .enum TV NTSC PAL - NTSC_OLD - PAL_N OTHER .endenum diff --git a/include/cbm.h b/include/cbm.h index b121050af..1395f700f 100644 --- a/include/cbm.h +++ b/include/cbm.h @@ -150,9 +150,7 @@ struct cbm_dirent { #define TV_NTSC 0 #define TV_PAL 1 -#define TV_NTSC_OLD 2 -#define TV_PAL_N 3 -#define TV_OTHER 4 +#define TV_OTHER 2 unsigned char get_tv (void); /* Return the video mode the machine is using. */ diff --git a/libsrc/c64/get_tv.s b/libsrc/c64/get_tv.s index 8c73f6fa4..4f46b8d64 100644 --- a/libsrc/c64/get_tv.s +++ b/libsrc/c64/get_tv.s @@ -3,11 +3,6 @@ ; ; unsigned char get_tv (void); ; /* Return the video mode the machine is using */ -; -; Changed to actually detect the mode instead of using a flag -; Marco van den Heuvel, 2018-03-08 -; -; The detection goes wrong on accelerated machines for now. ; .include "c64.inc" @@ -18,42 +13,8 @@ .proc _get_tv - php - sei -timing_loop_0: - lda VIC_HLINE -timing_loop_1: - cmp VIC_HLINE - beq timing_loop_1 - bmi timing_loop_0 - and #$03 - cmp #$01 - bne check_ntsc - lda #TV::NTSC_OLD ; NTSC OLD constant - bne detected -check_ntsc: - cmp #$03 - bcc ntsc - -; check for PAL and PAL-N - - ldx #$00 - lda #$10 -timing_loop_2: - inx - cmp VIC_HLINE - bne timing_loop_2 - lda #TV::PAL ; PAL constant - cpx #$70 - bcc detected - lda #TV::PAL_N ; PAL-N constant -detected: - ldx #$00 - plp + lda PALFLAG + ldx #0 rts -ntsc: - lda #TV::NTSC ; NTSC constant - beq detected - .endproc From 789ce59fb5489c73739412e6954674523203e466 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Sun, 11 Mar 2018 00:49:40 +0100 Subject: [PATCH 185/254] Added missing PCE conio functions. --- libsrc/pce/cclear.s | 25 +++++++++++++++++++++++++ libsrc/pce/color.s | 10 ++++------ libsrc/pce/wherex.s | 24 ++++++++++++++++++++++++ libsrc/pce/wherey.s | 24 ++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 libsrc/pce/cclear.s create mode 100644 libsrc/pce/wherex.s create mode 100644 libsrc/pce/wherey.s diff --git a/libsrc/pce/cclear.s b/libsrc/pce/cclear.s new file mode 100644 index 000000000..14b9d0e8b --- /dev/null +++ b/libsrc/pce/cclear.s @@ -0,0 +1,25 @@ +; +; Ullrich von Bassewitz, 08.08.1998 +; +; void cclearxy (unsigned char x, unsigned char y, unsigned char length); +; void cclear (unsigned char length); +; + + .export _cclearxy, _cclear + .import gotoxy, cputdirect + .importzp tmp1 + +_cclearxy: + pha ; Save the length + jsr gotoxy ; Call this one, will pop params + pla ; Restore the length and run into _cclear + +_cclear: + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + sta tmp1 +L1: lda #$20 ; Blank - screen code + jsr cputdirect ; Direct output + dec tmp1 + bne L1 +L9: rts diff --git a/libsrc/pce/color.s b/libsrc/pce/color.s index 0ff991a2e..1223d2936 100644 --- a/libsrc/pce/color.s +++ b/libsrc/pce/color.s @@ -5,11 +5,14 @@ ; - .export _textcolor, _bgcolor, _bordercolor + .export _textcolor, _bgcolor, _bordercolor + .import return0 .include "pce.inc" .include "extzp.inc" +_bordercolor = return0 + _textcolor: ldx CHARCOLOR ; get old value sta CHARCOLOR ; set new value @@ -32,11 +35,6 @@ _bgcolor: txa rts -_bordercolor: - lda #0 - tax - rts - .rodata .export colors diff --git a/libsrc/pce/wherex.s b/libsrc/pce/wherex.s new file mode 100644 index 000000000..3abe49cb6 --- /dev/null +++ b/libsrc/pce/wherex.s @@ -0,0 +1,24 @@ +; +; Ullrich von Bassewitz, 2003-05-02 +; +; unsigned char wherex (void); +; + + .export _wherex + + .include "pce.inc" + .include "extzp.inc" + +.proc _wherex + + lda CURS_X + ldx #$00 + rts + +.endproc + +;------------------------------------------------------------------------------- +; force the init constructor to be imported + + .import initconio +conio_init = initconio diff --git a/libsrc/pce/wherey.s b/libsrc/pce/wherey.s new file mode 100644 index 000000000..7061790ab --- /dev/null +++ b/libsrc/pce/wherey.s @@ -0,0 +1,24 @@ +; +; Ullrich von Bassewitz, 2003-05-02 +; +; unsigned char wherey (void); +; + + .export _wherey + + .include "pce.inc" + .include "extzp.inc" + +.proc _wherey + + lda CURS_Y + ldx #$00 + rts + +.endproc + +;------------------------------------------------------------------------------- +; force the init constructor to be imported + + .import initconio +conio_init = initconio From 8b3e12d632f22bfd3c3722d88195dc3ce4acc90a Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Mon, 12 Mar 2018 12:14:25 +0100 Subject: [PATCH 186/254] Added missing ror absolute override. Fixes https://github.com/cc65/cc65/issues/489 as suggested by EtchedPixels. --- src/da65/opc65c02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/da65/opc65c02.c b/src/da65/opc65c02.c index 1351f5eee..8133bccae 100644 --- a/src/da65/opc65c02.c +++ b/src/da65/opc65c02.c @@ -157,7 +157,7 @@ const OpcDesc OpcTable_65C02[256] = { { "", 1, flIllegal, OH_Illegal, }, /* $6b */ { "jmp", 3, flLabel, OH_JmpAbsoluteIndirect }, /* $6c */ { "adc", 3, flUseLabel|flAbsOverride, OH_Absolute }, /* $6d */ - { "ror", 3, flUseLabel, OH_Absolute }, /* $6e */ + { "ror", 3, flUseLabel|flAbsOverride, OH_Absolute }, /* $6e */ { "bbr6", 3, flUseLabel, OH_BitBranch }, /* $6f */ { "bvs", 2, flLabel, OH_Relative }, /* $70 */ { "adc", 2, flUseLabel, OH_DirectIndirectY }, /* $71 */ From 7efd9940f223c84c1ada30294dfd746c5e40604f Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 13 Mar 2018 22:19:19 +0000 Subject: [PATCH 187/254] Added console --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index fa8c4df60..6704eec9b 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ including - newer PET machines (not 2001). - the Apple ]\[+ and successors. - the Atari 8 bit machines. +- the Atari 2600 console. - the Atari 5200 console. - GEOS for the C64, C128 and Apple //e. - the Bit Corporation Gamate console. From 0c7496f08b8a450dc5e963602c72b737687ba544 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Fri, 16 Mar 2018 14:23:52 -0700 Subject: [PATCH 188/254] Added vic20 - ram emd. --- include/vic20.h | 2 +- libsrc/vic20/emd/vic20-rama.s | 258 ++++++++++++++++++++++++++++++++++ libsrc/vic20/libref.s | 2 + 3 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 libsrc/vic20/emd/vic20-rama.s diff --git a/include/vic20.h b/include/vic20.h index c6ad9632d..1e8c4ceb5 100644 --- a/include/vic20.h +++ b/include/vic20.h @@ -105,7 +105,7 @@ extern void vic20_ptvjoy_joy[]; extern void vic20_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ - +extern void vic20_rama_emd[]; /* End of vic20.h */ #endif diff --git a/libsrc/vic20/emd/vic20-rama.s b/libsrc/vic20/emd/vic20-rama.s new file mode 100644 index 000000000..a48959c13 --- /dev/null +++ b/libsrc/vic20/emd/vic20-rama.s @@ -0,0 +1,258 @@ +; +; Extended memory driver for the VIC20 $A000-$BFFF RAM. Driver works without +; problems when statically linked. +; +; Marco van den Heuvel, 2018-03-16 +; + + .include "zeropage.inc" + + .include "em-kernel.inc" + .include "em-error.inc" + + + .macpack generic + .macpack module + + +; ------------------------------------------------------------------------ +; Header. Includes jump table + + module_header _vic20_rama_emd + +; Driver signature + + .byte $65, $6d, $64 ; "emd" + .byte EMD_API_VERSION ; EM API version number + +; Library reference + + .addr $0000 + +; Jump table + + .addr INSTALL + .addr UNINSTALL + .addr PAGECOUNT + .addr MAP + .addr USE + .addr COMMIT + .addr COPYFROM + .addr COPYTO + +; ------------------------------------------------------------------------ +; Constants + +BASE = $A000 +PAGES = ($C000 - BASE) / 256 + +; ------------------------------------------------------------------------ +; Data. + +.bss +curpage: .res 1 ; Current page number +window: .res 256 ; Memory "window" + +.code + +; ------------------------------------------------------------------------ +; INSTALL routine. Is called after the driver is loaded into memory. If +; possible, check if the hardware is present and determine the amount of +; memory available. +; Must return an EM_ERR_xx code in a/x. +; + +INSTALL: + lda $A000 ; see what is at address $A000 + inc $A000 ; see if it can be changed + cmp $A000 ; did it stick ? + beq nomem + dec $A000 + + ldx #$FF + stx curpage ; Invalidate the current page + inx ; X = 0 + txa ; A = X = EM_ERR_OK + rts + +nomem: ldx #>EM_ERR_NO_DEVICE + lda #<EM_ERR_NO_DEVICE +; rts ; Run into UNINSTALL instead + +; ------------------------------------------------------------------------ +; UNINSTALL routine. Is called before the driver is removed from memory. +; Can do cleanup or whatever. Must not return anything. +; + +UNINSTALL: + rts + + +; ------------------------------------------------------------------------ +; PAGECOUNT: Return the total number of available pages in a/x. +; + +PAGECOUNT: + lda #<PAGES + ldx #>PAGES + rts + +; ------------------------------------------------------------------------ +; MAP: Map the page in a/x into memory and return a pointer to the page in +; a/x. The contents of the currently mapped page (if any) may be discarded +; by the driver. +; + +MAP: sta curpage ; Remember the new page + + clc + adc #>BASE + sta ptr1+1 + ldy #$00 + sty ptr1 + + lda #<window + sta ptr2 + lda #>window + sta ptr2+1 + +; Transfer one page + + jsr transfer ; Transfer one page + +; Return the memory window + + lda #<window + ldx #>window ; Return the window address + rts + +; ------------------------------------------------------------------------ +; USE: Tell the driver that the window is now associated with a given page. + +USE: sta curpage ; Remember the page + lda #<window + ldx #>window ; Return the window + rts + +; ------------------------------------------------------------------------ +; COMMIT: Commit changes in the memory window to extended storage. + +COMMIT: lda curpage ; Get the current page + bmi done ; Jump if no page mapped + + clc + adc #>BASE + sta ptr2+1 + ldy #$00 + sty ptr2 + + lda #<window + sta ptr1 + lda #>window + sta ptr1+1 + +; Transfer one page. Y must be zero on entry + +transfer: + +; Unroll the following loop + +loop: .repeat 8 + lda (ptr1),y + sta (ptr2),y + iny + .endrepeat + + bne loop + +; Done + +done: rts + +; ------------------------------------------------------------------------ +; COPYFROM: Copy from extended into linear memory. A pointer to a structure +; describing the request is passed in a/x. +; The function must not return anything. +; + +COPYFROM: + sta ptr3 + stx ptr3+1 ; Save the passed em_copy pointer + + ldy #EM_COPY::OFFS + lda (ptr3),y + sta ptr1 + ldy #EM_COPY::PAGE + lda (ptr3),y + clc + adc #>BASE + sta ptr1+1 ; From + + ldy #EM_COPY::BUF + lda (ptr3),y + sta ptr2 + iny + lda (ptr3),y + sta ptr2+1 ; To + +common: ldy #EM_COPY::COUNT+1 + lda (ptr3),y ; Get number of pages + beq @L2 ; Skip if no full pages + sta tmp1 + +; Copy full pages allowing interrupts after each page copied + + ldy #$00 +@L1: jsr transfer + inc ptr1+1 + inc ptr2+1 + dec tmp1 + bne @L1 + +; Copy the remainder of the page + +@L2: ldy #EM_COPY::COUNT + lda (ptr3),y ; Get bytes in last page + beq @L4 + tax + +; Transfer the bytes in the last page + + ldy #$00 +@L3: lda (ptr1),y + sta (ptr2),y + iny + dex + bne @L3 + +; Done + +@L4: rts + +; ------------------------------------------------------------------------ +; COPYTO: Copy from linear into extended memory. A pointer to a structure +; describing the request is passed in a/x. +; The function must not return anything. +; + +COPYTO: sta ptr3 + stx ptr3+1 ; Save the passed em_copy pointer + + ldy #EM_COPY::OFFS + lda (ptr3),y + sta ptr2 + ldy #EM_COPY::PAGE + lda (ptr3),y + clc + adc #>BASE + sta ptr2+1 ; To + + ldy #EM_COPY::BUF + lda (ptr3),y + sta ptr1 + iny + lda (ptr3),y + sta ptr1+1 ; From + + jmp common + diff --git a/libsrc/vic20/libref.s b/libsrc/vic20/libref.s index e4afa7eb1..468c540f1 100644 --- a/libsrc/vic20/libref.s +++ b/libsrc/vic20/libref.s @@ -3,6 +3,8 @@ ; .export joy_libref + .export em_libref .import _exit joy_libref := _exit +em_libref := _exit From 12f72a5ed70ec45d5e037089a4eea6d08d037dee Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sat, 17 Mar 2018 09:25:42 -0700 Subject: [PATCH 189/254] Added vic20 emd documentation. --- doc/vic20.sgml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/vic20.sgml b/doc/vic20.sgml index 26a4aa558..9f96cd388 100644 --- a/doc/vic20.sgml +++ b/doc/vic20.sgml @@ -147,7 +147,9 @@ No graphics drivers are currently available for the VIC20. <sect1>Extended memory drivers<p> -No extended memory drivers are currently available for the VIC20. + <tag><tt/vic20-rama.emd (vic20_rama_emd)/</tag> + A driver for any RAM at $A000-$BFFF. Supports 32 256 byte pages. + Written and contributed by Marco van den Heuvel. <sect1>Joystick drivers<p> From 4fdc2d7209612ffe94df4c4bf5acca52122e6fbe Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sun, 18 Mar 2018 12:06:43 -0700 Subject: [PATCH 190/254] Fix documentation building issue. --- doc/vic20.sgml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/vic20.sgml b/doc/vic20.sgml index 9f96cd388..13f2a5cc8 100644 --- a/doc/vic20.sgml +++ b/doc/vic20.sgml @@ -147,10 +147,14 @@ No graphics drivers are currently available for the VIC20. <sect1>Extended memory drivers<p> +<descrip> + <tag><tt/vic20-rama.emd (vic20_rama_emd)/</tag> A driver for any RAM at $A000-$BFFF. Supports 32 256 byte pages. Written and contributed by Marco van den Heuvel. +</descrip><p> + <sect1>Joystick drivers<p> From 2533cc8d751400daea6cfd4b694b2c5a76cd6cd7 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Mon, 19 Mar 2018 11:34:41 -0700 Subject: [PATCH 191/254] Added the vic20 georam emd. --- doc/vic20.sgml | 6 + include/vic20.h | 1 + libsrc/vic20/emd/vic20-georam.s | 352 ++++++++++++++++++++++++++++++++ 3 files changed, 359 insertions(+) create mode 100755 libsrc/vic20/emd/vic20-georam.s diff --git a/doc/vic20.sgml b/doc/vic20.sgml index 13f2a5cc8..1a8f9dfef 100644 --- a/doc/vic20.sgml +++ b/doc/vic20.sgml @@ -153,6 +153,12 @@ No graphics drivers are currently available for the VIC20. A driver for any RAM at $A000-$BFFF. Supports 32 256 byte pages. Written and contributed by Marco van den Heuvel. + <tag><tt/vic20-georam.emd (vic20_georam_emd)/</tag> + A driver for the Berkeley Softworks GeoRam cartridge connected by means of + the MasC=erade c64 cartridge adapter. The driver will determine the + available RAM from the connected cartridge. It supports 64KB + up to 2048KB of RAM. + </descrip><p> diff --git a/include/vic20.h b/include/vic20.h index 1e8c4ceb5..44512b3fd 100644 --- a/include/vic20.h +++ b/include/vic20.h @@ -106,6 +106,7 @@ extern void vic20_ptvjoy_joy[]; extern void vic20_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ extern void vic20_rama_emd[]; +extern void vic20_georam_emd[]; /* End of vic20.h */ #endif diff --git a/libsrc/vic20/emd/vic20-georam.s b/libsrc/vic20/emd/vic20-georam.s new file mode 100755 index 000000000..a960e9a1a --- /dev/null +++ b/libsrc/vic20/emd/vic20-georam.s @@ -0,0 +1,352 @@ +; +; Extended memory driver for the GEORAM cartridge through the masC=erade +; c64 cartridge adapter. Driver works without problems when statically +; linked. +; +; Marco van den Heuvel, 2018-03-18 +; + + .include "zeropage.inc" + + .include "em-kernel.inc" + .include "em-error.inc" + + + .macpack generic + .macpack module + + +; ------------------------------------------------------------------------ +; Header. Includes jump table + + module_header _vic20_georam_emd + +; Driver signature + + .byte $65, $6d, $64 ; "emd" + .byte EMD_API_VERSION ; EM API version number + +; Library reference + + .addr $0000 + +; Jump table + + .addr INSTALL + .addr UNINSTALL + .addr PAGECOUNT + .addr MAP + .addr USE + .addr COMMIT + .addr COPYFROM + .addr COPYTO + +; ------------------------------------------------------------------------ +; Constants + +GR_WINDOW = $9800 ; Address of GEORAM window +GR_PAGE_LO = $9CFE ; Page register low +GR_PAGE_HI = $9CFF ; Page register high + +; ------------------------------------------------------------------------ +; Data. + +.data + +pagecount: .res 2 ; Number of available pages + +.code + +; ------------------------------------------------------------------------ +; INSTALL routine. Is called after the driver is loaded into memory. If +; possible, check if the hardware is present and determine the amount of +; memory available. +; Must return an EM_ERR_xx code in a/x. +; + +INSTALL: + ldx GR_WINDOW + cpx GR_WINDOW + bne @notpresent + inc GR_WINDOW + cpx GR_WINDOW + beq @notpresent + + lda #4 + jsr check + cpy GR_WINDOW + beq @has64k + lda #8 + jsr check + cpy GR_WINDOW + beq @has128k + lda #16 + jsr check + cpy GR_WINDOW + beq @has256k + lda #32 + jsr check + cpy GR_WINDOW + beq @has512k + lda #64 + jsr check + cpy GR_WINDOW + beq @has1024k + lda #128 + jsr check + cpy GR_WINDOW + beq @has2048k + ldx #>16384 + bne @setok + +@has64k: + ldx #>256 + bne @setok +@has128k: + ldx #>512 + bne @setok +@has256k: + ldx #>1024 + bne @setok +@has512k: + ldx #>2048 + bne @setok +@has1024k: + ldx #>4096 + bne @setok +@has2048k: + ldx #>8192 + bne @setok + +@notpresent: + lda #<EM_ERR_NO_DEVICE + ldx #>EM_ERR_NO_DEVICE + rts + +@setok: + lda #0 + sta pagecount + stx pagecount+1 + lda #<EM_ERR_OK + ldx #>EM_ERR_OK + rts + +check: + ldx #0 + stx GR_PAGE_LO + stx GR_PAGE_HI + ldy GR_WINDOW + iny + sta GR_PAGE_HI + sty GR_WINDOW + ldx #0 + stx GR_PAGE_HI +; rts ; Run into UNINSTALL instead + +; ------------------------------------------------------------------------ +; UNINSTALL routine. Is called before the driver is removed from memory. +; Can do cleanup or whatever. Must not return anything. +; + +UNINSTALL: + rts + + +; ------------------------------------------------------------------------ +; PAGECOUNT: Return the total number of available pages in a/x. +; + +PAGECOUNT: + lda pagecount + ldx pagecount+1 + rts + +; ------------------------------------------------------------------------ +; USE: Tell the driver that the window is now associated with a given page. +; The GeoRAM cartridge does not copy but actually map the window, so USE is +; identical to MAP. + +USE = MAP + +; ------------------------------------------------------------------------ +; MAP: Map the page in a/x into memory and return a pointer to the page in +; a/x. The contents of the currently mapped page (if any) may be discarded +; by the driver. +; + +MAP: sta tmp1 + txa + asl tmp1 + rol a + asl tmp1 + rol a + + sta GR_PAGE_HI + lda tmp1 + lsr a + lsr a + sta GR_PAGE_LO + + lda #<GR_WINDOW + ldx #>GR_WINDOW + +; Use the RTS from COMMIT below to save a precious byte of storage + +; ------------------------------------------------------------------------ +; COMMIT: Commit changes in the memory window to extended storage. + +COMMIT: rts + +; ------------------------------------------------------------------------ +; COPYFROM: Copy from extended into linear memory. A pointer to a structure +; describing the request is passed in a/x. +; The function must not return anything. +; + +COPYFROM: + jsr setup + +; Setup is: +; +; - ptr1 contains the struct pointer +; - ptr2 contains the linear memory buffer +; - ptr3 contains -(count-1) +; - tmp1 contains the low page register value +; - tmp2 contains the high page register value +; - X contains the page offset +; - Y contains zero + + jmp @L5 + +@L1: lda GR_WINDOW,x + sta (ptr2),y + iny + bne @L2 + inc ptr2+1 +@L2: inx + beq @L4 + +; Bump count and repeat + +@L3: inc ptr3 + bne @L1 + inc ptr3+1 + bne @L1 + rts + +; Bump page register + +@L4: inc tmp1 ; Bump low page register + bit tmp1 ; Check for overflow in bit 6 + bvc @L6 ; Jump if no overflow + inc tmp2 +@L5: lda tmp2 + sta GR_PAGE_HI +@L6: lda tmp1 + sta GR_PAGE_LO + jmp @L3 + +; ------------------------------------------------------------------------ +; COPYTO: Copy from linear into extended memory. A pointer to a structure +; describing the request is passed in a/x. +; The function must not return anything. +; + +COPYTO: + jsr setup + +; Setup is: +; +; - ptr1 contains the struct pointer +; - ptr2 contains the linear memory buffer +; - ptr3 contains -(count-1) +; - tmp1 contains the low page register value +; - tmp2 contains the high page register value +; - X contains the page offset +; - Y contains zero + + jmp @L5 + +@L1: lda (ptr2),y + sta GR_WINDOW,x + iny + bne @L2 + inc ptr2+1 +@L2: inx + beq @L4 + +; Bump count and repeat + +@L3: inc ptr3 + bne @L1 + inc ptr3+1 + bne @L1 + rts + +; Bump page register + +@L4: inc tmp1 ; Bump low page register + bit tmp1 ; Check for overflow in bit 6 + bvc @L6 ; Jump if no overflow + inc tmp2 +@L5: lda tmp2 + sta GR_PAGE_HI +@L6: lda tmp1 + sta GR_PAGE_LO + jmp @L3 + +; ------------------------------------------------------------------------ +; Helper function for COPYFROM and COPYTO: Store the pointer to the request +; structure and prepare data for the copy + +setup: sta ptr1 + stx ptr1+1 ; Save passed pointer + +; Get the page number from the struct and adjust it so that it may be used +; with the hardware. That is: lower 6 bits in tmp1, high bits in tmp2. + + ldy #EM_COPY::PAGE+1 + lda (ptr1),y + sta tmp2 + dey + lda (ptr1),y + asl a + rol tmp2 + asl a + rol tmp2 + lsr a + lsr a + sta tmp1 + +; Get the buffer pointer into ptr2 + + ldy #EM_COPY::BUF + lda (ptr1),y + sta ptr2 + iny + lda (ptr1),y + sta ptr2+1 + +; Get the count, calculate -(count-1) and store it into ptr3 + + ldy #EM_COPY::COUNT + lda (ptr1),y + eor #$FF + sta ptr3 + iny + lda (ptr1),y + eor #$FF + sta ptr3+1 + +; Get the page offset into X and clear Y + + ldy #EM_COPY::OFFS + lda (ptr1),y + tax + ldy #$00 + +; Done + + rts + + From 5d4116f05fa311fb4611a932218cb9ef073d147a Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Tue, 20 Mar 2018 13:11:24 -0700 Subject: [PATCH 192/254] Added isfast function which returns a 1 when the C128 is in 2MHz mode. --- doc/c128.sgml | 1 + doc/funcref.sgml | 27 +++++++++++++++++++++++++++ include/c128.h | 3 ++- libsrc/c128/isfast.s | 20 ++++++++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 libsrc/c128/isfast.s diff --git a/doc/c128.sgml b/doc/c128.sgml index f133d8d4c..14c874998 100644 --- a/doc/c128.sgml +++ b/doc/c128.sgml @@ -87,6 +87,7 @@ url="funcref.html" name="function reference"> for declaration and usage. <item>c64mode <item>fast <item>slow +<item>isfast </itemize> diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 235a0d40f..193a10c52 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -131,6 +131,7 @@ function. <itemize> <item><ref id="c64mode" name="c64mode"> <item><ref id="fast" name="fast"> +<item><ref id="isfast" name="isfast"> <item><ref id="slow" name="slow"> <item><ref id="toggle_videomode" name="toggle_videomode"> <item><ref id="videomode" name="videomode"> @@ -3302,6 +3303,7 @@ will nearly double the speed compared to slow mode. </itemize> <tag/Availability/C128 <tag/See also/ +<ref id="isfast" name="isfast">, <ref id="slow" name="slow">, <ref id="toggle_videomode" name="toggle_videomode">, <ref id="videomode" name="videomode"> @@ -3954,6 +3956,28 @@ fastcall function, so it may only be used in presence of a prototype. </quote> +<sect1>isfast<label id="isfast"><p> + +<quote> +<descrip> +<tag/Function/Check if the C128 is in 2MHz mode. +<tag/Header/<tt/<ref id="c128.h" name="c128.h">/ +<tag/Declaration/<tt/unsigned char isfast (void);/ +<tag/Description/The function returns a 1 if the C128 is in 2MHz mode. +<tag/Notes/<itemize> +<item>The function is specific to the C128. +</itemize> +<tag/Availability/C128 +<tag/See also/ +<ref id="fast" name="fast">, +<ref id="slow" name="slow">, +<ref id="toggle_videomode" name="toggle_videomode">, +<ref id="videomode" name="videomode"> +<tag/Example/None. +</descrip> +</quote> + + <sect1>isgraph<label id="isgraph"><p> <quote> @@ -6073,6 +6097,7 @@ will halve the speed compared to fast mode. <tag/Availability/C128 <tag/See also/ <ref id="fast" name="fast">, +<ref id="isfast" name="isfast">, <ref id="toggle_videomode" name="toggle_videomode">, <ref id="videomode" name="videomode"> <tag/Example/None. @@ -6864,6 +6889,7 @@ name="videomode"> instead! <tag/Availability/C128 <tag/See also/ <ref id="fast" name="fast">, +<ref id="isfast" name="isfast">, <ref id="slow" name="slow">, <ref id="videomode" name="videomode"> <tag/Example/None. @@ -7064,6 +7090,7 @@ used in presence of a prototype. <tag/Availability/C128 and enhanced Apple //e <tag/See also/ <ref id="fast" name="fast">, +<ref id="isfast" name="isfast">, <ref id="slow" name="slow">, <ref id="toggle_videomode" name="toggle_videomode"> <tag/Example/None. diff --git a/include/c128.h b/include/c128.h index 356140d41..99e050a9b 100644 --- a/include/c128.h +++ b/include/c128.h @@ -167,7 +167,8 @@ void fast (void); void slow (void); /* Switch the CPU into 1MHz mode. */ - +unsigned char isfast (void); +/* Returns 1 if the CPU is in 2MHz mode. */ /* End of c128.h */ #endif diff --git a/libsrc/c128/isfast.s b/libsrc/c128/isfast.s new file mode 100644 index 000000000..01b597371 --- /dev/null +++ b/libsrc/c128/isfast.s @@ -0,0 +1,20 @@ +; +; Marco van den Heuvel, 2018-03-19 +; +; unsigned char isfast (void); +; /* Returns 1 if the CPU is in 2MHz mode. */ +; + + .export _isfast + + .include "c128.inc" + + +.proc _isfast + + lda VIC_CLK_128 + and #$01 + rts + +.endproc + From d34c93a464b09109d2226fefb3bb6cf701049905 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Tue, 20 Mar 2018 14:05:55 -0700 Subject: [PATCH 193/254] Set X register to 0 so that 16bit promotion works as expected. --- libsrc/c128/isfast.s | 1 + 1 file changed, 1 insertion(+) diff --git a/libsrc/c128/isfast.s b/libsrc/c128/isfast.s index 01b597371..d40e2c7e9 100644 --- a/libsrc/c128/isfast.s +++ b/libsrc/c128/isfast.s @@ -14,6 +14,7 @@ lda VIC_CLK_128 and #$01 + ldx #$00 rts .endproc From 03ba3f74730e0898dabba33cff6ded1ebecb7d2c Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Fri, 23 Mar 2018 14:27:15 -0700 Subject: [PATCH 194/254] Added c16/plus4 fast(), isfast() and slow() functions, and updated the documentation accordingly. --- asminc/plus4.inc | 1 + doc/c128.sgml | 16 +++++++++--- doc/c16.sgml | 12 +++++++++ doc/funcref.sgml | 59 +++++++++++++++++++++++++------------------ doc/plus4.sgml | 13 ++++++++++ include/plus4.h | 8 ++++++ libsrc/plus4/fast.s | 22 ++++++++++++++++ libsrc/plus4/isfast.s | 22 ++++++++++++++++ libsrc/plus4/slow.s | 22 ++++++++++++++++ 9 files changed, 148 insertions(+), 27 deletions(-) create mode 100644 libsrc/plus4/fast.s create mode 100644 libsrc/plus4/isfast.s create mode 100644 libsrc/plus4/slow.s diff --git a/asminc/plus4.inc b/asminc/plus4.inc index 3b2f08c54..5ea4dcf88 100644 --- a/asminc/plus4.inc +++ b/asminc/plus4.inc @@ -73,6 +73,7 @@ TED_CURSLO := $FF0D TED_V1FRQLO := $FF0E TED_V2FRQLO := $FF0F TED_V2FRQHI := $FF10 +TED_CLK := $FF13 TED_BGCOLOR := $FF15 TED_COLOR1 := $FF16 TED_COLOR2 := $FF17 diff --git a/doc/c128.sgml b/doc/c128.sgml index 14c874998..2bfb37a3d 100644 --- a/doc/c128.sgml +++ b/doc/c128.sgml @@ -85,9 +85,6 @@ url="funcref.html" name="function reference"> for declaration and usage. <itemize> <item>videomode <item>c64mode -<item>fast -<item>slow -<item>isfast </itemize> @@ -123,6 +120,19 @@ declaration and usage. </itemize> +<sect1>CBM specific CPU functions<p> + +Some CPU related functions are available for some of the Commodore +machines. See the <url url="funcref.html" name="function reference"> for +declaration and usage. + +<itemize> +<item>fast +<item>slow +<item>isfast +</itemize> + + <sect1>Hardware access<p> The following pseudo variables declared in the <tt/c128.h/ header file do diff --git a/doc/c16.sgml b/doc/c16.sgml index 1614516b7..27938ff1e 100644 --- a/doc/c16.sgml +++ b/doc/c16.sgml @@ -126,6 +126,18 @@ declaration and usage. </itemize> +<sect1>CBM specific CPU functions<p> + +Some CPU related functions are available for some of the Commodore +machines. See the <url url="funcref.html" name="function reference"> for +declaration and usage. + +<itemize> +<item>fast +<item>slow +<item>isfast +</itemize> + <sect1>Hardware access<p> The following pseudo variables declared in the <tt/c16.h/ header file do diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 193a10c52..5f90cfd3e 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -140,6 +140,12 @@ function. <sect1><tt/c16.h/<label id="c16.h"><p> +<itemize> +<item><ref id="fast" name="fast"> +<item><ref id="isfast" name="isfast"> +<item><ref id="slow" name="slow"> +</itemize> + (incomplete) @@ -502,6 +508,12 @@ It does not declare any functions. <sect1><tt/plus4.h/<label id="plus4.h"><p> +<itemize> +<item><ref id="fast" name="fast"> +<item><ref id="isfast" name="isfast"> +<item><ref id="slow" name="slow"> +</itemize> + (incomplete) @@ -3292,21 +3304,21 @@ program, it may not be able to read it. <quote> <descrip> -<tag/Function/Switch the C128 into 2MHz mode. -<tag/Header/<tt/<ref id="c128.h" name="c128.h">/ +<tag/Function/Switch the CPU into fast mode (C128: 2MHz mode, C16/Plus4: double clock mode). +<tag/Header/<tt/<ref id="c128.h" name="c128.h">, +<ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/ <tag/Declaration/<tt/void fast (void);/ -<tag/Description/The function will switch the clock of the C128 to 2MHz. This -will nearly double the speed compared to slow mode. +<tag/Description/The function will switch the clock of the CPU to fast mode. For the C128 +target it means switching the CPU into 2MHz mode. For the C16/Plus4 target it means +switching the CPU into double clock mode. <tag/Notes/<itemize> -<item>The function is specific to the C128. -<item>2MHz clock will not work in 40 column mode. +<item>The function is specific to the C128, C16 and Plus4. +<item>On the C128 the 2MHz clock will not work in 40 column mode. </itemize> -<tag/Availability/C128 +<tag/Availability/cc65 (not all platforms) <tag/See also/ <ref id="isfast" name="isfast">, <ref id="slow" name="slow">, -<ref id="toggle_videomode" name="toggle_videomode">, -<ref id="videomode" name="videomode"> <tag/Example/None. </descrip> </quote> @@ -3960,19 +3972,18 @@ fastcall function, so it may only be used in presence of a prototype. <quote> <descrip> -<tag/Function/Check if the C128 is in 2MHz mode. -<tag/Header/<tt/<ref id="c128.h" name="c128.h">/ +<tag/Function/Check if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode). +<tag/Header/<tt/<ref id="c128.h" name="c128.h">, +<ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/ <tag/Declaration/<tt/unsigned char isfast (void);/ -<tag/Description/The function returns a 1 if the C128 is in 2MHz mode. +<tag/Description/The function returns a 1 if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode). <tag/Notes/<itemize> -<item>The function is specific to the C128. +<item>The function is specific to the C128, C16 and Plus4. </itemize> -<tag/Availability/C128 +<tag/Availability/cc65 (not all platforms) <tag/See also/ <ref id="fast" name="fast">, <ref id="slow" name="slow">, -<ref id="toggle_videomode" name="toggle_videomode">, -<ref id="videomode" name="videomode"> <tag/Example/None. </descrip> </quote> @@ -6086,20 +6097,20 @@ be used in presence of a prototype. <quote> <descrip> -<tag/Function/Switch the C128 into 1MHz mode. -<tag/Header/<tt/<ref id="c128.h" name="c128.h">/ +<tag/Function/Switch the CPU into slow mode (C128: 1MHz mode, C16/Plus4: single clock mode). +<tag/Header/<tt/<ref id="c128.h" name="c128.h">, +<ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/ <tag/Declaration/<tt/void slow (void);/ -<tag/Description/The function will switch the clock of the C128 to 1MHz. This -will halve the speed compared to fast mode. +<tag/Description/The function will switch the clock of the CPU to slow mode. for the C128 +target it means switching the CPU into 1MHz mode. for the C16/Plus4 target it means +switching the CPU into single clock mode. <tag/Notes/<itemize> -<item>The function is specific to the C128. +<item>The function is specific to the C128, C16 and Plus4. </itemize> -<tag/Availability/C128 +<tag/Availability/cc65 (not all platforms) <tag/See also/ <ref id="fast" name="fast">, <ref id="isfast" name="isfast">, -<ref id="toggle_videomode" name="toggle_videomode">, -<ref id="videomode" name="videomode"> <tag/Example/None. </descrip> </quote> diff --git a/doc/plus4.sgml b/doc/plus4.sgml index 36d53e753..c1b6165f6 100644 --- a/doc/plus4.sgml +++ b/doc/plus4.sgml @@ -124,6 +124,19 @@ declaration and usage. </itemize> +<sect1>CBM specific CPU functions<p> + +Some CPU related functions are available for some of the Commodore +machines. See the <url url="funcref.html" name="function reference"> for +declaration and usage. + +<itemize> +<item>fast +<item>slow +<item>isfast +</itemize> + + <sect1>Hardware access<p> The following pseudo variables declared in the <tt/plus4.h/ header file do diff --git a/include/plus4.h b/include/plus4.h index 81e3c5286..6edb947e5 100644 --- a/include/plus4.h +++ b/include/plus4.h @@ -59,6 +59,14 @@ extern void plus4_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ extern void plus4_stdser_ser[]; +void fast (void); +/* Switch the CPU into double clock mode. */ + +void slow (void); +/* Switch the CPU into single clock mode. */ + +unsigned char isfast (void); +/* Returns 1 if the CPU is in double clock mode. */ /* End of plus4.h */ diff --git a/libsrc/plus4/fast.s b/libsrc/plus4/fast.s new file mode 100644 index 000000000..e48813969 --- /dev/null +++ b/libsrc/plus4/fast.s @@ -0,0 +1,22 @@ +; +; Marco van den Heuvel, 2018-03-20 +; +; void fast (void); +; /* Switch the CPU into double clock mode. */ +; + + .export _fast + + .include "plus4.inc" + + +.proc _fast + + lda TED_CLK + and #%11111101 + sta TED_CLK + rts + +.endproc + + diff --git a/libsrc/plus4/isfast.s b/libsrc/plus4/isfast.s new file mode 100644 index 000000000..ff104d97f --- /dev/null +++ b/libsrc/plus4/isfast.s @@ -0,0 +1,22 @@ +; +; Marco van den Heuvel, 2018-03-20 +; +; unsigned char isfast (void); +; /* Returns 1 if the CPU is in double clock mode. */ +; + + .export _isfast + + .include "plus4.inc" + + +.proc _isfast + + lda TED_CLK + lsr + and #$01 + ldx #$00 + rts + +.endproc + diff --git a/libsrc/plus4/slow.s b/libsrc/plus4/slow.s new file mode 100644 index 000000000..18b8c231c --- /dev/null +++ b/libsrc/plus4/slow.s @@ -0,0 +1,22 @@ +; +; Marco van den Heuvel, 2018-03-28 +; +; void slow (void); +; /* Switch the CPU into single clock mode. */ +; + + .export _slow + + .include "plus4.inc" + + +.proc _slow + + lda TED_CLK + ora #%00000010 + sta TED_CLK + rts + +.endproc + + From 8424286a3ea42dfc53b1f1d30c1af3e229b18301 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Fri, 23 Mar 2018 14:31:53 -0700 Subject: [PATCH 195/254] Add c16 files as well. --- libsrc/c16/fast.s | 22 ++++++++++++++++++++++ libsrc/c16/isfast.s | 22 ++++++++++++++++++++++ libsrc/c16/slow.s | 22 ++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 libsrc/c16/fast.s create mode 100644 libsrc/c16/isfast.s create mode 100644 libsrc/c16/slow.s diff --git a/libsrc/c16/fast.s b/libsrc/c16/fast.s new file mode 100644 index 000000000..e48813969 --- /dev/null +++ b/libsrc/c16/fast.s @@ -0,0 +1,22 @@ +; +; Marco van den Heuvel, 2018-03-20 +; +; void fast (void); +; /* Switch the CPU into double clock mode. */ +; + + .export _fast + + .include "plus4.inc" + + +.proc _fast + + lda TED_CLK + and #%11111101 + sta TED_CLK + rts + +.endproc + + diff --git a/libsrc/c16/isfast.s b/libsrc/c16/isfast.s new file mode 100644 index 000000000..ff104d97f --- /dev/null +++ b/libsrc/c16/isfast.s @@ -0,0 +1,22 @@ +; +; Marco van den Heuvel, 2018-03-20 +; +; unsigned char isfast (void); +; /* Returns 1 if the CPU is in double clock mode. */ +; + + .export _isfast + + .include "plus4.inc" + + +.proc _isfast + + lda TED_CLK + lsr + and #$01 + ldx #$00 + rts + +.endproc + diff --git a/libsrc/c16/slow.s b/libsrc/c16/slow.s new file mode 100644 index 000000000..18b8c231c --- /dev/null +++ b/libsrc/c16/slow.s @@ -0,0 +1,22 @@ +; +; Marco van den Heuvel, 2018-03-28 +; +; void slow (void); +; /* Switch the CPU into single clock mode. */ +; + + .export _slow + + .include "plus4.inc" + + +.proc _slow + + lda TED_CLK + ora #%00000010 + sta TED_CLK + rts + +.endproc + + From 155f3ade4140fd471ec6dfa77ec8c1cedce3785c Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Mon, 26 Mar 2018 07:24:37 -0400 Subject: [PATCH 196/254] C64 TGI: LINE: Optimization: Don't check boundaries; LINE always is called by tgi_clippedline(). Submitted in Pull Request #611 by Sven Michael Klose. --- libsrc/c64/tgi/c64-hi.s | 125 ++++++++-------------------------------- 1 file changed, 24 insertions(+), 101 deletions(-) diff --git a/libsrc/c64/tgi/c64-hi.s b/libsrc/c64/tgi/c64-hi.s index 8368c6ba2..aeb334404 100644 --- a/libsrc/c64/tgi/c64-hi.s +++ b/libsrc/c64/tgi/c64-hi.s @@ -4,6 +4,7 @@ ; Based on Stephen L. Judd's GRLIB code. ; ; 2017-01-13, Greg King +; 2018-03-13, Sven Klose ; .include "zeropage.inc" @@ -70,12 +71,9 @@ X2 := ptr3 Y2 := ptr4 TEXT := ptr3 -ROW := tmp2 ; Bitmap row... -COL := tmp3 ; ...and column, both set by PLOT TEMP := tmp4 TEMP2 := sreg POINT := regsave -INRANGE := regsave+2 ; PLOT variable, $00 = coordinates in range CHUNK := X2 ; Used in the line routine OLDCHUNK := X2+1 ; Dito @@ -454,11 +452,6 @@ GETPIXEL: ; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and ; X2/Y2 = ptr3/ptr4 using the current drawing color. ; -; To deal with off-screen coordinates, the current row -; and column (40x25) is kept track of. These are set -; negative when the point is off the screen, and made -; positive when the point is within the visible screen. -; ; X1,X2 etc. are set up above (x2=LINNUM in particular) ; Format is LINE x2,y2,x1,y1 ; @@ -513,7 +506,7 @@ LINE: stx YINCDEC stx XINCDEC - jsr CALC ; Set up .X,.Y,POINT, and INRANGE + jsr CALC ; Set up .X, .Y, and POINT lda BITCHUNK,X sta OLDCHUNK sta CHUNK @@ -556,15 +549,11 @@ STEPINY: ; YLOOP: sta TEMP - lda INRANGE ;Range check - bne @SKIP - - lda (POINT),y ;Otherwise plot + lda (POINT),y eor BITMASK and CHUNK eor (POINT),y sta (POINT),y -@SKIP: YINCDEC: iny ;Advance Y coordinate cpy #8 @@ -581,7 +570,7 @@ YCONT2: lda (POINT),y ;Plot endpoint and CHUNK eor (POINT),y sta (POINT),y -YDONE: lda #$36 + lda #$36 sta $01 cli rts @@ -592,23 +581,12 @@ YFIXX: ;x=x+1 bne YCONT ;If we pass a column boundary... ror CHUNK ;then reset CHUNK to $80 sta TEMP2 - lda COL - bmi @C1 ;Skip if column is negative - cmp #39 ;End if move past end of screen - bcs YDONE -@C1: lda POINT ;And add 8 to POINT + lda POINT ;And add 8 to POINT adc #8 sta POINT bcc @CONT inc POINT+1 -@CONT: inc COL ;Increment column - bne @C2 - lda ROW ;Range check - cmp #25 - bcs @C2 - lda #00 ;Passed into col 0 - sta INRANGE -@C2: lda TEMP2 +@CONT: lda TEMP2 dex bne YLOOP beq YCONT2 @@ -647,7 +625,7 @@ XCONT2: dex dec COUNTHI ;High bits set? bpl XLOOP -XDONE: lsr CHUNK ;Advance to last point + lsr CHUNK ;Advance to last point jsr LINEPLOT ;Plot the last chunk EXIT: lda #$36 sta $01 @@ -662,25 +640,14 @@ XFIXC: sta TEMP lda #$FF sta CHUNK sta OLDCHUNK - lda COL - bmi @C1 ;Skip if column is negative - cmp #39 ;End if move past end of screen - bcs EXIT -@C1: lda POINT + lda POINT + clc adc #8 sta POINT - bcc @CONT + lda TEMP + bcc XCONT1 inc POINT+1 -@CONT: inc COL - bne @C2 - lda ROW - cmp #25 - bcs @C2 - lda #00 - sta INRANGE -@C2: lda TEMP - sec - bcs XCONT1 + jmp XCONT1 ; ; Check to make sure there isn't a high bit, plot chunk, ; and update Y-coordinate. @@ -712,17 +679,14 @@ XINCDEC: ; room, gray hair, etc.) ; LINEPLOT: ; Plot the line chunk - lda INRANGE - bne @SKIP - - lda (POINT),Y ; Otherwise plot + lda (POINT),Y eor BITMASK ora CHUNK and OLDCHUNK eor CHUNK eor (POINT),Y sta (POINT),Y -@SKIP: rts + rts ; ; Subroutine to fix up pointer when Y decreases through @@ -730,23 +694,16 @@ LINEPLOT: ; Plot the line chunk ; FIXY: cpy #255 ;Y=255 or Y=8 beq @DECPTR + @INCPTR: ;Add 320 to pointer ldy #0 ;Y increased through 7 - lda ROW - bmi @C1 ;If negative, then don't update - cmp #24 - bcs @TOAST ;If at bottom of screen then quit -@C1: lda POINT + lda POINT adc #<320 sta POINT lda POINT+1 adc #>320 sta POINT+1 -@CONT1: inc ROW - bne @DONE - lda COL - bpl @CLEAR -@DONE: rts + rts @DECPTR: ;Okay, subtract 320 then ldy #7 ;Y decreased through 0 @@ -757,21 +714,8 @@ FIXY: cpy #255 ;Y=255 or Y=8 lda POINT+1 sbc #>320 sta POINT+1 -@CONT2: dec ROW - bmi @TOAST - lda ROW - cmp #24 - bne @DONE - lda COL - bmi @DONE -@CLEAR: lda #00 - sta INRANGE rts -@TOAST: pla ;Remove old return address - pla - jmp EXIT ;Restore interrupts, etc. - ; ------------------------------------------------------------------------ ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where ; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4 using the current drawing color. @@ -896,48 +840,36 @@ OUTTEXT: rts ; ------------------------------------------------------------------------ -; Calculate all variables to plot the pixel at X1/Y1. If the point is out -; of range, a carry is returned and INRANGE is set to a value !0 zero. If -; the coordinates are valid, INRANGE is zero and the carry clear. +; Calculate all variables to plot the pixel at X1/Y1. CALC: lda Y1 - sta ROW + sta TEMP2 and #7 tay lda Y1+1 lsr ; Neg is possible - ror ROW + ror TEMP2 lsr - ror ROW + ror TEMP2 lsr - ror ROW + ror TEMP2 lda #00 sta POINT - lda ROW + lda TEMP2 cmp #$80 ror ror POINT cmp #$80 ror ror POINT ; row*64 - adc ROW ; +row*256 + adc TEMP2 ; +row*256 clc adc #>VBASE ; +bitmap base sta POINT+1 lda X1 tax - sta COL - lda X1+1 - lsr - ror COL - lsr - ror COL - lsr - ror COL - - txa and #$F8 clc adc POINT ; +(X AND #$F8) @@ -948,13 +880,4 @@ CALC: lda Y1 txa and #7 tax - - lda ROW - cmp #25 - bcs @L9 - lda COL - cmp #40 - bcs @L9 - lda #00 -@L9: sta INRANGE rts From b8445721595f70f9011f9b4a381a2fc2233b9cba Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Tue, 27 Mar 2018 07:13:14 -0400 Subject: [PATCH 197/254] Moved most of the tgi_colors.s files into the libsrc/common/ directory. Only the Apple2 and Lynx platforms use different codes for the white color; they have their own files. --- libsrc/atmos/tgi_colors.s | 8 -------- libsrc/c128/tgi_colors.s | 8 -------- libsrc/c64/tgi_colors.s | 8 -------- libsrc/{atari => common}/tgi_colors.s | 0 libsrc/geos-common/system/tgi_colors.s | 8 -------- libsrc/nes/tgi_colors.s | 8 -------- libsrc/telestrat/tgi_colors.s | 8 -------- 7 files changed, 48 deletions(-) delete mode 100644 libsrc/atmos/tgi_colors.s delete mode 100644 libsrc/c128/tgi_colors.s delete mode 100644 libsrc/c64/tgi_colors.s rename libsrc/{atari => common}/tgi_colors.s (100%) delete mode 100644 libsrc/geos-common/system/tgi_colors.s delete mode 100644 libsrc/nes/tgi_colors.s delete mode 100644 libsrc/telestrat/tgi_colors.s diff --git a/libsrc/atmos/tgi_colors.s b/libsrc/atmos/tgi_colors.s deleted file mode 100644 index 6ef3729b4..000000000 --- a/libsrc/atmos/tgi_colors.s +++ /dev/null @@ -1,8 +0,0 @@ -; -; Target-specific black & white values for use by the target-shared TGI kernel -; - - .include "tgi-kernel.inc" - - .export tgi_color_black:zp = $00 - .export tgi_color_white:zp = $01 diff --git a/libsrc/c128/tgi_colors.s b/libsrc/c128/tgi_colors.s deleted file mode 100644 index 6ef3729b4..000000000 --- a/libsrc/c128/tgi_colors.s +++ /dev/null @@ -1,8 +0,0 @@ -; -; Target-specific black & white values for use by the target-shared TGI kernel -; - - .include "tgi-kernel.inc" - - .export tgi_color_black:zp = $00 - .export tgi_color_white:zp = $01 diff --git a/libsrc/c64/tgi_colors.s b/libsrc/c64/tgi_colors.s deleted file mode 100644 index 6ef3729b4..000000000 --- a/libsrc/c64/tgi_colors.s +++ /dev/null @@ -1,8 +0,0 @@ -; -; Target-specific black & white values for use by the target-shared TGI kernel -; - - .include "tgi-kernel.inc" - - .export tgi_color_black:zp = $00 - .export tgi_color_white:zp = $01 diff --git a/libsrc/atari/tgi_colors.s b/libsrc/common/tgi_colors.s similarity index 100% rename from libsrc/atari/tgi_colors.s rename to libsrc/common/tgi_colors.s diff --git a/libsrc/geos-common/system/tgi_colors.s b/libsrc/geos-common/system/tgi_colors.s deleted file mode 100644 index 0d404294c..000000000 --- a/libsrc/geos-common/system/tgi_colors.s +++ /dev/null @@ -1,8 +0,0 @@ -; -; Target-specific black & white values, for use by the target-shared TGI kernel -; - - .include "tgi-kernel.inc" - -tgi_color_black = $00 -tgi_color_white = $01 diff --git a/libsrc/nes/tgi_colors.s b/libsrc/nes/tgi_colors.s deleted file mode 100644 index 6ef3729b4..000000000 --- a/libsrc/nes/tgi_colors.s +++ /dev/null @@ -1,8 +0,0 @@ -; -; Target-specific black & white values for use by the target-shared TGI kernel -; - - .include "tgi-kernel.inc" - - .export tgi_color_black:zp = $00 - .export tgi_color_white:zp = $01 diff --git a/libsrc/telestrat/tgi_colors.s b/libsrc/telestrat/tgi_colors.s deleted file mode 100644 index 6ef3729b4..000000000 --- a/libsrc/telestrat/tgi_colors.s +++ /dev/null @@ -1,8 +0,0 @@ -; -; Target-specific black & white values for use by the target-shared TGI kernel -; - - .include "tgi-kernel.inc" - - .export tgi_color_black:zp = $00 - .export tgi_color_white:zp = $01 From a2a486882585b0e2c3c4ecbc5ea19afda015289f Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Fri, 30 Mar 2018 00:07:56 +0200 Subject: [PATCH 198/254] Added HGR and DHGR slide show programs. The DHGR program is sort of a hack as it first switches to double (aka 80 col) text mode to prepare for double graphics mode. Therefore only one additional soft switch access is necessary after using TGI to generally switch to hires. --- testcode/lib/apple2/Makefile | 35 ++++++++++++-- testcode/lib/apple2/astronaut.hgr | Bin 0 -> 8184 bytes testcode/lib/apple2/catface.dhgr | Bin 0 -> 16384 bytes testcode/lib/apple2/chips.hgr | Bin 0 -> 8184 bytes testcode/lib/apple2/dhgrshow.c | 45 ++++++++++++++++++ testcode/lib/apple2/gatsby.dhgr | Bin 0 -> 16384 bytes testcode/lib/apple2/girl.dhgr | Bin 0 -> 16384 bytes testcode/lib/apple2/hgrshow.c | 37 ++++++++++++++ testcode/lib/apple2/macrometer.hgr | Bin 0 -> 8184 bytes testcode/lib/apple2/mariner.hgr | Bin 0 -> 8184 bytes testcode/lib/apple2/monarch.dhgr | Bin 0 -> 16384 bytes testcode/lib/apple2/rose.hgr | Bin 0 -> 8184 bytes testcode/lib/apple2/superman.dhgr | Bin 0 -> 16384 bytes testcode/lib/apple2/venice.dhgr | Bin 0 -> 16384 bytes .../lib/apple2/{werner.pic => werner.hgr} | Bin testcode/lib/apple2/werner.s | 2 +- testcode/lib/apple2/winston.hgr | Bin 0 -> 8184 bytes 17 files changed, 113 insertions(+), 6 deletions(-) create mode 100644 testcode/lib/apple2/astronaut.hgr create mode 100644 testcode/lib/apple2/catface.dhgr create mode 100644 testcode/lib/apple2/chips.hgr create mode 100644 testcode/lib/apple2/dhgrshow.c create mode 100644 testcode/lib/apple2/gatsby.dhgr create mode 100644 testcode/lib/apple2/girl.dhgr create mode 100644 testcode/lib/apple2/hgrshow.c create mode 100644 testcode/lib/apple2/macrometer.hgr create mode 100644 testcode/lib/apple2/mariner.hgr create mode 100644 testcode/lib/apple2/monarch.dhgr create mode 100644 testcode/lib/apple2/rose.hgr create mode 100644 testcode/lib/apple2/superman.dhgr create mode 100644 testcode/lib/apple2/venice.dhgr rename testcode/lib/apple2/{werner.pic => werner.hgr} (100%) create mode 100644 testcode/lib/apple2/winston.hgr diff --git a/testcode/lib/apple2/Makefile b/testcode/lib/apple2/Makefile index 87dadcbe7..9d551aa62 100644 --- a/testcode/lib/apple2/Makefile +++ b/testcode/lib/apple2/Makefile @@ -1,12 +1,37 @@ # For this one see https://applecommander.github.io/ AC ?= ac.jar -CL = cl65 -CLFLAGS = -t apple2 -C apple2-hgr.cfg -Oirs +CL ?= cl65 -hgrtest.dsk: hgrtest +all: hgr.dsk dhgr.dsk + +hgr.dsk: hgrshow hgrtest cp prodos.dsk $@ - java -jar $(AC) -cc65 $@ hgrtest bin <hgrtest + java -jar $(AC) -as $@ hgrshow <hgrshow + java -jar $(AC) -as $@ hgrtest <hgrtest + java -jar $(AC) -p $@ astronaut.hgr bin 0x2000 <astronaut.hgr + java -jar $(AC) -p $@ chips.hgr bin 0x2000 <chips.hgr + java -jar $(AC) -p $@ macrometer.hgr bin 0x2000 <macrometer.hgr + java -jar $(AC) -p $@ mariner.hgr bin 0x2000 <mariner.hgr + java -jar $(AC) -p $@ rose.hgr bin 0x2000 <rose.hgr + java -jar $(AC) -p $@ werner.hgr bin 0x2000 <werner.hgr + java -jar $(AC) -p $@ winston.hgr bin 0x2000 <winston.hgr + +hgrshow: hgrshow.c + $(CL) -Oirs -t apple2 --start-addr 0x4000 -m hgrshow.map $^ hgrtest: hgrtest.c werner.s - $(CL) $(CLFLAGS) -m hgrtest.map $^ + $(CL) -Oirs -t apple2 -C apple2-hgr.cfg -m hgrtest.map $^ + +dhgr.dsk: dhgrshow + cp prodos.dsk $@ + java -jar $(AC) -as $@ dhgrshow <dhgrshow + java -jar $(AC) -p $@ catface.dhgr bin 0x2000 <catface.dhgr + java -jar $(AC) -p $@ gatsby.dhgr bin 0x2000 <gatsby.dhgr + java -jar $(AC) -p $@ girl.dhgr bin 0x2000 <girl.dhgr + java -jar $(AC) -p $@ monarch.dhgr bin 0x2000 <monarch.dhgr + java -jar $(AC) -p $@ superman.dhgr bin 0x2000 <superman.dhgr + java -jar $(AC) -p $@ venice.dhgr bin 0x2000 <venice.dhgr + +dhgrshow: dhgrshow.c + $(CL) -Oirs -t apple2enh --start-addr 0x4000 -m dhgrshow.map $^ diff --git a/testcode/lib/apple2/astronaut.hgr b/testcode/lib/apple2/astronaut.hgr new file mode 100644 index 0000000000000000000000000000000000000000..f19f0099a7f6546bee1920be8b92f85738a42b4d GIT binary patch literal 8184 zcmb7JU1%Fu7G6oVEKID8VMXJ5UA!)IjS4|q2W+et1$*nVb*M`t+Cl_2yYY7WApGET zUe8#LMij+L*flHFajg0wHF;7|!QLd`$-1ymRFa22#xUxF)_pNrTGkF2&wl6L8A)Tw zCAmgF9?i^m&bjA1-??{)tfAXq?9YPr<;XNm`xt*7?C-9W)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!2;GpA3|!fvEAOid`Q6SORNd z-lh*v;58q2tsg!5X6-FJBx~(|7wfNhUWm>You&uTyR}|$J^>T@kN!V~jdY=b_5J@e z>a<(1A1uQD`_o4K_e{k5zE512_O!s?IzaC+*;A;<?%y=uap@+)y8g8z+MMm!e@hZS z{R;#YUFH3UTKvI$egcO0)13DPKE?jKsxP5eL{f}tXHVJxm--6^Bt?gbXSSIWJ3rEl z(8#9GMV;7xf8ARDJNMs#Z;fgk-Dt!9yPm`|k@zJ~8gtR?zraTyVI}-=qSBK8=Z3KU zc2PPqa5V(}cXkJn>~;Mwsl~<}b5x4j`aiGJ?S%=f%znbEv>BiG@cHSZH4IZNX?SXe z4y<vo{udA<us%8%7`P1dq^R`XRcrs<W*}e1`|oVqDq+uL06L87fc=S9`g=nEf%{6N vrvFx7EA(He3s%;2EY~IimeanM6P^1DMn*}h>HoN|djP8{q5u3FSCIb$b=Uaw literal 0 HcmV?d00001 diff --git a/testcode/lib/apple2/catface.dhgr b/testcode/lib/apple2/catface.dhgr new file mode 100644 index 0000000000000000000000000000000000000000..1f373d9d0b2b2c73fd1f9df4d25b35c97b69c01f GIT binary patch literal 16384 zcmY+Lk5k)7w(naSWvZ3pzLI2IV{eMOvXDI>JITc!@J_r8T9?8Kuft<l%ft}FyMDH_ zL%_Z}v)Hxq8vX0<(*}}xT@^4!R(GF1-yi3QM0RAwK@dc?AwFs1Rm*B;qHVt#?fq3; zJG^VR?5Gggk=?2qw$Q}&w7w=HA-s02T{9fPxJfUyun_IE8*2q2LRV_Sipnj1Bkf6= zZW^0uI%z~)8y8~xog-bTKDHW$ZCI_K<-~UMv!4+j^JMrecQ))GFjzs$d0sGVzZ{o? zok)`+I#8buy*1{Sp1R2-Bkj1>E?<^oN4Qbhu%zhd!sESKyK#RIrfK6?z1|eM*b|;` z+uCY!zQmi>Gd~b&M{XFjMCi1fsN61u)@_;HipY%`ksj;qYEZZgDz>nVSA5Ks>h1-@ zGx#CYBGy@1RGhXgwYVCUL)$3C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$76C;VT{lM>Gz;YFSc{0@JeQ@UF4=5Bfcdu2hB+7Y@+{lT+yr9OB*)`qGpHKSe! zb8tesftu1+qdMdd1O441Spk#L|24RR>p)3pohB2U&t?6N=aJN1bX$G;Rl~3Q|9{MS B>>mIC literal 0 HcmV?d00001 diff --git a/testcode/lib/apple2/chips.hgr b/testcode/lib/apple2/chips.hgr new file mode 100644 index 0000000000000000000000000000000000000000..c8302db4da7395d96bd34e637ae32930be350ec0 GIT binary patch literal 8184 zcmai3U2EIQ7QIp&j!>bop(Zc)5}~|^G1RXIUx=q5(^nZJ{Bn&=pNtEqDMTc=m1lnX zU28sM$#I%7wxpS@y=H&R-h0NQFpq|*)Iq4DVZv)Js{Kl>L}flfIM7<lm`}J7*J%~w ziuS1PbSbWrQmAPak42tcr#Y@=G)i-=6GNnNA1wvBt;ti@>N*a>QvAy`j(5M6Xw=3a zTl|Xi(^BIp9$J?8l}B|Y!L5vg1aE+TEUHMSi?|YHX847JNGFDORvqhUCF)5ft|@`R zyMzx;zcvpJ*UlldJS=`;CEuyJ&Z?OBXkvYEy3&vH%HS_MGL6$*)Kkn*HNcn0yW|@4 z%%gLBpsJqaQ#B39-^vhS9P=LNLR~{*;&V{zPj;U8z20t&{G9)ScE~DYkLvLJy%LIY zX*nM!1Iiz__^{VfRL5psDZYu%eskFDZ!LSRCe}XCE8o)+I;1Cz?08n~m8cGUPaan- zKA%gmOc$_A{R<T4bDiAjvDW0%%8z+Q1!VXBR*Po3nOf$>{!XtT2lZJA&O_3EdKkLN zVK(Gk@9{SLw@6EeWbyDD^UnK|JZ|(jH1f3aW1i5Yd+)e8t`6`KwxgOre|US5QD5-y zXq2EIvg;Nf*zm0C2<`9GqySxuj5qPw2bd#$bZoq(42Q4qjU_?b2=!wF=4e}`f~*pw zbOD($H|Vv+PcUxrqY>5$b&EMbh8*-|Y*2}8Kjel+`7pzqLeuxaS9tr|@&0d;e^B=W zeOhjMYg`dj!%#+!7y`o$88%vH>9c8{lKeANnN{~P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c5_%O@gBV<yY*l_cBC7lIiH)ohvxmWJCVxslGO$X0c zF0|wsd(>BzR1Y8jTp-+VSxc?It$z5uWQ|PJhMEhk*;QO=q=q*JO?TPWB~5#$d-$vl z7*31H)6Gw3q0;I99sC`}Guj=0j9!=o_$E2CvkT)bNe`dBquCc#`Ew5hs`u9bUP?^y wezb|=9ls5G70MaD#2<6M;(IpvAGY}Tj_ev<5(WDer+@M+K3#0mg>^Idf5Po?;s5{u literal 0 HcmV?d00001 diff --git a/testcode/lib/apple2/dhgrshow.c b/testcode/lib/apple2/dhgrshow.c new file mode 100644 index 000000000..147ee01d6 --- /dev/null +++ b/testcode/lib/apple2/dhgrshow.c @@ -0,0 +1,45 @@ +// cl65 -t apple2enh --start-addr 0x4000 dhgrshow.c + +#include <tgi.h> +#include <conio.h> +#include <fcntl.h> +#include <string.h> +#include <unistd.h> +#include <dirent.h> +#include <peekpoke.h> + +void main (void) +{ + unsigned old; + DIR *dir; + struct dirent *ent; + + old = videomode (VIDEOMODE_80x24); + tgi_install (a2e_hi_tgi); + tgi_init (); + POKE (0xC05E, 0); + + dir = opendir ("."); + while (ent = readdir (dir)) { + char *ext; + int hgr; + + ext = strrchr (ent->d_name, '.'); + if (!ext || strcasecmp (ext, ".dhgr")) + continue; + + hgr = open(ent->d_name, O_RDONLY); + POKE (0xC055, 0); + read(hgr, (void*)0x2000, 0x2000); + POKE (0xC054, 0); + read(hgr, (void*)0x2000, 0x2000); + close(hgr); + + if (cgetc () == '\r') + break; + } + closedir (dir); + + tgi_uninstall (); + videomode (old); +} diff --git a/testcode/lib/apple2/gatsby.dhgr b/testcode/lib/apple2/gatsby.dhgr new file mode 100644 index 0000000000000000000000000000000000000000..dc3750e668e26f84de1eaf6a1a573d873e69f1ea GIT binary patch literal 16384 zcma)CjdvQ!k?)xud;@vD3>cEj?%PW<fn7A%(ps^k_e3PMxN(BmT?Y{cA`u|*tr9F5 z@orB*P8`g?e!uFTFC;madR9+=R99D5*H<@Y7W-!*<;I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WGoXTV5p<r=QrJJTKSX>;7f~P9XSSuYP0U193WD>fGp@<5 z{(J?WS!k2~EAP*l8|43Tsw@cg&p1c=>H|bR*nh$7WlRsA)23b=i*14*h0bM9Tu_V- z06BYDh4t{g-fF$<M(>8$nvPek(w8A6;K~yP-4<(8J{5q;TAc1aW!yT{qOgA+8Hef$ zkvCfBmAHB3br^qB-*|s)`R4EN%oQQ^Jhn%-OtODv7ev;gdxvQ@o>#&}@NIZ>Lx^U| zkuWPtpe3q}5&ZAt-`^e@OzUEPv^etmqxhU)2cG|BVEdq`&!CRTzk4&5jQ^~D0-<h1 zy~Of%ce<J`ysb@^b(wQ*%xZMMXwTlZ;HUM#{`rZvJirOEI_Poa-}B||K<^CDvSRy} z{+{cb^dkoH_Lq9cwlE%Tm^R4doh8DeO4sZ6_Pnf(Du^TKvU&MEeu=Ye0iQs#SJOea z-#elk0=vUs1Ul@WcvL_XBEYXpL*)PVo*k_Z{nOd}3Hwh^R?_~}``aDv|95>ohx|Lp zZqjY9T%h0QVrYR3cHT+mzws#5Y;U?+;CGV*S5)OR_5gf6O}E`J{-6Jz1fgRly}w`; zypDdA4#I!D8$~LigTe1binz}Ew@1^1$weIm0x;N}{0)WWWFM!J<4=U|Z*6&|_+KA* zw{7EP1A~M!x3eJzTAL8Q(aYWha}9m3TbLYqjZ&f$`9JR8JfMJINO8VUJI>jlm(XMU z@&~PH(fvbB9wGkYG#-HLsD#vLFp75Ycik`W+svh1@LsEFv=P|<95F+6pqvbB=tSlW b_P<ER{~}>@5}E_j=bguwc^mTKgiG*$(iM}r literal 0 HcmV?d00001 diff --git a/testcode/lib/apple2/girl.dhgr b/testcode/lib/apple2/girl.dhgr new file mode 100644 index 0000000000000000000000000000000000000000..af332edbe7c5bde96ba79dbfb8661715a35ad5c1 GIT binary patch literal 16384 zcmYkj3s75Uo-cT$h+YYD`|5!#W9%KFNHTf{$&xG!0oD~+JrHdabg(2OI=UPskvKYI z(MSuYK~7ihR%cSTDv8_UxII(b?M*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m@86{^-cJX z22Io~)I6msJyGC5@RSGYSElClv%KH#WpQgEC;O1S5z3>T_=lX^kFqg~)FJQ8bEuM_ zLR#*2td*-$)dY!KH>x2o^a=U69i(yJu=YPbn|lx|E<gVA^7RLmb>tv$|CRfvZ~xQn zj~9t4Ay;|mzptyflc*VjqG2S(-;;Tt&nGg0e2CO};d}&yH@cJmiF=!&KkOW;4ggov zLgc~!LH^eh4NABYCfV!4U8soK&G9b@ug4_-$Uo*6fw=#2avjx5Hl=S~Jn@H<w@-g! zSJ$by`>#@YV{2xmf^@7Yy;}|anQh8oZ^IHK?R;SuZWzR>?d8M&D^=<vswi$h-6WgA zevOrrthqJsE_sGL<^bu^9-&&5r5B+m^ZV!oJuzlyzW(eC_<wE{Rh!voe(h4_laq`8 z{A=I}hrgiTueY{pmAlZNxY-#;^&{CUH0r@+fIr-~nGf#tAI?_Tip~@vUrZDyX;c6+ z3AYT6MV;e5jB5HmpYO+e-K3MU=W+j)at|a>*TSG2O56o3aHn)+y%xDCR2z2yPmZAM fkHkn%A)0rVkbaMaGBU2_;Jt+EhG5f<{`mg^&&!S% literal 0 HcmV?d00001 diff --git a/testcode/lib/apple2/hgrshow.c b/testcode/lib/apple2/hgrshow.c new file mode 100644 index 000000000..5d839b5fa --- /dev/null +++ b/testcode/lib/apple2/hgrshow.c @@ -0,0 +1,37 @@ +// cl65 -t apple2 --start-addr 0x4000 hgrshow.c + +#include <tgi.h> +#include <conio.h> +#include <fcntl.h> +#include <string.h> +#include <unistd.h> +#include <dirent.h> + +void main (void) +{ + DIR *dir; + struct dirent *ent; + + tgi_install (a2_hi_tgi); + tgi_init (); + + dir = opendir ("."); + while (ent = readdir (dir)) { + char *ext; + int hgr; + + ext = strrchr (ent->d_name, '.'); + if (!ext || strcasecmp (ext, ".hgr")) + continue; + + hgr = open(ent->d_name, O_RDONLY); + read(hgr, (void*)0x2000, 0x2000); + close(hgr); + + if (cgetc () == '\r') + break; + } + closedir (dir); + + tgi_uninstall (); +} diff --git a/testcode/lib/apple2/macrometer.hgr b/testcode/lib/apple2/macrometer.hgr new file mode 100644 index 0000000000000000000000000000000000000000..925df6e417d71bb2966da737e2c90b57ce2697aa GIT binary patch literal 8184 zcmZu$O>5)G7JYUcTFB6`VN5n}h){2Y4AHi69xVlIvX#L?n=vvoo5lerffjC@maBgH zJLlGioSC_yWqnlDsk(LUSM@YrCRJLc(|8$7^b&W~LS<Dt!(FR-srOGw$Hx;d-TN_J z1sd|Iwr9Rks$pOJZ8+Y$ibq;U_@|3x8gKA^tLsBI9>g4_3IAhdIu!hHIvioVf+H-B zs#?^zlVR=UcvvMBkeai4SMQB^n?3@+`Dq^51AWfj!%?X#t(U+a{WSCBmt`=Gt07({ z)m|xwug+%e1AG8}z?MfPW1&?q^`2j_F31soR-V;ajn|?n`R?YN4RnF=Mq1jZn0s2J zQ(XXmlvHuC@c0}rCbp3^P};NTQZ#LG^lV5S;@biGo40wVWH%JFkyrOinfE%T&g4Dt zb;1#UaCh?S1kVxYFu*=fF^<FUUKCclvgn0;YY)I5ZY(r@vO-T&9dK^=r|MIcw^^4d z^lk2|w9A_GZMX~!KHAS^IN?W`Zq*<n544`dMF4#A!{b+qGr$^B?mzY>-C&JsJR81x z{5sw|NPojma20!ocGzoGe^~~v`7d>=F~4|4{ok;ym$W*Wy~P{o6>H}nKDhN)acBAa zlvmt`{TBPP3f9A44nLpmw<*V)@`Aa~fIW+JFu~gD`%R!Sl@Ig=JQvQ6Cv4{=u1>dP z9cAZ+?D<!vP5)9=A@^+!+j@KUujkYk-h;o~JLoB@pr?@@U`JbgyFIB)gNM^}ncf+s z{<`nfEqha<tsm5_UtSly8i|Bvnuap@)3;XY%j!zgAaZdE&u@8U+V50qi3qh9dLUG$ z8M^_^?<B_7LOom_+h1See`s1@X~(b(v0S?`GK;h&f#nSd_zmws{A;{Z*;*Q?u?z!b z{O#?6b(zXMu{DN*@;)l|ox^{xVV0Ld7of)F5Ogx*nrm8sz8o8-Kknvs&1(J7Da=CS z*=+K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$xD2P!>$7{QGG-)ZFpj4YvY-Wdf#0M} z@jp<R{&@?xP~zy=w=_3Ndr|*e{$gm4zrS^7Ml7eiqkGLI)NvBXDtP80_5=HJ+N292 zCvjH5!)F%3`5^im`fdyU-P!DVqI;Wi_<w7UN4kKaoPzcq7?Ws$iz(e8UCKKsym_xf zwC>~oW&JI6K8G%mbVFiZAdy^o0^sm%ZEW7l75|CT4e31k07NCc;SI<y>07hoViit~ zpHiV4jqw8iqW(szSz(?<a)E$b|Njrq^|!X)TsC6;ixch-^}nGs6FkuGn3X^4vusbU z)SId$_F5NqUoCjT`?3Bv6(Gm767}Z~?cASTn~%g73S&)HU|jaw2!%ksXOg@&MM!=< zEMPJ^vb4b2!|^b4?ePnpT|D_)r+@5e16_V-gA;O$MjacuK^EaV+Q<hz73unf`X6_{ zpA@-3`DgtNSLQ_YAQ_3Tzma8{F!L!iXADMH=;7Jd@Z8!BVYn2T#|bhu829&2?({|Q zz3xq;NY1k4-n#Jn?V@$-5A?l1Xj6@}qMOk>tj!9J)#5_F_{-2f!zGt-_4yT1|Cj7p zac}p*H%0E^bi;LE?>^Mu`thn@_{yn;`s~lCc8zz8{ZP#2yfd?}5z@d(<RrZf^gKi6 P0{)x&pY5spx#0gFP~C1| literal 0 HcmV?d00001 diff --git a/testcode/lib/apple2/mariner.hgr b/testcode/lib/apple2/mariner.hgr new file mode 100644 index 0000000000000000000000000000000000000000..2024a75961e828a9a0a7f44ead789284ada14ca4 GIT binary patch literal 8184 zcma)BeQX@X74O+`;<_OQk!w>W<Ss!X&ZZKf{iEii@unpN+?E`QujUU_pGYhrRETYw z+KDf>@9caSgGeIPO{Ave6t%@{R4$?*r2%{wnhJ!}#ui>I1lFBeqSAw6gL;Z_?c4s| z%zob4N#Dt{vv1y;-^`oY_uh<&98#4ie)~c}tw&3=)jNEDMQz?G<Qlt|5v`SNEBqpq z4@cvPbqP(g`DzvQR4>8Xl2t0yKwq&)yvQQ5U)zWggrm*98=}hto)&LaZSL*d(X6%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|NIz#H;@ngN(xoPf873*c=t0d6YP{fBDTmc^Uem8O}?^nBmWOB CdLAPH literal 0 HcmV?d00001 diff --git a/testcode/lib/apple2/monarch.dhgr b/testcode/lib/apple2/monarch.dhgr new file mode 100644 index 0000000000000000000000000000000000000000..8812c4b2d7417154b750dcc86499142668a496aa GIT binary patch literal 16384 zcmZ{rjb9pP*7wf<>R?bo;|78>2(B?U>xwi%N_soGBOxug@rmt&4MY|R=E;YQMz-Kx zBlE96-!q8OZTIRYfG}LI=l62XP?4LqIeIlcdU5Ny5p9^MU{ZXhT)M|qx89%HFwds5 z<!sq6=_}a@I<gaU{BqA(*x@>Hr?MA)^LM%^c-^F@pV!@xJ8dSz<9R1|tLxFr!ux15 zxGc^>J09}hYyafDY7f6H4Ktb7etp8Y{i&4MpV>Ie?iD&&hihx%3r>p_<#pUySdON` zKB=e7-={V{rTKV0v{5>)Z<W$@*B4w`Sssme_c^#cza-AR$4{CM*YaX6nLEKHb2PpL zS7q5uN~0gr9!30ee{6G4Sbr|$m-8!0%1(8U50d(6WT$j=Ih8(gKOG<S>$#%`7yVGL z-aloYORVu$+jR2HxRYOwJB9?4o2kiEI2BwqeR@f7HM|_ZzBanbn#8JG@}lFtHC>R1 z<9Gaf{#sVft8P-7_m)hFrDRN;l^rwr#qCeIS7~!&s&BetitEa<j{oG`f8D1(Z9Wd3 z-)ja_W;5J0mo}G!OJQFyX|O)On5!!(_I22rhGkylW;SLvLfz?&PS)~I7Y?K&j+8~t z-R=xA(8@PrI!}jKSqjrj*k=a%pA6A)!#gJb{?an<j4vk(>}zl*#%Hl5Vcsjubv=}o z7o0&j6?0^{^h=C6M15u>$E>83wF({KpWm?p1&y!J_cOU<*b08kJNKIr#t$w>SG_sx zOt!*1!KRMCk}_Ln>fuMTeZ8XL(+SrySH>c?Wmg7U)qhw8i=EZ8TqdUe%J+F~`pjRh zN@<Nvi+^RmljRIpn|wRnyJFru4_7zW;*Xz<o04BPiRH=WljV3bc>cXeYVsrFH&>Q}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>Tt_vQk#CVf*1rus)_-T9^s{!uj<>OYEs zub$)n+lK94{u28VEACS&iBW}R9@OF9zAOybIlr>cb=N5OkSV_oMcqU3zv}7#pVa@Y zzvIj@0fDowd#QbH{f(7-t)3>b*`>fmp?FDUEAr*CNF;FgD?$DrH>@sPSs-sIeEOCM z^aak)X=?s@UO1#;zH^BNUruOL414^~M?I;4QO{S{;$6+7Gn^<ZAGX>XTTjR+^kNfe zt}7SZ`{`*enr}yC{Zz>RO4JP&&{*kO^X4G)lKlTPKA`^2oyT}DOm1}qOO&}wc&kw* z0sXkLDZRV+VDAlec67|bq8vnS=`V=F{C>z>VE6eyd8z5h>KS*x`d$U}CCnzZMO%_+ zO-L&9R`?yxJ9C<E5q{2FH*m)P2f*BLz#2_oTX)xEOnVNew<wAl^#~%rSlrRt&DdVa zoy(J;!MGG-+~`F++;{11<IPN1KshLU66;vFd+zw8@d?DV>i>6gNk+$yfBWQ-pin&k zIr7b(dXwnC&w>)YXM_HF*Nu^(v8O~Wj7a@|mb;UBDa^FR6X+ZF^naq>qXGd^Wdi-z z$|~7{I)AFg)Y@$j&wGm@PyZF2_9E=Czk4_T?z2Wv#@TB99~_{;7gRUNe_@V{`bsOW zjB$NecTBbSQ0})6E$LS$_{oq&+2Kc;+0plR`Ca-d&mDZ$Y8%LXLseR1bAQMNdvm*- z-PdNHdE<x0AS-k)oh|pR9ck-*otSJZ0~R#@XZ>3h82HMGKaCgnTYSG4rt(oo|06HG z`g>Tyw(5Vsp5^p%cE0kU*6my)@<)`c{NT^(?|NTN&q}l6t=84)qfVwMy>0N1uOX|a z_TVwL6;WRr_`p5&9jfoJ0~z2rwGgV>TPL5jvP|}Ib6>3+`ntrguQdN(N#4o-|35|9 Beq{gv literal 0 HcmV?d00001 diff --git a/testcode/lib/apple2/rose.hgr b/testcode/lib/apple2/rose.hgr new file mode 100644 index 0000000000000000000000000000000000000000..d18fd83f0ecbc0f19ebcba7abc056898c3c04cb2 GIT binary patch literal 8184 zcmbVRZ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fr}rN;*TSBF&p8bm z*6sru0%{L)Uvxx<{bLq~<Ma{TQ-k==q57`1@&2v-%E*VZOH>AHFo8^af<8B!K*9>d z!2f;p>3UufWAY-p98)&ygW)e~7Aq_G4g5F#bd>%z)Q_;&m4EDK&S(~I%J;S!xnAeK u#A>&tA+iBMuab}ln1;Wd$IB1<?7dp0A*C_rKy5QQe~>Zlp3F%WZ~qICVY+qz literal 0 HcmV?d00001 diff --git a/testcode/lib/apple2/superman.dhgr b/testcode/lib/apple2/superman.dhgr new file mode 100644 index 0000000000000000000000000000000000000000..4886227c2884fac1259275dee49ac34c37a08443 GIT binary patch literal 16384 zcmZu&jepYC-ao;tJMp33q|DDH?bAC547<9`Lh9vOo-T+HGjCd3*V?(3#*3KYOJUBo znIfEj{rUb*62N(r4*|-_@BRCGIZ?wk(z9Pw@mVeQjec>VxIPke++u7(?^i8u@fu!M zw&vjzUM2cw<8Hs^+q`Y-S<4s05tff88Tu_bui1W)(ZLzBvQ1^JGdi8fKj1>NSDJ=f z^$j%#&bfZoU+z~Iir3cHJ0o#Lf2gqEv1S-kTgqBqO`h@hKWxu-dF_oebh4$o&p(LK z5UVH7l)JU%=iH2M)0yQKiPyx6l>e=QSE8T1lGLtSY#Tc^E2_&2MqzglJa%a*QOt3x z-x!XvcGmW4u_cH{)vv1bo^^J&4DLa9$m+lXg3LB?hWBlEsabV%(6FkqSM}4_t|@=v z2nY0HZRpx0Nprr9^|pQR&jazRLi#tN$!IbfIs=>A;Fhk>7}=uFEg#>#jM9~^A_=gP zPT_3%hHJB`Yk=<32|tYj5EGNpjQ=FHEzuY~Y>XT5mmlre{<~~;G8CPgbVq5e5d|5k zxAeP|xW@e|uQnmSt+v?eIo5$IY3|@7xKCa~3ts_$+g04(Yv3<M98T>&ROWQI{v3U1 zOx|s%MK$N<a2Ib(Cc7Xd`42>@_4K{@NcVNd422nNsV~4A@#nzmxZ>MLc(A0ZOc2HD zUGb>qy@vi{k}cI=#x-KuD<Q5+p7C&h$AFd@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Wy?7-BDyRWJpeJw3cWrd?l(JRlNMba~-DYys(67*OAg&#{M6|I_ne?EA^b zim1FlA&+Rc7dIDgFCO9-!NM;-!N06N$WpxoGr)hvl+WKnvw`O&33Zuk5=r47j(&Cp z7HS(6?EYx9qnq+a|A!xd0O)`khUwoj3#$ivhl`uds1pQFjx>e*zl~r2FWP<(<8NvO zRLKSO|JYZIjB>A;L?4BVj78LWRMU)EK|Kxg;hx!%^Y0x0KnUa?*d6rozs{O?S}C8_ z;ku&tg3Ji@AIqWFZM;U2PW?xmedr2Qhs?nAjlWVefi-jnWOF(q?D}Ij3$wow;+e{R z0~_4Z2dVzFDAt{H>WKHDSjIdn_umHX!z0YYhqPvMe>@yNVesKpcdUO2{4?x7{t_Db zZjz^<yW~K3jgiMf{tUYbUDnk^8~w+4Le`nuzoX&_IVi=agMOn?LCwUz8Fp6K-AQL4 z*^38<QIM{hy%YWmm`F1k`Ws@1xTpAoA*2-B$RqeqGT>%$dj4i&_mB4fX8C7Ei$1N~ zZ(Kfo0(tZdW&kt-ee(#F8+U+QQh(zb8Q;gE3hmP286fh{pD&*TSOu+<9&8*b`HGpL z9Wd1YkLaf3UWV4B_6HrRXM~L&(L5eJ9Z)Qw|HgBj-+n(94P*zp19b1lT+^$D=YyT- zkhPu}=x-{T5XYoHR!R#%%OZk;?2UQ@9=PvZDuNYr{3-V13X-4z>(mf4SO>T$a{S-e zUL+|Z#?_QJ-sN*Oq`syC%2#;%)$MQvu}6^~TVF&L@4iPS5aT13^#Aw`a?SYvKP<RK A*8l(j literal 0 HcmV?d00001 diff --git a/testcode/lib/apple2/venice.dhgr b/testcode/lib/apple2/venice.dhgr new file mode 100644 index 0000000000000000000000000000000000000000..9d3cb4c85fa213095c6b72c9bfbe01a03fbeec3e GIT binary patch literal 16384 zcmYj&jbGYm6D?A76Rcf=Mg?mNF(7#&Pz0nT<wFb>5G-H<0)}*5wHPF9)sQVI<X^wT z-mCAGpSW7vc|K;&IddlK7B=dHu;Czz8v@}V>O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2/werner.pic b/testcode/lib/apple2/werner.hgr similarity index 100% rename from testcode/lib/apple2/werner.pic rename to testcode/lib/apple2/werner.hgr diff --git a/testcode/lib/apple2/werner.s b/testcode/lib/apple2/werner.s index 6456ade13..f9200f694 100644 --- a/testcode/lib/apple2/werner.s +++ b/testcode/lib/apple2/werner.s @@ -1,2 +1,2 @@ .segment "HGR" -.incbin "werner.pic" +.incbin "werner.hgr" diff --git a/testcode/lib/apple2/winston.hgr b/testcode/lib/apple2/winston.hgr new file mode 100644 index 0000000000000000000000000000000000000000..074ff178dafd641584342c249b06d3bc5712eea8 GIT binary patch literal 8184 zcmZvh&1>7r-p8-igc=7<VmKz7=Mv$w5i;0!S!}3Ou(?|YJa}`2%3TE&oF1rgNn+3Z z>CfjoBgt~p5wVrgXuiMqm$8YK{m0Y{hN(#p<GgRGy{*S$7`wzU-(FQQ*`Ms}K3P@G zBL6)z&gf=l23mVKalhj)%hQp|lgAhPQ;%(CKJ^?UE?)mt4-;L1zv>Hr6z6mQu3yaR zG{3~(6%(GnKE$gRYs(iq<9T&_wRSszF5w4Sb+3`F7bg0_^Dqvn`Rwr_p}`-e%Le21 zKHjuz^~N?`xt8~^^TgVteQ?X9=id6mv9QJY_Vu6_p2O;cc(>P}<XJDxp$1x^W|XdO z#J)y@Z^lOQ=PK+d_EOZ#8n1`((pjEBcett&e0FoWdyC$z{p&3{&NNfJlqZ`(%S0=g z2q4bA+&gqQKH7sVdGdEN-{KF)%YN9sSoALOt%d)$=OW$L`1@TM<TGAj1>oDpR*KIC zE)TX?_`RkrjO&SWjnpKgPv`lD|K4~L@T=qPU1H{8as4?3-xf7Ga@ZB&!I-a!@Wr!m z%g@`LWK#-%F*?I==XIL(qP+h-IzMRehvTb&zdPQz*!calryuFkt-<g-r5)P-V)idq zJlE@NIdG>Uwb@bl^D_!}9y3SB*FVukJI?st{^r}tX1~gR3;z9A_zM!4V`CG^8M}Y6 zk+2(k*<z2_nO}Dtv>?q*oIC6_YiwWB4Suu4ImE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Tx^=ua(*>f#c5%S+1UloMWtK^R^We219%2&eh in?6#Zg>$uyThBJg3;B;pL=0&4CvG*y<=4vvUH=c;+V0u_ literal 0 HcmV?d00001 From e2b38c96f887b75f0bf7d0a4854683e9c775b9cd Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Fri, 30 Mar 2018 00:10:55 +0200 Subject: [PATCH 199/254] Adjusted style. --- testcode/lib/apple2/hgrshow.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testcode/lib/apple2/hgrshow.c b/testcode/lib/apple2/hgrshow.c index 5d839b5fa..518395715 100644 --- a/testcode/lib/apple2/hgrshow.c +++ b/testcode/lib/apple2/hgrshow.c @@ -24,9 +24,9 @@ void main (void) if (!ext || strcasecmp (ext, ".hgr")) continue; - hgr = open(ent->d_name, O_RDONLY); - read(hgr, (void*)0x2000, 0x2000); - close(hgr); + hgr = open (ent->d_name, O_RDONLY); + read (hgr, (void*)0x2000, 0x2000); + close (hgr); if (cgetc () == '\r') break; From a7ae8e0a188d1e45033afa50040e2ebb1b961090 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Fri, 30 Mar 2018 00:11:40 +0200 Subject: [PATCH 200/254] Adjusted style. --- testcode/lib/apple2/dhgrshow.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testcode/lib/apple2/dhgrshow.c b/testcode/lib/apple2/dhgrshow.c index 147ee01d6..f0b37e461 100644 --- a/testcode/lib/apple2/dhgrshow.c +++ b/testcode/lib/apple2/dhgrshow.c @@ -28,12 +28,12 @@ void main (void) if (!ext || strcasecmp (ext, ".dhgr")) continue; - hgr = open(ent->d_name, O_RDONLY); + hgr = open (ent->d_name, O_RDONLY); POKE (0xC055, 0); - read(hgr, (void*)0x2000, 0x2000); + read (hgr, (void*)0x2000, 0x2000); POKE (0xC054, 0); - read(hgr, (void*)0x2000, 0x2000); - close(hgr); + read (hgr, (void*)0x2000, 0x2000); + close (hgr); if (cgetc () == '\r') break; From 9db6f059ace9ea2dd6538a48e150fe4ca4e76a5a Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sat, 31 Mar 2018 18:59:15 -0700 Subject: [PATCH 201/254] Fixed cpu detection. --- libsrc/common/getcpu.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/common/getcpu.s b/libsrc/common/getcpu.s index 7fe002f65..2acff0635 100644 --- a/libsrc/common/getcpu.s +++ b/libsrc/common/getcpu.s @@ -53,7 +53,7 @@ _getcpu: adc #1 ; $01+$09 = $10 on 6502, $01+$09 = $0A on 2a03/2a07 cld cmp #10 - bne @L5 + beq @L5 lda #0 ; CPU_6502 constant beq @L9 @L5: From 098a30725f67e12ff030252ad4b983b39e2a55e3 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Sun, 1 Apr 2018 15:47:48 -0400 Subject: [PATCH 202/254] Moved declarations that are common to the C16 and the Plus4 libraries over to their common header. --- include/c16.h | 3 +-- include/cbm264.h | 13 +++++++++---- include/plus4.h | 11 +---------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/include/c16.h b/include/c16.h index c039218f9..beb2caa56 100644 --- a/include/c16.h +++ b/include/c16.h @@ -45,8 +45,7 @@ -/* Include the base header file for the 264 series. include file. - */ +/* Include the base header file for the 264 series. */ #include <cbm264.h> diff --git a/include/cbm264.h b/include/cbm264.h index 46fa64050..5e8a242a7 100644 --- a/include/cbm264.h +++ b/include/cbm264.h @@ -136,11 +136,16 @@ /* Code */ /*****************************************************************************/ +void fast (void); +/* Switch the CPU into double-clock mode. */ + +void slow (void); +/* Switch the CPU into single-clock mode. */ + +unsigned char isfast (void); +/* Returns 1 if the CPU is in double-clock mode. */ + /* End of cbm264.h */ #endif - - - - diff --git a/include/plus4.h b/include/plus4.h index 6edb947e5..c8aaf2eaf 100644 --- a/include/plus4.h +++ b/include/plus4.h @@ -45,8 +45,7 @@ -/* Include the base header file for the 264 series. include file. - */ +/* Include the base header file for the 264 series. */ #include <cbm264.h> /* Define hardware */ @@ -59,14 +58,6 @@ extern void plus4_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ extern void plus4_stdser_ser[]; -void fast (void); -/* Switch the CPU into double clock mode. */ - -void slow (void); -/* Switch the CPU into single clock mode. */ - -unsigned char isfast (void); -/* Returns 1 if the CPU is in double clock mode. */ /* End of plus4.h */ From 61e5b9d218c2893f38fe65878b95f933f3b5ed89 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sun, 1 Apr 2018 13:14:44 -0700 Subject: [PATCH 203/254] Changed #10 to #-basha for clarity. --- libsrc/common/getcpu.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/common/getcpu.s b/libsrc/common/getcpu.s index 2acff0635..169c56bbd 100644 --- a/libsrc/common/getcpu.s +++ b/libsrc/common/getcpu.s @@ -52,7 +52,7 @@ _getcpu: clc adc #1 ; $01+$09 = $10 on 6502, $01+$09 = $0A on 2a03/2a07 cld - cmp #10 + cmp #$0a beq @L5 lda #0 ; CPU_6502 constant beq @L9 From 89c3ed6d7f82de68fb909978529261ac2d88c09a Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Mon, 9 Apr 2018 19:36:53 -0700 Subject: [PATCH 204/254] Added C64/C128 SuperCPU accelerator functions and started on a generic framework for accelerators. --- asminc/accelerator.inc | 34 ++++++++++++ doc/c128.sgml | 12 ++++ doc/c64.sgml | 12 ++++ doc/funcref.sgml | 73 ++++++++++++++++++++++++ include/accelerator.h | 102 ++++++++++++++++++++++++++++++++++ libsrc/c128/acc_detect_scpu.s | 34 ++++++++++++ libsrc/c128/acc_scpu_speed.s | 59 ++++++++++++++++++++ libsrc/c64/acc_detect_scpu.s | 34 ++++++++++++ libsrc/c64/acc_scpu_speed.s | 59 ++++++++++++++++++++ 9 files changed, 419 insertions(+) create mode 100644 asminc/accelerator.inc create mode 100644 include/accelerator.h create mode 100755 libsrc/c128/acc_detect_scpu.s create mode 100755 libsrc/c128/acc_scpu_speed.s create mode 100644 libsrc/c64/acc_detect_scpu.s create mode 100644 libsrc/c64/acc_scpu_speed.s diff --git a/asminc/accelerator.inc b/asminc/accelerator.inc new file mode 100644 index 000000000..1bc8fb11e --- /dev/null +++ b/asminc/accelerator.inc @@ -0,0 +1,34 @@ +; +; Accelerator definitions. +; + +; --------------------------------------------------------------------------- +; Speed definitions for all accelerator, to be used as input for the 'set' +; functions. + + +SPEED_SLOW := $00 +SPEED_FAST := $FF + +SPEED_1X := SPEED_SLOW +SPEED_2X := 2 - 1 +SPEED_3X := 3 - 1 +SPEED_4X := 4 - 1 +SPEED_5X := 5 - 1 +SPEED_6X := 6 - 1 +SPEED_7X := 7 - 1 +SPEED_8X := 8 - 1 +SPEED_10X := 10 - 1 +SPEED_12X := 12 - 1 +SPEED_16X := 16 - 1 +SPEED_20X := 20 - 1 + + +; --------------------------------------------------------------------------- +; C64/C128 Super CPU cartridge + +SuperCPU_Slow := $D07A +SuperCPU_Fast := $D07B +SuperCPU_Speed_Mode := $D0B8 +SuperCPU_Detect := $D0BC + diff --git a/doc/c128.sgml b/doc/c128.sgml index 2bfb37a3d..9af66d62b 100644 --- a/doc/c128.sgml +++ b/doc/c128.sgml @@ -88,6 +88,18 @@ url="funcref.html" name="function reference"> for declaration and usage. </itemize> +<sect1>C128-specific accelerator functions<p> + +The functions listed below are accelerator functions for the C128. See the <url +url="funcref.html" name="function reference"> for declaration and usage. + +<itemize> +<item>detect_scpu +<item>scpu_get_speed +<item>scpu_set_speed +</itemize> + + <sect1>CBM-specific functions<p> Some functions are available for all (or at least most) of the Commodore diff --git a/doc/c64.sgml b/doc/c64.sgml index 7cca1aa09..05b87a22b 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -169,6 +169,18 @@ url="funcref.html" name="function reference"> for declaration and usage. </itemize> +<sect1>C64-specific accelerator functions<p> + +The functions listed below are accelerator functions for the C64. See the <url +url="funcref.html" name="function reference"> for declaration and usage. + +<itemize> +<item>detect_scpu +<item>scpu_get_speed +<item>scpu_set_speed +</itemize> + + <sect1>CBM-specific functions<p> Some functions are available for all (or at least most) of the Commodore diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 5f90cfd3e..e47a0c0a9 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -65,6 +65,15 @@ function. </itemize> +<sect1><tt/accelerator.h/<label id="accelerator.h"><p> + +<itemize> +<item><ref id="detect_scpu" name="detect_scpu"> +<item><ref id="get_scpu_speed" name="get_scpu_speed"> +<item><ref id="set_scpu_speed" name="set_scpu_speed"> +</itemize> + + <sect1><tt/apple2.h/<label id="apple2.h"><p> <itemize> @@ -2911,6 +2920,26 @@ used in presence of a prototype. </quote> +<sect1>detect_scpu<label id="detect_scpu"><p> + +<quote> +<descrip> +<tag/Function/Check for the presence of the C64/C128 SuperCPU cartridge. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char detect_scpu (void);/ +<tag/Description/The function returns a 1 if a SuperCPU cartridge has been detected. +<tag/Notes/<itemize> +<item>The function is specific to the C128 and C64. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="get_scpu_speed" name="get_scpu_speed">, +<ref id="set_scpu_speed" name="set_scpu_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>div<label id="div"><p> <quote> @@ -3450,6 +3479,28 @@ header files define constants that can be used to check the return code. </quote> +<sect1>get_scpu_speed<label id="get_scpu_speed"><p> + +<quote> +<descrip> +<tag/Function/Get the current speed of the C64/C128 SuperCPU cartridge. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char get_scpu_speed (void);/ +<tag/Description/The function returns the current speed of the SuperCPU cartridge. +<tag/Notes/<itemize> +<item>The function is specific to the C128 and C64. +<item>The function does not check for the presence of the cartridge. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_scpu" name="detect_scpu">, +<ref id="set_scpu_speed" name="set_scpu_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>getcpu<label id="getcpu"><p> <quote> @@ -6001,6 +6052,28 @@ clean-up when exitting the program. </quote> +<sect1>set_scpu_speed<label id="set_scpu_speed"><p> + +<quote> +<descrip> +<tag/Function/Set the current speed of the C64/C128 SuperCPU cartridge. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char set_scpu_speed (unsigned char speed);/ +<tag/Description/The function returns the speed after trying to set the speed of the SuperCPU cartridge. +<tag/Notes/<itemize> +<item>The function is specific to the C128 and C64. +<item>The function does not check for the presence of the cartridge. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_scpu" name="detect_scpu">, +<ref id="get_scpu_speed" name="get_scpu_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>setjmp<label id="setjmp"><p> <quote> diff --git a/include/accelerator.h b/include/accelerator.h new file mode 100644 index 000000000..7d1244233 --- /dev/null +++ b/include/accelerator.h @@ -0,0 +1,102 @@ +/*****************************************************************************/ +/* */ +/* accelerator.h */ +/* */ +/* Accelerator specific definitions */ +/* */ +/* */ +/* */ +/* (C) 2018 Marco van den Heuvel */ +/* EMail: blackystardust68@yahoo.com */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ +/* warranty. In no event will the authors be held liable for any damages */ +/* arising from the use of this software. */ +/* */ +/* Permission is granted to anyone to use this software for any purpose, */ +/* including commercial applications, and to alter it and redistribute it */ +/* freely, subject to the following restrictions: */ +/* */ +/* 1. The origin of this software must not be misrepresented; you must not */ +/* claim that you wrote the original software. If you use this software */ +/* in a product, an acknowledgment in the product documentation would be */ +/* appreciated but is not required. */ +/* 2. Altered source versions must be plainly marked as such, and must not */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ +/*****************************************************************************/ + + + +#ifndef _ACCELERATOR_H +#define _ACCELERATOR_H + +/*****************/ +/* Speed defines */ +/*****************/ + +#define SPEED_SLOW 0x00 +#define SPEED_FAST 0xFF + +#define SPEED_1X SPEED_SLOW +#define SPEED_2X 2 - 1 /* C64 Chameleon, C64DTV, C128, PET 65816, Apple2 Fast Chip, Apple2 TransWarp, Apple2 Zip Chip */ +#define SPEED_3X 3 - 1 /* C64 Chameleon, C65, PET 65816, Apple2 Booster, Apple 2 Fast Chip, Apple2 Titan, Apple2 TransWarp, Apple2 Zip Chip */ +#define SPEED_4X 4 - 1 /* C64 Chameleon, C64 TurboMaster, C64 TurboProcess, PET 65816, Apple2 Fast Chip, Apple2 Zip Chip */ +#define SPEED_5X 5 - 1 /* C64 Chameleon, PET 65816, Apple2 Fast Chip */ +#define SPEED_6X 6 - 1 /* C64 Chameleon, PET 65816, Apple2 Fast Chip */ +#define SPEED_7X 7 - 1 /* PET 65816, Apple2 Fast Chip */ +#define SPEED_8X 8 - 1 /* C64 Flash8, PET 65816, Apple 2 Fast Chip */ +#define SPEED_10X 10 - 1 /* PET 65816, Apple2 Fast Chip */ +#define SPEED_12X 12 - 1 /* Apple2 Fast Chip */ +#define SPEED_16X 16 - 1 /* Apple2 Fast Chip */ +#define SPEED_20X 20 - 1 /* C64/C128 SuperCPU */ + +/***********************************/ +/* Accelerator function prototypes */ +/***********************************/ + +/* C64/C128 SuperCPU cartridge */ + +extern unsigned char __fastcall__ set_scpu_speed (unsigned char speed); + +/* Set the speed of the SuperCPU cartridge, using SPEED_SLOW will switch to + * 1 Mhz mode, SPEED_20X or SPEED_FAST will switch to 20 Mhz mode. + * + * Note that any value lower than SPEED_20X will switch to 1 Mhz mode, and + * any value higher or equal to SPEED_20X will switch to 20 Mhz mode. + * + * This function will return the actual speed the CPU is at after trying + * to set the requested speed, if this is not the speed that was requested + * then possibly the hardware speed switch prevented any software speed + * switching. + * + * This function does not check for the presence of the SuperCPU cartridge, + * make sure you use 'detect_scpu();' before using. + */ + +extern unsigned char get_scpu_speed (void); + +/* Get the speed of the SuperCPU cartridge. + * + * Possible return values: + * SPEED_1X : 1 Mhz mode + * SPEED_20X : 20 Mhz mode + * + * This function does not check for the presence of the SuperCPU cartridge, + * make sure you use 'detect_scpu();' before using. + */ + +extern unsigned char detect_scpu (void); + +/* Check for the presence of the SuperCPU cartridge. + * + * Possible return values: + * 0x00 : SuperCPU cartridge not present + * 0x01 : SuperCPU cartridge present + */ + +/* End of accelerator.h */ +#endif diff --git a/libsrc/c128/acc_detect_scpu.s b/libsrc/c128/acc_detect_scpu.s new file mode 100755 index 000000000..e42d90548 --- /dev/null +++ b/libsrc/c128/acc_detect_scpu.s @@ -0,0 +1,34 @@ +; +; Marco van den Heuvel, 2018-04-08 +; + +; unsigned char detect_scpu (void); +; +;/* Check for the presence of the SuperCPU cartridge. +; * +; * Possible return values: +; * 0x00 : SuperCPU cartridge not present +; * 0x01 : SuperCPU cartridge present +; */ + + .export _detect_scpu + + .include "accelerator.inc" +_detect_scpu: + ldx #$00 + txa + +; Make sure the current CPU is a 65816 + clc + .byte $E2,$01 ; NOP #$01 on 6510 and 65(S)C02, LDA $(01,S),Y on 65CE02 and 4510, SEP #$01 on 65816 + bcc not_found ; carry will be set on 65816 + +; 65816 has been detected, make sure it's the SuperCPU cartridge + + lda SuperCPU_Detect + asl + bcs not_found +found: + lda #$01 +not_found: + rts diff --git a/libsrc/c128/acc_scpu_speed.s b/libsrc/c128/acc_scpu_speed.s new file mode 100755 index 000000000..4bd142bbb --- /dev/null +++ b/libsrc/c128/acc_scpu_speed.s @@ -0,0 +1,59 @@ +; +; Marco van den Heuvel, 2018-04-09 +; + +; extern unsigned char __fastcall__ set_scpu_speed (unsigned char speed); +; +;/* Set the speed of the SuperCPU cartridge, using SPEED_SLOW will switch to +; * 1 Mhz mode, SPEED_20X or SPEED_FAST will switch to 20 Mhz mode. +; * +; * Note that any value lower than SPEED_20X will switch to 1 Mhz mode, and +; * any value higher or equal to SPEED_20X will switch to 20 Mhz mode. +; * +; * This function will return the actual speed the CPU is at after trying +; * to set the requested speed, if this is not the speed that was requested +; * then possibly the hardware speed switch prevented any software speed +; * switching. +; * +; * This function does not check for the presence of the SuperCPU cartridge, +; * make sure you use 'detect_scpu();' before using. +; */ + +; extern unsigned char get_scpu_speed (void); +; +;/* Get the speed of the SuperCPU cartridge. +; * +; * Possible return values: +; * SPEED_1X : 1 Mhz mode +; * SPEED_20X : 20 Mhz mode +; * +; * This function does not check for the presence of the SuperCPU cartridge, +; * make sure you use 'detect_scpu();' before using. +; */ + + .export _set_scpu_speed + .export _get_scpu_speed + + .include "accelerator.inc" + +_set_scpu_speed: + cmp #SPEED_20X + bcs high_speed +low_speed: + sta SuperCPU_Slow + jmp _get_scpu_speed + +high_speed: + sta SuperCPU_Fast + +_get_scpu_speed: + ldx #$00 + lda SuperCPU_Speed_Mode + asl + asl + bcc is_fast_speed + lda #SPEED_1X + rts +is_fast_speed: + lda #SPEED_20X + rts diff --git a/libsrc/c64/acc_detect_scpu.s b/libsrc/c64/acc_detect_scpu.s new file mode 100644 index 000000000..e42d90548 --- /dev/null +++ b/libsrc/c64/acc_detect_scpu.s @@ -0,0 +1,34 @@ +; +; Marco van den Heuvel, 2018-04-08 +; + +; unsigned char detect_scpu (void); +; +;/* Check for the presence of the SuperCPU cartridge. +; * +; * Possible return values: +; * 0x00 : SuperCPU cartridge not present +; * 0x01 : SuperCPU cartridge present +; */ + + .export _detect_scpu + + .include "accelerator.inc" +_detect_scpu: + ldx #$00 + txa + +; Make sure the current CPU is a 65816 + clc + .byte $E2,$01 ; NOP #$01 on 6510 and 65(S)C02, LDA $(01,S),Y on 65CE02 and 4510, SEP #$01 on 65816 + bcc not_found ; carry will be set on 65816 + +; 65816 has been detected, make sure it's the SuperCPU cartridge + + lda SuperCPU_Detect + asl + bcs not_found +found: + lda #$01 +not_found: + rts diff --git a/libsrc/c64/acc_scpu_speed.s b/libsrc/c64/acc_scpu_speed.s new file mode 100644 index 000000000..4bd142bbb --- /dev/null +++ b/libsrc/c64/acc_scpu_speed.s @@ -0,0 +1,59 @@ +; +; Marco van den Heuvel, 2018-04-09 +; + +; extern unsigned char __fastcall__ set_scpu_speed (unsigned char speed); +; +;/* Set the speed of the SuperCPU cartridge, using SPEED_SLOW will switch to +; * 1 Mhz mode, SPEED_20X or SPEED_FAST will switch to 20 Mhz mode. +; * +; * Note that any value lower than SPEED_20X will switch to 1 Mhz mode, and +; * any value higher or equal to SPEED_20X will switch to 20 Mhz mode. +; * +; * This function will return the actual speed the CPU is at after trying +; * to set the requested speed, if this is not the speed that was requested +; * then possibly the hardware speed switch prevented any software speed +; * switching. +; * +; * This function does not check for the presence of the SuperCPU cartridge, +; * make sure you use 'detect_scpu();' before using. +; */ + +; extern unsigned char get_scpu_speed (void); +; +;/* Get the speed of the SuperCPU cartridge. +; * +; * Possible return values: +; * SPEED_1X : 1 Mhz mode +; * SPEED_20X : 20 Mhz mode +; * +; * This function does not check for the presence of the SuperCPU cartridge, +; * make sure you use 'detect_scpu();' before using. +; */ + + .export _set_scpu_speed + .export _get_scpu_speed + + .include "accelerator.inc" + +_set_scpu_speed: + cmp #SPEED_20X + bcs high_speed +low_speed: + sta SuperCPU_Slow + jmp _get_scpu_speed + +high_speed: + sta SuperCPU_Fast + +_get_scpu_speed: + ldx #$00 + lda SuperCPU_Speed_Mode + asl + asl + bcc is_fast_speed + lda #SPEED_1X + rts +is_fast_speed: + lda #SPEED_20X + rts From a50d214ffb2dd82055ae7117d33fa441a902722c Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 10 Apr 2018 18:37:10 +0000 Subject: [PATCH 205/254] Simpler get_tv You don't have to count the beam, just check the KERNAL. --- libsrc/vic20/get_tv.s | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/libsrc/vic20/get_tv.s b/libsrc/vic20/get_tv.s index 7182c0df7..9194a2c55 100644 --- a/libsrc/vic20/get_tv.s +++ b/libsrc/vic20/get_tv.s @@ -1,12 +1,11 @@ ; -; Stefan Haubenthal, 2004-10-07 -; Based on code from Pu-239 +; Stefan Haubenthal, 2018-04-10 +; Based on code by Mike ; ; unsigned char get_tv (void); ; /* Return the video mode the machine is using */ ; - .include "vic20.inc" .include "get_tv.inc" ;-------------------------------------------------------------------------- @@ -14,18 +13,13 @@ .proc _get_tv -NTSC_LINES = 261 ; detect the system lda #TV::NTSC tax -@L0: ldy VIC_HLINE - cpy #1 - bne @L0 ; wait for line 1 -@L1: ldy VIC_HLINE - beq @L2 ; line 0 reached -> NTSC - cpy #NTSC_LINES/2+2 - bne @L1 + ldy $EDE4 ; VIC init table + cpy #5 + beq @L0 lda #TV::PAL -@L2: rts ; system detected: 0 for NTSC, 1 for PAL +@L0: rts ; system detected: 0 for NTSC, 1 for PAL .endproc From e2cf4987cf297d3a8a6d5cfb1b5bf7c6f7fca644 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Tue, 10 Apr 2018 15:24:15 -0700 Subject: [PATCH 206/254] Added some accelerator test code. --- testcode/lib/accelerator/Makefile | 9 +++ testcode/lib/accelerator/c64-c128-scpu-test.c | 8 +++ testcode/lib/accelerator/turbo-test.c | 57 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 testcode/lib/accelerator/Makefile create mode 100755 testcode/lib/accelerator/c64-c128-scpu-test.c create mode 100644 testcode/lib/accelerator/turbo-test.c diff --git a/testcode/lib/accelerator/Makefile b/testcode/lib/accelerator/Makefile new file mode 100644 index 000000000..ece54ec36 --- /dev/null +++ b/testcode/lib/accelerator/Makefile @@ -0,0 +1,9 @@ +CL ?= cl65 + +all: c64-scpu-test.prg c128-scpu-test.prg + +c64-scpu-test.prg: c64-c128-scpu-test.c + $(CL) -t c64 c64-c128-scpu-test.c -o c64-scpu-test.prg + +c128-scpu-test.prg: c64-c128-scpu-test.c + $(CL) -t c128 c64-c128-scpu-test.c -o c128-scpu-test.prg diff --git a/testcode/lib/accelerator/c64-c128-scpu-test.c b/testcode/lib/accelerator/c64-c128-scpu-test.c new file mode 100755 index 000000000..975244df5 --- /dev/null +++ b/testcode/lib/accelerator/c64-c128-scpu-test.c @@ -0,0 +1,8 @@ +/* C64/C128 SuperCPU accelerator test code. */ + +#define ACC_DETECT detect_scpu +#define ACC_GET_SPEED get_scpu_speed +#define ACC_SET_SPEED set_scpu_speed +#define ACC_NAME "SuperCPU" + +#include "turbo-test.c" diff --git a/testcode/lib/accelerator/turbo-test.c b/testcode/lib/accelerator/turbo-test.c new file mode 100644 index 000000000..8c854c00c --- /dev/null +++ b/testcode/lib/accelerator/turbo-test.c @@ -0,0 +1,57 @@ +/* Accelerator test code. */ + +#ifndef ACC_DETECT +#error This file cannot be used directly (yet) +#endif + +#include <time.h> +#include <accelerator.h> +#include <stdio.h> +#include <conio.h> +#include <stdlib.h> + +static void print_time_taken(void) +{ + clock_t curtime = clock(); + clock_t newtime; + unsigned long i; + char buffer[10]; + + printf("Doing a speed test, please wait\n"); + for (i = 0; i < 0x1000; i++) { } + newtime = clock() - curtime; + ultoa(newtime, buffer, 10); + printf("Time taken : %s\n", buffer); +} + +static void print_current_speed(void) +{ + unsigned char status; + + status = ACC_GET_SPEED(); + printf("Current "ACC_NAME" speed : %d\n", status + 1); +} + +void main(void) +{ + unsigned char status; + unsigned char speed = 0; + + status = ACC_DETECT(); + clrscr(); + if (status == 0) { + printf("No "ACC_NAME" detected\n"); + } else { + status = ACC_GET_SPEED(); + print_current_speed(); + + /* cycle through all the speeds */ + for (speed = SPEED_1X; speed <= SPEED_20X; ++speed) { + printf("Setting "ACC_NAME" speed to %d\n", speed + 1); + ACC_SET_SPEED(speed); + print_current_speed(); + print_time_taken(); + } + ACC_SET_SPEED(status); + } +} From 165b98bba551c33e99523cb1ab3068a17ef87b9e Mon Sep 17 00:00:00 2001 From: Olli Savia <ops@iki.fi> Date: Wed, 11 Apr 2018 22:38:23 +0300 Subject: [PATCH 207/254] Added missing VIA registers. Register names from the COMPUTE!'s book 'Mapping the VIC' --- asminc/vic20.inc | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/asminc/vic20.inc b/asminc/vic20.inc index d882eb1ad..a428ee76f 100644 --- a/asminc/vic20.inc +++ b/asminc/vic20.inc @@ -66,16 +66,43 @@ VIC_COLOR := $900F ; Border and background color ; --------------------------------------------------------------------------- ; I/O: 6522 VIA1 -VIA1 := $9110 -VIA1_JOY := $9111 -VIA1_DDRB := $9112 -VIA1_DDRA := $9113 +VIA1 := $9110 ; *** Deprecated *** +VIA1_JOY := $9111 ; *** Deprecated *** +VIA1_PB := $9110 ; Port register B +VIA1_PA1 := $9111 ; Port register A +VIA1_DDRB := $9112 ; Data direction register B +VIA1_DDRA := $9113 ; Data direction register A +VIA1_T1CL := $9114 ; Timer 1, low byte +VIA1_T1CH := $9115 ; Timer 1, high byte +VIA1_T1LL := $9116 ; Timer 1 latch, low byte +VIA1_T1LH := $9117 ; Timer 1 latch, high byte +VIA1_T2CL := $9118 ; Timer 2, low byte +VIA1_T2CH := $9119 ; Timer 2, high byte +VIA1_SR := $911A ; Shift register +VIA1_CR := $911B ; Auxiliary control register +VIA1_PCR := $911C ; Peripheral control register +VIA1_IFR := $911D ; Interrupt flag register +VIA1_IER := $911E ; Interrupt enable register +VIA1_PA2 := $911F ; Port register A w/o handshake ; --------------------------------------------------------------------------- ; I/O: 6522 VIA2 -VIA2 := $9120 -VIA2_JOY := $9120 -VIA2_DDRB := $9122 -VIA2_DDRA := $9123 - +VIA2 := $9120 ; *** Deprecated *** +VIA2_JOY := $9120 ; *** Deprecated *** +VIA2_PB := $9120 ; Port register B +VIA2_PA1 := $9121 ; Port register A +VIA2_DDRB := $9122 ; Data direction register B +VIA2_DDRA := $9123 ; Data direction register A +VIA2_T1CL := $9124 ; Timer 1, low byte +VIA2_T1CH := $9125 ; Timer 1, high byte +VIA2_T1LL := $9126 ; Timer 1 latch, low byte +VIA2_T1LH := $9127 ; Timer 1 latch, high byte +VIA2_T2CL := $9128 ; Timer 2, low byte +VIA2_T2CH := $9129 ; Timer 2, high byte +VIA2_SR := $912A ; Shift register +VIA2_CR := $912B ; Auxiliary control register +VIA2_PCR := $912C ; Peripheral control register +VIA2_IFR := $912D ; Interrupt flag register +VIA2_IER := $912E ; Interrupt enable register +VIA2_PA2 := $912F ; Port register A w/o handshake From 79433ddb60a9d55d3bd0195d24f97238b0b90540 Mon Sep 17 00:00:00 2001 From: Olli Savia <ops@iki.fi> Date: Wed, 11 Apr 2018 22:40:46 +0300 Subject: [PATCH 208/254] Updated to use the new VIA register names. --- libsrc/vic20/joy/vic20-ptvjoy.s | 15 +++++++-------- libsrc/vic20/joy/vic20-stdjoy.s | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/libsrc/vic20/joy/vic20-ptvjoy.s b/libsrc/vic20/joy/vic20-ptvjoy.s index bf0ff128e..496653e9d 100644 --- a/libsrc/vic20/joy/vic20-ptvjoy.s +++ b/libsrc/vic20/joy/vic20-ptvjoy.s @@ -40,7 +40,6 @@ ; ------------------------------------------------------------------------ ; Constants -VIA1_PRB := VIA1 ; User port register JOY_COUNT = 3 ; Number of joysticks we support @@ -91,13 +90,13 @@ joy1: lda #$7F ; mask for VIA2 JOYBIT: sw3 ldy VIA2_DDRB ; remember the date of DDRB sta VIA2_DDRB ; set JOYBITS on this VIA for input - lda VIA2_JOY ; read JOYBIT: sw3 + lda VIA2_PB ; read JOYBIT: sw3 sty VIA2_DDRB ; restore the state of DDRB asl ; Shift sw3 into carry ldy VIA1_DDRA ; remember the state of DDRA stx VIA1_DDRA ; set JOYBITS on this VIA for input - lda VIA1_JOY ; read JOYBITS: sw0,sw1,sw2,sw4 + lda VIA1_PA1 ; read JOYBITS: sw0,sw1,sw2,sw4 sty VIA1_DDRA ; restore the state of DDRA cli ; necessary? @@ -127,9 +126,9 @@ joy2: lda #%10000000 ; via port B Data-Direction bne joy3 lda #$80 ; via port B read/write - sta VIA1_PRB ; (output one at PB7) + sta VIA1_PB ; (output one at PB7) - lda VIA1_PRB ; via port B read/write + lda VIA1_PB ; via port B read/write and #$1F ; get bit 4-0 (PB4-PB0) eor #$1F rts @@ -137,13 +136,13 @@ joy2: lda #%10000000 ; via port B Data-Direction ; Read joystick 3 joy3: lda #$00 ; via port B read/write - sta VIA1_PRB ; (output zero at PB7) + sta VIA1_PB ; (output zero at PB7) - lda VIA1_PRB ; via port B read/write + lda VIA1_PB ; via port B read/write and #$0F ; get bit 3-0 (PB3-PB0) sta tmp1 ; joy 4 directions - lda VIA1_PRB ; via port B read/write + lda VIA1_PB ; via port B read/write and #%00100000 ; get bit 5 (PB5) lsr ora tmp1 diff --git a/libsrc/vic20/joy/vic20-stdjoy.s b/libsrc/vic20/joy/vic20-stdjoy.s index e5539c653..ee8dc93d7 100644 --- a/libsrc/vic20/joy/vic20-stdjoy.s +++ b/libsrc/vic20/joy/vic20-stdjoy.s @@ -90,13 +90,13 @@ READ: lda #$7F ; mask for VIA2 JOYBIT: sw3 ldy VIA2_DDRB ; remember the date of DDRB sta VIA2_DDRB ; set JOYBITS on this VIA for input - lda VIA2_JOY ; read JOYBIT: sw3 + lda VIA2_PB ; read JOYBIT: sw3 sty VIA2_DDRB ; restore the state of DDRB asl ; Shift sw3 into carry ldy VIA1_DDRA ; remember the state of DDRA stx VIA1_DDRA ; set JOYBITS on this VIA for input - lda VIA1_JOY ; read JOYBITS: sw0,sw1,sw2,sw4 + lda VIA1_PA1 ; read JOYBITS: sw0,sw1,sw2,sw4 sty VIA1_DDRA ; restore the state of DDRA cli ; necessary? From 859422f357b16198e17505d729f8b3166326bdf9 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Thu, 12 Apr 2018 09:35:02 -0700 Subject: [PATCH 209/254] Fixed non-address constants. --- asminc/accelerator.inc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/asminc/accelerator.inc b/asminc/accelerator.inc index 1bc8fb11e..f86ce8b2d 100644 --- a/asminc/accelerator.inc +++ b/asminc/accelerator.inc @@ -7,21 +7,21 @@ ; functions. -SPEED_SLOW := $00 -SPEED_FAST := $FF +SPEED_SLOW = $00 +SPEED_FAST = $FF -SPEED_1X := SPEED_SLOW -SPEED_2X := 2 - 1 -SPEED_3X := 3 - 1 -SPEED_4X := 4 - 1 -SPEED_5X := 5 - 1 -SPEED_6X := 6 - 1 -SPEED_7X := 7 - 1 -SPEED_8X := 8 - 1 -SPEED_10X := 10 - 1 -SPEED_12X := 12 - 1 -SPEED_16X := 16 - 1 -SPEED_20X := 20 - 1 +SPEED_1X = SPEED_SLOW +SPEED_2X = 2 - 1 +SPEED_3X = 3 - 1 +SPEED_4X = 4 - 1 +SPEED_5X = 5 - 1 +SPEED_6X = 6 - 1 +SPEED_7X = 7 - 1 +SPEED_8X = 8 - 1 +SPEED_10X = 10 - 1 +SPEED_12X = 12 - 1 +SPEED_16X = 16 - 1 +SPEED_20X = 20 - 1 ; --------------------------------------------------------------------------- From 59cb7da334955a391b754c12dcb1c3c1e6162c35 Mon Sep 17 00:00:00 2001 From: Olli Savia <ops@iki.fi> Date: Sat, 14 Apr 2018 08:39:30 +0300 Subject: [PATCH 210/254] VIA1 and VIA2 no longer marked deprecated --- asminc/vic20.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asminc/vic20.inc b/asminc/vic20.inc index a428ee76f..9c8ca8a35 100644 --- a/asminc/vic20.inc +++ b/asminc/vic20.inc @@ -66,7 +66,7 @@ VIC_COLOR := $900F ; Border and background color ; --------------------------------------------------------------------------- ; I/O: 6522 VIA1 -VIA1 := $9110 ; *** Deprecated *** +VIA1 := $9110 ; VIA1 base address VIA1_JOY := $9111 ; *** Deprecated *** VIA1_PB := $9110 ; Port register B VIA1_PA1 := $9111 ; Port register A @@ -88,7 +88,7 @@ VIA1_PA2 := $911F ; Port register A w/o handshake ; --------------------------------------------------------------------------- ; I/O: 6522 VIA2 -VIA2 := $9120 ; *** Deprecated *** +VIA2 := $9120 ; VIA2 base address VIA2_JOY := $9120 ; *** Deprecated *** VIA2_PB := $9120 ; Port register B VIA2_PA1 := $9121 ; Port register A From 7b1db91d36a3f703b2ad6de2c23e11b46ee800bd Mon Sep 17 00:00:00 2001 From: Olli Savia <ops@iki.fi> Date: Sat, 14 Apr 2018 18:45:15 +0300 Subject: [PATCH 211/254] Changed register addresses relative to the base address --- asminc/vic20.inc | 68 ++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/asminc/vic20.inc b/asminc/vic20.inc index 9c8ca8a35..6ac7ef35c 100644 --- a/asminc/vic20.inc +++ b/asminc/vic20.inc @@ -67,42 +67,42 @@ VIC_COLOR := $900F ; Border and background color ; I/O: 6522 VIA1 VIA1 := $9110 ; VIA1 base address -VIA1_JOY := $9111 ; *** Deprecated *** -VIA1_PB := $9110 ; Port register B -VIA1_PA1 := $9111 ; Port register A -VIA1_DDRB := $9112 ; Data direction register B -VIA1_DDRA := $9113 ; Data direction register A -VIA1_T1CL := $9114 ; Timer 1, low byte -VIA1_T1CH := $9115 ; Timer 1, high byte -VIA1_T1LL := $9116 ; Timer 1 latch, low byte -VIA1_T1LH := $9117 ; Timer 1 latch, high byte -VIA1_T2CL := $9118 ; Timer 2, low byte -VIA1_T2CH := $9119 ; Timer 2, high byte -VIA1_SR := $911A ; Shift register -VIA1_CR := $911B ; Auxiliary control register -VIA1_PCR := $911C ; Peripheral control register -VIA1_IFR := $911D ; Interrupt flag register -VIA1_IER := $911E ; Interrupt enable register -VIA1_PA2 := $911F ; Port register A w/o handshake +VIA1_JOY := VIA1+$0 ; *** Deprecated *** +VIA1_PB := VIA1+$0 ; Port register B +VIA1_PA1 := VIA1+$1 ; Port register A +VIA1_DDRB := VIA1+$2 ; Data direction register B +VIA1_DDRA := VIA1+$3 ; Data direction register A +VIA1_T1CL := VIA1+$4 ; Timer 1, low byte +VIA1_T1CH := VIA1+$5 ; Timer 1, high byte +VIA1_T1LL := VIA1+$6 ; Timer 1 latch, low byte +VIA1_T1LH := VIA1+$7 ; Timer 1 latch, high byte +VIA1_T2CL := VIA1+$8 ; Timer 2, low byte +VIA1_T2CH := VIA1+$9 ; Timer 2, high byte +VIA1_SR := VIA1+$A ; Shift register +VIA1_CR := VIA1+$B ; Auxiliary control register +VIA1_PCR := VIA1+$C ; Peripheral control register +VIA1_IFR := VIA1+$D ; Interrupt flag register +VIA1_IER := VIA1+$E ; Interrupt enable register +VIA1_PA2 := VIA1+$F ; Port register A w/o handshake ; --------------------------------------------------------------------------- ; I/O: 6522 VIA2 VIA2 := $9120 ; VIA2 base address -VIA2_JOY := $9120 ; *** Deprecated *** -VIA2_PB := $9120 ; Port register B -VIA2_PA1 := $9121 ; Port register A -VIA2_DDRB := $9122 ; Data direction register B -VIA2_DDRA := $9123 ; Data direction register A -VIA2_T1CL := $9124 ; Timer 1, low byte -VIA2_T1CH := $9125 ; Timer 1, high byte -VIA2_T1LL := $9126 ; Timer 1 latch, low byte -VIA2_T1LH := $9127 ; Timer 1 latch, high byte -VIA2_T2CL := $9128 ; Timer 2, low byte -VIA2_T2CH := $9129 ; Timer 2, high byte -VIA2_SR := $912A ; Shift register -VIA2_CR := $912B ; Auxiliary control register -VIA2_PCR := $912C ; Peripheral control register -VIA2_IFR := $912D ; Interrupt flag register -VIA2_IER := $912E ; Interrupt enable register -VIA2_PA2 := $912F ; Port register A w/o handshake +VIA2_JOY := VIA2+$0 ; *** Deprecated *** +VIA2_PB := VIA2+$0 ; Port register B +VIA2_PA1 := VIA2+$1 ; Port register A +VIA2_DDRB := VIA2+$2 ; Data direction register B +VIA2_DDRA := VIA2+$3 ; Data direction register A +VIA2_T1CL := VIA2+$4 ; Timer 1, low byte +VIA2_T1CH := VIA2+$5 ; Timer 1, high byte +VIA2_T1LL := VIA2+$6 ; Timer 1 latch, low byte +VIA2_T1LH := VIA2+$7 ; Timer 1 latch, high byte +VIA2_T2CL := VIA2+$8 ; Timer 2, low byte +VIA2_T2CH := VIA2+$9 ; Timer 2, high byte +VIA2_SR := VIA2+$A ; Shift register +VIA2_CR := VIA2+$B ; Auxiliary control register +VIA2_PCR := VIA2+$C ; Peripheral control register +VIA2_IFR := VIA2+$D ; Interrupt flag register +VIA2_IER := VIA2+$E ; Interrupt enable register +VIA2_PA2 := VIA2+$F ; Port register A w/o handshake From 6076316f38a6d72081f6b90998ced0b7b7abe209 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sat, 14 Apr 2018 10:40:13 -0700 Subject: [PATCH 212/254] Added c64dtv accelerator code and documentation. --- asminc/accelerator.inc | 8 +++ doc/c64.sgml | 7 ++- doc/funcref.sgml | 67 ++++++++++++++++++++++++++ include/accelerator.h | 38 +++++++++++++++ libsrc/c64/acc_c64dtv_speed.s | 64 ++++++++++++++++++++++++ libsrc/c64/acc_detect_c64dtv.s | 43 +++++++++++++++++ testcode/lib/accelerator/Makefile | 6 ++- testcode/lib/accelerator/c64dtv-test.c | 8 +++ 8 files changed, 238 insertions(+), 3 deletions(-) create mode 100755 libsrc/c64/acc_c64dtv_speed.s create mode 100755 libsrc/c64/acc_detect_c64dtv.s create mode 100755 testcode/lib/accelerator/c64dtv-test.c diff --git a/asminc/accelerator.inc b/asminc/accelerator.inc index f86ce8b2d..1008b49c1 100644 --- a/asminc/accelerator.inc +++ b/asminc/accelerator.inc @@ -32,3 +32,11 @@ SuperCPU_Fast := $D07B SuperCPU_Speed_Mode := $D0B8 SuperCPU_Detect := $D0BC + +; --------------------------------------------------------------------------- +; C64DTV + +C64DTV_Extended_Regs := $D03F + +C64DTV_Slow = $00 +C64DTV_Fast = $03 diff --git a/doc/c64.sgml b/doc/c64.sgml index 05b87a22b..f1e678c72 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -175,9 +175,12 @@ The functions listed below are accelerator functions for the C64. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> +<item>detect_c64dtv <item>detect_scpu -<item>scpu_get_speed -<item>scpu_set_speed +<item>get_c64dtv_speed +<item>get_scpu_speed +<item>set_c64dtv_speed +<item>set_scpu_speed </itemize> diff --git a/doc/funcref.sgml b/doc/funcref.sgml index e47a0c0a9..4dfbf29e0 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -68,8 +68,11 @@ function. <sect1><tt/accelerator.h/<label id="accelerator.h"><p> <itemize> +<item><ref id="detect_c64dtv" name="detect_c64dtv"> <item><ref id="detect_scpu" name="detect_scpu"> +<item><ref id="get_c64dtv_speed" name="get_c64dtv_speed"> <item><ref id="get_scpu_speed" name="get_scpu_speed"> +<item><ref id="set_c64dtv_speed" name="set_c64dtv_speed"> <item><ref id="set_scpu_speed" name="set_scpu_speed"> </itemize> @@ -2920,6 +2923,26 @@ used in presence of a prototype. </quote> +<sect1>detect_c64dtv<label id="detect_c64dtv"><p> + +<quote> +<descrip> +<tag/Function/Check for the presence of the C64DTV. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char detect_c64dtv (void);/ +<tag/Description/The function returns a 1 if a C64DTV has been detected. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="get_scpu_speed" name="get_c64dtv_speed">, +<ref id="set_scpu_speed" name="set_c64dtv_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>detect_scpu<label id="detect_scpu"><p> <quote> @@ -3479,6 +3502,28 @@ header files define constants that can be used to check the return code. </quote> +<sect1>get_c64dtv_speed<label id="get_c64dtv_speed"><p> + +<quote> +<descrip> +<tag/Function/Get the current speed of the C64DTV. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char get_c64dtv_speed (void);/ +<tag/Description/The function returns the current speed of the C64DTV. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of the cartridge. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_c64dtv" name="detect_c64dtv">, +<ref id="set_c64dtv_speed" name="set_c64dtv_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>get_scpu_speed<label id="get_scpu_speed"><p> <quote> @@ -6052,6 +6097,28 @@ clean-up when exitting the program. </quote> +<sect1>set_c64dtv_speed<label id="set_c64dtv_speed"><p> + +<quote> +<descrip> +<tag/Function/Set the current speed of the C64DTV. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char set_c64dtv_speed (unsigned char speed);/ +<tag/Description/The function returns the speed after trying to set the speed of the C64DTV. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of the C64DTV. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_c64dtv" name="detect_c64dtv">, +<ref id="get_c64dtv_speed" name="get_c64dtv_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>set_scpu_speed<label id="set_scpu_speed"><p> <quote> diff --git a/include/accelerator.h b/include/accelerator.h index 7d1244233..336bbb036 100644 --- a/include/accelerator.h +++ b/include/accelerator.h @@ -98,5 +98,43 @@ extern unsigned char detect_scpu (void); * 0x01 : SuperCPU cartridge present */ + +/* C64DTV */ + +extern unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed); + +/* Set the speed of the C64DTV, using SPEED_SLOW will switch to + * slow mode, SPEED_2X or SPEED_FAST will switch to fast mode. + * + * Note that any value higher or equal to SPEED_2X will switch to fast mode. + * + * This function will return the actual speed the CPU is at after trying + * to set the requested speed, to my knowledge the switch should not fail. + * + * This function does not check for the presence of the C64DTV, + * make sure you use 'detect_c64dtv();' before using. + */ + +extern unsigned char get_c64dtv_speed (void); + +/* Get the speed of the C64DTV. + * + * Possible return values: + * SPEED_1X : slow mode + * SPEED_2X : fast mode + * + * This function does not check for the presence of the C64DTV, + * make sure you use 'detect_c64dtv();' before using. + */ + +extern unsigned char detect_c64dtv (void); + +/* Check for the presence of the C64DTV. + * + * Possible return values: + * 0x00 : C64DTV not present + * 0x01 : C64DTV present + */ + /* End of accelerator.h */ #endif diff --git a/libsrc/c64/acc_c64dtv_speed.s b/libsrc/c64/acc_c64dtv_speed.s new file mode 100755 index 000000000..9cf49673e --- /dev/null +++ b/libsrc/c64/acc_c64dtv_speed.s @@ -0,0 +1,64 @@ +; +; Marco van den Heuvel, 2018-04-14 +; + +; extern unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed); +; +;/* Set the speed of the C64DTV, using SPEED_SLOW will switch to +; * slow mode, SPEED_2X or SPEED_FAST will switch to fast mode. +; * +; * Note that any value higher or equal to SPEED_2X will switch to fast mode. +; * +; * This function will return the actual speed the CPU is at after trying +; * to set the requested speed, to my knowledge this should not happen. +; * +; * This function does not check for the presence of the C64DTV, +; * make sure you use 'detect_c64dtv();' before using. +; */ + +; extern unsigned char get_c64dtv_speed (void); +; +;/* Get the speed of the C64DTV. +; * +; * Possible return values: +; * SPEED_1X : slow mode +; * SPEED_2X : fast mode +; * +; * This function does not check for the presence of the C64DTV, +; * make sure you use 'detect_c64dtv();' before using. +; */ + + .export _set_c64dtv_speed + .export _get_c64dtv_speed + + .include "accelerator.inc" + +_set_c64dtv_speed: + cmp #SPEED_2X + bcs high_speed +low_speed: + ldx #C64DTV_Slow +set_speed: + .byte $32,$99 ; SAC #$99 set accumulator to reg 9 (cpu control) + txa ; (re)set skip and burst bits + .byte $32,$00 ; SAC #$99 set accumulator back to reg 0 + jmp _get_c64dtv_speed + +high_speed: + ldx #C64DTV_Fast + bne set_speed + + +_get_c64dtv_speed: + .byte $32,$99 ; SAC #$99 set accumulator to reg 9 (cpu control) + tax + .byte $32,$00 ; SAC #$99 set accumulator back to reg 0 + txa + and #C64DTV_Fast + bne in_fast_mode + lda #$00 + .byte $2C +in_fast_mode: + lda #$01 + ldx #$00 + rts diff --git a/libsrc/c64/acc_detect_c64dtv.s b/libsrc/c64/acc_detect_c64dtv.s new file mode 100755 index 000000000..ce30806db --- /dev/null +++ b/libsrc/c64/acc_detect_c64dtv.s @@ -0,0 +1,43 @@ +; +; Marco van den Heuvel, 2018-04-14 +; + +; unsigned char detect_c64dtv (void); +; +;/* Check for the presence of the C64DTV. +; * +; * Possible return values: +; * 0x00 : C64DTV not present +; * 0x01 : C64DTV present +; */ + + .export _detect_c64dtv + + .include "accelerator.inc" + +_detect_c64dtv: + ldy C64DTV_Extended_Regs + lda #$00 + tax + +; Make sure the CPU is a 6510 + .byte $1A ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816 + bne not_found + lda #$01 + sta C64DTV_Extended_Regs + +; Check if $D000 is mirrored at $D040 + lda $D040 + cmp $D000 + bne found + inc $D040 + cmp $D000 + bne not_found +found: + lda #$01 + .byte $2C +not_found: + lda #$00 + sty C64DTV_Extended_Regs + rts + diff --git a/testcode/lib/accelerator/Makefile b/testcode/lib/accelerator/Makefile index ece54ec36..a9fe5f78d 100644 --- a/testcode/lib/accelerator/Makefile +++ b/testcode/lib/accelerator/Makefile @@ -1,9 +1,13 @@ CL ?= cl65 -all: c64-scpu-test.prg c128-scpu-test.prg +all: c64-scpu-test.prg c128-scpu-test.prg c64dtv-test.prg c64-scpu-test.prg: c64-c128-scpu-test.c $(CL) -t c64 c64-c128-scpu-test.c -o c64-scpu-test.prg c128-scpu-test.prg: c64-c128-scpu-test.c $(CL) -t c128 c64-c128-scpu-test.c -o c128-scpu-test.prg + +c64dtv-test.prg: c64dtv-test.c + $(CL) -t c64 c64dtv-test.c -o c64dtv-test.prg + diff --git a/testcode/lib/accelerator/c64dtv-test.c b/testcode/lib/accelerator/c64dtv-test.c new file mode 100755 index 000000000..34f0410d9 --- /dev/null +++ b/testcode/lib/accelerator/c64dtv-test.c @@ -0,0 +1,8 @@ +/* C64DTV accelerator test code. */ + +#define ACC_DETECT detect_c64dtv +#define ACC_GET_SPEED get_c64dtv_speed +#define ACC_SET_SPEED set_c64dtv_speed +#define ACC_NAME "C64DTV" + +#include "turbo-test.c" From cb04bc54655c0b6e66e54cf924a9cee017872af9 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sat, 14 Apr 2018 11:31:28 -0700 Subject: [PATCH 213/254] Fixed an issue with the changing the d040 value while detecting. --- libsrc/c64/acc_detect_c64dtv.s | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libsrc/c64/acc_detect_c64dtv.s b/libsrc/c64/acc_detect_c64dtv.s index ce30806db..1734095b1 100755 --- a/libsrc/c64/acc_detect_c64dtv.s +++ b/libsrc/c64/acc_detect_c64dtv.s @@ -18,7 +18,7 @@ _detect_c64dtv: ldy C64DTV_Extended_Regs lda #$00 - tax + ldx $D000 ; Make sure the CPU is a 6510 .byte $1A ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816 @@ -27,17 +27,18 @@ _detect_c64dtv: sta C64DTV_Extended_Regs ; Check if $D000 is mirrored at $D040 - lda $D040 - cmp $D000 + cpx $D040 bne found - inc $D040 - cmp $D000 + inc $D000 + cpx $D040 bne not_found found: lda #$01 .byte $2C not_found: lda #$00 + stx $D000 + ldx #$00 sty C64DTV_Extended_Regs rts From e34ef0fc17378df795a1fa01c2cefae0abb34d09 Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Sat, 14 Apr 2018 21:52:11 +0200 Subject: [PATCH 214/254] add cputc & remove --- asminc/telestrat.inc | 3 ++- libsrc/telestrat/cputc.s | 16 ++++++++++++++++ libsrc/telestrat/sysremove.s | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 libsrc/telestrat/cputc.s create mode 100644 libsrc/telestrat/sysremove.s diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index cb28919c2..956d31be3 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -172,7 +172,8 @@ XMUSIC = $45 XZAP = $46 XSHOOT = $47 XMKDIR = $4B ; create a folder. Only available in telemon 3.x -XSOUT = $67 ; send A register to RS232, available in telemon 2.4 & 3.x +XRM = $4D ; remove a folder or a file. Only available in telemon 3.x +XSOUT = $67 ; send accumulator value (A) to RS232, available in telemon 2.4 & 3.x : if RS232 buffer is full, the Oric Telestrat freezes XHRSSE = $8C ; set hires position cursor XDRAWA = $8D ; draw a line XDRAWR = $8E ; draw a line diff --git a/libsrc/telestrat/cputc.s b/libsrc/telestrat/cputc.s new file mode 100644 index 000000000..d107446c3 --- /dev/null +++ b/libsrc/telestrat/cputc.s @@ -0,0 +1,16 @@ +; 2018-04-13, Jede (jede@oric.org) +; + +; void cputc (char c); +; + + .export _cputc + + + .include "telestrat.inc" + +.proc _cputc + BRK_TELEMON XWR0 ; macro send char to screen (channel 0 in telemon terms) + rts +.endproc + diff --git a/libsrc/telestrat/sysremove.s b/libsrc/telestrat/sysremove.s new file mode 100644 index 000000000..565dfc111 --- /dev/null +++ b/libsrc/telestrat/sysremove.s @@ -0,0 +1,16 @@ +; +; Jede, 10.11.2017 +; +; unsigned char __fastcall__ _sysremove (const char* name); +; + + .export __sysremove + + + .include "zeropage.inc" + .include "telestrat.inc" + +__sysremove: + ; Push name + BRK_TELEMON(XRM) + rts From 626fed88b7b3bd30390be7b6e8da31581b6e8a9c Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Sat, 14 Apr 2018 22:05:03 +0200 Subject: [PATCH 215/254] chline added --- libsrc/telestrat/chline.s | 22 ++++++++++++++++++++++ libsrc/telestrat/cputc.s | 1 - 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 libsrc/telestrat/chline.s diff --git a/libsrc/telestrat/chline.s b/libsrc/telestrat/chline.s new file mode 100644 index 000000000..16e57d5fd --- /dev/null +++ b/libsrc/telestrat/chline.s @@ -0,0 +1,22 @@ +; +; jede jede@oric.org 2018-04-17 +; + +; void chline (unsigned char length); +; + + .export _chline + .include "telestrat.inc" + .include "zeropage.inc" + + +.proc _chline + sta tmp1 +@loop: + lda #'-' ; Horizontal line screen code + BRK_TELEMON XWR0 ; macro send char to screen (channel 0 in telemon terms) + dec tmp1 + bne @loop + rts +.endproc + diff --git a/libsrc/telestrat/cputc.s b/libsrc/telestrat/cputc.s index d107446c3..b4f2966a4 100644 --- a/libsrc/telestrat/cputc.s +++ b/libsrc/telestrat/cputc.s @@ -5,7 +5,6 @@ ; .export _cputc - .include "telestrat.inc" From 5f6d024804e08f858029094fa91b9c18d1f8c156 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Sat, 14 Apr 2018 18:09:13 -0400 Subject: [PATCH 216/254] Made the samples Makefile be able to build the samples for targets other than the ones named explicitly in that file. --- samples/Makefile | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/samples/Makefile b/samples/Makefile index 6a6d93bc1..8bb6d25ae 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -4,8 +4,8 @@ # This Makefile requires GNU make # -# Run 'make SYS=<target>' or set a SYS env -# var to build for another target system. +# Run 'make SYS=<target>'; or, set a SYS env. +# var. to build for another target system. SYS ?= c64 ifneq ($(shell echo),) @@ -41,13 +41,14 @@ ifneq ($(filter disk samples.%,$(MAKECMDGOALS)),) MOU := $(wildcard $(TARGET_PATH)/$(SYS)/drv/mou/*) TGI := $(wildcard $(TARGET_PATH)/$(SYS)/drv/tgi/*) - # This one comes with VICE + # This one comes with the VICE emulator. + # See http://vice-emu.sourceforge.net/ C1541 ?= c1541 - # For this one see https://applecommander.github.io/ + # For this one, see https://applecommander.github.io/ AC ?= ac.jar - # For this one see http://www.horus.com/~hias/atari/ + # For this one, see http://www.horus.com/~hias/atari/ DIR2ATR ?= dir2atr DISK_c64 = samples.d64 @@ -59,6 +60,8 @@ endif # -------------------------------------------------------------------------- # System-dependent settings +# For convenience, these groups and lines are sorted alphabetically, first +# by target-machine group, then by mission, then by program and sub-target. # The Apple machines need the start address adjusted when using TGI LDFLAGS_mandelbrot_apple2 = --start-addr 0x4000 @@ -94,15 +97,19 @@ LDFLAGS_tgidemo_atarixl = --start-addr 0x4000 $(AS) $(<:.c=.s) .s.o: - $(AS) $(AFLAGS) -t $(SYS) $< + $(AS) $(ASFLAGS) -t $(SYS) $< .PRECIOUS: %.o .o: - $(LD) $(LDFLAGS_$(@F)_$(SYS)) -o $@ -t $(SYS) -m $@.map $^ $(SYS).lib +ifeq ($(SYS),vic20) + $(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -C vic20-32k.cfg -m $@.map $^ $(SYS).lib +else + $(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -t $(SYS) -m $@.map $^ $(SYS).lib +endif # -------------------------------------------------------------------------- -# List of executables +# Lists of executables EXELIST_c64 = \ ascii \ @@ -150,6 +157,13 @@ EXELIST_atarixl = $(EXELIST_atari) EXELIST_atari2600 = \ atari2600hello +# Unlisted targets will try to build everything. +# That lets us learn what they cannot build, and what settings +# we need to use for programs that can be built and run. +ifndef EXELIST_$(SYS) +EXELIST_$(SYS) := ${patsubst %.c,%,$(wildcard *.c)} +endif + # -------------------------------------------------------------------------- # Rules to make the binaries and the disk @@ -164,10 +178,10 @@ all: # overlay file-names are shortenned to fit the Atari's 8.3-character limit. multdemo: multidemo.o - $(LD) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(SYS).lib + $(LD) $(LDFLAGS) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(SYS).lib ovrldemo: overlaydemo.o - $(LD) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(SYS).lib + $(LD) $(LDFLAGS) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(SYS).lib OVERLAYLIST := $(foreach I,1 2 3,multdemo.$I ovrldemo.$I) @@ -189,7 +203,7 @@ samples.d64: samples # -------------------------------------------------------------------------- # Rule to make an Apple II disk with all samples. Needs the AppleCommander -# program available at https://applecommander.github.io/ and a template disk +# program, available at https://applecommander.github.io/, and a template disk # named 'prodos.dsk'. define DSK_WRITE_BIN_recipe @@ -260,7 +274,7 @@ zip: # Clean-up rules mostlyclean: - @$(DEL) *.map *.o *.s 2>$(NULLDEV) + @$(DEL) *.lbl *.map *.o *.s 2>$(NULLDEV) clean: mostlyclean @$(DEL) $(EXELIST_$(SYS)) $(DISK_$(SYS)) 2>$(NULLDEV) From c5f15fa1d54fd476e9b3a852bb6699ccd57183a0 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sun, 15 Apr 2018 11:55:58 -0700 Subject: [PATCH 217/254] Fixed some comment and documentation errors. --- doc/funcref.sgml | 10 +++++----- libsrc/c64/acc_c64dtv_speed.s | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 4dfbf29e0..268c210fe 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -2936,8 +2936,8 @@ used in presence of a prototype. </itemize> <tag/Availability/cc65 (not all platforms) <tag/See also/ -<ref id="get_scpu_speed" name="get_c64dtv_speed">, -<ref id="set_scpu_speed" name="set_c64dtv_speed">, +<ref id="get_c64dtv_speed" name="get_c64dtv_speed">, +<ref id="set_c64dtv_speed" name="set_c64dtv_speed">, <tag/Example/None. </descrip> </quote> @@ -3512,7 +3512,7 @@ header files define constants that can be used to check the return code. <tag/Description/The function returns the current speed of the C64DTV. <tag/Notes/<itemize> <item>The function is specific to the C64. -<item>The function does not check for the presence of the cartridge. +<item>The function does not check for the presence of the C64DTV. <item>See the accelerator.h header for the speed definitions. </itemize> <tag/Availability/cc65 (not all platforms) @@ -6103,7 +6103,7 @@ clean-up when exitting the program. <descrip> <tag/Function/Set the current speed of the C64DTV. <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ -<tag/Declaration/<tt/unsigned char set_c64dtv_speed (unsigned char speed);/ +<tag/Declaration/<tt/unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);/ <tag/Description/The function returns the speed after trying to set the speed of the C64DTV. <tag/Notes/<itemize> <item>The function is specific to the C64. @@ -6125,7 +6125,7 @@ clean-up when exitting the program. <descrip> <tag/Function/Set the current speed of the C64/C128 SuperCPU cartridge. <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ -<tag/Declaration/<tt/unsigned char set_scpu_speed (unsigned char speed);/ +<tag/Declaration/<tt/unsigned char __fastcall__ set_scpu_speed (unsigned char speed);/ <tag/Description/The function returns the speed after trying to set the speed of the SuperCPU cartridge. <tag/Notes/<itemize> <item>The function is specific to the C128 and C64. diff --git a/libsrc/c64/acc_c64dtv_speed.s b/libsrc/c64/acc_c64dtv_speed.s index 9cf49673e..03bff8aa6 100755 --- a/libsrc/c64/acc_c64dtv_speed.s +++ b/libsrc/c64/acc_c64dtv_speed.s @@ -41,7 +41,7 @@ low_speed: set_speed: .byte $32,$99 ; SAC #$99 set accumulator to reg 9 (cpu control) txa ; (re)set skip and burst bits - .byte $32,$00 ; SAC #$99 set accumulator back to reg 0 + .byte $32,$00 ; SAC #$00 set accumulator back to reg 0 jmp _get_c64dtv_speed high_speed: From 0aa2735d4e12017de3dc834f3504da5116f0716a Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sun, 15 Apr 2018 12:15:19 -0700 Subject: [PATCH 218/254] Fixed another comment. --- libsrc/c64/acc_c64dtv_speed.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/c64/acc_c64dtv_speed.s b/libsrc/c64/acc_c64dtv_speed.s index 03bff8aa6..ff86751a5 100755 --- a/libsrc/c64/acc_c64dtv_speed.s +++ b/libsrc/c64/acc_c64dtv_speed.s @@ -10,7 +10,7 @@ ; * Note that any value higher or equal to SPEED_2X will switch to fast mode. ; * ; * This function will return the actual speed the CPU is at after trying -; * to set the requested speed, to my knowledge this should not happen. +; * to set the requested speed, to my knowlegde the switching should not fail. ; * ; * This function does not check for the presence of the C64DTV, ; * make sure you use 'detect_c64dtv();' before using. From ef73310ccef82ec6ed4e2b48fcc354c747468423 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Mon, 16 Apr 2018 11:05:52 -0700 Subject: [PATCH 219/254] Fixed more comments. --- libsrc/c64/acc_c64dtv_speed.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsrc/c64/acc_c64dtv_speed.s b/libsrc/c64/acc_c64dtv_speed.s index ff86751a5..6a8371a9c 100755 --- a/libsrc/c64/acc_c64dtv_speed.s +++ b/libsrc/c64/acc_c64dtv_speed.s @@ -10,7 +10,7 @@ ; * Note that any value higher or equal to SPEED_2X will switch to fast mode. ; * ; * This function will return the actual speed the CPU is at after trying -; * to set the requested speed, to my knowlegde the switching should not fail. +; * to set the requested speed, to my knowledge the switching should not fail. ; * ; * This function does not check for the presence of the C64DTV, ; * make sure you use 'detect_c64dtv();' before using. @@ -52,7 +52,7 @@ high_speed: _get_c64dtv_speed: .byte $32,$99 ; SAC #$99 set accumulator to reg 9 (cpu control) tax - .byte $32,$00 ; SAC #$99 set accumulator back to reg 0 + .byte $32,$00 ; SAC #$00 set accumulator back to reg 0 txa and #C64DTV_Fast bne in_fast_mode From cc2b5af6014a2ab60ed8cf446eca382039ffd727 Mon Sep 17 00:00:00 2001 From: jede <jede@oric.org> Date: Mon, 16 Apr 2018 21:51:15 +0200 Subject: [PATCH 220/254] Fix comment --- libsrc/telestrat/chline.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/telestrat/chline.s b/libsrc/telestrat/chline.s index 16e57d5fd..6ead10eee 100644 --- a/libsrc/telestrat/chline.s +++ b/libsrc/telestrat/chline.s @@ -13,7 +13,7 @@ .proc _chline sta tmp1 @loop: - lda #'-' ; Horizontal line screen code + lda #'-' ; horizontal line screen code BRK_TELEMON XWR0 ; macro send char to screen (channel 0 in telemon terms) dec tmp1 bne @loop From e235ac2a0ed8f9b4a413796fe10832d783b206e3 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Tue, 17 Apr 2018 16:53:10 -0400 Subject: [PATCH 221/254] Added a preprocessor guard to tgidemo.c that avoids a compiler warning. DoWarning() is compiled only if it will be used. --- samples/tgidemo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/samples/tgidemo.c b/samples/tgidemo.c index d8c2a6f50..6f3b86abc 100644 --- a/samples/tgidemo.c +++ b/samples/tgidemo.c @@ -49,8 +49,9 @@ static void CheckError (const char* S) +#if DYN_DRV static void DoWarning (void) -/* Warn the user that the TGI driver is needed for this program */ +/* Warn the user that the dynamic TGI driver is needed for this program */ { printf ("Warning: This program needs the TGI\n" "driver on disk! Press 'y' if you have\n" @@ -58,8 +59,9 @@ static void DoWarning (void) if (tolower (cgetc ()) != 'y') { exit (EXIT_SUCCESS); } - printf ("Ok. Please wait patiently...\n"); + printf ("OK. Please wait patiently...\n"); } +#endif From 7292b571deff92def83cc53a71cde488cad68ecf Mon Sep 17 00:00:00 2001 From: Olli Savia <ops@iki.fi> Date: Fri, 20 Apr 2018 21:24:37 +0300 Subject: [PATCH 222/254] Added missing VIA register names. --- asminc/pet.inc | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/asminc/pet.inc b/asminc/pet.inc index 43d52a5d5..d165bb336 100644 --- a/asminc/pet.inc +++ b/asminc/pet.inc @@ -61,8 +61,22 @@ NMIVec := $0094 ; --------------------------------------------------------------------------- ; I/O: 6522 VIA2 -VIA := $E840 -VIA_PRB := $E840 -VIA_PRA := $E841 -VIA_DDRB := $E842 -VIA_DDRA := $E843 +VIA := $E840 ; VIA base address +VIA_PB := VIA+$0 ; Port register B +VIA_PA1 := VIA+$1 ; Port register A +VIA_PRB := VIA+$0 ; *** Deprecated *** +VIA_PRA := VIA+$1 ; *** Deprecated *** +VIA_DDRB := VIA+$2 ; Data direction register B +VIA_DDRA := VIA+$3 ; Data direction register A +VIA_T1CL := VIA+$4 ; Timer 1, low byte +VIA_T1CH := VIA+$5 ; Timer 1, high byte +VIA_T1LL := VIA+$6 ; Timer 1 latch, low byte +VIA_T1LH := VIA+$7 ; Timer 1 latch, high byte +VIA_T2CL := VIA+$8 ; Timer 2, low byte +VIA_T2CH := VIA+$9 ; Timer 2, high byte +VIA_SR := VIA+$A ; Shift register +VIA_CR := VIA+$B ; Auxiliary control register +VIA_PCR := VIA+$C ; Peripheral control register +VIA_IFR := VIA+$D ; Interrupt flag register +VIA_IER := VIA+$E ; Interrupt enable register +VIA_PA2 := VIA+$F ; Port register A w/o handshake From c2adade8a881d49f09b6b21dfb5223ee9f12aaa7 Mon Sep 17 00:00:00 2001 From: Olli Savia <ops@iki.fi> Date: Fri, 20 Apr 2018 21:25:43 +0300 Subject: [PATCH 223/254] Updated to use the new VIA register names --- libsrc/pet/joy/pet-ptvjoy.s | 15 ++++++--------- libsrc/pet/joy/pet-stdjoy.s | 4 ++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/libsrc/pet/joy/pet-ptvjoy.s b/libsrc/pet/joy/pet-ptvjoy.s index 7620013be..c098072fb 100644 --- a/libsrc/pet/joy/pet-ptvjoy.s +++ b/libsrc/pet/joy/pet-ptvjoy.s @@ -10,6 +10,7 @@ .include "joy-kernel.inc" .include "joy-error.inc" + .include "pet.inc" .macpack module @@ -40,10 +41,6 @@ JOY_COUNT = 2 ; Number of joysticks we support -VIA_PRA := $E841 ; Port register A -VIA_DDRA := $E843 ; Data direction register A - - .code ; ------------------------------------------------------------------------ @@ -89,9 +86,9 @@ READ: lda #%10000000 ; via port A Data-Direction ; Read joystick 1 joy1: lda #$80 ; via port A read/write - sta VIA_PRA ; (output one at PA7) + sta VIA_PA1 ; (output one at PA7) - lda VIA_PRA ; via port A read/write + lda VIA_PA1 ; via port A read/write and #$1f ; get bit 4-0 (PA4-PA0) eor #$1f rts @@ -99,13 +96,13 @@ joy1: lda #$80 ; via port A read/write ; Read joystick 2 joy2: lda #$00 ; via port A read/write - sta VIA_PRA ; (output zero at PA7) + sta VIA_PA1 ; (output zero at PA7) - lda VIA_PRA ; via port A read/write + lda VIA_PA1 ; via port A read/write and #$0f ; get bit 3-0 (PA3-PA0) sta tmp1 ; joy 4 directions - lda VIA_PRA ; via port A read/write + lda VIA_PA1 ; via port A read/write and #%00100000 ; get bit 5 (PA5) lsr ora tmp1 diff --git a/libsrc/pet/joy/pet-stdjoy.s b/libsrc/pet/joy/pet-stdjoy.s index 85b742302..75b9f7465 100644 --- a/libsrc/pet/joy/pet-stdjoy.s +++ b/libsrc/pet/joy/pet-stdjoy.s @@ -85,7 +85,7 @@ READ: joy1: lda #0 sta VIA_DDRA - lda VIA_PRA + lda VIA_PA1 and #$0f cmp #$0c bne @notc1 @@ -102,7 +102,7 @@ joy1: joy2: lda #0 sta VIA_DDRA - lda VIA_PRA + lda VIA_PA1 lsr lsr lsr From 3f5683b39139bd7f211fd72822c562863014e6cb Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Fri, 20 Apr 2018 12:08:28 -0700 Subject: [PATCH 224/254] Added C128 in C64 mode accelerator code and documentation. --- asminc/accelerator.inc | 7 +++ doc/c64.sgml | 3 ++ doc/funcref.sgml | 67 ++++++++++++++++++++++++ include/accelerator.h | 39 ++++++++++++++ libsrc/c64/acc_c128_speed.s | 53 +++++++++++++++++++ libsrc/c64/acc_detect_c128.s | 33 ++++++++++++ testcode/lib/accelerator/Makefile | 4 +- testcode/lib/accelerator/c64-c128-test.c | 8 +++ 8 files changed, 213 insertions(+), 1 deletion(-) create mode 100755 libsrc/c64/acc_c128_speed.s create mode 100755 libsrc/c64/acc_detect_c128.s create mode 100755 testcode/lib/accelerator/c64-c128-test.c diff --git a/asminc/accelerator.inc b/asminc/accelerator.inc index 1008b49c1..86d27b3f2 100644 --- a/asminc/accelerator.inc +++ b/asminc/accelerator.inc @@ -40,3 +40,10 @@ C64DTV_Extended_Regs := $D03F C64DTV_Slow = $00 C64DTV_Fast = $03 + + +; --------------------------------------------------------------------------- +; C128 in C64 mode + +C128_VICIIE_CLK := $D030 + diff --git a/doc/c64.sgml b/doc/c64.sgml index f1e678c72..03a03974c 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -176,10 +176,13 @@ url="funcref.html" name="function reference"> for declaration and usage. <itemize> <item>detect_c64dtv +<item>detect_c128 <item>detect_scpu <item>get_c64dtv_speed +<item>get_c128_speed <item>get_scpu_speed <item>set_c64dtv_speed +<item>set_c128_speed <item>set_scpu_speed </itemize> diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 268c210fe..17a42b103 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -69,10 +69,13 @@ function. <itemize> <item><ref id="detect_c64dtv" name="detect_c64dtv"> +<item><ref id="detect_c128" name="detect_c128"> <item><ref id="detect_scpu" name="detect_scpu"> <item><ref id="get_c64dtv_speed" name="get_c64dtv_speed"> +<item><ref id="get_c128_speed" name="get_c128_speed"> <item><ref id="get_scpu_speed" name="get_scpu_speed"> <item><ref id="set_c64dtv_speed" name="set_c64dtv_speed"> +<item><ref id="set_c128_speed" name="set_c64dtv_speed"> <item><ref id="set_scpu_speed" name="set_scpu_speed"> </itemize> @@ -2943,6 +2946,26 @@ used in presence of a prototype. </quote> +<sect1>detect_c128<label id="detect_c128"><p> + +<quote> +<descrip> +<tag/Function/Check for the presence of a C128 in C64 mode. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char detect_c128 (void);/ +<tag/Description/The function returns a 1 if a C128 in C64 mode has been detected. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="get_c128_speed" name="get_c128_speed">, +<ref id="set_c128_speed" name="set_c128_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>detect_scpu<label id="detect_scpu"><p> <quote> @@ -3524,6 +3547,28 @@ header files define constants that can be used to check the return code. </quote> +<sect1>get_c128_speed<label id="get_c128_speed"><p> + +<quote> +<descrip> +<tag/Function/Get the current speed of the C128 in C64 mode. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char get_c128_speed (void);/ +<tag/Description/The function returns the current speed of the C128 in C64 mode. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of a C128 in C64 mode. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_c128" name="detect_c128">, +<ref id="set_c128_speed" name="set_c128_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>get_scpu_speed<label id="get_scpu_speed"><p> <quote> @@ -6119,6 +6164,28 @@ clean-up when exitting the program. </quote> +<sect1>set_c128_speed<label id="set_c128_speed"><p> + +<quote> +<descrip> +<tag/Function/Set the current speed of a C128 in C64 mode. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char __fastcall__ set_c128_speed (unsigned char speed);/ +<tag/Description/The function returns the speed after trying to set the speed of the C128 in C64 mode. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of a C128 in C64 mode. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_c128" name="detect_c128">, +<ref id="get_c128_speed" name="get_c128_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>set_scpu_speed<label id="set_scpu_speed"><p> <quote> diff --git a/include/accelerator.h b/include/accelerator.h index 336bbb036..0e3ba6e36 100644 --- a/include/accelerator.h +++ b/include/accelerator.h @@ -136,5 +136,44 @@ extern unsigned char detect_c64dtv (void); * 0x01 : C64DTV present */ + +/* C128 in C64 mode */ + +extern unsigned char __fastcall__ set_c128_speed (unsigned char speed); + +/* Set the speed of the C128 CPU, using SPEED_SLOW will switch to + * 1 Mhz (slow) mode, SPEED_2X or SPEED_FAST will switch to 2Mhz (fast) mode. + * + * Note that any value higher or equal to SPEED_2X will switch to fast mode. + * + * This function will return the actual speed the CPU is at after trying + * to set the requested speed, to my knowledge the switching should not fail. + * + * This function does not check for the presence of a C128 in C64 mode, + * make sure you use 'detect_c128();' before using. + */ + +extern unsigned char get_c128_speed (void); + +/* Get the speed of the C128 CPU. + * + * Possible return values: + * SPEED_SLOW : Slow mode + * SPEED_2X : Fast mode + * + * This function does not check for the presence of a C128 in C64 mode, + * make sure you use 'detect_c128();' before using. + */ + +extern unsigned char detect_c128 (void); + +/* Check for the presence of a C128 in C64 mode. + * + * Possible return values: + * 0x00 : C128 in C64 mode not present + * 0x01 : C128 in C64 mode present + */ + /* End of accelerator.h */ #endif + diff --git a/libsrc/c64/acc_c128_speed.s b/libsrc/c64/acc_c128_speed.s new file mode 100755 index 000000000..4ec23b1da --- /dev/null +++ b/libsrc/c64/acc_c128_speed.s @@ -0,0 +1,53 @@ +; +; Marco van den Heuvel, 2018-04-20 +; + +; extern unsigned char __fastcall__ set_c128_speed (unsigned char speed); +; +;/* Set the speed of the C128 CPU, using SPEED_SLOW will switch to +; * 1 Mhz (slow) mode, SPEED_2X or SPEED_FAST will switch to 2Mhz (fast) mode. +; * +; * Note that any value higher or equal to SPEED_2X will switch to fast mode. +; * +; * This function will return the actual speed the CPU is at after trying +; * to set the requested speed, to my knowledge the switching should not fail. +; * +; * This function does not check for the presence of a C128 in C64 mode, +; * make sure you use 'detect_c128();' before using. +; */ + +; extern unsigned char get_c128_speed (void); +; +;/* Get the speed of the C128 CPU. +; * +; * Possible return values: +; * SPEED_SLOW : Slow mode +; * SPEED_2X : Fast mode +; * +; * This function does not check for the presence of a C128 in C64 mode, +; * make sure you use 'detect_c128();' before using. +; */ + + .export _set_c128_speed + .export _get_c128_speed + + .include "accelerator.inc" + +_set_c128_speed: + cmp #SPEED_2X + bcs high_speed +store_speed: + sta C128_VICIIE_CLK + jmp _get_c128_speed + +high_speed: + lda #$01 + bne store_speed + + +_get_c128_speed: + lda C128_VICIIE_CLK + and #$01 + ldx #$00 + rts + diff --git a/libsrc/c64/acc_detect_c128.s b/libsrc/c64/acc_detect_c128.s new file mode 100755 index 000000000..591ff6c59 --- /dev/null +++ b/libsrc/c64/acc_detect_c128.s @@ -0,0 +1,33 @@ +; +; Marco van den Heuvel, 2018-04-20 +; + +; unsigned char detect_c128 (void); +; +;/* Check for the presence of a C128 in C64 mode. +; * +; * Possible return values: +; * 0x00 : C128 in C64 mode not present +; * 0x01 : C128 in C64 mode present +; */ + + .export _detect_c128 + + .include "accelerator.inc" + +_detect_c128: + lda #$00 + tax + +; Make sure the CPU is a 8502 + .byte $1A ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816 + bne not_found + +; Make sure a C128 VICIIe is present + ldy C128_VICIIE_CLK + cpy #$FF + beq not_found +found: + lda #$01 +not_found: + rts diff --git a/testcode/lib/accelerator/Makefile b/testcode/lib/accelerator/Makefile index a9fe5f78d..c6423e44f 100644 --- a/testcode/lib/accelerator/Makefile +++ b/testcode/lib/accelerator/Makefile @@ -1,6 +1,6 @@ CL ?= cl65 -all: c64-scpu-test.prg c128-scpu-test.prg c64dtv-test.prg +all: c64-scpu-test.prg c128-scpu-test.prg c64dtv-test.prg c64-c128-test.prg c64-scpu-test.prg: c64-c128-scpu-test.c $(CL) -t c64 c64-c128-scpu-test.c -o c64-scpu-test.prg @@ -11,3 +11,5 @@ c128-scpu-test.prg: c64-c128-scpu-test.c c64dtv-test.prg: c64dtv-test.c $(CL) -t c64 c64dtv-test.c -o c64dtv-test.prg +c64-c128-test.prg: c64-c128-test.c + $(CL) -t c64 c64-c128-test.c -o c64-c128-test.prg diff --git a/testcode/lib/accelerator/c64-c128-test.c b/testcode/lib/accelerator/c64-c128-test.c new file mode 100755 index 000000000..fd20a665e --- /dev/null +++ b/testcode/lib/accelerator/c64-c128-test.c @@ -0,0 +1,8 @@ +/* C128 in C64 mode accelerator test code. */ + +#define ACC_DETECT detect_c128 +#define ACC_GET_SPEED get_c128_speed +#define ACC_SET_SPEED set_c128_speed +#define ACC_NAME "C128 in C64 mode" + +#include "turbo-test.c" From 30aed2330d07d11372d5c75b7f1f5a8a80cc2c00 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Sat, 21 Apr 2018 04:30:56 -0400 Subject: [PATCH 225/254] Updated a joystick adapter URL. --- doc/vic20.sgml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/vic20.sgml b/doc/vic20.sgml index 1a8f9dfef..a61691733 100644 --- a/doc/vic20.sgml +++ b/doc/vic20.sgml @@ -6,7 +6,7 @@ <author> <url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> <url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal"> -<date>2017-05-18 +<date>2018-04-20 <abstract> An overview over the VIC20 runtime system as it is implemented for the cc65 C @@ -173,8 +173,8 @@ The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/vic20-std <tag><tt/vic20-ptvjoy.joy (vic20_ptvjoy_joy)/</tag> Driver for the Protovision 4-player adapter contributed by Groepaz. See - <url url="http://www.protovision-online.de/hardw/4_player.php?language=en" - name="Protovision shop"> for prices and building instructions. Up to three + <url url="https://www.protovision.games/hardw/4_player.php" + name="the Protovision shop"> for prices and building instructions. Up to three joysticks are supported. </descrip><p> From 28f26991ac66cc2e0aee4a222d8b2b8701fb3077 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sat, 21 Apr 2018 09:52:50 -0700 Subject: [PATCH 226/254] Updated c128 accelerator code and documentation. --- doc/c64.sgml | 6 +- doc/funcref.sgml | 134 +++++++++++++++++------------------ libsrc/c64/acc_c128_speed.s | 3 +- libsrc/c64/acc_detect_c128.s | 7 +- 4 files changed, 76 insertions(+), 74 deletions(-) diff --git a/doc/c64.sgml b/doc/c64.sgml index 03a03974c..c2c9551b4 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -175,14 +175,14 @@ The functions listed below are accelerator functions for the C64. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> -<item>detect_c64dtv <item>detect_c128 +<item>detect_c64dtv <item>detect_scpu -<item>get_c64dtv_speed <item>get_c128_speed +<item>get_c64dtv_speed <item>get_scpu_speed -<item>set_c64dtv_speed <item>set_c128_speed +<item>set_c64dtv_speed <item>set_scpu_speed </itemize> diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 17a42b103..75028b7b6 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -68,14 +68,14 @@ function. <sect1><tt/accelerator.h/<label id="accelerator.h"><p> <itemize> -<item><ref id="detect_c64dtv" name="detect_c64dtv"> <item><ref id="detect_c128" name="detect_c128"> +<item><ref id="detect_c64dtv" name="detect_c64dtv"> <item><ref id="detect_scpu" name="detect_scpu"> -<item><ref id="get_c64dtv_speed" name="get_c64dtv_speed"> <item><ref id="get_c128_speed" name="get_c128_speed"> +<item><ref id="get_c64dtv_speed" name="get_c64dtv_speed"> <item><ref id="get_scpu_speed" name="get_scpu_speed"> +<item><ref id="set_c128_speed" name="set_c128_speed"> <item><ref id="set_c64dtv_speed" name="set_c64dtv_speed"> -<item><ref id="set_c128_speed" name="set_c64dtv_speed"> <item><ref id="set_scpu_speed" name="set_scpu_speed"> </itemize> @@ -2926,26 +2926,6 @@ used in presence of a prototype. </quote> -<sect1>detect_c64dtv<label id="detect_c64dtv"><p> - -<quote> -<descrip> -<tag/Function/Check for the presence of the C64DTV. -<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ -<tag/Declaration/<tt/unsigned char detect_c64dtv (void);/ -<tag/Description/The function returns a 1 if a C64DTV has been detected. -<tag/Notes/<itemize> -<item>The function is specific to the C64. -</itemize> -<tag/Availability/cc65 (not all platforms) -<tag/See also/ -<ref id="get_c64dtv_speed" name="get_c64dtv_speed">, -<ref id="set_c64dtv_speed" name="set_c64dtv_speed">, -<tag/Example/None. -</descrip> -</quote> - - <sect1>detect_c128<label id="detect_c128"><p> <quote> @@ -2966,6 +2946,26 @@ used in presence of a prototype. </quote> +<sect1>detect_c64dtv<label id="detect_c64dtv"><p> + +<quote> +<descrip> +<tag/Function/Check for the presence of the C64DTV. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char detect_c64dtv (void);/ +<tag/Description/The function returns a 1 if a C64DTV has been detected. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="get_c64dtv_speed" name="get_c64dtv_speed">, +<ref id="set_c64dtv_speed" name="set_c64dtv_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>detect_scpu<label id="detect_scpu"><p> <quote> @@ -3525,28 +3525,6 @@ header files define constants that can be used to check the return code. </quote> -<sect1>get_c64dtv_speed<label id="get_c64dtv_speed"><p> - -<quote> -<descrip> -<tag/Function/Get the current speed of the C64DTV. -<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ -<tag/Declaration/<tt/unsigned char get_c64dtv_speed (void);/ -<tag/Description/The function returns the current speed of the C64DTV. -<tag/Notes/<itemize> -<item>The function is specific to the C64. -<item>The function does not check for the presence of the C64DTV. -<item>See the accelerator.h header for the speed definitions. -</itemize> -<tag/Availability/cc65 (not all platforms) -<tag/See also/ -<ref id="detect_c64dtv" name="detect_c64dtv">, -<ref id="set_c64dtv_speed" name="set_c64dtv_speed">, -<tag/Example/None. -</descrip> -</quote> - - <sect1>get_c128_speed<label id="get_c128_speed"><p> <quote> @@ -3569,6 +3547,28 @@ header files define constants that can be used to check the return code. </quote> +<sect1>get_c64dtv_speed<label id="get_c64dtv_speed"><p> + +<quote> +<descrip> +<tag/Function/Get the current speed of the C64DTV. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char get_c64dtv_speed (void);/ +<tag/Description/The function returns the current speed of the C64DTV. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of the C64DTV. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_c64dtv" name="detect_c64dtv">, +<ref id="set_c64dtv_speed" name="set_c64dtv_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>get_scpu_speed<label id="get_scpu_speed"><p> <quote> @@ -6142,28 +6142,6 @@ clean-up when exitting the program. </quote> -<sect1>set_c64dtv_speed<label id="set_c64dtv_speed"><p> - -<quote> -<descrip> -<tag/Function/Set the current speed of the C64DTV. -<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ -<tag/Declaration/<tt/unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);/ -<tag/Description/The function returns the speed after trying to set the speed of the C64DTV. -<tag/Notes/<itemize> -<item>The function is specific to the C64. -<item>The function does not check for the presence of the C64DTV. -<item>See the accelerator.h header for the speed definitions. -</itemize> -<tag/Availability/cc65 (not all platforms) -<tag/See also/ -<ref id="detect_c64dtv" name="detect_c64dtv">, -<ref id="get_c64dtv_speed" name="get_c64dtv_speed">, -<tag/Example/None. -</descrip> -</quote> - - <sect1>set_c128_speed<label id="set_c128_speed"><p> <quote> @@ -6186,6 +6164,28 @@ clean-up when exitting the program. </quote> +<sect1>set_c64dtv_speed<label id="set_c64dtv_speed"><p> + +<quote> +<descrip> +<tag/Function/Set the current speed of the C64DTV. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);/ +<tag/Description/The function returns the speed after trying to set the speed of the C64DTV. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of the C64DTV. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_c64dtv" name="detect_c64dtv">, +<ref id="get_c64dtv_speed" name="get_c64dtv_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>set_scpu_speed<label id="set_scpu_speed"><p> <quote> diff --git a/libsrc/c64/acc_c128_speed.s b/libsrc/c64/acc_c128_speed.s index 4ec23b1da..4cb2630fa 100755 --- a/libsrc/c64/acc_c128_speed.s +++ b/libsrc/c64/acc_c128_speed.s @@ -38,13 +38,12 @@ _set_c128_speed: bcs high_speed store_speed: sta C128_VICIIE_CLK - jmp _get_c128_speed + .byte $2C ; skip over the lda #$01 high_speed: lda #$01 bne store_speed - _get_c128_speed: lda C128_VICIIE_CLK and #$01 diff --git a/libsrc/c64/acc_detect_c128.s b/libsrc/c64/acc_detect_c128.s index 591ff6c59..71996730e 100755 --- a/libsrc/c64/acc_detect_c128.s +++ b/libsrc/c64/acc_detect_c128.s @@ -21,13 +21,16 @@ _detect_c128: ; Make sure the CPU is a 8502 .byte $1A ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816 - bne not_found + beq found + .byte $3A ; decrement A again, so a #$00 can be returned + rts + +found: ; Make sure a C128 VICIIe is present ldy C128_VICIIE_CLK cpy #$FF beq not_found -found: lda #$01 not_found: rts From cc2bcb8a4db2b659a9a173c53761b77e8c603fb6 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Mon, 23 Apr 2018 19:25:11 -0700 Subject: [PATCH 227/254] Changed c128 accelerator code and documention to include both C64 and C128 support. --- doc/c128.sgml | 7 ++- doc/funcref.sgml | 22 +++++----- include/accelerator.h | 20 ++++----- libsrc/c128/acc_c128_speed.s | 56 ++++++++++++++++++++++++ libsrc/c128/acc_detect_c128.s | 24 ++++++++++ libsrc/c64/acc_c128_speed.s | 50 +-------------------- testcode/lib/accelerator/Makefile | 6 ++- testcode/lib/accelerator/c64-c128-test.c | 2 +- 8 files changed, 114 insertions(+), 73 deletions(-) create mode 100755 libsrc/c128/acc_c128_speed.s create mode 100755 libsrc/c128/acc_detect_c128.s diff --git a/doc/c128.sgml b/doc/c128.sgml index 9af66d62b..1bdcf01f5 100644 --- a/doc/c128.sgml +++ b/doc/c128.sgml @@ -94,9 +94,12 @@ The functions listed below are accelerator functions for the C128. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> +<item>detect_c128 <item>detect_scpu -<item>scpu_get_speed -<item>scpu_set_speed +<item>get_c128_speed +<item>get_scpu_speed +<item>set_c128_speed +<item>set_scpu_speed </itemize> diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 75028b7b6..55701cf55 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -2930,12 +2930,12 @@ used in presence of a prototype. <quote> <descrip> -<tag/Function/Check for the presence of a C128 in C64 mode. +<tag/Function/Check if a C128 CPU is the current CPU. <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ <tag/Declaration/<tt/unsigned char detect_c128 (void);/ -<tag/Description/The function returns a 1 if a C128 in C64 mode has been detected. +<tag/Description/The function returns a 1 if a C128 CPU is the current CPU. <tag/Notes/<itemize> -<item>The function is specific to the C64. +<item>The function is specific to the C64 and C128. </itemize> <tag/Availability/cc65 (not all platforms) <tag/See also/ @@ -3529,13 +3529,13 @@ header files define constants that can be used to check the return code. <quote> <descrip> -<tag/Function/Get the current speed of the C128 in C64 mode. +<tag/Function/Get the current speed of the C128 CPU. <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ <tag/Declaration/<tt/unsigned char get_c128_speed (void);/ -<tag/Description/The function returns the current speed of the C128 in C64 mode. +<tag/Description/The function returns the current speed of the C128 CPU. <tag/Notes/<itemize> -<item>The function is specific to the C64. -<item>The function does not check for the presence of a C128 in C64 mode. +<item>The function is specific to the C64 and C128. +<item>The function does not check if the C128 CPU is the current CPU. <item>See the accelerator.h header for the speed definitions. </itemize> <tag/Availability/cc65 (not all platforms) @@ -6146,13 +6146,13 @@ clean-up when exitting the program. <quote> <descrip> -<tag/Function/Set the current speed of a C128 in C64 mode. +<tag/Function/Set the current speed of a C128 CPU. <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ <tag/Declaration/<tt/unsigned char __fastcall__ set_c128_speed (unsigned char speed);/ -<tag/Description/The function returns the speed after trying to set the speed of the C128 in C64 mode. +<tag/Description/The function returns the speed after trying to set the speed of the C128 CPU. <tag/Notes/<itemize> -<item>The function is specific to the C64. -<item>The function does not check for the presence of a C128 in C64 mode. +<item>The function is specific to the C64 and C128. +<item>The function does not check if the C128 CPU is the current CPU. <item>See the accelerator.h header for the speed definitions. </itemize> <tag/Availability/cc65 (not all platforms) diff --git a/include/accelerator.h b/include/accelerator.h index 0e3ba6e36..0fa202bc6 100644 --- a/include/accelerator.h +++ b/include/accelerator.h @@ -137,11 +137,11 @@ extern unsigned char detect_c64dtv (void); */ -/* C128 in C64 mode */ +/* C128 8502 CPU */ extern unsigned char __fastcall__ set_c128_speed (unsigned char speed); -/* Set the speed of the C128 CPU, using SPEED_SLOW will switch to +/* Set the speed of the C128 8502 CPU, using SPEED_SLOW will switch to * 1 Mhz (slow) mode, SPEED_2X or SPEED_FAST will switch to 2Mhz (fast) mode. * * Note that any value higher or equal to SPEED_2X will switch to fast mode. @@ -149,29 +149,29 @@ extern unsigned char __fastcall__ set_c128_speed (unsigned char speed); * This function will return the actual speed the CPU is at after trying * to set the requested speed, to my knowledge the switching should not fail. * - * This function does not check for the presence of a C128 in C64 mode, - * make sure you use 'detect_c128();' before using. + * This function does not check if the C128 CPU is the current CPU, make sure + * you use 'detect_c128();' before using. */ extern unsigned char get_c128_speed (void); -/* Get the speed of the C128 CPU. +/* Get the speed of the C128 8502 CPU. * * Possible return values: * SPEED_SLOW : Slow mode * SPEED_2X : Fast mode * - * This function does not check for the presence of a C128 in C64 mode, - * make sure you use 'detect_c128();' before using. + * This function does not check if the C128 CPU is the current CPU, make sure + * you use 'detect_c128();' before using. */ extern unsigned char detect_c128 (void); -/* Check for the presence of a C128 in C64 mode. +/* Check if the C128 CPU is the current CPU. * * Possible return values: - * 0x00 : C128 in C64 mode not present - * 0x01 : C128 in C64 mode present + * 0x00 : C128 CPU is not the current CPU + * 0x01 : C128 CPU is the current CPU */ /* End of accelerator.h */ diff --git a/libsrc/c128/acc_c128_speed.s b/libsrc/c128/acc_c128_speed.s new file mode 100755 index 000000000..c3012b2c8 --- /dev/null +++ b/libsrc/c128/acc_c128_speed.s @@ -0,0 +1,56 @@ +; +; Marco van den Heuvel, 2018-04-23 +; + +; extern unsigned char __fastcall__ set_c128_speed (unsigned char speed); +; +;/* Set the speed of the C128 8502 CPU, using SPEED_SLOW will switch to +; * 1 Mhz (slow) mode, SPEED_2X or SPEED_FAST will switch to 2Mhz (fast) mode. +; * +; * Note that any value higher or equal to SPEED_2X will switch to fast mode. +; * +; * This function will return the actual speed the CPU is at after trying +; * to set the requested speed, to my knowledge the switching should not fail. +; * +; * For C64 programs a check for a C128 in C64 mode is needed, make sure you +; * use 'detect_c128();' before using. +; * +; * For C128 programs no detect function call is needed. +; */ + +; extern unsigned char get_c128_speed (void); +; +;/* Get the speed of the C128 8502 CPU. +; * +; * Possible return values: +; * SPEED_SLOW : Slow mode +; * SPEED_2X : Fast mode +; * +; * For C64 programs a check for a C128 in C64 mode is needed, make sure you +; * use 'detect_c128();' before using. +; * +; * For C128 programs no detect function call is needed. +; */ + + .export _set_c128_speed + .export _get_c128_speed + + .include "accelerator.inc" + +_set_c128_speed: + cmp #SPEED_2X + bcs high_speed +store_speed: + sta C128_VICIIE_CLK + + .byte $2C ; skip over the lda #$01 +high_speed: + lda #$01 + bne store_speed + +_get_c128_speed: + lda C128_VICIIE_CLK + and #$01 + ldx #$00 + rts + diff --git a/libsrc/c128/acc_detect_c128.s b/libsrc/c128/acc_detect_c128.s new file mode 100755 index 000000000..f40fe395a --- /dev/null +++ b/libsrc/c128/acc_detect_c128.s @@ -0,0 +1,24 @@ +; +; Marco van den Heuvel, 2018-04-23 +; + +; unsigned char detect_c128 (void); +; +;/* Check if the C128 8502 CPU is the current CPU. +; * +; * Possible return values: +; * 0x00 : C128 8502 is not the current CPU +; * 0x01 : C128 8502 is the current CPU +; */ + + .export _detect_c128 + + .include "accelerator.inc" + +_detect_c128: + ldx #$00 + lda #$01 + +; Make sure the CPU is a 8502 + .byte $3A ; NOP on 8502, DEA on 65(S)C(E)02, 4510 and 65816 + rts diff --git a/libsrc/c64/acc_c128_speed.s b/libsrc/c64/acc_c128_speed.s index 4cb2630fa..bdd559412 100755 --- a/libsrc/c64/acc_c128_speed.s +++ b/libsrc/c64/acc_c128_speed.s @@ -1,52 +1,6 @@ ; -; Marco van den Heuvel, 2018-04-20 +; Marco van den Heuvel, 2018-04-23 ; -; extern unsigned char __fastcall__ set_c128_speed (unsigned char speed); -; -;/* Set the speed of the C128 CPU, using SPEED_SLOW will switch to -; * 1 Mhz (slow) mode, SPEED_2X or SPEED_FAST will switch to 2Mhz (fast) mode. -; * -; * Note that any value higher or equal to SPEED_2X will switch to fast mode. -; * -; * This function will return the actual speed the CPU is at after trying -; * to set the requested speed, to my knowledge the switching should not fail. -; * -; * This function does not check for the presence of a C128 in C64 mode, -; * make sure you use 'detect_c128();' before using. -; */ - -; extern unsigned char get_c128_speed (void); -; -;/* Get the speed of the C128 CPU. -; * -; * Possible return values: -; * SPEED_SLOW : Slow mode -; * SPEED_2X : Fast mode -; * -; * This function does not check for the presence of a C128 in C64 mode, -; * make sure you use 'detect_c128();' before using. -; */ - - .export _set_c128_speed - .export _get_c128_speed - - .include "accelerator.inc" - -_set_c128_speed: - cmp #SPEED_2X - bcs high_speed -store_speed: - sta C128_VICIIE_CLK - - .byte $2C ; skip over the lda #$01 -high_speed: - lda #$01 - bne store_speed - -_get_c128_speed: - lda C128_VICIIE_CLK - and #$01 - ldx #$00 - rts +.include "../c128/acc_c128_speed.s" diff --git a/testcode/lib/accelerator/Makefile b/testcode/lib/accelerator/Makefile index c6423e44f..121ad57b8 100644 --- a/testcode/lib/accelerator/Makefile +++ b/testcode/lib/accelerator/Makefile @@ -1,6 +1,7 @@ CL ?= cl65 -all: c64-scpu-test.prg c128-scpu-test.prg c64dtv-test.prg c64-c128-test.prg +all: c64-scpu-test.prg c128-scpu-test.prg c64dtv-test.prg \ + c64-c128-test.prg c128-test.prg c64-scpu-test.prg: c64-c128-scpu-test.c $(CL) -t c64 c64-c128-scpu-test.c -o c64-scpu-test.prg @@ -13,3 +14,6 @@ c64dtv-test.prg: c64dtv-test.c c64-c128-test.prg: c64-c128-test.c $(CL) -t c64 c64-c128-test.c -o c64-c128-test.prg + +c128-test.prg: c64-c128-test.c + $(CL) -t c128 c64-c128-test.c -o c128-test.prg diff --git a/testcode/lib/accelerator/c64-c128-test.c b/testcode/lib/accelerator/c64-c128-test.c index fd20a665e..ba212e03d 100755 --- a/testcode/lib/accelerator/c64-c128-test.c +++ b/testcode/lib/accelerator/c64-c128-test.c @@ -3,6 +3,6 @@ #define ACC_DETECT detect_c128 #define ACC_GET_SPEED get_c128_speed #define ACC_SET_SPEED set_c128_speed -#define ACC_NAME "C128 in C64 mode" +#define ACC_NAME "C128 CPU" #include "turbo-test.c" From f2e46f0fdf5d54b7e5de8a1be8dd95925c606b92 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Wed, 25 Apr 2018 12:53:29 -0700 Subject: [PATCH 228/254] Added C64 Chameleon accelerator code and documentation. --- asminc/accelerator.inc | 15 +++- doc/c64.sgml | 3 + doc/funcref.sgml | 67 +++++++++++++++ include/accelerator.h | 52 +++++++++++ libsrc/c64/acc_chameleon_speed.s | 100 ++++++++++++++++++++++ libsrc/c64/acc_detect_chameleon.s | 39 +++++++++ testcode/lib/accelerator/Makefile | 5 +- testcode/lib/accelerator/chameleon-test.c | 8 ++ 8 files changed, 287 insertions(+), 2 deletions(-) create mode 100755 libsrc/c64/acc_chameleon_speed.s create mode 100755 libsrc/c64/acc_detect_chameleon.s create mode 100755 testcode/lib/accelerator/chameleon-test.c diff --git a/asminc/accelerator.inc b/asminc/accelerator.inc index 86d27b3f2..0c687b2ad 100644 --- a/asminc/accelerator.inc +++ b/asminc/accelerator.inc @@ -43,7 +43,20 @@ C64DTV_Fast = $03 ; --------------------------------------------------------------------------- -; C128 in C64 mode +; C128 native and C128 in C64 mode C128_VICIIE_CLK := $D030 + +; --------------------------------------------------------------------------- +; C64 Chameleon cartridge + +CHAMELEON_CFGTUR := $D0F3 +CHAMELEON_CFGENA := $D0FE + +CHAMELEON_ENABLE_REGS = $2A +CHAMELEON_DISABLE_REGS = $FF + +CHAMELEON_CFGTUR_LIMIT_1MHZ = %00001100 +CHAMELEON_CFGTUR_LIMIT_NONE = %10000000 + diff --git a/doc/c64.sgml b/doc/c64.sgml index c2c9551b4..c037b1e0e 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -177,12 +177,15 @@ url="funcref.html" name="function reference"> for declaration and usage. <itemize> <item>detect_c128 <item>detect_c64dtv +<item>detect_chameleon <item>detect_scpu <item>get_c128_speed <item>get_c64dtv_speed +<item>get_chameleon_speed <item>get_scpu_speed <item>set_c128_speed <item>set_c64dtv_speed +<item>set_chameleon_speed <item>set_scpu_speed </itemize> diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 55701cf55..09ee27e4a 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -70,12 +70,15 @@ function. <itemize> <item><ref id="detect_c128" name="detect_c128"> <item><ref id="detect_c64dtv" name="detect_c64dtv"> +<item><ref id="detect_chameleon" name="detect_chameleon"> <item><ref id="detect_scpu" name="detect_scpu"> <item><ref id="get_c128_speed" name="get_c128_speed"> <item><ref id="get_c64dtv_speed" name="get_c64dtv_speed"> +<item><ref id="get_chameleon_speed" name="get_chameleon_speed"> <item><ref id="get_scpu_speed" name="get_scpu_speed"> <item><ref id="set_c128_speed" name="set_c128_speed"> <item><ref id="set_c64dtv_speed" name="set_c64dtv_speed"> +<item><ref id="set_chameleon_speed" name="set_chameleon_speed"> <item><ref id="set_scpu_speed" name="set_scpu_speed"> </itemize> @@ -2966,6 +2969,26 @@ used in presence of a prototype. </quote> +<sect1>detect_chameleon<label id="detect_chameleon"><p> + +<quote> +<descrip> +<tag/Function/Check for the presence of the C64 Chameleon cartridge. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char detect_chameleon (void);/ +<tag/Description/The function returns a 1 if a C64 Chameleon cartridge has been detected. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="get_chameleon_speed" name="get_chameleon_speed">, +<ref id="set_chameleon_speed" name="set_chameleon_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>detect_scpu<label id="detect_scpu"><p> <quote> @@ -3569,6 +3592,28 @@ header files define constants that can be used to check the return code. </quote> +<sect1>get_chameleon_speed<label id="get_chameleon_speed"><p> + +<quote> +<descrip> +<tag/Function/Get the current speed of the C64 Chameleon cartridge. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char get_chameleon_speed (void);/ +<tag/Description/The function returns the current speed of the C64 Chameleon cartridge. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of the C64 Chameleon cartridge. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_chameleon" name="detect_chameleon">, +<ref id="set_chameleon_speed" name="set_chameleon_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>get_scpu_speed<label id="get_scpu_speed"><p> <quote> @@ -6186,6 +6231,28 @@ clean-up when exitting the program. </quote> +<sect1>set_chameleon_speed<label id="set_chameleon_speed"><p> + +<quote> +<descrip> +<tag/Function/Set the current speed of the C64 Chameleon cartridge. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char __fastcall__ set_chameleon_speed (unsigned char speed);/ +<tag/Description/The function returns the speed after trying to set the speed of the C64 Chameleon cartridge. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of the C64 Chameleon cartridge. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_chameleon" name="detect_chameleon">, +<ref id="get_chameleon_speed" name="get_chameleon_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>set_scpu_speed<label id="set_scpu_speed"><p> <quote> diff --git a/include/accelerator.h b/include/accelerator.h index 0fa202bc6..5797cb36c 100644 --- a/include/accelerator.h +++ b/include/accelerator.h @@ -174,6 +174,58 @@ extern unsigned char detect_c128 (void); * 0x01 : C128 CPU is the current CPU */ + +/* C64 Chameleon cartridge */ + +extern unsigned char __fastcall__ set_chameleon_speed (unsigned char speed); + +/* Set the speed of the C64 Chameleon cartridge, the following inputs + * are accepted: + * SPEED_SLOW : 1 Mhz mode + * SPEED_1X : 1 Mhz mode + * SPEED_2X : 2 Mhz mode + * SPEED_3X : 3 Mhz mode + * SPEED_4X : 4 Mhz mode + * SPEED_5X : 5 Mhz mode + * SPEED_6X : 6 Mhz mode + * SPEED_FAST : Maximum speed mode + * + * Note that any value higher or equal to SPEED_7X will switch to maximum + * speed mode. + * + * This function will return the actual speed the CPU is at after trying + * to set the requested speed, to my knowledge the switching should not fail. + * + * This function does not check for the presence of the C64 Chameleon cartridge, + * make sure you use 'detect_chameleon();' before using. + */ + +extern unsigned char get_chameleon_speed (void); + +;/* Get the speed of the C64 Chameleon cartridge. +; * +; * Possible return values: +; * SPEED_SLOW : Slow mode +; * SPEED_2X : 2Mhz mode +; * SPEED_3X : 3Mhz mode +; * SPEED_4X : 4Mhz mode +; * SPEED_5X : 5Mhz mode +; * SPEED_6X : 6Mhz mode +; * SPEED_FAST : Maximum speed mode +; * +; * This function does not check for the presence of the C64 Chameleon cartridge, +; * make sure you use 'detect_chameleon();' before using. +; */ + +extern unsigned char detect_chameleon (void); + +/* Check for the presence of the C64 Chameleon cartridge. + * + * Possible return values: + * 0x00 : C64 Chameleon cartridge not present + * 0x01 : C64 Chameleon cartridge present + */ + /* End of accelerator.h */ #endif diff --git a/libsrc/c64/acc_chameleon_speed.s b/libsrc/c64/acc_chameleon_speed.s new file mode 100755 index 000000000..0e3e1320f --- /dev/null +++ b/libsrc/c64/acc_chameleon_speed.s @@ -0,0 +1,100 @@ +; +; Marco van den Heuvel, 2018-04-25 +; + +; extern unsigned char __fastcall__ set_chameleon_speed (unsigned char speed); +; +;/* Set the speed of the Chameleon cartridge, the following inputs +; * are accepted: +; * SPEED_SLOW : 1 Mhz mode +; * SPEED_1X : 1 Mhz mode +; * SPEED_2X : 2 Mhz mode +; * SPEED_3X : 3 Mhz mode +; * SPEED_4X : 4 Mhz mode +; * SPEED_5X : 5 Mhz mode +; * SPEED_6X : 6 Mhz mode +; * SPEED_FAST : Maximum speed mode +; * +; * Note that any value higher or equal to SPEED_7X will switch to maximum +; * speed mode. +; * +; * This function will return the actual speed the CPU is at after trying +; * to set the requested speed, to my knowledge the switching should not fail. +; * +; * This function does not check for the presence of the Chameleon cartridge, +; * make sure you use 'detect_chameleon();' before using. +; */ + +; extern unsigned char get_chameleon_speed (void); +; +;/* Get the speed of the Chameleon cartridge. +; * +; * Possible return values: +; * SPEED_SLOW : Slow mode +; * SPEED_2X : 2Mhz mode +; * SPEED_3X : 3Mhz mode +; * SPEED_4X : 4Mhz mode +; * SPEED_5X : 5Mhz mode +; * SPEED_6X : 6Mhz mode +; * SPEED_FAST : Maximum speed mode +; * +; * This function does not check for the presence of the Chameleon cartridge, +; * make sure you use 'detect_chameleon();' before using. +; */ + + .export _set_chameleon_speed + .export _get_chameleon_speed + + .include "accelerator.inc" + +_set_chameleon_speed: + cmp #SPEED_7X + bcs maximum_speed + cmp #SPEED_1X + beq low_speed + ora #$80 +set_speed: + jsr activate_regs + sta CHAMELEON_CFGTUR + jmp return_speed + +low_speed: + lda #CHAMELEON_CFGTUR_LIMIT_1MHZ + bne set_speed + +maximum_speed: + lda #CHAMELEON_CFGTUR_LIMIT_NONE + bne set_speed + +_get_chameleon_speed: + jsr activate_regs +return_speed: + ldx #$00 + lda CHAMELEON_CFGTUR + tay + and #%10000000 + beq return_value + tya + and #%00001000 + bne is_slow_mode + tya + and #%00000111 + beq is_max_mode +return_value: + ldy #CHAMELEON_DISABLE_REGS + sty CHAMELEON_CFGENA + rts + +is_slow_mode: + txa + bne return_value + +is_max_mode: + lda #SPEED_FAST + bne return_value + +activate_regs: + ldy #CHAMELEON_ENABLE_REGS + sty CHAMELEON_CFGENA + rts + diff --git a/libsrc/c64/acc_detect_chameleon.s b/libsrc/c64/acc_detect_chameleon.s new file mode 100755 index 000000000..4b90c6ea9 --- /dev/null +++ b/libsrc/c64/acc_detect_chameleon.s @@ -0,0 +1,39 @@ +; +; Marco van den Heuvel, 2018-04-25 +; + +; unsigned char detect_chameleon (void); +; +;/* Check for the presence of the Chameleon cartridge. +; * +; * Possible return values: +; * 0x00 : Chameleon cartridge not present +; * 0x01 : Chameleon cartridge present +; */ + + .export _detect_chameleon + + .include "accelerator.inc" + +_detect_chameleon: + lda #$00 + tax + +; Make sure the CPU is a 6510 + .byte $1A ; NOP on 6510, INA on 65(S)C(E)02, 4510 and 65816 + bne not_found + + ldy CHAMELEON_CFGENA + lda #CHAMELEON_ENABLE_REGS + sta CHAMELEON_CFGENA + lda CHAMELEON_CFGENA + sty CHAMELEON_CFGENA + cmp #$FF + beq not_found +found: + lda #$01 + .byte $2C +not_found: + lda #$00 + rts + diff --git a/testcode/lib/accelerator/Makefile b/testcode/lib/accelerator/Makefile index 121ad57b8..e9bd61881 100644 --- a/testcode/lib/accelerator/Makefile +++ b/testcode/lib/accelerator/Makefile @@ -1,7 +1,7 @@ CL ?= cl65 all: c64-scpu-test.prg c128-scpu-test.prg c64dtv-test.prg \ - c64-c128-test.prg c128-test.prg + c64-c128-test.prg c128-test.prg chameleon-test.prg c64-scpu-test.prg: c64-c128-scpu-test.c $(CL) -t c64 c64-c128-scpu-test.c -o c64-scpu-test.prg @@ -17,3 +17,6 @@ c64-c128-test.prg: c64-c128-test.c c128-test.prg: c64-c128-test.c $(CL) -t c128 c64-c128-test.c -o c128-test.prg + +chameleon-test.prg: chameleon-test.c + $(CL) -t c64 chameleon-test.c -o chameleon-test.prg diff --git a/testcode/lib/accelerator/chameleon-test.c b/testcode/lib/accelerator/chameleon-test.c new file mode 100755 index 000000000..ffc1539b5 --- /dev/null +++ b/testcode/lib/accelerator/chameleon-test.c @@ -0,0 +1,8 @@ +/* C64 Chameleon accelerator test code. */ + +#define ACC_DETECT detect_chameleon +#define ACC_GET_SPEED get_chameleon_speed +#define ACC_SET_SPEED set_chameleon_speed +#define ACC_NAME "Chameleon cartridge" + +#include "turbo-test.c" From c92a3c5bd53724d13194930beeb310fb49c3757b Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Thu, 26 Apr 2018 05:37:27 -0400 Subject: [PATCH 229/254] Improved the accelerator code. Fixed an infinite loop. Removed the execute permissions from some files. --- libsrc/c128/acc_c128_speed.s | 29 ++++++++----------- libsrc/c128/acc_detect_c128.s | 0 libsrc/c128/acc_detect_scpu.s | 0 libsrc/c128/acc_scpu_speed.s | 0 libsrc/c64/acc_c128_speed.s | 1 - libsrc/c64/acc_c64dtv_speed.s | 0 libsrc/c64/acc_detect_c128.s | 25 +++++++--------- libsrc/c64/acc_detect_c64dtv.s | 0 testcode/lib/accelerator/c64-c128-scpu-test.c | 0 testcode/lib/accelerator/c64-c128-test.c | 0 testcode/lib/accelerator/c64dtv-test.c | 0 11 files changed, 23 insertions(+), 32 deletions(-) mode change 100755 => 100644 libsrc/c128/acc_c128_speed.s mode change 100755 => 100644 libsrc/c128/acc_detect_c128.s mode change 100755 => 100644 libsrc/c128/acc_detect_scpu.s mode change 100755 => 100644 libsrc/c128/acc_scpu_speed.s mode change 100755 => 100644 libsrc/c64/acc_c128_speed.s mode change 100755 => 100644 libsrc/c64/acc_c64dtv_speed.s mode change 100755 => 100644 libsrc/c64/acc_detect_c128.s mode change 100755 => 100644 libsrc/c64/acc_detect_c64dtv.s mode change 100755 => 100644 testcode/lib/accelerator/c64-c128-scpu-test.c mode change 100755 => 100644 testcode/lib/accelerator/c64-c128-test.c mode change 100755 => 100644 testcode/lib/accelerator/c64dtv-test.c diff --git a/libsrc/c128/acc_c128_speed.s b/libsrc/c128/acc_c128_speed.s old mode 100755 new mode 100644 index c3012b2c8..a104aad1a --- a/libsrc/c128/acc_c128_speed.s +++ b/libsrc/c128/acc_c128_speed.s @@ -1,21 +1,22 @@ ; -; Marco van den Heuvel, 2018-04-23 +; 2018-04-23, Marco van den Heuvel +; 2018-04-26, Greg King ; ; extern unsigned char __fastcall__ set_c128_speed (unsigned char speed); ; -;/* Set the speed of the C128 8502 CPU, using SPEED_SLOW will switch to +;/* Set the speed of the C128 8502 CPU; using SPEED_SLOW will switch to ; * 1 Mhz (slow) mode, SPEED_2X or SPEED_FAST will switch to 2Mhz (fast) mode. ; * ; * Note that any value higher or equal to SPEED_2X will switch to fast mode. ; * -; * This function will return the actual speed the CPU is at after trying -; * to set the requested speed, to my knowledge the switching should not fail. +; * This function will return the actual speed the CPU is at, after trying +; * to set the requested speed; to my knowledge, the switching should not fail. ; * -; * For C64 programs a check for a C128 in C64 mode is needed, make sure you +; * For C64 programs, a check for a C128 in C64 mode is needed; make sure you ; * use 'detect_c128();' before using. ; * -; * For C128 programs no detect function call is needed. +; * For C128 programs, no detect function call is needed. ; */ ; extern unsigned char get_c128_speed (void); @@ -26,10 +27,10 @@ ; * SPEED_SLOW : Slow mode ; * SPEED_2X : Fast mode ; * -; * For C64 programs a check for a C128 in C64 mode is needed, make sure you +; * For C64 programs, a check for a C128 in C64 mode is needed; make sure you ; * use 'detect_c128();' before using. ; * -; * For C128 programs no detect function call is needed. +; * For C128 programs, no detect function call is needed. ; */ .export _set_c128_speed @@ -39,18 +40,12 @@ _set_c128_speed: cmp #SPEED_2X - bcs high_speed -store_speed: + lda #$00 ; clear VIC-IIe test bit + rol a ; carry flag is speed bit sta C128_VICIIE_CLK - .byte $2C ; skip over the lda #$01 -high_speed: - lda #$01 - bne store_speed - _get_c128_speed: lda C128_VICIIE_CLK and #$01 - ldx #$00 + ldx #>$0000 rts - diff --git a/libsrc/c128/acc_detect_c128.s b/libsrc/c128/acc_detect_c128.s old mode 100755 new mode 100644 diff --git a/libsrc/c128/acc_detect_scpu.s b/libsrc/c128/acc_detect_scpu.s old mode 100755 new mode 100644 diff --git a/libsrc/c128/acc_scpu_speed.s b/libsrc/c128/acc_scpu_speed.s old mode 100755 new mode 100644 diff --git a/libsrc/c64/acc_c128_speed.s b/libsrc/c64/acc_c128_speed.s old mode 100755 new mode 100644 index bdd559412..678f52d0c --- a/libsrc/c64/acc_c128_speed.s +++ b/libsrc/c64/acc_c128_speed.s @@ -3,4 +3,3 @@ ; .include "../c128/acc_c128_speed.s" - diff --git a/libsrc/c64/acc_c64dtv_speed.s b/libsrc/c64/acc_c64dtv_speed.s old mode 100755 new mode 100644 diff --git a/libsrc/c64/acc_detect_c128.s b/libsrc/c64/acc_detect_c128.s old mode 100755 new mode 100644 index 71996730e..12817001a --- a/libsrc/c64/acc_detect_c128.s +++ b/libsrc/c64/acc_detect_c128.s @@ -1,5 +1,6 @@ ; -; Marco van den Heuvel, 2018-04-20 +; 2018-04-20, Marco van den Heuvel +; 2018-04-26, Greg King ; ; unsigned char detect_c128 (void); @@ -16,21 +17,17 @@ .include "accelerator.inc" _detect_c128: - lda #$00 - tax + ldx #>$0001 + lda #<$0001 -; Make sure the CPU is a 8502 - .byte $1A ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816 - beq found - .byte $3A ; decrement A again, so a #$00 can be returned - rts +; Make sure the CPU is an 8502. + .byte $3A ; NOP on 8502, DEA on 65(S)C(E)02, 4510, and 65816 + beq detect_end -found: - -; Make sure a C128 VICIIe is present +; Make sure a C128 VIC-IIe is present. ldy C128_VICIIE_CLK cpy #$FF - beq not_found - lda #$01 -not_found: + bne detect_end + txa ; return zero when not VIC-IIe +detect_end: rts diff --git a/libsrc/c64/acc_detect_c64dtv.s b/libsrc/c64/acc_detect_c64dtv.s old mode 100755 new mode 100644 diff --git a/testcode/lib/accelerator/c64-c128-scpu-test.c b/testcode/lib/accelerator/c64-c128-scpu-test.c old mode 100755 new mode 100644 diff --git a/testcode/lib/accelerator/c64-c128-test.c b/testcode/lib/accelerator/c64-c128-test.c old mode 100755 new mode 100644 diff --git a/testcode/lib/accelerator/c64dtv-test.c b/testcode/lib/accelerator/c64dtv-test.c old mode 100755 new mode 100644 From 14280151583c4ddf5cad6ecb794db4d1b651a6bb Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Thu, 26 Apr 2018 09:18:54 -0700 Subject: [PATCH 230/254] Optimized the code a bit as suggested by Greg. --- libsrc/c64/acc_detect_chameleon.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsrc/c64/acc_detect_chameleon.s b/libsrc/c64/acc_detect_chameleon.s index 4b90c6ea9..a16a264e7 100755 --- a/libsrc/c64/acc_detect_chameleon.s +++ b/libsrc/c64/acc_detect_chameleon.s @@ -32,8 +32,8 @@ _detect_chameleon: beq not_found found: lda #$01 - .byte $2C + .byte $24 not_found: - lda #$00 + txa rts From 97e69952c4bccac2994a2ce923502380297258c0 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Fri, 27 Apr 2018 09:16:25 -0700 Subject: [PATCH 231/254] Removed extern keyword from function prototypes. --- include/accelerator.h | 22 +++++++++++----------- libsrc/c128/acc_c128_speed.s | 4 ++-- libsrc/c128/acc_scpu_speed.s | 4 ++-- libsrc/c64/acc_c64dtv_speed.s | 4 ++-- libsrc/c64/acc_chameleon_speed.s | 4 ++-- libsrc/c64/acc_scpu_speed.s | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/accelerator.h b/include/accelerator.h index 5797cb36c..d29b73467 100644 --- a/include/accelerator.h +++ b/include/accelerator.h @@ -77,7 +77,7 @@ extern unsigned char __fastcall__ set_scpu_speed (unsigned char speed); * make sure you use 'detect_scpu();' before using. */ -extern unsigned char get_scpu_speed (void); +unsigned char get_scpu_speed (void); /* Get the speed of the SuperCPU cartridge. * @@ -89,7 +89,7 @@ extern unsigned char get_scpu_speed (void); * make sure you use 'detect_scpu();' before using. */ -extern unsigned char detect_scpu (void); +unsigned char detect_scpu (void); /* Check for the presence of the SuperCPU cartridge. * @@ -101,7 +101,7 @@ extern unsigned char detect_scpu (void); /* C64DTV */ -extern unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed); +unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed); /* Set the speed of the C64DTV, using SPEED_SLOW will switch to * slow mode, SPEED_2X or SPEED_FAST will switch to fast mode. @@ -115,7 +115,7 @@ extern unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed); * make sure you use 'detect_c64dtv();' before using. */ -extern unsigned char get_c64dtv_speed (void); +unsigned char get_c64dtv_speed (void); /* Get the speed of the C64DTV. * @@ -127,7 +127,7 @@ extern unsigned char get_c64dtv_speed (void); * make sure you use 'detect_c64dtv();' before using. */ -extern unsigned char detect_c64dtv (void); +unsigned char detect_c64dtv (void); /* Check for the presence of the C64DTV. * @@ -139,7 +139,7 @@ extern unsigned char detect_c64dtv (void); /* C128 8502 CPU */ -extern unsigned char __fastcall__ set_c128_speed (unsigned char speed); +unsigned char __fastcall__ set_c128_speed (unsigned char speed); /* Set the speed of the C128 8502 CPU, using SPEED_SLOW will switch to * 1 Mhz (slow) mode, SPEED_2X or SPEED_FAST will switch to 2Mhz (fast) mode. @@ -153,7 +153,7 @@ extern unsigned char __fastcall__ set_c128_speed (unsigned char speed); * you use 'detect_c128();' before using. */ -extern unsigned char get_c128_speed (void); +unsigned char get_c128_speed (void); /* Get the speed of the C128 8502 CPU. * @@ -165,7 +165,7 @@ extern unsigned char get_c128_speed (void); * you use 'detect_c128();' before using. */ -extern unsigned char detect_c128 (void); +unsigned char detect_c128 (void); /* Check if the C128 CPU is the current CPU. * @@ -177,7 +177,7 @@ extern unsigned char detect_c128 (void); /* C64 Chameleon cartridge */ -extern unsigned char __fastcall__ set_chameleon_speed (unsigned char speed); +unsigned char __fastcall__ set_chameleon_speed (unsigned char speed); /* Set the speed of the C64 Chameleon cartridge, the following inputs * are accepted: @@ -200,7 +200,7 @@ extern unsigned char __fastcall__ set_chameleon_speed (unsigned char speed); * make sure you use 'detect_chameleon();' before using. */ -extern unsigned char get_chameleon_speed (void); +unsigned char get_chameleon_speed (void); ;/* Get the speed of the C64 Chameleon cartridge. ; * @@ -217,7 +217,7 @@ extern unsigned char get_chameleon_speed (void); ; * make sure you use 'detect_chameleon();' before using. ; */ -extern unsigned char detect_chameleon (void); +unsigned char detect_chameleon (void); /* Check for the presence of the C64 Chameleon cartridge. * diff --git a/libsrc/c128/acc_c128_speed.s b/libsrc/c128/acc_c128_speed.s index c3012b2c8..3f2017de9 100755 --- a/libsrc/c128/acc_c128_speed.s +++ b/libsrc/c128/acc_c128_speed.s @@ -2,7 +2,7 @@ ; Marco van den Heuvel, 2018-04-23 ; -; extern unsigned char __fastcall__ set_c128_speed (unsigned char speed); +; unsigned char __fastcall__ set_c128_speed (unsigned char speed); ; ;/* Set the speed of the C128 8502 CPU, using SPEED_SLOW will switch to ; * 1 Mhz (slow) mode, SPEED_2X or SPEED_FAST will switch to 2Mhz (fast) mode. @@ -18,7 +18,7 @@ ; * For C128 programs no detect function call is needed. ; */ -; extern unsigned char get_c128_speed (void); +; unsigned char get_c128_speed (void); ; ;/* Get the speed of the C128 8502 CPU. ; * diff --git a/libsrc/c128/acc_scpu_speed.s b/libsrc/c128/acc_scpu_speed.s index 4bd142bbb..9f932aecd 100755 --- a/libsrc/c128/acc_scpu_speed.s +++ b/libsrc/c128/acc_scpu_speed.s @@ -2,7 +2,7 @@ ; Marco van den Heuvel, 2018-04-09 ; -; extern unsigned char __fastcall__ set_scpu_speed (unsigned char speed); +; unsigned char __fastcall__ set_scpu_speed (unsigned char speed); ; ;/* Set the speed of the SuperCPU cartridge, using SPEED_SLOW will switch to ; * 1 Mhz mode, SPEED_20X or SPEED_FAST will switch to 20 Mhz mode. @@ -19,7 +19,7 @@ ; * make sure you use 'detect_scpu();' before using. ; */ -; extern unsigned char get_scpu_speed (void); +; unsigned char get_scpu_speed (void); ; ;/* Get the speed of the SuperCPU cartridge. ; * diff --git a/libsrc/c64/acc_c64dtv_speed.s b/libsrc/c64/acc_c64dtv_speed.s index 6a8371a9c..d6cf8b994 100755 --- a/libsrc/c64/acc_c64dtv_speed.s +++ b/libsrc/c64/acc_c64dtv_speed.s @@ -2,7 +2,7 @@ ; Marco van den Heuvel, 2018-04-14 ; -; extern unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed); +; unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed); ; ;/* Set the speed of the C64DTV, using SPEED_SLOW will switch to ; * slow mode, SPEED_2X or SPEED_FAST will switch to fast mode. @@ -16,7 +16,7 @@ ; * make sure you use 'detect_c64dtv();' before using. ; */ -; extern unsigned char get_c64dtv_speed (void); +; unsigned char get_c64dtv_speed (void); ; ;/* Get the speed of the C64DTV. ; * diff --git a/libsrc/c64/acc_chameleon_speed.s b/libsrc/c64/acc_chameleon_speed.s index 0e3e1320f..ce51b9dde 100755 --- a/libsrc/c64/acc_chameleon_speed.s +++ b/libsrc/c64/acc_chameleon_speed.s @@ -2,7 +2,7 @@ ; Marco van den Heuvel, 2018-04-25 ; -; extern unsigned char __fastcall__ set_chameleon_speed (unsigned char speed); +; unsigned char __fastcall__ set_chameleon_speed (unsigned char speed); ; ;/* Set the speed of the Chameleon cartridge, the following inputs ; * are accepted: @@ -25,7 +25,7 @@ ; * make sure you use 'detect_chameleon();' before using. ; */ -; extern unsigned char get_chameleon_speed (void); +; unsigned char get_chameleon_speed (void); ; ;/* Get the speed of the Chameleon cartridge. ; * diff --git a/libsrc/c64/acc_scpu_speed.s b/libsrc/c64/acc_scpu_speed.s index 4bd142bbb..9f932aecd 100644 --- a/libsrc/c64/acc_scpu_speed.s +++ b/libsrc/c64/acc_scpu_speed.s @@ -2,7 +2,7 @@ ; Marco van den Heuvel, 2018-04-09 ; -; extern unsigned char __fastcall__ set_scpu_speed (unsigned char speed); +; unsigned char __fastcall__ set_scpu_speed (unsigned char speed); ; ;/* Set the speed of the SuperCPU cartridge, using SPEED_SLOW will switch to ; * 1 Mhz mode, SPEED_20X or SPEED_FAST will switch to 20 Mhz mode. @@ -19,7 +19,7 @@ ; * make sure you use 'detect_scpu();' before using. ; */ -; extern unsigned char get_scpu_speed (void); +; unsigned char get_scpu_speed (void); ; ;/* Get the speed of the SuperCPU cartridge. ; * From 11629bcf990bcc91326f33cb668749a9fa79c9eb Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Fri, 27 Apr 2018 14:22:41 -0700 Subject: [PATCH 232/254] Added C65/C64DX accelerator code and documentation. --- asminc/accelerator.inc | 9 ++++ doc/c64.sgml | 3 ++ doc/funcref.sgml | 67 +++++++++++++++++++++++++++ include/accelerator.h | 37 +++++++++++++++ libsrc/c64/acc_c65_speed.s | 70 +++++++++++++++++++++++++++++ libsrc/c64/acc_detect_c65.s | 55 +++++++++++++++++++++++ testcode/lib/accelerator/Makefile | 6 ++- testcode/lib/accelerator/c65-test.c | 8 ++++ 8 files changed, 254 insertions(+), 1 deletion(-) create mode 100755 libsrc/c64/acc_c65_speed.s create mode 100755 libsrc/c64/acc_detect_c65.s create mode 100644 testcode/lib/accelerator/c65-test.c diff --git a/asminc/accelerator.inc b/asminc/accelerator.inc index 0c687b2ad..a92b65ff9 100644 --- a/asminc/accelerator.inc +++ b/asminc/accelerator.inc @@ -60,3 +60,12 @@ CHAMELEON_DISABLE_REGS = $FF CHAMELEON_CFGTUR_LIMIT_1MHZ = %00001100 CHAMELEON_CFGTUR_LIMIT_NONE = %10000000 + +; --------------------------------------------------------------------------- +; C65/C64DX in C64 mode + +C65_VICIII_KEY := $D02F +C65_VICIII_CTRL_B := $D031 + +C65_VICIII_UNLOCK_1 = $A5 +C65_VICIII_UNLOCK_2 = $96 diff --git a/doc/c64.sgml b/doc/c64.sgml index c037b1e0e..800314fec 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -177,14 +177,17 @@ url="funcref.html" name="function reference"> for declaration and usage. <itemize> <item>detect_c128 <item>detect_c64dtv +<item>detect_c65 <item>detect_chameleon <item>detect_scpu <item>get_c128_speed <item>get_c64dtv_speed +<item>get_c65_speed <item>get_chameleon_speed <item>get_scpu_speed <item>set_c128_speed <item>set_c64dtv_speed +<item>set_c65_speed <item>set_chameleon_speed <item>set_scpu_speed </itemize> diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 09ee27e4a..edca7745e 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -70,14 +70,17 @@ function. <itemize> <item><ref id="detect_c128" name="detect_c128"> <item><ref id="detect_c64dtv" name="detect_c64dtv"> +<item><ref id="detect_c65" name="detect_c65"> <item><ref id="detect_chameleon" name="detect_chameleon"> <item><ref id="detect_scpu" name="detect_scpu"> <item><ref id="get_c128_speed" name="get_c128_speed"> <item><ref id="get_c64dtv_speed" name="get_c64dtv_speed"> +<item><ref id="get_c65_speed" name="get_c65_speed"> <item><ref id="get_chameleon_speed" name="get_chameleon_speed"> <item><ref id="get_scpu_speed" name="get_scpu_speed"> <item><ref id="set_c128_speed" name="set_c128_speed"> <item><ref id="set_c64dtv_speed" name="set_c64dtv_speed"> +<item><ref id="set_c65_speed" name="set_c65_speed"> <item><ref id="set_chameleon_speed" name="set_chameleon_speed"> <item><ref id="set_scpu_speed" name="set_scpu_speed"> </itemize> @@ -2969,6 +2972,26 @@ used in presence of a prototype. </quote> +<sect1>detect_c65<label id="detect_c65"><p> + +<quote> +<descrip> +<tag/Function/Check for the presence of a C65/C64DX in C64 mode. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char detect_c65 (void);/ +<tag/Description/The function returns a 1 if a C65/C64DX in C64 mode has been detected. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="get_c65_speed" name="get_c65_speed">, +<ref id="set_c65_speed" name="set_c65_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>detect_chameleon<label id="detect_chameleon"><p> <quote> @@ -3592,6 +3615,28 @@ header files define constants that can be used to check the return code. </quote> +<sect1>get_c65_speed<label id="get_c65_speed"><p> + +<quote> +<descrip> +<tag/Function/Get the current speed of the C65/C64DX in C64 mode. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char get_c65_speed (void);/ +<tag/Description/The function returns the current speed of the C65/C64DX in C64 mode. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of a C65/C64DX in C64 mode. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_c65" name="detect_c65">, +<ref id="set_c65_speed" name="set_c65_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>get_chameleon_speed<label id="get_chameleon_speed"><p> <quote> @@ -6231,6 +6276,28 @@ clean-up when exitting the program. </quote> +<sect1>set_c65_speed<label id="set_c65_speed"><p> + +<quote> +<descrip> +<tag/Function/Set the current speed of the C65/C64DX in C64 mode. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char __fastcall__ set_c65_speed (unsigned char speed);/ +<tag/Description/The function returns the speed after trying to set the speed of the C65/C64DX in C64 mode. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of a C65/C64DX in C64 mode. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_c65" name="detect_c65">, +<ref id="get_c65_speed" name="get_c65_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>set_chameleon_speed<label id="set_chameleon_speed"><p> <quote> diff --git a/include/accelerator.h b/include/accelerator.h index d29b73467..a5e6dbb28 100644 --- a/include/accelerator.h +++ b/include/accelerator.h @@ -226,6 +226,43 @@ unsigned char detect_chameleon (void); * 0x01 : C64 Chameleon cartridge present */ + +/* C65/C64DX in C64 mode */ + +unsigned char __fastcall__ set_c65_speed (unsigned char speed); + +/* Set the speed of the C65/C64DX CPU, using SPEED_SLOW will switch to + * 1 Mhz mode, SPEED_3X or SPEED_FAST will switch to 3.5 Mhz (fast) mode. + * + * Note that any value higher or equal to SPEED_3X will switch to fast mode. + * + * This function will return the actual speed the CPU is at after trying + * to set the requested speed, to my knowledge the switching should not fail. + * + * This function does not check for the presence of a C65/C64DX in C64 mode, + * make sure you use 'detect_c65();' before using. + */ + +unsigned char get_c65_speed (void); + +/* Get the speed of the C65/C64DX CPU. + * + * Possible return values: + * SPEED_SLOW : Slow mode + * SPEED_3X : Fast mode + * + * This function does not check for the presence of a C65/C64DX in C64 mode, + * make sure you use 'detect_c65();' before using. + */ + +unsigned char detect_c65 (void); + +/* Check for the presence of a C65/C64DX in C64 mode. + * + * Possible return values: + * 0x00 : C65/C64DX in C64 mode not present + * 0x01 : C65/C64DX in C64 mode present + */ /* End of accelerator.h */ #endif diff --git a/libsrc/c64/acc_c65_speed.s b/libsrc/c64/acc_c65_speed.s new file mode 100755 index 000000000..94fa50e91 --- /dev/null +++ b/libsrc/c64/acc_c65_speed.s @@ -0,0 +1,70 @@ +; +; Marco van den Heuvel, 2018-04-27 +; + +; unsigned char __fastcall__ set_c65_speed (unsigned char speed); +; +;/* Set the speed of the C65 CPU, using SPEED_SLOW will switch to +; * 1 Mhz mode, SPEED_3X or SPEED_FAST will switch to 3.5 Mhz (fast) mode. +; * +; * Note that any value higher or equal to SPEED_3X will switch to fast mode. +; * +; * This function will return the actual speed the CPU is at after trying +; * to set the requested speed, to my knowledge the switching should not fail. +; * +; * This function does not check for the presence of a C65/C64DX in C64 mode, +; * make sure you use 'detect_c65();' before using. +; */ + +; unsigned char get_c65_speed (void); +; +;/* Get the speed of the C65 CPU. +; * +; * Possible return values: +; * SPEED_SLOW : 1 Mhz mode +; * SPEED_3X : 3.5 Mhz mode +; * +; * This function does not check for the presence of a C65/C64DX in C64 mode, +; * make sure you use 'detect_c65();' before using. +; */ + + .export _set_c65_speed + .export _get_c65_speed + + .include "accelerator.inc" + +_set_c65_speed: + tay + jsr activate_new_vic_mode + cpy #SPEED_3X + bcs high_speed +low_speed: + and #$BF +store_speed: + sta C65_VICIII_CTRL_B + lda C65_VICIII_CTRL_B + jmp return_c65_speed + +high_speed: + ora #$40 + bne store_speed + +_get_c65_speed: + jsr activate_new_vic_mode +return_c65_speed: + sta C65_VICIII_KEY + and #$40 + beq speed_is_slow + lda #SPEED_3X + .byte $2C +speed_is_slow: + ldx #$00 + rts + +activate_new_vic_mode: + lda #C65_VICIII_UNLOCK_1 + sta C65_VICIII_KEY + lda #C65_VICIII_UNLOCK_2 + sta C65_VICIII_KEY + lda C65_VICIII_CTRL_B + rts diff --git a/libsrc/c64/acc_detect_c65.s b/libsrc/c64/acc_detect_c65.s new file mode 100755 index 000000000..8e9f9b9ec --- /dev/null +++ b/libsrc/c64/acc_detect_c65.s @@ -0,0 +1,55 @@ +; +; Marco van den Heuvel, 2018-04-27 +; + +; unsigned char detect_c65 (void); +; +;/* Check for the presence of a C65/C64DX in C64 mode. +; * +; * Possible return values: +; * 0x00 : C65/C64DX in C64 mode not present +; * 0x01 : C65/C64DX in C64 mode present +; */ + + .export _detect_c65 + + .include "accelerator.inc" + +_detect_c65: + ldy $D000 + +; Make sure the CPU is not a 65816 + clc + .byte $E2,$01 ; NOP #$01 on 6510 and 65(S)C02, LDA $(01,S),Y on 65CE02 and 4510, SEP #$01 on 65816 + lda #$00 + tax + bcs not_found ; carry will be set on 65816 + +; Make sure the CPU is not a 6510 + .byte $1A ; NOP on 6510, INA on 65(S)C(E)02 + beq not_found + txa + +; Make sure the CPU is a 65CE02/4510 + .byte $A3,$A3 ; NOP NOP on 65(S)C02, LDZ #$A3 on 65CE02 and 4510 + .byte $6B ; NOP on 65(S)C02, TZA on 65CE02 and 4510 + cmp #$A3 + bne not_found + +; Switch to VICIII mode and check if $D040 is a mirror of $D000 + ldy #C65_VICIII_UNLOCK_1 + sty C65_VICIII_KEY + ldy #C65_VICIII_UNLOCK_2 + sty C65_VICIII_KEY + cpy $D040 + bne found + inc $D000 + cpy $D040 + beq not_found + +found: + lda #$01 +not_found: + sty $D000 + sta C65_VICIII_KEY + rts diff --git a/testcode/lib/accelerator/Makefile b/testcode/lib/accelerator/Makefile index e9bd61881..9ff4d96b4 100644 --- a/testcode/lib/accelerator/Makefile +++ b/testcode/lib/accelerator/Makefile @@ -1,7 +1,8 @@ CL ?= cl65 all: c64-scpu-test.prg c128-scpu-test.prg c64dtv-test.prg \ - c64-c128-test.prg c128-test.prg chameleon-test.prg + c64-c128-test.prg c128-test.prg chameleon-test.prg \ + c65-test.prg c64-scpu-test.prg: c64-c128-scpu-test.c $(CL) -t c64 c64-c128-scpu-test.c -o c64-scpu-test.prg @@ -20,3 +21,6 @@ c128-test.prg: c64-c128-test.c chameleon-test.prg: chameleon-test.c $(CL) -t c64 chameleon-test.c -o chameleon-test.prg + +c65-test.prg: c65-test.c + $(CL) -t c64 c65-test.c -o c65-test.prg diff --git a/testcode/lib/accelerator/c65-test.c b/testcode/lib/accelerator/c65-test.c new file mode 100644 index 000000000..02e322625 --- /dev/null +++ b/testcode/lib/accelerator/c65-test.c @@ -0,0 +1,8 @@ +/* C65/C64DX in C64 mode accelerator test code. */ + +#define ACC_DETECT detect_c65 +#define ACC_GET_SPEED get_c65_speed +#define ACC_SET_SPEED set_c65_speed +#define ACC_NAME "C65" + +#include "turbo-test.c" From a012fab090a1ad681094ba23867a444eb603cc98 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sat, 28 Apr 2018 13:25:16 -0700 Subject: [PATCH 233/254] Added a comment to make the situation more clear. --- libsrc/c64/acc_c65_speed.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/c64/acc_c65_speed.s b/libsrc/c64/acc_c65_speed.s index 94fa50e91..1c218f0b5 100755 --- a/libsrc/c64/acc_c65_speed.s +++ b/libsrc/c64/acc_c65_speed.s @@ -54,7 +54,7 @@ _get_c65_speed: return_c65_speed: sta C65_VICIII_KEY and #$40 - beq speed_is_slow + beq speed_is_slow ; when this branch is taken then register A is already set to SPEED_SLOW lda #SPEED_3X .byte $2C speed_is_slow: From d0088fbc0fa99732c7d34c293c2d454b3b69f22e Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sat, 28 Apr 2018 13:26:20 -0700 Subject: [PATCH 234/254] Fixed a wrong branch. --- libsrc/c64/acc_detect_c65.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/c64/acc_detect_c65.s b/libsrc/c64/acc_detect_c65.s index 8e9f9b9ec..6d8af3c01 100755 --- a/libsrc/c64/acc_detect_c65.s +++ b/libsrc/c64/acc_detect_c65.s @@ -45,7 +45,7 @@ _detect_c65: bne found inc $D000 cpy $D040 - beq not_found + bne not_found found: lda #$01 From a482b54ed72e4c194fed57631266ca75b8aadc48 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Sun, 29 Apr 2018 13:50:09 +0200 Subject: [PATCH 235/254] Removed extern keyword from function prototype. --- include/accelerator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/accelerator.h b/include/accelerator.h index d29b73467..d25195455 100644 --- a/include/accelerator.h +++ b/include/accelerator.h @@ -60,7 +60,7 @@ /* C64/C128 SuperCPU cartridge */ -extern unsigned char __fastcall__ set_scpu_speed (unsigned char speed); +unsigned char __fastcall__ set_scpu_speed (unsigned char speed); /* Set the speed of the SuperCPU cartridge, using SPEED_SLOW will switch to * 1 Mhz mode, SPEED_20X or SPEED_FAST will switch to 20 Mhz mode. From 63cad26656bb83d4269c53a642d9f8b8187760ae Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sun, 29 Apr 2018 12:12:13 -0700 Subject: [PATCH 236/254] Merge branch 'master', remote-tracking branch 'origin' From 5b4929ef98e2a6ba28ab4e6528037a9ad5d14fed Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Sun, 29 Apr 2018 12:13:52 -0700 Subject: [PATCH 237/254] Removed obsolete bit opcode. --- libsrc/c64/acc_c65_speed.s | 1 - 1 file changed, 1 deletion(-) diff --git a/libsrc/c64/acc_c65_speed.s b/libsrc/c64/acc_c65_speed.s index 1c218f0b5..92f2bac06 100755 --- a/libsrc/c64/acc_c65_speed.s +++ b/libsrc/c64/acc_c65_speed.s @@ -56,7 +56,6 @@ return_c65_speed: and #$40 beq speed_is_slow ; when this branch is taken then register A is already set to SPEED_SLOW lda #SPEED_3X - .byte $2C speed_is_slow: ldx #$00 rts From ad7b339c449bb680e58ba240d37db8581015a60c Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Mon, 30 Apr 2018 14:30:35 -0700 Subject: [PATCH 238/254] Added C64 Turbo Master accelerator code and documentation. --- asminc/accelerator.inc | 9 ++++ doc/c64.sgml | 3 ++ doc/funcref.sgml | 67 +++++++++++++++++++++++++++++ include/accelerator.h | 41 ++++++++++++++++++ libsrc/c64/acc_detect_turbomaster.s | 47 ++++++++++++++++++++ libsrc/c64/acc_turbomaster_speed.s | 63 +++++++++++++++++++++++++++ testcode/lib/accelerator/Makefile | 5 ++- 7 files changed, 234 insertions(+), 1 deletion(-) create mode 100755 libsrc/c64/acc_detect_turbomaster.s create mode 100755 libsrc/c64/acc_turbomaster_speed.s diff --git a/asminc/accelerator.inc b/asminc/accelerator.inc index a92b65ff9..23a9686c7 100644 --- a/asminc/accelerator.inc +++ b/asminc/accelerator.inc @@ -69,3 +69,12 @@ C65_VICIII_CTRL_B := $D031 C65_VICIII_UNLOCK_1 = $A5 C65_VICIII_UNLOCK_2 = $96 + + +; --------------------------------------------------------------------------- +; C64 Turbo Master cartridge + +TURBOMASTER_DETECT := $BF53 + +TURBOMASTER_SPEED_REG := $00 + diff --git a/doc/c64.sgml b/doc/c64.sgml index 800314fec..98008ef41 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -180,16 +180,19 @@ url="funcref.html" name="function reference"> for declaration and usage. <item>detect_c65 <item>detect_chameleon <item>detect_scpu +<item>detect_turbomaster <item>get_c128_speed <item>get_c64dtv_speed <item>get_c65_speed <item>get_chameleon_speed <item>get_scpu_speed +<item>get_turbomaster_speed <item>set_c128_speed <item>set_c64dtv_speed <item>set_c65_speed <item>set_chameleon_speed <item>set_scpu_speed +<item>set_turbomaster_speed </itemize> diff --git a/doc/funcref.sgml b/doc/funcref.sgml index edca7745e..946b88159 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -73,16 +73,19 @@ function. <item><ref id="detect_c65" name="detect_c65"> <item><ref id="detect_chameleon" name="detect_chameleon"> <item><ref id="detect_scpu" name="detect_scpu"> +<item><ref id="detect_turbomaster" name="detect_turbomaster"> <item><ref id="get_c128_speed" name="get_c128_speed"> <item><ref id="get_c64dtv_speed" name="get_c64dtv_speed"> <item><ref id="get_c65_speed" name="get_c65_speed"> <item><ref id="get_chameleon_speed" name="get_chameleon_speed"> <item><ref id="get_scpu_speed" name="get_scpu_speed"> +<item><ref id="get_turbomaster_speed" name="get_turbomaster_speed"> <item><ref id="set_c128_speed" name="set_c128_speed"> <item><ref id="set_c64dtv_speed" name="set_c64dtv_speed"> <item><ref id="set_c65_speed" name="set_c65_speed"> <item><ref id="set_chameleon_speed" name="set_chameleon_speed"> <item><ref id="set_scpu_speed" name="set_scpu_speed"> +<item><ref id="set_turbomaster_speed" name="set_turbomaster_speed"> </itemize> @@ -3032,6 +3035,26 @@ used in presence of a prototype. </quote> +<sect1>detect_turbomaster<label id="detect_turbomaster"><p> + +<quote> +<descrip> +<tag/Function/Check for the presence of the C64 Turbo Master cartridge. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char detect_turbomaster (void);/ +<tag/Description/The function returns a 1 if a C64 Turbo Master cartridge has been detected. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="get_turbomaster_speed" name="get_turbomaster_speed">, +<ref id="set_turbomaster_speed" name="set_turbomaster_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>div<label id="div"><p> <quote> @@ -3659,6 +3682,28 @@ header files define constants that can be used to check the return code. </quote> +<sect1>get_turbomaster_speed<label id="get_turbomaster_speed"><p> + +<quote> +<descrip> +<tag/Function/Get the current speed of the C64 Turbo Master cartridge. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char get_turbomaster_speed (void);/ +<tag/Description/The function returns the current speed of the C64 Turbo Master cartridge. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of the C64 Turbo master cartridge. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_turbomaster" name="detect_turbomaster">, +<ref id="set_turbomaster_speed" name="set_turbomaster_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>get_scpu_speed<label id="get_scpu_speed"><p> <quote> @@ -6320,6 +6365,28 @@ clean-up when exitting the program. </quote> +<sect1>set_turbomaster_speed<label id="set_turbomaster_speed"><p> + +<quote> +<descrip> +<tag/Function/Set the current speed of the C64 Turbo Master cartridge. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed);/ +<tag/Description/The function returns the speed after trying to set the speed of the C64 Turbo Master cartridge. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of the C64 Turbo Master cartridge. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_turbomaster" name="detect_turbomaster">, +<ref id="get_turbomaster_speed" name="get_turbomaster_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>set_scpu_speed<label id="set_scpu_speed"><p> <quote> diff --git a/include/accelerator.h b/include/accelerator.h index 50ff5c35e..fdd2ebaf7 100644 --- a/include/accelerator.h +++ b/include/accelerator.h @@ -263,6 +263,47 @@ unsigned char detect_c65 (void); * 0x00 : C65/C64DX in C64 mode not present * 0x01 : C65/C64DX in C64 mode present */ + + +/* C64 Turbo Master cartridge */ + +unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed); + +/* Set the speed of the Turbo Master cartridge, using SPEED_SLOW will switch to + * 1 Mhz mode, SPEED_4X or SPEED_FAST will switch to 4 Mhz mode. + * + * Note that any value higher or equal to SPEED_4X will switch to 4 Mhz mode, + * any value lower than SPEED_4X will switch to 1 Mhz mode. + * + * This function will return the actual speed the CPU is at after trying + * to set the requested speed, if the speed is different it might indicate + * that the hardware switch has locked the speed. + * + * This function does not check for the presence of a Turbo Master cartridge, + * make sure you use 'detect_turbomaster();' before using. + */ + +unsigned char get_turbomaster_speed (void); + +/* Get the speed of the Turbo Master cartridge. + * + * Possible return values: + * SPEED_SLOW : 1 Mhz mode + * SPEED_4X : 4 Mhz mode + * + * This function does not check for the presence of a Turbo Master cartridge, + * make sure you use 'detect_turbomaster();' before using. + */ + +unsigned char detect_turbomaster (void); + +/* Check for the presence of a C64 Turbo Master cartridge. + * + * Possible return values: + * 0x00 : C64 Turbo Master cartridge not present + * 0x01 : C64 Turbo Master cartridge present + */ + /* End of accelerator.h */ #endif diff --git a/libsrc/c64/acc_detect_turbomaster.s b/libsrc/c64/acc_detect_turbomaster.s new file mode 100755 index 000000000..0af9c3af7 --- /dev/null +++ b/libsrc/c64/acc_detect_turbomaster.s @@ -0,0 +1,47 @@ +; +; Marco van den Heuvel, 2018-04-30 +; + +; unsigned char detect_turbomaster (void); +; +;/* Check for the presence of a Turbo Master cartridge. +; * +; * Possible return values: +; * 0x00 : TurboMaster cartridge not present +; * 0x01 : TurboMaster cartridge present +; */ + + .export _detect_turbomaster + + .include "accelerator.inc" + +_detect_turbomaster: + lda #$00 + tax + +; Make sure the current CPU is not a 6510 + .byte $1A ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816 + beq not_found + +; Make sure the current CPU is not a 65816 + clc + .byte $E2,$01 ; NOP #$01 on 65(S)C02, LDA $(01,S),Y on 65CE02 and 4510, SEP #$01 on 65816 + bcs not_found ; carry will be set on 65816 + +; Make sure the current CPU is not a 65CE02/4510 + .byte $A3,$A3 ; NOP NOP on 65(S)C02 and LDZ #$00 on 65CE02 and 4510 + .byte $6B ; NOP on 65(S)C02 and TZA on 65CE02 and 4510 + cmp #$A3 + beq not_found + +; Check for turbo master basic replacement + ldy TURBOMASTER_DETECT + cpy #$A2 + bne not_found +found: + lda #$01 + .byte $24 +not_found: + txa + rts + diff --git a/libsrc/c64/acc_turbomaster_speed.s b/libsrc/c64/acc_turbomaster_speed.s new file mode 100755 index 000000000..679003b03 --- /dev/null +++ b/libsrc/c64/acc_turbomaster_speed.s @@ -0,0 +1,63 @@ +; +; Marco van den Heuvel, 2018-04-30 +; + +; unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed); +; +;/* Set the speed of the Turbo Master cartridge, using SPEED_SLOW will switch to +; * 1 Mhz mode, SPEED_4X or SPEED_FAST will switch to 4 Mhz mode. +; * +; * Note that any value higher or equal to SPEED_4X will switch to 4 Mhz mode, +; * any value lower than SPEED_4X will switch to 1 Mhz mode. +; * +; * This function will return the actual speed the CPU is at after trying +; * to set the requested speed, if the speed is different it might indicate +; * that the hardware switch has locked the speed. +; * +; * This function does not check for the presence of a Turbo Master cartridge, +; * make sure you use 'detect_turbomaster();' before using. +; */ + +; unsigned char get_turbomaster_speed (void); +; +;/* Get the speed of the Turbo Master cartridge. +; * +; * Possible return values: +; * SPEED_SLOW : 1 Mhz mode +; * SPEED_4X : 4 Mhz mode +; * +; * This function does not check for the presence of a Turbo Master cartridge, +; * make sure you use 'detect_turbomaster();' before using. +; */ + + .export _set_turbomaster_speed + .export _get_turbomaster_speed + + .include "accelerator.inc" + +_set_turbomaster_speed: + tay + lda TURBOMASTER_SPEED_REG + cpy #SPEED_4X + bcs high_speed +low_speed: + and #$7F +store_speed: + sta TURBOMASTER_SPEED_REG + jmp _get_turbomaster_speed + +high_speed: + ora #$80 + bne store_speed + + +_get_turbomaster_speed: + ldx #$00 + lda TURBOMASTER_SPEED_REG + and #$80 + beq is_slow_speed +is_high_speed: + lda #SPEED_4X +is_slow_speed: + rts + diff --git a/testcode/lib/accelerator/Makefile b/testcode/lib/accelerator/Makefile index 9ff4d96b4..6b90a9556 100644 --- a/testcode/lib/accelerator/Makefile +++ b/testcode/lib/accelerator/Makefile @@ -2,7 +2,7 @@ CL ?= cl65 all: c64-scpu-test.prg c128-scpu-test.prg c64dtv-test.prg \ c64-c128-test.prg c128-test.prg chameleon-test.prg \ - c65-test.prg + c65-test.prg turbomaster-test.prg c64-scpu-test.prg: c64-c128-scpu-test.c $(CL) -t c64 c64-c128-scpu-test.c -o c64-scpu-test.prg @@ -24,3 +24,6 @@ chameleon-test.prg: chameleon-test.c c65-test.prg: c65-test.c $(CL) -t c64 c65-test.c -o c65-test.prg + +turbomaster-test.prg: turbomaster-test.c + $(CL) -t c64 turbomaster-test.c -o turbomaster-test.prg From b12678e90d66e5c371f84947dd445ab2ae342699 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Mon, 30 Apr 2018 14:34:46 -0700 Subject: [PATCH 239/254] Fixed a typo. --- doc/funcref.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 946b88159..c23ffb72c 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -3692,7 +3692,7 @@ header files define constants that can be used to check the return code. <tag/Description/The function returns the current speed of the C64 Turbo Master cartridge. <tag/Notes/<itemize> <item>The function is specific to the C64. -<item>The function does not check for the presence of the C64 Turbo master cartridge. +<item>The function does not check for the presence of the C64 Turbo Master cartridge. <item>See the accelerator.h header for the speed definitions. </itemize> <tag/Availability/cc65 (not all platforms) From 21e6f25e700d70f9fea4ab0bfea2e6a858c43a62 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Tue, 1 May 2018 14:44:23 -0700 Subject: [PATCH 240/254] Added missing file. --- testcode/lib/accelerator/turbomaster-test.c | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 testcode/lib/accelerator/turbomaster-test.c diff --git a/testcode/lib/accelerator/turbomaster-test.c b/testcode/lib/accelerator/turbomaster-test.c new file mode 100755 index 000000000..207465efa --- /dev/null +++ b/testcode/lib/accelerator/turbomaster-test.c @@ -0,0 +1,8 @@ +/* C64 Turbo Master accelerator test code. */ + +#define ACC_DETECT detect_turbomaster +#define ACC_GET_SPEED get_turbomaster_speed +#define ACC_SET_SPEED set_turbomaster_speed +#define ACC_NAME "Turbo Master cartridge" + +#include "turbo-test.c" From b1c3daca3a847741e3fc0226e19ca92a502aa03e Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Tue, 1 May 2018 14:45:51 -0700 Subject: [PATCH 241/254] Fixed the order of some functions. --- doc/funcref.sgml | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index c23ffb72c..88581c361 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -3682,28 +3682,6 @@ header files define constants that can be used to check the return code. </quote> -<sect1>get_turbomaster_speed<label id="get_turbomaster_speed"><p> - -<quote> -<descrip> -<tag/Function/Get the current speed of the C64 Turbo Master cartridge. -<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ -<tag/Declaration/<tt/unsigned char get_turbomaster_speed (void);/ -<tag/Description/The function returns the current speed of the C64 Turbo Master cartridge. -<tag/Notes/<itemize> -<item>The function is specific to the C64. -<item>The function does not check for the presence of the C64 Turbo Master cartridge. -<item>See the accelerator.h header for the speed definitions. -</itemize> -<tag/Availability/cc65 (not all platforms) -<tag/See also/ -<ref id="detect_turbomaster" name="detect_turbomaster">, -<ref id="set_turbomaster_speed" name="set_turbomaster_speed">, -<tag/Example/None. -</descrip> -</quote> - - <sect1>get_scpu_speed<label id="get_scpu_speed"><p> <quote> @@ -3726,6 +3704,27 @@ header files define constants that can be used to check the return code. </quote> +<sect1>get_turbomaster_speed<label id="get_turbomaster_speed"><p> + +<quote> +<descrip> +<tag/Function/Get the current speed of the C64 Turbo Master cartridge. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char get_turbomaster_speed (void);/ +<tag/Description/The function returns the current speed of the C64 Turbo Master cartridge. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of the C64 Turbo Master cartridge. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_turbomaster" name="detect_turbomaster">, +<ref id="set_turbomaster_speed" name="set_turbomaster_speed">, +<tag/Example/None. +</descrip> +</quote> + <sect1>getcpu<label id="getcpu"><p> <quote> From e88ac62d06e228739686df4b710f00070ce4e3fb Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Tue, 1 May 2018 14:46:57 -0700 Subject: [PATCH 242/254] Optimized the code a bit, thanks to Greg for the suggestions/comments. --- libsrc/c64/acc_detect_turbomaster.s | 6 ++---- libsrc/c64/acc_turbomaster_speed.s | 11 ++--------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/libsrc/c64/acc_detect_turbomaster.s b/libsrc/c64/acc_detect_turbomaster.s index 0af9c3af7..2f8fb2294 100755 --- a/libsrc/c64/acc_detect_turbomaster.s +++ b/libsrc/c64/acc_detect_turbomaster.s @@ -37,11 +37,9 @@ _detect_turbomaster: ; Check for turbo master basic replacement ldy TURBOMASTER_DETECT cpy #$A2 - bne not_found -found: - lda #$01 - .byte $24 + beq found not_found: txa +found: rts diff --git a/libsrc/c64/acc_turbomaster_speed.s b/libsrc/c64/acc_turbomaster_speed.s index 679003b03..7ef6b0540 100755 --- a/libsrc/c64/acc_turbomaster_speed.s +++ b/libsrc/c64/acc_turbomaster_speed.s @@ -38,18 +38,11 @@ _set_turbomaster_speed: tay lda TURBOMASTER_SPEED_REG + asl cpy #SPEED_4X - bcs high_speed -low_speed: - and #$7F + ror store_speed: sta TURBOMASTER_SPEED_REG - jmp _get_turbomaster_speed - -high_speed: - ora #$80 - bne store_speed - _get_turbomaster_speed: ldx #$00 From 04675fca2a181270fc36d9f9c204d4064c5f2dfd Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Wed, 2 May 2018 11:23:43 -0700 Subject: [PATCH 243/254] Order fix. --- doc/funcref.sgml | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 88581c361..f10379c93 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -6364,28 +6364,6 @@ clean-up when exitting the program. </quote> -<sect1>set_turbomaster_speed<label id="set_turbomaster_speed"><p> - -<quote> -<descrip> -<tag/Function/Set the current speed of the C64 Turbo Master cartridge. -<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ -<tag/Declaration/<tt/unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed);/ -<tag/Description/The function returns the speed after trying to set the speed of the C64 Turbo Master cartridge. -<tag/Notes/<itemize> -<item>The function is specific to the C64. -<item>The function does not check for the presence of the C64 Turbo Master cartridge. -<item>See the accelerator.h header for the speed definitions. -</itemize> -<tag/Availability/cc65 (not all platforms) -<tag/See also/ -<ref id="detect_turbomaster" name="detect_turbomaster">, -<ref id="get_turbomaster_speed" name="get_turbomaster_speed">, -<tag/Example/None. -</descrip> -</quote> - - <sect1>set_scpu_speed<label id="set_scpu_speed"><p> <quote> @@ -6408,6 +6386,28 @@ clean-up when exitting the program. </quote> +<sect1>set_turbomaster_speed<label id="set_turbomaster_speed"><p> + +<quote> +<descrip> +<tag/Function/Set the current speed of the C64 Turbo Master cartridge. +<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/ +<tag/Declaration/<tt/unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed);/ +<tag/Description/The function returns the speed after trying to set the speed of the C64 Turbo Master cartridge. +<tag/Notes/<itemize> +<item>The function is specific to the C64. +<item>The function does not check for the presence of the C64 Turbo Master cartridge. +<item>See the accelerator.h header for the speed definitions. +</itemize> +<tag/Availability/cc65 (not all platforms) +<tag/See also/ +<ref id="detect_turbomaster" name="detect_turbomaster">, +<ref id="get_turbomaster_speed" name="get_turbomaster_speed">, +<tag/Example/None. +</descrip> +</quote> + + <sect1>setjmp<label id="setjmp"><p> <quote> From cdebf6baa754af0e446a2dd5242ec71e783c1491 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel <blackystardust68@yahoo.com> Date: Thu, 3 May 2018 09:11:20 -0700 Subject: [PATCH 244/254] Harmonized the comments (as in added 1 space) ;) --- libsrc/c64/acc_detect_turbomaster.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/c64/acc_detect_turbomaster.s b/libsrc/c64/acc_detect_turbomaster.s index 2f8fb2294..431985a47 100755 --- a/libsrc/c64/acc_detect_turbomaster.s +++ b/libsrc/c64/acc_detect_turbomaster.s @@ -20,7 +20,7 @@ _detect_turbomaster: tax ; Make sure the current CPU is not a 6510 - .byte $1A ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816 + .byte $1A ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816 beq not_found ; Make sure the current CPU is not a 65816 From cdce753a09ea815d55936b78e6a1d57849a9a175 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 9 May 2018 23:31:42 +0000 Subject: [PATCH 245/254] NMI friendly c64-hi Don't clear all vectors, see #639. --- libsrc/c64/tgi/c64-hi.s | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libsrc/c64/tgi/c64-hi.s b/libsrc/c64/tgi/c64-hi.s index aeb334404..fd7a25478 100644 --- a/libsrc/c64/tgi/c64-hi.s +++ b/libsrc/c64/tgi/c64-hi.s @@ -131,7 +131,7 @@ VBASE := $E000 ; Video memory base address ; INSTALL: - rts +; rts ; fall through ; ------------------------------------------------------------------------ @@ -272,9 +272,12 @@ CLEAR: ldy #$00 sta VBASE+$1C00,y sta VBASE+$1D00,y sta VBASE+$1E00,y - sta VBASE+$1F00,y iny bne @L1 +@L2: sta VBASE+$1F00,y + iny + cpy #$40 + bne @L2 rts ; ------------------------------------------------------------------------ @@ -285,7 +288,7 @@ CLEAR: ldy #$00 ; SETVIEWPAGE: - rts +; rts ; fall through ; ------------------------------------------------------------------------ ; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n). From b81a04f157975ac117866473f5cecdf7d6015801 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 9 May 2018 23:52:52 +0000 Subject: [PATCH 246/254] Update c64-hi.s --- libsrc/c64/tgi/c64-hi.s | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libsrc/c64/tgi/c64-hi.s b/libsrc/c64/tgi/c64-hi.s index fd7a25478..ad453fd5a 100644 --- a/libsrc/c64/tgi/c64-hi.s +++ b/libsrc/c64/tgi/c64-hi.s @@ -272,12 +272,9 @@ CLEAR: ldy #$00 sta VBASE+$1C00,y sta VBASE+$1D00,y sta VBASE+$1E00,y + sta VBASE+$1F40,y ; preserve vectors iny bne @L1 -@L2: sta VBASE+$1F00,y - iny - cpy #$40 - bne @L2 rts ; ------------------------------------------------------------------------ From b449ded1764c134ed1a103adf5ec4f5ba1486814 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Wed, 9 May 2018 23:56:35 +0000 Subject: [PATCH 247/254] Update c64-hi.s --- libsrc/c64/tgi/c64-hi.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/c64/tgi/c64-hi.s b/libsrc/c64/tgi/c64-hi.s index ad453fd5a..e2c3bca9f 100644 --- a/libsrc/c64/tgi/c64-hi.s +++ b/libsrc/c64/tgi/c64-hi.s @@ -272,7 +272,7 @@ CLEAR: ldy #$00 sta VBASE+$1C00,y sta VBASE+$1D00,y sta VBASE+$1E00,y - sta VBASE+$1F40,y ; preserve vectors + sta VBASE+$1E40,y ; preserve vectors iny bne @L1 rts From ca31e3af1effb268d36235495a11c2580b938682 Mon Sep 17 00:00:00 2001 From: greg-king5 <greg.king5@verizon.net> Date: Sat, 12 May 2018 13:46:16 -0400 Subject: [PATCH 248/254] Fixed a bug that didn't preserve the accumulator's value when a simple 16-bit fetch-and-store is optimized. (#637) Fix a 16-bit fetch-and-store cc65 optimizer bug. --- src/cc65/coptstore.c | 45 +++++++++++++++++++++--------------------- test/val/assign-use1.c | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 23 deletions(-) create mode 100644 test/val/assign-use1.c diff --git a/src/cc65/coptstore.c b/src/cc65/coptstore.c index 56343c95b..b0dfe3b6d 100644 --- a/src/cc65/coptstore.c +++ b/src/cc65/coptstore.c @@ -380,48 +380,48 @@ unsigned OptStore5 (CodeSeg* S) ** sta something ** stx something-else ** -** and replace it by +** and, replace it by ** -** lda foo -** sta something ** lda bar ** sta something-else +** lda foo +** sta something ** -** if X is not used later. This replacement doesn't save any cycles or bytes, -** but it keeps the value of X, which may be reused later. +** if the new value of X is not used later. That replacement doesn't save any +** cycles or bytes; but, it keeps the old value of X, which may be reused later. */ { unsigned Changes = 0; + unsigned I = 0; /* Walk over the entries */ - unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[4]; /* Get next entry */ L[0] = CS_GetEntry (S, I); /* Check for the sequence */ - if (L[0]->OPC == OP65_LDA && - !CS_RangeHasLabel (S, I+1, 3) && - CS_GetEntries (S, L+1, I+1, 3) && - L[1]->OPC == OP65_LDX && - L[2]->OPC == OP65_STA && - L[3]->OPC == OP65_STX && + if (L[0]->OPC == OP65_LDA && + !CS_RangeHasLabel (S, I+1, 3) && + CS_GetEntries (S, L+1, I+1, 3) && + L[1]->OPC == OP65_LDX && + L[2]->OPC == OP65_STA && + L[3]->OPC == OP65_STX && !RegXUsed (S, I+4)) { - CodeEntry* X; + CodeEntry* E = CS_GetEntry (S, I+1); - /* Insert the code after the sequence */ - X = NewCodeEntry (OP65_LDA, L[1]->AM, L[1]->Arg, 0, L[1]->LI); - CS_InsertEntry (S, X, I+4); - X = NewCodeEntry (OP65_STA, L[3]->AM, L[3]->Arg, 0, L[3]->LI); - CS_InsertEntry (S, X, I+5); + /* Move the high-byte code to the beginning of the sequence */ + CS_MoveEntry (S, I+1, I); + CS_MoveEntry (S, I+3, I+1); - /* Delete the old code */ - CS_DelEntry (S, I+3); - CS_DelEntry (S, I+1); + /* Change from the X register to the A register */ + CE_ReplaceOPC (E, OP65_LDA); + CE_ReplaceOPC (CS_GetEntry (S, I+1), OP65_STA); + + /* Move labels from the old first entry to the new first entry */ + CS_MoveLabels (S, CS_GetEntry (S, I+2), E); /* Remember, we had changes */ ++Changes; @@ -429,7 +429,6 @@ unsigned OptStore5 (CodeSeg* S) /* Next entry */ ++I; - } /* Return the number of changes made */ diff --git a/test/val/assign-use1.c b/test/val/assign-use1.c new file mode 100644 index 000000000..744023530 --- /dev/null +++ b/test/val/assign-use1.c @@ -0,0 +1,36 @@ +/* + !!DESCRIPTION!! Assign an int; then, do an operation that depends directly on that assignment. + !!ORIGIN!! cc65 regression tests + !!LICENCE!! Public Domain + !!AUTHOR!! Greg King +*/ + +#include <stdio.h> + +static unsigned char failures = 0; + +static unsigned int result; +static const unsigned int buffer = 0xABCD; + +int main(void) +{ + result = buffer; + + /* Shift doesn't use high byte (X register); previous assignment should be optimized. */ + result <<= 8; + if (result != 0xCD00) { + ++failures; + printf("assign-use1: left shift is $%X, not $CD00.\n", result); + } + + result = buffer; + + /* Shift does use high byte; previous assignment shouldn't be optimized by OptStore5(). */ + result >>= 8; + if (result != 0x00AB) { + ++failures; + printf("assign-use1: right shift is $%X, not $00AB.\n", result); + } + + return failures; +} From 5ecd902fbfbf7199ca489cf6d1d7add9758c0758 Mon Sep 17 00:00:00 2001 From: Michael Kohn <mike@mikekohn.net> Date: Sun, 13 May 2018 06:31:05 -0500 Subject: [PATCH 249/254] The opcode for BS should be 0x0C. --- src/ca65/instr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ca65/instr.c b/src/ca65/instr.c index 53d3573a6..37217203a 100644 --- a/src/ca65/instr.c +++ b/src/ca65/instr.c @@ -758,7 +758,7 @@ static const struct { { "BNZ", AMSW16_BRA, 0x07, 0, PutSweet16Branch }, { "BP", AMSW16_BRA, 0x04, 0, PutSweet16Branch }, { "BR", AMSW16_BRA, 0x01, 0, PutSweet16Branch }, - { "BS", AMSW16_BRA, 0x0B, 0, PutSweet16Branch }, + { "BS", AMSW16_BRA, 0x0C, 0, PutSweet16Branch }, { "BZ", AMSW16_BRA, 0x06, 0, PutSweet16Branch }, { "CPR", AMSW16_REG, 0xD0, 0, PutSweet16 }, { "DCR", AMSW16_REG, 0xF0, 0, PutSweet16 }, From 362b6afacff5ce936531713c76010367af6db42f Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Sun, 13 May 2018 04:21:42 -0400 Subject: [PATCH 250/254] Made a C union declaration know the sizes of anonymous struct/union members when it determines its size. The bug was located, and the fix was written, by Francesco. --- src/cc65/declare.c | 7 +- test/val/anon-struct1.c | 111 +++++++++++++++++++++++++++++ test/val/anon-struct2.c | 152 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 268 insertions(+), 2 deletions(-) create mode 100644 test/val/anon-struct1.c create mode 100644 test/val/anon-struct2.c diff --git a/src/cc65/declare.c b/src/cc65/declare.c index a6b232905..19100781c 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -656,13 +656,16 @@ static SymEntry* ParseUnionDecl (const char* Name) /* Check for fields without a name */ if (Decl.Ident[0] == '\0') { /* In cc65 mode, we allow anonymous structs/unions within - ** a struct. + ** a union. */ if (IS_Get (&Standard) >= STD_CC65 && IsClassStruct (Decl.Type)) { /* This is an anonymous struct or union. Copy the fields ** into the current level. */ - CopyAnonStructFields (&Decl, 0); + FieldSize = CopyAnonStructFields (&Decl, 0); + if (FieldSize > UnionSize) { + UnionSize = FieldSize; + } } else { /* A non bit-field without a name is legal but useless */ diff --git a/test/val/anon-struct1.c b/test/val/anon-struct1.c new file mode 100644 index 000000000..9a737adca --- /dev/null +++ b/test/val/anon-struct1.c @@ -0,0 +1,111 @@ +/* + !!DESCRIPTION!! Make sure that structs/unions know the sizes of anonymous struct/union members + !!ORIGIN!! cc65 regression tests + !!LICENCE!! Public Domain + !!AUTHOR!! Greg King +*/ + +/* + see https://github.com/cc65/cc65/issues/641 +*/ + +#include <stdio.h> + +static unsigned char fails = 0; + +typedef struct { + short s1; + struct { + int i1; + long l1; + char c1; + }; + char c2; +} s1_t; + +typedef struct { + short s1; + union { + int i1; + long l1; + char c1; + }; + char c2; +} s2_t; + +typedef union { + short s1; + struct { + int i1; + long l1; + char c1; + }; + char c2; +} u1_t; + +typedef union { + short s1; + union { + int i1; + long l1; + char c1; + }; + char c2; +} u2_t; + +static s1_t s1; +static s2_t s2; +static u1_t u1; +static u2_t u2; + +/* We use "variables" in the comparisons, so that we can avoid "constant +** comparison" and "Unreachable code" warnings (the second one currently +** can't be suppressed). +*/ + +static size_t const four = 4; +static size_t const seven = 7; +static size_t const ten = 10; + +int main(void) +{ + /* Check the types' sizes. */ + + if (sizeof (s1_t) != ten) { + printf("s1_t size is %u; it should be 10.\n", sizeof (s1_t)); + ++fails; + } + if (sizeof (s2_t) != seven) { + printf("s2_t size is %u; it should be 7.\n", sizeof (s2_t)); + ++fails; + } + if (sizeof (u1_t) != seven) { + printf("u1_t size is %u; it should be 7.\n", sizeof (u1_t)); + ++fails; + } + if (sizeof (u2_t) != four) { + printf("u2_t size is %u; it should be 4.\n", sizeof (u2_t)); + ++fails; + } + + /* Check the variables' sizes. */ + + if (sizeof s1 != ten) { + printf("s1 size is %u; it should be 10.\n", sizeof s1); + ++fails; + } + if (sizeof s2 != seven) { + printf("s2 size is %u; it should be 7.\n", sizeof s2); + ++fails; + } + if (sizeof u1 != seven) { + printf("u1 size is %u; it should be 7.\n", sizeof u1); + ++fails; + } + if (sizeof u2 != four) { + printf("u2 size is %u; it should be 4.\n", sizeof u2); + ++fails; + } + + return fails; +} diff --git a/test/val/anon-struct2.c b/test/val/anon-struct2.c new file mode 100644 index 000000000..bdaddc823 --- /dev/null +++ b/test/val/anon-struct2.c @@ -0,0 +1,152 @@ +/* + !!DESCRIPTION!! Make sure that the fields of anonymous structs/unions can be reached properly. + !!ORIGIN!! cc65 regression tests + !!LICENCE!! Public Domain + !!AUTHOR!! Greg King +*/ + +#include <stddef.h> +#include <stdio.h> + +static unsigned char fails = 0; + +typedef struct { + short s1; + struct { + char c1; + int i1; + long l1; + }; + char c2; +} s1_t; + +typedef struct { + char c2; + union { + int i1; + char c1; + long l1; + }; + short s1; +} s2_t; + +typedef union { + short s1; + struct { + int i1; + long l1; + char c1; + }; + char c2; +} u1_t; + +typedef union { + short s1; + union { + long l1; + char c1; + int i1; + }; + char c2; +} u2_t; + +typedef struct { + union { + short s1; + struct { + int i1; + long l1; + char c1; + }; + char c2; + }; + short s2; +} s3_t; + +static s1_t s1; +static s2_t s2; +static u1_t u1; +static u2_t u2; + +static long l2; +static int i2; + +/* We use "variables" in the comparisons, so that we can avoid "constant +** comparison" and "Unreachable code" warnings (the second one currently +** can't be suppressed). +*/ + +static size_t const zero = 0; +static size_t const one = 1; +static size_t const three = 3; +static size_t const five = 5; +static size_t const six = 6; +static size_t const seven = 7; +static size_t const nine = 9; + +int main(void) +{ + /* Can cc65 see the names of members of anonymous structs/unions? */ + + l2 = s1.l1; + l2 = s2.l1; + l2 = u1.l1; + l2 = u2.l1; + + i2 = s1.c1; + i2 = s1.c2; + i2 = s2.c1; + i2 = s2.c2; + i2 = u1.c1; + i2 = u1.c2; + i2 = u2.c1; + i2 = u2.c2; + + /* Does cc65 use the correct offsets of + ** the members of anonymous structs/unions? + */ + + if (offsetof(s1_t, i1) != three) { + printf("The offset of s1.i1 is %u; it should be 3.\n", offsetof(s1_t, i1)); + ++fails; + } + if (offsetof(s2_t, l1) != one) { + printf("The offset of s2.l1 is %u; it should be 1.\n", offsetof(s2_t, l1)); + ++fails; + } + if (offsetof(u1_t, c1) != six) { + printf("The offset of u1.c1 is %u; it should be 6.\n", offsetof(u1_t, c1)); + ++fails; + } + if (offsetof(u2_t, i1) != zero) { + printf("The offset of u2.i1 is %u; it should be 0.\n", offsetof(u2_t, i1)); + ++fails; + } + + /* Does cc65 use the correct offset of a member + ** that's later than an anonymous struct/union? + */ + + if (offsetof(s1_t, c2) != nine) { + printf("The offset of s1.c2 is %u; it should be 9.\n", offsetof(s1_t, c2)); + ++fails; + } + if (offsetof(s2_t, s1) != five) { + printf("The offset of s2.s1 is %u; it should be 5.\n", offsetof(s2_t, s1)); + ++fails; + } + if (offsetof(u1_t, c2) != zero) { + printf("The offset of u1.c2 is %u; it should be 0.\n", offsetof(u1_t, c2)); + ++fails; + } + if (offsetof(u2_t, c2) != zero) { + printf("The offset of u2.c2 is %u; it should be 0.\n", offsetof(u2_t, c2)); + ++fails; + } + if (offsetof(s3_t, s2) != seven) { + printf("The offset of s3.s2 is %u; it should be 7.\n", offsetof(s3_t, s2)); + ++fails; + } + + return fails; +} From df79409f761e0e51ea39e2407a86537baf6b0321 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Mon, 14 May 2018 14:17:09 +0000 Subject: [PATCH 251/254] Update c64.sgml soft80 is NMI ready --- doc/c64.sgml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/c64.sgml b/doc/c64.sgml index 98008ef41..96260b48e 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -5,7 +5,7 @@ <title>Commodore 64-specific information for cc65 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"><newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> -<date>2017-01-18 +<date>2018-05-14 <abstract> An overview over the C64 runtime system as it is implemented for the cc65 C @@ -122,8 +122,8 @@ since the program must be loaded to the BASIC start address. <sect1>80 Columns conio driver<p> The C64 package comes with an alternative software driven 80 columns -module <tt/c64-soft80.o/ which uses the memory under I/O between $d000 -and $ffff. +module <tt/c64-soft80.o/ which uses the memory under I/O between $D000 +and $FF3F. In memory constrained situations the memory from $400 to $7FF can be made available to a program by calling <tt/_heapadd ((void *) 0x0400, 0x0400);/ From b3358c462ed4a24bf8cb2b646e46cf86d544b299 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Mon, 14 May 2018 23:10:34 +0000 Subject: [PATCH 252/254] Update c64.sgml Do not use last page! --- doc/c64.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/c64.sgml b/doc/c64.sgml index 96260b48e..a18ce359f 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -318,7 +318,7 @@ Note that the graphics drivers are incompatible with the bytes each. Written and contributed by Marco van den Heuvel. <tag><tt/c64-ram.emd (c64_ram_emd)/</tag> - A driver for the hidden RAM below the I/O area and kernal ROM. Supports 48 + A driver for the hidden RAM below the I/O area and kernal ROM. Supports 47 256 byte pages. Please note that this driver is incompatible with any of the graphics drivers, or the soft80 conio driver! From 472a10735835ba9fc175c50a36ff59c8e0e5f4d0 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Mon, 14 May 2018 23:22:09 +0000 Subject: [PATCH 253/254] Make NMI ready --- libsrc/c64/emd/c64-ram.s | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libsrc/c64/emd/c64-ram.s b/libsrc/c64/emd/c64-ram.s index f8a4a1819..b41f932e6 100644 --- a/libsrc/c64/emd/c64-ram.s +++ b/libsrc/c64/emd/c64-ram.s @@ -44,7 +44,7 @@ ; Constants BASE = $D000 -PAGES = ($10000 - BASE) / 256 +PAGES = ($FF00 - BASE) / 256 ; ------------------------------------------------------------------------ ; Data. @@ -267,5 +267,3 @@ COPYTO: sta ptr3 sta ptr1+1 ; From jmp common - - From a795a27689e0bb06773f0ee0608354bdceb19286 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Thu, 17 May 2018 11:11:40 +0200 Subject: [PATCH 254/254] There's no 'closeallstreams' (anymore ?). --- libsrc/cbm/open.s | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libsrc/cbm/open.s b/libsrc/cbm/open.s index 4e57f5efc..5c97aff56 100644 --- a/libsrc/cbm/open.s +++ b/libsrc/cbm/open.s @@ -2,10 +2,6 @@ ; Ullrich von Bassewitz, 16.11.2002 ; ; int open (const char* name, int flags, ...); /* May take a mode argument */ -; -; Be sure to keep the value priority of closeallfiles lower than that of -; closeallstreams (which is the high level C file I/O counterpart and must be -; called before closeallfiles). .export _open