Merge branch 'master' into popptr1
This commit is contained in:
@@ -27,6 +27,7 @@ TARGETS = apple2 \
|
||||
gamate \
|
||||
lynx \
|
||||
nes \
|
||||
none \
|
||||
osic1p \
|
||||
pce \
|
||||
sim6502 \
|
||||
|
||||
@@ -1,16 +1,40 @@
|
||||
;
|
||||
; Oliver Schmidt, 2012-06-10
|
||||
;
|
||||
; This module supplies a 4 byte DOS 3.3 header
|
||||
; containing the load address and load length.
|
||||
; This module supplies an AppleSingle version 2 file header + entry with
|
||||
; ID 11 according to https://tools.ietf.org/rfc/rfc1740.txt Appendix A.
|
||||
;
|
||||
|
||||
.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"
|
||||
|
||||
.addr __MAIN_START__ ; Load address
|
||||
.word __MAIN_LAST__ - __MAIN_START__ ; Load length
|
||||
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:
|
||||
|
||||
@@ -52,7 +52,6 @@ PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READJOY
|
||||
.addr 0 ; IRQ not used
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -115,7 +115,6 @@ pages: .byte 2 ; Number of screens available
|
||||
.addr BAR
|
||||
.addr TEXTSTYLE
|
||||
.addr OUTTEXT
|
||||
.addr 0 ; IRQ entry is unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -85,7 +85,6 @@ Y2 := ptr4
|
||||
.addr BAR
|
||||
.addr TEXTSTYLE
|
||||
.addr OUTTEXT
|
||||
.addr 0 ; IRQ entry is unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
;
|
||||
|
||||
.include "atari.inc"
|
||||
.export _cgetc,setcursor
|
||||
.export _cgetc
|
||||
.import setcursor
|
||||
.import KEYBDV_handler
|
||||
.import cursor,mul40
|
||||
|
||||
_cgetc:
|
||||
jsr setcursor
|
||||
@@ -29,43 +29,3 @@ _cgetc:
|
||||
pha
|
||||
rts
|
||||
.endif
|
||||
|
||||
.proc setcursor
|
||||
|
||||
ldy #0
|
||||
lda OLDCHR
|
||||
sta (OLDADR),y
|
||||
|
||||
lda ROWCRS
|
||||
jsr mul40
|
||||
clc
|
||||
adc SAVMSC ; add start of screen memory
|
||||
sta OLDADR
|
||||
txa
|
||||
adc SAVMSC+1
|
||||
sta OLDADR+1
|
||||
lda COLCRS
|
||||
adc OLDADR
|
||||
sta OLDADR
|
||||
bcc nc
|
||||
inc OLDADR+1
|
||||
nc: lda (OLDADR),y
|
||||
sta OLDCHR
|
||||
|
||||
ldx cursor ; current cursor setting as requested by the user
|
||||
beq off
|
||||
ldx #0
|
||||
beq cont
|
||||
|
||||
off: inx
|
||||
cont: stx CRSINH ; update system variable
|
||||
|
||||
beq turnon
|
||||
and #$7f ; clear high bit / inverse flag
|
||||
finish: sta (OLDADR),y ; update on-screen display
|
||||
rts
|
||||
|
||||
turnon: ora #$80 ; set high bit / inverse flag
|
||||
bne finish
|
||||
|
||||
.endproc
|
||||
|
||||
78
libsrc/atari/getdevice.s
Normal file
78
libsrc/atari/getdevice.s
Normal file
@@ -0,0 +1,78 @@
|
||||
;
|
||||
; Oliver Schmidt, 2012-09-04
|
||||
; Christian Groessler, 2017-12-28
|
||||
;
|
||||
; unsigned char getfirstdevice (void);
|
||||
; unsigned char __fastcall__ getnextdevice (unsigned char device);
|
||||
;
|
||||
|
||||
.include "atari.inc"
|
||||
.export _getfirstdevice
|
||||
.export _getnextdevice
|
||||
|
||||
MAX_DIO_DEVICES = 8
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; _getfirstdevice
|
||||
|
||||
_getfirstdevice:
|
||||
lda #$FF
|
||||
; Fall through
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; _getnextdevice
|
||||
|
||||
_getnextdevice:
|
||||
tax
|
||||
next: inx
|
||||
cpx #MAX_DIO_DEVICES
|
||||
beq none
|
||||
|
||||
jsr check_device
|
||||
bmi next
|
||||
|
||||
done: txa
|
||||
ldx #$00
|
||||
rts
|
||||
|
||||
none: ldx #255 ; INVALID_DEVICE (see include/device.h)
|
||||
bne done ; jump always
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; check_device - checks if a disk device is present
|
||||
; input: X - device id (0 = D1, 1 = D2, ...)
|
||||
; output: NF - 0/1 for detected/not detected
|
||||
; X register preserved
|
||||
|
||||
check_device:
|
||||
txa
|
||||
pha
|
||||
lda #SIO_STAT
|
||||
sta DCOMND ; set command into DCB
|
||||
lda #%01000000 ; direction value, "receive data"
|
||||
sta DSTATS ; set data flow directon
|
||||
lda #15
|
||||
sta DTIMLO ; value got from DOS source
|
||||
lda #4
|
||||
sta DAUX1 ; set sector # (dummy: 4)
|
||||
sta DBYTLO ; # of bytes to transfer
|
||||
lda #0
|
||||
sta DAUX2
|
||||
sta DBYTHI
|
||||
lda #>DVSTAT
|
||||
sta DBUFHI
|
||||
lda #<DVSTAT
|
||||
sta DBUFLO ; set buffer address into DCB
|
||||
lda #DISKID ; SIO bus ID of diskette drive
|
||||
sta DDEVIC
|
||||
inx
|
||||
stx DUNIT ; unit number (1-based)
|
||||
|
||||
jsr SIOV ; execute SIO command
|
||||
|
||||
pla
|
||||
tax
|
||||
lda DSTATS
|
||||
rts
|
||||
|
||||
.end
|
||||
@@ -41,7 +41,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READJOY
|
||||
.addr 0 ; IRQ entry not used
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READJOY
|
||||
.addr 0 ; IRQ entry not used
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
48
libsrc/atari/setcursor.s
Normal file
48
libsrc/atari/setcursor.s
Normal file
@@ -0,0 +1,48 @@
|
||||
;
|
||||
; Christian Groessler, November-2002
|
||||
;
|
||||
; cursor handling, internal function
|
||||
|
||||
.include "atari.inc"
|
||||
.import cursor,mul40
|
||||
.export setcursor
|
||||
|
||||
.proc setcursor
|
||||
|
||||
ldy #0
|
||||
lda OLDCHR
|
||||
sta (OLDADR),y
|
||||
|
||||
lda ROWCRS
|
||||
jsr mul40
|
||||
clc
|
||||
adc SAVMSC ; add start of screen memory
|
||||
sta OLDADR
|
||||
txa
|
||||
adc SAVMSC+1
|
||||
sta OLDADR+1
|
||||
lda COLCRS
|
||||
adc OLDADR
|
||||
sta OLDADR
|
||||
bcc nc
|
||||
inc OLDADR+1
|
||||
nc: lda (OLDADR),y
|
||||
sta OLDCHR
|
||||
|
||||
ldx cursor ; current cursor setting as requested by the user
|
||||
beq off
|
||||
ldx #0
|
||||
beq cont
|
||||
|
||||
off: inx
|
||||
cont: stx CRSINH ; update system variable
|
||||
|
||||
beq turnon
|
||||
and #$7f ; clear high bit / inverse flag
|
||||
finish: sta (OLDADR),y ; update on-screen display
|
||||
rts
|
||||
|
||||
turnon: ora #$80 ; set high bit / inverse flag
|
||||
bne finish
|
||||
|
||||
.endproc
|
||||
@@ -68,7 +68,6 @@ libref: .addr $0000 ; Library reference
|
||||
.addr BAR
|
||||
.addr TEXTSTYLE
|
||||
.addr OUTTEXT
|
||||
.addr 0 ; IRQ entry is unused
|
||||
|
||||
; ******************************************************************************
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ clrscr: sta (SAVMSC),y
|
||||
rts
|
||||
|
||||
|
||||
.segment "RODATA"
|
||||
.segment "DLIST"
|
||||
|
||||
; display list for 20x24 text mode
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READJOY
|
||||
.addr 0 ; IRQ entry not used
|
||||
|
||||
.code
|
||||
|
||||
|
||||
@@ -7,9 +7,44 @@
|
||||
|
||||
.include "atmos.inc"
|
||||
|
||||
_atmos_ping := PING
|
||||
_atmos_shoot := SHOOT
|
||||
_atmos_explode := EXPLODE
|
||||
_atmos_zap := ZAP
|
||||
_atmos_tick := TICK
|
||||
_atmos_tock := TOCK
|
||||
.proc _atmos_ping
|
||||
bit $31
|
||||
bvs L1 ; Atmos?
|
||||
jmp PING
|
||||
L1: jmp PING1
|
||||
.endproc
|
||||
|
||||
.proc _atmos_shoot
|
||||
bit $31
|
||||
bvs L1 ; Atmos?
|
||||
jmp SHOOT
|
||||
L1: jmp SHOOT1
|
||||
.endproc
|
||||
|
||||
.proc _atmos_explode
|
||||
bit $31
|
||||
bvs L1 ; Atmos?
|
||||
jmp EXPLODE
|
||||
L1: jmp EXPLODE1
|
||||
.endproc
|
||||
|
||||
.proc _atmos_zap
|
||||
bit $31
|
||||
bvs L1 ; Atmos?
|
||||
jmp ZAP
|
||||
L1: jmp ZAP1
|
||||
.endproc
|
||||
|
||||
.proc _atmos_tick
|
||||
bit $31
|
||||
bvs L1 ; Atmos?
|
||||
jmp TICK
|
||||
L1: jmp TICK1
|
||||
.endproc
|
||||
|
||||
.proc _atmos_tock
|
||||
bit $31
|
||||
bvs L1 ; Atmos?
|
||||
jmp TOCK
|
||||
L1: jmp TOCK1
|
||||
.endproc
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
;
|
||||
|
||||
.export _cgetc
|
||||
.constructor initcgetc
|
||||
|
||||
.import cursor
|
||||
.forceimport disable_caps
|
||||
@@ -53,14 +52,3 @@
|
||||
@L3: rts
|
||||
|
||||
.endproc
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Switch the cursor off. Code goes into the ONCE segment,
|
||||
; which will be reused after it is run.
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
initcgetc:
|
||||
lsr STATUS
|
||||
asl STATUS ; Clear bit zero
|
||||
rts
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
.export _cputcxy, _cputc
|
||||
.export setscrptr, putchar
|
||||
.constructor initcputc
|
||||
.import rvs
|
||||
.import popax
|
||||
.importzp ptr2
|
||||
@@ -95,3 +96,13 @@ ScrTabHi:
|
||||
.byte >(SCREEN + Line * SCREEN_XSIZE)
|
||||
.endrep
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Switch the cursor off. Code goes into the ONCE segment,
|
||||
; which will be reused after it is run.
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
initcputc:
|
||||
lsr STATUS
|
||||
asl STATUS ; Clear bit zero
|
||||
rts
|
||||
|
||||
134
libsrc/atmos/joy/atmos-ijk.s
Normal file
134
libsrc/atmos/joy/atmos-ijk.s
Normal file
@@ -0,0 +1,134 @@
|
||||
;
|
||||
; IJK joystick driver for the Atmos
|
||||
; Can be used multiple times when statically linked to the application.
|
||||
;
|
||||
; 2002-12-20, Based on Ullrich von Bassewitz's code.
|
||||
; 2017-11-01, Stefan Haubenthal
|
||||
;
|
||||
|
||||
.include "joy-kernel.inc"
|
||||
.include "joy-error.inc"
|
||||
.include "atmos.inc"
|
||||
|
||||
.macpack module
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Header. Includes jump table
|
||||
|
||||
module_header _atmos_ijk_joy
|
||||
|
||||
; Driver signature
|
||||
|
||||
.byte $6A, $6F, $79 ; "joy"
|
||||
.byte JOY_API_VERSION ; Driver API version number
|
||||
|
||||
; Library reference
|
||||
|
||||
.addr $0000
|
||||
|
||||
; Jump table.
|
||||
|
||||
.addr INSTALL
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READ
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
JOY_COUNT = 2 ; Number of joysticks we support
|
||||
|
||||
.code
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; INSTALL routine. Is called after the driver is loaded into memory. If
|
||||
; possible, check if the hardware is present and determine the amount of
|
||||
; memory available.
|
||||
; Must return an JOY_ERR_xx code in a/x.
|
||||
;
|
||||
|
||||
INSTALL:
|
||||
lda #%11000000
|
||||
sta VIA::DDRA
|
||||
sta VIA::PRA
|
||||
lda VIA::PRA
|
||||
and #%00100000
|
||||
bne ijkPresent
|
||||
lda #<JOY_ERR_NO_DEVICE
|
||||
.byte $2C ; Skip next opcode
|
||||
ijkPresent:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||
; Can do cleanup or whatever. Must not return anything.
|
||||
;
|
||||
|
||||
UNINSTALL:
|
||||
rts
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; COUNT: Return the total number of available joysticks in a/x.
|
||||
;
|
||||
|
||||
COUNT:
|
||||
lda #<JOY_COUNT
|
||||
ldx #>JOY_COUNT
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; READ: Read a particular joystick passed in A.
|
||||
;
|
||||
|
||||
READ:
|
||||
bne right
|
||||
|
||||
; Ensure Printer Strobe is set to Output
|
||||
lda #%10110111
|
||||
sta VIA::DDRB
|
||||
; Set Strobe Low
|
||||
lda #%00000000
|
||||
sta VIA::PRB
|
||||
; Set Top two bits of PortA to Output and rest as Input
|
||||
lda #%11000000
|
||||
sta VIA::DDRA
|
||||
|
||||
; Select Left Joystick
|
||||
lda #%01111111
|
||||
sta VIA::PRA
|
||||
; Read back Left Joystick state
|
||||
lda VIA::PRA
|
||||
; Mask out unused bits
|
||||
and #%00011111
|
||||
; Invert Bits
|
||||
eor #%00011111
|
||||
; Index table to conform to Generic Format
|
||||
tax
|
||||
lda GenericIJKBits,X
|
||||
bne L1
|
||||
|
||||
right:
|
||||
; Select Right Joystick
|
||||
lda #%10111111
|
||||
sta VIA::PRA
|
||||
; Read back Right Joystick state and rejig bits
|
||||
lda VIA::PRA
|
||||
and #%00011111
|
||||
eor #%00011111
|
||||
tax
|
||||
lda GenericIJKBits,X
|
||||
|
||||
; Restore VIA PortA state
|
||||
L1: ldx #%11111111
|
||||
stx VIA::DDRA
|
||||
inx ; x=0
|
||||
rts
|
||||
|
||||
.rodata
|
||||
GenericIJKBits:
|
||||
.byte 0,2,1,3,32,34,33,0,8,10,9,0,40,42,41,0
|
||||
.byte 16,18,17,0,48,50,49,0,0,0,0,0,0,0,0,0
|
||||
@@ -34,7 +34,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READ
|
||||
.addr 0 ; IRQ entry unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
@@ -59,7 +59,6 @@ YSIZE = 8 ; System font height
|
||||
.addr BAR
|
||||
.addr TEXTSTYLE
|
||||
.addr OUTTEXT
|
||||
.addr 0 ; IRQ entry is unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
|
||||
@@ -59,7 +59,6 @@ YSIZE = 8 ; System font height
|
||||
.addr BAR
|
||||
.addr TEXTSTYLE
|
||||
.addr OUTTEXT
|
||||
.addr 0 ; IRQ entry is unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
;
|
||||
; Target-specific black & white values for use by the target-shared TGI kernel
|
||||
;
|
||||
|
||||
.include "tgi-kernel.inc"
|
||||
|
||||
.export tgi_color_black:zp = $00
|
||||
.export tgi_color_white:zp = $01
|
||||
@@ -1,14 +0,0 @@
|
||||
;
|
||||
; char __fastcall__ toascii (char c);
|
||||
; /* Convert a target-specific character to ASCII. */
|
||||
;
|
||||
|
||||
.export _toascii
|
||||
|
||||
.proc _toascii
|
||||
|
||||
; .X must be zero, on return.
|
||||
ldx #>$0000
|
||||
rts
|
||||
|
||||
.endproc
|
||||
51
libsrc/c128/acc_c128_speed.s
Normal file
51
libsrc/c128/acc_c128_speed.s
Normal file
@@ -0,0 +1,51 @@
|
||||
;
|
||||
; 2018-04-23, Marco van den Heuvel
|
||||
; 2018-04-26, Greg King
|
||||
;
|
||||
|
||||
; unsigned char __fastcall__ set_c128_speed (unsigned char speed);
|
||||
;
|
||||
;/* Set the speed of the C128 8502 CPU; using SPEED_SLOW will switch to
|
||||
; * 1 Mhz (slow) mode, SPEED_2X or SPEED_FAST will switch to 2Mhz (fast) mode.
|
||||
; *
|
||||
; * Note that any value higher or equal to SPEED_2X will switch to fast mode.
|
||||
; *
|
||||
; * This function will return the actual speed the CPU is at, after trying
|
||||
; * to set the requested speed; to my knowledge, the switching should not fail.
|
||||
; *
|
||||
; * For C64 programs, a check for a C128 in C64 mode is needed; make sure you
|
||||
; * use 'detect_c128();' before using.
|
||||
; *
|
||||
; * For C128 programs, no detect function call is needed.
|
||||
; */
|
||||
|
||||
; unsigned char get_c128_speed (void);
|
||||
;
|
||||
;/* Get the speed of the C128 8502 CPU.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * SPEED_SLOW : Slow mode
|
||||
; * SPEED_2X : Fast mode
|
||||
; *
|
||||
; * For C64 programs, a check for a C128 in C64 mode is needed; make sure you
|
||||
; * use 'detect_c128();' before using.
|
||||
; *
|
||||
; * For C128 programs, no detect function call is needed.
|
||||
; */
|
||||
|
||||
.export _set_c128_speed
|
||||
.export _get_c128_speed
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_set_c128_speed:
|
||||
cmp #SPEED_2X
|
||||
lda #$00 ; clear VIC-IIe test bit
|
||||
rol a ; carry flag is speed bit
|
||||
sta C128_VICIIE_CLK
|
||||
|
||||
_get_c128_speed:
|
||||
lda C128_VICIIE_CLK
|
||||
and #$01
|
||||
ldx #>$0000
|
||||
rts
|
||||
24
libsrc/c128/acc_detect_c128.s
Normal file
24
libsrc/c128/acc_detect_c128.s
Normal file
@@ -0,0 +1,24 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-23
|
||||
;
|
||||
|
||||
; unsigned char detect_c128 (void);
|
||||
;
|
||||
;/* Check if the C128 8502 CPU is the current CPU.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * 0x00 : C128 8502 is not the current CPU
|
||||
; * 0x01 : C128 8502 is the current CPU
|
||||
; */
|
||||
|
||||
.export _detect_c128
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_detect_c128:
|
||||
ldx #$00
|
||||
lda #$01
|
||||
|
||||
; Make sure the CPU is a 8502
|
||||
.byte $3A ; NOP on 8502, DEA on 65(S)C(E)02, 4510 and 65816
|
||||
rts
|
||||
34
libsrc/c128/acc_detect_scpu.s
Normal file
34
libsrc/c128/acc_detect_scpu.s
Normal file
@@ -0,0 +1,34 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-08
|
||||
;
|
||||
|
||||
; unsigned char detect_scpu (void);
|
||||
;
|
||||
;/* Check for the presence of the SuperCPU cartridge.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * 0x00 : SuperCPU cartridge not present
|
||||
; * 0x01 : SuperCPU cartridge present
|
||||
; */
|
||||
|
||||
.export _detect_scpu
|
||||
|
||||
.include "accelerator.inc"
|
||||
_detect_scpu:
|
||||
ldx #$00
|
||||
txa
|
||||
|
||||
; Make sure the current CPU is a 65816
|
||||
clc
|
||||
.byte $E2,$01 ; NOP #$01 on 6510 and 65(S)C02, LDA $(01,S),Y on 65CE02 and 4510, SEP #$01 on 65816
|
||||
bcc not_found ; carry will be set on 65816
|
||||
|
||||
; 65816 has been detected, make sure it's the SuperCPU cartridge
|
||||
|
||||
lda SuperCPU_Detect
|
||||
asl
|
||||
bcs not_found
|
||||
found:
|
||||
lda #$01
|
||||
not_found:
|
||||
rts
|
||||
59
libsrc/c128/acc_scpu_speed.s
Normal file
59
libsrc/c128/acc_scpu_speed.s
Normal file
@@ -0,0 +1,59 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-09
|
||||
;
|
||||
|
||||
; unsigned char __fastcall__ set_scpu_speed (unsigned char speed);
|
||||
;
|
||||
;/* Set the speed of the SuperCPU cartridge, using SPEED_SLOW will switch to
|
||||
; * 1 Mhz mode, SPEED_20X or SPEED_FAST will switch to 20 Mhz mode.
|
||||
; *
|
||||
; * Note that any value lower than SPEED_20X will switch to 1 Mhz mode, and
|
||||
; * any value higher or equal to SPEED_20X will switch to 20 Mhz mode.
|
||||
; *
|
||||
; * This function will return the actual speed the CPU is at after trying
|
||||
; * to set the requested speed, if this is not the speed that was requested
|
||||
; * then possibly the hardware speed switch prevented any software speed
|
||||
; * switching.
|
||||
; *
|
||||
; * This function does not check for the presence of the SuperCPU cartridge,
|
||||
; * make sure you use 'detect_scpu();' before using.
|
||||
; */
|
||||
|
||||
; unsigned char get_scpu_speed (void);
|
||||
;
|
||||
;/* Get the speed of the SuperCPU cartridge.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * SPEED_1X : 1 Mhz mode
|
||||
; * SPEED_20X : 20 Mhz mode
|
||||
; *
|
||||
; * This function does not check for the presence of the SuperCPU cartridge,
|
||||
; * make sure you use 'detect_scpu();' before using.
|
||||
; */
|
||||
|
||||
.export _set_scpu_speed
|
||||
.export _get_scpu_speed
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_set_scpu_speed:
|
||||
cmp #SPEED_20X
|
||||
bcs high_speed
|
||||
low_speed:
|
||||
sta SuperCPU_Slow
|
||||
jmp _get_scpu_speed
|
||||
|
||||
high_speed:
|
||||
sta SuperCPU_Fast
|
||||
|
||||
_get_scpu_speed:
|
||||
ldx #$00
|
||||
lda SuperCPU_Speed_Mode
|
||||
asl
|
||||
asl
|
||||
bcc is_fast_speed
|
||||
lda #SPEED_1X
|
||||
rts
|
||||
is_fast_speed:
|
||||
lda #SPEED_20X
|
||||
rts
|
||||
70
libsrc/c128/cpeekc.s
Normal file
70
libsrc/c128/cpeekc.s
Normal file
@@ -0,0 +1,70 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2017-06-26, Greg King
|
||||
;
|
||||
; char cpeekc (void);
|
||||
;
|
||||
|
||||
.export _cpeekc
|
||||
|
||||
.import plot, popa
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "c128.inc"
|
||||
|
||||
|
||||
_cpeekc:
|
||||
lda MODE
|
||||
bmi @c80
|
||||
|
||||
ldy CURS_X
|
||||
lda (SCREEN_PTR),y ; get char
|
||||
|
||||
@return:
|
||||
and #<~$80 ; remove reverse flag
|
||||
|
||||
; Convert the screen code into a PetSCII code.
|
||||
; $00 - $1F: +$40
|
||||
; $20 - $3F
|
||||
; $40 - $5f: +$20
|
||||
; $60 - $7F: +$40
|
||||
|
||||
cmp #$20
|
||||
bcs @sk1 ;(bge)
|
||||
ora #$40
|
||||
rts
|
||||
|
||||
@sk1: cmp #$40
|
||||
bcc @end ;(blt)
|
||||
cmp #$60
|
||||
bcc @sk2 ;(blt)
|
||||
;sec
|
||||
adc #$20 - $01
|
||||
@sk2: ;clc ; both above cmp and adc clear carry flag
|
||||
adc #$20
|
||||
@end: rts
|
||||
|
||||
@c80:
|
||||
lda SCREEN_PTR
|
||||
ldy SCREEN_PTR+1
|
||||
clc
|
||||
adc CURS_X
|
||||
bcc @s
|
||||
iny
|
||||
|
||||
; get byte from VDC mem
|
||||
@s: ldx #VDC_DATA_LO
|
||||
stx VDC_INDEX
|
||||
@L0: bit VDC_INDEX
|
||||
bpl @L0
|
||||
sta VDC_DATA
|
||||
dex
|
||||
stx VDC_INDEX
|
||||
sty VDC_DATA
|
||||
|
||||
ldx #VDC_RAM_RW
|
||||
stx VDC_INDEX
|
||||
@L1: bit VDC_INDEX
|
||||
bpl @L1 ; wait for blanking
|
||||
lda VDC_DATA
|
||||
jmp @return
|
||||
56
libsrc/c128/cpeekcolor.s
Normal file
56
libsrc/c128/cpeekcolor.s
Normal file
@@ -0,0 +1,56 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2017-06-26, Greg King
|
||||
;
|
||||
; unsigned char cpeekcolor (void);
|
||||
;
|
||||
|
||||
.export _cpeekcolor
|
||||
|
||||
.include "c128.inc"
|
||||
|
||||
|
||||
_cpeekcolor:
|
||||
bit MODE
|
||||
bmi @c80
|
||||
|
||||
ldy CURS_X
|
||||
lda (CRAM_PTR),y ; get color
|
||||
and #$0F
|
||||
ldx #>$0000
|
||||
rts
|
||||
|
||||
@c80: lda CRAM_PTR
|
||||
ldy CRAM_PTR+1
|
||||
clc
|
||||
adc CURS_X
|
||||
bcc @s
|
||||
iny
|
||||
|
||||
; get byte from VDC mem
|
||||
@s: ldx #VDC_DATA_LO
|
||||
stx VDC_INDEX
|
||||
@L0: bit VDC_INDEX
|
||||
bpl @L0
|
||||
sta VDC_DATA
|
||||
dex
|
||||
stx VDC_INDEX
|
||||
sty VDC_DATA
|
||||
|
||||
ldx #VDC_RAM_RW
|
||||
stx VDC_INDEX
|
||||
@L1: bit VDC_INDEX
|
||||
bpl @L1 ; wait for blanking
|
||||
lda VDC_DATA
|
||||
and #$0F
|
||||
|
||||
; translate VDC->VIC colour
|
||||
|
||||
vdctovic:
|
||||
ldy #$0F + 1
|
||||
@L2: dey
|
||||
cmp $CE5C,y
|
||||
bne @L2
|
||||
tya
|
||||
ldx #>$0000
|
||||
rts
|
||||
51
libsrc/c128/cpeekrevers.s
Normal file
51
libsrc/c128/cpeekrevers.s
Normal file
@@ -0,0 +1,51 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2017-06-26, Greg King
|
||||
;
|
||||
; unsigned char cpeekrevers (void);
|
||||
;
|
||||
|
||||
.export _cpeekrevers
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "c128.inc"
|
||||
|
||||
|
||||
_cpeekrevers:
|
||||
lda MODE
|
||||
bmi @c80
|
||||
|
||||
ldy CURS_X
|
||||
lda (SCREEN_PTR),y ; get char
|
||||
|
||||
@return:
|
||||
and #$80 ; get reverse flag
|
||||
asl a
|
||||
tax ; ldx #>$0000
|
||||
rol a ; return boolean value
|
||||
rts
|
||||
|
||||
@c80:
|
||||
lda SCREEN_PTR
|
||||
ldy SCREEN_PTR+1
|
||||
clc
|
||||
adc CURS_X
|
||||
bcc @s
|
||||
iny
|
||||
|
||||
; get byte from VDC mem
|
||||
@s: ldx #VDC_DATA_LO
|
||||
stx VDC_INDEX
|
||||
@L0: bit VDC_INDEX
|
||||
bpl @L0
|
||||
sta VDC_DATA
|
||||
dex
|
||||
stx VDC_INDEX
|
||||
sty VDC_DATA
|
||||
|
||||
ldx #VDC_RAM_RW
|
||||
stx VDC_INDEX
|
||||
@L1: bit VDC_INDEX
|
||||
bpl @L1 ; wait for blanking
|
||||
lda VDC_DATA
|
||||
jmp @return
|
||||
159
libsrc/c128/cpeeks.s
Normal file
159
libsrc/c128/cpeeks.s
Normal file
@@ -0,0 +1,159 @@
|
||||
;
|
||||
; 2017-07-05, Greg King
|
||||
; 2017-12-12, Groepaz
|
||||
;
|
||||
; void cpeeks (char* s, unsigned length);
|
||||
;
|
||||
|
||||
.export _cpeeks
|
||||
|
||||
.import popax
|
||||
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
|
||||
|
||||
.macpack generic
|
||||
|
||||
; FIXME c128 needs special version that handles the 80-column VDC.
|
||||
|
||||
.include "c128.inc"
|
||||
|
||||
_cpeeks:
|
||||
eor #<$FFFF ; counting a word upward is faster
|
||||
sta ptr3 ; so, we use -(length + 1)
|
||||
txa
|
||||
eor #>$FFFF
|
||||
sta ptr3+1
|
||||
|
||||
lda MODE
|
||||
bmi c80
|
||||
|
||||
lda SCREEN_PTR
|
||||
ldx SCREEN_PTR+1
|
||||
sta ptr2
|
||||
stx ptr2+1
|
||||
ldy CURS_X
|
||||
sty tmp2
|
||||
|
||||
jsr popax
|
||||
sta tmp1 ; (will be a .Y index)
|
||||
stx ptr1+1
|
||||
ldx #<$0000
|
||||
stx ptr1
|
||||
bze L3 ; branch always
|
||||
|
||||
L4: ldy tmp2
|
||||
lda (ptr2),y ; get char
|
||||
iny
|
||||
bnz L2
|
||||
inc ptr2+1
|
||||
L2: sty tmp2
|
||||
and #<~$80 ; remove reverse bit
|
||||
|
||||
; Convert the screen code into a PetSCII code.
|
||||
; $00 - $1F: +$40
|
||||
; $20 - $3F
|
||||
; $40 - $5f: +$20
|
||||
; $60 - $7F: +$40
|
||||
|
||||
cmp #$20
|
||||
blt @sk1 ;(bcc)
|
||||
cmp #$40
|
||||
blt L5
|
||||
cmp #$60
|
||||
blt @sk2 ;(bcc)
|
||||
clc
|
||||
@sk1: adc #$20
|
||||
@sk2: ;clc ; both above cmp and adc clear carry flag
|
||||
adc #$20
|
||||
|
||||
L5: ldy tmp1
|
||||
sta (ptr1),y
|
||||
iny
|
||||
bnz L1
|
||||
inc ptr1+1
|
||||
L1: sty tmp1
|
||||
|
||||
L3: inc ptr3 ; count length
|
||||
bnz L4
|
||||
inc ptr3+1
|
||||
bnz L4
|
||||
|
||||
txa ; terminate the string
|
||||
ldy tmp1
|
||||
sta (ptr1),y
|
||||
rts
|
||||
|
||||
;-----------------------------------------------------------
|
||||
c80:
|
||||
lda SCREEN_PTR
|
||||
clc
|
||||
adc CURS_X
|
||||
sta ptr2
|
||||
lda SCREEN_PTR+1
|
||||
adc #0
|
||||
sta ptr2+1
|
||||
|
||||
jsr popax
|
||||
sta tmp1 ; (will be a .Y index)
|
||||
stx ptr1+1
|
||||
ldx #<$0000
|
||||
stx ptr1
|
||||
bze L3a ; branch always
|
||||
|
||||
L4a:
|
||||
lda ptr2
|
||||
ldy ptr2+1
|
||||
inc ptr2
|
||||
bne @s
|
||||
inc ptr2+1
|
||||
@s:
|
||||
; get byte from VDC mem
|
||||
ldx #VDC_DATA_LO
|
||||
stx VDC_INDEX
|
||||
@L0: bit VDC_INDEX
|
||||
bpl @L0
|
||||
sta VDC_DATA
|
||||
dex
|
||||
stx VDC_INDEX
|
||||
sty VDC_DATA
|
||||
|
||||
ldx #VDC_RAM_RW
|
||||
stx VDC_INDEX
|
||||
@L1: bit VDC_INDEX
|
||||
bpl @L1 ; wait for blanking
|
||||
lda VDC_DATA
|
||||
|
||||
and #<~$80 ; remove reverse bit
|
||||
|
||||
; Convert the screen code into a PetSCII code.
|
||||
; $00 - $1F: +$40
|
||||
; $20 - $3F
|
||||
; $40 - $5f: +$20
|
||||
; $60 - $7F: +$40
|
||||
|
||||
cmp #$20
|
||||
blt @sk1 ;(bcc)
|
||||
cmp #$40
|
||||
blt L5a
|
||||
cmp #$60
|
||||
blt @sk2 ;(bcc)
|
||||
clc
|
||||
@sk1: adc #$20
|
||||
@sk2: ;clc ; both above cmp and adc clear carry flag
|
||||
adc #$20
|
||||
|
||||
L5a: ldy tmp1
|
||||
sta (ptr1),y
|
||||
iny
|
||||
bnz L1a
|
||||
inc ptr1+1
|
||||
L1a: sty tmp1
|
||||
|
||||
L3a: inc ptr3 ; count length
|
||||
bnz L4a
|
||||
inc ptr3+1
|
||||
bnz L4a
|
||||
|
||||
lda #0 ; terminate the string
|
||||
ldy tmp1
|
||||
sta (ptr1),y
|
||||
rts
|
||||
@@ -55,6 +55,8 @@ REU_TRIGGER = $FF00 ; REU command trigger
|
||||
OP_COPYFROM = $ED
|
||||
OP_COPYTO = $EC
|
||||
|
||||
OP_COPYFROM_ALOAD = $B1
|
||||
OP_COPYTO_ALOAD = $B0
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
@@ -92,17 +94,56 @@ INSTALL:
|
||||
cmp REU_REUADDR ; Check for presence of REU
|
||||
bne nodevice
|
||||
|
||||
ldy #>(128*4) ; Assume 128KB
|
||||
lda REU_STATUS
|
||||
and #$10 ; Check size bit
|
||||
beq @L1
|
||||
ldy #>(256*4) ; 256KB when size bit is set
|
||||
@L1: sty pagecount+1
|
||||
|
||||
; determine the size
|
||||
php
|
||||
sei
|
||||
ldy #$FF
|
||||
sty curpage
|
||||
sty curpage+1 ; Invalidate the current page
|
||||
txa ; X = A = EM_ERR_OK
|
||||
loop:
|
||||
sty window
|
||||
jsr reu_size_check_common
|
||||
ldx #OP_COPYTO_ALOAD
|
||||
stx REU_COMMAND
|
||||
dey
|
||||
cpy #$FF
|
||||
bne loop
|
||||
iny
|
||||
size_loop:
|
||||
jsr reu_size_check_common
|
||||
ldx #OP_COPYFROM_ALOAD
|
||||
stx REU_COMMAND
|
||||
cpy window
|
||||
bne size_found
|
||||
iny
|
||||
bne size_loop
|
||||
size_found:
|
||||
plp
|
||||
ldx #$00
|
||||
cpy #$00 ; too many pages, shave off 2
|
||||
bne pagecount_ok
|
||||
dex
|
||||
dex
|
||||
dey
|
||||
pagecount_ok:
|
||||
stx pagecount
|
||||
sty pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
rts
|
||||
|
||||
; common REU setup for size check
|
||||
reu_size_check_common:
|
||||
sty REU_REUADDR+2
|
||||
ldx #<window
|
||||
stx REU_C64ADDR
|
||||
ldx #>window
|
||||
stx REU_C64ADDR+1
|
||||
ldx #$00
|
||||
stx REU_REUADDR
|
||||
stx REU_REUADDR+1
|
||||
stx REU_COUNT+1
|
||||
stx REU_CONTROL
|
||||
inx
|
||||
stx REU_COUNT
|
||||
rts
|
||||
|
||||
; No REU found
|
||||
|
||||
21
libsrc/c128/isfast.s
Normal file
21
libsrc/c128/isfast.s
Normal file
@@ -0,0 +1,21 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-03-19
|
||||
;
|
||||
; unsigned char isfast (void);
|
||||
; /* Returns 1 if the CPU is in 2MHz mode. */
|
||||
;
|
||||
|
||||
.export _isfast
|
||||
|
||||
.include "c128.inc"
|
||||
|
||||
|
||||
.proc _isfast
|
||||
|
||||
lda VIC_CLK_128
|
||||
and #$01
|
||||
ldx #$00
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READ
|
||||
.addr 0 ; IRQ entry unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READ
|
||||
.addr 0 ; IRQ entry not used
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
@@ -88,7 +88,6 @@ pages: .byte 1 ; Number of screens available
|
||||
.addr BAR
|
||||
.addr TEXTSTYLE
|
||||
.addr OUTTEXT
|
||||
.addr 0 ; IRQ entry is unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
|
||||
@@ -89,7 +89,6 @@ pages: .byte 0 ; Number of screens available
|
||||
.addr BAR
|
||||
.addr TEXTSTYLE
|
||||
.addr OUTTEXT
|
||||
.addr 0 ; IRQ entry is unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
;
|
||||
; Target-specific black & white values for use by the target-shared TGI kernel
|
||||
;
|
||||
|
||||
.include "tgi-kernel.inc"
|
||||
|
||||
.export tgi_color_black:zp = $00
|
||||
.export tgi_color_white:zp = $01
|
||||
22
libsrc/c16/fast.s
Normal file
22
libsrc/c16/fast.s
Normal file
@@ -0,0 +1,22 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-03-20
|
||||
;
|
||||
; void fast (void);
|
||||
; /* Switch the CPU into double clock mode. */
|
||||
;
|
||||
|
||||
.export _fast
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
|
||||
.proc _fast
|
||||
|
||||
lda TED_CLK
|
||||
and #%11111101
|
||||
sta TED_CLK
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
22
libsrc/c16/isfast.s
Normal file
22
libsrc/c16/isfast.s
Normal file
@@ -0,0 +1,22 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-03-20
|
||||
;
|
||||
; unsigned char isfast (void);
|
||||
; /* Returns 1 if the CPU is in double clock mode. */
|
||||
;
|
||||
|
||||
.export _isfast
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
|
||||
.proc _isfast
|
||||
|
||||
lda TED_CLK
|
||||
lsr
|
||||
and #$01
|
||||
ldx #$00
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
22
libsrc/c16/slow.s
Normal file
22
libsrc/c16/slow.s
Normal file
@@ -0,0 +1,22 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-03-28
|
||||
;
|
||||
; void slow (void);
|
||||
; /* Switch the CPU into single clock mode. */
|
||||
;
|
||||
|
||||
.export _slow
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
|
||||
.proc _slow
|
||||
|
||||
lda TED_CLK
|
||||
ora #%00000010
|
||||
sta TED_CLK
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
5
libsrc/c64/acc_c128_speed.s
Normal file
5
libsrc/c64/acc_c128_speed.s
Normal file
@@ -0,0 +1,5 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-23
|
||||
;
|
||||
|
||||
.include "../c128/acc_c128_speed.s"
|
||||
64
libsrc/c64/acc_c64dtv_speed.s
Normal file
64
libsrc/c64/acc_c64dtv_speed.s
Normal file
@@ -0,0 +1,64 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-14
|
||||
;
|
||||
|
||||
; unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);
|
||||
;
|
||||
;/* Set the speed of the C64DTV, using SPEED_SLOW will switch to
|
||||
; * slow mode, SPEED_2X or SPEED_FAST will switch to fast mode.
|
||||
; *
|
||||
; * Note that any value higher or equal to SPEED_2X will switch to fast mode.
|
||||
; *
|
||||
; * This function will return the actual speed the CPU is at after trying
|
||||
; * to set the requested speed, to my knowledge the switching should not fail.
|
||||
; *
|
||||
; * This function does not check for the presence of the C64DTV,
|
||||
; * make sure you use 'detect_c64dtv();' before using.
|
||||
; */
|
||||
|
||||
; unsigned char get_c64dtv_speed (void);
|
||||
;
|
||||
;/* Get the speed of the C64DTV.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * SPEED_1X : slow mode
|
||||
; * SPEED_2X : fast mode
|
||||
; *
|
||||
; * This function does not check for the presence of the C64DTV,
|
||||
; * make sure you use 'detect_c64dtv();' before using.
|
||||
; */
|
||||
|
||||
.export _set_c64dtv_speed
|
||||
.export _get_c64dtv_speed
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_set_c64dtv_speed:
|
||||
cmp #SPEED_2X
|
||||
bcs high_speed
|
||||
low_speed:
|
||||
ldx #C64DTV_Slow
|
||||
set_speed:
|
||||
.byte $32,$99 ; SAC #$99 set accumulator to reg 9 (cpu control)
|
||||
txa ; (re)set skip and burst bits
|
||||
.byte $32,$00 ; SAC #$00 set accumulator back to reg 0
|
||||
jmp _get_c64dtv_speed
|
||||
|
||||
high_speed:
|
||||
ldx #C64DTV_Fast
|
||||
bne set_speed
|
||||
|
||||
|
||||
_get_c64dtv_speed:
|
||||
.byte $32,$99 ; SAC #$99 set accumulator to reg 9 (cpu control)
|
||||
tax
|
||||
.byte $32,$00 ; SAC #$00 set accumulator back to reg 0
|
||||
txa
|
||||
and #C64DTV_Fast
|
||||
bne in_fast_mode
|
||||
lda #$00
|
||||
.byte $2C
|
||||
in_fast_mode:
|
||||
lda #$01
|
||||
ldx #$00
|
||||
rts
|
||||
69
libsrc/c64/acc_c65_speed.s
Executable file
69
libsrc/c64/acc_c65_speed.s
Executable file
@@ -0,0 +1,69 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-27
|
||||
;
|
||||
|
||||
; unsigned char __fastcall__ set_c65_speed (unsigned char speed);
|
||||
;
|
||||
;/* Set the speed of the C65 CPU, using SPEED_SLOW will switch to
|
||||
; * 1 Mhz mode, SPEED_3X or SPEED_FAST will switch to 3.5 Mhz (fast) mode.
|
||||
; *
|
||||
; * Note that any value higher or equal to SPEED_3X will switch to fast mode.
|
||||
; *
|
||||
; * This function will return the actual speed the CPU is at after trying
|
||||
; * to set the requested speed, to my knowledge the switching should not fail.
|
||||
; *
|
||||
; * This function does not check for the presence of a C65/C64DX in C64 mode,
|
||||
; * make sure you use 'detect_c65();' before using.
|
||||
; */
|
||||
|
||||
; unsigned char get_c65_speed (void);
|
||||
;
|
||||
;/* Get the speed of the C65 CPU.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * SPEED_SLOW : 1 Mhz mode
|
||||
; * SPEED_3X : 3.5 Mhz mode
|
||||
; *
|
||||
; * This function does not check for the presence of a C65/C64DX in C64 mode,
|
||||
; * make sure you use 'detect_c65();' before using.
|
||||
; */
|
||||
|
||||
.export _set_c65_speed
|
||||
.export _get_c65_speed
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_set_c65_speed:
|
||||
tay
|
||||
jsr activate_new_vic_mode
|
||||
cpy #SPEED_3X
|
||||
bcs high_speed
|
||||
low_speed:
|
||||
and #$BF
|
||||
store_speed:
|
||||
sta C65_VICIII_CTRL_B
|
||||
lda C65_VICIII_CTRL_B
|
||||
jmp return_c65_speed
|
||||
|
||||
high_speed:
|
||||
ora #$40
|
||||
bne store_speed
|
||||
|
||||
_get_c65_speed:
|
||||
jsr activate_new_vic_mode
|
||||
return_c65_speed:
|
||||
sta C65_VICIII_KEY
|
||||
and #$40
|
||||
beq speed_is_slow ; when this branch is taken then register A is already set to SPEED_SLOW
|
||||
lda #SPEED_3X
|
||||
speed_is_slow:
|
||||
ldx #$00
|
||||
rts
|
||||
|
||||
activate_new_vic_mode:
|
||||
lda #C65_VICIII_UNLOCK_1
|
||||
sta C65_VICIII_KEY
|
||||
lda #C65_VICIII_UNLOCK_2
|
||||
sta C65_VICIII_KEY
|
||||
lda C65_VICIII_CTRL_B
|
||||
rts
|
||||
100
libsrc/c64/acc_chameleon_speed.s
Executable file
100
libsrc/c64/acc_chameleon_speed.s
Executable file
@@ -0,0 +1,100 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-25
|
||||
;
|
||||
|
||||
; unsigned char __fastcall__ set_chameleon_speed (unsigned char speed);
|
||||
;
|
||||
;/* Set the speed of the Chameleon cartridge, the following inputs
|
||||
; * are accepted:
|
||||
; * SPEED_SLOW : 1 Mhz mode
|
||||
; * SPEED_1X : 1 Mhz mode
|
||||
; * SPEED_2X : 2 Mhz mode
|
||||
; * SPEED_3X : 3 Mhz mode
|
||||
; * SPEED_4X : 4 Mhz mode
|
||||
; * SPEED_5X : 5 Mhz mode
|
||||
; * SPEED_6X : 6 Mhz mode
|
||||
; * SPEED_FAST : Maximum speed mode
|
||||
; *
|
||||
; * Note that any value higher or equal to SPEED_7X will switch to maximum
|
||||
; * speed mode.
|
||||
; *
|
||||
; * This function will return the actual speed the CPU is at after trying
|
||||
; * to set the requested speed, to my knowledge the switching should not fail.
|
||||
; *
|
||||
; * This function does not check for the presence of the Chameleon cartridge,
|
||||
; * make sure you use 'detect_chameleon();' before using.
|
||||
; */
|
||||
|
||||
; unsigned char get_chameleon_speed (void);
|
||||
;
|
||||
;/* Get the speed of the Chameleon cartridge.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * SPEED_SLOW : Slow mode
|
||||
; * SPEED_2X : 2Mhz mode
|
||||
; * SPEED_3X : 3Mhz mode
|
||||
; * SPEED_4X : 4Mhz mode
|
||||
; * SPEED_5X : 5Mhz mode
|
||||
; * SPEED_6X : 6Mhz mode
|
||||
; * SPEED_FAST : Maximum speed mode
|
||||
; *
|
||||
; * This function does not check for the presence of the Chameleon cartridge,
|
||||
; * make sure you use 'detect_chameleon();' before using.
|
||||
; */
|
||||
|
||||
.export _set_chameleon_speed
|
||||
.export _get_chameleon_speed
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_set_chameleon_speed:
|
||||
cmp #SPEED_7X
|
||||
bcs maximum_speed
|
||||
cmp #SPEED_1X
|
||||
beq low_speed
|
||||
ora #$80
|
||||
set_speed:
|
||||
jsr activate_regs
|
||||
sta CHAMELEON_CFGTUR
|
||||
jmp return_speed
|
||||
|
||||
low_speed:
|
||||
lda #CHAMELEON_CFGTUR_LIMIT_1MHZ
|
||||
bne set_speed
|
||||
|
||||
maximum_speed:
|
||||
lda #CHAMELEON_CFGTUR_LIMIT_NONE
|
||||
bne set_speed
|
||||
|
||||
_get_chameleon_speed:
|
||||
jsr activate_regs
|
||||
return_speed:
|
||||
ldx #$00
|
||||
lda CHAMELEON_CFGTUR
|
||||
tay
|
||||
and #%10000000
|
||||
beq return_value
|
||||
tya
|
||||
and #%00001000
|
||||
bne is_slow_mode
|
||||
tya
|
||||
and #%00000111
|
||||
beq is_max_mode
|
||||
return_value:
|
||||
ldy #CHAMELEON_DISABLE_REGS
|
||||
sty CHAMELEON_CFGENA
|
||||
rts
|
||||
|
||||
is_slow_mode:
|
||||
txa
|
||||
bne return_value
|
||||
|
||||
is_max_mode:
|
||||
lda #SPEED_FAST
|
||||
bne return_value
|
||||
|
||||
activate_regs:
|
||||
ldy #CHAMELEON_ENABLE_REGS
|
||||
sty CHAMELEON_CFGENA
|
||||
rts
|
||||
|
||||
33
libsrc/c64/acc_detect_c128.s
Normal file
33
libsrc/c64/acc_detect_c128.s
Normal file
@@ -0,0 +1,33 @@
|
||||
;
|
||||
; 2018-04-20, Marco van den Heuvel
|
||||
; 2018-04-26, Greg King
|
||||
;
|
||||
|
||||
; unsigned char detect_c128 (void);
|
||||
;
|
||||
;/* Check for the presence of a C128 in C64 mode.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * 0x00 : C128 in C64 mode not present
|
||||
; * 0x01 : C128 in C64 mode present
|
||||
; */
|
||||
|
||||
.export _detect_c128
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_detect_c128:
|
||||
ldx #>$0001
|
||||
lda #<$0001
|
||||
|
||||
; Make sure the CPU is an 8502.
|
||||
.byte $3A ; NOP on 8502, DEA on 65(S)C(E)02, 4510, and 65816
|
||||
beq detect_end
|
||||
|
||||
; Make sure a C128 VIC-IIe is present.
|
||||
ldy C128_VICIIE_CLK
|
||||
cpy #$FF
|
||||
bne detect_end
|
||||
txa ; return zero when not VIC-IIe
|
||||
detect_end:
|
||||
rts
|
||||
44
libsrc/c64/acc_detect_c64dtv.s
Normal file
44
libsrc/c64/acc_detect_c64dtv.s
Normal file
@@ -0,0 +1,44 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-14
|
||||
;
|
||||
|
||||
; unsigned char detect_c64dtv (void);
|
||||
;
|
||||
;/* Check for the presence of the C64DTV.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * 0x00 : C64DTV not present
|
||||
; * 0x01 : C64DTV present
|
||||
; */
|
||||
|
||||
.export _detect_c64dtv
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_detect_c64dtv:
|
||||
ldy C64DTV_Extended_Regs
|
||||
lda #$00
|
||||
ldx $D000
|
||||
|
||||
; Make sure the CPU is a 6510
|
||||
.byte $1A ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816
|
||||
bne not_found
|
||||
lda #$01
|
||||
sta C64DTV_Extended_Regs
|
||||
|
||||
; Check if $D000 is mirrored at $D040
|
||||
cpx $D040
|
||||
bne found
|
||||
inc $D000
|
||||
cpx $D040
|
||||
bne not_found
|
||||
found:
|
||||
lda #$01
|
||||
.byte $2C
|
||||
not_found:
|
||||
lda #$00
|
||||
stx $D000
|
||||
ldx #$00
|
||||
sty C64DTV_Extended_Regs
|
||||
rts
|
||||
|
||||
55
libsrc/c64/acc_detect_c65.s
Executable file
55
libsrc/c64/acc_detect_c65.s
Executable file
@@ -0,0 +1,55 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-27
|
||||
;
|
||||
|
||||
; unsigned char detect_c65 (void);
|
||||
;
|
||||
;/* Check for the presence of a C65/C64DX in C64 mode.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * 0x00 : C65/C64DX in C64 mode not present
|
||||
; * 0x01 : C65/C64DX in C64 mode present
|
||||
; */
|
||||
|
||||
.export _detect_c65
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_detect_c65:
|
||||
ldy $D000
|
||||
|
||||
; Make sure the CPU is not a 65816
|
||||
clc
|
||||
.byte $E2,$01 ; NOP #$01 on 6510 and 65(S)C02, LDA $(01,S),Y on 65CE02 and 4510, SEP #$01 on 65816
|
||||
lda #$00
|
||||
tax
|
||||
bcs not_found ; carry will be set on 65816
|
||||
|
||||
; Make sure the CPU is not a 6510
|
||||
.byte $1A ; NOP on 6510, INA on 65(S)C(E)02
|
||||
beq not_found
|
||||
txa
|
||||
|
||||
; Make sure the CPU is a 65CE02/4510
|
||||
.byte $A3,$A3 ; NOP NOP on 65(S)C02, LDZ #$A3 on 65CE02 and 4510
|
||||
.byte $6B ; NOP on 65(S)C02, TZA on 65CE02 and 4510
|
||||
cmp #$A3
|
||||
bne not_found
|
||||
|
||||
; Switch to VICIII mode and check if $D040 is a mirror of $D000
|
||||
ldy #C65_VICIII_UNLOCK_1
|
||||
sty C65_VICIII_KEY
|
||||
ldy #C65_VICIII_UNLOCK_2
|
||||
sty C65_VICIII_KEY
|
||||
cpy $D040
|
||||
bne found
|
||||
inc $D000
|
||||
cpy $D040
|
||||
bne not_found
|
||||
|
||||
found:
|
||||
lda #$01
|
||||
not_found:
|
||||
sty $D000
|
||||
sta C65_VICIII_KEY
|
||||
rts
|
||||
39
libsrc/c64/acc_detect_chameleon.s
Executable file
39
libsrc/c64/acc_detect_chameleon.s
Executable file
@@ -0,0 +1,39 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-25
|
||||
;
|
||||
|
||||
; unsigned char detect_chameleon (void);
|
||||
;
|
||||
;/* Check for the presence of the Chameleon cartridge.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * 0x00 : Chameleon cartridge not present
|
||||
; * 0x01 : Chameleon cartridge present
|
||||
; */
|
||||
|
||||
.export _detect_chameleon
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_detect_chameleon:
|
||||
lda #$00
|
||||
tax
|
||||
|
||||
; Make sure the CPU is a 6510
|
||||
.byte $1A ; NOP on 6510, INA on 65(S)C(E)02, 4510 and 65816
|
||||
bne not_found
|
||||
|
||||
ldy CHAMELEON_CFGENA
|
||||
lda #CHAMELEON_ENABLE_REGS
|
||||
sta CHAMELEON_CFGENA
|
||||
lda CHAMELEON_CFGENA
|
||||
sty CHAMELEON_CFGENA
|
||||
cmp #$FF
|
||||
beq not_found
|
||||
found:
|
||||
lda #$01
|
||||
.byte $24
|
||||
not_found:
|
||||
txa
|
||||
rts
|
||||
|
||||
34
libsrc/c64/acc_detect_scpu.s
Normal file
34
libsrc/c64/acc_detect_scpu.s
Normal file
@@ -0,0 +1,34 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-08
|
||||
;
|
||||
|
||||
; unsigned char detect_scpu (void);
|
||||
;
|
||||
;/* Check for the presence of the SuperCPU cartridge.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * 0x00 : SuperCPU cartridge not present
|
||||
; * 0x01 : SuperCPU cartridge present
|
||||
; */
|
||||
|
||||
.export _detect_scpu
|
||||
|
||||
.include "accelerator.inc"
|
||||
_detect_scpu:
|
||||
ldx #$00
|
||||
txa
|
||||
|
||||
; Make sure the current CPU is a 65816
|
||||
clc
|
||||
.byte $E2,$01 ; NOP #$01 on 6510 and 65(S)C02, LDA $(01,S),Y on 65CE02 and 4510, SEP #$01 on 65816
|
||||
bcc not_found ; carry will be set on 65816
|
||||
|
||||
; 65816 has been detected, make sure it's the SuperCPU cartridge
|
||||
|
||||
lda SuperCPU_Detect
|
||||
asl
|
||||
bcs not_found
|
||||
found:
|
||||
lda #$01
|
||||
not_found:
|
||||
rts
|
||||
45
libsrc/c64/acc_detect_turbomaster.s
Executable file
45
libsrc/c64/acc_detect_turbomaster.s
Executable file
@@ -0,0 +1,45 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-30
|
||||
;
|
||||
|
||||
; unsigned char detect_turbomaster (void);
|
||||
;
|
||||
;/* Check for the presence of a Turbo Master cartridge.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * 0x00 : TurboMaster cartridge not present
|
||||
; * 0x01 : TurboMaster cartridge present
|
||||
; */
|
||||
|
||||
.export _detect_turbomaster
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_detect_turbomaster:
|
||||
lda #$00
|
||||
tax
|
||||
|
||||
; Make sure the current CPU is not a 6510
|
||||
.byte $1A ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816
|
||||
beq not_found
|
||||
|
||||
; Make sure the current CPU is not a 65816
|
||||
clc
|
||||
.byte $E2,$01 ; NOP #$01 on 65(S)C02, LDA $(01,S),Y on 65CE02 and 4510, SEP #$01 on 65816
|
||||
bcs not_found ; carry will be set on 65816
|
||||
|
||||
; Make sure the current CPU is not a 65CE02/4510
|
||||
.byte $A3,$A3 ; NOP NOP on 65(S)C02 and LDZ #$00 on 65CE02 and 4510
|
||||
.byte $6B ; NOP on 65(S)C02 and TZA on 65CE02 and 4510
|
||||
cmp #$A3
|
||||
beq not_found
|
||||
|
||||
; Check for turbo master basic replacement
|
||||
ldy TURBOMASTER_DETECT
|
||||
cpy #$A2
|
||||
beq found
|
||||
not_found:
|
||||
txa
|
||||
found:
|
||||
rts
|
||||
|
||||
59
libsrc/c64/acc_scpu_speed.s
Normal file
59
libsrc/c64/acc_scpu_speed.s
Normal file
@@ -0,0 +1,59 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-09
|
||||
;
|
||||
|
||||
; unsigned char __fastcall__ set_scpu_speed (unsigned char speed);
|
||||
;
|
||||
;/* Set the speed of the SuperCPU cartridge, using SPEED_SLOW will switch to
|
||||
; * 1 Mhz mode, SPEED_20X or SPEED_FAST will switch to 20 Mhz mode.
|
||||
; *
|
||||
; * Note that any value lower than SPEED_20X will switch to 1 Mhz mode, and
|
||||
; * any value higher or equal to SPEED_20X will switch to 20 Mhz mode.
|
||||
; *
|
||||
; * This function will return the actual speed the CPU is at after trying
|
||||
; * to set the requested speed, if this is not the speed that was requested
|
||||
; * then possibly the hardware speed switch prevented any software speed
|
||||
; * switching.
|
||||
; *
|
||||
; * This function does not check for the presence of the SuperCPU cartridge,
|
||||
; * make sure you use 'detect_scpu();' before using.
|
||||
; */
|
||||
|
||||
; unsigned char get_scpu_speed (void);
|
||||
;
|
||||
;/* Get the speed of the SuperCPU cartridge.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * SPEED_1X : 1 Mhz mode
|
||||
; * SPEED_20X : 20 Mhz mode
|
||||
; *
|
||||
; * This function does not check for the presence of the SuperCPU cartridge,
|
||||
; * make sure you use 'detect_scpu();' before using.
|
||||
; */
|
||||
|
||||
.export _set_scpu_speed
|
||||
.export _get_scpu_speed
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_set_scpu_speed:
|
||||
cmp #SPEED_20X
|
||||
bcs high_speed
|
||||
low_speed:
|
||||
sta SuperCPU_Slow
|
||||
jmp _get_scpu_speed
|
||||
|
||||
high_speed:
|
||||
sta SuperCPU_Fast
|
||||
|
||||
_get_scpu_speed:
|
||||
ldx #$00
|
||||
lda SuperCPU_Speed_Mode
|
||||
asl
|
||||
asl
|
||||
bcc is_fast_speed
|
||||
lda #SPEED_1X
|
||||
rts
|
||||
is_fast_speed:
|
||||
lda #SPEED_20X
|
||||
rts
|
||||
56
libsrc/c64/acc_turbomaster_speed.s
Executable file
56
libsrc/c64/acc_turbomaster_speed.s
Executable file
@@ -0,0 +1,56 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-30
|
||||
;
|
||||
|
||||
; unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed);
|
||||
;
|
||||
;/* Set the speed of the Turbo Master cartridge, using SPEED_SLOW will switch to
|
||||
; * 1 Mhz mode, SPEED_4X or SPEED_FAST will switch to 4 Mhz mode.
|
||||
; *
|
||||
; * Note that any value higher or equal to SPEED_4X will switch to 4 Mhz mode,
|
||||
; * any value lower than SPEED_4X will switch to 1 Mhz mode.
|
||||
; *
|
||||
; * This function will return the actual speed the CPU is at after trying
|
||||
; * to set the requested speed, if the speed is different it might indicate
|
||||
; * that the hardware switch has locked the speed.
|
||||
; *
|
||||
; * This function does not check for the presence of a Turbo Master cartridge,
|
||||
; * make sure you use 'detect_turbomaster();' before using.
|
||||
; */
|
||||
|
||||
; unsigned char get_turbomaster_speed (void);
|
||||
;
|
||||
;/* Get the speed of the Turbo Master cartridge.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * SPEED_SLOW : 1 Mhz mode
|
||||
; * SPEED_4X : 4 Mhz mode
|
||||
; *
|
||||
; * This function does not check for the presence of a Turbo Master cartridge,
|
||||
; * make sure you use 'detect_turbomaster();' before using.
|
||||
; */
|
||||
|
||||
.export _set_turbomaster_speed
|
||||
.export _get_turbomaster_speed
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_set_turbomaster_speed:
|
||||
tay
|
||||
lda TURBOMASTER_SPEED_REG
|
||||
asl
|
||||
cpy #SPEED_4X
|
||||
ror
|
||||
store_speed:
|
||||
sta TURBOMASTER_SPEED_REG
|
||||
|
||||
_get_turbomaster_speed:
|
||||
ldx #$00
|
||||
lda TURBOMASTER_SPEED_REG
|
||||
and #$80
|
||||
beq is_slow_speed
|
||||
is_high_speed:
|
||||
lda #SPEED_4X
|
||||
is_slow_speed:
|
||||
rts
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
; Constants
|
||||
|
||||
BASE = $D000
|
||||
PAGES = ($10000 - BASE) / 256
|
||||
PAGES = ($FF00 - BASE) / 256
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
@@ -267,5 +267,3 @@ COPYTO: sta ptr3
|
||||
sta ptr1+1 ; From
|
||||
|
||||
jmp common
|
||||
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@ REU_TRIGGER = $FF00 ; REU command trigger
|
||||
OP_COPYFROM = $ED
|
||||
OP_COPYTO = $EC
|
||||
|
||||
OP_COPYFROM_ALOAD = $B1
|
||||
OP_COPYTO_ALOAD = $B0
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
@@ -92,19 +95,59 @@ INSTALL:
|
||||
cmp REU_REUADDR ; Check for presence of REU
|
||||
bne nodevice
|
||||
|
||||
ldy #>(128*4) ; Assume 128KB
|
||||
lda REU_STATUS
|
||||
and #$10 ; Check size bit
|
||||
beq @L1
|
||||
ldy #>(256*4) ; 256KB when size bit is set
|
||||
@L1: sty pagecount+1
|
||||
|
||||
; determine the size
|
||||
php
|
||||
sei
|
||||
ldy #$FF
|
||||
sty curpage
|
||||
sty curpage+1 ; Invalidate the current page
|
||||
txa ; X = A = EM_ERR_OK
|
||||
loop:
|
||||
sty window
|
||||
jsr reu_size_check_common
|
||||
ldx #OP_COPYTO_ALOAD
|
||||
stx REU_COMMAND
|
||||
dey
|
||||
cpy #$FF
|
||||
bne loop
|
||||
iny
|
||||
size_loop:
|
||||
jsr reu_size_check_common
|
||||
ldx #OP_COPYFROM_ALOAD
|
||||
stx REU_COMMAND
|
||||
cpy window
|
||||
bne size_found
|
||||
iny
|
||||
bne size_loop
|
||||
size_found:
|
||||
plp
|
||||
ldx #$00
|
||||
cpy #$00 ; too many pages, shave off 2
|
||||
bne pagecount_ok
|
||||
dex
|
||||
dex
|
||||
dey
|
||||
pagecount_ok:
|
||||
stx pagecount
|
||||
sty pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
rts
|
||||
|
||||
; common REU setup for size check
|
||||
reu_size_check_common:
|
||||
sty REU_REUADDR+2
|
||||
ldx #<window
|
||||
stx REU_C64ADDR
|
||||
ldx #>window
|
||||
stx REU_C64ADDR+1
|
||||
ldx #$00
|
||||
stx REU_REUADDR
|
||||
stx REU_REUADDR+1
|
||||
stx REU_COUNT+1
|
||||
stx REU_CONTROL
|
||||
inx
|
||||
stx REU_COUNT
|
||||
rts
|
||||
|
||||
|
||||
; No REU found
|
||||
|
||||
nodevice:
|
||||
|
||||
@@ -15,6 +15,22 @@
|
||||
.export _textcolor := soft80_textcolor ; color.s
|
||||
.export _bgcolor := soft80_bgcolor ; color.s
|
||||
|
||||
; soft80_cpeekc.s
|
||||
.import soft80_cpeekc
|
||||
.export _cpeekc := soft80_cpeekc ; cpeekc.s
|
||||
|
||||
; soft80_cpeekcolor.s
|
||||
.import soft80_cpeekcolor
|
||||
.export _cpeekcolor := soft80_cpeekcolor ; cpeekcolor.s
|
||||
|
||||
; soft80_cpeekrevers.s
|
||||
.import soft80_cpeekrevers
|
||||
.export _cpeekrevers := soft80_cpeekrevers ; cpeekrevers.s
|
||||
|
||||
; soft80_cpeeks.s
|
||||
.import soft80_cpeeks
|
||||
.export _cpeeks := soft80_cpeeks ; cpeeks.s
|
||||
|
||||
; soft80_cputc.s
|
||||
.import soft80_cputc
|
||||
.import soft80_cputcxy
|
||||
@@ -50,3 +66,6 @@
|
||||
; Chars used by chline () and cvline ()
|
||||
.exportzp chlinechar = CH_HLINE
|
||||
.exportzp cvlinechar = CH_VLINE
|
||||
|
||||
.import return1
|
||||
.export _doesclrscrafterexit := return1
|
||||
|
||||
@@ -18,6 +18,22 @@
|
||||
.export _textcolor := soft80mono_textcolor ; color.s
|
||||
.export _bgcolor := soft80mono_bgcolor ; color.s
|
||||
|
||||
; soft80mono_cpeekc.s
|
||||
.import soft80_cpeekc
|
||||
.export _cpeekc := soft80_cpeekc ; cpeekc.s
|
||||
|
||||
; soft80mono_cpeekcolor.s
|
||||
.import soft80mono_cpeekcolor
|
||||
.export _cpeekcolor := soft80mono_cpeekcolor ; cpeekcolor.s
|
||||
|
||||
; soft80mono_cpeekrevers.s
|
||||
.import soft80_cpeekrevers
|
||||
.export _cpeekrevers := soft80_cpeekrevers ; cpeekrevers.s
|
||||
|
||||
; soft80mono_cpeeks.s
|
||||
.import soft80_cpeeks
|
||||
.export _cpeeks := soft80_cpeeks ; cpeeks.s
|
||||
|
||||
; soft80mono_cputc.s
|
||||
.import soft80mono_cputc
|
||||
.import soft80mono_cputcxy
|
||||
@@ -53,3 +69,6 @@
|
||||
; Chars used by chline () and cvline ()
|
||||
.exportzp chlinechar = CH_HLINE
|
||||
.exportzp cvlinechar = CH_VLINE
|
||||
|
||||
.import return1
|
||||
.export _doesclrscrafterexit := return1
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READ
|
||||
.addr IRQ
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
@@ -74,13 +73,22 @@ UNINSTALL:
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; IRQ entry point. Is called from the C layer as a subroutine in the
|
||||
; interrupt. The routine MUST return carry set if the interrupt has been
|
||||
; 'handled' - which means that the interrupt source is gone. Otherwise it
|
||||
; MUST return carry clear.
|
||||
; COUNT: Return the total number of available joysticks in a/x.
|
||||
;
|
||||
|
||||
IRQ: ; cia 2 setup
|
||||
COUNT: lda #<JOY_COUNT
|
||||
ldx #>JOY_COUNT
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; READ: Read a particular joystick passed in A.
|
||||
;
|
||||
|
||||
readadapter:
|
||||
|
||||
sei
|
||||
|
||||
; cia 2 setup
|
||||
ldy #$00 ; port b direction
|
||||
sty $dd03 ; => input
|
||||
|
||||
@@ -144,32 +152,24 @@ IRQ: ; cia 2 setup
|
||||
sta temp4
|
||||
|
||||
fire:
|
||||
; Default Value: $40/64 on PAL
|
||||
; $42/66 on NTSC
|
||||
; FIXME: to be really 100% correct this should restore the correct timer
|
||||
; values for the respective machine (PAL: $4025, NTSC: $4295)
|
||||
; however, this should hardly be a problem in a real world program
|
||||
|
||||
lda #$41
|
||||
sta $dc05
|
||||
; Default Value: $25/37 on PAL
|
||||
; $95/149 on NTSC
|
||||
lda #0
|
||||
sta $dc04
|
||||
|
||||
; We do never "handle" the interrupt, we use it just as a timer.
|
||||
clc
|
||||
cli
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; COUNT: Return the total number of available joysticks in a/x.
|
||||
;
|
||||
READ:
|
||||
pha
|
||||
jsr readadapter
|
||||
pla
|
||||
|
||||
COUNT: lda #<JOY_COUNT
|
||||
ldx #>JOY_COUNT
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; READ: Read a particular joystick passed in A.
|
||||
;
|
||||
|
||||
READ: tax ; Joystick number into X
|
||||
tax ; Joystick number into X
|
||||
bne joy2
|
||||
|
||||
; Read joystick 1
|
||||
@@ -215,4 +215,3 @@ joy4: lda temp4
|
||||
eor #$1F
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READ
|
||||
.addr 0 ; IRQ entry unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READ
|
||||
.addr 0 ; IRQ entry unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READ
|
||||
.addr 0 ; IRQ entry unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
148
libsrc/c64/soft80_cpeekc.s
Normal file
148
libsrc/c64/soft80_cpeekc.s
Normal file
@@ -0,0 +1,148 @@
|
||||
;
|
||||
; 2017-12-28, Groepaz
|
||||
;
|
||||
; char cpeekc (void);
|
||||
;
|
||||
|
||||
.export soft80_cpeekc, soft80_cpeekchar
|
||||
|
||||
.include "c64.inc"
|
||||
.include "soft80.inc"
|
||||
|
||||
.macpack longbranch
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
soft80_cpeekc:
|
||||
jsr soft80_cpeekchar
|
||||
; 0-1F -> A0-BF
|
||||
; 20-7F -> 20-7F
|
||||
cmp #$20
|
||||
bcs @sk
|
||||
;clc
|
||||
adc #$a0
|
||||
@sk:
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
soft80_cpeekchar:
|
||||
|
||||
sei
|
||||
lda #$34
|
||||
sta $01
|
||||
|
||||
lda CURS_X
|
||||
and #$01
|
||||
|
||||
jne @l1a
|
||||
|
||||
; test non-inverted character (left side)
|
||||
|
||||
ldx #0
|
||||
@l2aa:
|
||||
ldy #0
|
||||
|
||||
.repeat 8,line
|
||||
lda (SCREEN_PTR),y
|
||||
and #$f0
|
||||
cmp soft80_hi_charset+(line*$80),x
|
||||
bne @l2b
|
||||
.if (line < 7)
|
||||
iny
|
||||
.endif
|
||||
.endrepeat
|
||||
|
||||
@backok:
|
||||
lda #$36
|
||||
sta $01
|
||||
cli
|
||||
txa ; return char in A
|
||||
ldx #$00 ; revers flag
|
||||
rts
|
||||
@l2b:
|
||||
inx
|
||||
cpx #$80
|
||||
jne @l2aa
|
||||
|
||||
; test inverted character (left side)
|
||||
|
||||
ldx #0
|
||||
@l2aa2:
|
||||
ldy #0
|
||||
|
||||
.repeat 8,line
|
||||
lda (SCREEN_PTR),y
|
||||
and #$f0
|
||||
eor #$f0
|
||||
cmp soft80_hi_charset+(line*$80),x
|
||||
bne @l2b2
|
||||
.if (line < 7)
|
||||
iny
|
||||
.endif
|
||||
.endrepeat
|
||||
|
||||
@backokrevers:
|
||||
lda #$36
|
||||
sta $01
|
||||
cli
|
||||
txa ; return char in A
|
||||
ldx #$01 ; revers flag
|
||||
rts
|
||||
|
||||
@l2b2:
|
||||
inx
|
||||
cpx #$80
|
||||
jne @l2aa2
|
||||
|
||||
@backerr:
|
||||
lda #$36
|
||||
sta $01
|
||||
cli
|
||||
ldx #0
|
||||
txa
|
||||
rts
|
||||
|
||||
; test non-inverted character (right side)
|
||||
|
||||
@l1a:
|
||||
ldx #0
|
||||
@l1aa:
|
||||
ldy #0
|
||||
.repeat 8,line
|
||||
lda (SCREEN_PTR),y
|
||||
and #$0f
|
||||
eor soft80_lo_charset+(line*$80),x
|
||||
bne @l2bb
|
||||
.if line < 7
|
||||
iny
|
||||
.endif
|
||||
.endrepeat
|
||||
jmp @backok
|
||||
@l2bb:
|
||||
inx
|
||||
cpx #$80
|
||||
bne @l1aa
|
||||
|
||||
; test inverted character (right side)
|
||||
|
||||
ldx #0
|
||||
@l1aa2:
|
||||
ldy #0
|
||||
.repeat 8,line
|
||||
lda (SCREEN_PTR),y
|
||||
and #$0f
|
||||
eor #$0f
|
||||
eor soft80_lo_charset+(line*$80),x
|
||||
bne @l2bb2
|
||||
.if line < 7
|
||||
iny
|
||||
.endif
|
||||
.endrepeat
|
||||
jmp @backokrevers
|
||||
@l2bb2:
|
||||
inx
|
||||
cpx #$80
|
||||
bne @l1aa2
|
||||
|
||||
jmp @backerr
|
||||
|
||||
19
libsrc/c64/soft80_cpeekcolor.s
Normal file
19
libsrc/c64/soft80_cpeekcolor.s
Normal file
@@ -0,0 +1,19 @@
|
||||
;
|
||||
; 2017-12-27, Groepaz
|
||||
;
|
||||
; unsigned char cpeekcolor (void);
|
||||
;
|
||||
|
||||
.export soft80_cpeekcolor
|
||||
|
||||
.include "c64.inc"
|
||||
.include "soft80.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
soft80_cpeekcolor:
|
||||
ldy #0
|
||||
lda (CRAM_PTR),y
|
||||
and #$0f
|
||||
ldx #0
|
||||
rts
|
||||
15
libsrc/c64/soft80_cpeekrevers.s
Normal file
15
libsrc/c64/soft80_cpeekrevers.s
Normal file
@@ -0,0 +1,15 @@
|
||||
;
|
||||
; 2017-12-28, Groepaz
|
||||
;
|
||||
; unsigned char cpeekrevers (void);
|
||||
;
|
||||
|
||||
.import soft80_cpeekchar
|
||||
|
||||
.export soft80_cpeekrevers
|
||||
|
||||
soft80_cpeekrevers:
|
||||
jsr soft80_cpeekchar
|
||||
txa
|
||||
ldx #0
|
||||
rts
|
||||
71
libsrc/c64/soft80_cpeeks.s
Normal file
71
libsrc/c64/soft80_cpeeks.s
Normal file
@@ -0,0 +1,71 @@
|
||||
;
|
||||
; 2017-12-27, groepaz
|
||||
;
|
||||
; void cpeeks (char* s, unsigned length);
|
||||
;
|
||||
.export soft80_cpeeks
|
||||
.import soft80_cpeekc, soft80_kplot, popax
|
||||
|
||||
.importzp ptr1, ptr2
|
||||
|
||||
.include "c64.inc"
|
||||
.include "soft80.inc"
|
||||
|
||||
soft80_cpeeks:
|
||||
eor #<$FFFF ; counting a word upward is faster
|
||||
sta ptr2 ; so, we use -(length + 1)
|
||||
txa
|
||||
eor #>$FFFF
|
||||
sta ptr2+1
|
||||
|
||||
jsr popax
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
|
||||
; save current cursor position
|
||||
lda CURS_X
|
||||
pha
|
||||
lda CURS_Y
|
||||
pha
|
||||
|
||||
; get the string
|
||||
@lp:
|
||||
jsr soft80_cpeekc
|
||||
ldy #0
|
||||
sta (ptr1),y
|
||||
|
||||
; advance cursor position
|
||||
ldy CURS_X
|
||||
ldx CURS_Y
|
||||
iny
|
||||
cpy #charsperline
|
||||
bne @sk2
|
||||
ldy #0
|
||||
inx
|
||||
@sk2:
|
||||
sty CURS_X
|
||||
stx CURS_Y
|
||||
clc
|
||||
jsr soft80_kplot
|
||||
|
||||
inc ptr1
|
||||
bne @sk
|
||||
inc ptr1+1
|
||||
@sk:
|
||||
inc ptr2
|
||||
bne @lp
|
||||
inc ptr2+1
|
||||
bne @lp
|
||||
|
||||
; terminate the string
|
||||
lda #0
|
||||
ldy #0
|
||||
sta (ptr1),y
|
||||
|
||||
; restore the cursor position
|
||||
pla
|
||||
tax ; CURS_Y
|
||||
pla
|
||||
tay ; CURS_X
|
||||
clc
|
||||
jmp soft80_kplot
|
||||
17
libsrc/c64/soft80mono_cpeekcolor.s
Normal file
17
libsrc/c64/soft80mono_cpeekcolor.s
Normal file
@@ -0,0 +1,17 @@
|
||||
;
|
||||
; 2017-12-27, Groepaz
|
||||
;
|
||||
; unsigned char cpeekcolor (void);
|
||||
;
|
||||
|
||||
.export soft80mono_cpeekcolor
|
||||
|
||||
.include "c64.inc"
|
||||
.include "soft80.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
soft80mono_cpeekcolor:
|
||||
lda CHARCOLOR
|
||||
ldx #0
|
||||
rts
|
||||
@@ -4,6 +4,7 @@
|
||||
; Based on Stephen L. Judd's GRLIB code.
|
||||
;
|
||||
; 2017-01-13, Greg King
|
||||
; 2018-03-13, Sven Klose
|
||||
;
|
||||
|
||||
.include "zeropage.inc"
|
||||
@@ -57,7 +58,6 @@
|
||||
.addr BAR
|
||||
.addr TEXTSTYLE
|
||||
.addr OUTTEXT
|
||||
.addr 0 ; IRQ entry is unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
@@ -71,12 +71,9 @@ X2 := ptr3
|
||||
Y2 := ptr4
|
||||
TEXT := ptr3
|
||||
|
||||
ROW := tmp2 ; Bitmap row...
|
||||
COL := tmp3 ; ...and column, both set by PLOT
|
||||
TEMP := tmp4
|
||||
TEMP2 := sreg
|
||||
POINT := regsave
|
||||
INRANGE := regsave+2 ; PLOT variable, $00 = coordinates in range
|
||||
|
||||
CHUNK := X2 ; Used in the line routine
|
||||
OLDCHUNK := X2+1 ; Dito
|
||||
@@ -134,7 +131,7 @@ VBASE := $E000 ; Video memory base address
|
||||
;
|
||||
|
||||
INSTALL:
|
||||
rts
|
||||
; rts ; fall through
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
@@ -275,7 +272,7 @@ CLEAR: ldy #$00
|
||||
sta VBASE+$1C00,y
|
||||
sta VBASE+$1D00,y
|
||||
sta VBASE+$1E00,y
|
||||
sta VBASE+$1F00,y
|
||||
sta VBASE+$1E40,y ; preserve vectors
|
||||
iny
|
||||
bne @L1
|
||||
rts
|
||||
@@ -288,7 +285,7 @@ CLEAR: ldy #$00
|
||||
;
|
||||
|
||||
SETVIEWPAGE:
|
||||
rts
|
||||
; rts ; fall through
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n).
|
||||
@@ -455,11 +452,6 @@ GETPIXEL:
|
||||
; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and
|
||||
; X2/Y2 = ptr3/ptr4 using the current drawing color.
|
||||
;
|
||||
; To deal with off-screen coordinates, the current row
|
||||
; and column (40x25) is kept track of. These are set
|
||||
; negative when the point is off the screen, and made
|
||||
; positive when the point is within the visible screen.
|
||||
;
|
||||
; X1,X2 etc. are set up above (x2=LINNUM in particular)
|
||||
; Format is LINE x2,y2,x1,y1
|
||||
;
|
||||
@@ -514,7 +506,7 @@ LINE:
|
||||
stx YINCDEC
|
||||
stx XINCDEC
|
||||
|
||||
jsr CALC ; Set up .X,.Y,POINT, and INRANGE
|
||||
jsr CALC ; Set up .X, .Y, and POINT
|
||||
lda BITCHUNK,X
|
||||
sta OLDCHUNK
|
||||
sta CHUNK
|
||||
@@ -557,15 +549,11 @@ STEPINY:
|
||||
;
|
||||
YLOOP: sta TEMP
|
||||
|
||||
lda INRANGE ;Range check
|
||||
bne @SKIP
|
||||
|
||||
lda (POINT),y ;Otherwise plot
|
||||
lda (POINT),y
|
||||
eor BITMASK
|
||||
and CHUNK
|
||||
eor (POINT),y
|
||||
sta (POINT),y
|
||||
@SKIP:
|
||||
YINCDEC:
|
||||
iny ;Advance Y coordinate
|
||||
cpy #8
|
||||
@@ -582,7 +570,7 @@ YCONT2: lda (POINT),y ;Plot endpoint
|
||||
and CHUNK
|
||||
eor (POINT),y
|
||||
sta (POINT),y
|
||||
YDONE: lda #$36
|
||||
lda #$36
|
||||
sta $01
|
||||
cli
|
||||
rts
|
||||
@@ -593,23 +581,12 @@ YFIXX: ;x=x+1
|
||||
bne YCONT ;If we pass a column boundary...
|
||||
ror CHUNK ;then reset CHUNK to $80
|
||||
sta TEMP2
|
||||
lda COL
|
||||
bmi @C1 ;Skip if column is negative
|
||||
cmp #39 ;End if move past end of screen
|
||||
bcs YDONE
|
||||
@C1: lda POINT ;And add 8 to POINT
|
||||
lda POINT ;And add 8 to POINT
|
||||
adc #8
|
||||
sta POINT
|
||||
bcc @CONT
|
||||
inc POINT+1
|
||||
@CONT: inc COL ;Increment column
|
||||
bne @C2
|
||||
lda ROW ;Range check
|
||||
cmp #25
|
||||
bcs @C2
|
||||
lda #00 ;Passed into col 0
|
||||
sta INRANGE
|
||||
@C2: lda TEMP2
|
||||
@CONT: lda TEMP2
|
||||
dex
|
||||
bne YLOOP
|
||||
beq YCONT2
|
||||
@@ -648,7 +625,7 @@ XCONT2: dex
|
||||
dec COUNTHI ;High bits set?
|
||||
bpl XLOOP
|
||||
|
||||
XDONE: lsr CHUNK ;Advance to last point
|
||||
lsr CHUNK ;Advance to last point
|
||||
jsr LINEPLOT ;Plot the last chunk
|
||||
EXIT: lda #$36
|
||||
sta $01
|
||||
@@ -663,25 +640,14 @@ XFIXC: sta TEMP
|
||||
lda #$FF
|
||||
sta CHUNK
|
||||
sta OLDCHUNK
|
||||
lda COL
|
||||
bmi @C1 ;Skip if column is negative
|
||||
cmp #39 ;End if move past end of screen
|
||||
bcs EXIT
|
||||
@C1: lda POINT
|
||||
lda POINT
|
||||
clc
|
||||
adc #8
|
||||
sta POINT
|
||||
bcc @CONT
|
||||
lda TEMP
|
||||
bcc XCONT1
|
||||
inc POINT+1
|
||||
@CONT: inc COL
|
||||
bne @C2
|
||||
lda ROW
|
||||
cmp #25
|
||||
bcs @C2
|
||||
lda #00
|
||||
sta INRANGE
|
||||
@C2: lda TEMP
|
||||
sec
|
||||
bcs XCONT1
|
||||
jmp XCONT1
|
||||
;
|
||||
; Check to make sure there isn't a high bit, plot chunk,
|
||||
; and update Y-coordinate.
|
||||
@@ -713,17 +679,14 @@ XINCDEC:
|
||||
; room, gray hair, etc.)
|
||||
;
|
||||
LINEPLOT: ; Plot the line chunk
|
||||
lda INRANGE
|
||||
bne @SKIP
|
||||
|
||||
lda (POINT),Y ; Otherwise plot
|
||||
lda (POINT),Y
|
||||
eor BITMASK
|
||||
ora CHUNK
|
||||
and OLDCHUNK
|
||||
eor CHUNK
|
||||
eor (POINT),Y
|
||||
sta (POINT),Y
|
||||
@SKIP: rts
|
||||
rts
|
||||
|
||||
;
|
||||
; Subroutine to fix up pointer when Y decreases through
|
||||
@@ -731,23 +694,16 @@ LINEPLOT: ; Plot the line chunk
|
||||
;
|
||||
FIXY: cpy #255 ;Y=255 or Y=8
|
||||
beq @DECPTR
|
||||
|
||||
@INCPTR: ;Add 320 to pointer
|
||||
ldy #0 ;Y increased through 7
|
||||
lda ROW
|
||||
bmi @C1 ;If negative, then don't update
|
||||
cmp #24
|
||||
bcs @TOAST ;If at bottom of screen then quit
|
||||
@C1: lda POINT
|
||||
lda POINT
|
||||
adc #<320
|
||||
sta POINT
|
||||
lda POINT+1
|
||||
adc #>320
|
||||
sta POINT+1
|
||||
@CONT1: inc ROW
|
||||
bne @DONE
|
||||
lda COL
|
||||
bpl @CLEAR
|
||||
@DONE: rts
|
||||
rts
|
||||
|
||||
@DECPTR: ;Okay, subtract 320 then
|
||||
ldy #7 ;Y decreased through 0
|
||||
@@ -758,21 +714,8 @@ FIXY: cpy #255 ;Y=255 or Y=8
|
||||
lda POINT+1
|
||||
sbc #>320
|
||||
sta POINT+1
|
||||
@CONT2: dec ROW
|
||||
bmi @TOAST
|
||||
lda ROW
|
||||
cmp #24
|
||||
bne @DONE
|
||||
lda COL
|
||||
bmi @DONE
|
||||
@CLEAR: lda #00
|
||||
sta INRANGE
|
||||
rts
|
||||
|
||||
@TOAST: pla ;Remove old return address
|
||||
pla
|
||||
jmp EXIT ;Restore interrupts, etc.
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where
|
||||
; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4 using the current drawing color.
|
||||
@@ -897,48 +840,36 @@ OUTTEXT:
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Calculate all variables to plot the pixel at X1/Y1. If the point is out
|
||||
; of range, a carry is returned and INRANGE is set to a value !0 zero. If
|
||||
; the coordinates are valid, INRANGE is zero and the carry clear.
|
||||
; Calculate all variables to plot the pixel at X1/Y1.
|
||||
|
||||
CALC: lda Y1
|
||||
sta ROW
|
||||
sta TEMP2
|
||||
and #7
|
||||
tay
|
||||
lda Y1+1
|
||||
lsr ; Neg is possible
|
||||
ror ROW
|
||||
ror TEMP2
|
||||
lsr
|
||||
ror ROW
|
||||
ror TEMP2
|
||||
lsr
|
||||
ror ROW
|
||||
ror TEMP2
|
||||
|
||||
lda #00
|
||||
sta POINT
|
||||
lda ROW
|
||||
lda TEMP2
|
||||
cmp #$80
|
||||
ror
|
||||
ror POINT
|
||||
cmp #$80
|
||||
ror
|
||||
ror POINT ; row*64
|
||||
adc ROW ; +row*256
|
||||
adc TEMP2 ; +row*256
|
||||
clc
|
||||
adc #>VBASE ; +bitmap base
|
||||
sta POINT+1
|
||||
|
||||
lda X1
|
||||
tax
|
||||
sta COL
|
||||
lda X1+1
|
||||
lsr
|
||||
ror COL
|
||||
lsr
|
||||
ror COL
|
||||
lsr
|
||||
ror COL
|
||||
|
||||
txa
|
||||
and #$F8
|
||||
clc
|
||||
adc POINT ; +(X AND #$F8)
|
||||
@@ -949,13 +880,4 @@ CALC: lda Y1
|
||||
txa
|
||||
and #7
|
||||
tax
|
||||
|
||||
lda ROW
|
||||
cmp #25
|
||||
bcs @L9
|
||||
lda COL
|
||||
cmp #40
|
||||
bcs @L9
|
||||
lda #00
|
||||
@L9: sta INRANGE
|
||||
rts
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
;
|
||||
; Target-specific black & white values for use by the target-shared TGI kernel
|
||||
;
|
||||
|
||||
.include "tgi-kernel.inc"
|
||||
|
||||
.export tgi_color_black:zp = $00
|
||||
.export tgi_color_white:zp = $01
|
||||
@@ -1,11 +1,11 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 03.06.1999
|
||||
;
|
||||
; void cbm_untlk (void);
|
||||
; void cbm_k_untlk (void);
|
||||
;
|
||||
|
||||
.export _cbm_untlk
|
||||
.export _cbm_k_untlk
|
||||
.import UNTLK
|
||||
|
||||
|
||||
_cbm_untlk = UNTLK
|
||||
_cbm_k_untlk = UNTLK
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
lda #LFN_CLOSED
|
||||
sta fdtab,x
|
||||
lda tmp2 ; Get the handle
|
||||
txa ; Get handle
|
||||
clc
|
||||
adc #LFN_OFFS ; Make LFN from handle
|
||||
jsr CLOSE
|
||||
|
||||
53
libsrc/cbm/cpeekc.s
Normal file
53
libsrc/cbm/cpeekc.s
Normal file
@@ -0,0 +1,53 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2017-06-22, Greg King
|
||||
;
|
||||
; char cpeekc (void);
|
||||
;
|
||||
|
||||
.export _cpeekc
|
||||
|
||||
; Get a system-specific file.
|
||||
; Note: The cbm610, and c128 targets need special
|
||||
; versions that handle RAM banking and the 80-column VDC.
|
||||
|
||||
.if .def(__C16__)
|
||||
.include "plus4.inc" ; both C16 and Plus4
|
||||
.elseif .def(__C64__)
|
||||
.include "c64.inc"
|
||||
.elseif .def(__CBM510__)
|
||||
.import CURS_X: zp, SCREEN_PTR: zp
|
||||
.include "cbm510.inc"
|
||||
.elseif .def(__PET__)
|
||||
.include "pet.inc"
|
||||
.elseif .def(__VIC20__)
|
||||
.include "vic20.inc"
|
||||
.endif
|
||||
|
||||
|
||||
_cpeekc:
|
||||
ldy CURS_X
|
||||
lda (SCREEN_PTR),y ; get screen code
|
||||
ldx #>$0000
|
||||
and #<~$80 ; remove reverse bit
|
||||
|
||||
; Convert the screen code into a PetSCII code.
|
||||
; $00 - $1F: +$40
|
||||
; $20 - $3F
|
||||
; $40 - $5f: +$20
|
||||
; $60 - $7F: +$40
|
||||
|
||||
cmp #$20
|
||||
bcs @sk1 ;(bge)
|
||||
ora #$40
|
||||
rts
|
||||
|
||||
@sk1: cmp #$40
|
||||
bcc @end ;(blt)
|
||||
cmp #$60
|
||||
bcc @sk2 ;(blt)
|
||||
;sec
|
||||
adc #$20 - $01
|
||||
@sk2: ;clc ; both above cmp and adc clear carry flag
|
||||
adc #$20
|
||||
@end: rts
|
||||
28
libsrc/cbm/cpeekcolor.s
Normal file
28
libsrc/cbm/cpeekcolor.s
Normal file
@@ -0,0 +1,28 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2017-06-22, Greg King
|
||||
;
|
||||
; unsigned char cpeekcolor (void);
|
||||
;
|
||||
|
||||
.export _cpeekcolor
|
||||
|
||||
; Get a system-specific file.
|
||||
; Note: The cbm510, cbm610, c128, and Pet targets need special
|
||||
; versions that handle RAM banking, the 80-column VDC, and monochrome.
|
||||
|
||||
.if .def(__C16__)
|
||||
.include "plus4.inc" ; both C16 and Plus4
|
||||
.elseif .def(__C64__)
|
||||
.include "c64.inc"
|
||||
.elseif .def(__VIC20__)
|
||||
.include "vic20.inc"
|
||||
.endif
|
||||
|
||||
|
||||
_cpeekcolor:
|
||||
ldy CURS_X
|
||||
lda (CRAM_PTR),y ; get color
|
||||
and #$0F
|
||||
ldx #>$0000
|
||||
rts
|
||||
35
libsrc/cbm/cpeekrevers.s
Normal file
35
libsrc/cbm/cpeekrevers.s
Normal file
@@ -0,0 +1,35 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2017-06-15, Greg King
|
||||
;
|
||||
; unsigned char cpeekrevers (void);
|
||||
;
|
||||
|
||||
.export _cpeekrevers
|
||||
|
||||
; Get a system-specific file.
|
||||
; Note: The cbm610, and c128 targets need special
|
||||
; versions that handle RAM banking and the 80-column VDC.
|
||||
|
||||
.if .def(__C16__)
|
||||
.include "plus4.inc" ; both C16 and Plus4
|
||||
.elseif .def(__C64__)
|
||||
.include "c64.inc"
|
||||
.elseif .def(__CBM510__)
|
||||
.import CURS_X: zp, SCREEN_PTR: zp
|
||||
.include "cbm510.inc"
|
||||
.elseif .def(__PET__)
|
||||
.include "pet.inc"
|
||||
.elseif .def(__VIC20__)
|
||||
.include "vic20.inc"
|
||||
.endif
|
||||
|
||||
|
||||
_cpeekrevers:
|
||||
ldy CURS_X
|
||||
lda (SCREEN_PTR),y ; get screen code
|
||||
and #$80 ; get reverse bit
|
||||
asl a
|
||||
tax ; ldx #>$0000
|
||||
rol a ; return boolean value
|
||||
rts
|
||||
93
libsrc/cbm/cpeeks.s
Normal file
93
libsrc/cbm/cpeeks.s
Normal file
@@ -0,0 +1,93 @@
|
||||
;
|
||||
; 2017-07-05, Greg King
|
||||
;
|
||||
; void cpeeks (char* s, unsigned length);
|
||||
;
|
||||
|
||||
.export _cpeeks
|
||||
|
||||
.import popax
|
||||
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
|
||||
|
||||
.macpack generic
|
||||
|
||||
; Get a system-specific file.
|
||||
; Note: The cbm610, and c128 targets need special
|
||||
; versions that handle RAM banking and the 80-column VDC.
|
||||
|
||||
.if .def(__C16__)
|
||||
.include "plus4.inc" ; both C16 and Plus4
|
||||
.elseif .def(__C64__)
|
||||
.include "c64.inc"
|
||||
.elseif .def(__CBM510__)
|
||||
.import CURS_X: zp, SCREEN_PTR: zp
|
||||
.include "cbm510.inc"
|
||||
.elseif .def(__PET__)
|
||||
.include "pet.inc"
|
||||
.elseif .def(__VIC20__)
|
||||
.include "vic20.inc"
|
||||
.endif
|
||||
|
||||
|
||||
_cpeeks:
|
||||
eor #<$FFFF ; counting a word upward is faster
|
||||
sta ptr3 ; so, we use -(length + 1)
|
||||
txa
|
||||
eor #>$FFFF
|
||||
sta ptr3+1
|
||||
|
||||
lda SCREEN_PTR
|
||||
ldx SCREEN_PTR+1
|
||||
sta ptr2
|
||||
stx ptr2+1
|
||||
ldy CURS_X
|
||||
sty tmp2
|
||||
|
||||
jsr popax
|
||||
sta tmp1 ; (will be a .Y index)
|
||||
stx ptr1+1
|
||||
ldx #<$0000
|
||||
stx ptr1
|
||||
bze L3 ; branch always
|
||||
|
||||
L4: ldy tmp2
|
||||
lda (ptr2),y ; get char
|
||||
iny
|
||||
bnz L2
|
||||
inc ptr2+1
|
||||
L2: sty tmp2
|
||||
and #<~$80 ; remove reverse bit
|
||||
|
||||
; Convert the screen code into a PetSCII code.
|
||||
; $00 - $1F: +$40
|
||||
; $20 - $3F
|
||||
; $40 - $5f: +$20
|
||||
; $60 - $7F: +$40
|
||||
|
||||
cmp #$20
|
||||
blt @sk1 ;(bcc)
|
||||
cmp #$40
|
||||
blt L5
|
||||
cmp #$60
|
||||
blt @sk2 ;(bcc)
|
||||
clc
|
||||
@sk1: adc #$20
|
||||
@sk2: ;clc ; both above cmp and adc clear carry flag
|
||||
adc #$20
|
||||
|
||||
L5: ldy tmp1
|
||||
sta (ptr1),y
|
||||
iny
|
||||
bnz L1
|
||||
inc ptr1+1
|
||||
L1: sty tmp1
|
||||
|
||||
L3: inc ptr3 ; count length
|
||||
bnz L4
|
||||
inc ptr3+1
|
||||
bnz L4
|
||||
|
||||
txa ; terminate the string
|
||||
ldy tmp1
|
||||
sta (ptr1),y
|
||||
rts
|
||||
@@ -2,10 +2,6 @@
|
||||
; Ullrich von Bassewitz, 16.11.2002
|
||||
;
|
||||
; int open (const char* name, int flags, ...); /* May take a mode argument */
|
||||
;
|
||||
; Be sure to keep the value priority of closeallfiles lower than that of
|
||||
; closeallstreams (which is the high level C file I/O counterpart and must be
|
||||
; called before closeallfiles).
|
||||
|
||||
|
||||
.export _open
|
||||
|
||||
24
libsrc/cbm510/cpeekcolor.s
Normal file
24
libsrc/cbm510/cpeekcolor.s
Normal file
@@ -0,0 +1,24 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2017-06-19, Greg King
|
||||
;
|
||||
; unsigned char cpeekcolor (void);
|
||||
;
|
||||
|
||||
.export _cpeekcolor
|
||||
|
||||
.import CURS_X: zp, CRAM_PTR: zp
|
||||
|
||||
.include "cbm510.inc"
|
||||
|
||||
|
||||
_cpeekcolor:
|
||||
ldx IndReg
|
||||
lda #$0F
|
||||
sta IndReg
|
||||
ldy CURS_X
|
||||
lda (CRAM_PTR),y ; get color
|
||||
stx IndReg
|
||||
and #$0F
|
||||
ldx #>$0000
|
||||
rts
|
||||
16
libsrc/cbm510/doesclrscr.s
Normal file
16
libsrc/cbm510/doesclrscr.s
Normal file
@@ -0,0 +1,16 @@
|
||||
;
|
||||
; 2016-06, Christian Groessler
|
||||
; 2017-07-05, Greg King
|
||||
;
|
||||
; unsigned char doesclrscrafterexit (void);
|
||||
;
|
||||
; Returns 0/1 if, after program termination, the screen isn't/is cleared.
|
||||
;
|
||||
|
||||
.import return1
|
||||
|
||||
; cc65's CBM510 programs switch to a display screen in the program RAM bank;
|
||||
; then, they switch back to the system bank when they exit.
|
||||
; The screen is cleared.
|
||||
|
||||
.export _doesclrscrafterexit := return1
|
||||
@@ -36,7 +36,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READ
|
||||
.addr 0 ; IRQ entry unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
45
libsrc/cbm610/cpeekc.s
Normal file
45
libsrc/cbm610/cpeekc.s
Normal file
@@ -0,0 +1,45 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2017-06-19, Greg King
|
||||
;
|
||||
; char cpeekc (void);
|
||||
;
|
||||
|
||||
.export _cpeekc
|
||||
|
||||
.import CURS_X: zp, CharPtr: zp
|
||||
|
||||
.include "cbm610.inc"
|
||||
|
||||
|
||||
_cpeekc:
|
||||
ldx IndReg
|
||||
ldy #$0F
|
||||
sty IndReg
|
||||
|
||||
ldy CURS_X
|
||||
lda (CharPtr),y ; get char from system bank
|
||||
stx IndReg
|
||||
ldx #>$0000
|
||||
and #<~$80 ; remove reverse bit
|
||||
|
||||
; Convert the screen code into a PetSCII code.
|
||||
; $00 - $1F: +$40
|
||||
; $20 - $3F
|
||||
; $40 - $5f: +$20
|
||||
; $60 - $7F: +$40
|
||||
|
||||
cmp #$20
|
||||
bcs @sk1 ;(bge)
|
||||
ora #$40
|
||||
rts
|
||||
|
||||
@sk1: cmp #$40
|
||||
bcc @end ;(blt)
|
||||
cmp #$60
|
||||
bcc @sk2 ;(blt)
|
||||
;sec
|
||||
adc #$20 - $01
|
||||
@sk2: ;clc ; both above cmp and adc clear carry flag
|
||||
adc #$20
|
||||
@end: rts
|
||||
8
libsrc/cbm610/cpeekcolor.s
Normal file
8
libsrc/cbm610/cpeekcolor.s
Normal file
@@ -0,0 +1,8 @@
|
||||
;
|
||||
; 2017-06-03, Greg King
|
||||
;
|
||||
; unsigned char cpeekcolor (void);
|
||||
;
|
||||
|
||||
.import return1
|
||||
.export _cpeekcolor := return1 ; always COLOR_WHITE
|
||||
29
libsrc/cbm610/cpeekrevers.s
Normal file
29
libsrc/cbm610/cpeekrevers.s
Normal file
@@ -0,0 +1,29 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2017-06-19, Greg King
|
||||
;
|
||||
; unsigned char cpeekrevers (void);
|
||||
;
|
||||
|
||||
.export _cpeekrevers
|
||||
|
||||
.import plot
|
||||
.import CURS_X: zp, CharPtr: zp
|
||||
|
||||
.include "cbm610.inc"
|
||||
|
||||
|
||||
_cpeekrevers:
|
||||
ldx IndReg
|
||||
ldy #$0F
|
||||
sty IndReg
|
||||
|
||||
ldy CURS_X
|
||||
lda (CharPtr),y ; get char from system bank
|
||||
stx IndReg
|
||||
ldx #>$0000
|
||||
and #$80 ; get reverse bit
|
||||
asl a
|
||||
tax ; ldx #>$0000
|
||||
rol a ; return boolean value
|
||||
rts
|
||||
82
libsrc/cbm610/cpeeks.s
Normal file
82
libsrc/cbm610/cpeeks.s
Normal file
@@ -0,0 +1,82 @@
|
||||
;
|
||||
; 2017-07-05, Greg King
|
||||
;
|
||||
; void cpeeks (char* s, unsigned length);
|
||||
;
|
||||
|
||||
.export _cpeeks
|
||||
|
||||
.import popax
|
||||
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
|
||||
.importzp CURS_X, CharPtr
|
||||
|
||||
.include "cbm610.inc"
|
||||
.macpack generic
|
||||
|
||||
|
||||
_cpeeks:
|
||||
eor #<$FFFF ; counting a word upward is faster
|
||||
sta ptr3 ; so, we use -(length + 1)
|
||||
txa
|
||||
eor #>$FFFF
|
||||
sta ptr3+1
|
||||
|
||||
lda CharPtr
|
||||
ldx CharPtr+1
|
||||
sta ptr2
|
||||
stx ptr2+1
|
||||
ldy CURS_X
|
||||
sty tmp2
|
||||
|
||||
jsr popax
|
||||
sta tmp1 ; (will be a .Y index)
|
||||
stx ptr1+1
|
||||
ldx IndReg
|
||||
ldy #<$0000
|
||||
sty ptr1
|
||||
bze L3 ; branch always
|
||||
|
||||
L4: ldy #$0F
|
||||
sty IndReg
|
||||
ldy tmp2
|
||||
lda (ptr2),y ; get char from system bank
|
||||
stx IndReg
|
||||
iny
|
||||
bnz L2
|
||||
inc ptr2+1
|
||||
L2: sty tmp2
|
||||
and #<~$80 ; remove reverse bit
|
||||
|
||||
; Convert the screen code into a PetSCII code.
|
||||
; $00 - $1F: +$40
|
||||
; $20 - $3F
|
||||
; $40 - $5f: +$20
|
||||
; $60 - $7F: +$40
|
||||
|
||||
cmp #$20
|
||||
blt @sk1 ;(bcc)
|
||||
cmp #$40
|
||||
blt L5
|
||||
cmp #$60
|
||||
blt @sk2 ;(bcc)
|
||||
clc
|
||||
@sk1: adc #$20
|
||||
@sk2: ;clc ; both above cmp and adc clear carry flag
|
||||
adc #$20
|
||||
|
||||
L5: ldy tmp1
|
||||
sta (ptr1),y
|
||||
iny
|
||||
bnz L1
|
||||
inc ptr1+1
|
||||
L1: sty tmp1
|
||||
|
||||
L3: inc ptr3 ; count length
|
||||
bnz L4
|
||||
inc ptr3+1
|
||||
bnz L4
|
||||
|
||||
lda #$00 ; terminate the string
|
||||
ldy tmp1
|
||||
sta (ptr1),y
|
||||
rts
|
||||
@@ -10,9 +10,13 @@
|
||||
; Subroutine to detect an 816. Returns
|
||||
;
|
||||
; - carry clear and 0 in A for a NMOS 6502 CPU
|
||||
; - carry set and 1 in A for some CMOS 6502 CPU
|
||||
; - carry set and 1 in A for a 65C02
|
||||
; - carry set and 2 in A for a 65816
|
||||
; - carry set and 3 in A for a 4510
|
||||
; - carry set and 4 in A for a 65SC02
|
||||
; - carry set and 5 in A for a 65CE02
|
||||
; - carry set and 6 in A for a HuC6280
|
||||
; - carry clear and 7 in A for a 2a03/2a07
|
||||
;
|
||||
; This function uses a $1A opcode which is a INA on the 816 and ignored
|
||||
; (interpreted as a NOP) on a NMOS 6502. There are several CMOS versions
|
||||
@@ -25,22 +29,62 @@ _getcpu:
|
||||
lda #0
|
||||
inc a ; .byte $1A ; nop on nmos, inc on every cmos
|
||||
cmp #1
|
||||
bcc @L9
|
||||
bcc @L8
|
||||
|
||||
; This is at least a 65C02, check for a 4510
|
||||
; This is at least a 65C02, check for a 65CE02/4510
|
||||
|
||||
.byte $42,$ea ; neg on 4510, nop #$ea on 65c02, wdm $ea on 65816
|
||||
.byte $42,$EA ; neg on 65CE02/4510, nop #$EA on 65C02, wdm $EA on 65816
|
||||
cmp #1
|
||||
bne @L8
|
||||
beq @L6
|
||||
|
||||
; check for 65816; after 4510, because $eb there is row (rotate word)
|
||||
; This is at least a 65CE02, check for 4510
|
||||
|
||||
lda #5 ; CPU_65CE02 constant
|
||||
.byte $5C ; map on 4510, aug on 65CE02 (acts like 4 byte nop)
|
||||
lda #3 ; CPU_4510 constant
|
||||
nop
|
||||
bne @L9
|
||||
|
||||
; 6502 type of cpu, check for a 2a03/2a07
|
||||
@L8:
|
||||
sed ; set decimal mode, no decimal mode on the 2a03/2a07
|
||||
lda #9
|
||||
clc
|
||||
adc #1 ; $01+$09 = $10 on 6502, $01+$09 = $0A on 2a03/2a07
|
||||
cld
|
||||
cmp #$0a
|
||||
beq @L5
|
||||
lda #0 ; CPU_6502 constant
|
||||
beq @L9
|
||||
@L5:
|
||||
lda #7 ; CPU_2A0x constant
|
||||
bne @L9
|
||||
|
||||
; 65C02 cpu type, check for HuC6280
|
||||
@L4: ldx #6 ; CPU_HUC6280 constant
|
||||
.byte $22,$EA ; sax nop on HuC6280 (A=$06, X=$01), nop #$EA on 65C02 (A=$01, X=$06)
|
||||
bne @L9
|
||||
|
||||
; Check for 65816/65802
|
||||
@L6: xba ; .byte $EB, put $01 in B accu (nop on 65C02/65SC02)
|
||||
dec a ; .byte $3A, A=$00
|
||||
xba ; .byte $EB, A=$01 if 65816/65802 and A=$00 if 65C02/65SC02
|
||||
inc a ; .byte $1A, A=$02 if 65816/65802 and A=$01 if 65C02/65SC02
|
||||
cmp #2
|
||||
beq @L9
|
||||
|
||||
; check for 65SC02
|
||||
|
||||
ldy $F7
|
||||
ldx #0
|
||||
stx $F7
|
||||
.byte $F7,$F7 ; nop nop on 65SC02, smb7 $F7 on 65C02
|
||||
ldx $F7
|
||||
sty $F7
|
||||
cpx #$00
|
||||
bne @L4
|
||||
lda #4 ; CPU_65SC02 constant
|
||||
|
||||
xba ; .byte $eb, put $01 in B accu
|
||||
dec a ; .byte $3a, A=$00 if 65C02
|
||||
xba ; .byte $eb, get $01 back if 65816
|
||||
inc a ; .byte $1a, make $01/$02
|
||||
.byte $2c ; bit instruction to skip next command
|
||||
@L8: lda #3 ; CPU_4510 constant
|
||||
@L9: ldx #0 ; Load high byte of word
|
||||
rts
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
.export _set_irq, _reset_irq
|
||||
.interruptor clevel_irq, 1 ; Export as low priority IRQ handler
|
||||
.import popax, __ZP_START__
|
||||
.import popax, __ZP_START__, jmpvec
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
@@ -84,6 +84,12 @@ zpsave: .res zpsavespace
|
||||
dex
|
||||
bpl @L2
|
||||
|
||||
; Save jmpvec
|
||||
lda jmpvec+1
|
||||
pha
|
||||
lda jmpvec+2
|
||||
pha
|
||||
|
||||
; Set C level interrupt stack
|
||||
lda irqsp
|
||||
ldx irqsp+1
|
||||
@@ -93,15 +99,21 @@ zpsave: .res zpsavespace
|
||||
; Call C level interrupt request handler
|
||||
jsr irqvec
|
||||
|
||||
; Copy back our zero page content
|
||||
; Mark interrupt handled / not handled
|
||||
lsr
|
||||
|
||||
; Restore our zero page content
|
||||
ldx #.sizeof(::zpsave)-1
|
||||
@L3: ldy zpsave,x
|
||||
sty <__ZP_START__,x
|
||||
@L3: lda zpsave,x
|
||||
sta <__ZP_START__,x
|
||||
dex
|
||||
bpl @L3
|
||||
|
||||
; Mark interrupt handled / not handled and return
|
||||
lsr
|
||||
; Restore jmpvec and return
|
||||
pla
|
||||
sta jmpvec+2
|
||||
pla
|
||||
sta jmpvec+1
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
.export _toascii
|
||||
|
||||
_toascii:
|
||||
ldx #$00
|
||||
ldx #>$0000
|
||||
rts
|
||||
@@ -33,7 +33,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READJOY
|
||||
.addr 0 ; IRQ entry not used
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READJOY
|
||||
.addr 0 ; IRQ entry unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
@@ -79,6 +78,7 @@ COUNT:
|
||||
|
||||
READJOY:
|
||||
lda JOY_DATA
|
||||
eor #$FF
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
|
||||
@@ -9,6 +9,4 @@
|
||||
.export _joy_static_stddrv
|
||||
.import _gamate_stdjoy_joy
|
||||
|
||||
.rodata
|
||||
|
||||
_joy_static_stddrv := _gamate_stdjoy_joy
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;
|
||||
; Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2.7.2001
|
||||
; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2015-08-26, Greg King
|
||||
;
|
||||
;
|
||||
; unsigned char __fastcall__ dio_phys_to_log (dhandle_t handle,
|
||||
@@ -59,7 +59,7 @@ _dio_phys_to_log:
|
||||
lda (ptr3),y
|
||||
tay
|
||||
lda driveType,y
|
||||
and #%00000011 ; this is for RamDrive compatibility
|
||||
and #%00001111 ; remove ramDisk flags
|
||||
cmp #DRV_1541
|
||||
beq dio_cts1541
|
||||
cmp #DRV_1571
|
||||
@@ -67,7 +67,7 @@ _dio_phys_to_log:
|
||||
cmp #DRV_1581
|
||||
beq dio_cts1581
|
||||
|
||||
lda #DEV_NOT_FOUND ; unknown device
|
||||
lda #INCOMPATIBLE ; unsupported device
|
||||
ldx #0
|
||||
beq ret
|
||||
|
||||
@@ -91,7 +91,7 @@ _inv_data:
|
||||
lda #INV_TRACK
|
||||
.byte $2c
|
||||
_inv_hand:
|
||||
lda #INCOMPATIBLE
|
||||
lda #DEV_NOT_FOUND
|
||||
ldx #0
|
||||
beq ret
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
;
|
||||
; Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2015-08-24, Greg King
|
||||
;
|
||||
; based on Atari version by Christian Groessler
|
||||
; 2.7.2001
|
||||
;
|
||||
; dhandle_t __fastcall__ dio_open (unsigned char device);
|
||||
; unsigned char __fastcall__ dio_close (dhandle_t handle);
|
||||
@@ -27,11 +27,13 @@ sectsizetab:
|
||||
.code
|
||||
|
||||
_dio_open:
|
||||
pha
|
||||
cmp #4
|
||||
bcs _inv_drive
|
||||
tax
|
||||
lda driveType,x ; check if there's a device
|
||||
beq _inv_drive
|
||||
txa
|
||||
pha
|
||||
clc
|
||||
adc #8 ; normalize devnum
|
||||
sta curDevice
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;
|
||||
; Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2.7.2001
|
||||
; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2015-08-27, Greg King
|
||||
;
|
||||
; this file provides the _dio_read function
|
||||
;
|
||||
@@ -15,7 +15,9 @@
|
||||
|
||||
_dio_read:
|
||||
jsr dio_params
|
||||
tay
|
||||
bne err
|
||||
jsr ReadBlock
|
||||
stx __oserror
|
||||
txa
|
||||
rts
|
||||
err: rts
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;
|
||||
; Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2.7.2001
|
||||
; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2015-08-27, Greg King
|
||||
;
|
||||
; unsigned char __fastcall__ dio_log_to_phys (dhandle_t handle,
|
||||
; unsigned *sectnum, /* input */
|
||||
@@ -55,7 +55,7 @@ _dio_log_to_phys:
|
||||
lda (ptr3),y
|
||||
tay
|
||||
lda driveType,y
|
||||
and #%00000011 ; this is for RamDrive compatibility
|
||||
and #%00001111 ; remove ramDisk flags
|
||||
cmp #DRV_1541
|
||||
beq dio_stc1541
|
||||
cmp #DRV_1571
|
||||
@@ -63,7 +63,7 @@ _dio_log_to_phys:
|
||||
cmp #DRV_1581
|
||||
beq dio_stc1581
|
||||
|
||||
lda #DEV_NOT_FOUND ; unknown device
|
||||
lda #INCOMPATIBLE ; unsupported device
|
||||
ldx #0
|
||||
beq _ret
|
||||
|
||||
@@ -86,7 +86,7 @@ _inv_data:
|
||||
lda #INV_TRACK
|
||||
.byte $2c
|
||||
_inv_hand:
|
||||
lda #INCOMPATIBLE
|
||||
lda #DEV_NOT_FOUND
|
||||
ldx #0
|
||||
beq _ret
|
||||
|
||||
@@ -102,8 +102,8 @@ _loop41:
|
||||
bne _nxt
|
||||
lda tmp1
|
||||
cmp sectab_1541_l+1,x
|
||||
bcc _found
|
||||
_nxt: inx
|
||||
_nxt: bcc _found
|
||||
inx
|
||||
cpx #35
|
||||
bne _loop41
|
||||
beq _inv_data
|
||||
@@ -124,12 +124,11 @@ dio_stc1571:
|
||||
; - fall down to 1541
|
||||
lda tmp2
|
||||
cmp #>683
|
||||
bne _cnt71
|
||||
bne _if71
|
||||
lda tmp1
|
||||
cmp #<683
|
||||
bcc dio_stc1541
|
||||
_if71: bcc dio_stc1541
|
||||
|
||||
_cnt71:
|
||||
lda tmp1
|
||||
sec
|
||||
sbc #<683
|
||||
@@ -138,6 +137,8 @@ _cnt71:
|
||||
sbc #>683
|
||||
sta tmp2
|
||||
jsr dio_stc1541 ; will fall through here
|
||||
tay
|
||||
bne _ret ; result beyond track 70
|
||||
|
||||
ldy #diopp_track
|
||||
lda (ptr1),y
|
||||
@@ -166,7 +167,7 @@ _sub81: lda tmp1
|
||||
sbc #0
|
||||
sta tmp2
|
||||
inx
|
||||
cpx #81
|
||||
cpx #80
|
||||
bne _loop81
|
||||
beq _inv_data
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;
|
||||
; Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2.7.2001
|
||||
; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2015-08-27, Greg King
|
||||
;
|
||||
; this file provides the _dio_write function
|
||||
;
|
||||
@@ -15,5 +15,9 @@
|
||||
|
||||
_dio_write:
|
||||
jsr dio_params
|
||||
tay
|
||||
bne err
|
||||
jsr WriteBlock
|
||||
jmp setoserror
|
||||
|
||||
err: rts
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;
|
||||
; Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2.7.2001
|
||||
; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2015-08-27, Greg King
|
||||
;
|
||||
; this file provides the _dio_write function
|
||||
;
|
||||
@@ -15,7 +15,9 @@
|
||||
|
||||
_dio_write_verify:
|
||||
jsr dio_params
|
||||
tay
|
||||
bne err
|
||||
jsr VerWriteBlock
|
||||
stx __oserror
|
||||
txa
|
||||
rts
|
||||
err: rts
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
;4-2-99
|
||||
|
||||
bootName = $c006
|
||||
gatewayFlag = $c007
|
||||
version = $c00f
|
||||
nationality = $c010
|
||||
sysFlgCopy = $c012
|
||||
c128Flag = $c013
|
||||
dateCopy = $c018
|
||||
mp3Flag = $c014
|
||||
dateCopy = $c018
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
;
|
||||
; 10.09.2001
|
||||
;
|
||||
; Plus4 and GEOS 1.1 detection by
|
||||
; Marco van den Heuvel, 2010-02-02
|
||||
; Plus4, Gateway, MP3 and GEOS 1.1 detection by
|
||||
; Marco van den Heuvel, 2018-02-07
|
||||
;
|
||||
|
||||
; unsigned char get_ostype (void);
|
||||
@@ -26,11 +26,20 @@ _get_ostype:
|
||||
and #%11110000
|
||||
cmp #$10
|
||||
beq geos10
|
||||
cmp #$13 ; either 1.3 or 1.5
|
||||
beq geos13check
|
||||
lda gatewayFlag
|
||||
cmp #$41
|
||||
beq gateway
|
||||
lda mp3Flag
|
||||
cmp #$4d
|
||||
beq megapatch3
|
||||
lda c128Flag ; we're on at least 2.0
|
||||
cmp #$18
|
||||
beq geos_on_plus4
|
||||
ora version
|
||||
rts
|
||||
geos13:
|
||||
geos10:
|
||||
lda version
|
||||
rts
|
||||
@@ -40,6 +49,21 @@ geos11:
|
||||
geos_on_plus4:
|
||||
lda #$04
|
||||
rts
|
||||
gateway:
|
||||
lda #$08
|
||||
ora c128Flag
|
||||
rts
|
||||
megapatch3:
|
||||
lda #$03
|
||||
ora c128Flag
|
||||
rts
|
||||
geos13check:
|
||||
lda mp3Flag
|
||||
cmp #$03
|
||||
bne geos13
|
||||
geos15:
|
||||
lda #$15
|
||||
rts
|
||||
|
||||
_get_tv:
|
||||
jsr _get_ostype
|
||||
|
||||
@@ -74,7 +74,6 @@ aspect: .word $00D4 ; Aspect ratio (based on 4/3 display)
|
||||
.addr BAR
|
||||
.addr TEXTSTYLE
|
||||
.addr OUTTEXT
|
||||
.addr 0 ; IRQ entry is unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
;
|
||||
; Target-specific black & white values, for use by the target-shared TGI kernel
|
||||
;
|
||||
|
||||
.include "tgi-kernel.inc"
|
||||
|
||||
tgi_color_black = $00
|
||||
tgi_color_white = $01
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
.import joy_libref
|
||||
.importzp ptr1
|
||||
.interruptor joy_irq ; Export as IRQ handler
|
||||
|
||||
.include "joy-kernel.inc"
|
||||
.include "joy-error.inc"
|
||||
@@ -26,7 +25,6 @@ joy_install: jmp $0000
|
||||
joy_uninstall: jmp $0000
|
||||
joy_count: jmp $0000
|
||||
joy_read: jmp $0000
|
||||
joy_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes
|
||||
|
||||
; Driver header signature
|
||||
.rodata
|
||||
@@ -73,18 +71,7 @@ _joy_install:
|
||||
cpy #(JOY_HDR::JUMPTAB + .sizeof(JOY_HDR::JUMPTAB))
|
||||
bne @L1
|
||||
|
||||
jsr joy_install ; Call driver install routine
|
||||
tay ; Test error code
|
||||
bne @L2 ; Bail out if install had errors
|
||||
|
||||
; Install the IRQ vector if the driver needs it. A/X contains the error code
|
||||
; from joy_install, so don't use it.
|
||||
|
||||
ldy joy_irq+2 ; Check high byte of IRQ vector
|
||||
beq @L2 ; Jump if vector invalid
|
||||
ldy #$4C ; JMP opcode
|
||||
sty joy_irq ; Activate IRQ routine
|
||||
@L2: rts
|
||||
jmp joy_install ; Call driver install routine
|
||||
|
||||
; Driver signature invalid
|
||||
|
||||
@@ -108,9 +95,6 @@ copy: lda (ptr1),y
|
||||
; */
|
||||
|
||||
_joy_uninstall:
|
||||
lda #$60 ; RTS opcode
|
||||
sta joy_irq ; Disable IRQ entry point
|
||||
|
||||
jsr joy_uninstall ; Call the driver routine
|
||||
|
||||
_joy_clear_ptr: ; External entry point
|
||||
|
||||
@@ -8,5 +8,3 @@
|
||||
.include "joy-kernel.inc"
|
||||
|
||||
_joy_read = joy_read ; Use driver entry
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user