Merge remote-tracking branch 'origin/master' into coniopeek

This commit is contained in:
mrdudz
2022-07-24 03:24:45 +02:00
2250 changed files with 195541 additions and 36938 deletions

View File

@@ -1,8 +1,9 @@
../tgi/nes-64-56-2.tgi: ../libwrk/nes/clrscr.o \
../libwrk/nes/cputc.o \
../libwrk/nes/get_tv.o \
../libwrk/nes/gotoxy.o \
../libwrk/nes/popa.o \
../libwrk/nes/ppu.o \
../libwrk/nes/ppubuf.o \
../libwrk/nes/setcursor.o
../target/nes/drv/tgi/nes-64-56-2.tgi: \
../libwrk/nes/clrscr.o \
../libwrk/nes/cputc.o \
../libwrk/nes/get_tv.o \
../libwrk/nes/gotoxy.o \
../libwrk/nes/popa.o \
../libwrk/nes/ppu.o \
../libwrk/nes/ppubuf.o \
../libwrk/nes/setcursor.o

View File

@@ -6,19 +6,18 @@
;
.export _cclearxy, _cclear
.import popa, _gotoxy, cputdirect
.import gotoxy, cputdirect
.importzp tmp1
_cclearxy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
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
sta tmp1
L1: lda #$20 ; Blank - screen code
jsr cputdirect ; Direct output
dec tmp1

View File

@@ -6,15 +6,14 @@
;
.export _chlinexy, _chline
.import popa, _gotoxy, cputdirect
.import gotoxy, cputdirect
.importzp tmp1
.include "nes.inc"
_chlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length
_chline:

View File

@@ -54,7 +54,7 @@ colors: .byte $0f ; 0 black
.byte $3d ; 1 white
.byte $04 ; 2 red
.byte $3b ; 3 cyan
.byte $14 ; 4 violett
.byte $14 ; 4 violet
.byte $1a ; 5 green
.byte $01 ; 6 blue
.byte $38 ; 7 yellow
@@ -66,4 +66,3 @@ colors: .byte $0f ; 0 black
.byte $2b ; d light green
.byte $22 ; e light blue
.byte $3d ; f light gray

View File

@@ -9,7 +9,7 @@
.export _cputcxy, _cputc, cputdirect, putchar
.export newline
.constructor initconio
.import popa, _gotoxy
.import gotoxy
.import ppuinit, paletteinit, ppubuf_put
.import setcursor
@@ -23,8 +23,7 @@
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function
@@ -75,10 +74,10 @@ putchar:
jmp ppubuf_put
;-----------------------------------------------------------------------------
; Initialize the conio subsystem. Code goes into the INIT segment, which may
; Initialize the conio subsystem. Code goes into the ONCE segment, which may
; be reused after startup.
.segment "INIT"
.segment "ONCE"
initconio:
jsr ppuinit

View File

@@ -1,5 +1,5 @@
;
; Startup code for cc65 (NES version)
; Start-up code for cc65 (NES version)
;
; by Groepaz/Hitmen <groepaz@gmx.net>
; based on code by Ullrich von Bassewitz <uz@cc65.org>
@@ -7,11 +7,12 @@
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib, callmain
.import push0, _main, zerobss, copydata
.import ppubuf_flush
; Linker generated symbols
; Linker-generated symbols
.import __RAM_START__, __RAM_SIZE__
.import __SRAM_START__, __SRAM_SIZE__
.import __ROM0_START__, __ROM0_SIZE__
@@ -19,12 +20,17 @@
.import __CODE_LOAD__,__CODE_RUN__, __CODE_SIZE__
.import __RODATA_LOAD__,__RODATA_RUN__, __RODATA_SIZE__
; ------------------------------------------------------------------------
; Character data
; ------------------------------------------------------------------------
.forceimport NESfont
.include "zeropage.inc"
.include "nes.inc"
; ------------------------------------------------------------------------
; 16 bytes INES header
; 16-byte INES header
.segment "HEADER"
@@ -100,9 +106,9 @@ start:
; Set up the stack.
lda #<(__SRAM_START__ + __SRAM_SIZE__)
ldx #>(__SRAM_START__ + __SRAM_SIZE__)
sta sp
lda #>(__SRAM_START__ + __SRAM_SIZE__)
sta sp+1 ; Set argument stack ptr
stx sp+1 ; Set argument stack ptr
; Call the module constructors.
@@ -159,31 +165,16 @@ nmi: pha
; Interrupt exit
irq2:
irq1:
timerirq:
irq:
rti
; ------------------------------------------------------------------------
; hardware vectors
; Hardware vectors
; ------------------------------------------------------------------------
.segment "VECTORS"
.word irq2 ; $fff4 ?
.word irq1 ; $fff6 ?
.word timerirq ; $fff8 ?
.word nmi ; $fffa vblank nmi
.word start ; $fffc reset
.word irq ; $fffe irq / brk
; ------------------------------------------------------------------------
; character data
; ------------------------------------------------------------------------
.segment "CHARS"
.include "neschar.inc"

