Merge branch 'master' into feature/plus4-tgi-driver

This commit is contained in:
Bob Andrews
2025-06-01 23:12:27 +02:00
committed by GitHub
2213 changed files with 191473 additions and 27985 deletions

View File

@@ -74,10 +74,9 @@ L5: inc CURS_Y
; Handle character if high bit set
L10: and #$7F
cmp #$7E ; PI?
cmp #$7F ; PI?
bne L11
lda #$5E ; Load screen code for PI
bne cputdirect
L11: ora #$40
bne cputdirect

View File

@@ -224,5 +224,3 @@ irqcount: .byte 0
.segment "INIT"
zpsave: .res zpspace

View File

@@ -58,8 +58,9 @@ JOY_COUNT = 2 ; Number of joysticks we support
;
INSTALL:
lda #<JOY_ERR_OK
ldx #>JOY_ERR_OK
lda #JOY_ERR_OK
.assert JOY_ERR_OK = 0, error
tax
; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------

View File

@@ -1,10 +1,11 @@
;
; Ullrich von Bassewitz, 22.11.2002
;
; BASIN replacement function
; BASIN/CHRIN replacement function
;
.export BASIN
.export CHRIN
.include "plus4.inc"
@@ -17,4 +18,4 @@
rts ; Return to caller
.endproc
CHRIN := BASIN

View File

@@ -1,10 +1,11 @@
;
; Ullrich von Bassewitz, 22.11.2002
;
; BSOUT replacement function
; BSOUT/CHROUT replacement function
;
.export BSOUT
.export CHROUT
.include "plus4.inc"
@@ -17,4 +18,4 @@
rts ; Return to caller
.endproc
CHROUT := BSOUT

17
libsrc/plus4/kgetin.s Normal file
View File

@@ -0,0 +1,17 @@
.export GETIN
.scope KERNAL
.include "cbm_kernal.inc"
.endscope
.include "plus4.inc"
.segment "LOWCODE" ; Stay out of ROM area.
.proc GETIN
sta ENABLE_ROM
jsr KERNAL::GETIN
sta ENABLE_RAM
rts
.endproc

View File

@@ -2,16 +2,16 @@
; 2002-11-05, Ullrich von Bassewitz
; 2015-09-11, Greg King
;
; void _randomize (void);
; void __randomize (void);
; /* Initialize the random number generator */
;
.export __randomize
.export ___randomize
.import _srand
.include "plus4.inc"
__randomize:
___randomize:
ldx TED_VLINELO ; Use TED rasterline as high byte
lda TIME+2 ; Use 60HZ clock as low byte
jmp _srand ; Initialize generator

View File

@@ -157,8 +157,9 @@ SER_CLOSE:
; Done, return an error code
lda #<SER_ERR_OK
tax ; A is zero
lda #SER_ERR_OK
.assert SER_ERR_OK = 0, error
tax
rts
;----------------------------------------------------------------------------
@@ -225,22 +226,23 @@ SER_OPEN:
; Done
lda #<SER_ERR_OK
tax ; A is zero
lda #SER_ERR_OK
.assert SER_ERR_OK = 0, error
tax
rts
; Invalid parameter
InvParam:
lda #<SER_ERR_INIT_FAILED
ldx #>SER_ERR_INIT_FAILED
lda #SER_ERR_INIT_FAILED
ldx #0 ; return value is char
rts
; Baud rate not available
InvBaud:
lda #<SER_ERR_BAUD_UNAVAIL
ldx #>SER_ERR_BAUD_UNAVAIL
lda #SER_ERR_BAUD_UNAVAIL
ldx #0 ; return value is char
rts
;----------------------------------------------------------------------------
@@ -250,19 +252,14 @@ InvBaud:
;
SER_GET:
ldx SendFreeCnt ; Send data if necessary
inx ; X == $FF?
beq @L1
lda #$00
jsr TryToSend
; Check for buffer empty
@L1: lda RecvFreeCnt ; (25)
lda RecvFreeCnt ; (25)
cmp #$ff
bne @L2
lda #<SER_ERR_NO_DATA
ldx #>SER_ERR_NO_DATA
lda #SER_ERR_NO_DATA
ldx #0 ; return value is char
rts
; Check for flow stopped & enough free: release flow control
@@ -298,27 +295,30 @@ SER_PUT:
; Try to send
ldx SendFreeCnt
inx ; X = $ff?
cpx #$ff ; Nothing to flush
beq @L2
pha
lda #$00
jsr TryToSend
pla
; Put byte into send buffer & send
; Reload SendFreeCnt after TryToSend
@L2: ldx SendFreeCnt
bne @L3
lda #<SER_ERR_OVERFLOW ; X is already zero
ldx SendFreeCnt
bne @L2
lda #SER_ERR_OVERFLOW ; X is already zero
rts
@L3: ldx SendTail
; Put byte into send buffer & send
@L2: ldx SendTail
sta SendBuf,x
inc SendTail
dec SendFreeCnt
lda #$ff
jsr TryToSend
lda #<SER_ERR_OK
lda #SER_ERR_OK
.assert SER_ERR_OK = 0, error
tax
rts
@@ -331,7 +331,8 @@ SER_STATUS:
lda ACIA_STATUS
ldx #0
sta (ptr1,x)
txa ; SER_ERR_OK
.assert SER_ERR_OK = 0, error
txa
rts
;----------------------------------------------------------------------------
@@ -341,8 +342,8 @@ SER_STATUS:
;
SER_IOCTL:
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
ldx #>SER_ERR_INV_IOCTL
lda #SER_ERR_INV_IOCTL ; We don't support ioclts for now
ldx #0 ; return value is char
rts ; Run into IRQ instead
;----------------------------------------------------------------------------
@@ -384,25 +385,25 @@ SER_IRQ:
sta tmp1 ; Remember tryHard flag
@L0: lda SendFreeCnt
cmp #$ff
beq @L3 ; Bail out
beq @L2 ; Bail out
; Check for flow stopped
@L1: lda Stopped
bne @L3 ; Bail out
bne @L2 ; Bail out
; Check that swiftlink is ready to send
@L2: lda ACIA_STATUS
lda ACIA_STATUS
and #$10
bne @L4
bit tmp1 ; Keep trying if must try hard
bmi @L0
@L3: rts
bne @L3
bit tmp1 ;keep trying if must try hard
bmi @L1
@L2: rts
; Send byte and try again
@L4: ldx SendHead
@L3: ldx SendHead
lda SendBuf,x
sta ACIA_DATA
inc SendHead

View File

@@ -0,0 +1,14 @@
;
; Address of the static standard serial driver
;
; Oliver Schmidt, 2022-12-22
;
; const void ser_static_stddrv[];
;
.export _ser_static_stddrv
.import _plus4_stdser_ser
.rodata
_ser_static_stddrv := _plus4_stdser_ser

13
libsrc/plus4/ser_stddrv.s Normal file
View File

@@ -0,0 +1,13 @@
;
; Name of the standard serial driver
;
; Oliver Schmidt, 2022-12-22
;
; const char ser_stddrv[];
;
.export _ser_stddrv
.rodata
_ser_stddrv: .asciiz "plus4-stdser.ser"