Merge branch 'master' into coniopeek
This commit is contained in:
@@ -27,6 +27,7 @@ TARGETS = apple2 \
|
||||
$(CBMS) \
|
||||
$(GEOS) \
|
||||
gamate \
|
||||
kim1 \
|
||||
lynx \
|
||||
nes \
|
||||
none \
|
||||
@@ -38,6 +39,10 @@ TARGETS = apple2 \
|
||||
sym1 \
|
||||
telestrat
|
||||
|
||||
TARGETTEST = none \
|
||||
sim6502 \
|
||||
sim65c02
|
||||
|
||||
DRVTYPES = emd \
|
||||
joy \
|
||||
mou \
|
||||
@@ -52,7 +57,7 @@ OUTPUTDIRS := lib
|
||||
$(subst ../,,$(wildcard ../target/*/drv/*)) \
|
||||
$(subst ../,,$(wildcard ../target/*/util))
|
||||
|
||||
.PHONY: all mostlyclean clean install zip lib $(TARGETS)
|
||||
.PHONY: all mostlyclean clean install zip lib libtest $(TARGETS)
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
@@ -80,6 +85,8 @@ datadir = $(PREFIX)/share/cc65
|
||||
|
||||
all lib: $(TARGETS)
|
||||
|
||||
libtest: $(TARGETTEST)
|
||||
|
||||
mostlyclean:
|
||||
$(call RMDIR,../libwrk)
|
||||
|
||||
@@ -115,9 +122,13 @@ endef # ZIP_recipe
|
||||
zip:
|
||||
$(foreach dir,$(OUTPUTDIRS),$(ZIP_recipe))
|
||||
|
||||
$(TARGETS):
|
||||
$(TARGETS): | ../lib
|
||||
@$(MAKE) --no-print-directory $@
|
||||
|
||||
# ../lib must be created globally before doing lib targets in parallel
|
||||
../lib:
|
||||
@$(call MKDIR,$@)
|
||||
|
||||
else # TARGET
|
||||
|
||||
CA65FLAGS =
|
||||
@@ -286,10 +297,12 @@ $(EXTRA_OBJPAT): $(EXTRA_SRCPAT) | ../libwrk/$(TARGET) ../lib
|
||||
@echo $(TARGET) - $(<F)
|
||||
@$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:../lib/%.o=../libwrk/$(TARGET)/%.d) -o $@ $<
|
||||
|
||||
$(EXTRA_OBJS): | ../lib
|
||||
|
||||
../lib/$(TARGET).lib: $(OBJS) | ../lib
|
||||
$(AR65) a $@ $?
|
||||
|
||||
../libwrk/$(TARGET) ../lib ../target/$(TARGET)/util:
|
||||
../libwrk/$(TARGET) ../target/$(TARGET)/util:
|
||||
@$(call MKDIR,$@)
|
||||
|
||||
$(TARGET): $(EXTRA_OBJS) ../lib/$(TARGET).lib
|
||||
|
||||
@@ -33,8 +33,8 @@ zerofd: lda #$00
|
||||
; Return success
|
||||
lda #$00
|
||||
|
||||
; Set __oserror
|
||||
oserr: jmp __mappederrno
|
||||
; Set ___oserror
|
||||
oserr: jmp ___mappederrno
|
||||
|
||||
; Set __errno
|
||||
errno: jmp __directerrno
|
||||
errno: jmp ___directerrno
|
||||
|
||||
@@ -45,9 +45,9 @@ _getdevicedir:
|
||||
|
||||
; Handle errors
|
||||
erange: lda #<ERANGE
|
||||
jsr __directerrno
|
||||
jsr ___directerrno
|
||||
bne :+ ; Branch always
|
||||
oserr: jsr __mappederrno
|
||||
oserr: jsr ___mappederrno
|
||||
: lda #$00 ; Return NULL
|
||||
tax
|
||||
rts
|
||||
@@ -73,7 +73,7 @@ oserr: jsr __mappederrno
|
||||
iny
|
||||
lda #$00
|
||||
sta (ptr1),y
|
||||
sta __oserror ; Clear _oserror
|
||||
sta ___oserror ; Clear __oserror
|
||||
|
||||
; Success, return buf
|
||||
lda ptr1
|
||||
|
||||
@@ -30,6 +30,6 @@ diocommon:
|
||||
|
||||
dioepilog:
|
||||
; Return success or error
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
ldx #$00
|
||||
rts
|
||||
|
||||
@@ -24,7 +24,7 @@ _dio_open:
|
||||
lda #$28 ; "No device connected"
|
||||
|
||||
; Return oserror
|
||||
oserr: sta __oserror
|
||||
oserr: sta ___oserror
|
||||
jmp return0
|
||||
|
||||
; Return success
|
||||
@@ -34,5 +34,5 @@ oserr: sta __oserror
|
||||
asl
|
||||
asl
|
||||
ldx #$00
|
||||
stx __oserror
|
||||
stx ___oserror
|
||||
rts
|
||||
|
||||
@@ -16,7 +16,7 @@ _dio_query_sectcount:
|
||||
; Set handle
|
||||
sta mliparam + MLI::ON_LINE::UNIT_NUM
|
||||
|
||||
; Get ProDOS 8 block size (clears __oserror)
|
||||
; Get ProDOS 8 block size (clears ___oserror)
|
||||
jsr _dio_query_sectsize
|
||||
|
||||
; Alloc buffer
|
||||
@@ -74,7 +74,7 @@ done: lda ptr4
|
||||
rts
|
||||
|
||||
nomem: lda #$FF ; Error code for sure not used by MLI
|
||||
oserr: sta __oserror
|
||||
oserr: sta ___oserror
|
||||
|
||||
; Save total blocks for failure
|
||||
lda #$00
|
||||
@@ -85,7 +85,7 @@ oserr: sta __oserror
|
||||
; Check for non-ProDOS disk
|
||||
check: cmp #$52 ; "Not a ProDOS volume"
|
||||
bne oserr
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
|
||||
; Save total blocks for a 16-sector disk
|
||||
lda #<280
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
_dio_query_sectsize:
|
||||
; Clear error
|
||||
stx __oserror ; X = 0
|
||||
stx ___oserror ; X = 0
|
||||
|
||||
; Return ProDOS 8 block size
|
||||
txa ; X = 0
|
||||
|
||||
@@ -73,7 +73,8 @@ INSTALL:
|
||||
and #$f0
|
||||
cmp #$80
|
||||
bne @L1
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
@L1: lda #EM_ERR_NO_DEVICE
|
||||
; rts
|
||||
|
||||
@@ -19,8 +19,8 @@ typerr: lda #$4A ; "Incompatible file format"
|
||||
; Cleanup name
|
||||
oserr: jsr popname ; Preserves A
|
||||
|
||||
; Set __oserror
|
||||
jmp __mappederrno
|
||||
; Set ___oserror
|
||||
jmp ___mappederrno
|
||||
|
||||
_exec:
|
||||
; Save cmdline
|
||||
|
||||
@@ -52,7 +52,7 @@ _clock_getres:
|
||||
enosys: lda #ENOSYS
|
||||
|
||||
; Set __errno
|
||||
jmp __directerrno
|
||||
jmp ___directerrno
|
||||
|
||||
.rodata
|
||||
|
||||
|
||||
@@ -81,13 +81,13 @@ erange: lda #ERANGE
|
||||
jsr incsp3 ; Preserves A
|
||||
|
||||
; Set __errno
|
||||
jmp __directerrno
|
||||
jmp ___directerrno
|
||||
|
||||
; Cleanup stack
|
||||
oserr: jsr incsp3 ; Preserves A
|
||||
|
||||
; Set __oserror
|
||||
jmp __mappederrno
|
||||
; Set ___oserror
|
||||
jmp ___mappederrno
|
||||
|
||||
.bss
|
||||
|
||||
|
||||
@@ -71,8 +71,9 @@ INSTALL:
|
||||
stx gettype+2
|
||||
gettype:jsr $0000
|
||||
sta ostype
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; Fall through
|
||||
|
||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||
|
||||
@@ -107,13 +107,13 @@ seek_common:
|
||||
einval: lda #EINVAL
|
||||
|
||||
; Set __errno
|
||||
errno: jsr __directerrno ; leaves -1 in AX
|
||||
errno: jsr ___directerrno ; leaves -1 in AX
|
||||
stx sreg ; extend return value to 32 bits
|
||||
stx sreg+1
|
||||
rts
|
||||
|
||||
; Set __oserror
|
||||
oserr: jsr __mappederrno ; leaves -1 in AX
|
||||
; Set ___oserror
|
||||
oserr: jsr ___mappederrno ; leaves -1 in AX
|
||||
stx sreg ; extend return value to 32 bits
|
||||
stx sreg+1
|
||||
rts
|
||||
|
||||
@@ -133,8 +133,8 @@ next: inc ptr1+1
|
||||
bcc :+
|
||||
|
||||
; Mouse firmware not found
|
||||
lda #<MOUSE_ERR_NO_DEVICE
|
||||
ldx #>MOUSE_ERR_NO_DEVICE
|
||||
lda #MOUSE_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Check Pascal 1.1 Firmware Protocol ID bytes
|
||||
|
||||
@@ -64,7 +64,7 @@ _open:
|
||||
errno: jsr incsp4 ; Preserves A
|
||||
|
||||
; Set __errno
|
||||
jmp __directerrno
|
||||
jmp ___directerrno
|
||||
|
||||
; Save fdtab slot
|
||||
found: tya
|
||||
@@ -147,8 +147,8 @@ oserr1: ldy tmp2 ; Restore fdtab slot
|
||||
jsr freebuffer
|
||||
pla ; Restore oserror code
|
||||
|
||||
; Set __oserror
|
||||
jmp __mappederrno
|
||||
; Set ___oserror
|
||||
jmp ___mappederrno
|
||||
|
||||
open: ldy tmp2 ; Restore fdtab slot
|
||||
|
||||
@@ -209,7 +209,7 @@ done: lda tmp1 ; Restore fd
|
||||
|
||||
; Return success
|
||||
ldx #$00
|
||||
stx __oserror
|
||||
stx ___oserror
|
||||
rts
|
||||
|
||||
freebuffer:
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 17.05.2000
|
||||
;
|
||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
||||
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||
;
|
||||
|
||||
.export __osmaperrno
|
||||
.export ___osmaperrno
|
||||
|
||||
.include "errno.inc"
|
||||
|
||||
__osmaperrno:
|
||||
___osmaperrno:
|
||||
ldx #ErrTabSize
|
||||
: cmp ErrTab-2,x ; Search for the error code
|
||||
beq :+ ; Jump if found
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 07.11.2002
|
||||
;
|
||||
; void _randomize (void);
|
||||
; void __randomize (void);
|
||||
; /* Initialize the random number generator */
|
||||
;
|
||||
|
||||
.export __randomize
|
||||
.export ___randomize
|
||||
.import _srand
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
__randomize:
|
||||
___randomize:
|
||||
ldx RNDH ; Use random value supplied by ROM
|
||||
lda RNDL
|
||||
jmp _srand ; Initialize generator
|
||||
|
||||
@@ -52,7 +52,7 @@ _read:
|
||||
|
||||
; Device succeeds always
|
||||
device: lda #$00
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
|
||||
; Set counter to zero
|
||||
sta ptr3
|
||||
@@ -107,4 +107,4 @@ check: lda ptr3
|
||||
einval: lda #EINVAL
|
||||
|
||||
; Set __errno
|
||||
errno: jmp __directerrno
|
||||
errno: jmp ___directerrno
|
||||
|
||||
@@ -49,10 +49,10 @@ rwcommon:
|
||||
|
||||
rwepilog:
|
||||
; Return success
|
||||
sta __oserror ; A = 0
|
||||
sta ___oserror ; A = 0
|
||||
lda mliparam + MLI::RW::TRANS_COUNT
|
||||
ldx mliparam + MLI::RW::TRANS_COUNT+1
|
||||
rts
|
||||
|
||||
; Set __oserror
|
||||
oserr: jmp __mappederrno
|
||||
; Set ___oserror
|
||||
oserr: jmp ___mappederrno
|
||||
|
||||
@@ -57,7 +57,9 @@
|
||||
;----------------------------------------------------------------------------
|
||||
; I/O definitions
|
||||
|
||||
ACIA = $C088
|
||||
Offset = $8F ; Move 6502 false read out of I/O to page $BF
|
||||
|
||||
ACIA = $C088-Offset
|
||||
ACIA_DATA = ACIA+0 ; Data register
|
||||
ACIA_STATUS = ACIA+1 ; Status register
|
||||
ACIA_CMD = ACIA+2 ; Command register
|
||||
@@ -166,8 +168,9 @@ SER_CLOSE:
|
||||
sta ACIA_CMD,x
|
||||
|
||||
; Done, return an error code
|
||||
: lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
: lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
stx Index ; Mark port as closed
|
||||
rts
|
||||
|
||||
@@ -197,6 +200,7 @@ SER_OPEN:
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
adc #Offset ; Assume carry to be clear
|
||||
tax
|
||||
|
||||
; Check if the handshake setting is valid
|
||||
@@ -253,23 +257,24 @@ SER_OPEN:
|
||||
|
||||
; Done
|
||||
stx Index ; Mark port as open
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; Device (hardware) not found
|
||||
NoDevice:lda #<SER_ERR_NO_DEVICE
|
||||
ldx #>SER_ERR_NO_DEVICE
|
||||
NoDevice:lda #SER_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Invalid parameter
|
||||
InvParam:lda #<SER_ERR_INIT_FAILED
|
||||
ldx #>SER_ERR_INIT_FAILED
|
||||
InvParam: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
|
||||
InvBaud:lda #SER_ERR_BAUD_UNAVAIL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -289,8 +294,8 @@ SER_GET:
|
||||
: lda RecvFreeCnt ; (25)
|
||||
cmp #$FF
|
||||
bne :+
|
||||
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
|
||||
@@ -333,8 +338,8 @@ SER_PUT:
|
||||
; Put byte into send buffer & send
|
||||
: ldy SendFreeCnt
|
||||
bne :+
|
||||
lda #<SER_ERR_OVERFLOW
|
||||
ldx #>SER_ERR_OVERFLOW
|
||||
lda #SER_ERR_OVERFLOW
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
: ldy SendTail
|
||||
@@ -343,7 +348,8 @@ SER_PUT:
|
||||
dec SendFreeCnt
|
||||
lda #$FF ; TryHard = true
|
||||
jsr TryToSend
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
@@ -356,7 +362,8 @@ SER_STATUS:
|
||||
lda ACIA_STATUS,x
|
||||
ldx #$00
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -376,11 +383,12 @@ SER_IOCTL:
|
||||
bcs :+
|
||||
|
||||
stx Slot
|
||||
tax ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
: lda #<SER_ERR_INV_IOCTL
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
: lda #SER_ERR_INV_IOCTL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
||||
22
libsrc/apple2/ser_stat_stddrv.s
Normal file
22
libsrc/apple2/ser_stat_stddrv.s
Normal file
@@ -0,0 +1,22 @@
|
||||
;
|
||||
; Address of the static standard serial driver
|
||||
;
|
||||
; Oliver Schmidt, 2022-12-22
|
||||
;
|
||||
; const void ser_static_stddrv[];
|
||||
;
|
||||
|
||||
.export _ser_static_stddrv
|
||||
.ifdef __APPLE2ENH__
|
||||
.import _a2e_ssc_ser
|
||||
.else
|
||||
.import _a2_ssc_ser
|
||||
.endif
|
||||
|
||||
.rodata
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
_ser_static_stddrv := _a2e_ssc_ser
|
||||
.else
|
||||
_ser_static_stddrv := _a2_ssc_ser
|
||||
.endif
|
||||
18
libsrc/apple2/ser_stddrv.s
Normal file
18
libsrc/apple2/ser_stddrv.s
Normal file
@@ -0,0 +1,18 @@
|
||||
;
|
||||
; Name of the standard serial driver
|
||||
;
|
||||
; Oliver Schmidt, 2022-12-22
|
||||
;
|
||||
; const char ser_stddrv[];
|
||||
;
|
||||
|
||||
.export _ser_stddrv
|
||||
|
||||
.rodata
|
||||
|
||||
_ser_stddrv:
|
||||
.ifdef __APPLE2ENH__
|
||||
.asciiz "A2E.SSC.SER"
|
||||
.else
|
||||
.asciiz "A2.SSC.SER"
|
||||
.endif
|
||||
@@ -68,4 +68,4 @@ enosys: lda #ENOSYS
|
||||
erange: lda #ERANGE
|
||||
|
||||
; Set __errno
|
||||
errno: jmp __directerrno
|
||||
errno: jmp ___directerrno
|
||||
|
||||
@@ -107,8 +107,8 @@ done: lda #$00
|
||||
einval: lda #EINVAL
|
||||
|
||||
; Set __errno
|
||||
errno: jmp __directerrno
|
||||
errno: jmp ___directerrno
|
||||
|
||||
; Set __oserror
|
||||
oserr: jmp __mappederrno
|
||||
; Set ___oserror
|
||||
oserr: jmp ___mappederrno
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
; originally by Ullrich von Bassewitz and Sidney Cadot
|
||||
;
|
||||
; clock_t clock (void);
|
||||
; clock_t _clocks_per_sec (void);
|
||||
; clock_t __clocks_per_sec (void);
|
||||
;
|
||||
|
||||
.export _clock, __clocks_per_sec
|
||||
.export _clock, ___clocks_per_sec
|
||||
.importzp sreg
|
||||
|
||||
.include "atari.inc"
|
||||
@@ -28,7 +28,7 @@
|
||||
.endproc
|
||||
|
||||
|
||||
.proc __clocks_per_sec
|
||||
.proc ___clocks_per_sec
|
||||
|
||||
ldx #$00 ; Clear byte 1 of return value
|
||||
stx sreg ; Clear byte 2 of return value
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.include "atari.inc"
|
||||
.export _close
|
||||
.import __do_oserror,popax,__oserror
|
||||
.import __do_oserror,popax,___oserror
|
||||
.import fdtoiocb_down,__inviocb
|
||||
|
||||
.proc _close
|
||||
@@ -18,7 +18,7 @@
|
||||
jsr CIOV
|
||||
bmi closerr
|
||||
ok: ldx #0
|
||||
stx __oserror ; clear system specific error code
|
||||
stx ___oserror ; clear system specific error code
|
||||
txa
|
||||
rts
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
;
|
||||
|
||||
.export _dio_phys_to_log
|
||||
.import popax,__oserror
|
||||
.import popax,___oserror
|
||||
.importzp ptr1,ptr2,ptr3
|
||||
.include "atari.inc"
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
ldx #0
|
||||
txa
|
||||
ret:
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
rts ; return success
|
||||
|
||||
; invalid handle
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
.export _dio_log_to_phys
|
||||
.include "atari.inc"
|
||||
.importzp ptr1,ptr2,ptr3
|
||||
.import popax,popptr1,__oserror
|
||||
.import popax,popptr1,___oserror
|
||||
|
||||
.proc _dio_log_to_phys
|
||||
|
||||
@@ -56,7 +56,7 @@ _l1: lda (ptr1,x)
|
||||
|
||||
txa
|
||||
ret:
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
rts ; return success
|
||||
|
||||
; invalid handle
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
.export _dio_open, _dio_close
|
||||
.export sectsizetab
|
||||
.import __oserror, __sio_call, _dio_read
|
||||
.import ___oserror, __sio_call, _dio_read
|
||||
.import pushax, addysp, subysp
|
||||
.importzp ptr2, sp
|
||||
.include "atari.inc"
|
||||
@@ -31,7 +31,7 @@ sectsizetab:
|
||||
|
||||
_inv_drive:
|
||||
lda #NONDEV ; non-existent device
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
lda #0
|
||||
tax
|
||||
rts ; return NULL
|
||||
@@ -49,7 +49,7 @@ _dio_open:
|
||||
sta sectsizetab+sst_flag,x ; set flag that drive is "open"
|
||||
lda #0
|
||||
sta sectsizetab+sst_sectsize+1,x
|
||||
sta __oserror ; success
|
||||
sta ___oserror ; success
|
||||
tya
|
||||
sta sectsizetab+sst_driveno,x
|
||||
stx ptr2
|
||||
@@ -156,7 +156,7 @@ s128: lda #128
|
||||
lda #0
|
||||
ldy #sst_flag
|
||||
sta (ptr2),y
|
||||
sta __oserror ; success
|
||||
sta ___oserror ; success
|
||||
tax
|
||||
rts ; return no error
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
.include "atari.inc"
|
||||
.export _dio_query_sectsize
|
||||
.importzp ptr1,tmp1
|
||||
.import popax, __oserror
|
||||
.import popax, ___oserror
|
||||
|
||||
.proc _dio_query_sectsize
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
stx ptr1+1
|
||||
|
||||
lda #0
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
|
||||
ldy #sst_sectsize+1
|
||||
lda (ptr1),y
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
;
|
||||
; __do_oserror updates __oserror and errno. Do a JMP here right after
|
||||
; __do_oserror updates ___oserror and errno. Do a JMP here right after
|
||||
; calling CIOV. It will return with AX set to -1 ($FFFF). It expects the CIO
|
||||
; status in Y.
|
||||
;
|
||||
@@ -9,4 +9,4 @@
|
||||
|
||||
__do_oserror:
|
||||
tya
|
||||
jmp __mappederrno
|
||||
jmp ___mappederrno
|
||||
|
||||
@@ -34,7 +34,7 @@ notsupp:lda #ENOSYS ; "unsupported system call"
|
||||
.byte $2C ; bit opcode, eats the next 2 bytes
|
||||
noiocb: lda #EMFILE ; "too many open files"
|
||||
jsr incsp2 ; clean up stack
|
||||
seterr: jmp __directerrno
|
||||
seterr: jmp ___directerrno
|
||||
|
||||
|
||||
; entry point
|
||||
@@ -148,7 +148,7 @@ copycd: lda #ATEOL
|
||||
pha ; remember error code
|
||||
jsr close ; close the IOCB (required even if open failed)
|
||||
pla ; put error code back into A
|
||||
setmerr:jmp __mappederrno ; update errno from OS specific error code in A
|
||||
setmerr:jmp ___mappederrno ; update errno from OS specific error code in A
|
||||
|
||||
openok: lda #>buf
|
||||
sta ICBAH,x ; set buffer address
|
||||
|
||||
@@ -41,7 +41,7 @@ _clock_getres:
|
||||
enosys: lda #ENOSYS
|
||||
|
||||
; Set __errno
|
||||
jmp __directerrno
|
||||
jmp ___directerrno
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; timespec struct with tv_sec set to 1 second
|
||||
|
||||
@@ -105,7 +105,7 @@ errexit:jsr incsp3 ; Preserves A
|
||||
|
||||
; set __errno
|
||||
|
||||
jmp __directerrno
|
||||
jmp ___directerrno
|
||||
|
||||
; -------
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
.export __graphics
|
||||
|
||||
.import findfreeiocb
|
||||
.import __oserror
|
||||
.import ___oserror
|
||||
.import fddecusage
|
||||
.import clriocb
|
||||
.import fdtoiocb
|
||||
@@ -45,7 +45,7 @@ parmok: jsr findfreeiocb
|
||||
beq iocbok ; we found one
|
||||
|
||||
lda #<EMFILE ; "too many open files"
|
||||
seterr: jsr __mappederrno ; @@@ probably not correct to set errno here @@@
|
||||
seterr: jsr ___mappederrno ; @@@ probably not correct to set errno here @@@
|
||||
rts ; return -1
|
||||
|
||||
;invmode:ldx #>EINVAL
|
||||
@@ -94,7 +94,7 @@ doopen: txa
|
||||
|
||||
lda tmp2 ; get fd
|
||||
ldx #0
|
||||
stx __oserror
|
||||
stx ___oserror
|
||||
rts
|
||||
|
||||
cioerr: sty tmp3 ; remember error code
|
||||
@@ -103,6 +103,6 @@ cioerr: sty tmp3 ; remember error code
|
||||
jsr CIOV ; close IOCB again since open failed
|
||||
jsr fddecusage ; and decrement usage counter of fd
|
||||
lda tmp3 ; put error code into A
|
||||
jmp __mappederrno
|
||||
jmp ___mappederrno
|
||||
|
||||
.endproc ; __graphics
|
||||
|
||||
@@ -7,4 +7,4 @@
|
||||
|
||||
__inviocb:
|
||||
lda #<EINVAL
|
||||
jmp __directerrno
|
||||
jmp ___directerrno
|
||||
|
||||
@@ -69,7 +69,8 @@ INSTALL:
|
||||
lda #$34
|
||||
sta PACTL
|
||||
lda #JOY_ERR_OK
|
||||
ldx #0
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -62,7 +62,8 @@ JOY_COUNT = 4 ; Number of joysticks we support
|
||||
|
||||
INSTALL:
|
||||
lda #JOY_ERR_OK
|
||||
ldx #0
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
.export _lseek
|
||||
.import incsp6,__oserror
|
||||
.import incsp6,___oserror
|
||||
.import __inviocb,ldax0sp,ldaxysp,fdtoiocb
|
||||
.import __dos_type
|
||||
.import fd_table
|
||||
@@ -21,7 +21,7 @@
|
||||
; seeking not supported, return -1 and ENOSYS errno value
|
||||
no_supp:jsr incsp6
|
||||
lda #<ENOSYS
|
||||
jsr __directerrno ; returns with $FFFF in AX
|
||||
jsr ___directerrno ; returns with $FFFF in AX
|
||||
sta sreg
|
||||
sta sreg+1
|
||||
rts
|
||||
@@ -94,7 +94,7 @@ xxerr: tya
|
||||
pha
|
||||
jsr incsp6
|
||||
pla
|
||||
jsr __mappederrno ; returns with $FFFF in AX
|
||||
jsr ___mappederrno ; returns with $FFFF in AX
|
||||
sta sreg
|
||||
sta sreg+1
|
||||
rts
|
||||
|
||||
@@ -137,9 +137,10 @@ INSTALL:
|
||||
ldx YPos+1
|
||||
jsr CMOVEY
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
||||
@@ -268,9 +268,10 @@ INSTALL:
|
||||
and #$0f
|
||||
sta old_porta_vbi
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
||||
@@ -132,9 +132,10 @@ INSTALL:
|
||||
ldx YPos+1
|
||||
jsr CMOVEY
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
.import findfreeiocb
|
||||
.import incsp4
|
||||
.import ldaxysp,addysp
|
||||
.import __oserror
|
||||
.import ___oserror
|
||||
.ifdef UCASE_FILENAME
|
||||
.import ucase_fn
|
||||
.endif
|
||||
@@ -37,7 +37,7 @@ parmok: jsr findfreeiocb
|
||||
beq iocbok ; we found one
|
||||
|
||||
lda #<EMFILE ; "too many open files"
|
||||
seterr: jsr __directerrno
|
||||
seterr: jsr ___directerrno
|
||||
jsr incsp4 ; clean up stack
|
||||
lda #$FF
|
||||
tax
|
||||
@@ -150,11 +150,11 @@ finish: php
|
||||
jsr CIOV ; close IOCB again since open failed
|
||||
jsr fddecusage ; and decrement usage counter of fd
|
||||
lda tmp3 ; put error code into A
|
||||
jmp __mappederrno
|
||||
jmp ___mappederrno
|
||||
|
||||
ok: lda tmp2 ; get fd
|
||||
ldx #0
|
||||
stx __oserror
|
||||
stx ___oserror
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
; Christian Groessler, May-2000
|
||||
;
|
||||
; os specific error code mapping
|
||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
||||
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||
;
|
||||
|
||||
.include "errno.inc"
|
||||
.export __osmaperrno
|
||||
.export ___osmaperrno
|
||||
|
||||
.proc __osmaperrno
|
||||
.proc ___osmaperrno
|
||||
|
||||
cmp #$80 ; error or success
|
||||
bcs errcode ; error, jump
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
.include "atari.inc"
|
||||
.export _opendir, _readdir, _closedir
|
||||
.import findfreeiocb, clriocb
|
||||
.import __oserror, return0, __do_oserror
|
||||
.import ___oserror, return0, __do_oserror
|
||||
.importzp ptr1, tmp1
|
||||
.ifdef DEFAULT_DEVICE
|
||||
.import __defdev
|
||||
@@ -56,13 +56,13 @@
|
||||
jsr CIOV
|
||||
bmi cioerr
|
||||
lda #0
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
tax
|
||||
lda diriocb
|
||||
rts
|
||||
.endproc
|
||||
|
||||
cioerr: sty __oserror
|
||||
cioerr: sty ___oserror
|
||||
lda #CLOSE
|
||||
sta ICCOM,x
|
||||
jsr CIOV ; close IOCB again since open failed
|
||||
@@ -147,7 +147,7 @@ copychar: lda (ptr1),y ; src=y dest=tmp1
|
||||
jsr CIOV
|
||||
bmi @cioerr
|
||||
ldx #0
|
||||
stx __oserror ; clear system specific error code
|
||||
stx ___oserror ; clear system specific error code
|
||||
txa
|
||||
rts
|
||||
@cioerr: jmp __do_oserror
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
;
|
||||
; Christian Groessler, 06.11.2002
|
||||
;
|
||||
; void _randomize (void);
|
||||
; void __randomize (void);
|
||||
; /* Initialize the random number generator */
|
||||
;
|
||||
|
||||
.export __randomize
|
||||
.export ___randomize
|
||||
.import _srand
|
||||
|
||||
.include "atari.inc"
|
||||
|
||||
__randomize:
|
||||
___randomize:
|
||||
ldx VCOUNT ; Use vertical line counter as high byte
|
||||
lda RTCLOK+2 ; Use clock as low byte
|
||||
jmp _srand ; Initialize generator
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
;
|
||||
|
||||
.include "atari.inc"
|
||||
.import __rwsetup,__do_oserror,__inviocb,__oserror
|
||||
.import __rwsetup,__do_oserror,__inviocb,___oserror
|
||||
.export _read
|
||||
|
||||
_read: jsr __rwsetup ; do common setup for read and write
|
||||
@@ -33,7 +33,7 @@ done: lda ICBLL,x ; buf len lo
|
||||
lda ICBLH,x ; get buf len hi
|
||||
tax ; to X
|
||||
okdone: lda #0
|
||||
sta __oserror ; clear system dependend error code
|
||||
sta ___oserror ; clear system dependend error code
|
||||
pla ; get buf len lo
|
||||
rts
|
||||
|
||||
|
||||
@@ -135,8 +135,8 @@ my_CIOV:
|
||||
.code
|
||||
|
||||
invbaud:
|
||||
lda #<SER_ERR_BAUD_UNAVAIL
|
||||
ldx #>SER_ERR_BAUD_UNAVAIL
|
||||
lda #SER_ERR_BAUD_UNAVAIL
|
||||
ldx #0 ; return value is char
|
||||
openerr:
|
||||
rts
|
||||
|
||||
@@ -229,8 +229,9 @@ SER_OPEN:
|
||||
jsr my_CIOV
|
||||
bmi cioerr
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
inverr: jmp my___inviocb
|
||||
@@ -240,8 +241,8 @@ cioerr:
|
||||
jsr my_fddecusage ; decrement usage counter of fd as open failed
|
||||
|
||||
init_err:
|
||||
ldx #0
|
||||
lda #SER_ERR_INIT_FAILED
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;---- open the device
|
||||
@@ -313,8 +314,9 @@ SER_CLOSE:
|
||||
stx rshand+1
|
||||
inx
|
||||
stx cm_run
|
||||
@done: lda #<SER_ERR_OK
|
||||
ldx #>SER_ERR_OK
|
||||
@done: lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -365,16 +367,16 @@ SER_GET:
|
||||
rts
|
||||
|
||||
@nix_da:lda #SER_ERR_NO_DATA
|
||||
ldx #0
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
ser_error:
|
||||
lda #SER_ERR_OVERFLOW ; there is no large selection of serial error codes... :-/
|
||||
ldx #0
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
ni_err: lda #SER_ERR_NOT_OPEN
|
||||
ldx #0
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -427,8 +429,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
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -456,8 +458,8 @@ search: lda HATABS,y ; get device name
|
||||
|
||||
; R: device not found, return error
|
||||
|
||||
lda #<SER_ERR_NO_DEVICE
|
||||
ldx #0
|
||||
lda #SER_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; R: device found, initialize jump table into main program
|
||||
@@ -554,8 +556,9 @@ found: lda ptr3
|
||||
pla
|
||||
sta ptr3
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
||||
|
||||
22
libsrc/atari/ser_stat_stddrv.s
Normal file
22
libsrc/atari/ser_stat_stddrv.s
Normal file
@@ -0,0 +1,22 @@
|
||||
;
|
||||
; Address of the static standard serial driver
|
||||
;
|
||||
; Oliver Schmidt, 2022-12-22
|
||||
;
|
||||
; const void ser_static_stddrv[];
|
||||
;
|
||||
|
||||
.export _ser_static_stddrv
|
||||
.ifdef __ATARIXL__
|
||||
.import _atrxrdev_ser
|
||||
.else
|
||||
.import _atrrdev_ser
|
||||
.endif
|
||||
|
||||
.rodata
|
||||
|
||||
.ifdef __ATARIXL__
|
||||
_ser_static_stddrv := _atrxrdev_ser
|
||||
.else
|
||||
_ser_static_stddrv := _atrrdev_ser
|
||||
.endif
|
||||
18
libsrc/atari/ser_stddrv.s
Normal file
18
libsrc/atari/ser_stddrv.s
Normal file
@@ -0,0 +1,18 @@
|
||||
;
|
||||
; Name of the standard serial driver
|
||||
;
|
||||
; Oliver Schmidt, 2022-12-22
|
||||
;
|
||||
; const char ser_stddrv[];
|
||||
;
|
||||
|
||||
.export _ser_stddrv
|
||||
|
||||
.rodata
|
||||
|
||||
_ser_stddrv:
|
||||
.ifdef __ATARIXL__
|
||||
.asciiz "atrxrdev.ser"
|
||||
.else
|
||||
.asciiz "atrrdev.ser"
|
||||
.endif
|
||||
@@ -96,4 +96,4 @@ done: jmp return0
|
||||
; load errno code
|
||||
|
||||
enosys: lda #ENOSYS
|
||||
drcter: jmp __directerrno
|
||||
drcter: jmp ___directerrno
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
.export __sio_call
|
||||
.include "atari.inc"
|
||||
.import popa,popax,popptr1
|
||||
.import sectsizetab,__oserror
|
||||
.import sectsizetab,___oserror
|
||||
.importzp ptr1
|
||||
|
||||
.proc __sio_call
|
||||
@@ -76,7 +76,7 @@ _cont: lda #DISKID ; SIO bus ID of diskette drive
|
||||
bmi _req_err ; error occurred
|
||||
txa ; no error occurred
|
||||
_req_err:
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
rts
|
||||
|
||||
_inv_hand:
|
||||
|
||||
39
libsrc/atari/sound.s
Normal file
39
libsrc/atari/sound.s
Normal file
@@ -0,0 +1,39 @@
|
||||
;
|
||||
; Mariano Domínguez
|
||||
; 2022-12-4
|
||||
;
|
||||
; this file provides an equivalent to the BASIC SOUND function
|
||||
;
|
||||
; void __fastcall__ _sound (unsigned char voice, unsigned char frequency, unsigned char distortion, unsigned char volume);
|
||||
;
|
||||
.include "atari.inc"
|
||||
.export __sound
|
||||
.import popa
|
||||
.importzp tmp1,tmp2
|
||||
|
||||
; play sound, arguments: voice, pitch, distortion, volume
|
||||
.proc __sound
|
||||
sta tmp2 ;save volume
|
||||
jsr popa ;get distortion
|
||||
sta tmp1 ;save distortion
|
||||
jsr popa ;get pitch
|
||||
pha ;save in stack
|
||||
jsr popa ;get voice
|
||||
asl a ;adjust voice *2 for offset in x
|
||||
tax
|
||||
pla ;get pitch from stack
|
||||
sta AUDF1,x ;store pitch
|
||||
lda #0
|
||||
sta AUDCTL
|
||||
lda #3
|
||||
sta SKCTL ;init sound
|
||||
lda tmp1 ;get distortion
|
||||
asl a ;ignore the high nibble
|
||||
asl a
|
||||
asl a
|
||||
asl a
|
||||
clc ;setup for adding volume
|
||||
adc tmp2 ;add volume
|
||||
sta AUDC1,x ;volume + distortion in control channel
|
||||
rts
|
||||
.endproc
|
||||
@@ -2,7 +2,7 @@
|
||||
; int __fastcall__ write (int fd, const void* buf, unsigned count);
|
||||
;
|
||||
.include "atari.inc"
|
||||
.import __rwsetup,__do_oserror,__inviocb,__oserror
|
||||
.import __rwsetup,__do_oserror,__inviocb,___oserror
|
||||
.export _write
|
||||
_write:
|
||||
jsr __rwsetup ; do common setup
|
||||
@@ -21,7 +21,7 @@ write9:
|
||||
lda ICBLH,x ; buf len high
|
||||
tax
|
||||
lda #0
|
||||
sta __oserror ; clear system dependend error code
|
||||
sta ___oserror ; clear system dependend error code
|
||||
pla
|
||||
rts
|
||||
|
||||
|
||||
@@ -47,7 +47,8 @@ INSTALL:
|
||||
lda #$04 ; enable POT input from the joystick ports, see section "GTIA" in
|
||||
sta CONSOL ; http://www.atarimuseum.com/videogames/consoles/5200/conv_to_5200.html
|
||||
lda #JOY_ERR_OK
|
||||
ldx #0
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
;
|
||||
; Christian Groessler, 01-Mar-2014
|
||||
;
|
||||
; void _randomize (void);
|
||||
; void __randomize (void);
|
||||
; /* Initialize the random number generator */
|
||||
;
|
||||
|
||||
.export __randomize
|
||||
.export ___randomize
|
||||
.import _srand
|
||||
|
||||
.include "atari5200.inc"
|
||||
|
||||
__randomize:
|
||||
___randomize:
|
||||
ldx VCOUNT ; Use vertical line counter as high byte
|
||||
lda RTCLOK+1 ; Use clock as low byte
|
||||
jmp _srand ; Initialize generator
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
;
|
||||
; 2022-03-15, Karri Kaksonen
|
||||
;
|
||||
; clock_t _clocks_per_sec (void);
|
||||
; clock_t __clocks_per_sec (void);
|
||||
;
|
||||
|
||||
.export __clocks_per_sec
|
||||
.export ___clocks_per_sec
|
||||
|
||||
.import sreg: zp
|
||||
.import _paldetected
|
||||
@@ -17,7 +17,7 @@
|
||||
;-----------------------------------------------------------------------------
|
||||
; Return the number of clock ticks in one second.
|
||||
;
|
||||
.proc __clocks_per_sec
|
||||
.proc ___clocks_per_sec
|
||||
|
||||
lda #0
|
||||
tax
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
.export _clrscr
|
||||
|
||||
.import _screen
|
||||
.import pushax, __bzero
|
||||
.import pushax, ___bzero
|
||||
.include "extzp.inc"
|
||||
|
||||
.code
|
||||
@@ -16,7 +16,7 @@
|
||||
jsr pushax
|
||||
ldx #>(charsperline * screenrows)
|
||||
lda #<(charsperline * screenrows)
|
||||
jmp __bzero
|
||||
jmp ___bzero
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
@@ -62,8 +62,9 @@ INSTALL:
|
||||
sty SWCHB ; enable 2-button 7800 controller 2: pull pin 6 (INPT4) high
|
||||
|
||||
reset:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
.export _mono_clrscr
|
||||
|
||||
.import _mono_screen
|
||||
.import pushax, __bzero
|
||||
.import pushax, ___bzero
|
||||
.include "extzp.inc"
|
||||
|
||||
.code
|
||||
@@ -16,7 +16,7 @@
|
||||
jsr pushax
|
||||
ldx #>(mono_charsperline * screenrows)
|
||||
lda #<(mono_charsperline * screenrows)
|
||||
jmp __bzero
|
||||
jmp ___bzero
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
@@ -55,11 +55,12 @@ INSTALL:
|
||||
lda VIA::PRA
|
||||
and #%00100000
|
||||
bne ijkPresent
|
||||
lda #<JOY_ERR_NO_DEVICE
|
||||
lda #JOY_ERR_NO_DEVICE
|
||||
.byte $2C ; Skip next opcode
|
||||
ijkPresent:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -58,7 +58,8 @@ temp2: .byte $00
|
||||
|
||||
INSTALL:
|
||||
lda #JOY_ERR_OK
|
||||
ldx #0
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
;
|
||||
; Stefan Haubenthal, 2011-04-18
|
||||
;
|
||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
||||
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||
; /* Map a system specific error into a system independent code */
|
||||
;
|
||||
|
||||
.include "errno.inc"
|
||||
.export __osmaperrno
|
||||
.export ___osmaperrno
|
||||
|
||||
.proc __osmaperrno
|
||||
.proc ___osmaperrno
|
||||
|
||||
lda #<EUNKNOWN
|
||||
ldx #>EUNKNOWN
|
||||
|
||||
@@ -141,8 +141,9 @@ SER_CLOSE:
|
||||
sta ACIA::CMD,x
|
||||
|
||||
; Done, return an error code
|
||||
: lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
: lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
stx Index ; Mark port as closed
|
||||
rts
|
||||
|
||||
@@ -205,8 +206,9 @@ SER_OPEN:
|
||||
|
||||
; Done
|
||||
stx Index ; Mark port as open
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; Invalid parameter
|
||||
@@ -235,8 +237,8 @@ SER_GET:
|
||||
: lda RecvFreeCnt ; (25)
|
||||
cmp #$FF
|
||||
bne :+
|
||||
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
|
||||
@@ -277,8 +279,8 @@ SER_PUT:
|
||||
; Put byte into send buffer & send
|
||||
: ldy SendFreeCnt
|
||||
bne :+
|
||||
lda #<SER_ERR_OVERFLOW
|
||||
ldx #>SER_ERR_OVERFLOW
|
||||
lda #SER_ERR_OVERFLOW
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
: ldy SendTail
|
||||
@@ -287,7 +289,8 @@ SER_PUT:
|
||||
dec SendFreeCnt
|
||||
lda #$FF ; TryHard = true
|
||||
jsr TryToSend
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
@@ -299,7 +302,8 @@ SER_STATUS:
|
||||
lda ACIA::STATUS
|
||||
ldx #$00
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -308,8 +312,8 @@ SER_STATUS:
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
lda #SER_ERR_INV_IOCTL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
||||
14
libsrc/atmos/ser_stat_stddrv.s
Normal file
14
libsrc/atmos/ser_stat_stddrv.s
Normal 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 _atmos_acia_ser
|
||||
|
||||
.rodata
|
||||
|
||||
_ser_static_stddrv := _atmos_acia_ser
|
||||
13
libsrc/atmos/ser_stddrv.s
Normal file
13
libsrc/atmos/ser_stddrv.s
Normal 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 "atmos-acia.ser"
|
||||
@@ -215,7 +215,8 @@ SETPALETTE:
|
||||
jsr PAPER
|
||||
ldy #1
|
||||
jsr flipcolor
|
||||
dey ; TGI_ERR_OK
|
||||
.assert TGI_ERR_OK = 0, error
|
||||
dey
|
||||
sty ERROR
|
||||
sty PARAM1+1
|
||||
jmp INK
|
||||
|
||||
@@ -87,16 +87,17 @@ INSTALL:
|
||||
cli
|
||||
cmp tmp1
|
||||
beq @ram_present
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@ram_present:
|
||||
ldx #$FF
|
||||
stx curpage
|
||||
stx curpage+1 ; Invalidate the current page
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa ; A = X = EM_ERR_OK
|
||||
txa
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -120,16 +120,16 @@ INSTALL:
|
||||
bne @setok
|
||||
|
||||
@notpresent:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@setok:
|
||||
lda #0
|
||||
sta pagecount
|
||||
stx pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
check:
|
||||
|
||||
@@ -87,16 +87,17 @@ INSTALL:
|
||||
cli
|
||||
cmp tmp1
|
||||
beq @ram_present
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@ram_present:
|
||||
ldx #$FF
|
||||
stx curpage
|
||||
stx curpage+1 ; Invalidate the current page
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa ; A = X = EM_ERR_OK
|
||||
txa
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -68,8 +68,9 @@ INSTALL:
|
||||
ldx #$FF
|
||||
stx curpage
|
||||
stx curpage+1 ; Invalidate the current page
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa ; A = X = EM_ERR_OK
|
||||
txa
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -107,8 +107,9 @@ INSTALL:
|
||||
ldx #$FF
|
||||
stx curpage
|
||||
stx curpage+1 ; Invalidate the current page
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa ; A = X = EM_ERR_OK
|
||||
txa
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -97,13 +97,14 @@ INSTALL:
|
||||
lda #0
|
||||
sta pagecount
|
||||
stx pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
@notpresent:
|
||||
@readonly:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -126,8 +126,9 @@ size_found:
|
||||
pagecount_ok:
|
||||
stx pagecount
|
||||
sty pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; common REU setup for size check
|
||||
|
||||
@@ -121,8 +121,9 @@ INSTALL:
|
||||
lda vdc_cset_save
|
||||
jsr vdcputreg
|
||||
@keep64kBit:
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
test64k:
|
||||
|
||||
@@ -53,8 +53,9 @@ JOY_COUNT = 4 ; 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
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -57,8 +57,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
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -194,9 +194,10 @@ INSTALL:
|
||||
sta (ptr3),y
|
||||
cli
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
||||
@@ -228,9 +228,10 @@ INSTALL:
|
||||
jsr MoveX
|
||||
cli
|
||||
|
||||
; Done, return zero.
|
||||
; Done
|
||||
|
||||
lda #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
||||
@@ -195,9 +195,10 @@ INSTALL:
|
||||
sta (ptr3),y
|
||||
cli
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
||||
@@ -195,9 +195,10 @@ INSTALL:
|
||||
sta (ptr3),y
|
||||
cli
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
||||
@@ -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 "c128.inc"
|
||||
|
||||
__randomize:
|
||||
___randomize:
|
||||
ldx VIC_HLINE ; Use VIC rasterline as high byte
|
||||
lda TIME+2 ; Use 60HZ clock as low byte
|
||||
jmp _srand ; Initialize generator
|
||||
|
||||
@@ -187,8 +187,9 @@ SetNMI: sta NMIVec
|
||||
|
||||
; 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
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -264,22 +265,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
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -300,8 +302,9 @@ SER_CLOSE:
|
||||
|
||||
; Return OK
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -322,8 +325,8 @@ SER_GET:
|
||||
@L1: 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
|
||||
@@ -370,7 +373,7 @@ SER_PUT:
|
||||
|
||||
@L2: ldx SendFreeCnt
|
||||
bne @L3
|
||||
lda #<SER_ERR_OVERFLOW ; X is already zero
|
||||
lda #SER_ERR_OVERFLOW ; X is already zero
|
||||
rts
|
||||
|
||||
@L3: ldx SendTail
|
||||
@@ -379,7 +382,8 @@ SER_PUT:
|
||||
dec SendFreeCnt
|
||||
lda #$ff
|
||||
jsr TryToSend
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
@@ -392,7 +396,8 @@ SER_STATUS:
|
||||
lda ACIA_STATUS
|
||||
ldx #0
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -402,8 +407,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
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
||||
14
libsrc/c128/ser_stat_stddrv.s
Normal file
14
libsrc/c128/ser_stat_stddrv.s
Normal 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 _c128_swlink_ser
|
||||
|
||||
.rodata
|
||||
|
||||
_ser_static_stddrv := _c128_swlink_ser
|
||||
13
libsrc/c128/ser_stddrv.s
Normal file
13
libsrc/c128/ser_stddrv.s
Normal 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 "c128_swlink.ser"
|
||||
@@ -77,12 +77,13 @@ INSTALL:
|
||||
|
||||
ldx #$FF
|
||||
stx curpage ; Invalidate the current page
|
||||
inx ; X = 0
|
||||
txa ; A = X = EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa
|
||||
rts
|
||||
|
||||
nomem: ldx #>EM_ERR_NO_DEVICE
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
nomem: ldx #EM_ERR_NO_DEVICE
|
||||
lda #0 ; return value is char
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -120,13 +120,14 @@ INSTALL:
|
||||
dex
|
||||
@noextradex:
|
||||
stx bankcount
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
@not_present:
|
||||
cli
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
|
||||
|
||||
@@ -158,13 +158,14 @@ INSTALL:
|
||||
jsr restore_data
|
||||
cpy #$01
|
||||
beq @present
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@present:
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -147,13 +147,14 @@ INSTALL:
|
||||
jsr restore_data
|
||||
cpy #$01
|
||||
beq @present
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@present:
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -121,16 +121,17 @@ INSTALL:
|
||||
bne @setok
|
||||
|
||||
@notpresent:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
@setok:
|
||||
lda #0
|
||||
sta pagecount
|
||||
stx pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
check:
|
||||
|
||||
@@ -76,13 +76,14 @@ INSTALL:
|
||||
beq @setok
|
||||
|
||||
@notpresent:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@setok:
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -82,13 +82,14 @@ INSTALL:
|
||||
cmp #$AA
|
||||
bne @notpresent
|
||||
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
@notpresent:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
; use rts from UNINSTALL below
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -65,8 +65,9 @@ window: .res 256 ; Memory "window"
|
||||
INSTALL:
|
||||
ldx #$FF
|
||||
stx curpage ; Invalidate the current page
|
||||
inx ; X = 0
|
||||
txa ; A = X = EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -98,13 +98,13 @@ INSTALL:
|
||||
lda #0
|
||||
sta pagecount
|
||||
stx pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
@notpresent:
|
||||
@readonly:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -127,8 +127,9 @@ size_found:
|
||||
pagecount_ok:
|
||||
stx pagecount
|
||||
sty pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; common REU setup for size check
|
||||
@@ -152,6 +153,7 @@ reu_size_check_common:
|
||||
|
||||
nodevice:
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
.assert EM_ERR_OK = 0, error
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
363
libsrc/c64/emd/c64-rrr.s
Normal file
363
libsrc/c64/emd/c64-rrr.s
Normal file
@@ -0,0 +1,363 @@
|
||||
;
|
||||
; Extended Memory Driver for the Action Replay/Retro Replay RAM
|
||||
;
|
||||
; original Version 1.0 by Johannes Braun 2006-08-22 <hannenz@freenet.de>
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
.include "em-kernel.inc"
|
||||
.include "em-error.inc"
|
||||
|
||||
.macpack generic
|
||||
.macpack module
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
c64_ram = ptr1 ; use some more expressive identifiers...
|
||||
rr_ram = ptr2
|
||||
len = ptr3
|
||||
aux = ptr4
|
||||
temp = tmp1
|
||||
|
||||
Lo_Mem = $0100 ; location of Lo_Code (must be below $1000 or above $e000)
|
||||
|
||||
RRMODE_OFF = $02
|
||||
RRMODE_CART_RAM = $23
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Header. Includes jump table
|
||||
|
||||
module_header _c64_rrr_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
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
|
||||
.bss
|
||||
window: .res 256 ; the memory window (256 bytes)
|
||||
pagecount: .res 1 ; Number of available pages
|
||||
|
||||
.rodata
|
||||
dummy:
|
||||
.word window ; a "pseudo"-em_copy_struct, used by em_map/ em_commit
|
||||
.byte 0 ; to pass over to COPYTO/COPYFROM
|
||||
curpage:
|
||||
.byte $ff ; just this byte is changed according to the desired page
|
||||
.byte 0
|
||||
.word 256
|
||||
|
||||
.code
|
||||
|
||||
;----------------------------------------------------------------------------------------
|
||||
;unsigned char __fastcall__ em_install(void *driver);
|
||||
;returns an error code
|
||||
;----------------------------------------------------------------------------------------
|
||||
INSTALL:
|
||||
ldx #c2-c1
|
||||
: lda c1,x
|
||||
sta Lo_Mem,x
|
||||
dex
|
||||
bpl :-
|
||||
;ldx #$ff
|
||||
stx curpage ; invalidate current page
|
||||
|
||||
ldy #RRMODE_OFF
|
||||
sei
|
||||
jmp Lo_Mem+8 ; jump to the code below
|
||||
|
||||
; copied to Lo_Mem
|
||||
c1:
|
||||
|
||||
;detectmodes:
|
||||
.byte RRMODE_CART_RAM | $00
|
||||
.byte RRMODE_CART_RAM | $08
|
||||
.byte RRMODE_CART_RAM | $10
|
||||
.byte RRMODE_CART_RAM | $18
|
||||
.byte RRMODE_CART_RAM | $80
|
||||
.byte RRMODE_CART_RAM | $88
|
||||
.byte RRMODE_CART_RAM | $90
|
||||
.byte RRMODE_CART_RAM | $98
|
||||
|
||||
; first save c64 memory
|
||||
lda $8888
|
||||
pha
|
||||
|
||||
; tag c64 memory
|
||||
lda #$00
|
||||
sta $8888
|
||||
|
||||
ldx #$07
|
||||
:
|
||||
; try accessing rr-ram
|
||||
;lda detectmodes, x
|
||||
lda Lo_Mem, x
|
||||
sta $de00
|
||||
|
||||
; tag (hopefully) rr memory
|
||||
txa
|
||||
ora #$80
|
||||
sta $8888
|
||||
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
;ldy #RRMODE_OFF
|
||||
sty $de00
|
||||
|
||||
; now if C64 memory is $80, there is no AR/RR
|
||||
; if C64 memory is $00, there is a AR/RR.
|
||||
|
||||
lda $8888
|
||||
beq detectpages
|
||||
|
||||
lda #0
|
||||
beq hasnopages
|
||||
|
||||
detectpages:
|
||||
; we can now read the highest available bank nr from the highest bank :)
|
||||
|
||||
lda #RRMODE_CART_RAM | $98
|
||||
sta $de00
|
||||
|
||||
ldx $8888
|
||||
inx
|
||||
txa
|
||||
|
||||
; 8k = 32 pages
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
|
||||
hasnopages:
|
||||
|
||||
;ldy #RRMODE_OFF
|
||||
sty $de00 ; c64 ram again
|
||||
|
||||
sta pagecount
|
||||
|
||||
; restore c64 memory
|
||||
pla
|
||||
sta $8888
|
||||
|
||||
cli
|
||||
|
||||
ldx pagecount
|
||||
beq no
|
||||
|
||||
; no error
|
||||
lda #0
|
||||
tax
|
||||
rts
|
||||
|
||||
no:
|
||||
lda #4 ; return #4: error code for "device not present"
|
||||
rts
|
||||
c2:
|
||||
|
||||
;----------------------------------------------------------------------------------------
|
||||
;void em_uninstall(void);
|
||||
;----------------------------------------------------------------------------------------
|
||||
UNINSTALL:
|
||||
return_null:
|
||||
lda #$00
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------------------
|
||||
;unsigned __fastcall__ em_pagecount(void);
|
||||
;----------------------------------------------------------------------------------------
|
||||
PAGECOUNT:
|
||||
lda pagecount ; always return 32kb (128 pages)
|
||||
ldx #$00
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------------------
|
||||
;void* __fastcall__ em_use(unsigned page);
|
||||
;----------------------------------------------------------------------------------------
|
||||
USE:
|
||||
cmp #$80 ; valid page?
|
||||
bcs return_null ; no, return NULL pointer
|
||||
sta curpage ; set to current page
|
||||
return_win:
|
||||
lda #<window ; return pointer to window
|
||||
ldx #>window
|
||||
return: rts
|
||||
|
||||
;----------------------------------------------------------------------------------------
|
||||
;void* __fastcall__ em_map(unsigned page);
|
||||
;----------------------------------------------------------------------------------------
|
||||
MAP:
|
||||
cmp pagecount
|
||||
bcs return_null
|
||||
sta curpage
|
||||
lda #<dummy ; load .A/.X with adress of data for COPYFROM-call (which expects the
|
||||
ldx #>dummy ; adress in .A/.X)
|
||||
jsr COPYFROM
|
||||
bcs return_win ; function returns pointer to window (returns always with carry set!)
|
||||
|
||||
;----------------------------------------------------------------------------------------
|
||||
;void __fastcall__ em_commit(void);
|
||||
;----------------------------------------------------------------------------------------
|
||||
COMMIT:
|
||||
lda curpage
|
||||
cmp pagecount
|
||||
bcs return
|
||||
lda #<dummy ; load .A/.X with adress of data for COPYTO-call (which expects the
|
||||
ldx #>dummy ; adress in .A/.X)
|
||||
|
||||
;----------------------------------------------------------------------------------------
|
||||
;void __fastcall__ em_copyto (struct em_copy *copy_data);
|
||||
;----------------------------------------------------------------------------------------
|
||||
COPYTO:
|
||||
jsr get_struct_data ;read the parameters passed in the em_struct pointed to by .A/.X upon call
|
||||
|
||||
;copy the main copyto routine into Lo_Mem
|
||||
|
||||
ldy #Lo_Code1_End - Lo_Code1
|
||||
: lda Lo_Code1-1,y
|
||||
sta Lo_Mem-1,y
|
||||
dey
|
||||
bne :-
|
||||
COMMON:
|
||||
sei
|
||||
jmp Lo_Mem
|
||||
|
||||
;this part will be executed in Lo_Mem (!) by COPYFROM
|
||||
|
||||
Lo_Code2:
|
||||
; copy byte rr -> c64
|
||||
stx $de00 ;map in rr-ram
|
||||
lda (rr_ram),y ;get byte from rr-ram
|
||||
sty $de00 ;RR-ROM will be mapped to $8000-$a000 but write access will go to c64-ram anyway!!
|
||||
sta (c64_ram),y ;and write to c64-ram
|
||||
nop ;pad to same size as Lo_Code1
|
||||
nop
|
||||
Lo_Code2_End:
|
||||
|
||||
|
||||
;this part will be executed in Lo_Mem (!) by COPYTO
|
||||
|
||||
Lo_Code1:
|
||||
; copy byte c64 -> rr
|
||||
lda (c64_ram),y ;read 1 byte from c64-ram
|
||||
stx $de00 ;map in rr-ram
|
||||
sta (rr_ram),y ;write byte to rr-ram
|
||||
lda #$02 ;map in c64-ram again
|
||||
sta $de00
|
||||
;12 bytes
|
||||
|
||||
;this part is common for both COPYFROM/COPYTO and executed in Lo_Mem, too
|
||||
|
||||
Lo_Code_Common:
|
||||
inc c64_ram ;increase pointers
|
||||
bne :+
|
||||
inc c64_ram+1
|
||||
: inc rr_ram
|
||||
bne @skip
|
||||
inc rr_ram+1
|
||||
lda rr_ram+1
|
||||
cmp #$a0 ;wrap around 16k boundary in rr-ram window ($8000-$a000)
|
||||
bne @skip
|
||||
|
||||
lda #$80 ;reset pointer to $8000
|
||||
sta rr_ram+1
|
||||
txa ;adjust value in .X to map in next 16k-bank in rr-ram
|
||||
adc #7 ;carry is set because of former CMP, so it adds 8
|
||||
tax
|
||||
;27 bytes
|
||||
@skip: lda c64_ram
|
||||
cmp len
|
||||
lda c64_ram+1
|
||||
sbc len+1
|
||||
bcc Lo_Code1
|
||||
lda #2 ;CHANGE to LDA #0 if driver is called from ROM
|
||||
sta $de00
|
||||
cli
|
||||
rts ;17 bytes = 56 bytes Lo_Code ($38)
|
||||
Lo_Code1_End:
|
||||
;----------------------------------------------------------------------------------------
|
||||
;void __fastcall__ em_copyfrom(struct em_copy *copy_data);
|
||||
;copy from extended memory into linear memory
|
||||
;----------------------------------------------------------------------------------------
|
||||
COPYFROM:
|
||||
jsr get_struct_data
|
||||
|
||||
ldy #Lo_Code2_End - Lo_Code2 ;copy routine into Lo_Mem
|
||||
: lda Lo_Code2-1,y
|
||||
sta Lo_Mem-1,y
|
||||
dey
|
||||
bne :-
|
||||
ldy #Lo_Code1_End-Lo_Code_Common
|
||||
: lda Lo_Code_Common-1,y
|
||||
sta Lo_Mem+11,y
|
||||
dey
|
||||
bne :-
|
||||
beq COMMON ;and execute...
|
||||
;----------------------------------------------------------------------------------------
|
||||
;read the struct data located at (.A/.X)
|
||||
;and setup parameters for stash/ fetch operation
|
||||
;----------------------------------------------------------------------------------------
|
||||
get_struct_data:
|
||||
|
||||
;read and process the values from the em_copy struct passed to as parameters rameter to the
|
||||
;functions em_copyto and em_copyfrom
|
||||
|
||||
sta aux ;store adress of struct (passed in .A/.X) into a zp pointer
|
||||
stx aux+1
|
||||
ldy #0 ;index 0
|
||||
|
||||
lda (aux),y ;read c64-adress lo
|
||||
sta c64_ram
|
||||
iny
|
||||
lda (aux),y ;read c64-adress hi
|
||||
sta c64_ram+1 ;(c64_ram) --> points to c64-adress space
|
||||
iny
|
||||
lda (aux),y ;read rr-adress lo
|
||||
sta rr_ram
|
||||
iny
|
||||
lda (aux),y ;rr-adress hi
|
||||
pha ;remember
|
||||
and #$1f
|
||||
ora #$80 ;adjust into 16k-window ($8000-$a000)
|
||||
sta rr_ram+1
|
||||
pla ;re-get hi byte of rr-adress
|
||||
and #$60 ;isolate bits 5 and 6
|
||||
lsr
|
||||
lsr ;shift into bits 3 and 4
|
||||
ora #$23 ;set bit 5 (select ram) and 1+2 (game/exrom setting for ULTIMAX-mode)
|
||||
tax ;.X has now the value to write into $de00 to acess rr-ram at desired 16k-bank
|
||||
iny
|
||||
iny ;skip unused byte
|
||||
lda (aux),y ;read length lo-byte
|
||||
clc
|
||||
adc c64_ram ;add to c64-addres
|
||||
sta len
|
||||
iny
|
||||
lda (aux),y ;length hi-byte
|
||||
adc c64_ram+1
|
||||
sta len+1 ;tmp2: length, tmp3 contains end adress of transfer in c64-ram.
|
||||
rts
|
||||
;55 bytes
|
||||
|
||||
@@ -87,8 +87,8 @@ INSTALL:
|
||||
bne @L0
|
||||
iny
|
||||
bne @L0
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
; ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@present:
|
||||
@@ -131,8 +131,9 @@ INSTALL:
|
||||
sta pagecount
|
||||
stx pagecount+1
|
||||
@endok:
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
test64k:
|
||||
|
||||
@@ -93,15 +93,16 @@ INSTALL:
|
||||
|
||||
; DTV not found
|
||||
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@present:
|
||||
ldx #$FF
|
||||
stx curpage+1 ; Invalidate curpage
|
||||
inx ; X = 0
|
||||
txa ; A/X = EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa
|
||||
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
|
||||
@@ -59,8 +59,9 @@ temp4: .byte 0
|
||||
;
|
||||
|
||||
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
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user