1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 15:29:46 +00:00

Cleanups for Creativision.

This commit is contained in:
Christian Groessler 2017-02-01 19:46:04 +01:00
parent 0b2a699b46
commit a08f905224
22 changed files with 291 additions and 314 deletions

View File

@ -12,6 +12,7 @@ SEGMENTS {
VECTORS: load = ROM, run = RAM, type = rw, define = yes;
DATA: load = ROM, run = RAM, type = rw, define = yes, start = $0204;
BSS: load = RAM, type = bss, define = yes;
ONCE: load = ROM, type = ro, optional = yes;
CODE: load = ROM, type = ro;
INIT: load = ROM, type = ro;
RODATA: load = ROM, type = ro;

View File

@ -2,14 +2,14 @@
;** _scrsize.s
;*
.export screensize
.export screensize
.include "creativision.inc"
.include "creativision.inc"
.proc screensize
ldx #SCREEN_COLS
ldy #SCREEN_ROWS
rts
ldx #SCREEN_COLS
ldy #SCREEN_ROWS
rts
.endproc

View File

@ -1,62 +1,62 @@
; Boxchars
boxchars:
; Vertical Line
.byte $18
.byte $18
.byte $18
.byte $18
.byte $18
.byte $18
.byte $18
.byte $18
; Vertical Line
.byte $18
.byte $18
.byte $18
.byte $18
.byte $18
.byte $18
.byte $18
.byte $18
; Horizontal Line
.byte 0
.byte 0
.byte 0
.byte $ff
.byte 0
.byte 0
.byte 0
.byte 0
; Top Left
.byte 0
.byte 0
.byte 0
.byte $1f
.byte $18
.byte $18
.byte $18
.byte $18
; Top Right
.byte 0
.byte 0
.byte 0
.byte $F8
.byte $18
.byte $18
.byte $18
.byte $18
; Horizontal Line
.byte $00
.byte $00
.byte $00
.byte $FF
.byte $00
.byte $00
.byte $00
.byte $00
; Bottom Left
.byte $18
.byte $18
.byte $18
.byte $1F
.byte 0
.byte 0
.byte 0
.byte 0
; Top Left
.byte $00
.byte $00
.byte $00
.byte $1F
.byte $18
.byte $18
.byte $18
.byte $18
; Bottom Right
.byte $18
.byte $18
.byte $18
.byte $F8
.byte 0
.byte 0
.byte 0
.byte 0
; Top Right
.byte $00
.byte $00
.byte $00
.byte $F8
.byte $18
.byte $18
.byte $18
.byte $18
; Bottom Left
.byte $18
.byte $18
.byte $18
.byte $1F
.byte $00
.byte $00
.byte $00
.byte $00
; Bottom Right
.byte $18
.byte $18
.byte $18
.byte $F8
.byte $00
.byte $00
.byte $00
.byte $00

View File

@ -3,27 +3,24 @@
;* void cclear (unsigned char length);
;*
.export _cclearxy, _cclear
.import popa, _gotoxy, cputdirect
.importzp tmp1
_cclearxy:
pha ; Save length
jsr popa ; get Y
jsr _gotoxy
pla
_cclear:
cmp #0 ; Zero length?
beq L2
sta tmp1
L1:
lda #$20 ; Space
jsr cputdirect
dec tmp1
bne L1
L2: rts
.export _cclearxy, _cclear
.import popa, _gotoxy, cputdirect
.importzp tmp1
_cclearxy:
pha ; Save length
jsr popa ; get Y
jsr _gotoxy
pla
_cclear:
cmp #0 ; Zero length?
beq L2
sta tmp1
L1: lda #$20 ; Space
jsr cputdirect
dec tmp1
bne L1
L2: rts

View File

@ -1,17 +1,14 @@
;* cgetc
.export _cgetc
.include "creativision.inc"
.export _cgetc
.include "creativision.inc"
_cgetc:
lda #$80
L1:
bit ZP_KEYBOARD
bpl L1
lda ZP_KEYBOARD
and #$7f
rts
lda #$80
L1: bit ZP_KEYBOARD
bpl L1
lda ZP_KEYBOARD
and #$7F
rts

View File

@ -6,7 +6,7 @@
.importzp tmp1
.include "creativision.inc"
_chlinexy:
pha ; Save the length
jsr popa ; Get y

View File

@ -4,38 +4,38 @@
;* NB: All screen functions assume Graphics Mode 1 in a default configuration.
;* Therefore, this is hard coded to use $1000-$12FF as screen VRAM.
.export _clrscr
.include "creativision.inc"
.export _clrscr
.include "creativision.inc"
_clrscr:
sei ; Disable interrupts. Default INT handler reads VDP_STATUS
; and would lose any setup done here.
lda #$00 ; VRAM offset low
sta VDP_CONTROL_W
lda #$50 ; VRAM offset high ($10 OR $40)
sta VDP_CONTROL_W
lda #$C0 ; Space from ROM setup
ldx #0
ldy #3
L1: sta VDP_DATA_W
inx
bne L1
dey
bne L1
cli ; Let interrupts go again
lda #0
sta CURSOR_X
sta CURSOR_Y
sta <SCREEN_PTR
lda #$10
sta >SCREEN_PTR
rts
sei ; Disable interrupts. Default INT handler reads VDP_STATUS
; and would lose any setup done here.
lda #$00 ; VRAM offset low
sta VDP_CONTROL_W
lda #$50 ; VRAM offset high ($10 OR $40)
sta VDP_CONTROL_W
lda #$C0 ; Space from ROM setup
ldx #0
ldy #3
L1: sta VDP_DATA_W
inx
bne L1
dey
bne L1
cli ; Let interrupts go again
lda #0
sta CURSOR_X
sta CURSOR_Y
sta <SCREEN_PTR
lda #$10
sta >SCREEN_PTR
rts

View File

@ -4,10 +4,10 @@
;* unsigned char __fastcall__ bordercolor (unsigned char color);
;*
.export _textcolor, _bgcolor, _bordercolor
.import return0
.include "creativision.inc"
_bordercolor = return0;
_textcolor = return0;
_bgcolor = return0;
.export _textcolor, _bgcolor, _bordercolor
.import return0
.include "creativision.inc"
_bordercolor = return0;
_textcolor = return0;
_bgcolor = return0;

View File

@ -29,13 +29,13 @@ _cputcxy:
; Plot a character - also used as internal function
_cputc: cmp #$0d ; CR?
_cputc: cmp #$0D ; CR?
bne L1
lda #0
sta CURSOR_X
beq plot ; Recalculate pointers
L1: cmp #$0a ; LF?
L1: cmp #$0A ; LF?
beq newline ; Recalculate pointers
; Printable char of some sort
@ -82,19 +82,19 @@ IS_UPPER:
pha
lda SCREEN_PTR
sei
sta VDP_CONTROL_W
sta VDP_CONTROL_W
lda SCREEN_PTR+1
ora #$40
sta VDP_CONTROL_W
ora #$40
sta VDP_CONTROL_W
pla
clc
adc #160
sta VDP_DATA_W
adc #160
sta VDP_DATA_W
cli
BAD_CHAR:
jmp plot
;-----------------------------------------------------------------------------
; Initialize the conio subsystem. Code goes into the INIT segment, which may
; be reused after startup.
@ -102,24 +102,24 @@ BAD_CHAR:
.segment "INIT"
initconio:
lda #$0
sta SCREEN_PTR
lda #$10
sta SCREEN_PTR+1
lda #$0
sta SCREEN_PTR
lda #$10
sta SCREEN_PTR+1
; Copy box characters to slot
sei
lda #08
sta VDP_CONTROL_W
lda #$46
sta VDP_CONTROL_W
ldx #0
LL:
lda boxchars,x
sta VDP_DATA_W
inx
cpx #48
bne LL
; Copy box characters to slot
sei
lda #08
sta VDP_CONTROL_W
lda #$46
sta VDP_CONTROL_W
ldx #0
cli
jmp plot
LL: lda boxchars,x
sta VDP_DATA_W
inx
cpx #48
bne LL
cli
jmp plot

View File

@ -11,7 +11,7 @@
.proc _gotox
sta CURSOR_X ; Set new position
sta CURSOR_X ; Set new position
tay
ldx CURSOR_Y
jmp setcursor ; Set the cursor to the new position

View File

@ -12,9 +12,9 @@
.proc _gotoxy
sta CURSOR_Y ; Set Y
jsr popa ; Get X
sta CURSOR_X ; Set X
sta CURSOR_Y ; Set Y
jsr popa ; Get X
sta CURSOR_X ; Set X
tay
ldx CURSOR_Y
jmp setcursor ; Set the cursor position

View File

@ -1,6 +1,6 @@
;*
;* Creativision Joystick Function
;*
;*
;* unsigned char __fastcall__ joystate(unsigned char joy);
;*
;* JOY_1 -> Return Left Joystick direction
@ -12,47 +12,47 @@
.export _joystate
.include "creativision.inc"
_joystate:
cmp #1 ; Left Direction
bne l1
lda $11
beq l5
and #$f
and #$0F
lsr a
tax
inx
txa
rts
l1: cmp #2 ; Right Direction
bne l2
lda $13
beq l5
and #$f
and #$0F
lsr a
tax
inx
txa
rts
l2: cmp #3 ; Left Buttons
bne l3
lda $16
beq l5
and #$f
and #$0F
rts
l3: cmp #4
bne l4
lda $17
beq l5
and #$f
and #$0F
rts
l4: lda #0
l5: rts

View File

@ -5,5 +5,5 @@
.export joy_libref, tgi_libref
.import _exit
joy_libref := _exit
tgi_libref := _exit
joy_libref := _exit
tgi_libref := _exit

View File

@ -20,5 +20,3 @@
rts
.endproc

View File

@ -3,40 +3,37 @@
; void __fastcall__ bios_playsound( void *b, unsigned char c);
; void psg_silence( void );
.export _psg_outb, _psg_silence, _psg_delay
.export _bios_playsound
.import popa
.include "creativision.inc"
.export _psg_outb, _psg_silence, _psg_delay
.export _bios_playsound
.import popa
.include "creativision.inc"
_psg_outb:
;* Let BIOS output the value
jmp $FE77
;* Let BIOS output the value
jmp $FE77
_psg_silence:
jmp $FE54
jmp $FE54
_psg_delay:
tay
l1:
lda #200
l2:
sbc #1
bne l2
lda #200
l3:
sbc #1
bne l3
dey
bne l1
rts
tay
l1: lda #200
l2: sbc #1
bne l2
lda #200
l3: sbc #1
bne l3
dey
bne l1
rts
;* Creativision Sound Player
;*
@ -46,23 +43,21 @@ l3:
_bios_playsound:
pha ; Save Length Byte
sei
lda #$D5 ; BIOS volume table low
sta $4
lda #$FC ; BIOS volume table high
sta $5
jsr popa ; Get Sound table pointer low
sta $0
jsr popa ; Get Sound table pointer high
sta $1
pla
tay ; Put length in Y
dey
php
jmp $fbed ; Let BIOS do it's thing
pha ; Save Length Byte
sei
lda #$D5 ; BIOS volume table low
sta $4
lda #$FC ; BIOS volume table high
sta $5
jsr popa ; Get Sound table pointer low
sta $0
jsr popa ; Get Sound table pointer high
sta $1
pla
tay ; Put length in Y
dey
php
jmp $FBED ; Let BIOS do it's thing

View File

@ -34,6 +34,3 @@ utsdata:
; machine
.asciiz "CREATIVISION"

View File

@ -5,7 +5,6 @@
;
.export _wherex
.include "creativision.inc"
.proc _wherex
@ -15,5 +14,3 @@
rts
.endproc

View File

@ -5,7 +5,6 @@
;
.export _wherey
.include "creativision.inc"
.proc _wherey
@ -15,5 +14,3 @@
rts
.endproc

View File

@ -259,6 +259,10 @@ static void SetSys (const char* Sys)
CBMSystem ("__PET__");
break;
case TGT_BBC:
NewSymbol ("__BBC__", 1);
break;
case TGT_APPLE2:
NewSymbol ("__APPLE2__", 1);
break;
@ -278,14 +282,6 @@ static void SetSys (const char* Sys)
NewSymbol ("__GEOS_CBM__", 1);
break;
case TGT_ATMOS:
NewSymbol ("__ATMOS__", 1);
break;
case TGT_BBC:
NewSymbol ("__BBC__", 1);
break;
case TGT_CREATIVISION:
NewSymbol ("__CREATIVISION__", 1);
break;
@ -299,14 +295,22 @@ static void SetSys (const char* Sys)
NewSymbol ("__LUNIX__", 1);
break;
case TGT_LYNX:
NewSymbol ("__LYNX__", 1);
case TGT_ATMOS:
NewSymbol ("__ATMOS__", 1);
break;
case TGT_NES:
NewSymbol ("__NES__", 1);
break;
case TGT_SUPERVISION:
NewSymbol ("__SUPERVISION__", 1);
break;
case TGT_LYNX:
NewSymbol ("__LYNX__", 1);
break;
case TGT_SIM6502:
NewSymbol ("__SIM6502__", 1);
break;
@ -323,10 +327,6 @@ static void SetSys (const char* Sys)
NewSymbol ("__PCE__", 1);
break;
case TGT_SUPERVISION:
NewSymbol ("__SUPERVISION__", 1);
break;
default:
AbEnd ("Invalid target name: `%s'", Sys);

View File

@ -211,6 +211,10 @@ static void SetSys (const char* Sys)
cbmsys ("__PET__");
break;
case TGT_BBC:
DefineNumericMacro ("__BBC__", 1);
break;
case TGT_APPLE2:
DefineNumericMacro ("__APPLE2__", 1);
break;
@ -230,14 +234,6 @@ static void SetSys (const char* Sys)
DefineNumericMacro ("__GEOS_CBM__", 1);
break;
case TGT_ATMOS:
DefineNumericMacro ("__ATMOS__", 1);
break;
case TGT_BBC:
DefineNumericMacro ("__BBC__", 1);
break;
case TGT_CREATIVISION:
DefineNumericMacro ("__CREATIVISION__", 1);
break;
@ -251,14 +247,22 @@ static void SetSys (const char* Sys)
DefineNumericMacro ("__LUNIX__", 1);
break;
case TGT_LYNX:
DefineNumericMacro ("__LYNX__", 1);
case TGT_ATMOS:
DefineNumericMacro ("__ATMOS__", 1);
break;
case TGT_NES:
DefineNumericMacro ("__NES__", 1);
break;
case TGT_SUPERVISION:
DefineNumericMacro ("__SUPERVISION__", 1);
break;
case TGT_LYNX:
DefineNumericMacro ("__LYNX__", 1);
break;
case TGT_SIM6502:
DefineNumericMacro ("__SIM6502__", 1);
break;
@ -275,10 +279,6 @@ static void SetSys (const char* Sys)
DefineNumericMacro ("__PCE__", 1);
break;
case TGT_SUPERVISION:
DefineNumericMacro ("__SUPERVISION__", 1);
break;
default:
AbEnd ("Unknown target system type %d", Target);
}