View File

@@ -1,172 +0,0 @@
;
; Ullrich von Bassewitz, 02.06.1998
;
; Character specification table.
;
; The tables are readonly, put them into the rodata segment
.rodata
; 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:
;
; * It is fast. If it were'nt for the slow parameter passing of cc65, one
; could even define macros for the isxxx functions (this is usually
; done on other platforms).
;
; * It is highly portable. The only unportable part is the table itself,
; all real code goes into the common library.
;
; * We save some code in the isxxx functions.
;
;
; Bit assignments:
;
; 0 - Lower case char
; 1 - Upper case char
; 2 - Numeric digit
; 3 - Hex digit (both, lower and upper)
; 4 - Control character
; 5 - The space character itself
; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v')
; 7 - Space or tab character
.export __ctype
__ctype:
.repeat 2 ; 2 times for normal and inverted
.byte $10 ; 0/00 ___ctrl_@___
.byte $10 ; 1/01 ___ctrl_A___
.byte $10 ; 2/02 ___ctrl_B___
.byte $10 ; 3/03 ___ctrl_C___
.byte $10 ; 4/04 ___ctrl_D___
.byte $10 ; 5/05 ___ctrl_E___
.byte $10 ; 6/06 ___ctrl_F___
.byte $10 ; 7/07 ___ctrl_G___
.byte $10 ; 8/08 ___ctrl_H___
.byte $D0 ; 9/09 ___ctrl_I___
.byte $50 ; 10/0a ___ctrl_J___
.byte $50 ; 11/0b ___ctrl_K___
.byte $50 ; 12/0c ___ctrl_L___
.byte $50 ; 13/0d ___ctrl_M___
.byte $10 ; 14/0e ___ctrl_N___
.byte $10 ; 15/0f ___ctrl_O___
.byte $10 ; 16/10 ___ctrl_P___
.byte $10 ; 17/11 ___ctrl_Q___
.byte $10 ; 18/12 ___ctrl_R___
.byte $10 ; 19/13 ___ctrl_S___
.byte $10 ; 20/14 ___ctrl_T___
.byte $10 ; 21/15 ___ctrl_U___
.byte $10 ; 22/16 ___ctrl_V___
.byte $10 ; 23/17 ___ctrl_W___
.byte $10 ; 24/18 ___ctrl_X___
.byte $10 ; 25/19 ___ctrl_Y___
.byte $10 ; 26/1a ___ctrl_Z___
.byte $10 ; 27/1b ___ctrl_[___
.byte $10 ; 28/1c ___ctrl_\___
.byte $10 ; 29/1d ___ctrl_]___
.byte $10 ; 30/1e ___ctrl_^___
.byte $10 ; 31/1f ___ctrl_____
.byte $A0 ; 32/20 ___SPACE___
.byte $00 ; 33/21 _____!_____
.byte $00 ; 34/22 _____"_____
.byte $00 ; 35/23 _____#_____
.byte $00 ; 36/24 _____$_____
.byte $00 ; 37/25 _____%_____
.byte $00 ; 38/26 _____&_____
.byte $00 ; 39/27 _____'_____
.byte $00 ; 40/28 _____(_____
.byte $00 ; 41/29 _____)_____
.byte $00 ; 42/2a _____*_____
.byte $00 ; 43/2b _____+_____
.byte $00 ; 44/2c _____,_____
.byte $00 ; 45/2d _____-_____
.byte $00 ; 46/2e _____._____
.byte $00 ; 47/2f _____/_____
.byte $0C ; 48/30 _____0_____
.byte $0C ; 49/31 _____1_____
.byte $0C ; 50/32 _____2_____
.byte $0C ; 51/33 _____3_____
.byte $0C ; 52/34 _____4_____
.byte $0C ; 53/35 _____5_____
.byte $0C ; 54/36 _____6_____
.byte $0C ; 55/37 _____7_____
.byte $0C ; 56/38 _____8_____
.byte $0C ; 57/39 _____9_____
.byte $00 ; 58/3a _____:_____
.byte $00 ; 59/3b _____;_____
.byte $00 ; 60/3c _____<_____
.byte $00 ; 61/3d _____=_____
.byte $00 ; 62/3e _____>_____
.byte $00 ; 63/3f _____?_____
.byte $00 ; 64/40 _____@_____
.byte $0A ; 65/41 _____A_____
.byte $0A ; 66/42 _____B_____
.byte $0A ; 67/43 _____C_____
.byte $0A ; 68/44 _____D_____
.byte $0A ; 69/45 _____E_____
.byte $0A ; 70/46 _____F_____
.byte $02 ; 71/47 _____G_____
.byte $02 ; 72/48 _____H_____
.byte $02 ; 73/49 _____I_____
.byte $02 ; 74/4a _____J_____
.byte $02 ; 75/4b _____K_____
.byte $02 ; 76/4c _____L_____
.byte $02 ; 77/4d _____M_____
.byte $02 ; 78/4e _____N_____
.byte $02 ; 79/4f _____O_____
.byte $02 ; 80/50 _____P_____
.byte $02 ; 81/51 _____Q_____
.byte $02 ; 82/52 _____R_____
.byte $02 ; 83/53 _____S_____
.byte $02 ; 84/54 _____T_____
.byte $02 ; 85/55 _____U_____
.byte $02 ; 86/56 _____V_____
.byte $02 ; 87/57 _____W_____
.byte $02 ; 88/58 _____X_____
.byte $02 ; 89/59 _____Y_____
.byte $02 ; 90/5a _____Z_____
.byte $00 ; 91/5b _____[_____
.byte $00 ; 92/5c _____\_____
.byte $00 ; 93/5d _____]_____
.byte $00 ; 94/5e _____^_____
.byte $00 ; 95/5f _UNDERLINE_
.byte $00 ; 96/60 ___grave___
.byte $09 ; 97/61 _____a_____
.byte $09 ; 98/62 _____b_____
.byte $09 ; 99/63 _____c_____
.byte $09 ; 100/64 _____d_____
.byte $09 ; 101/65 _____e_____
.byte $09 ; 102/66 _____f_____
.byte $01 ; 103/67 _____g_____
.byte $01 ; 104/68 _____h_____
.byte $01 ; 105/69 _____i_____
.byte $01 ; 106/6a _____j_____
.byte $01 ; 107/6b _____k_____
.byte $01 ; 108/6c _____l_____
.byte $01 ; 109/6d _____m_____
.byte $01 ; 110/6e _____n_____
.byte $01 ; 111/6f _____o_____
.byte $01 ; 112/70 _____p_____
.byte $01 ; 113/71 _____q_____
.byte $01 ; 114/72 _____r_____
.byte $01 ; 115/73 _____s_____
.byte $01 ; 116/74 _____t_____
.byte $01 ; 117/75 _____u_____
.byte $01 ; 118/76 _____v_____
.byte $01 ; 119/77 _____w_____
.byte $01 ; 120/78 _____x_____
.byte $01 ; 121/79 _____y_____
.byte $01 ; 122/7a _____z_____
.byte $00 ; 123/7b _____{_____
.byte $00 ; 124/7c _____|_____
.byte $00 ; 125/7d _____}_____
.byte $00 ; 126/7e _____~_____
.byte $40 ; 127/7f ____DEL____
.endrepeat

