Style changes.

This commit is contained in:
Greg King
2015-10-02 10:50:22 -04:00
committed by Oliver Schmidt
parent 203200e259
commit b5d939c858
23 changed files with 142 additions and 159 deletions

View File

@@ -1,9 +1,11 @@
;
; Screen size variables
;
.export screensize
.export xsize, ysize
.include "pce.inc"
.export screensize
screensize:
ldx xsize
ldy ysize
@@ -12,7 +14,6 @@ screensize:
; FIXME: changing the video mode allows for different screen sizes
.rodata
.export xsize, ysize
xsize: .byte charsperline
ysize: .byte screenrows

View File

@@ -6,6 +6,7 @@
;
.export _chlinexy, _chline
.import gotoxy, cputdirect
.importzp tmp1
@@ -25,7 +26,3 @@ L1: lda #CH_HLINE ; Horizontal line, screen code
dec tmp1
bne L1
L9: rts

View File

@@ -2,17 +2,15 @@
; clock_t clock (void);
;
.include "pce.inc"
.include "extzp.inc"
.export _clock
.constructor initclock, 24
.forceimport ticktock
.importzp sreg
.constructor initclock
.include "extzp.inc"
.proc _clock
lda tickcount+3
sta sreg+1
lda tickcount+2
@@ -20,7 +18,6 @@
ldx tickcount+1
lda tickcount
rts
.endproc
.segment "ONCE"

View File

@@ -1,11 +1,11 @@
.export _clrscr
.import plot
.include "pce.inc"
.include "extzp.inc"
.import plot
.export _clrscr
_clrscr:
st0 #VDC_MAWR
st1 #<$0000
st2 #>$0000

View File

@@ -4,14 +4,15 @@
; unsigned char __fastcall__ bordercolor (unsigned char color);
;
.export _textcolor, _bgcolor, _bordercolor
.export colors
.import return0
.include "pce.inc"
.include "extzp.inc"
_bordercolor = return0
_bordercolor := return0
_textcolor:
ldx CHARCOLOR ; get old value
@@ -35,27 +36,25 @@ _bgcolor:
txa
rts
.rodata
.export colors
.rodata
colors:
; G R B
.word ((0<<6)+(0<<3)+(0)) ; 0 black
.word ((7<<6)+(7<<3)+(7)) ; 1 white
.word ((0<<6)+(7<<3)+(0)) ; 2 red
.word ((7<<6)+(0<<3)+(7)) ; 3 cyan
.word ((0<<6)+(5<<3)+(7)) ; 4 violett
.word ((7<<6)+(0<<3)+(0)) ; 5 green
.word ((0<<6)+(0<<3)+(7)) ; 6 blue
.word ((7<<6)+(7<<3)+(0)) ; 7 yellow
.word ((5<<6)+(7<<3)+(0)) ; 8 orange
.word ((3<<6)+(4<<3)+(3)) ; 9 brown
.word ((4<<6)+(7<<3)+(4)) ; a light red
.word ((3<<6)+(3<<3)+(3)) ; b dark grey
.word ((4<<6)+(4<<3)+(4)) ; c middle grey
.word ((7<<6)+(4<<3)+(4)) ; d light green
.word ((4<<6)+(4<<3)+(7)) ; e light blue
.word ((6<<6)+(6<<3)+(6)) ; f light gray
; G R B
colors: .word ((0<<6)+(0<<3)+(0)) ; $0 black
.word ((7<<6)+(7<<3)+(7)) ; $1 white
.word ((0<<6)+(7<<3)+(0)) ; $2 red
.word ((7<<6)+(0<<3)+(7)) ; $3 cyan
.word ((0<<6)+(5<<3)+(7)) ; $4 violett
.word ((7<<6)+(0<<3)+(0)) ; $5 green
.word ((0<<6)+(0<<3)+(7)) ; $6 blue
.word ((7<<6)+(7<<3)+(0)) ; $7 yellow
.word ((5<<6)+(7<<3)+(0)) ; $8 orange
.word ((3<<6)+(4<<3)+(3)) ; $9 brown
.word ((4<<6)+(7<<3)+(4)) ; $A light red
.word ((3<<6)+(3<<3)+(3)) ; $B dark grey
.word ((4<<6)+(4<<3)+(4)) ; $C middle grey
.word ((7<<6)+(4<<3)+(4)) ; $D light green
.word ((4<<6)+(4<<3)+(7)) ; $E light blue
.word ((6<<6)+(6<<3)+(6)) ; $F light gray
;-------------------------------------------------------------------------------
; force the init constructor to be imported