View File

@ -142,38 +142,38 @@ struct TargetEntry {
** Allows multiple entries for one target id (target name aliases).
*/
static const TargetEntry TargetMap[] = {
{ "apple2", TGT_APPLE2 },
{ "apple2enh", TGT_APPLE2ENH },
{ "atari", TGT_ATARI },
{ "atari2600", TGT_ATARI2600 },
{ "atari5200", TGT_ATARI5200 },
{ "atarixl", TGT_ATARIXL },
{ "atmos", TGT_ATMOS },
{ "bbc", TGT_BBC },
{ "c128", TGT_C128 },
{ "c16", TGT_C16 },
{ "c64", TGT_C64 },
{ "c65", TGT_C65 },
{ "cbm510", TGT_CBM510 },
{ "cbm610", TGT_CBM610 },
{ "creativision", TGT_CREATIVISION},
{ "gamate", TGT_GAMATE },
{ "geos", TGT_GEOS_CBM },
{ "geos-apple", TGT_GEOS_APPLE },
{ "geos-cbm", TGT_GEOS_CBM },
{ "lunix", TGT_LUNIX },
{ "lynx", TGT_LYNX },
{ "module", TGT_MODULE },
{ "nes", TGT_NES },
{ "none", TGT_NONE },
{ "osic1p", TGT_OSIC1P },
{ "pce", TGT_PCENGINE },
{ "pet", TGT_PET },
{ "plus4", TGT_PLUS4 },
{ "sim6502", TGT_SIM6502 },
{ "sim65c02", TGT_SIM65C02 },
{ "supervision", TGT_SUPERVISION },
{ "vic20", TGT_VIC20 },
{ "apple2", TGT_APPLE2 },
{ "apple2enh", TGT_APPLE2ENH },
{ "atari", TGT_ATARI },
{ "atari2600", TGT_ATARI2600 },
{ "atari5200", TGT_ATARI5200 },
{ "atarixl", TGT_ATARIXL },
{ "atmos", TGT_ATMOS },
{ "bbc", TGT_BBC },
{ "c128", TGT_C128 },
{ "c16", TGT_C16 },
{ "c64", TGT_C64 },
{ "c65", TGT_C65 },
{ "cbm510", TGT_CBM510 },
{ "cbm610", TGT_CBM610 },
{ "creativision", TGT_CREATIVISION },
{ "gamate", TGT_GAMATE },
{ "geos", TGT_GEOS_CBM },
{ "geos-apple", TGT_GEOS_APPLE },
{ "geos-cbm", TGT_GEOS_CBM },
{ "lunix", TGT_LUNIX },
{ "lynx", TGT_LYNX },
{ "module", TGT_MODULE },
{ "nes", TGT_NES },
{ "none", TGT_NONE },
{ "osic1p", TGT_OSIC1P },
{ "pce", TGT_PCENGINE },
{ "pet", TGT_PET },
{ "plus4", TGT_PLUS4 },
{ "sim6502", TGT_SIM6502 },
{ "sim65c02", TGT_SIM65C02 },
{ "supervision", TGT_SUPERVISION },
{ "vic20", TGT_VIC20 },
};
#define MAP_ENTRY_COUNT (sizeof (TargetMap) / sizeof (TargetMap[0]))
@ -195,13 +195,12 @@ static const TargetProperties PropertyTable[TGT_COUNT] = {
{ "cbm610", CPU_6502, BINFMT_BINARY, CTPET },
{ "osic1p", CPU_6502, BINFMT_BINARY, CTOSI },
{ "pet", CPU_6502, BINFMT_BINARY, CTPET },
{ "bbc", CPU_6502, BINFMT_BINARY, CTNone },
{ "apple2", CPU_6502, BINFMT_BINARY, CTNone },
{ "apple2enh", CPU_65C02, BINFMT_BINARY, CTNone },
{ "atmos", CPU_6502, BINFMT_BINARY, CTNone },
{ "bbc", CPU_6502, BINFMT_BINARY, CTNone },
{ "geos-cbm", CPU_6502, BINFMT_BINARY, CTNone },
{ "creativision", CPU_6502, BINFMT_BINARY, CTNone },
{ "geos-apple", CPU_65C02, BINFMT_BINARY, CTNone },
{ "geos-cbm", CPU_6502, BINFMT_BINARY, CTNone },
{ "lunix", CPU_6502, BINFMT_O65, CTNone },
{ "atmos", CPU_6502, BINFMT_BINARY, CTNone },
{ "nes", CPU_6502, BINFMT_BINARY, CTNone },
@ -211,7 +210,6 @@ static const TargetProperties PropertyTable[TGT_COUNT] = {
{ "sim65c02", CPU_65C02, BINFMT_BINARY, CTNone },
{ "pce", CPU_HUC6280, BINFMT_BINARY, CTNone },
{ "gamate", CPU_6502, BINFMT_BINARY, CTNone },
{ "supervision", CPU_65SC02, BINFMT_BINARY, CTNone },
{ "c65", CPU_4510, BINFMT_BINARY, CTPET },
};

View File

@ -67,21 +67,21 @@ typedef enum {
TGT_CBM610,
TGT_OSIC1P,
TGT_PET,
TGT_BBC,
TGT_APPLE2,
TGT_APPLE2ENH,
TGT_ATMOS,
TGT_BBC,
TGT_GEOS_CBM,
TGT_CREATIVISION,
TGT_GEOS_APPLE,
TGT_GEOS_CBM,
TGT_LUNIX,
TGT_LYNX,
TGT_ATMOS,
TGT_NES,
TGT_SUPERVISION,
TGT_LYNX,
TGT_SIM6502,
TGT_SIM65C02,
TGT_PCENGINE,
TGT_GAMATE,
TGT_SUPERVISION,
TGT_C65,
TGT_COUNT /* Number of target systems */
} target_t;