Merge remote-tracking branch 'origin/master' into coniopeek

This commit is contained in:
mrdudz
2022-07-24 03:24:45 +02:00
2250 changed files with 195541 additions and 36938 deletions

View File

@@ -1,7 +1,7 @@
;
; Ullrich von Bassewitz, 27.09.1998
;
; void set_brk (unsigned Addr);
; void __fastcall__ set_brk (unsigned Addr);
; void reset_brk (void);
;

View File

@@ -7,6 +7,7 @@
.export _cgetc
.import cursor
.include "cbm_kernal.inc"
.include "plus4.inc"
@@ -56,12 +57,14 @@ L2: jsr KBDREAD ; Read char and return in A
.constructor initkbd
.destructor donekbd
.segment "INIT"
.segment "ONCE"
.proc initkbd
ldy #15
ldy #7
@L1: lda fnkeys,y
sta FKEY_SPACE+8,y
lda #$01 ; Lower 8 places are all $01
sta FKEY_SPACE,y
dey
bpl @L1
@@ -69,6 +72,8 @@ L2: jsr KBDREAD ; Read char and return in A
.endproc
fnkeys: .byte 133, 137, 134, 138, 135, 139, 136, 140
.code
@@ -82,11 +87,3 @@ L2: jsr KBDREAD ; Read char and return in A
rts
.endproc
; Function key table, readonly
.rodata
fnkeys: .byte $01, $01, $01, $01, $01, $01, $01, $01
.byte 133, 137, 134, 138, 135, 139, 136, 140

View File

@@ -6,10 +6,6 @@
.export _clrscr
.include "plus4.inc"
.include "cbm_kernal.inc"
_clrscr = CLRSCR

View File

@@ -1,33 +1 @@
;
; Ullrich von Bassewitz, 06.08.1998
;
; unsigned char __fastcall__ textcolor (unsigned char color);
; unsigned char __fastcall__ bgcolor (unsigned char color);
; unsigned char __fastcall__ bordercolor (unsigned char color);
;
.export _textcolor, _bgcolor, _bordercolor
.include "plus4.inc"
_textcolor:
ldx CHARCOLOR ; get old value
sta CHARCOLOR ; set new value
txa
rts
_bgcolor:
ldx TED_BGCOLOR ; get old value
sta TED_BGCOLOR ; set new value
txa
rts
_bordercolor:
ldx TED_BORDERCOLOR ; get old value
sta TED_BORDERCOLOR ; set new value
txa
rts
.include "../plus4/color.s"

View File

@@ -1,10 +1 @@
;
; Ullrich von Bassewitz, 06.08.1998
;
; Low level stuff for screen output/console input
;
.exportzp CURS_X, CURS_Y
.include "plus4.inc"
.include "../plus4/conio.s"

View File

@@ -1,105 +1 @@
;
; Ullrich von Bassewitz, 06.08.1998
;
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import PLOT
.include "plus4.inc"
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
pla ; Restore C
; Plot a character - also used as internal function
_cputc: cmp #$0A ; CR?
bne L1
lda #0
sta CURS_X
beq plot ; Recalculate pointers
L1: cmp #$0D ; LF?
beq newline ; Recalculate pointers
; Printable char of some sort
cmp #' '
bcc cputdirect ; Other control char
tay
bmi L10
cmp #$60
bcc L2
and #$DF
bne cputdirect ; Branch always
L2: and #$3F
cputdirect:
jsr putchar ; Write the character to the screen
; Advance cursor position
advance:
iny
cpy #XSIZE
bne L3
jsr newline ; new line
ldy #0 ; + cr
L3: sty CURS_X
rts
newline:
clc
lda #XSIZE
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
inc SCREEN_PTR+1
clc
L4: lda #XSIZE
adc CRAM_PTR
sta CRAM_PTR
bcc L5
inc CRAM_PTR+1
L5: inc CURS_Y
rts
; Handle character if high bit set
L10: and #$7F
cmp #$7E ; PI?
bne L11
lda #$5E ; Load screen code for PI
bne cputdirect
L11: ora #$40
bne cputdirect
; Set cursor position, calculate RAM pointers
plot: ldy CURS_X
ldx CURS_Y
clc
jmp PLOT ; Set the new cursor
; Write one character to the screen without doing anything else, return X
; position in Y
putchar:
ora RVS ; Set revers bit
ldy CURS_X
sta (SCREEN_PTR),y ; Set char
lda CHARCOLOR
sta (CRAM_PTR),y ; Set color
rts
.include "../plus4/cputc.s"

View File

@@ -13,7 +13,6 @@
.importzp ST
.include "zeropage.inc"
.include "plus4.inc"
; ------------------------------------------------------------------------
; Startup code
@@ -90,7 +89,7 @@ L2: lda zpsave,x
; ------------------------------------------------------------------------
.segment "INITBSS"
.segment "INIT"
zpsave: .res zpspace