View File

@@ -1,13 +1,13 @@
.include "pce.inc"
.include "extzp.inc"
.constructor initconio, 24
.import vce_init
.import psg_init
.import vdc_init
.import colors
.importzp ptr1, tmp1
.constructor initconio
.include "pce.inc"
.include "extzp.inc"
.macpack longbranch
.segment "ONCE"
@@ -39,7 +39,7 @@ set_palette:
inx
inx
cpx #16*2
cpx #16 * 2
jne @lp
stz VCE_ADDR_LO
@@ -72,7 +72,7 @@ conio_init:
lda #>font
sta ptr1+1
lda #$ff
lda #$FF
sta tmp1
jsr copy
@@ -113,5 +113,5 @@ fillloop:
rts
font:
.include "vga.inc"
.rodata
font: .include "vga.inc"

View File

@@ -5,11 +5,11 @@
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import gotoxy
.import PLOT
.import xsize
.importzp tmp3,tmp4
.importzp tmp3, tmp4
.include "pce.inc"
.include "extzp.inc"
@@ -21,13 +21,13 @@ _cputcxy:
; Plot a character - also used as internal function
_cputc: cmp #$0d ; CR?
_cputc: cmp #$0D ; CR?
bne L1
lda #0
sta CURS_X
beq plot ; Recalculate pointers
L1: cmp #$0a ; LF?
L1: cmp #$0A ; LF?
beq newline ; Recalculate pointers
; Printable char of some sort
@@ -43,7 +43,7 @@ advance:
cpy xsize
bne L3
jsr newline ; new line
ldy #0 ; + cr
ldy #0 ; + CR
L3: sty CURS_X
jmp plot
@@ -71,7 +71,7 @@ putchar:
lda SCREEN_PTR
sta VDC_DATA_LO
lda SCREEN_PTR + 1
lda SCREEN_PTR+1
sta VDC_DATA_HI
st0 #VDC_VWR ; VWR

View File

@@ -1,8 +1,8 @@
;
; Startup code for cc65 (PCEngine version)
;
; by Groepaz/Hitmen <groepaz@gmx.net>
; based on code by Ullrich von Bassewitz <uz@cc65.org>
; by Groepaz/Hitmen <groepaz@gmx.net>,
; based on code by Ullrich von Bassewitz <uz@cc65.org>.
;
; 2018-02-11, Greg King
;
@@ -28,16 +28,12 @@
; ------------------------------------------------------------------------
; Place the startup code in a special segment.
.segment "STARTUP"
start:
; Set up the CPU and System-IRQ
.segment "STARTUP"
; Initialize CPU
sei
start: sei
nop
csh ; Set high speed CPU mode
csh ; Set high-speed CPU mode
nop
; Set up stack and memory mapping
@@ -64,7 +60,7 @@ start:
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
;tam #%10000000 ; $E000-$FFFF Hucard/Syscard bank 0
; Initialize hardware
stz TIMER_CTRL ; Timer off
@@ -72,7 +68,7 @@ start:
sta IRQ_MASK ; Interrupts off
stz IRQ_STATUS ; Acknowledge timer
; FIXME; i dont know why the heck this one doesnt work when called from a constructor :/
; FIXME; I don't know why the heck this one doesn't work when called from a constructor. :/
.import vdc_init
jsr vdc_init
@@ -96,24 +92,22 @@ start:
; Call module constructors
jsr initlib
cli ; allow IRQ only after constructors have run
cli ; allow IRQ only after constructors have run
; Pass an empty command line
jsr push0 ; argc
jsr push0 ; argv
ldy #4 ; Argument size
jsr _main ; Call the users code
jsr _main ; Call the user's code
; Call module destructors. This is also the _exit entry.
_exit:
jsr donelib ; Run module destructors
_exit: jsr donelib ; Run module destructors
; reset the PCEngine (start over)
jmp start
_nmi:
rti
_nmi: rti
.export initmainargs
initmainargs:
@@ -122,10 +116,10 @@ initmainargs:
; ------------------------------------------------------------------------
; hardware vectors
; ------------------------------------------------------------------------
.segment "VECTORS"
.segment "VECTORS"
.word IRQStub ; $fff6 IRQ2 (External IRQ, BRK)
.word IRQStub ; $fff8 IRQ1 (VDC)
.word IRQStub ; $fffa Timer
.word _nmi ; $fffc NMI
.word start ; $fffe reset
.word IRQStub ; $FFF6 IRQ2 (External IRQ, BRK)
.word IRQStub ; $FFF8 IRQ1 (VDC)
.word IRQStub ; $FFFA Timer
.word _nmi ; $FFFC NMI
.word start ; $FFFE reset

