Merge branch 'master' into popptr1

This commit is contained in:
Irgendwer
2018-05-21 13:33:14 +02:00
committed by GitHub
321 changed files with 9563 additions and 2667 deletions

16
libsrc/pce/call.s Normal file
View File

@@ -0,0 +1,16 @@
;
; CC65 runtime: call function via pointer in ax
;
; 1998-08-06, Ullrich von Bassewitz
; 2018-02-28, Greg King
;
.export callax
.importzp ptr1
callax: sta ptr1
stx ptr1+1
; The PC-Engine puts the zero-page at $2000.
jmp (ptr1 + $2000) ; go there

14
libsrc/pce/callptr4.s Normal file
View File

@@ -0,0 +1,14 @@
;
; CC65 runtime: call function via pointer in ptr4
;
; 2018-02-28, Greg King
;
.export callptr4
.importzp ptr4
callptr4:
; The PC-Engine puts the zero-page at $2000.
jmp (ptr4 + $2000)

25
libsrc/pce/cclear.s Normal file
View File

@@ -0,0 +1,25 @@
;
; Ullrich von Bassewitz, 08.08.1998
;
; void cclearxy (unsigned char x, unsigned char y, unsigned char length);
; void cclear (unsigned char length);
;
.export _cclearxy, _cclear
.import gotoxy, cputdirect
.importzp tmp1
_cclearxy:
pha ; Save the length
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cclear
_cclear:
cmp #0 ; Is the length zero?
beq L9 ; Jump if done
sta tmp1
L1: lda #$20 ; Blank - screen code
jsr cputdirect ; Direct output
dec tmp1
bne L1
L9: rts

View File

@@ -5,11 +5,14 @@
;
.export _textcolor, _bgcolor, _bordercolor
.export _textcolor, _bgcolor, _bordercolor
.import return0
.include "pce.inc"
.include "extzp.inc"
_bordercolor = return0
_textcolor:
ldx CHARCOLOR ; get old value
sta CHARCOLOR ; set new value
@@ -32,11 +35,6 @@ _bgcolor:
txa
rts
_bordercolor:
lda #0
tax
rts
.rodata
.export colors

View File

@@ -4,33 +4,26 @@
; by Groepaz/Hitmen <groepaz@gmx.net>
; based on code by Ullrich von Bassewitz <uz@cc65.org>
;
; This must be the *first* file on the linker command line
; 2018-02-11, Greg King
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib
.import push0, _main, zerobss
.import initheap
.import push0, _main
.import IRQStub
; Linker generated
.import __RAM_START__, __RAM_SIZE__
.import __ROM0_START__, __ROM0_SIZE__
.import __ROM_START__, __ROM_SIZE__
.import __STARTUP_LOAD__,__STARTUP_RUN__, __STARTUP_SIZE__
.import __CODE_LOAD__,__CODE_RUN__, __CODE_SIZE__
.import __RODATA_LOAD__,__RODATA_RUN__, __RODATA_SIZE__
.import __DATA_LOAD__,__DATA_RUN__, __DATA_SIZE__
.import __BSS_SIZE__
; Linker-generated
.import __CARTSIZE__
.import __DATA_LOAD__, __DATA_RUN__, __DATA_SIZE__
.import __BSS_RUN__, __BSS_SIZE__
.import __MAIN_START__, __MAIN_SIZE__, __STACKSIZE__
.include "pce.inc"
.include "extzp.inc"
.importzp sp
.importzp ptr1,ptr2
.importzp tmp1,tmp2,tmp3
; ------------------------------------------------------------------------
; Place the startup code in a special segment.
@@ -53,29 +46,27 @@ start:
ldx #$FF ; Stack top ($21FF)
txs
; At startup all MPRs are set to 0, so init them
lda #$ff
tam #%00000001 ; 0000-1FFF = Hardware page
; At power-on, most MPRs have random values; so, initiate them.
lda #$FF
tam #%00000001 ; $0000-$1FFF = Hardware bank
lda #$F8
tam #%00000010 ; 2000-3FFF = Work RAM
; FIXME: setup a larger block of memory to use with C-code
tam #%00000010 ; $2000-$3FFF = Work RAM
;lda #$F7
;tam #%00000100 ; 4000-5FFF = Save RAM
;lda #1
;tam #%00001000 ; 6000-7FFF Page 2
;lda #2
;tam #%00010000 ; 8000-9FFF Page 3
;lda #3
;tam #%00100000 ; A000-BFFF Page 4
;tam #%00000100 ; $4000-$47FF = 2K Battery-backed RAM
;lda #4
;tam #%01000000 ; C000-DFFF Page 5
;lda #0
;tam #%10000000 ; e000-fFFF hucard/syscard bank 0
;tam #%00001000 ; $6000-$7FFF
; Clear work RAM (2000-3FFF)
stz <$00
tii $2000, $2001, $1FFF
lda #$01
ldx #>$8000
cpx #>__CARTSIZE__
bcc @L1 ;(blt)
tam #%00010000 ; $8000-$9FFF = ROM bank 1 (32K block of ROM)
inc a
tam #%00100000 ; $A000-$BFFF = ROM bank 2
inc a
@L1: tam #%01000000 ; $C000-$DFFF = ROM bank 3 (32K) or 1 (16K)
;lda #$00 ; (The reset default)
;tam #%10000000 ; $E000-$FFFF hucard/syscard bank 0
; Initialize hardware
stz TIMER_CTRL ; Timer off
@@ -91,15 +82,16 @@ start:
lda #$05
sta IRQ_MASK ; IRQ1=on
; Clear the BSS data
jsr zerobss
; Copy the .data segment to RAM
tii __DATA_LOAD__, __DATA_RUN__, __DATA_SIZE__
; Clear the .bss segment
stz __BSS_RUN__
tii __BSS_RUN__, __BSS_RUN__ + 1, __BSS_SIZE__ - 1
; Set up the stack
lda #<(__RAM_START__+__RAM_SIZE__)
ldx #>(__RAM_START__+__RAM_SIZE__)
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
sta sp
stx sp + 1

View File

@@ -30,7 +30,6 @@
.addr UNINSTALL
.addr COUNT
.addr READJOY
.addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants

24
libsrc/pce/wherex.s Normal file
View File

@@ -0,0 +1,24 @@
;
; Ullrich von Bassewitz, 2003-05-02
;
; unsigned char wherex (void);
;
.export _wherex
.include "pce.inc"
.include "extzp.inc"
.proc _wherex
lda CURS_X
ldx #$00
rts
.endproc
;-------------------------------------------------------------------------------
; force the init constructor to be imported
.import initconio
conio_init = initconio

24
libsrc/pce/wherey.s Normal file
View File

@@ -0,0 +1,24 @@
;
; Ullrich von Bassewitz, 2003-05-02
;
; unsigned char wherey (void);
;
.export _wherey
.include "pce.inc"
.include "extzp.inc"
.proc _wherey
lda CURS_Y
ldx #$00
rts
.endproc
;-------------------------------------------------------------------------------
; force the init constructor to be imported
.import initconio
conio_init = initconio