1
libsrc/c16/fast.s Normal file
View File

@@ -0,0 +1 @@
.include "../plus4/fast.s"

View File

@@ -1,27 +1 @@
;
; Ullrich von Bassewitz, 2002-12-03
;
; unsigned char __fastcall__ get_tv (void);
; /* Return the video mode the machine is using */
;
.include "plus4.inc"
.include "get_tv.inc"
;--------------------------------------------------------------------------
; _get_tv
.proc _get_tv
ldx #TV::PAL ; Assume PAL
bit TED_MULTI1 ; Test bit 6
bvc pal
dex ; NTSC
pal: txa
ldx #0
rts
.endproc
.include "../plus4/get_tv.s"

View File

@@ -9,7 +9,7 @@
; ------------------------------------------------------------------------
.segment "INIT"
.segment "ONCE"
initirq:
lda IRQVec

1
libsrc/c16/isfast.s Normal file
View File

@@ -0,0 +1 @@
.include "../plus4/isfast.s"

View File

@@ -1,9 +1,14 @@
;
; Ullrich von Bassewitz, 19.11.2002
;
; C16 kernal functions
; C16 Kernal functions
;
.include "cbm_kernal.inc"
.export CLRSCR
.export KBDREAD
.export CINT
.export IOINIT
.export RAMTAS
@@ -30,7 +35,9 @@
.export CKOUT
.export CLRCH
.export BASIN
.export CHRIN
.export BSOUT
.export CHROUT
.export LOAD
.export SAVE
.export SETTIM
@@ -42,48 +49,3 @@
.export SCREEN
.export PLOT
.export IOBASE
;-----------------------------------------------------------------------------
; All functions are available in the kernal jump table
CINT = $FF81
IOINIT = $FF84
RAMTAS = $FF87
RESTOR = $FF8A
VECTOR = $FF8D
SETMSG = $FF90
SECOND = $FF93
TKSA = $FF96
MEMTOP = $FF99
MEMBOT = $FF9C
SCNKEY = $FF9F
SETTMO = $FFA2
ACPTR = $FFA5
CIOUT = $FFA8
UNTLK = $FFAB
UNLSN = $FFAE
LISTEN = $FFB1
TALK = $FFB4
READST = $FFB7
SETLFS = $FFBA
SETNAM = $FFBD
OPEN = $FFC0
;CLOSE = $FFC3
CHKIN = $FFC6
CKOUT = $FFC9
CLRCH = $FFCC
BASIN = $FFCF
BSOUT = $FFD2
LOAD = $FFD5
SAVE = $FFD8
SETTIM = $FFDB
RDTIM = $FFDE
STOP = $FFE1
GETIN = $FFE4
CLALL = $FFE7
UDTIM = $FFEA
SCREEN = $FFED
PLOT = $FFF0
IOBASE = $FFF3

View File

@@ -32,10 +32,10 @@ MAXARGS = 10 ; Maximum number of arguments allowed
REM = $8f ; BASIC token-code
NAME_LEN = 16 ; Maximum length of command-name
; Get possible command-line arguments. Goes into the special INIT segment,
; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run
.segment "INIT"
.segment "ONCE"
initmainargs:
@@ -126,7 +126,7 @@ done: lda #<argv
stx __argv + 1
rts
.segment "INITBSS"
.segment "INIT"
term: .res 1
name: .res NAME_LEN + 1

View File

@@ -1,27 +1 @@
;
; Ullrich von Bassewitz, 07.08.1998
;
; unsigned char revers (unsigned char onoff);
;
.export _revers
.include "plus4.inc"
.proc _revers
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
ldx #$80 ; Load on value
ldy #$00 ; Assume old value is zero
L1: lda RVS ; Load old value
stx RVS ; Set new value
beq L2 ; Jump if old value zero
iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
.endproc
.include "../plus4/revers.s"

1
libsrc/c16/slow.s Normal file
View File

@@ -0,0 +1 @@
.include "../plus4/slow.s"

View File

@@ -1,5 +1 @@
;
; Oliver Schmidt, 2012-09-30
;
.exportzp ST := $90 ; IEC status byte
.include "../plus4/status.s"

View File

@@ -1,28 +0,0 @@
;
; Ullrich von Bassewitz, 12.11.2002
;
; time_t _systime (void);
; /* Similar to time(), but:
; ** - Is not ISO C
; ** - Does not take the additional pointer
; ** - Does not set errno when returning -1
; */
;
.export __systime
.importzp sreg
.code
.proc __systime
lda #$FF
tax
sta sreg
sta sreg+1
rts ; Return -1
.endproc

1
libsrc/c16/waitvsync.s Normal file
View File

@@ -0,0 +1 @@
.include "../plus4/waitvsync.s"