View File

@@ -10,7 +10,7 @@
.rodata
; The following 256 byte wide table specifies attributes for the isxxx type
; The following 256-byte-wide table specifies attributes for the isxxx type
; of functions. Doing it by a table means some overhead in space, but it
; has major advantages:
;
@@ -157,5 +157,3 @@ __ctype:
.byte CT_NONE ; 126/7e _____~_____
.byte CT_OTHER_WS ; 127/7f ____DEL____
.endrepeat

View File

@@ -6,6 +6,7 @@
;
.export _cvlinexy, _cvline
.import gotoxy, putchar, newline
.importzp tmp1
@@ -26,6 +27,3 @@ L1: lda #CH_VLINE ; Vertical bar
dec tmp1
bne L1
L9: rts

View File

@@ -4,15 +4,15 @@
; zeropage locations for exclusive use by the library
;
.include "extzp.inc"
.include "extzp.inc"
.segment "EXTZP" : zeropage
.segment "EXTZP" : zeropage
CURS_X: .res 1
CURS_Y: .res 1
SCREEN_PTR: .res 2
CHARCOLOR: .res 1
RVS: .res 1
BGCOLOR: .res 1
tickcount: .res 4
vdc_flags: .res 1
CURS_X: .res 1
CURS_Y: .res 1
SCREEN_PTR: .res 2
CHARCOLOR: .res 1
RVS: .res 1
BGCOLOR: .res 1
tickcount: .res 4
vdc_flags: .res 1

View File

@@ -3,6 +3,7 @@
;
.export gotoxy, _gotoxy
.import popa, plot
.include "pce.inc"

View File

@@ -1,4 +1,3 @@
;
; Standard joystick driver for the PCEngine
;
@@ -17,8 +16,8 @@
; Driver signature
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
; Library reference
@@ -43,7 +42,7 @@ JOY_COUNT = 4 ; Number of joysticks we support
; 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.
; Must return a JOY_ERR_xx code in a/x.
;
INSTALL:
@@ -90,7 +89,7 @@ joy1:
rts
read_joy:
; reset multitap counter
; Reset Multitap counter.
lda #$01
sta JOY_CTRL
pha
@@ -108,7 +107,7 @@ read_joy:
cly
nextpad:
lda #$01
sta JOY_CTRL ; sel = 1
sta JOY_CTRL ; sel = 1
pha
pla
nop ; some delay is required
@@ -119,21 +118,20 @@ nextpad:
asl a
asl a
asl a
sta padbuffer, y ; store new value
sta padbuffer,y ; store new value
stz JOY_CTRL
pha
pla
nop ; some delay is required
nop
lda JOY_CTRL
and #$0F
ora padbuffer, y ; second half of new value
ora padbuffer,y ; second half of new value
eor #$FF
sta padbuffer, y ; store new value
sta padbuffer,y ; store new value
iny
cpy #$05
@@ -144,4 +142,3 @@ nextpad:
padbuffer:
.res 4

View File

@@ -20,7 +20,7 @@ PLOT:
ldy CURS_X
rts
.rodata
.rodata
_plotlo:
.repeat screenrows,line

View File

@@ -1,7 +1,7 @@
.include "pce.inc"
.export psg_init
.include "pce.inc"
.segment "ONCE"
psg_init:
clx

View File

@@ -1,11 +1,10 @@
.export _revers
.include "pce.inc"
.include "extzp.inc"
.export _revers
.proc _revers
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
@@ -18,7 +17,6 @@ L1: lda RVS ; Load old value
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
.endproc
;-------------------------------------------------------------------------------

View File

@@ -1,7 +1,7 @@
.include "pce.inc"
.export vce_init
.include "pce.inc"
.segment "ONCE"
vce_init:
; Set CTA to zero

View File

@@ -1,11 +1,11 @@
.export vdc_init
.include "pce.inc"
; FIXME: implement selection of different video modes at runtime
HIRES = 1
.export vdc_init
vdc_init:
lda VDC_CTRL

View File

@@ -4,17 +4,16 @@
; void waitvsync (void);
;
.export _waitvsync
.forceimport ticktock
.include "pce.inc"
.include "extzp.inc"
.forceimport ticktock
.export _waitvsync
.proc _waitvsync
lda tickcount
@lp: cmp tickcount
beq @lp
rts
.endproc