Merge branch 'master' of https://github.com/jedeoric/cc65
This commit is contained in:
@@ -133,8 +133,7 @@ MKINC = $(GEOS) \
|
||||
|
||||
TARGETUTIL = apple2 \
|
||||
apple2enh \
|
||||
atari \
|
||||
geos-apple
|
||||
atari
|
||||
|
||||
GEOSDIRS = common \
|
||||
conio \
|
||||
|
||||
@@ -19,11 +19,14 @@
|
||||
.segment "ONCE"
|
||||
|
||||
initprompt:
|
||||
; Set prompt <> ']' to let DOS 3.3 know that we're
|
||||
; not in Applesoft immediate mode and thus keep it
|
||||
; from scanning our device I/O for DOS commands.
|
||||
; Set prompt <> ']' and currently executed Applesoft
|
||||
; line number hibyte <> $FF to let DOS 3.3 (at $A65E)
|
||||
; know that we're not in Applesoft immediate mode and
|
||||
; thus keep it from scanning our device I/O for DOS
|
||||
; commands.
|
||||
lda #$80 ; Same value used at $D52C
|
||||
sta PROMPT
|
||||
sta CURLIN+1 ; Any value <> $FF will do
|
||||
rts
|
||||
|
||||
.code
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
DEPS += ../libwrk/$(TARGET)/loader.d
|
||||
DEPS += ../libwrk/$(TARGET)/convert.d \
|
||||
../libwrk/$(TARGET)/loader.d
|
||||
|
||||
../libwrk/$(TARGET)/convert.o: $(SRCDIR)/targetutil/convert.c | ../libwrk/$(TARGET)
|
||||
$(COMPILE_recipe)
|
||||
|
||||
../libwrk/$(TARGET)/loader.o: $(SRCDIR)/targetutil/loader.s | ../libwrk/$(TARGET)
|
||||
$(ASSEMBLE_recipe)
|
||||
|
||||
../target/$(TARGET)/util/convert.system: ../libwrk/$(TARGET)/convert.o ../lib/$(TARGET).lib | ../target/$(TARGET)/util
|
||||
$(LD65) -o $@ -C $(TARGET)-system.cfg $^
|
||||
|
||||
../target/$(TARGET)/util/loader.system: ../libwrk/$(TARGET)/loader.o $(SRCDIR)/targetutil/loader.cfg | ../target/$(TARGET)/util
|
||||
$(LD65) -o $@ -C $(filter %.cfg,$^) $(filter-out %.cfg,$^)
|
||||
|
||||
$(TARGET): ../target/$(TARGET)/util/loader.system
|
||||
$(TARGET): ../target/$(TARGET)/util/convert.system \
|
||||
../target/$(TARGET)/util/loader.system
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
; originally by Ullrich von Bassewitz and Sidney Cadot
|
||||
;
|
||||
; clock_t clock (void);
|
||||
; unsigned _clocks_per_sec (void);
|
||||
; clock_t _clocks_per_sec (void);
|
||||
;
|
||||
|
||||
.export _clock, __clocks_per_sec
|
||||
@@ -30,8 +30,10 @@
|
||||
|
||||
.proc __clocks_per_sec
|
||||
|
||||
ldx #$00 ; Clear high byte of return value
|
||||
lda PAL ; use hw register, PALNTS is only supported on XL/XE ROM
|
||||
ldx #$00 ; Clear byte 1 of return value
|
||||
stx sreg ; Clear byte 2 of return value
|
||||
stx sreg+1 ; Clear byte 3 of return value
|
||||
lda PAL ; Use hw register, PALNTS is only supported on XL/XE ROM
|
||||
and #$0e
|
||||
bne @NTSC
|
||||
lda #50
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
;
|
||||
; Christian Groessler, June-2016
|
||||
;
|
||||
; unsigned char doesclrscr(void);
|
||||
; unsigned char doesclrscrafterexit (void);
|
||||
;
|
||||
; returns 0/1 if after program termination the screen isn't/is cleared
|
||||
;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
SHRAM_HANDLERS = 1
|
||||
.include "atari.inc"
|
||||
.include "romswitch.inc"
|
||||
.import __CHARGEN_START__
|
||||
.export set_VTIMR1_handler
|
||||
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
SHRAM_HANDLERS = 1
|
||||
.include "atari.inc"
|
||||
.include "romswitch.inc"
|
||||
.import __CHARGEN_START__
|
||||
.export set_VTIMR2_handler
|
||||
|
||||
|
||||
|
||||
15
libsrc/atari/waitvsync.s
Normal file
15
libsrc/atari/waitvsync.s
Normal file
@@ -0,0 +1,15 @@
|
||||
;
|
||||
; Written by Christian Groessler <chris@groessler.org>
|
||||
;
|
||||
; void waitvsync (void);
|
||||
;
|
||||
|
||||
.include "atari.inc"
|
||||
.export _waitvsync
|
||||
|
||||
.proc _waitvsync
|
||||
lda RTCLOK+2
|
||||
@lp: cmp RTCLOK+2
|
||||
beq @lp
|
||||
rts
|
||||
.endproc
|
||||
@@ -2,7 +2,6 @@
|
||||
; from Atari computer version by Christian Groessler, 2014
|
||||
;
|
||||
; clock_t clock (void);
|
||||
; unsigned _clocks_per_sec (void);
|
||||
;
|
||||
|
||||
.export _clock
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
.import zerobss, copydata
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "atari5200.inc"
|
||||
|
||||
start:
|
||||
|
||||
|
||||
15
libsrc/atari5200/waitvsync.s
Normal file
15
libsrc/atari5200/waitvsync.s
Normal file
@@ -0,0 +1,15 @@
|
||||
;
|
||||
; Written by Christian Groessler <chris@groessler.org>
|
||||
;
|
||||
; void waitvsync (void);
|
||||
;
|
||||
|
||||
.include "atari5200.inc"
|
||||
.export _waitvsync
|
||||
|
||||
.proc _waitvsync
|
||||
lda RTCLOK+1
|
||||
@lp: cmp RTCLOK+1
|
||||
beq @lp
|
||||
rts
|
||||
.endproc
|
||||
@@ -7,7 +7,7 @@
|
||||
;
|
||||
|
||||
.export _cputcxy, _cputc
|
||||
.export setscrptr, putchar
|
||||
.export setscrptr, cputdirect, putchar
|
||||
.constructor initcputc
|
||||
.import rvs
|
||||
.import popax
|
||||
@@ -32,13 +32,13 @@ _cputc: cmp #$0D ; CR?
|
||||
rts
|
||||
|
||||
L1: cmp #$0A ; LF?
|
||||
bne output
|
||||
bne cputdirect
|
||||
inc CURS_Y ; Newline
|
||||
rts
|
||||
|
||||
; Output the character, then advance the cursor position
|
||||
|
||||
output:
|
||||
cputdirect:
|
||||
jsr putchar
|
||||
|
||||
advance:
|
||||
|
||||
@@ -20,18 +20,19 @@
|
||||
|
||||
sta ptr3
|
||||
stx ptr3+1 ; save count as result
|
||||
eor #$FF
|
||||
sta ptr2
|
||||
txa
|
||||
eor #$FF
|
||||
sta ptr2+1 ; Remember -count-1
|
||||
|
||||
inx
|
||||
stx ptr2+1
|
||||
tax
|
||||
inx
|
||||
stx ptr2 ; save count with each byte incremented separately
|
||||
|
||||
jsr popptr1 ; get buf
|
||||
jsr popax ; get fd and discard
|
||||
|
||||
L1: inc ptr2
|
||||
L1: dec ptr2
|
||||
bnz L2
|
||||
inc ptr2+1
|
||||
dec ptr2+1
|
||||
bze L9 ; no more room in buf
|
||||
|
||||
; If there are no more characters in BASIC's input buffer, then get a line from
|
||||
|
||||
@@ -17,17 +17,17 @@
|
||||
sta ptr3
|
||||
stx ptr3+1 ; save count as result
|
||||
|
||||
eor #$FF
|
||||
sta ptr2
|
||||
txa
|
||||
eor #$FF
|
||||
sta ptr2+1 ; Remember -count-1
|
||||
inx
|
||||
stx ptr2+1
|
||||
tax
|
||||
inx
|
||||
stx ptr2 ; save count with each byte incremented separately
|
||||
|
||||
jsr popptr1 ; get buf
|
||||
jsr popax ; get fd and discard
|
||||
L1: inc ptr2
|
||||
L1: dec ptr2
|
||||
bne L2
|
||||
inc ptr2+1
|
||||
dec ptr2+1
|
||||
beq L9
|
||||
L2: ldy #0
|
||||
lda (ptr1),y
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
|
||||
; Sprite definitions. The first value can be changed to adjust the number
|
||||
; of the sprite used for the mouse. All others depend on this value.
|
||||
MOUSE_SPR = 0 ; Sprite used for the mouse
|
||||
MOUSE_SPR_MEM = $0E00 ; Memory location
|
||||
MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
|
||||
MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative mask
|
||||
VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
|
||||
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||
MOUSE_SPR = 0 ; Sprite used for the mouse
|
||||
MOUSE_SPR_MEM = $0E00 ; Memory location
|
||||
MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
|
||||
MOUSE_SPR_NMASK = .lobyte(.bitnot MOUSE_SPR_MASK) ; Negative mask
|
||||
VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
|
||||
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Initialize the mouse sprite.
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
.importzp ST
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "plus4.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Startup code
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
.importzp ST
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "c64.inc"
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
|
||||
; Sprite definitions. The first value can be changed to adjust the number
|
||||
; of the sprite used for the mouse. All others depend on this value.
|
||||
MOUSE_SPR = 0 ; Sprite used for the mouse
|
||||
MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
|
||||
MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative mask
|
||||
VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
|
||||
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||
MOUSE_SPR = 0 ; Sprite used for the mouse
|
||||
MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
|
||||
MOUSE_SPR_NMASK = .lobyte(.bitnot MOUSE_SPR_MASK) ; Negative mask
|
||||
VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
|
||||
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Initialize the mouse sprite.
|
||||
|
||||
@@ -2,14 +2,16 @@
|
||||
; Ullrich von Bassewitz, 03.06.1999
|
||||
;
|
||||
; unsigned char cbm_k_basin (void);
|
||||
; unsigned char cbm_k_chrin (void);
|
||||
;
|
||||
|
||||
.include "cbm.inc"
|
||||
|
||||
.export _cbm_k_basin
|
||||
.export _cbm_k_basin, _cbm_k_chrin
|
||||
|
||||
|
||||
_cbm_k_basin:
|
||||
_cbm_k_chrin:
|
||||
jsr BASIN
|
||||
ldx #0 ; Clear high byte
|
||||
rts
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
; Ullrich von Bassewitz, 03.06.1999
|
||||
;
|
||||
; void __fastcall__ cbm_k_bsout (unsigned char C);
|
||||
; void __fastcall__ cbm_k_chrout (unsigned char C);
|
||||
;
|
||||
|
||||
.include "cbm.inc"
|
||||
|
||||
.export _cbm_k_bsout
|
||||
.export _cbm_k_bsout, _cbm_k_chrout
|
||||
|
||||
_cbm_k_bsout = BSOUT
|
||||
_cbm_k_bsout := BSOUT
|
||||
_cbm_k_chrout := CHROUT
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
/* 2009-10-10 -- Version 0.3 */
|
||||
/* 2011-04-07 -- Version 0.4, groepaz */
|
||||
/* 2011-04-14 -- Version 0.5, Greg King */
|
||||
/* 2021-02-15 -- Version 0.6, Greg King */
|
||||
|
||||
/* Tested with floppy-drive and IDE64 devices. */
|
||||
/* Not tested with messed (buggy) directory listings. */
|
||||
@@ -29,7 +30,7 @@ unsigned char cbm_opendir (unsigned char lfn, unsigned char device, ...)
|
||||
va_list ap;
|
||||
const char* name = "$";
|
||||
|
||||
/* The name used in cbm_open may optionally be passed */
|
||||
/* The name used in cbm_open() optionally may be passed */
|
||||
if (__argsize__ == 4) {
|
||||
va_start (ap, device);
|
||||
name = va_arg (ap, const char*);
|
||||
@@ -76,9 +77,10 @@ unsigned char __fastcall__ cbm_readdir (unsigned char lfn, register struct cbm_d
|
||||
|
||||
byte = cbm_k_basin();
|
||||
switch (byte) {
|
||||
|
||||
/* "B" BLOCKS FREE. */
|
||||
/* "B" BLOCKS FREE/USED. */
|
||||
/* "M" MB FREE. */
|
||||
case 'b':
|
||||
case 'm':
|
||||
/* Read until end; careless callers might call us again. */
|
||||
while (!cbm_k_readst()) {
|
||||
cbm_k_basin();
|
||||
@@ -168,7 +170,6 @@ unsigned char __fastcall__ cbm_readdir (unsigned char lfn, register struct cbm_d
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
goto ret_val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,11 +45,11 @@
|
||||
|
||||
|
||||
_cbm_read:
|
||||
eor #$FF
|
||||
sta ptr1
|
||||
txa
|
||||
eor #$FF
|
||||
sta ptr1+1 ; Save -size-1
|
||||
inx
|
||||
stx ptr1+1
|
||||
tax
|
||||
inx
|
||||
stx ptr1 ; Save size with both bytes incremented separately.
|
||||
|
||||
jsr popax
|
||||
sta ptr2
|
||||
@@ -92,9 +92,9 @@ _cbm_read:
|
||||
bne @L3
|
||||
inc ptr3+1 ; ++bytesread;
|
||||
|
||||
@L3: inc ptr1
|
||||
@L3: dec ptr1
|
||||
bne @L1
|
||||
inc ptr1+1
|
||||
dec ptr1+1
|
||||
bne @L1
|
||||
|
||||
@L4: jsr CLRCH
|
||||
|
||||
@@ -39,11 +39,11 @@
|
||||
_cbm_write:
|
||||
sta ptr3
|
||||
stx ptr3+1 ; Save size
|
||||
eor #$FF
|
||||
sta ptr1
|
||||
txa
|
||||
eor #$FF
|
||||
sta ptr1+1 ; Save -size-1
|
||||
inx
|
||||
stx ptr1+1
|
||||
tax
|
||||
inx
|
||||
stx ptr1 ; Save size with both bytes incremented separately
|
||||
|
||||
jsr popax
|
||||
sta ptr2
|
||||
@@ -69,9 +69,9 @@ _cbm_write:
|
||||
|
||||
@L2: jsr BSOUT ; cbm_k_bsout (A);
|
||||
|
||||
@L3: inc ptr1 ; --size;
|
||||
@L3: dec ptr1 ; --size;
|
||||
bne @L1
|
||||
inc ptr1+1
|
||||
dec ptr1+1
|
||||
bne @L1
|
||||
|
||||
jsr CLRCH
|
||||
|
||||
@@ -106,9 +106,9 @@
|
||||
|
||||
; Decrement the count
|
||||
|
||||
@L3: inc ptr2
|
||||
@L3: dec ptr2
|
||||
bne @L0
|
||||
inc ptr2+1
|
||||
dec ptr2+1
|
||||
bne @L0
|
||||
beq done ; Branch always
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
** Ullrich von Bassewitz, 2012-05-30. Based on code by Groepaz.
|
||||
** Based on code by Groepaz.
|
||||
** 2012-05-30, Ullrich von Bassewitz
|
||||
** 2021-02-15, Greg King
|
||||
*/
|
||||
|
||||
|
||||
@@ -52,12 +54,14 @@ struct dirent* __fastcall__ readdir (register DIR* dir)
|
||||
/* Bump the directory offset and include the bytes for line-link and size */
|
||||
dir->off += count + 4;
|
||||
|
||||
/* End of directory is reached if the buffer contains "blocks free". It is
|
||||
** sufficient here to check for the leading 'b'. buffer will contain at
|
||||
** least one byte if we come here.
|
||||
/* End of directory is reached if the buffer contains "blocks free/used" or
|
||||
** "mb free.". It is sufficient here to check for the leading 'b' and 'm'.
|
||||
** buffer will contain at least one byte if we come here.
|
||||
*/
|
||||
if (buffer[0] == 'b') {
|
||||
goto exitpoint;
|
||||
switch (buffer[0]) {
|
||||
case 'b':
|
||||
case 'm':
|
||||
goto exitpoint;
|
||||
}
|
||||
|
||||
/* Parse the buffer for the filename and file type */
|
||||
@@ -67,7 +71,6 @@ struct dirent* __fastcall__ readdir (register DIR* dir)
|
||||
b = buffer;
|
||||
while (i < count) {
|
||||
switch (s) {
|
||||
|
||||
case 0:
|
||||
/* Searching for start of file name */
|
||||
if (*b == '"') {
|
||||
@@ -127,6 +130,3 @@ struct dirent* __fastcall__ readdir (register DIR* dir)
|
||||
exitpoint:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
|
||||
.proc rwcommon
|
||||
|
||||
eor #$FF
|
||||
sta ptr2
|
||||
txa
|
||||
eor #$FF
|
||||
sta ptr2+1 ; Remember -count-1
|
||||
inx
|
||||
stx ptr2+1
|
||||
tax
|
||||
inx
|
||||
stx ptr2 ; Save count with each byte incremented separately
|
||||
|
||||
jsr popptr1 ; Get buf to ptr1, Y=0 by call
|
||||
|
||||
|
||||
@@ -83,9 +83,9 @@
|
||||
|
||||
; Decrement count
|
||||
|
||||
@L2: inc ptr2
|
||||
@L2: dec ptr2
|
||||
bne @L0
|
||||
inc ptr2+1
|
||||
dec ptr2+1
|
||||
bne @L0
|
||||
|
||||
; Wrote all chars or disk full. Close the output channel
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
|
||||
; Sprite definitions. The first value can be changed to adjust the number
|
||||
; of the sprite used for the mouse. All others depend on that value.
|
||||
MOUSE_SPR = 0 ; Sprite used for the mouse
|
||||
MOUSE_SPR_MEM = $F400 ; Memory location
|
||||
MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
|
||||
MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative mask
|
||||
VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
|
||||
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||
MOUSE_SPR = 0 ; Sprite used for the mouse
|
||||
MOUSE_SPR_MEM = $F400 ; Memory location
|
||||
MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
|
||||
MOUSE_SPR_NMASK = .lobyte(.bitnot MOUSE_SPR_MASK) ; Negative mask
|
||||
VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
|
||||
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Initialize the mouse sprite.
|
||||
|
||||
@@ -17,22 +17,22 @@
|
||||
|
||||
.proc _getcwd
|
||||
|
||||
; Remember -size-1 because this simplifies the following loop
|
||||
; Remember size with each byte incremented because this simplifies the following loop
|
||||
|
||||
eor #$FF
|
||||
sta ptr2
|
||||
txa
|
||||
eor #$FF
|
||||
sta ptr2+1
|
||||
inx
|
||||
stx ptr2+1
|
||||
tax
|
||||
inx
|
||||
stx ptr2 ; Save size with each byte incremented separately
|
||||
|
||||
jsr popptr1 ; Get buf to ptr1
|
||||
|
||||
; Copy __cwd to the given buffer checking the length
|
||||
|
||||
; ldy #$00 is guaranteed by popptr1
|
||||
loop: inc ptr2
|
||||
loop: dec ptr2
|
||||
bne @L1
|
||||
inc ptr2+1
|
||||
dec ptr2+1
|
||||
beq overflow
|
||||
|
||||
; Copy one character, end the loop if the zero terminator is reached. We
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
|
||||
_memcmp:
|
||||
|
||||
; Calculate (-count-1) and store it into ptr3. This is some overhead here but
|
||||
; saves time in the compare loop
|
||||
; Calculate a special count, and store it into ptr3. That is some overhead here,
|
||||
; but saves time in the compare loop
|
||||
|
||||
eor #$FF
|
||||
sta ptr3
|
||||
txa
|
||||
eor #$FF
|
||||
sta ptr3+1
|
||||
inx
|
||||
stx ptr3+1
|
||||
tax
|
||||
inx
|
||||
stx ptr3 ; Save count with each byte incremented separately
|
||||
|
||||
; Get the pointer parameters
|
||||
|
||||
@@ -29,12 +29,12 @@ _memcmp:
|
||||
; Loop initialization
|
||||
|
||||
;ldy #$00 ; Initialize pointer (Y=0 guaranteed by popptr1)
|
||||
ldx ptr3 ; Load low counter byte into X
|
||||
ldx ptr3 ; Load inner counter byte into .X
|
||||
|
||||
; Head of compare loop: Test for the end condition
|
||||
|
||||
Loop: inx ; Bump low byte of (-count-1)
|
||||
beq BumpHiCnt ; Jump on overflow
|
||||
Loop: dex
|
||||
beq BumpHiCnt ; Jump on end of inner count
|
||||
|
||||
; Do the compare
|
||||
|
||||
@@ -50,10 +50,10 @@ Comp: lda (ptr1),y
|
||||
inc ptr2+1
|
||||
bne Loop ; Branch always (pointer wrap is illegal)
|
||||
|
||||
; Entry on low counter byte overflow
|
||||
; Entry on inner loop end
|
||||
|
||||
BumpHiCnt:
|
||||
inc ptr3+1 ; Bump high byte of (-count-1)
|
||||
dec ptr3+1
|
||||
bne Comp ; Jump if not done
|
||||
jmp return0 ; Count is zero, areas are identical
|
||||
|
||||
@@ -67,4 +67,3 @@ NotEqual:
|
||||
Greater:
|
||||
ldx #$01 ; Make result positive
|
||||
rts
|
||||
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
; char* strncat (char* dest, const char* src, size_t n);
|
||||
;
|
||||
|
||||
.export _strncat
|
||||
.import popax, popptr1
|
||||
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
|
||||
.macpack cpu
|
||||
.export _strncat
|
||||
.import popax, popptr1
|
||||
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
|
||||
.macpack cpu
|
||||
|
||||
_strncat:
|
||||
eor #$FF ; one's complement to count upwards
|
||||
sta tmp1
|
||||
txa
|
||||
eor #$FF
|
||||
sta tmp2
|
||||
inx
|
||||
stx tmp2
|
||||
tax
|
||||
inx
|
||||
stx tmp1 ; save count with each byte incremented separately
|
||||
|
||||
jsr popptr1 ; get src
|
||||
|
||||
@@ -49,9 +49,9 @@ L2: sty ptr2
|
||||
L3: ldy #0
|
||||
ldx tmp1 ; low counter byte
|
||||
|
||||
L4: inx
|
||||
L4: dex
|
||||
bne L5
|
||||
inc tmp2
|
||||
dec tmp2
|
||||
beq L6 ; jump if done
|
||||
L5: lda (ptr1),y
|
||||
sta (ptr2),y
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
.proc _strncpy
|
||||
|
||||
eor #$FF
|
||||
sta tmp1
|
||||
txa
|
||||
eor #$FF
|
||||
sta tmp2 ; Store -size - 1
|
||||
inx
|
||||
stx tmp2
|
||||
tax
|
||||
inx
|
||||
stx tmp1 ; save count with each byte incremented separately
|
||||
|
||||
jsr popptr1 ; get src
|
||||
jsr popax ; get dest
|
||||
@@ -24,11 +24,11 @@
|
||||
|
||||
; Copy src -> dest up to size bytes
|
||||
|
||||
ldx tmp1 ; Load low byte of ones complement of size
|
||||
ldx tmp1
|
||||
ldy #$00
|
||||
L1: inx
|
||||
L1: dex
|
||||
bne L2
|
||||
inc tmp2
|
||||
dec tmp2
|
||||
beq L9
|
||||
|
||||
L2: lda (ptr1),y ; Copy one character
|
||||
@@ -42,8 +42,8 @@ L2: lda (ptr1),y ; Copy one character
|
||||
|
||||
; Fill the remaining bytes.
|
||||
|
||||
L3: inx ; Counter low byte
|
||||
beq L6 ; Branch on overflow
|
||||
L3: dex ; Counter low byte
|
||||
beq L6
|
||||
L4: sta (ptr2),y ; Clear one byte
|
||||
L5: iny ; Bump pointer
|
||||
bne L3
|
||||
@@ -52,7 +52,7 @@ L5: iny ; Bump pointer
|
||||
|
||||
; Bump the counter high byte
|
||||
|
||||
L6: inc tmp2
|
||||
L6: dec tmp2
|
||||
bne L4
|
||||
|
||||
; Done, return dest
|
||||
|
||||
@@ -15,17 +15,11 @@
|
||||
_strnicmp:
|
||||
_strncasecmp:
|
||||
|
||||
; Convert the given counter value in a/x from a downward counter into an
|
||||
; upward counter, so we can increment the counter in the loop below instead
|
||||
; of decrementing it. This adds some overhead now, but is cheaper than
|
||||
; executing a more complex test in each iteration of the loop. We do also
|
||||
; correct the value by one, so we can do the test on top of the loop.
|
||||
|
||||
eor #$FF
|
||||
sta ptr3
|
||||
txa
|
||||
eor #$FF
|
||||
sta ptr3+1
|
||||
inx
|
||||
stx ptr3+1
|
||||
tax
|
||||
inx
|
||||
stx ptr3 ; save count with each byte incremented separately
|
||||
|
||||
; Get the remaining arguments
|
||||
|
||||
@@ -40,8 +34,8 @@ _strncasecmp:
|
||||
|
||||
; Start of compare loop. Check the counter.
|
||||
|
||||
Loop: inc ptr3
|
||||
beq IncHi ; increment high byte
|
||||
Loop: dec ptr3 ; decrement high byte
|
||||
beq IncHi
|
||||
|
||||
; Compare a byte from the strings
|
||||
|
||||
@@ -79,7 +73,7 @@ L2: ldx tmp1
|
||||
|
||||
; Increment hi byte
|
||||
|
||||
IncHi: inc ptr3+1
|
||||
IncHi: dec ptr3+1
|
||||
bne Comp ; jump if counter not zero
|
||||
|
||||
; Exit code if strings are equal. a/x not set
|
||||
|
||||
@@ -47,12 +47,12 @@ outdesc: ; Static outdesc structure
|
||||
|
||||
out: jsr popax ; count
|
||||
sta ptr2
|
||||
eor #$FF
|
||||
sta outdesc+6
|
||||
txa
|
||||
sta ptr2+1
|
||||
eor #$FF
|
||||
sta outdesc+7
|
||||
stx ptr2+1
|
||||
inx
|
||||
stx outdesc+7
|
||||
tax
|
||||
inx
|
||||
stx outdesc+6
|
||||
|
||||
jsr popptr1 ; buf
|
||||
|
||||
@@ -74,7 +74,7 @@ out: jsr popax ; count
|
||||
|
||||
; Loop outputting characters
|
||||
|
||||
@L1: inc outdesc+6
|
||||
@L1: dec outdesc+6
|
||||
beq @L4
|
||||
@L2: ldy tmp1
|
||||
lda (ptr1),y
|
||||
@@ -85,7 +85,7 @@ out: jsr popax ; count
|
||||
jsr _cputc
|
||||
jmp @L1
|
||||
|
||||
@L4: inc outdesc+7
|
||||
@L4: dec outdesc+7
|
||||
bne @L2
|
||||
rts
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ next: inx
|
||||
jsr closecmdchannel
|
||||
ldx tmp2
|
||||
|
||||
; As we had to reference ST above anyway, we can do so, as well,
|
||||
; As we had to reference STATUS above anyway, we can do so, as well,
|
||||
; here too (instead of calling READST).
|
||||
|
||||
lda STATUS
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
DEPS += ../libwrk/$(TARGET)/convert.d
|
||||
|
||||
../libwrk/$(TARGET)/convert.o: TARGET = apple2enh
|
||||
|
||||
../libwrk/$(TARGET)/convert.o: $(SRCDIR)/targetutil/convert.c | ../libwrk/$(TARGET)
|
||||
$(COMPILE_recipe)
|
||||
|
||||
../lib/apple2enh.lib:
|
||||
@$(MAKE) --no-print-directory apple2enh
|
||||
|
||||
../target/$(TARGET)/util/convert.system: ../libwrk/$(TARGET)/convert.o ../lib/apple2enh.lib | ../target/$(TARGET)/util
|
||||
$(LD65) -o $@ -C apple2enh-system.cfg $^
|
||||
|
||||
$(TARGET): ../target/$(TARGET)/util/convert.system
|
||||
@@ -13,6 +13,10 @@
|
||||
.include "geossym.inc"
|
||||
|
||||
_CalcBlksFree:
|
||||
lda #<curDirHead
|
||||
ldx #>curDirHead
|
||||
sta r5L
|
||||
stx r5H
|
||||
jsr CalcBlksFree
|
||||
stx __oserror
|
||||
lda r4L
|
||||
|
||||
@@ -94,11 +94,12 @@ _read:
|
||||
; popax - fd, must be == to the above one
|
||||
; return -1+__oserror or number of bytes read
|
||||
|
||||
eor #$ff
|
||||
sta ptr1
|
||||
txa
|
||||
eor #$ff
|
||||
sta ptr1+1 ; -(# of bytes to read)-1
|
||||
inx
|
||||
stx ptr1+1
|
||||
tax
|
||||
inx
|
||||
stx ptr1 ; save count with each byte incremented separately
|
||||
|
||||
jsr popax
|
||||
sta ptr2
|
||||
stx ptr2+1 ; buffer ptr
|
||||
@@ -152,9 +153,9 @@ _read:
|
||||
beq @done ; yes, we're done
|
||||
jmp __mappederrno ; no, we're screwed
|
||||
|
||||
@L3: inc ptr1 ; decrement the count
|
||||
@L3: dec ptr1 ; decrement the count
|
||||
bne @L0
|
||||
inc ptr1+1
|
||||
dec ptr1+1
|
||||
bne @L0
|
||||
|
||||
@done:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
;
|
||||
; Maciej 'YTM/Alliance' Witkowiak
|
||||
; 1999-10-26, Maciej 'YTM/Alliance' Witkowiak
|
||||
; 2020-10-29, Greg King
|
||||
;
|
||||
; 26.10.99
|
||||
|
||||
; struct filehandle* Get1stDirEntry (void);
|
||||
|
||||
.import __oserror
|
||||
.import __oserror, return0
|
||||
.export _Get1stDirEntry
|
||||
|
||||
.include "diskdrv.inc"
|
||||
@@ -14,6 +14,10 @@
|
||||
_Get1stDirEntry:
|
||||
jsr Get1stDirEntry
|
||||
stx __oserror
|
||||
txa
|
||||
bne L1 ; jump if disk error
|
||||
lda r5L
|
||||
ldx r5H
|
||||
rts
|
||||
|
||||
L1: jmp return0 ; return NULL if not valid entry
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
;
|
||||
; Maciej 'YTM/Alliance' Witkowiak
|
||||
; 1999-10-26, Maciej 'YTM/Alliance' Witkowiak
|
||||
; 2020-10-29, Greg King
|
||||
;
|
||||
; 26.10.99
|
||||
|
||||
; struct filehandle* GetNxtDirEntry (void);
|
||||
|
||||
.import __oserror
|
||||
.import __oserror, return0
|
||||
.export _GetNxtDirEntry
|
||||
|
||||
.include "diskdrv.inc"
|
||||
@@ -14,6 +14,12 @@
|
||||
_GetNxtDirEntry:
|
||||
jsr GetNxtDirEntry
|
||||
stx __oserror
|
||||
txa
|
||||
bne L1 ; jump if disk error
|
||||
tya
|
||||
bne L1 ; jump when no more entries
|
||||
lda r5L
|
||||
ldx r5H
|
||||
rts
|
||||
|
||||
L1: jmp return0 ; return NULL if not valid entry
|
||||
|
||||
@@ -2,18 +2,14 @@
|
||||
; 2003-04-13, Ullrich von Bassewitz
|
||||
; 2012-02-06, Greg King
|
||||
;
|
||||
; #include <time.h>
|
||||
; clock_t clock (void);
|
||||
; clock_t _clocks_per_sec (void);
|
||||
;
|
||||
; typedef unsigned long int clock_t;
|
||||
; clock_t _clk_tck(void);
|
||||
; #define CLOCKS_PER_SEC _clk_tck()
|
||||
; clock_t clock(void);
|
||||
;
|
||||
; clk_tck()'s test-values are based on the numbers in "set_tv.s".
|
||||
; clocks_per_sec()'s test-values are based on the numbers in "set_tv.s".
|
||||
; If you change the numbers there, then change them here, too.
|
||||
;
|
||||
|
||||
.export _clock, __clk_tck, clock_count
|
||||
.export _clock, __clocks_per_sec, clock_count
|
||||
.interruptor update_clock, 2 ; (low priority)
|
||||
.constructor init_clock
|
||||
|
||||
@@ -42,7 +38,7 @@
|
||||
;-----------------------------------------------------------------------------
|
||||
; Return the number of clock ticks in one second.
|
||||
;
|
||||
__clk_tck:
|
||||
__clocks_per_sec:
|
||||
ldx #$00 ; >50, >60, >75
|
||||
ldy PBKUP
|
||||
lda #<75
|
||||
|
||||
@@ -50,16 +50,15 @@ LINEDIST = $20 ; Offset in video RAM between two lines
|
||||
ldx #>load_addr
|
||||
sta load
|
||||
stx load+1
|
||||
lda #<load_size
|
||||
eor #$FF
|
||||
sta count ; store (-size - 1)
|
||||
lda #>load_size
|
||||
eor #$FF
|
||||
sta count+1
|
||||
|
||||
L1: inc count ; pre-count one's-complement upwards
|
||||
ldx #(<load_size) + 1
|
||||
stx count
|
||||
ldx #(>load_size) + 1
|
||||
stx count+1 ; save size with each byte incremented separately
|
||||
|
||||
L1: dec count
|
||||
bnz L2
|
||||
inc count+1
|
||||
dec count+1
|
||||
bze L3
|
||||
L2: jsr GETCHAR ; (doesn't change .Y)
|
||||
sta (load),y
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "pet.inc"
|
||||
.include "../cbm/cbm.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Startup code
|
||||
|
||||
16
libsrc/pet/waitvsync.s
Normal file
16
libsrc/pet/waitvsync.s
Normal file
@@ -0,0 +1,16 @@
|
||||
;
|
||||
; Written by Robin Harbron, requires 12" monitor
|
||||
;
|
||||
; void waitvsync (void);
|
||||
;
|
||||
|
||||
.export _waitvsync
|
||||
|
||||
.include "pet.inc"
|
||||
|
||||
_waitvsync:
|
||||
@l1:
|
||||
lda VIA_PB
|
||||
and #%00100000
|
||||
bne @l1
|
||||
rts
|
||||
@@ -198,5 +198,3 @@ irqcount: .byte 0
|
||||
.segment "INIT"
|
||||
|
||||
zpsave: .res zpspace
|
||||
|
||||
|
||||
|
||||
@@ -78,5 +78,3 @@ not_dma:
|
||||
.word nmi
|
||||
.word reset32kcode
|
||||
.word irq
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ _cputcxy:
|
||||
ldx CHARCOLOR
|
||||
cpx OLD_CHARCOLOR
|
||||
beq do_not_change_color_foreground
|
||||
|
||||
|
||||
stx OLD_CHARCOLOR ; Store CHARCOLOR into OLD_CHARCOLOR
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ do_not_change_color:
|
||||
CHARCOLOR:
|
||||
.res 1
|
||||
OLD_CHARCOLOR:
|
||||
.res 1
|
||||
.res 1
|
||||
BGCOLOR:
|
||||
.res 1
|
||||
.res 1
|
||||
OLD_BGCOLOR:
|
||||
.res 1
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
.import __MAIN_START__, __MAIN_SIZE__
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "telestrat.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Place the startup code in a special segment.
|
||||
|
||||
17
libsrc/telestrat/kbhit.s
Normal file
17
libsrc/telestrat/kbhit.s
Normal file
@@ -0,0 +1,17 @@
|
||||
;
|
||||
; Jede, 2021-02-01
|
||||
;
|
||||
; int kbhit (void);
|
||||
;
|
||||
|
||||
.export _kbhit
|
||||
|
||||
.include "telestrat.inc"
|
||||
|
||||
_kbhit:
|
||||
BRK_TELEMON XRD0
|
||||
ldx #$00
|
||||
txa
|
||||
rol
|
||||
eor #$01
|
||||
rts
|
||||
@@ -13,11 +13,11 @@
|
||||
sta ptr3
|
||||
stx ptr3+1 ; save count as result
|
||||
|
||||
eor #$FF
|
||||
sta ptr2
|
||||
txa
|
||||
eor #$FF
|
||||
sta ptr2+1 ; remember -count-1
|
||||
inx
|
||||
stx ptr2+1
|
||||
tax
|
||||
inx
|
||||
stx ptr2 ; save count with each byte incremented separately
|
||||
|
||||
jsr popptr1 ; get buf
|
||||
jsr popax ; get fd and discard
|
||||
@@ -51,9 +51,9 @@ next:
|
||||
rts
|
||||
|
||||
|
||||
L1: inc ptr2
|
||||
L1: dec ptr2
|
||||
bne L2
|
||||
inc ptr2+1
|
||||
dec ptr2+1
|
||||
beq L9
|
||||
L2: ldy #0
|
||||
lda (ptr1),y
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
.importzp ST
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "vic20.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Startup code
|
||||
|
||||
Reference in New Issue
Block a user