Merge branch 'cc65:master' into master
This commit is contained in:
@@ -1,13 +1,31 @@
|
||||
# ---- Display info during parsing phase ----
|
||||
SILENT:=$(findstring s,$(word 1, $(MAKEFLAGS)))
|
||||
ifneq ($(SILENT),s)
|
||||
$(info Using Makefile: $(realpath $(firstword $(MAKEFILE_LIST))) $(MAKECMDGOALS))
|
||||
endif
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
ifeq ($(SILENT),s)
|
||||
QUIET = 1
|
||||
endif
|
||||
|
||||
ifdef QUIET
|
||||
.SILENT:
|
||||
PQ = "QUIET=1"
|
||||
PD = --no-print-directory
|
||||
endif
|
||||
|
||||
CBMS = c128 \
|
||||
c16 \
|
||||
c64 \
|
||||
c65 \
|
||||
cbm510 \
|
||||
cbm610 \
|
||||
cx16 \
|
||||
mega65 \
|
||||
pet \
|
||||
plus4 \
|
||||
vic20
|
||||
@@ -15,7 +33,8 @@ CBMS = c128 \
|
||||
GEOS = geos-apple \
|
||||
geos-cbm
|
||||
|
||||
TARGETS = apple2 \
|
||||
TARGETS = agat \
|
||||
apple2 \
|
||||
apple2enh \
|
||||
atari \
|
||||
atarixl \
|
||||
@@ -124,7 +143,7 @@ zip:
|
||||
$(foreach dir,$(OUTPUTDIRS),$(ZIP_recipe))
|
||||
|
||||
$(TARGETS): | ../lib
|
||||
@$(MAKE) --no-print-directory $@
|
||||
@$(MAKE) $(PD) $@ $(PQ)
|
||||
|
||||
# ../lib must be created globally before doing lib targets in parallel
|
||||
../lib:
|
||||
@@ -243,8 +262,8 @@ $1_DYNS = $$(patsubst $$($1_SRCPAT),$$($1_DYNPAT),$$($1_SRCS))
|
||||
$1_DRVS = $$(patsubst $$($1_DYNPAT),$$($1_DRVPAT),$$($1_DYNS))
|
||||
|
||||
$$($1_STCPAT): $$($1_SRCPAT)
|
||||
@echo $$(TARGET) - $$< - static
|
||||
@$$(CA65) -t $$(TARGET) -D DYN_DRV=0 $$(CA65FLAGS) --create-dep $$(@:.o=.d) -o $$@ $$<
|
||||
$$(if $$(QUIET),@echo $$(TARGET) - $$< - static)
|
||||
$$(CA65) -t $$(TARGET) -D DYN_DRV=0 $$(CA65FLAGS) --create-dep $$(@:.o=.d) -o $$@ $$<
|
||||
|
||||
OBJS += $$($1_STCS)
|
||||
DEPS += $$($1_STCS:.o=.d)
|
||||
@@ -252,8 +271,8 @@ DEPS += $$($1_STCS:.o=.d)
|
||||
$$($1_DYNS): | $$($1_DYNDIR)
|
||||
|
||||
$$($1_DRVPAT): $$($1_DYNPAT) $$(ZPOBJ) | $$($1_DRVDIR)
|
||||
@echo $$(TARGET) - $$(<F)
|
||||
@$$(LD65) -o $$@ -t module $$^
|
||||
$$(if $$(QUIET),@echo $$(TARGET) - $$(<F))
|
||||
$$(LD65) -o $$@ -t module $$^
|
||||
|
||||
$$($1_DYNDIR) $$($1_DRVDIR):
|
||||
@$$(call MKDIR,$$@)
|
||||
@@ -275,16 +294,16 @@ export CC65_HOME := $(abspath ..)
|
||||
|
||||
define ASSEMBLE_recipe
|
||||
|
||||
$(if $(QUIET),,@echo $(TARGET) - $<)
|
||||
@$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:.o=.d) -o $@ $<
|
||||
$(if $(QUIET),@echo $(TARGET) - $<)
|
||||
$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:.o=.d) -o $@ $<
|
||||
|
||||
endef # ASSEMBLE_recipe
|
||||
|
||||
define COMPILE_recipe
|
||||
|
||||
$(if $(QUIET),,@echo $(TARGET) - $<)
|
||||
@$(CC65) -t $(TARGET) $(CC65FLAGS) --create-dep $(@:.o=.d) --dep-target $@ -o $(@:.o=.s) $<
|
||||
@$(CA65) -t $(TARGET) -o $@ $(@:.o=.s)
|
||||
$(if $(QUIET),@echo $(TARGET) - $<)
|
||||
$(CC65) -t $(TARGET) $(CC65FLAGS) --create-dep $(@:.o=.d) --dep-target $@ -o $(@:.o=.s) $<
|
||||
$(CA65) -t $(TARGET) -o $@ $(@:.o=.s)
|
||||
|
||||
endef # COMPILE_recipe
|
||||
|
||||
@@ -295,12 +314,13 @@ endef # COMPILE_recipe
|
||||
$(COMPILE_recipe)
|
||||
|
||||
$(EXTRA_OBJPAT): $(EXTRA_SRCPAT) | ../libwrk/$(TARGET) ../lib
|
||||
@echo $(TARGET) - $(<F)
|
||||
$(if $(QUIET),@echo $(TARGET) - $(<F))
|
||||
@$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:../lib/%.o=../libwrk/$(TARGET)/%.d) -o $@ $<
|
||||
|
||||
$(EXTRA_OBJS): | ../lib
|
||||
|
||||
../lib/$(TARGET).lib: $(OBJS) | ../lib
|
||||
$(if $(QUIET),@echo $(TARGET) - $<)
|
||||
$(AR65) a $@ $?
|
||||
|
||||
../libwrk/$(TARGET) ../target/$(TARGET)/util:
|
||||
|
||||
23
libsrc/agat/_scrsize.s
Normal file
23
libsrc/agat/_scrsize.s
Normal file
@@ -0,0 +1,23 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
; Konstantin Fedorov, 12.06.2025
|
||||
;
|
||||
; Screen size variables
|
||||
;
|
||||
|
||||
.export screensize
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
screensize:
|
||||
lda WNDWDTH
|
||||
bit TATTR
|
||||
bmi t64
|
||||
lsr
|
||||
t64:
|
||||
tax
|
||||
lda WNDBTM
|
||||
sec
|
||||
sbc WNDTOP
|
||||
tay
|
||||
rts
|
||||
113
libsrc/agat/break.s
Normal file
113
libsrc/agat/break.s
Normal file
@@ -0,0 +1,113 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 27.09.1998
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; void __fastcall__ set_brk (unsigned Addr);
|
||||
; void reset_brk (void);
|
||||
;
|
||||
|
||||
.export _set_brk, _reset_brk
|
||||
.destructor _reset_brk
|
||||
|
||||
; Be sure to export the following variables absolute
|
||||
.export _brk_a: abs, _brk_x: abs, _brk_y: abs
|
||||
.export _brk_sr: abs, _brk_pc: abs
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
_brk_a = $45
|
||||
_brk_x = $46
|
||||
_brk_y = $47
|
||||
_brk_sr = $48
|
||||
_brk_sp = $49
|
||||
_brk_pc = $3A
|
||||
|
||||
.bss
|
||||
oldvec: .res 2 ; Old vector
|
||||
|
||||
|
||||
.data
|
||||
uservec: jmp $FFFF ; Patched at runtime
|
||||
|
||||
|
||||
.code
|
||||
|
||||
; Set the break vector
|
||||
.proc _set_brk
|
||||
|
||||
sta uservec+1
|
||||
stx uservec+2 ; Set the user vector
|
||||
|
||||
lda oldvec
|
||||
ora oldvec+1 ; Did we save the vector already?
|
||||
bne L1 ; Jump if we installed the handler already
|
||||
|
||||
lda BRKVec
|
||||
sta oldvec
|
||||
lda BRKVec+1
|
||||
sta oldvec+1 ; Save the old vector
|
||||
|
||||
L1: lda #<brk_handler ; Set the break vector to our routine
|
||||
ldx #>brk_handler
|
||||
sta BRKVec
|
||||
stx BRKVec+1
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
; Reset the break vector
|
||||
.proc _reset_brk
|
||||
|
||||
lda oldvec
|
||||
ldx oldvec+1
|
||||
beq @L9 ; Jump if vector not installed
|
||||
sta BRKVec
|
||||
stx BRKVec+1
|
||||
lda #$00
|
||||
sta oldvec ; Clear the old vector
|
||||
stx oldvec+1
|
||||
@L9: rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
; Break handler, called if a break occurs
|
||||
|
||||
.proc brk_handler
|
||||
|
||||
sec
|
||||
lda _brk_pc
|
||||
sbc #$02 ; Point to start of brk
|
||||
sta _brk_pc
|
||||
lda _brk_pc+1
|
||||
sbc #$00
|
||||
sta _brk_pc+1
|
||||
|
||||
clc
|
||||
lda _brk_sp
|
||||
adc #$04 ; Adjust stack pointer
|
||||
sta _brk_sp
|
||||
|
||||
lda _brk_sr ; Clear brk
|
||||
and #$EF
|
||||
sta _brk_sr
|
||||
|
||||
jsr uservec ; Call the user's routine
|
||||
|
||||
lda _brk_pc+1
|
||||
pha
|
||||
lda _brk_pc
|
||||
pha
|
||||
lda _brk_sr
|
||||
pha
|
||||
|
||||
ldx _brk_x
|
||||
ldy _brk_y
|
||||
lda _brk_a
|
||||
|
||||
rti ; Jump back...
|
||||
|
||||
.endproc
|
||||
|
||||
18
libsrc/agat/cclear.s
Normal file
18
libsrc/agat/cclear.s
Normal file
@@ -0,0 +1,18 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; void __fastcall__ cclear (unsigned char length);
|
||||
;
|
||||
|
||||
.export _cclear
|
||||
.import COUT
|
||||
.include "zeropage.inc"
|
||||
|
||||
_cclear:
|
||||
sta ptr1
|
||||
lda #$A0
|
||||
next:
|
||||
jsr COUT
|
||||
dec ptr1
|
||||
bne next
|
||||
rts
|
||||
23
libsrc/agat/cgetc.s
Normal file
23
libsrc/agat/cgetc.s
Normal file
@@ -0,0 +1,23 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; char cgetc (void);
|
||||
;
|
||||
|
||||
.export _cgetc
|
||||
.import cursor
|
||||
.include "agat.inc"
|
||||
|
||||
_cgetc:
|
||||
lda #$DF ; _
|
||||
bit cursor
|
||||
bne hascur
|
||||
lda #$00
|
||||
hascur:
|
||||
sta CURSOR
|
||||
jsr j1
|
||||
cmp #$A0
|
||||
bpl :+
|
||||
and #$7F
|
||||
: rts
|
||||
j1: jmp (VCIN)
|
||||
33
libsrc/agat/chline.s
Normal file
33
libsrc/agat/chline.s
Normal file
@@ -0,0 +1,33 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
; Colin Leroy-Mira, 26.05.2025
|
||||
; Konstantin Fedorov, 12.06.2025
|
||||
;
|
||||
; void chlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void chline (unsigned char length);
|
||||
;
|
||||
|
||||
.export _chlinexy, _chline, chlinedirect
|
||||
.import gotoxy, putchar
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
_chlinexy:
|
||||
pha ; Save the length
|
||||
jsr gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _chline
|
||||
|
||||
_chline:
|
||||
ldx #$1B ; horizontal line character
|
||||
|
||||
chlinedirect:
|
||||
stx tmp1
|
||||
cmp #$00 ; Is the length zero?
|
||||
beq done ; Jump if done
|
||||
sta tmp2
|
||||
: lda tmp1 ; Screen code
|
||||
jsr putchar ; Direct output
|
||||
dec tmp2
|
||||
bne :-
|
||||
done: rts
|
||||
|
||||
10
libsrc/agat/clrscr.s
Normal file
10
libsrc/agat/clrscr.s
Normal file
@@ -0,0 +1,10 @@
|
||||
;
|
||||
; Kevin Ruland
|
||||
;
|
||||
; void clrscr (void);
|
||||
;
|
||||
|
||||
.export _clrscr
|
||||
.import HOME
|
||||
|
||||
_clrscr := HOME
|
||||
20
libsrc/agat/color.s
Normal file
20
libsrc/agat/color.s
Normal file
@@ -0,0 +1,20 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; unsigned char __fastcall__ textcolor (unsigned char color);
|
||||
;
|
||||
|
||||
|
||||
.export _textcolor
|
||||
.include "agat.inc"
|
||||
|
||||
|
||||
_textcolor:
|
||||
ldx TATTR
|
||||
eor TATTR
|
||||
and #$07
|
||||
eor TATTR
|
||||
sta TATTR
|
||||
txa
|
||||
and #$0F
|
||||
rts
|
||||
14
libsrc/agat/cout.s
Normal file
14
libsrc/agat/cout.s
Normal file
@@ -0,0 +1,14 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; COUT routine
|
||||
;
|
||||
|
||||
.export COUT
|
||||
.include "agat.inc"
|
||||
|
||||
COUT:
|
||||
cmp #$10
|
||||
bpl out
|
||||
ora #$80
|
||||
out: jmp (VCOUT)
|
||||
60
libsrc/agat/cputc.s
Normal file
60
libsrc/agat/cputc.s
Normal file
@@ -0,0 +1,60 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
; Konstantin Fedorov, 12.06.2025
|
||||
;
|
||||
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
|
||||
.import COUT
|
||||
.export _cputcxy, _cputc, newline, putchar,putchardirect
|
||||
.import gotoxy, VTABZ
|
||||
.include "agat.inc"
|
||||
|
||||
_cputcxy:
|
||||
pha
|
||||
jsr gotoxy
|
||||
pla
|
||||
_cputc:
|
||||
cmp #$0D ; Test for \r = carriage return
|
||||
bne notleft
|
||||
ldy #$00
|
||||
sty CH
|
||||
rts
|
||||
notleft:
|
||||
cmp #$0A ; Test for \n = line feed
|
||||
beq newline
|
||||
|
||||
putchar:
|
||||
ldy CH
|
||||
sta (BASL),Y
|
||||
iny
|
||||
lda TATTR
|
||||
bmi wch ; Skip if t64
|
||||
sta (BASL),Y
|
||||
iny
|
||||
wch:
|
||||
sty CH
|
||||
cpy WNDWDTH
|
||||
bcc noend
|
||||
ldy #$00
|
||||
sty CH
|
||||
newline:
|
||||
inc CV
|
||||
lda CV
|
||||
cmp WNDBTM
|
||||
bcc :+
|
||||
lda WNDTOP
|
||||
sta CV
|
||||
: jmp VTABZ
|
||||
noend:
|
||||
rts
|
||||
|
||||
putchardirect:
|
||||
ldy CH
|
||||
sta (BASL),Y
|
||||
lda TATTR
|
||||
bmi :+
|
||||
iny
|
||||
sta (BASL),Y
|
||||
: rts
|
||||
78
libsrc/agat/crt0.s
Normal file
78
libsrc/agat/crt0.s
Normal file
@@ -0,0 +1,78 @@
|
||||
;
|
||||
; Startup code for cc65 (Agat version)
|
||||
;
|
||||
|
||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||
.export _exit
|
||||
|
||||
.import initlib, donelib
|
||||
.import zerobss, callmain
|
||||
.import __ONCE_LOAD__, __ONCE_SIZE__ ; Linker generated
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "agat.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.segment "STARTUP"
|
||||
jsr init
|
||||
jsr zerobss
|
||||
jsr callmain
|
||||
_exit:
|
||||
ldx #<exit
|
||||
lda #>exit
|
||||
jsr reset
|
||||
jsr donelib
|
||||
exit:
|
||||
ldx #$02
|
||||
: lda rvsave,x
|
||||
sta SOFTEV,x
|
||||
dex
|
||||
bpl :-
|
||||
ldx #zpspace-1
|
||||
: lda zpsave,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl :-
|
||||
ldx #$FF
|
||||
txs
|
||||
jmp DOSWARM
|
||||
|
||||
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
init:
|
||||
ldx #zpspace-1
|
||||
: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
ldx #$02
|
||||
: lda SOFTEV,x
|
||||
sta rvsave,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
lda HIMEM
|
||||
ldx HIMEM+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
ldx #<_exit
|
||||
lda #>_exit
|
||||
jsr reset
|
||||
jmp initlib
|
||||
|
||||
.code
|
||||
|
||||
reset:
|
||||
stx SOFTEV
|
||||
sta SOFTEV+1
|
||||
eor #$A5
|
||||
sta PWREDUP
|
||||
rts
|
||||
|
||||
.segment "INIT"
|
||||
zpsave: .res zpspace
|
||||
rvsave: .res 3
|
||||
29
libsrc/agat/cvline.s
Normal file
29
libsrc/agat/cvline.s
Normal file
@@ -0,0 +1,29 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
; Colin Leroy-Mira, 26.05.2025
|
||||
; Konstantin Fedorov, 12.06.2025
|
||||
;
|
||||
; void cvlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void cvline (unsigned char length);
|
||||
;
|
||||
|
||||
.export _cvlinexy, _cvline
|
||||
.import gotoxy, putchardirect, newline
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
_cvlinexy:
|
||||
pha ; Save the length
|
||||
jsr gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _cvline
|
||||
|
||||
_cvline:
|
||||
cmp #$00 ; Is the length zero?
|
||||
beq done ; Jump if done
|
||||
sta tmp2
|
||||
: lda #$5C ; vertical line character
|
||||
jsr putchardirect ; Write, no cursor advance
|
||||
jsr newline ; Advance cursor to next line
|
||||
dec tmp2
|
||||
bne :-
|
||||
done: rts
|
||||
43
libsrc/agat/exehdr.s
Normal file
43
libsrc/agat/exehdr.s
Normal file
@@ -0,0 +1,43 @@
|
||||
;
|
||||
; Oliver Schmidt, 2012-06-10
|
||||
;
|
||||
; This module supplies an AppleSingle version 2 file header + entry with
|
||||
; ID 11 according to https://tools.ietf.org/rfc/rfc1740.txt Appendix A.
|
||||
;
|
||||
; Agat target uses this header only for compatibility with Apple Commander
|
||||
; because Agat's 140K disk filesystem is identical to Apple II DOS 3.3 and
|
||||
; "ac.jar -as" option can be used to import binaries into disk images.
|
||||
|
||||
.export __EXEHDR__ : absolute = 1 ; Linker referenced
|
||||
.import __FILETYPE__ ; Linker generated
|
||||
.import __MAIN_START__, __MAIN_LAST__ ; Linker generated
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
; Data Fork
|
||||
ID01_LENGTH = __MAIN_LAST__ - __MAIN_START__
|
||||
ID01_OFFSET = ID01 - START
|
||||
|
||||
; ProDOS File Info
|
||||
ID11_LENGTH = ID01 - ID11
|
||||
ID11_OFFSET = ID11 - START
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.segment "EXEHDR"
|
||||
|
||||
START: .byte $00, $05, $16, $00 ; Magic number
|
||||
.byte $00, $02, $00, $00 ; Version number
|
||||
.res 16 ; Filler
|
||||
.byte 0, 2 ; Number of entries
|
||||
.byte 0, 0, 0, 1 ; Entry ID 1 - Data Fork
|
||||
.byte 0, 0, >ID01_OFFSET, <ID01_OFFSET ; Offset
|
||||
.byte 0, 0, >ID01_LENGTH, <ID01_LENGTH ; Length
|
||||
.byte 0, 0, 0, 11 ; Entry ID 11 - ProDOS File Info
|
||||
.byte 0, 0, >ID11_OFFSET, <ID11_OFFSET ; Offset
|
||||
.byte 0, 0, >ID11_LENGTH, <ID11_LENGTH ; Length
|
||||
ID11: .byte 0, %11000011 ; Access - Destroy, Rename, Write, Read
|
||||
.byte >__FILETYPE__, <__FILETYPE__ ; File Type
|
||||
.byte 0, 0 ; Auxiliary Type high
|
||||
.byte >__MAIN_START__, <__MAIN_START__ ; Auxiliary Type low
|
||||
ID01:
|
||||
28
libsrc/agat/gotoxy.s
Normal file
28
libsrc/agat/gotoxy.s
Normal file
@@ -0,0 +1,28 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; void __fastcall__ gotoxy (unsigned char x, unsigned char y);
|
||||
; void __fastcall__ gotox (unsigned char x);
|
||||
;
|
||||
|
||||
.export gotoxy, _gotoxy, _gotox
|
||||
.import popa, VTABZ
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
gotoxy:
|
||||
jsr popa ; Get Y
|
||||
_gotoxy:
|
||||
clc
|
||||
adc WNDTOP
|
||||
sta CV ; Store Y
|
||||
jsr VTABZ
|
||||
jsr popa ; Get X
|
||||
_gotox:
|
||||
bit TATTR
|
||||
bmi t64
|
||||
asl
|
||||
t64:
|
||||
sta CH ; Store X
|
||||
rts
|
||||
16
libsrc/agat/gotoy.s
Normal file
16
libsrc/agat/gotoy.s
Normal file
@@ -0,0 +1,16 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; void __fastcall__ gotoy (unsigned char y);
|
||||
;
|
||||
|
||||
.import VTABZ
|
||||
.export _gotoy
|
||||
.include "agat.inc"
|
||||
|
||||
_gotoy:
|
||||
clc
|
||||
adc WNDTOP
|
||||
sta CV
|
||||
jmp VTABZ
|
||||
15
libsrc/agat/home.s
Normal file
15
libsrc/agat/home.s
Normal file
@@ -0,0 +1,15 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; HOME routine
|
||||
;
|
||||
|
||||
.export HOME
|
||||
.import COUT
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
HOME:
|
||||
lda #$8C
|
||||
jmp COUT
|
||||
rts
|
||||
19
libsrc/agat/kbhit.s
Normal file
19
libsrc/agat/kbhit.s
Normal file
@@ -0,0 +1,19 @@
|
||||
;
|
||||
; Kevin Ruland
|
||||
; Ullrich von Bassewitz, 2005-03-25
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; unsigned char kbhit (void);
|
||||
;
|
||||
|
||||
.export _kbhit
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
_kbhit:
|
||||
lda KBD ; Reading KBD checks for keypress
|
||||
rol ; if high bit is set, key was pressed
|
||||
lda #$00
|
||||
tax
|
||||
rol
|
||||
rts
|
||||
18
libsrc/agat/randomize.s
Normal file
18
libsrc/agat/randomize.s
Normal file
@@ -0,0 +1,18 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 07.11.2002
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; void _randomize (void);
|
||||
; /* Initialize the random number generator */
|
||||
;
|
||||
|
||||
.export __randomize
|
||||
.import _srand
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
__randomize:
|
||||
ldx RNDH ; Use random value supplied by ROM
|
||||
lda RNDL
|
||||
jmp _srand ; Initialize generator
|
||||
|
||||
38
libsrc/agat/revers.s
Normal file
38
libsrc/agat/revers.s
Normal file
@@ -0,0 +1,38 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2005-03-28
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; unsigned char __fastcall__ revers (unsigned char onoff)
|
||||
; unsigned char __fastcall__ flash (unsigned char onoff)
|
||||
;
|
||||
|
||||
.export _revers, _flash
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
_revers:
|
||||
tax
|
||||
beq noinv
|
||||
lda TATTR
|
||||
and #$D7
|
||||
sta TATTR
|
||||
rts
|
||||
noinv:
|
||||
lda TATTR
|
||||
ora #$20
|
||||
sta TATTR
|
||||
rts
|
||||
|
||||
_flash:
|
||||
tax
|
||||
beq noflash
|
||||
lda TATTR
|
||||
and #$DF
|
||||
ora #$08
|
||||
sta TATTR
|
||||
rts
|
||||
noflash:
|
||||
lda TATTR
|
||||
ora #$20
|
||||
sta TATTR
|
||||
rts
|
||||
37
libsrc/agat/sysuname.s
Normal file
37
libsrc/agat/sysuname.s
Normal file
@@ -0,0 +1,37 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2003-08-12
|
||||
;
|
||||
; unsigned char __fastcall__ _sysuname (struct utsname* buf);
|
||||
;
|
||||
|
||||
.export __sysuname, utsdata
|
||||
|
||||
.import utscopy
|
||||
|
||||
__sysuname = utscopy
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
; Data. We define a fixed utsname struct here and just copy it.
|
||||
|
||||
.rodata
|
||||
|
||||
utsdata:
|
||||
; sysname
|
||||
.asciiz "cc65"
|
||||
|
||||
; nodename
|
||||
.asciiz ""
|
||||
|
||||
; release
|
||||
.byte .string (>.version)
|
||||
.byte '.'
|
||||
.byte .string (<.version)
|
||||
.byte $00
|
||||
|
||||
; version
|
||||
.byte '0' ; unused
|
||||
.byte $00
|
||||
|
||||
; machine
|
||||
.asciiz "Agat"
|
||||
|
||||
24
libsrc/agat/vtabz.s
Normal file
24
libsrc/agat/vtabz.s
Normal file
@@ -0,0 +1,24 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; VTABZ routine
|
||||
;
|
||||
|
||||
.export VTABZ
|
||||
.include "agat.inc"
|
||||
|
||||
VTABZ:
|
||||
lda CV
|
||||
ror
|
||||
ror
|
||||
ror
|
||||
and #$C0
|
||||
sta BASL
|
||||
lda CV
|
||||
lsr
|
||||
lsr
|
||||
eor BASH
|
||||
and #$07
|
||||
eor BASH
|
||||
sta BASH
|
||||
rts
|
||||
19
libsrc/agat/wherex.s
Normal file
19
libsrc/agat/wherex.s
Normal file
@@ -0,0 +1,19 @@
|
||||
;
|
||||
; Kevin Ruland
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; unsigned char wherex (void);
|
||||
;
|
||||
|
||||
.export _wherex
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
_wherex:
|
||||
lda CH
|
||||
bit TATTR
|
||||
bmi t64
|
||||
lsr
|
||||
t64:
|
||||
ldx #$00
|
||||
rts
|
||||
17
libsrc/agat/wherey.s
Normal file
17
libsrc/agat/wherey.s
Normal file
@@ -0,0 +1,17 @@
|
||||
;
|
||||
; Kevin Ruland
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; unsigned char wherey (void);
|
||||
;
|
||||
|
||||
.export _wherey
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
_wherey:
|
||||
lda CV
|
||||
sec
|
||||
sbc WNDTOP
|
||||
ldx #$00
|
||||
rts
|
||||
50
libsrc/agat/write.s
Normal file
50
libsrc/agat/write.s
Normal file
@@ -0,0 +1,50 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; int __fastcall__ write (int fd, const void* buf, unsigned count);
|
||||
;
|
||||
|
||||
.export _write
|
||||
.import popax, popptr1
|
||||
.import COUT
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
_write:
|
||||
sta ptr2
|
||||
stx ptr2+1
|
||||
jsr popptr1
|
||||
jsr popax
|
||||
|
||||
; Check for zero count
|
||||
ora ptr2
|
||||
beq done
|
||||
|
||||
; Get char from buf
|
||||
next: ldy #$00
|
||||
lda (ptr1),y
|
||||
|
||||
; Replace '\n' with '\r'
|
||||
cmp #$0A
|
||||
bne output
|
||||
lda #$8D
|
||||
|
||||
; Set hi bit and write to device
|
||||
output:
|
||||
jsr COUT ; Preserves X and Y
|
||||
|
||||
; Increment pointer
|
||||
inc ptr1
|
||||
bne :+
|
||||
inc ptr1+1
|
||||
|
||||
; Decrement count
|
||||
: dec ptr2
|
||||
bne next
|
||||
dec ptr2+1
|
||||
bpl next
|
||||
|
||||
; Return success
|
||||
done: lda #$00
|
||||
rts
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
; unsigned char __fastcall__ allow_lowercase (unsigned char onoff);
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.export _allow_lowercase
|
||||
.import uppercasemask, return0, return1
|
||||
.import return0
|
||||
.import uppercasemask, return1
|
||||
|
||||
_allow_lowercase:
|
||||
tax
|
||||
@@ -21,3 +24,5 @@ _allow_lowercase:
|
||||
|
||||
values: .byte $DF ; Force uppercase
|
||||
.byte $FF ; Keep lowercase
|
||||
|
||||
.endif
|
||||
|
||||
73
libsrc/apple2/boxchars.s
Normal file
73
libsrc/apple2/boxchars.s
Normal file
@@ -0,0 +1,73 @@
|
||||
;
|
||||
; Colin Leroy-Mira and Oliver Schmidt, 26.05.2025
|
||||
;
|
||||
; Initialize box-drawing characters according to
|
||||
; MouseText availability
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.constructor initboxchars
|
||||
.import machinetype
|
||||
|
||||
.export _CH_HLINE
|
||||
.export _CH_VLINE
|
||||
.export _CH_ULCORNER
|
||||
.export _CH_URCORNER
|
||||
.export _CH_LLCORNER
|
||||
.export _CH_LRCORNER
|
||||
.export _CH_TTEE
|
||||
.export _CH_BTEE
|
||||
.export _CH_LTEE
|
||||
.export _CH_RTEE
|
||||
.export _CH_CROSS
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
initboxchars:
|
||||
bit machinetype ; IIe enhanced or newer?
|
||||
bvs out
|
||||
|
||||
ldx #NUM_BOXCHARS ; No mousetext, patch characters
|
||||
: lda std_boxchars,x
|
||||
sta boxchars,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
out: rts
|
||||
|
||||
; Replacement chars for when MouseText is not available
|
||||
std_boxchars: .byte '!'
|
||||
.byte '-'
|
||||
.byte '+'
|
||||
.byte '+'
|
||||
.byte '+'
|
||||
.byte '+'
|
||||
|
||||
.data
|
||||
|
||||
; MouseText-based box characters
|
||||
boxchars:
|
||||
VERT: .byte $DF
|
||||
HORIZ: .byte $5F
|
||||
ULCORNER: .byte $5F
|
||||
URCORNER: .byte $20
|
||||
LLCORNER: .byte $D4
|
||||
LRCORNER: .byte $DF
|
||||
|
||||
NUM_BOXCHARS = *-boxchars
|
||||
|
||||
; exported symbols, referencing our 6 bytes
|
||||
_CH_HLINE = HORIZ
|
||||
_CH_VLINE = VERT
|
||||
_CH_ULCORNER = ULCORNER
|
||||
_CH_URCORNER = URCORNER
|
||||
_CH_LLCORNER = LLCORNER
|
||||
_CH_LRCORNER = LRCORNER
|
||||
_CH_TTEE = ULCORNER
|
||||
_CH_BTEE = LLCORNER
|
||||
_CH_LTEE = LLCORNER
|
||||
_CH_RTEE = LRCORNER
|
||||
_CH_CROSS = LLCORNER
|
||||
|
||||
.endif ; not __APPLE2ENH__
|
||||
@@ -54,7 +54,7 @@ exit: ldx #$02
|
||||
; Copy back the zero-page stuff.
|
||||
ldx #zpspace-1
|
||||
: lda zpsave,x
|
||||
sta sp,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
;
|
||||
|
||||
.export _cgetc
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
.import cursor, putchardirect
|
||||
|
||||
.include "zeropage.inc"
|
||||
@@ -18,11 +22,14 @@ _cgetc:
|
||||
beq :+
|
||||
|
||||
; Show caret.
|
||||
.ifdef __APPLE2ENH__
|
||||
lda #$7F | $80 ; Checkerboard, screen code
|
||||
.else
|
||||
.ifndef __APPLE2ENH__
|
||||
lda #' ' | $40 ; Blank, flashing
|
||||
bit machinetype
|
||||
bpl put_caret
|
||||
.endif
|
||||
|
||||
lda #$7F | $80 ; Checkerboard, screen code
|
||||
put_caret:
|
||||
jsr putchardirect ; Saves old character in tmp3
|
||||
|
||||
; Wait for keyboard strobe.
|
||||
@@ -44,10 +51,14 @@ _cgetc:
|
||||
|
||||
; At this time, the high bit of the key pressed is set.
|
||||
: bit KBDSTRB ; Clear keyboard strobe
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype ; Apple //e or more recent?
|
||||
bpl clear
|
||||
.endif
|
||||
bit BUTN0 ; Check if OpenApple is down
|
||||
bmi done
|
||||
.endif
|
||||
and #$7F ; If not down, then clear high bit
|
||||
|
||||
clear: and #$7F ; If not down, then clear high bit
|
||||
done: ldx #>$0000
|
||||
rts
|
||||
|
||||
@@ -4,14 +4,24 @@
|
||||
; char cpeekc (void);
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
|
||||
.export _cpeekc
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
_cpeekc:
|
||||
ldy CH
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
sec ; Assume main memory
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl peek
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl peek ; No, just go ahead
|
||||
lda OURCH
|
||||
@@ -21,13 +31,12 @@ _cpeekc:
|
||||
php
|
||||
sei ; No valid MSLOT et al. in aux memory
|
||||
bit HISCR ; Assume SET80COL
|
||||
.endif
|
||||
|
||||
peek: lda (BASL),Y ; Get character
|
||||
.ifdef __APPLE2ENH__
|
||||
bcs :+ ; In main memory
|
||||
bit LOWSCR
|
||||
plp
|
||||
: .endif
|
||||
eor #$80 ; Invert high bit
|
||||
|
||||
: eor #$80 ; Invert high bit
|
||||
ldx #>$0000
|
||||
rts
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
.constructor initconio
|
||||
.endif
|
||||
.export _cputcxy, _cputc
|
||||
.export cputdirect, newline, putchar, putchardirect
|
||||
.import gotoxy, VTABZ
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.import uppercasemask
|
||||
.endif
|
||||
|
||||
@@ -22,12 +22,16 @@
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
initconio:
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bmi :+
|
||||
rts
|
||||
:
|
||||
.endif
|
||||
sta SETALTCHAR ; Switch in alternate charset
|
||||
bit LORES ; Limit SET80COL-HISCR to text
|
||||
rts
|
||||
.endif
|
||||
|
||||
.code
|
||||
|
||||
@@ -52,14 +56,22 @@ _cputc:
|
||||
|
||||
cputdirect:
|
||||
jsr putchar
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl :+
|
||||
.endif
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl :+
|
||||
inc OURCH ; Bump to next column
|
||||
lda OURCH
|
||||
.ifdef __APPLE2ENH__
|
||||
bra check ; Must leave CH alone
|
||||
: .endif
|
||||
inc CH ; Bump to next column
|
||||
.else
|
||||
jmp check
|
||||
.endif
|
||||
|
||||
: inc CH ; Bump to next column
|
||||
lda CH
|
||||
check: cmp WNDWDTH
|
||||
bcc done
|
||||
@@ -67,13 +79,24 @@ check: cmp WNDWDTH
|
||||
left:
|
||||
.ifdef __APPLE2ENH__
|
||||
stz CH ; Goto left edge of screen
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl done
|
||||
stz OURCH ; Goto left edge of screen
|
||||
.else
|
||||
lda #$00 ; Goto left edge of screen
|
||||
lda #$00
|
||||
sta CH
|
||||
.endif
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl done
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl done
|
||||
.ifdef __APPLE2ENH__
|
||||
stz OURCH ; Goto left edge of screen
|
||||
.else
|
||||
sta OURCH
|
||||
.endif
|
||||
|
||||
done: rts
|
||||
|
||||
newline:
|
||||
@@ -100,8 +123,14 @@ mask: and INVFLG ; Apply normal, inverse, flash
|
||||
putchardirect:
|
||||
tax
|
||||
ldy CH
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
sec ; Assume main memory
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl put
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl put ; No, just go ahead
|
||||
lda OURCH
|
||||
@@ -111,14 +140,13 @@ putchardirect:
|
||||
php
|
||||
sei ; No valid MSLOT et al. in aux memory
|
||||
bit HISCR ; Assume SET80COL
|
||||
.endif
|
||||
|
||||
put: lda (BASL),Y ; Get current character
|
||||
sta tmp3 ; Save old character for _cgetc
|
||||
txa
|
||||
sta (BASL),Y
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
bcs :+ ; In main memory
|
||||
bit LOWSCR
|
||||
plp
|
||||
: .endif
|
||||
rts
|
||||
: rts
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
; Save the zero-page locations that we need.
|
||||
init: ldx #zpspace-1
|
||||
: lda sp,x
|
||||
: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl :-
|
||||
@@ -56,8 +56,10 @@ init: ldx #zpspace-1
|
||||
bpl :-
|
||||
|
||||
; Check for ProDOS.
|
||||
ldy $BF00 ; MLI call entry point
|
||||
cpy #$4C ; Is MLI present? (JMP opcode)
|
||||
lda $BF00 ; MLI call entry point
|
||||
sec
|
||||
sbc #$4C ; Is MLI present? (JMP opcode)
|
||||
pha ; Backup the result for later
|
||||
bne basic
|
||||
|
||||
; Check the ProDOS system bit map.
|
||||
@@ -81,8 +83,8 @@ basic: lda HIMEM
|
||||
ldx HIMEM+1
|
||||
|
||||
; Set up the C stack.
|
||||
: sta sp
|
||||
stx sp+1
|
||||
: sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
; ProDOS TechRefMan, chapter 5.3.5:
|
||||
; "Your system program should place in the RESET vector the
|
||||
@@ -99,7 +101,20 @@ basic: lda HIMEM
|
||||
bit $C081
|
||||
bit $C081
|
||||
|
||||
; Set the source start address.
|
||||
pla ; If not running ProDOS, we need to patch 6502 vectors.
|
||||
beq :+
|
||||
|
||||
lda #<reset_6502
|
||||
ldx #>reset_6502
|
||||
sta ROM_RST
|
||||
stx ROM_RST+1
|
||||
|
||||
lda #<irq_6502
|
||||
ldx #>irq_6502
|
||||
sta ROM_IRQ
|
||||
stx ROM_IRQ+1
|
||||
|
||||
: ; Set the source start address.
|
||||
; Aka __LC_LOAD__ iff segment LC exists.
|
||||
lda #<(__ONCE_LOAD__ + __ONCE_SIZE__)
|
||||
ldy #>(__ONCE_LOAD__ + __ONCE_SIZE__)
|
||||
@@ -144,6 +159,14 @@ quit: jsr $BF00 ; MLI call entry point
|
||||
.byte $65 ; Quit
|
||||
.word q_param
|
||||
|
||||
reset_6502: ; Used with DOS3.3 programs
|
||||
bit $C082 ; Switch in ROM
|
||||
jmp (ROM_RST) ; Jump to ROM's RESET vector
|
||||
|
||||
irq_6502: ; Used with DOS3.3 programs
|
||||
bit $C082 ; Switch in ROM
|
||||
jmp (ROM_IRQ) ; Jump to ROM's IRQ/BRK vector
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.rodata
|
||||
|
||||
56
libsrc/apple2/detect80cols.s
Normal file
56
libsrc/apple2/detect80cols.s
Normal file
@@ -0,0 +1,56 @@
|
||||
;
|
||||
; Colin Leroy-Mira, 27/05/2025
|
||||
;
|
||||
; Verify the presence of a 80 columns card in slot 3,
|
||||
; and publish a flag accordingly.
|
||||
;
|
||||
.export aux80col
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
|
||||
.constructor detect80cols
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
.data
|
||||
|
||||
aux80col: .byte 0
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
IdOfsTable: ; Table of bytes positions, used to check four
|
||||
; specific bytes on the slot's firmware to make
|
||||
; sure this is a serial card.
|
||||
.byte $05 ; Pascal 1.0 ID byte
|
||||
.byte $07 ; Pascal 1.0 ID byte
|
||||
.byte $0B ; Pascal 1.1 generic signature byte
|
||||
.byte $0C ; Device signature byte
|
||||
|
||||
IdValTable: ; Table of expected values for the four checked
|
||||
; bytes
|
||||
.byte $38 ; ID Byte 0 (from Pascal 1.0), fixed
|
||||
.byte $18 ; ID Byte 1 (from Pascal 1.0), fixed
|
||||
.byte $01 ; Generic signature for Pascal 1.1, fixed
|
||||
.byte $88 ; Device signature byte (80 columns card)
|
||||
|
||||
IdTableLen = * - IdValTable
|
||||
|
||||
detect80cols:
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype ; Check we're on a //e at least, otherwise we
|
||||
bpl NoDev ; handle no 80cols hardware (like Videx)
|
||||
.endif
|
||||
|
||||
ldx #IdTableLen-1
|
||||
: ldy IdOfsTable,x ; Check Pascal 1.1 Firmware Protocol ID bytes
|
||||
lda IdValTable,x
|
||||
cmp $C300,y
|
||||
bne NoDev
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
dec aux80col ; We have an 80-columns card! Set flag to $FF
|
||||
|
||||
NoDev: rts
|
||||
41
libsrc/apple2/dynchline.s
Normal file
41
libsrc/apple2/dynchline.s
Normal file
@@ -0,0 +1,41 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
; Colin Leroy-Mira, 26.05.2025
|
||||
;
|
||||
; void __fastcall__ dyn_chlinexy (unsigned char c, unsigned char x, unsigned char y, unsigned char length);
|
||||
; void __fastcall__ dyn_chline (unsigned char c, unsigned char length);
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.export _dyn_chlinexy, _dyn_chline, chlinedirect
|
||||
.import gotoxy, cputdirect, popa
|
||||
.import machinetype
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "apple2.inc"
|
||||
|
||||
_dyn_chlinexy:
|
||||
pha ; Save the length
|
||||
jsr gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _chline
|
||||
|
||||
_dyn_chline:
|
||||
pha
|
||||
jsr popa ; Get the character to draw
|
||||
eor #$80 ; Invert high bit
|
||||
tax
|
||||
pla
|
||||
|
||||
chlinedirect:
|
||||
stx tmp1
|
||||
cmp #$00 ; Is the length zero?
|
||||
beq done ; Jump if done
|
||||
sta tmp2
|
||||
: lda tmp1 ; Screen code
|
||||
jsr cputdirect ; Direct output
|
||||
dec tmp2
|
||||
bne :-
|
||||
done: rts
|
||||
|
||||
.endif
|
||||
40
libsrc/apple2/dyncvline.s
Normal file
40
libsrc/apple2/dyncvline.s
Normal file
@@ -0,0 +1,40 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
; Colin Leroy-Mira, 26.05.2025
|
||||
;
|
||||
; void __fastcall__ dyn_cvlinexy (unsigned char c, unsigned char x, unsigned char y, unsigned char length);
|
||||
; void __fastcall__ dyn_cvline (unsigned char c, unsigned char length);
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.export _dyn_cvlinexy, _dyn_cvline
|
||||
.import gotoxy, putchar, newline, popa
|
||||
.import machinetype
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
_dyn_cvlinexy:
|
||||
pha ; Save the length
|
||||
jsr gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _cvline
|
||||
|
||||
_dyn_cvline:
|
||||
pha
|
||||
jsr popa ; Get the character to draw
|
||||
eor #$80 ; Invert high bit
|
||||
tax
|
||||
pla
|
||||
|
||||
stx tmp1
|
||||
cmp #$00 ; Is the length zero?
|
||||
beq done ; Jump if done
|
||||
sta tmp2
|
||||
: lda tmp1 ; Screen code
|
||||
jsr putchar ; Write, no cursor advance
|
||||
jsr newline ; Advance cursor to next line
|
||||
dec tmp2
|
||||
bne :-
|
||||
done: rts
|
||||
|
||||
.endif
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
.export _exec
|
||||
.import mli_file_info_direct
|
||||
.import aux80col
|
||||
.import pushname, popname, popax, done, _exit
|
||||
|
||||
.include "zeropage.inc"
|
||||
@@ -41,9 +42,9 @@ _exec:
|
||||
; binary programs so we should do the same too in any case
|
||||
; especially as _we_ rely on it in mainargs.s for argv[0]
|
||||
ldy #$00
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
tay
|
||||
: lda (sp),y
|
||||
: lda (c_sp),y
|
||||
sta $0280,y
|
||||
dey
|
||||
bpl :-
|
||||
@@ -115,7 +116,8 @@ setbuf: lda #$00 ; Low byte
|
||||
sta io_buffer
|
||||
stx io_buffer+1
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
bit aux80col
|
||||
bpl :+
|
||||
; Calling the 80 column firmware needs the ROM switched
|
||||
; in, otherwise it copies the F8 ROM to the LC (@ $CEF4)
|
||||
bit $C082
|
||||
@@ -128,9 +130,8 @@ setbuf: lda #$00 ; Low byte
|
||||
|
||||
; Switch in LC bank 2 for R/O
|
||||
bit $C080
|
||||
.endif
|
||||
|
||||
; Reset stack as we already passed
|
||||
: ; Reset stack as we already passed
|
||||
; the point of no return anyway
|
||||
ldx #$FF
|
||||
txs
|
||||
|
||||
@@ -54,18 +54,20 @@ iobuf_alloc:
|
||||
rts
|
||||
|
||||
; Mark table entry as used
|
||||
: lda #$FF
|
||||
sta table,x
|
||||
: dec table,x
|
||||
|
||||
; Convert table index to address hibyte
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
clc
|
||||
; Skip clearing carry, it can't be set as long as MAX_FDS*4 is
|
||||
; less than 64.
|
||||
.assert MAX_FDS*4 < $40, error
|
||||
adc #>$0800
|
||||
|
||||
; Store address in "memptr"
|
||||
ldy #$01
|
||||
; (Y still equals 0 from popptr1)
|
||||
iny
|
||||
sta (ptr1),y
|
||||
dey
|
||||
tya
|
||||
@@ -82,8 +84,7 @@ iobuf_free:
|
||||
|
||||
; Mark table entry as free
|
||||
tax
|
||||
lda #$00
|
||||
sta table,x
|
||||
inc table,x
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -34,8 +34,8 @@ pushname:
|
||||
sta mliparam + MLI::ON_LINE::UNIT_NUM
|
||||
|
||||
; Use allocated pathname buffer
|
||||
lda sp
|
||||
ldx sp+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::ON_LINE::DATA_BUFFER
|
||||
stx mliparam + MLI::ON_LINE::DATA_BUFFER+1
|
||||
|
||||
@@ -46,16 +46,16 @@ pushname:
|
||||
bcs addsp65
|
||||
|
||||
; Get volume name length
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
and #15 ; Max volume name length
|
||||
|
||||
; Bracket volume name with slashes to form prefix
|
||||
sta tmp1
|
||||
lda #'/'
|
||||
sta (sp),y
|
||||
sta (c_sp),y
|
||||
ldy tmp1
|
||||
iny ; Leading slash
|
||||
sta (sp),y
|
||||
sta (c_sp),y
|
||||
iny ; Trailing slash
|
||||
|
||||
; Adjust source pointer for copy
|
||||
@@ -69,7 +69,7 @@ pushname:
|
||||
|
||||
; Copy source to allocated pathname buffer
|
||||
copy: lda (ptr1),y
|
||||
sta (sp),y
|
||||
sta (c_sp),y
|
||||
beq setlen
|
||||
iny
|
||||
cpy #FILENAME_MAX
|
||||
@@ -86,7 +86,7 @@ addsp65:ldy #FILENAME_MAX
|
||||
setlen: tya
|
||||
jsr decsp1 ; Preserves A
|
||||
ldy #$00
|
||||
sta (sp),y
|
||||
sta (c_sp),y
|
||||
|
||||
; Return success
|
||||
tya
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
; unsigned char get_ostype (void)
|
||||
;
|
||||
|
||||
; Priority higher than the default one so that things depending
|
||||
; on ostype can get ostype set when called at normal priority
|
||||
.constructor initostype, 9
|
||||
.export _get_ostype, ostype
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
.import _set_iigs_speed, _get_iigs_speed
|
||||
.import ostype
|
||||
|
||||
.constructor calibrate_tv, 2
|
||||
.constructor calibrate_tv, 8 ; After ostype
|
||||
|
||||
.include "accelerator.inc"
|
||||
.include "apple2.inc"
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
.export gotoxy, _gotoxy, _gotox
|
||||
.import popa, VTABZ
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
gotoxy:
|
||||
@@ -22,9 +26,13 @@ _gotoxy:
|
||||
|
||||
_gotox:
|
||||
sta CH ; Store X
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl :+
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl :+
|
||||
sta OURCH ; Store X
|
||||
: .endif
|
||||
rts
|
||||
: rts
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
; Oliver Schmidt, 2013-05-31
|
||||
;
|
||||
|
||||
.export em_libref, mouse_libref, ser_libref, tgi_libref
|
||||
.export em_libref, ser_libref
|
||||
.import _exit
|
||||
|
||||
em_libref := _exit
|
||||
mouse_libref := _exit
|
||||
ser_libref := _exit
|
||||
tgi_libref := _exit
|
||||
|
||||
24
libsrc/apple2/machinetype.s
Normal file
24
libsrc/apple2/machinetype.s
Normal file
@@ -0,0 +1,24 @@
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.constructor initmachinetype, 8
|
||||
|
||||
.import ostype
|
||||
.export machinetype
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
initmachinetype:
|
||||
ldx ostype
|
||||
cpx #$31 ; Apple //e enhanced?
|
||||
ror machinetype ; Carry to high bit
|
||||
cpx #$30 ; Apple //e?
|
||||
ror machinetype
|
||||
rts
|
||||
|
||||
.data
|
||||
|
||||
; bit 7: Machine is a //e or newer
|
||||
; bit 6: Machine is a //e enhanced or newer
|
||||
machinetype: .byte 0
|
||||
|
||||
.endif
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
.export _mouse_def_callbacks
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
@@ -42,11 +46,14 @@ cursor = '+' | $40 ; Flashing crosshair
|
||||
.endif
|
||||
|
||||
getcursor:
|
||||
.ifdef __APPLE2ENH__
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl column
|
||||
.endif
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl column ; No, skip bank switching
|
||||
switch: bit LOWSCR ; Patched at runtime
|
||||
.endif
|
||||
|
||||
column: ldx #$00 ; Patched at runtime
|
||||
getscr: lda $0400,x ; Patched at runtime
|
||||
cmp #cursor
|
||||
@@ -55,9 +62,7 @@ getscr: lda $0400,x ; Patched at runtime
|
||||
setcursor:
|
||||
lda #cursor
|
||||
setscr: sta $0400,x ; Patched at runtime
|
||||
.ifdef __APPLE2ENH__
|
||||
bit LOWSCR ; Doesn't hurt in 40 column mode
|
||||
.endif
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
@@ -65,9 +70,7 @@ setscr: sta $0400,x ; Patched at runtime
|
||||
.code
|
||||
|
||||
done:
|
||||
.ifdef __APPLE2ENH__
|
||||
bit LOWSCR ; Doesn't hurt in 40 column mode
|
||||
.endif
|
||||
return: rts
|
||||
|
||||
; Hide the mouse cursor.
|
||||
@@ -108,14 +111,14 @@ movex:
|
||||
inx
|
||||
bcs :-
|
||||
stx column+1
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
; Patch switch anyway, it will just be skipped over if in 40-col mode
|
||||
adc #7 / 2 ; Left or right half of 40-col column?
|
||||
ldx #<LOWSCR ; Columns 1,3,5..79
|
||||
bcs :+
|
||||
.assert LOWSCR + 1 = HISCR, error
|
||||
inx ; Columns 0,2,4..78
|
||||
: stx switch+1
|
||||
.endif
|
||||
rts
|
||||
|
||||
; Move the mouse cursor y position to the value in A/X.
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
; Returns with carry set on error, and sets errno
|
||||
mli_file_info_direct:
|
||||
; Set pushed name
|
||||
lda sp
|
||||
ldx sp+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::INFO::PATHNAME
|
||||
stx mliparam + MLI::INFO::PATHNAME+1
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
.include "zeropage.inc"
|
||||
.include "mouse-kernel.inc"
|
||||
.include "apple2.inc"
|
||||
.include "get_tv.inc"
|
||||
|
||||
.macpack module
|
||||
|
||||
@@ -21,6 +22,7 @@ CLAMPMOUSE = $17 ; Sets mouse bounds in a window
|
||||
HOMEMOUSE = $18 ; Sets mouse to upper-left corner of clamp win
|
||||
INITMOUSE = $19 ; Resets mouse clamps to default values and
|
||||
; sets mouse position to 0,0
|
||||
TIMEDATA = $1C ; Set mousecard's interrupt rate
|
||||
|
||||
pos1_lo := $0478
|
||||
pos1_hi := $0578
|
||||
@@ -41,6 +43,7 @@ status := $0778
|
||||
.byte MOUSE_API_VERSION ; Mouse driver API version number
|
||||
|
||||
; Library reference
|
||||
libref:
|
||||
.addr $0000
|
||||
|
||||
; Jump table
|
||||
@@ -169,7 +172,31 @@ next: inc ptr1+1
|
||||
asl
|
||||
sta yparam+1
|
||||
|
||||
; The AppleMouse II Card needs the ROM switched in
|
||||
; Apple II technical notes "Varying VBL Interrupt Rate",
|
||||
lda libref
|
||||
ldx libref+1
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
lda (ptr1)
|
||||
.else
|
||||
ldy #$00
|
||||
lda (ptr1),y
|
||||
.endif
|
||||
|
||||
cmp #TV::OTHER
|
||||
beq :+
|
||||
|
||||
; The TV values are aligned with the values the mousecard
|
||||
; expect: 0 for 60Hz, 1 for 50Hz.
|
||||
.assert TV::NTSC = 0, error
|
||||
.assert TV::PAL = 1, error
|
||||
|
||||
ldx #TIMEDATA
|
||||
jsr firmware
|
||||
|
||||
: ; The AppleMouse II Card needs the ROM switched in
|
||||
; to be able to detect an Apple //e and use RDVBL
|
||||
bit $C082
|
||||
|
||||
@@ -314,10 +341,10 @@ MOVE:
|
||||
ldy #$00 ; Start at top of stack
|
||||
|
||||
; Set x
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
iny
|
||||
sta pos1_lo,x
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta pos1_hi,x
|
||||
|
||||
; Update cursor
|
||||
|
||||
25
libsrc/apple2/mouseref.s
Normal file
25
libsrc/apple2/mouseref.s
Normal file
@@ -0,0 +1,25 @@
|
||||
;
|
||||
; Colin Leroy-Mira, 2025-05-11
|
||||
;
|
||||
|
||||
.export mouse_libref
|
||||
.import _get_tv, ostype, return0
|
||||
|
||||
.constructor init_mousetv
|
||||
|
||||
.include "get_tv.inc"
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
.proc init_mousetv
|
||||
lda ostype
|
||||
cmp #$40 ; Technical notes say not to change
|
||||
bcs :+ ; interrupt rate on IIc/IIgs, so...
|
||||
jsr _get_tv
|
||||
sta mouse_libref
|
||||
: rts ; ...don't update "Other" on those machines
|
||||
.endproc
|
||||
|
||||
.data
|
||||
|
||||
mouse_libref: .byte TV::OTHER
|
||||
@@ -1,27 +1,26 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
; Colin Leroy-Mira, 26.05.2025
|
||||
;
|
||||
; void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void __fastcall__ chline (unsigned char length);
|
||||
; void __fastcall__ mt_chlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void __fastcall__ mt_chline (unsigned char length);
|
||||
;
|
||||
|
||||
.export _chlinexy, _chline, chlinedirect
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.export _mt_chlinexy, _mt_chline, chlinedirect
|
||||
.import gotoxy, cputdirect
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "apple2.inc"
|
||||
|
||||
_chlinexy:
|
||||
_mt_chlinexy:
|
||||
pha ; Save the length
|
||||
jsr gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _chline
|
||||
|
||||
_chline:
|
||||
.ifdef __APPLE2ENH__
|
||||
_mt_chline:
|
||||
ldx #'_' | $80 ; Underscore, screen code
|
||||
.else
|
||||
ldx #'-' | $80 ; Minus, screen code
|
||||
.endif
|
||||
|
||||
chlinedirect:
|
||||
stx tmp1
|
||||
@@ -33,3 +32,5 @@ chlinedirect:
|
||||
dec tmp2
|
||||
bne :-
|
||||
done: rts
|
||||
|
||||
.endif
|
||||
@@ -1,34 +1,32 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
; Colin Leroy-Mira, 26.05.2025
|
||||
;
|
||||
; void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void __fastcall__ cvline (unsigned char length);
|
||||
; void __fastcall__ mt_cvlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void __fastcall__ mt_cvline (unsigned char length);
|
||||
;
|
||||
|
||||
.export _cvlinexy, _cvline
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.export _mt_cvlinexy, _mt_cvline
|
||||
.import gotoxy, putchar, newline
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
_cvlinexy:
|
||||
_mt_cvlinexy:
|
||||
pha ; Save the length
|
||||
jsr gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _cvline
|
||||
|
||||
_cvline:
|
||||
.ifdef __APPLE2ENH__
|
||||
ldx #$5F ; Left vertical line MouseText character
|
||||
.else
|
||||
ldx #'!' | $80 ; Exclamation mark, screen code
|
||||
.endif
|
||||
|
||||
stx tmp1
|
||||
_mt_cvline:
|
||||
cmp #$00 ; Is the length zero?
|
||||
beq done ; Jump if done
|
||||
sta tmp2
|
||||
: lda tmp1 ; Screen code
|
||||
: lda #$5F ; Left vertical line MouseText character
|
||||
jsr putchar ; Write, no cursor advance
|
||||
jsr newline ; Advance cursor to next line
|
||||
dec tmp2
|
||||
bne :-
|
||||
done: rts
|
||||
|
||||
.endif
|
||||
@@ -101,8 +101,8 @@ found: tya
|
||||
bne oserr1
|
||||
|
||||
; Set pushed name
|
||||
lda sp
|
||||
ldx sp+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::OPEN::PATHNAME
|
||||
stx mliparam + MLI::OPEN::PATHNAME+1
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ __syschdir:
|
||||
bne oserr
|
||||
|
||||
; Set pushed name
|
||||
lda sp
|
||||
ldx sp+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::PREFIX::PATHNAME
|
||||
stx mliparam + MLI::PREFIX::PATHNAME+1
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ __sysmkdir:
|
||||
bne oserr
|
||||
|
||||
; Set pushed name
|
||||
lda sp
|
||||
ldx sp+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::CREATE::PATHNAME
|
||||
stx mliparam + MLI::CREATE::PATHNAME+1
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ __sysremove:
|
||||
bne oserr
|
||||
|
||||
; Set pushed name
|
||||
lda sp
|
||||
ldx sp+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::DESTROY::PATHNAME
|
||||
stx mliparam + MLI::DESTROY::PATHNAME+1
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ __sysrename:
|
||||
bne oserr1
|
||||
|
||||
; Save pushed oldname
|
||||
lda sp
|
||||
ldx sp+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta ptr3
|
||||
stx ptr3+1
|
||||
|
||||
@@ -40,8 +40,8 @@ __sysrename:
|
||||
stx mliparam + MLI::RENAME::PATHNAME+1
|
||||
|
||||
; Set pushed newname
|
||||
lda sp
|
||||
ldx sp+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::RENAME::NEW_PATHNAME
|
||||
stx mliparam + MLI::RENAME::NEW_PATHNAME+1
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ utsdata:
|
||||
.asciiz ""
|
||||
|
||||
; release
|
||||
.byte ((.VERSION >> 8) & $0F) + '0'
|
||||
.byte .string (>.version)
|
||||
.byte '.'
|
||||
.byte ((.VERSION >> 4) & $0F) + '0'
|
||||
.byte .string (<.version)
|
||||
.byte $00
|
||||
|
||||
; version
|
||||
.byte (.VERSION & $0F) + '0'
|
||||
.byte '0' ; unused
|
||||
.byte $00
|
||||
|
||||
; machine
|
||||
|
||||
@@ -83,7 +83,10 @@ Y2 := ptr4
|
||||
|
||||
.byte $74, $67, $69 ; "tgi"
|
||||
.byte TGI_API_VERSION ; TGI API version number
|
||||
|
||||
libref:
|
||||
.addr $0000 ; Library reference
|
||||
|
||||
.word 280 ; X resolution
|
||||
.word 192 ; Y resolution
|
||||
.byte 8 ; Number of drawing colors
|
||||
@@ -120,6 +123,10 @@ pages: .byte 2 ; Number of screens available
|
||||
|
||||
.bss
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
machinetype: .res 1
|
||||
.endif
|
||||
|
||||
; Absolute variables used in the code
|
||||
|
||||
ERROR: .res 1 ; Error code
|
||||
@@ -146,13 +153,22 @@ FONT:
|
||||
; most of the time.
|
||||
; Must set an error code: NO
|
||||
INSTALL:
|
||||
.ifdef __APPLE2ENH__
|
||||
.ifndef __APPLE2ENH__
|
||||
lda libref
|
||||
ldx libref+1
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
ldy #$0
|
||||
lda (ptr1),y
|
||||
sta machinetype
|
||||
bpl :+
|
||||
.endif
|
||||
; No page switching if 80 column store is enabled
|
||||
bit RD80COL
|
||||
bpl :+
|
||||
lda #$01
|
||||
sta pages
|
||||
: .endif
|
||||
:
|
||||
|
||||
; Fall through
|
||||
|
||||
@@ -175,10 +191,16 @@ INIT:
|
||||
; Switch into graphics mode
|
||||
bit MIXCLR
|
||||
bit HIRES
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl clr_txt
|
||||
.endif
|
||||
|
||||
sta IOUDISON
|
||||
bit DHIRESOFF
|
||||
.endif
|
||||
|
||||
clr_txt:
|
||||
bit TXTCLR
|
||||
|
||||
; Beagle Bros Shape Mechanic fonts don't
|
||||
@@ -200,10 +222,8 @@ DONE:
|
||||
bit TXTSET
|
||||
bit LOWSCR
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
; Limit SET80COL-HISCR to text
|
||||
bit LORES
|
||||
.endif
|
||||
|
||||
; Reset the text window top
|
||||
lda #$00
|
||||
|
||||
@@ -53,7 +53,7 @@ Y2 := ptr4
|
||||
|
||||
.byte $74, $67, $69 ; "tgi"
|
||||
.byte TGI_API_VERSION ; TGI API version number
|
||||
.addr $0000 ; Library reference
|
||||
libref: .addr $0000 ; Library reference
|
||||
.word 40 ; X resolution
|
||||
.word 48 ; Y resolution
|
||||
.byte 16 ; Number of drawing colors
|
||||
@@ -93,6 +93,10 @@ Y2 := ptr4
|
||||
ERROR: .res 1 ; Error code
|
||||
MIX: .res 1 ; 4 lines of text
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
machinetype: .res 1
|
||||
.endif
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.rodata
|
||||
@@ -126,11 +130,15 @@ INIT:
|
||||
bit $C082 ; Switch in ROM
|
||||
jsr SETGR
|
||||
bit MIXCLR
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl lc_in
|
||||
.endif
|
||||
|
||||
sta IOUDISON
|
||||
bit DHIRESOFF
|
||||
.endif
|
||||
bit $C080 ; Switch in LC bank 2 for R/O
|
||||
lc_in: bit $C080 ; Switch in LC bank 2 for R/O
|
||||
|
||||
; Done, reset the error code
|
||||
lda #TGI_ERR_OK
|
||||
@@ -144,6 +152,16 @@ INIT:
|
||||
; most of the time.
|
||||
; Must set an error code: NO
|
||||
INSTALL:
|
||||
.ifndef __APPLE2ENH__
|
||||
lda libref
|
||||
ldx libref+1
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
ldy #$0
|
||||
lda (ptr1),y
|
||||
sta machinetype
|
||||
bpl :+
|
||||
.endif
|
||||
; Fall through
|
||||
|
||||
; UNINSTALL routine. Is called before the driver is removed from memory. May
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
;
|
||||
; Target-specific black & white values for use by the target-shared TGI kernel
|
||||
;
|
||||
; NOTE: These are indices into the default palette
|
||||
|
||||
.include "tgi-kernel.inc"
|
||||
|
||||
|
||||
18
libsrc/apple2/tgiref.s
Normal file
18
libsrc/apple2/tgiref.s
Normal file
@@ -0,0 +1,18 @@
|
||||
;
|
||||
; Colin Leroy-Mira, 2025-05-10
|
||||
;
|
||||
|
||||
.export tgi_libref
|
||||
.import _exit
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.import machinetype
|
||||
|
||||
tgi_libref := machinetype
|
||||
|
||||
.else
|
||||
|
||||
tgi_libref := _exit
|
||||
|
||||
.endif
|
||||
@@ -2,8 +2,26 @@
|
||||
; Oliver Schmidt, 2024-08-06
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.export uppercasemask
|
||||
|
||||
.import machinetype
|
||||
.constructor detectlowercase
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
detectlowercase:
|
||||
bit machinetype
|
||||
bpl :+
|
||||
|
||||
lda #$FF
|
||||
sta uppercasemask
|
||||
: rts
|
||||
|
||||
|
||||
.data
|
||||
|
||||
uppercasemask: .byte $DF ; Convert to uppercase
|
||||
|
||||
.endif
|
||||
|
||||
@@ -1,17 +1,31 @@
|
||||
;
|
||||
; Oliver Schmidt, 07.09.2009
|
||||
;
|
||||
; unsigned __fastcall__ videomode (unsigned mode);
|
||||
; signed char __fastcall__ videomode (unsigned mode);
|
||||
;
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.export _videomode
|
||||
|
||||
.import aux80col
|
||||
.import returnFFFF
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
|
||||
VIDEOMODE_40x24 = $15
|
||||
VIDEOMODE_80x24 = $00
|
||||
|
||||
.segment "LOWCODE"
|
||||
|
||||
_videomode:
|
||||
bit aux80col
|
||||
bmi set_mode
|
||||
|
||||
; No 80 column card, return error if requested mode is 80cols
|
||||
cmp #VIDEOMODE_40x24
|
||||
beq out
|
||||
jmp returnFFFF
|
||||
set_mode:
|
||||
|
||||
; Get and save current videomode flag
|
||||
bit RD80VID
|
||||
php
|
||||
@@ -31,10 +45,8 @@ _videomode:
|
||||
|
||||
; Return ctrl-char code for setting previous
|
||||
; videomode using the saved videomode flag
|
||||
lda #$15 ; Ctrl-char code for 40 cols
|
||||
lda #VIDEOMODE_40x24
|
||||
plp
|
||||
bpl :+
|
||||
lda #$00 ; Ctrl-char code for 80 cols
|
||||
: rts ; X was preserved all the way
|
||||
|
||||
.endif ; __APPLE2ENH__
|
||||
bpl out
|
||||
lda #VIDEOMODE_80x24
|
||||
out: rts ; X was preserved all the way
|
||||
|
||||
@@ -3,18 +3,26 @@
|
||||
;
|
||||
; void waitvsync (void);
|
||||
;
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.export _waitvsync
|
||||
.import ostype
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
_waitvsync:
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype ; IIe/enh?
|
||||
bpl out ; No, silently fail
|
||||
.endif
|
||||
|
||||
bit ostype
|
||||
bmi iigs ; $8x
|
||||
bvs iic ; $4x
|
||||
|
||||
; Apple IIe
|
||||
: bit RDVBLBAR
|
||||
bpl :- ; Blanking
|
||||
: bit RDVBLBAR
|
||||
@@ -42,6 +50,4 @@ iic: php
|
||||
bit DISVBL
|
||||
: sta IOUDISON ; IIc Tech Ref Man: The firmware normally leaves IOUDIS on.
|
||||
plp
|
||||
rts
|
||||
|
||||
.endif ; __APPLE2ENH__
|
||||
out: rts
|
||||
|
||||
@@ -4,16 +4,23 @@
|
||||
; unsigned char wherex (void);
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
|
||||
.export _wherex
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
_wherex:
|
||||
lda CH
|
||||
.ifdef __APPLE2ENH__
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl :+
|
||||
.endif
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl :+
|
||||
lda OURCH
|
||||
: .endif
|
||||
ldx #>$0000
|
||||
|
||||
: ldx #>$0000
|
||||
rts
|
||||
|
||||
@@ -59,8 +59,8 @@ start:
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
sta sp
|
||||
stx sp+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
.else
|
||||
|
||||
@@ -75,11 +75,11 @@ start:
|
||||
lda MEMTOP
|
||||
sbc #<__RESERVED_MEMORY__
|
||||
sta APPMHI ; initialize our APPMHI value
|
||||
sta sp ; set up runtime stack part 1
|
||||
sta c_sp ; set up runtime stack part 1
|
||||
lda MEMTOP+1
|
||||
sbc #>__RESERVED_MEMORY__
|
||||
sta APPMHI+1
|
||||
sta sp+1 ; set up runtime stack part 2
|
||||
sta c_sp+1 ; set up runtime stack part 2
|
||||
|
||||
.endif
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.export sectsizetab
|
||||
.import ___oserror, __sio_call, _dio_read
|
||||
.import pushax, addysp, subysp
|
||||
.importzp ptr2, sp
|
||||
.importzp ptr2, c_sp
|
||||
.include "atari.inc"
|
||||
|
||||
|
||||
@@ -78,10 +78,10 @@ _dio_open:
|
||||
ldy #128
|
||||
jsr subysp ; allocate buffer on the stack
|
||||
|
||||
lda sp
|
||||
lda c_sp
|
||||
pha
|
||||
lda sp+1
|
||||
pha ; save sp (buffer address) on processor stack
|
||||
lda c_sp+1
|
||||
pha ; save c_sp (buffer address) on processor stack
|
||||
|
||||
lda ptr2
|
||||
ldx ptr2+1
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.include "atari.inc"
|
||||
.include "fd.inc"
|
||||
.importzp tmp1,tmp2,tmp3,ptr4,sp
|
||||
.importzp tmp1,tmp2,tmp3,ptr4,c_sp
|
||||
.import fd_table,fd_index
|
||||
.import fdt_to_fdi
|
||||
.export clriocb
|
||||
@@ -229,7 +229,7 @@ freefnd:txa
|
||||
beq l2
|
||||
|
||||
l1: ldy #0
|
||||
lda (sp),y ; get device
|
||||
lda (c_sp),y ; get device
|
||||
l2: sta fd_table+ft_dev,x ; set device
|
||||
lda #1
|
||||
sta fd_table+ft_usa,x ; set usage counter
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
;
|
||||
|
||||
.include "atari.inc"
|
||||
.importzp sp
|
||||
.importzp c_sp
|
||||
.export _mouse_pm_callbacks
|
||||
.constructor pm_init, 27
|
||||
.destructor pm_down
|
||||
@@ -193,22 +193,22 @@ pm_init:
|
||||
|
||||
.else
|
||||
|
||||
; use top of memory and lower sp accordingly
|
||||
sta sp
|
||||
; use top of memory and lower c_sp accordingly
|
||||
sta c_sp
|
||||
sta MOUSE_PM_BASE
|
||||
lda sp+1
|
||||
lda c_sp+1
|
||||
and #7 ; offset within 2K
|
||||
cmp #3 + MOUSE_PM_RAW + 1 ; can we use it?
|
||||
bcc @decr ; no
|
||||
|
||||
lda sp+1
|
||||
lda c_sp+1
|
||||
and #$F8
|
||||
@set: adc #3 + MOUSE_PM_RAW - 1 ; CF is set, so adding MOUSE_PM_RAW + 3
|
||||
sta MOUSE_PM_BASE+1
|
||||
sta sp+1
|
||||
sta c_sp+1
|
||||
bne @cont ; jump always
|
||||
|
||||
@decr: lda sp+1
|
||||
@decr: lda c_sp+1
|
||||
and #$F8
|
||||
sbc #8 - 1 ; CF is clear, subtracts 8
|
||||
bcs @set ; jump always
|
||||
|
||||
@@ -241,11 +241,11 @@ MOVE: php
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
|
||||
@@ -399,12 +399,12 @@ MOVE: php
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
sta XPosWrk+1
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
sta XPosWrk
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -236,11 +236,11 @@ MOVE: php
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.include "atari.inc"
|
||||
.import findfreeiocb
|
||||
.importzp tmp4, sp, ptr2, ptr3
|
||||
.importzp tmp4, c_sp, ptr2, ptr3
|
||||
.import incsp2, subysp, addysp, popax
|
||||
.ifdef UCASE_FILENAME
|
||||
.importzp tmp3
|
||||
@@ -118,19 +118,19 @@ L1: jsr subysp ; make room on the stack
|
||||
; copy old name
|
||||
ldy #0
|
||||
con: lda (ptr3),y
|
||||
sta (sp),y
|
||||
sta (c_sp),y
|
||||
beq copyend
|
||||
iny
|
||||
bne con
|
||||
|
||||
copyend:lda #$20 ; space
|
||||
sta (sp),y
|
||||
sta (c_sp),y
|
||||
iny
|
||||
tya ; get current offset (beyond old name)
|
||||
clc
|
||||
adc sp
|
||||
adc c_sp
|
||||
sta ptr3
|
||||
lda sp+1
|
||||
lda c_sp+1
|
||||
adc #0
|
||||
sta ptr3+1 ; ptr3 now contains pointer to space for new filename
|
||||
|
||||
@@ -143,9 +143,9 @@ cnn: lda (ptr2),y
|
||||
bne cnn
|
||||
|
||||
copend2:ldx tmp4
|
||||
lda sp
|
||||
lda c_sp
|
||||
sta ICBAL,x
|
||||
lda sp+1
|
||||
lda c_sp+1
|
||||
sta ICBAH,x
|
||||
lda #RENAME
|
||||
sta ICCOM,x
|
||||
@@ -160,13 +160,13 @@ copend2:ldx tmp4
|
||||
|
||||
; clean up stack
|
||||
|
||||
lda sp
|
||||
lda c_sp
|
||||
clc
|
||||
adc sspc
|
||||
sta sp
|
||||
lda sp+1
|
||||
sta c_sp
|
||||
lda c_sp+1
|
||||
adc sspc+1
|
||||
sta sp+1
|
||||
sta c_sp+1
|
||||
|
||||
; handle status
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ utsdata:
|
||||
.asciiz ""
|
||||
|
||||
; release
|
||||
.byte ((.VERSION >> 8) & $0F) + '0'
|
||||
.byte .string (>.version)
|
||||
.byte '.'
|
||||
.byte ((.VERSION >> 4) & $0F) + '0'
|
||||
.byte .string (<.version)
|
||||
.byte $00
|
||||
|
||||
; version
|
||||
.byte (.VERSION & $0F) + '0'
|
||||
.byte '0' ; unused
|
||||
.byte $00
|
||||
|
||||
; machine
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
.importzp tmp2
|
||||
.import __defdev
|
||||
.endif
|
||||
.importzp tmp3,ptr4,sp
|
||||
.importzp tmp3,ptr4,c_sp
|
||||
.import subysp,addysp
|
||||
.export ucase_fn
|
||||
|
||||
@@ -63,13 +63,13 @@ hasdev:
|
||||
ldy #0
|
||||
|
||||
loop2: lda (ptr4),y
|
||||
sta (sp),y
|
||||
sta (c_sp),y
|
||||
beq copy_end
|
||||
bmi L1 ; Not lowercase (also, invalid, should reject)
|
||||
cmp #'a'
|
||||
bcc L1 ; Not lowercase
|
||||
and #$DF ; make upper case char, assume ASCII chars
|
||||
sta (sp),y ; store back
|
||||
sta (c_sp),y ; store back
|
||||
L1:
|
||||
iny
|
||||
bpl loop2 ; bpl: this way we only support a max. length of 127
|
||||
@@ -93,15 +93,15 @@ copy_end:
|
||||
jsr subysp ; adjust stack pointer
|
||||
dey
|
||||
cpdev: lda __defdev,y
|
||||
sta (sp),y ; insert device name, number and ':'
|
||||
sta (c_sp),y ; insert device name, number and ':'
|
||||
dey
|
||||
bpl cpdev
|
||||
hasdev2:
|
||||
.endif
|
||||
|
||||
; leave A and X pointing to the modified filename
|
||||
lda sp
|
||||
ldx sp+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
clc ; indicate success
|
||||
rts
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ clearLoop:
|
||||
; Initialize C stack pointer
|
||||
lda #<(__RAM_START__ + __RAM_SIZE__)
|
||||
ldx #>(__RAM_START__ + __RAM_SIZE__)
|
||||
sta sp
|
||||
stx sp+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
; Call main
|
||||
jsr _main
|
||||
|
||||
@@ -27,8 +27,8 @@ start:
|
||||
|
||||
lda #<(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__)
|
||||
ldx #>(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__)
|
||||
sta sp
|
||||
stx sp+1 ; Set argument stack ptr
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ utsdata:
|
||||
.asciiz ""
|
||||
|
||||
; release
|
||||
.byte ((.VERSION >> 8) & $0F) + '0'
|
||||
.byte .string (>.version)
|
||||
.byte '.'
|
||||
.byte ((.VERSION >> 4) & $0F) + '0'
|
||||
.byte .string (<.version)
|
||||
.byte $00
|
||||
|
||||
; version
|
||||
.byte (.VERSION & $0F) + '0'
|
||||
.byte '0' ; unused
|
||||
.byte $00
|
||||
|
||||
; machine
|
||||
|
||||
@@ -30,9 +30,9 @@ start:
|
||||
|
||||
; Set up parameter stack
|
||||
lda #<(__RAM3_START__ + __RAM3_SIZE__)
|
||||
sta sp
|
||||
sta c_sp
|
||||
lda #>(__RAM3_START__ + __RAM3_SIZE__)
|
||||
sta sp+1
|
||||
sta c_sp+1
|
||||
|
||||
jsr copydata
|
||||
jsr zerobss
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
.constructor mono_init_cursor
|
||||
.interruptor mono_blink_cursor
|
||||
|
||||
.importzp sp
|
||||
.importzp c_sp
|
||||
.import _zonecounter
|
||||
.import _mono_zones
|
||||
.import cursor
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
.constructor init_cursor
|
||||
.interruptor blink_cursor
|
||||
|
||||
.importzp sp
|
||||
.importzp c_sp
|
||||
.import _zonecounter
|
||||
.import _zones
|
||||
.import cursor
|
||||
|
||||
@@ -51,7 +51,7 @@ _exit: jsr donelib
|
||||
|
||||
ldx #zpspace - 1
|
||||
L2: lda zpsave,x
|
||||
sta sp,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
@@ -68,7 +68,7 @@ L2: lda zpsave,x
|
||||
; Save the zero-page area that we're about to use.
|
||||
|
||||
init: ldx #zpspace - 1
|
||||
L1: lda sp,x
|
||||
L1: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
@@ -85,8 +85,8 @@ L1: lda sp,x
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
|
||||
sta sp
|
||||
stx sp+1 ; Set argument stack ptr
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -23,23 +23,13 @@ utsdata:
|
||||
.asciiz ""
|
||||
|
||||
; release
|
||||
.byte ((.VERSION >> 8) & $0F) + '0'
|
||||
.byte .string (>.version)
|
||||
.byte '.'
|
||||
.if ((.VERSION >> 4) & $0F) > 9
|
||||
.byte ((.VERSION >> 4) & $0F) / 10 + '0'
|
||||
.byte ((.VERSION >> 4) & $0F) .MOD 10 + '0'
|
||||
.else
|
||||
.byte ((.VERSION >> 4) & $0F) + '0'
|
||||
.endif
|
||||
.byte .string (<.version)
|
||||
.byte $00
|
||||
|
||||
; version
|
||||
.if (.VERSION & $0F) > 9
|
||||
.byte (.VERSION & $0F) / 10 + '0'
|
||||
.byte (.VERSION & $0F) .MOD 10 + '0'
|
||||
.else
|
||||
.byte (.VERSION & $0F) + '0'
|
||||
.endif
|
||||
.byte '0' ; unused
|
||||
.byte $00
|
||||
|
||||
; machine
|
||||
|
||||
@@ -39,7 +39,7 @@ Start:
|
||||
; Save the zero-page locations that we need.
|
||||
|
||||
ldx #zpspace-1
|
||||
L1: lda sp,x
|
||||
L1: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
@@ -58,8 +58,8 @@ L1: lda sp,x
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
sta sp
|
||||
stx sp+1 ; Set argument stack ptr
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
@@ -85,7 +85,7 @@ _exit: pha ; Save the return code on stack
|
||||
|
||||
ldx #zpspace-1
|
||||
L2: lda zpsave,x
|
||||
sta sp,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
|
||||
@@ -296,11 +296,11 @@ MOVE: sei ; No interrupts
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -323,10 +323,10 @@ MOVE: sei ; No interrupts
|
||||
jsr MoveY
|
||||
|
||||
ldy #$01
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
jsr MoveX ; Move the cursor
|
||||
|
||||
cli ; Allow interrupts
|
||||
|
||||
@@ -297,11 +297,11 @@ MOVE: sei ; No interrupts
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -297,11 +297,11 @@ MOVE: sei ; No interrupts
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -23,13 +23,13 @@ utsdata:
|
||||
.asciiz ""
|
||||
|
||||
; release
|
||||
.byte ((.VERSION >> 8) & $0F) + '0'
|
||||
.byte .string (>.version)
|
||||
.byte '.'
|
||||
.byte ((.VERSION >> 4) & $0F) + '0'
|
||||
.byte .string (<.version)
|
||||
.byte $00
|
||||
|
||||
; version
|
||||
.byte (.VERSION & $0F) + '0'
|
||||
.byte '0' ; unused
|
||||
.byte $00
|
||||
|
||||
; machine
|
||||
|
||||
@@ -24,7 +24,7 @@ Start:
|
||||
; Save the zero-page locations that we need.
|
||||
|
||||
ldx #zpspace-1
|
||||
L1: lda sp,x
|
||||
L1: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
@@ -49,8 +49,8 @@ L1: lda sp,x
|
||||
bcc MemOk
|
||||
ldy #$80
|
||||
ldx #$00
|
||||
MemOk: stx sp
|
||||
sty sp+1 ; set argument stack ptr
|
||||
MemOk: stx c_sp
|
||||
sty c_sp+1 ; set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
@@ -69,7 +69,7 @@ _exit: pha ; Save the return code on stack
|
||||
|
||||
ldx #zpspace-1
|
||||
L2: lda zpsave,x
|
||||
sta sp,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ utsdata:
|
||||
.asciiz ""
|
||||
|
||||
; release
|
||||
.byte ((.VERSION >> 8) & $0F) + '0'
|
||||
.byte .string (>.version)
|
||||
.byte '.'
|
||||
.byte ((.VERSION >> 4) & $0F) + '0'
|
||||
.byte .string (<.version)
|
||||
.byte $00
|
||||
|
||||
; version
|
||||
.byte (.VERSION & $0F) + '0'
|
||||
.byte '0' ; unused
|
||||
.byte $00
|
||||
|
||||
; machine
|
||||
|
||||
@@ -55,7 +55,7 @@ _exit: pha ; Save the return code on stack
|
||||
|
||||
ldx #zpspace-1
|
||||
L2: lda zpsave,x
|
||||
sta sp,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
@@ -85,7 +85,7 @@ init:
|
||||
; Save the zero-page locations that we need.
|
||||
|
||||
ldx #zpspace-1
|
||||
L1: lda sp,x
|
||||
L1: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
@@ -94,8 +94,8 @@ L1: lda sp,x
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
|
||||
sta sp
|
||||
stx sp+1 ; Set argument stack ptr
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Switch to the second charset.
|
||||
|
||||
|
||||
@@ -239,11 +239,11 @@ MOVE: sei ; No interrupts
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -249,10 +249,10 @@ MOVE: sei ; No interrupts
|
||||
jsr MoveY
|
||||
|
||||
ldy #$01
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
jsr MoveX ; Move the cursor
|
||||
|
||||
cli ; Allow interrupts
|
||||
|
||||
@@ -245,11 +245,11 @@ MOVE: sei ; No interrupts
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -230,11 +230,11 @@ MOVE: sei ; No interrupts
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -23,13 +23,13 @@ utsdata:
|
||||
.asciiz ""
|
||||
|
||||
; release
|
||||
.byte ((.VERSION >> 8) & $0F) + '0'
|
||||
.byte .string (>.version)
|
||||
.byte '.'
|
||||
.byte ((.VERSION >> 4) & $0F) + '0'
|
||||
.byte .string (<.version)
|
||||
.byte $00
|
||||
|
||||
; version
|
||||
.byte (.VERSION & $0F) + '0'
|
||||
.byte '0' ; unused
|
||||
.byte $00
|
||||
|
||||
; machine
|
||||
|
||||
17
libsrc/c65/_scrsize.s
Normal file
17
libsrc/c65/_scrsize.s
Normal file
@@ -0,0 +1,17 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; Screen size variables
|
||||
;
|
||||
|
||||
.export screensize
|
||||
.include "cbm_kernal.inc"
|
||||
|
||||
.proc screensize
|
||||
|
||||
jsr SCREEN
|
||||
inx
|
||||
iny
|
||||
rts
|
||||
|
||||
.endproc
|
||||
17
libsrc/c65/bordercolor.s
Normal file
17
libsrc/c65/bordercolor.s
Normal file
@@ -0,0 +1,17 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
;
|
||||
; unsigned char __fastcall__ bordercolor (unsigned char color);
|
||||
;
|
||||
|
||||
|
||||
.export _bordercolor
|
||||
|
||||
.include "c65.inc"
|
||||
|
||||
_bordercolor:
|
||||
ldx VIC_BORDERCOLOR ; get old value
|
||||
sta VIC_BORDERCOLOR ; set new value
|
||||
txa
|
||||
rts
|
||||
|
||||
32
libsrc/c65/cgetc.s
Normal file
32
libsrc/c65/cgetc.s
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
.import cursor
|
||||
.export _cgetc
|
||||
_cgetc:
|
||||
|
||||
lda cursor
|
||||
beq nocursor
|
||||
|
||||
; enable the cursor
|
||||
clc
|
||||
jsr CURSOR
|
||||
|
||||
nocursor:
|
||||
; wait for a key
|
||||
; FIXME: is $d610 mega65 specific?
|
||||
:
|
||||
lda $d610
|
||||
beq :-
|
||||
|
||||
jsr KBDREAD
|
||||
|
||||
pha
|
||||
; disable the cursor
|
||||
sec
|
||||
jsr CURSOR
|
||||
|
||||
pla
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
15
libsrc/c65/clrscr.s
Normal file
15
libsrc/c65/clrscr.s
Normal file
@@ -0,0 +1,15 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
;
|
||||
; void clrscr (void);
|
||||
;
|
||||
|
||||
.export _clrscr
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
|
||||
;_clrscr = CLRSCR
|
||||
|
||||
_clrscr:
|
||||
lda #$93
|
||||
jmp CHROUT
|
||||
24
libsrc/c65/color.s
Normal file
24
libsrc/c65/color.s
Normal file
@@ -0,0 +1,24 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
;
|
||||
; unsigned char __fastcall__ textcolor (unsigned char color);
|
||||
; unsigned char __fastcall__ bgcolor (unsigned char color);
|
||||
;
|
||||
|
||||
|
||||
.export _textcolor, _bgcolor
|
||||
|
||||
.include "c65.inc"
|
||||
|
||||
_textcolor:
|
||||
ldx CHARCOLOR ; get old value
|
||||
sta CHARCOLOR ; set new value
|
||||
txa
|
||||
rts
|
||||
|
||||
|
||||
_bgcolor:
|
||||
ldx VIC_BG_COLOR0 ; get old value
|
||||
sta VIC_BG_COLOR0 ; set new value
|
||||
txa
|
||||
rts
|
||||
10
libsrc/c65/conio.s
Normal file
10
libsrc/c65/conio.s
Normal file
@@ -0,0 +1,10 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
;
|
||||
; Low level stuff for screen output/console input
|
||||
;
|
||||
|
||||
.exportzp CURS_X, CURS_Y
|
||||
|
||||
.include "c65.inc"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user