mirror of
https://github.com/cc65/cc65.git
synced 2026-04-23 23:17:45 +00:00
Updated the cx16 library to the ROM's prerelease 36.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
;
|
||||
; 2020-01-08, Greg King
|
||||
;
|
||||
; void __fastcall__ cbm_k_settim (unsigned long timer);
|
||||
;
|
||||
|
||||
.export _cbm_k_settim
|
||||
.importzp sreg
|
||||
|
||||
.include "cbm.inc"
|
||||
|
||||
|
||||
.proc _cbm_k_settim
|
||||
ldy sreg
|
||||
jmp SETTIM
|
||||
.endproc
|
||||
@@ -25,7 +25,6 @@
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
.proc _clock
|
||||
|
||||
stz sreg + 1 ; Byte 3 always is zero
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ _bgcolor:
|
||||
ora tmp1
|
||||
sta CHARCOLOR ; set new values
|
||||
txa
|
||||
lsr a ; get screen color
|
||||
lsr a ; get old background color
|
||||
lsr a
|
||||
lsr a
|
||||
lsr a
|
||||
|
||||
+3
-3
@@ -61,7 +61,7 @@ L2: lda zpsave,x
|
||||
ldx spsave
|
||||
txs ; Restore stack pointer
|
||||
ldx ramsave
|
||||
stx VIA1::PRA2 ; Restore former RAM bank
|
||||
stx VIA1::PRA ; Restore former RAM bank
|
||||
lda VIA1::PRB
|
||||
and #<~$07
|
||||
ora #$04
|
||||
@@ -85,10 +85,10 @@ init:
|
||||
|
||||
; Change to the second RAM bank.
|
||||
|
||||
lda VIA1::PRA2
|
||||
lda VIA1::PRA
|
||||
sta ramsave ; Save the current RAM bank number
|
||||
lda #$01
|
||||
sta VIA1::PRA2
|
||||
sta VIA1::PRA
|
||||
|
||||
.if 0 ; We don't need to preserve zero-page space for cc65's variables.
|
||||
; Save the zero-page locations that we need.
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
;
|
||||
; 2020-01-10, Greg King
|
||||
;
|
||||
; unsigned char get_numbanks (void);
|
||||
; /* Return the number of RAM banks that the machine has. */
|
||||
;
|
||||
; The Commander X16 version of MEMTOP returns with an extra value:
|
||||
; The accumulator describes the number of RAM banks that exist on the hardware.
|
||||
;
|
||||
|
||||
.export _get_numbanks
|
||||
|
||||
.import MEMTOP
|
||||
|
||||
|
||||
_get_numbanks:
|
||||
sec
|
||||
jsr MEMTOP
|
||||
ldx #>$0000
|
||||
rts
|
||||
@@ -1,20 +0,0 @@
|
||||
;
|
||||
; 2019-12-22, Greg King
|
||||
;
|
||||
; Link an interrupt handler if joysticks are used by a program.
|
||||
;
|
||||
|
||||
.interruptor joy_libref, 9
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
.include "cx16.inc"
|
||||
|
||||
|
||||
joy_libref:
|
||||
lda VERA::IRQ_FLAGS
|
||||
lsr a
|
||||
bcc not_vsync
|
||||
jsr JOYSTICK_SCAN ; Bit-bang game controllers
|
||||
clc ; Let other Jiffy handlers run
|
||||
not_vsync:
|
||||
rts
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
;
|
||||
; 2019-12-22, Greg King
|
||||
; 2020-01-08, Greg King
|
||||
;
|
||||
; unsigned char kbhit (void);
|
||||
; /* Returns non-zero (true) if a typed character is waiting. */
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
|
||||
.proc _kbhit
|
||||
ldy VIA1::PRA2 ; (KEY_COUNT is in RAM bank 0)
|
||||
stz VIA1::PRA2
|
||||
ldy VIA1::PRA ; (KEY_COUNT is in RAM bank 0)
|
||||
stz VIA1::PRA
|
||||
lda KEY_COUNT ; Get number of characters
|
||||
sty VIA1::PRA2
|
||||
sty VIA1::PRA
|
||||
tax ; High byte of return (only its zero/nonzero ...
|
||||
rts ; ... state matters)
|
||||
.endproc
|
||||
|
||||
+12
-2
@@ -1,11 +1,20 @@
|
||||
;
|
||||
; 2019-12-22, Greg King
|
||||
; 2020-01-06, Greg King
|
||||
;
|
||||
; CX16 Kernal functions
|
||||
;
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
|
||||
.export CONSOLE_INIT
|
||||
.export CONSOLE_PUT_CHAR
|
||||
.export CONSOLE_GET_CHAR
|
||||
.export MEMORY_FILL
|
||||
.export MEMORY_COPY
|
||||
.export MEMORY_CRC
|
||||
.export MEMORY_DECOMPRESS
|
||||
.export SPRITE_SET_IMAGE
|
||||
.export SPRITE_SET_POSITION
|
||||
.export FB_INIT
|
||||
.export FB_GET_INFO
|
||||
.export FB_SET_PALETTE
|
||||
@@ -37,7 +46,8 @@
|
||||
.export CLOCK_GET_DATE_TIME
|
||||
.export JOYSTICK_SCAN
|
||||
.export JOYSTICK_GET
|
||||
.export SCRMOD
|
||||
.export SCREEN_SET_MODE
|
||||
.export SCREEN_SET_CHARSET
|
||||
.export MOUSE_CONFIG
|
||||
.export MOUSE_GET
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
;
|
||||
; 2013-05-31, Oliver Schmidt
|
||||
; 2019-11-14, Greg King
|
||||
; 2020-01-06, Greg King
|
||||
;
|
||||
|
||||
.export em_libref
|
||||
.export joy_libref
|
||||
.export mouse_libref
|
||||
.export ser_libref
|
||||
.export tgi_libref
|
||||
@@ -11,6 +12,7 @@
|
||||
.import _exit
|
||||
|
||||
em_libref := _exit
|
||||
joy_libref := _exit
|
||||
mouse_libref := _exit
|
||||
ser_libref := _exit
|
||||
tgi_libref := _exit
|
||||
|
||||
+11
-26
@@ -1,44 +1,29 @@
|
||||
;
|
||||
; Default mouse callbacks for the CX16
|
||||
;
|
||||
; 2019-12-25, Greg King
|
||||
;
|
||||
; All functions in this module should be interrupt-safe
|
||||
; because they might be called from an interrupt handler.
|
||||
; 2020-01-10, Greg King
|
||||
;
|
||||
|
||||
.export _mouse_def_callbacks
|
||||
|
||||
.import MOUSE_GET, SPRITE_SET_POSITION
|
||||
.include "cx16.inc"
|
||||
|
||||
|
||||
msprite:
|
||||
stz VERA::CTRL ; set address for VERA's data port zero
|
||||
lda #<(VERA::SPRITE::ATTRIB::Z_FLIP + 0 * 8)
|
||||
ldx #>(VERA::SPRITE::ATTRIB::Z_FLIP + 0 * 8)
|
||||
ldy #^(VERA::SPRITE::ATTRIB::Z_FLIP + 0 * 8) | VERA::INC0
|
||||
sta VERA::ADDR
|
||||
stx VERA::ADDR+1
|
||||
sty VERA::ADDR+2
|
||||
rts
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Hide the mouse pointer.
|
||||
|
||||
hide: jsr msprite
|
||||
lda VERA::DATA0
|
||||
and #<~VERA::SPRITE::DEPTH::LAYER1
|
||||
sta VERA::DATA0
|
||||
rts
|
||||
hide: ldx #%10000000
|
||||
stx gREG::r0H
|
||||
bra mse
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Show the mouse pointer.
|
||||
|
||||
show: jsr msprite
|
||||
lda VERA::DATA0
|
||||
ora #VERA::SPRITE::DEPTH::LAYER1
|
||||
sta VERA::DATA0
|
||||
rts
|
||||
show: ldx #gREG::r0
|
||||
jsr MOUSE_GET
|
||||
mse: lda #$00 ; mouse sprite
|
||||
jmp SPRITE_SET_POSITION
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Prepare to move the mouse pointer.
|
||||
@@ -53,13 +38,13 @@ draw: ; Fall through
|
||||
; --------------------------------------------------------------------------
|
||||
; Move the mouse pointer X position to the value in .XA .
|
||||
|
||||
movex: ; Already set by drivers
|
||||
movex: ; Already done by Kernal
|
||||
; Fall through
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Move the mouse pointer Y position to the value in .XA .
|
||||
|
||||
movey: rts ; Already set by drivers
|
||||
movey: rts ; Already done by Kernal
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Callback structure
|
||||
|
||||
+12
-16
@@ -1,10 +1,10 @@
|
||||
;
|
||||
; 2019-11-06, Greg King
|
||||
; 2020-01-06, Greg King
|
||||
;
|
||||
; /* Video mode defines */
|
||||
; #define VIDEOMODE_40x30 0x00
|
||||
; #define VIDEOMODE_80x60 0x02
|
||||
; #define VIDEOMODE_320x240 0x80
|
||||
; #define VIDEOMODE_320x200 0x80
|
||||
; #define VIDEOMODE_SWAP (-1)
|
||||
;
|
||||
; signed char __fastcall__ videomode (signed char Mode);
|
||||
@@ -16,29 +16,25 @@
|
||||
|
||||
.export _videomode
|
||||
|
||||
.import SCRMOD
|
||||
.import SCREEN_SET_MODE
|
||||
.include "cx16.inc"
|
||||
|
||||
|
||||
.proc _videomode
|
||||
tax
|
||||
clc ; (Get old mode)
|
||||
jsr SCRMOD
|
||||
pha
|
||||
txa
|
||||
ldx SCREEN_MODE ; Get old mode
|
||||
phx
|
||||
|
||||
sec ; (Set new mode)
|
||||
jsr SCRMOD
|
||||
jsr SCREEN_SET_MODE
|
||||
|
||||
pla ; Get back old mode
|
||||
bcs @L1
|
||||
ldx #>$0000 ; Clear high byte
|
||||
bcs @L1
|
||||
rts
|
||||
|
||||
; The new mode is invalid. Go back to the old mode. Return -1.
|
||||
; The new mode is invalid. Go back to the old one. Return -1.
|
||||
|
||||
@L1: sec
|
||||
jsr SCRMOD
|
||||
lda #<-1
|
||||
tax
|
||||
@L1: sta SCREEN_MODE
|
||||
dex
|
||||
txa
|
||||
rts
|
||||
.endproc
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
;
|
||||
; 2019-12-23, Greg King
|
||||
; 2020-01-08, Greg King
|
||||
;
|
||||
; void waitvsync (void);
|
||||
; /* Wait for the start of the next video field. */
|
||||
@@ -12,10 +12,10 @@
|
||||
.include "cx16.inc"
|
||||
|
||||
_waitvsync:
|
||||
ldx VIA1::PRA2 ; (TIMER is in RAM bank 0)
|
||||
stz VIA1::PRA2
|
||||
ldx VIA1::PRA ; (TIMER is in RAM bank 0)
|
||||
stz VIA1::PRA
|
||||
lda TIMER + 2
|
||||
: cmp TIMER + 2
|
||||
beq :- ; Wait for next jiffy
|
||||
stx VIA1::PRA2
|
||||
stx VIA1::PRA
|
||||
rts
|
||||
|
||||
Reference in New Issue
Block a user