View File

@@ -6,15 +6,14 @@
;
.export _cvlinexy, _cvline
.import popa, _gotoxy, putchar, newline
.import gotoxy, putchar, newline
.importzp tmp1
.include "nes.inc"
_cvlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline
_cvline:

View File

@@ -4,21 +4,19 @@
; void gotoxy (unsigned char x, unsigned char y);
;
.export _gotoxy
.export gotoxy, _gotoxy
.import setcursor
.import popa
.include "nes.inc"
.proc _gotoxy
gotoxy:
jsr popa ; Get Y
_gotoxy:
sta CURS_Y ; Set Y
jsr popa ; Get X
sta CURS_X ; Set X
tay
ldx CURS_Y
jmp setcursor ; Set the cursor position
.endproc

View File

@@ -19,4 +19,4 @@
.endproc

View File

@@ -6,7 +6,7 @@
; ------------------------------------------------------------------------
.segment "INIT"
.segment "ONCE"
initirq:
rts

View File

@@ -29,24 +29,12 @@
.addr $0000
; Button state masks (8 values)
.byte $10 ; JOY_UP
.byte $20 ; JOY_DOWN
.byte $40 ; JOY_LEFT
.byte $80 ; JOY_RIGHT
.byte $01 ; JOY_FIRE (A)
.byte $02 ; JOY_FIRE2 (B)
.byte $04 ; (Select)
.byte $08 ; (Start)
; Jump table.
.addr INSTALL
.addr UNINSTALL
.addr COUNT
.addr READJOY
.addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants

View File

@@ -1,13 +0,0 @@
;
; Name of the standard joystick driver
;
; Oliver Schmidt, 2012-11-01
;
; const char joy_stddrv[];
;
.export _joy_stddrv
.rodata
_joy_stddrv: .asciiz "nes-stdjoy.joy"

View File

@@ -10,10 +10,10 @@
;---------------------------------------------------------------------------
; Get possible command-line arguments. Goes into the special INIT segment,
; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run
.segment "INIT"
.segment "ONCE"
.proc initmainargs

File diff suppressed because it is too large Load Diff

View File

@@ -68,6 +68,8 @@
;-----------------------------------------------------------------------------
.segment "ONCE"
.proc ppuinit
lda #%10101000
@@ -104,7 +106,6 @@
.endproc
;-----------------------------------------------------------------------------
.proc paletteinit
@@ -126,7 +127,7 @@
bne @loop
rts
.endproc
;-----------------------------------------------------------------------------
@@ -136,7 +137,7 @@
paldata:
.repeat 2
.byte $0f ; 0 black
.byte $14 ; 4 violett
.byte $14 ; 4 violet
.byte $3b ; 3 cyan
.byte $3d ; 1 white

View File

@@ -101,7 +101,7 @@
@end: stx ringread
sty ringcount
rts
rts
.endproc

View File

@@ -35,5 +35,5 @@ utsdata:
; machine
.asciiz "NES"

View File

@@ -60,7 +60,6 @@ yres: .word 56 ; Max Y resolution
.addr BAR
.addr TEXTSTYLE
.addr OUTTEXT
.addr 0 ; IRQ entry is unused
; ------------------------------------------------------------------------
; Data.
@@ -80,12 +79,6 @@ TEMP2 = tmp4
TEMP3 = sreg
TEMP4 = sreg+1
; Line routine stuff (must be on zpage)
PB = ptr3 ; (2) LINE
UB = ptr4 ; (2) LINE
ERR = regsave ; (2) LINE
NX = regsave+2 ; (2) LINE
; Absolute variables used in the code
.bss
@@ -96,17 +89,6 @@ ERROR: .res 1 ; Error code
COLOR: .res 1 ; Current color
PALETTE: .res 2 ; The current palette
; Line routine stuff
OGora:
COUNT: .res 2
OUkos:
NY: .res 2
Y3:
DX: .res 1
DY: .res 1
AY: .res 1
; Constants and tables
.rodata
@@ -243,6 +225,7 @@ SETCOLOR:
;
SETVIEWPAGE:
; rts
; ------------------------------------------------------------------------
; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n).

View File

@@ -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

View File

@@ -1,18 +0,0 @@
;
; Written by Groepaz/Hitmen <groepaz@gmx.net>
; Cleanup by Ullrich von Bassewitz <uz@cc65.org>
;
; void waitvblank(void);
;
.export _waitvblank
.include "nes.inc"
.proc _waitvblank
wait: lda PPU_STATUS
bpl wait
rts
.endproc

18
libsrc/nes/waitvsync.s Normal file
View File

@@ -0,0 +1,18 @@
;
; Written by Groepaz <groepaz@gmx.net>
; Cleanup by Ullrich von Bassewitz <uz@cc65.org>
;
; void waitvsync(void);
;
.export _waitvsync
.include "nes.inc"
.proc _waitvsync
wait: bit PPU_STATUS
bpl wait
rts
.endproc