1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-22 12:30:01 +00:00

preliminary NES support; made free BIOS for CV; ported solarian to coleco

This commit is contained in:
Steven Hugg 2017-05-17 22:33:56 -04:00
parent 7c18e1a27c
commit 867bab7978
17 changed files with 12218 additions and 984 deletions

View File

@ -150,7 +150,10 @@ body {
<script src="javatari.js/release/javatari/javatari.js"></script> <script src="javatari.js/release/javatari/javatari.js"></script>
<script src="src/cpu/z80fast.js"></script> <script src="src/cpu/z80fast.js"></script>
<script src="src/cpu/6809.js"></script> <script src="src/cpu/6809.js"></script>
<!--
<script src="jsnes/build/jsnes.min.js"></script>
<script src="jsnes/lib/dynamicaudio-min.js" type="text/javascript" charset="utf-8"></script>
-->
<script src="tss/js/tss/PsgDeviceChannel.js"></script> <script src="tss/js/tss/PsgDeviceChannel.js"></script>
<script src="tss/js/tss/MasterChannel.js"></script> <script src="tss/js/tss/MasterChannel.js"></script>
<script src="tss/js/tss/AudioLooper.js"></script> <script src="tss/js/tss/AudioLooper.js"></script>

Binary file not shown.

View File

@ -0,0 +1,8 @@
all: minbios.rom
%.rom: %.asm
naken_asm -b $<
dd if=out.bin of=$@ bs=1 count=8192
# python parsebdf8.py -f -s 32 -e 127 -B fonts/tom-thumb.bdf

View File

@ -0,0 +1,526 @@
.z80
O EQU 0FFH ; filler for unused bytes
;***************************************
; RAM usage
;***************************************
ORG 73FFH
Stack: DS 1 ; Default initial stack pointer
;***************************************
; Cartridge header addresses
;***************************************
ORG 8000H
Cart_Sig: DS 2 ; AA55 = title screen, 55AA = no screen
RamSprtTab: DS 2 ; RAM sprite attribute table pointer
RAMSprtIdx: DS 2 ; sprite index table pointer
VDP_Temp: DS 2 ; pointer to temp image storage (up to 40 bytes used)
CtlState: DS 2 ; pointer to controller state table (2 + 2x5 bytes)
Cart_Start: DS 2 ; start of cart code
V_RST_08H: DS 3 ; RST 08H vector
V_RST_10H: DS 3 ; RST 10H vector
V_RST_18H: DS 3 ; RST 18H vector
V_RST_20H: DS 3 ; RST 20H vector
V_RST_28H: DS 3 ; RST 28H vector
V_RST_30H: DS 3 ; RST 30H vector
V_RST_38H: DS 3 ; RST 38H vector
V_NMI: DS 3 ; NMI vector (vertical blank interrupt)
Cart_Title: DS 1 ; Title string "LINE 3/LINE 2/yyyy"
;***************************************
; Offsets into data blocks
;***************************************
; Offsets into RawCtlState
RawCtlLeft EQU 00H ; raw left controller state
RawCtlRight EQU 0AH ; raw right controller state
; Offsets into RawCtlLeft and RawCtlRight
RawCtlLFBit EQU 00H ; previous left fire bit
RawCtlLFState EQU 01H ; left fire button state
RawCtlDBits EQU 02H ; previous directional bits
RawCtlDState EQU 03H ; directionals state
; EQU 04H ; unused?
; EQU 05H ; unused?
RawCtlRFBit EQU 06H ; previous right fire bit
RawCtlRFState EQU 07H ; right fire button state
RawCtlKPBit EQU 08H ; previous keypad bits
RawCtlKPState EQU 09H ; keypad state
; Offsets into CtlState table
CtlStateLFlag EQU 00H ; left controller flags
CtlStateRFlag EQU 01H ; right controller flags
CtlStateLeft EQU 02H ; left controller state
CtlStateRight EQU 07H ; right controller state
; CtlStateLF/CtlStateRF bits
CtlCheckMe EQU 80H ; 7 ; if =0, do not check this ctrl at all
; EQU 40H ; 6 ; unused?
; EQU 20H ; 5 ; unused?
CtlCheckKP EQU 10H ; 4 ; check keypad
CtlCheckRFire EQU 08H ; 3 ; check right fire button
CtlCheckSpinner EQU 04H ; 2 ; check spinner
CtlCheckDir EQU 02H ; 1 ; check directionals
CtlCheckLFire EQU 01H ; 0 ; check left fire button
; Offsets into CtlStateLeft and CtlStateRight
CtlStateLFire EQU 00H ; left fire button
CtlStateDir EQU 01H ; directionals
CtlStateSpin EQU 02H ; spinner value
CtlStateRFire EQU 03H ; right fire button
CtlStateKey EQU 04H ; key code
;***************************************
; I/O port addresses
;***************************************
IO_KP_Select EQU 080H ; Keypad select output port
IO_Joy_Select EQU 0C0H ; Joystick select output port
IO_Joy1 EQU 0FCH ; Joystick 1 input port
IO_Joy2 EQU 0FFH ; Joystick 2 input port
IO_Sound EQU 0FFH ; Sound chip output port
IO_VDP_Data EQU 0BEH ; VDP data port
IO_VDP_Addr EQU 0BFH ; VDP VRAM address output port
IO_VDP_Status EQU 0BFH ; VDP status input port
ORG 0000H
;***************************************
; Everything starts here
;***************************************
A0000: LD SP,Stack ; Initialize stack pointer
JR ColdStart
;***************************************
; These are the RST vectors, mixed with some (formerly) wasted bytes
;***************************************
org 0x8
A0008: JP V_RST_08H
org 0x10
A0010: JP V_RST_10H
org 0x18
A0018: JP V_RST_18H
org 0x20
A0020: JP V_RST_20H
org 0x28
A0028: JP V_RST_28H
org 0x30
A0030: JP V_RST_30H
org 0x38
A0038: JP V_RST_38H
;***************************************
; NMI vector
;***************************************
org 0x66
JP V_NMI
;***************************************
; I'm not really sure what these are for, but aside from the
; jump vectors at the end of the ROM, they are probably the
; only ROM addresses that you should reference directly.
;***************************************
A0069: DB 60 ; this might mean a 60hz display (NTSC)
A006A: DW Font_A ; this points to the font bitmap for 'A'
A006C: DW Font_0 ; this points to the font bitmap for '0'
DW xFont_Space ; small font
;***************************************
;
; First part of cold start code
;
;***************************************
ColdStart:
LD HL,(Cart_Sig) ; Check first word of cart for 55AAH
LD A,L ; 8000=55H and 8001=AAH
CP 55H
JR NZ,NoCart
LD A,H
CP 0AAH
JR NZ,NoCart
LD HL,(Cart_Start) ; If 55H/AAH, jump into cartridge
JP (HL)
;TODO
NoCart:
RST 0
; Character cell data for default font
xFont_Space:
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ;32
.DB 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x80 ;33
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xa0 ;34
.DB 0x00,0x00,0x00,0xa0,0xe0,0xa0,0xe0,0xa0 ;35
.DB 0x00,0x00,0x00,0x60,0xc0,0x60,0xc0,0x40 ;36
.DB 0x00,0x00,0x00,0x80,0x20,0x40,0x80,0x20 ;37
.DB 0x00,0x00,0x00,0xc0,0xc0,0xe0,0xa0,0x60 ;38
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80 ;39
.DB 0x00,0x00,0x00,0x40,0x80,0x80,0x80,0x40 ;40
.DB 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x80 ;41
.DB 0x00,0x00,0x00,0x00,0x00,0xa0,0x40,0xa0 ;42
.DB 0x00,0x00,0x00,0x00,0x00,0x40,0xe0,0x40 ;43
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80 ;44
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0 ;45
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80 ;46
.DB 0x00,0x00,0x00,0x20,0x20,0x40,0x80,0x80 ;47
xFont_0:
.DB 0x00,0x00,0x00,0x60,0xa0,0xa0,0xa0,0xc0 ;48
.DB 0x00,0x00,0x00,0x40,0xc0,0x40,0x40,0x40 ;49
.DB 0x00,0x00,0x00,0xc0,0x20,0x40,0x80,0xe0 ;50
.DB 0x00,0x00,0x00,0xc0,0x20,0x40,0x20,0xc0 ;51
.DB 0x00,0x00,0x00,0xa0,0xa0,0xe0,0x20,0x20 ;52
.DB 0x00,0x00,0x00,0xe0,0x80,0xc0,0x20,0xc0 ;53
.DB 0x00,0x00,0x00,0x60,0x80,0xe0,0xa0,0xe0 ;54
.DB 0x00,0x00,0x00,0xe0,0x20,0x40,0x80,0x80 ;55
.DB 0x00,0x00,0x00,0xe0,0xa0,0xe0,0xa0,0xe0 ;56
.DB 0x00,0x00,0x00,0xe0,0xa0,0xe0,0x20,0xc0 ;57
.DB 0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x80 ;58
.DB 0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x80 ;59
.DB 0x00,0x00,0x00,0x20,0x40,0x80,0x40,0x20 ;60
.DB 0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0xe0 ;61
.DB 0x00,0x00,0x00,0x80,0x40,0x20,0x40,0x80 ;62
.DB 0x00,0x00,0x00,0xe0,0x20,0x40,0x00,0x40 ;63
.DB 0x00,0x00,0x00,0x40,0xa0,0xe0,0x80,0x60 ;64
xFont_A:
.DB 0x00,0x00,0x00,0x40,0xa0,0xe0,0xa0,0xa0 ;65
.DB 0x00,0x00,0x00,0xc0,0xa0,0xc0,0xa0,0xc0 ;66
.DB 0x00,0x00,0x00,0x60,0x80,0x80,0x80,0x60 ;67
.DB 0x00,0x00,0x00,0xc0,0xa0,0xa0,0xa0,0xc0 ;68
.DB 0x00,0x00,0x00,0xe0,0x80,0xe0,0x80,0xe0 ;69
.DB 0x00,0x00,0x00,0xe0,0x80,0xe0,0x80,0x80 ;70
.DB 0x00,0x00,0x00,0x60,0x80,0xe0,0xa0,0x60 ;71
.DB 0x00,0x00,0x00,0xa0,0xa0,0xe0,0xa0,0xa0 ;72
.DB 0x00,0x00,0x00,0xe0,0x40,0x40,0x40,0xe0 ;73
.DB 0x00,0x00,0x00,0x20,0x20,0x20,0xa0,0x40 ;74
.DB 0x00,0x00,0x00,0xa0,0xa0,0xc0,0xa0,0xa0 ;75
.DB 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0xe0 ;76
.DB 0x00,0x00,0x00,0xa0,0xe0,0xe0,0xa0,0xa0 ;77
.DB 0x00,0x00,0x00,0xa0,0xe0,0xe0,0xe0,0xa0 ;78
.DB 0x00,0x00,0x00,0x40,0xa0,0xa0,0xa0,0x40 ;79
.DB 0x00,0x00,0x00,0xc0,0xa0,0xc0,0x80,0x80 ;80
.DB 0x00,0x00,0x00,0x40,0xa0,0xa0,0xe0,0x60 ;81
.DB 0x00,0x00,0x00,0xc0,0xa0,0xe0,0xc0,0xa0 ;82
.DB 0x00,0x00,0x00,0x60,0x80,0x40,0x20,0xc0 ;83
.DB 0x00,0x00,0x00,0xe0,0x40,0x40,0x40,0x40 ;84
.DB 0x00,0x00,0x00,0xa0,0xa0,0xa0,0xa0,0x60 ;85
.DB 0x00,0x00,0x00,0xa0,0xa0,0xa0,0x40,0x40 ;86
.DB 0x00,0x00,0x00,0xa0,0xa0,0xe0,0xe0,0xa0 ;87
.DB 0x00,0x00,0x00,0xa0,0xa0,0x40,0xa0,0xa0 ;88
.DB 0x00,0x00,0x00,0xa0,0xa0,0x40,0x40,0x40 ;89
.DB 0x00,0x00,0x00,0xe0,0x20,0x40,0x80,0xe0 ;90
.DB 0x00,0x00,0x00,0xe0,0x80,0x80,0x80,0xe0 ;91
.DB 0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x20 ;92
.DB 0x00,0x00,0x00,0xe0,0x20,0x20,0x20,0xe0 ;93
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xa0 ;94
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0 ;95
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40 ;96
.DB 0x00,0x00,0x00,0x00,0xc0,0x60,0xa0,0xe0 ;97
.DB 0x00,0x00,0x00,0x80,0xc0,0xa0,0xa0,0xc0 ;98
.DB 0x00,0x00,0x00,0x00,0x60,0x80,0x80,0x60 ;99
.DB 0x00,0x00,0x00,0x20,0x60,0xa0,0xa0,0x60 ;100
.DB 0x00,0x00,0x00,0x00,0x60,0xa0,0xc0,0x60 ;101
.DB 0x00,0x00,0x00,0x20,0x40,0xe0,0x40,0x40 ;102
.DB 0x00,0x00,0x00,0x60,0xa0,0xe0,0x20,0x40 ;103
.DB 0x00,0x00,0x00,0x80,0xc0,0xa0,0xa0,0xa0 ;104
.DB 0x00,0x00,0x00,0x80,0x00,0x80,0x80,0x80 ;105
.DB 0x00,0x00,0x20,0x00,0x20,0x20,0xa0,0x40 ;106
.DB 0x00,0x00,0x00,0x80,0xa0,0xc0,0xc0,0xa0 ;107
.DB 0x00,0x00,0x00,0xc0,0x40,0x40,0x40,0xe0 ;108
.DB 0x00,0x00,0x00,0x00,0xe0,0xe0,0xe0,0xa0 ;109
.DB 0x00,0x00,0x00,0x00,0xc0,0xa0,0xa0,0xa0 ;110
.DB 0x00,0x00,0x00,0x00,0x40,0xa0,0xa0,0x40 ;111
.DB 0x00,0x00,0x00,0xc0,0xa0,0xa0,0xc0,0x80 ;112
.DB 0x00,0x00,0x00,0x60,0xa0,0xa0,0x60,0x20 ;113
.DB 0x00,0x00,0x00,0x00,0x60,0x80,0x80,0x80 ;114
.DB 0x00,0x00,0x00,0x00,0x60,0xc0,0x60,0xc0 ;115
.DB 0x00,0x00,0x00,0x40,0xe0,0x40,0x40,0x60 ;116
.DB 0x00,0x00,0x00,0x00,0xa0,0xa0,0xa0,0x60 ;117
.DB 0x00,0x00,0x00,0x00,0xa0,0xa0,0xe0,0x40 ;118
.DB 0x00,0x00,0x00,0x00,0xa0,0xe0,0xe0,0xe0 ;119
.DB 0x00,0x00,0x00,0x00,0xa0,0x40,0x40,0xa0 ;120
.DB 0x00,0x00,0x00,0xa0,0xa0,0x60,0x20,0x40 ;121
.DB 0x00,0x00,0x00,0x00,0xe0,0x60,0xc0,0xe0 ;122
.DB 0x00,0x00,0x00,0x60,0x40,0x80,0x40,0x60 ;123
.DB 0x00,0x00,0x00,0x80,0x80,0x00,0x80,0x80 ;124
.DB 0x00,0x00,0x00,0xc0,0x40,0x20,0x40,0xc0 ;125
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xc0 ;126
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ;127
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ;0
.DB 0x38,0x44,0x6c,0x44,0x54,0x44,0x38,0x00 ;1
.DB 0x38,0x7c,0x54,0x7c,0x44,0x7c,0x38,0x00 ;2
.DB 0x00,0x28,0x7c,0x7c,0x7c,0x38,0x10,0x00 ;3
.DB 0x00,0x10,0x38,0x7c,0x7c,0x38,0x10,0x00 ;4
.DB 0x10,0x38,0x38,0x10,0x7c,0x7c,0x10,0x00 ;5
.DB 0x00,0x10,0x38,0x7c,0x7c,0x10,0x38,0x00 ;6
.DB 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00 ;7
.DB 0xfc,0xfc,0xfc,0xcc,0xcc,0xfc,0xfc,0xfc ;8
.DB 0x00,0x00,0x78,0x48,0x48,0x78,0x00,0x00 ;9
.DB 0xfc,0xfc,0x84,0xb4,0xb4,0x84,0xfc,0xfc ;10
.DB 0x00,0x1c,0x0c,0x34,0x48,0x48,0x30,0x00 ;11
.DB 0x38,0x44,0x44,0x38,0x10,0x38,0x10,0x00 ;12
.DB 0x10,0x18,0x14,0x10,0x30,0x70,0x60,0x00 ;13
.DB 0x0c,0x34,0x2c,0x34,0x2c,0x6c,0x60,0x00 ;14
.DB 0x00,0x54,0x38,0x6c,0x38,0x54,0x00,0x00 ;15
.DB 0x20,0x30,0x38,0x3c,0x38,0x30,0x20,0x00 ;16
.DB 0x08,0x18,0x38,0x78,0x38,0x18,0x08,0x00 ;17
.DB 0x10,0x38,0x7c,0x10,0x7c,0x38,0x10,0x00 ;18
.DB 0x28,0x28,0x28,0x28,0x28,0x00,0x28,0x00 ;19
.DB 0x3c,0x54,0x54,0x34,0x14,0x14,0x14,0x00 ;20
.DB 0x38,0x44,0x30,0x28,0x18,0x44,0x38,0x00 ;21
.DB 0x00,0x00,0x00,0x00,0x00,0x78,0x78,0x00 ;22
.DB 0x10,0x38,0x7c,0x10,0x7c,0x38,0x10,0x38 ;23
.DB 0x10,0x38,0x7c,0x10,0x10,0x10,0x10,0x00 ;24
.DB 0x10,0x10,0x10,0x10,0x7c,0x38,0x10,0x00 ;25
.DB 0x00,0x10,0x18,0x7c,0x18,0x10,0x00,0x00 ;26
.DB 0x00,0x10,0x30,0x7c,0x30,0x10,0x00,0x00 ;27
.DB 0x00,0x00,0x00,0x40,0x40,0x40,0x7c,0x00 ;28
.DB 0x00,0x28,0x28,0x7c,0x28,0x28,0x00,0x00 ;29
.DB 0x10,0x10,0x38,0x38,0x7c,0x7c,0x00,0x00 ;30
.DB 0x7c,0x7c,0x38,0x38,0x10,0x10,0x00,0x00 ;31
Font_Space:
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ;32
.DB 0x10,0x38,0x38,0x10,0x10,0x00,0x10,0x00 ;33
.DB 0x6c,0x6c,0x48,0x00,0x00,0x00,0x00,0x00 ;34
.DB 0x00,0x28,0x7c,0x28,0x28,0x7c,0x28,0x00 ;35
.DB 0x20,0x38,0x40,0x30,0x08,0x70,0x10,0x00 ;36
.DB 0x64,0x64,0x08,0x10,0x20,0x4c,0x4c,0x00 ;37
.DB 0x20,0x50,0x50,0x20,0x54,0x48,0x34,0x00 ;38
.DB 0x30,0x30,0x20,0x00,0x00,0x00,0x00,0x00 ;39
.DB 0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x00 ;40
.DB 0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x00 ;41
.DB 0x00,0x28,0x38,0x7c,0x38,0x28,0x00,0x00 ;42
.DB 0x00,0x10,0x10,0x7c,0x10,0x10,0x00,0x00 ;43
.DB 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20 ;44
.DB 0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00 ;45
.DB 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00 ;46
.DB 0x00,0x04,0x08,0x10,0x20,0x40,0x00,0x00 ;47
Font_0:
.DB 0x38,0x44,0x4c,0x54,0x64,0x44,0x38,0x00 ;48
.DB 0x10,0x30,0x10,0x10,0x10,0x10,0x38,0x00 ;49
.DB 0x38,0x44,0x04,0x18,0x20,0x40,0x7c,0x00 ;50
.DB 0x38,0x44,0x04,0x38,0x04,0x44,0x38,0x00 ;51
.DB 0x08,0x18,0x28,0x48,0x7c,0x08,0x08,0x00 ;52
.DB 0x7c,0x40,0x40,0x78,0x04,0x44,0x38,0x00 ;53
.DB 0x18,0x20,0x40,0x78,0x44,0x44,0x38,0x00 ;54
.DB 0x7c,0x04,0x08,0x10,0x20,0x20,0x20,0x00 ;55
.DB 0x38,0x44,0x44,0x38,0x44,0x44,0x38,0x00 ;56
.DB 0x38,0x44,0x44,0x3c,0x04,0x08,0x30,0x00 ;57
.DB 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x00 ;58
.DB 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x20 ;59
.DB 0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x00 ;60
.DB 0x00,0x00,0x7c,0x00,0x00,0x7c,0x00,0x00 ;61
.DB 0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x00 ;62
.DB 0x38,0x44,0x04,0x18,0x10,0x00,0x10,0x00 ;63
.DB 0x38,0x44,0x5c,0x54,0x5c,0x40,0x38,0x00 ;64
Font_A:
.DB 0x38,0x44,0x44,0x44,0x7c,0x44,0x44,0x00 ;65
.DB 0x78,0x44,0x44,0x78,0x44,0x44,0x78,0x00 ;66
.DB 0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00 ;67
.DB 0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00 ;68
.DB 0x7c,0x40,0x40,0x78,0x40,0x40,0x7c,0x00 ;69
.DB 0x7c,0x40,0x40,0x78,0x40,0x40,0x40,0x00 ;70
.DB 0x38,0x44,0x40,0x5c,0x44,0x44,0x3c,0x00 ;71
.DB 0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x00 ;72
.DB 0x38,0x10,0x10,0x10,0x10,0x10,0x38,0x00 ;73
.DB 0x04,0x04,0x04,0x04,0x44,0x44,0x38,0x00 ;74
.DB 0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00 ;75
.DB 0x40,0x40,0x40,0x40,0x40,0x40,0x7c,0x00 ;76
.DB 0x44,0x6c,0x54,0x44,0x44,0x44,0x44,0x00 ;77
.DB 0x44,0x64,0x54,0x4c,0x44,0x44,0x44,0x00 ;78
.DB 0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00 ;79
.DB 0x78,0x44,0x44,0x78,0x40,0x40,0x40,0x00 ;80
.DB 0x38,0x44,0x44,0x44,0x54,0x48,0x34,0x00 ;81
.DB 0x78,0x44,0x44,0x78,0x48,0x44,0x44,0x00 ;82
.DB 0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00 ;83
.DB 0x7c,0x10,0x10,0x10,0x10,0x10,0x10,0x00 ;84
.DB 0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00 ;85
.DB 0x44,0x44,0x44,0x44,0x44,0x28,0x10,0x00 ;86
.DB 0x44,0x44,0x54,0x54,0x54,0x54,0x28,0x00 ;87
.DB 0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00 ;88
.DB 0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x00 ;89
.DB 0x78,0x08,0x10,0x20,0x40,0x40,0x78,0x00 ;90
.DB 0x38,0x20,0x20,0x20,0x20,0x20,0x38,0x00 ;91
.DB 0x00,0x40,0x20,0x10,0x08,0x04,0x00,0x00 ;92
.DB 0x38,0x08,0x08,0x08,0x08,0x08,0x38,0x00 ;93
.DB 0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00 ;94
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc ;95
.DB 0x30,0x30,0x10,0x00,0x00,0x00,0x00,0x00 ;96
.DB 0x00,0x00,0x38,0x04,0x3c,0x44,0x3c,0x00 ;97
.DB 0x40,0x40,0x78,0x44,0x44,0x44,0x78,0x00 ;98
.DB 0x00,0x00,0x38,0x44,0x40,0x44,0x38,0x00 ;99
.DB 0x04,0x04,0x3c,0x44,0x44,0x44,0x3c,0x00 ;100
.DB 0x00,0x00,0x38,0x44,0x78,0x40,0x38,0x00 ;101
.DB 0x18,0x20,0x20,0x78,0x20,0x20,0x20,0x00 ;102
.DB 0x00,0x00,0x3c,0x44,0x44,0x3c,0x04,0x38 ;103
.DB 0x40,0x40,0x70,0x48,0x48,0x48,0x48,0x00 ;104
.DB 0x10,0x00,0x10,0x10,0x10,0x10,0x18,0x00 ;105
.DB 0x08,0x00,0x18,0x08,0x08,0x08,0x48,0x30 ;106
.DB 0x40,0x40,0x48,0x50,0x60,0x50,0x48,0x00 ;107
.DB 0x10,0x10,0x10,0x10,0x10,0x10,0x18,0x00 ;108
.DB 0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x00 ;109
.DB 0x00,0x00,0x70,0x48,0x48,0x48,0x48,0x00 ;110
.DB 0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x00 ;111
.DB 0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40 ;112
.DB 0x00,0x00,0x3c,0x44,0x44,0x44,0x3c,0x04 ;113
.DB 0x00,0x00,0x58,0x24,0x20,0x20,0x70,0x00 ;114
.DB 0x00,0x00,0x38,0x40,0x38,0x04,0x38,0x00 ;115
.DB 0x00,0x20,0x78,0x20,0x20,0x28,0x10,0x00 ;116
.DB 0x00,0x00,0x48,0x48,0x48,0x58,0x28,0x00 ;117
.DB 0x00,0x00,0x44,0x44,0x44,0x28,0x10,0x00 ;118
.DB 0x00,0x00,0x44,0x44,0x54,0x7c,0x28,0x00 ;119
.DB 0x00,0x00,0x48,0x48,0x30,0x48,0x48,0x00 ;120
.DB 0x00,0x00,0x48,0x48,0x48,0x38,0x10,0x60 ;121
.DB 0x00,0x00,0x78,0x08,0x30,0x40,0x78,0x00 ;122
.DB 0x18,0x20,0x20,0x60,0x20,0x20,0x18,0x00 ;123
.DB 0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x00 ;124
.DB 0x30,0x08,0x08,0x0c,0x08,0x08,0x30,0x00 ;125
.DB 0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00 ;126
.DB 0x10,0x38,0x6c,0x44,0x44,0x7c,0x00,0x00 ;127
.DB 0x38,0x44,0x40,0x40,0x44,0x38,0x10,0x30 ;128
.DB 0x48,0x00,0x48,0x48,0x48,0x58,0x28,0x00 ;129
.DB 0x0c,0x00,0x38,0x44,0x78,0x40,0x38,0x00 ;130
.DB 0x38,0x00,0x38,0x04,0x3c,0x44,0x3c,0x00 ;131
.DB 0x28,0x00,0x38,0x04,0x3c,0x44,0x3c,0x00 ;132
.DB 0x30,0x00,0x38,0x04,0x3c,0x44,0x3c,0x00 ;133
.DB 0x38,0x28,0x38,0x04,0x3c,0x44,0x3c,0x00 ;134
.DB 0x00,0x38,0x44,0x40,0x44,0x38,0x10,0x30 ;135
.DB 0x38,0x00,0x38,0x44,0x78,0x40,0x38,0x00 ;136
.DB 0x28,0x00,0x38,0x44,0x78,0x40,0x38,0x00 ;137
.DB 0x30,0x00,0x38,0x44,0x78,0x40,0x38,0x00 ;138
.DB 0x28,0x00,0x10,0x10,0x10,0x10,0x18,0x00 ;139
.DB 0x10,0x28,0x00,0x10,0x10,0x10,0x18,0x00 ;140
.DB 0x20,0x00,0x10,0x10,0x10,0x10,0x18,0x00 ;141
.DB 0x28,0x00,0x10,0x28,0x44,0x7c,0x44,0x00 ;142
.DB 0x38,0x28,0x38,0x6c,0x44,0x7c,0x44,0x00 ;143
.DB 0x0c,0x00,0x7c,0x40,0x78,0x40,0x7c,0x00 ;144
.DB 0x00,0x00,0x78,0x14,0x7c,0x50,0x3c,0x00 ;145
.DB 0x3c,0x50,0x50,0x7c,0x50,0x50,0x5c,0x00 ;146
.DB 0x38,0x00,0x30,0x48,0x48,0x48,0x30,0x00 ;147
.DB 0x28,0x00,0x30,0x48,0x48,0x48,0x30,0x00 ;148
.DB 0x60,0x00,0x30,0x48,0x48,0x48,0x30,0x00 ;149
.DB 0x38,0x00,0x48,0x48,0x48,0x58,0x28,0x00 ;150
.DB 0x60,0x00,0x48,0x48,0x48,0x58,0x28,0x00 ;151
.DB 0x28,0x00,0x48,0x48,0x48,0x38,0x10,0x60 ;152
.DB 0x48,0x30,0x48,0x48,0x48,0x48,0x30,0x00 ;153
.DB 0x28,0x00,0x48,0x48,0x48,0x48,0x30,0x00 ;154
.DB 0x00,0x10,0x38,0x40,0x40,0x38,0x10,0x00 ;155
.DB 0x18,0x24,0x20,0x78,0x20,0x24,0x5c,0x00 ;156
.DB 0x44,0x28,0x10,0x7c,0x10,0x7c,0x10,0x00 ;157
.DB 0x60,0x50,0x50,0x68,0x5c,0x48,0x48,0x00 ;158
.DB 0x08,0x14,0x10,0x38,0x10,0x10,0x50,0x20 ;159
.DB 0x18,0x00,0x38,0x04,0x3c,0x44,0x3c,0x00 ;160
.DB 0x18,0x00,0x10,0x10,0x10,0x10,0x18,0x00 ;161
.DB 0x18,0x00,0x30,0x48,0x48,0x48,0x30,0x00 ;162
.DB 0x18,0x00,0x48,0x48,0x48,0x58,0x28,0x00 ;163
.DB 0x28,0x50,0x00,0x70,0x48,0x48,0x48,0x00 ;164
.DB 0x28,0x50,0x00,0x48,0x68,0x58,0x48,0x00 ;165
.DB 0x38,0x04,0x3c,0x44,0x3c,0x00,0x3c,0x00 ;166
.DB 0x30,0x48,0x48,0x48,0x30,0x00,0x78,0x00 ;167
.DB 0x10,0x00,0x10,0x30,0x40,0x44,0x38,0x00 ;168
.DB 0x00,0x00,0x7c,0x40,0x40,0x40,0x00,0x00 ;169
.DB 0x00,0x00,0xfc,0x04,0x04,0x00,0x00,0x00 ;170
.DB 0x40,0x48,0x50,0x38,0x44,0x08,0x1c,0x00 ;171
.DB 0x40,0x48,0x50,0x2c,0x54,0x1c,0x04,0x00 ;172
.DB 0x10,0x00,0x10,0x10,0x38,0x38,0x10,0x00 ;173
.DB 0x00,0x00,0x24,0x48,0x24,0x00,0x00,0x00 ;174
.DB 0x00,0x00,0x48,0x24,0x48,0x00,0x00,0x00 ;175
.DB 0x54,0x00,0xa8,0x00,0x54,0x00,0xa8,0x00 ;176
.DB 0x54,0xa8,0x54,0xa8,0x54,0xa8,0x54,0xa8 ;177
.DB 0xa8,0xfc,0x54,0xfc,0xa8,0xfc,0x54,0xfc ;178
.DB 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10 ;179
.DB 0x10,0x10,0x10,0xf0,0x10,0x10,0x10,0x10 ;180
.DB 0x10,0xf0,0x10,0xf0,0x10,0x10,0x10,0x10 ;181
.DB 0x50,0x50,0x50,0xd0,0x50,0x50,0x50,0x50 ;182
.DB 0x00,0x00,0x00,0xf0,0x50,0x50,0x50,0x50 ;183
.DB 0x00,0xf0,0x10,0xf0,0x10,0x10,0x10,0x10 ;184
.DB 0x50,0xd0,0x10,0xd0,0x50,0x50,0x50,0x50 ;185
.DB 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50 ;186
.DB 0x00,0xf0,0x10,0xd0,0x50,0x50,0x50,0x50 ;187
.DB 0x50,0xd0,0x10,0xf0,0x00,0x00,0x00,0x00 ;188
.DB 0x50,0x50,0x50,0xf0,0x00,0x00,0x00,0x00 ;189
.DB 0x10,0xf0,0x10,0xf0,0x00,0x00,0x00,0x00 ;190
.DB 0x00,0x00,0x00,0xf0,0x10,0x10,0x10,0x10 ;191
.DB 0x10,0x10,0x10,0x1c,0x00,0x00,0x00,0x00 ;192
.DB 0x10,0x10,0x10,0xfc,0x00,0x00,0x00,0x00 ;193
.DB 0x00,0x00,0x00,0xfc,0x10,0x10,0x10,0x10 ;194
.DB 0x10,0x10,0x10,0x1c,0x10,0x10,0x10,0x10 ;195
.DB 0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00 ;196
.DB 0x10,0x10,0x10,0xfc,0x10,0x10,0x10,0x10 ;197
.DB 0x10,0x1c,0x10,0x1c,0x10,0x10,0x10,0x10 ;198
.DB 0x50,0x50,0x50,0x5c,0x50,0x50,0x50,0x50 ;199
.DB 0x50,0x5c,0x40,0x7c,0x00,0x00,0x00,0x00 ;200
.DB 0x00,0x7c,0x40,0x5c,0x50,0x50,0x50,0x50 ;201
.DB 0x50,0xdc,0x00,0xfc,0x00,0x00,0x00,0x00 ;202
.DB 0x00,0xfc,0x00,0xdc,0x50,0x50,0x50,0x50 ;203
.DB 0x50,0x5c,0x40,0x5c,0x50,0x50,0x50,0x50 ;204
.DB 0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00 ;205
.DB 0x50,0xdc,0x00,0xdc,0x50,0x50,0x50,0x50 ;206
.DB 0x10,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00 ;207
.DB 0x50,0x50,0x50,0xfc,0x00,0x00,0x00,0x00 ;208
.DB 0x00,0xfc,0x00,0xfc,0x10,0x10,0x10,0x10 ;209
.DB 0x00,0x00,0x00,0xfc,0x50,0x50,0x50,0x50 ;210
.DB 0x50,0x50,0x50,0x7c,0x00,0x00,0x00,0x00 ;211
.DB 0x10,0x1c,0x10,0x1c,0x00,0x00,0x00,0x00 ;212
.DB 0x00,0x1c,0x10,0x1c,0x10,0x10,0x10,0x10 ;213
.DB 0x00,0x00,0x00,0x7c,0x50,0x50,0x50,0x50 ;214
.DB 0x50,0x50,0x50,0xdc,0x50,0x50,0x50,0x50 ;215
.DB 0x10,0xfc,0x00,0xfc,0x10,0x10,0x10,0x10 ;216
.DB 0x10,0x10,0x10,0xf0,0x00,0x00,0x00,0x00 ;217
.DB 0x00,0x00,0x00,0x1c,0x10,0x10,0x10,0x10 ;218
.DB 0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc ;219
.DB 0x00,0x00,0x00,0x00,0xfc,0xfc,0xfc,0xfc ;220
.DB 0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0 ;221
.DB 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c ;222
.DB 0xfc,0xfc,0xfc,0xfc,0x00,0x00,0x00,0x00 ;223
.DB 0x00,0x00,0x34,0x48,0x48,0x34,0x00,0x00 ;224
.DB 0x00,0x70,0x48,0x70,0x48,0x48,0x70,0x40 ;225
.DB 0x78,0x48,0x40,0x40,0x40,0x40,0x40,0x00 ;226
.DB 0x00,0x7c,0x28,0x28,0x28,0x28,0x28,0x00 ;227
.DB 0x78,0x48,0x20,0x10,0x20,0x48,0x78,0x00 ;228
.DB 0x00,0x00,0x3c,0x48,0x48,0x30,0x00,0x00 ;229
.DB 0x00,0x00,0x48,0x48,0x48,0x70,0x40,0x40 ;230
.DB 0x00,0x00,0x28,0x50,0x10,0x10,0x10,0x00 ;231
.DB 0x38,0x10,0x38,0x44,0x38,0x10,0x38,0x00 ;232
.DB 0x30,0x48,0x48,0x78,0x48,0x48,0x30,0x00 ;233
.DB 0x00,0x38,0x44,0x44,0x28,0x28,0x6c,0x00 ;234
.DB 0x30,0x40,0x20,0x10,0x38,0x48,0x30,0x00 ;235
.DB 0x00,0x00,0x28,0x54,0x54,0x28,0x00,0x00 ;236
.DB 0x00,0x10,0x38,0x54,0x54,0x38,0x10,0x00 ;237
.DB 0x00,0x38,0x40,0x78,0x40,0x38,0x00,0x00 ;238
.DB 0x00,0x30,0x48,0x48,0x48,0x48,0x00,0x00 ;239
.DB 0x00,0x78,0x00,0x78,0x00,0x78,0x00,0x00 ;240
.DB 0x00,0x10,0x38,0x10,0x00,0x38,0x00,0x00 ;241
.DB 0x40,0x30,0x08,0x30,0x40,0x00,0x78,0x00 ;242
.DB 0x08,0x30,0x40,0x30,0x08,0x00,0x78,0x00 ;243
.DB 0x00,0x08,0x14,0x10,0x10,0x10,0x10,0x10 ;244
.DB 0x10,0x10,0x10,0x10,0x10,0x50,0x20,0x00 ;245
.DB 0x00,0x10,0x00,0x7c,0x00,0x10,0x00,0x00 ;246
.DB 0x00,0x28,0x50,0x00,0x28,0x50,0x00,0x00 ;247
.DB 0x30,0x48,0x48,0x30,0x00,0x00,0x00,0x00 ;248
.DB 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00 ;249
.DB 0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00 ;250
.DB 0x00,0x1c,0x10,0x10,0x50,0x50,0x20,0x00 ;251
.DB 0x50,0x28,0x28,0x28,0x00,0x00,0x00,0x00 ;252
.DB 0x60,0x10,0x20,0x70,0x00,0x00,0x00,0x00 ;253
.DB 0x00,0x00,0x78,0x78,0x78,0x78,0x00,0x00 ;254
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ;255
.org 0x2000

783
presets/coleco/shoot.c Normal file
View File

@ -0,0 +1,783 @@
#include <stdlib.h>
#include <string.h>
#include "cv.h"
#include "cvu.h"
/* VRAM map
0x0000 - 0x17ff character pattern table
0x1800 - 0x1aff image table
0x2000 - 0x37ff color table
0x3800 - 0x3bff sprite pattern table
0x3c00 - 0x3fff sprite attribute table
*/
const cv_vmemp PATTERN = 0x0000;
const cv_vmemp IMAGE = 0x1800;
const cv_vmemp COLOR = 0x2000;
const cv_vmemp SPRITE_PATTERNS = 0x3800;
const cv_vmemp SPRITES = 0x3c00;
#define COLS 32
#define ROWS 24
#define NSPRITES 16
#define NMISSILES 8
#define YOFFSCREEN 239
typedef unsigned char byte;
typedef signed char sbyte;
typedef unsigned short word;
uintptr_t __at(0x6a) font_bitmap_a;
uintptr_t __at(0x6c) font_bitmap_0;
volatile bool vint;
volatile uint_fast8_t vint_counter;
void vint_handler(void)
{
vint = true;
vint_counter++;
}
static byte pattern_table[8*2] = {
/*{w:16,h:8,remap:[3,0,1,2]}*/
0xCC, 0xF2, 0xD0, 0xFC, 0xF3, 0xE8, 0xC4, 0x03,
0x0C, 0x13, 0x02, 0x0F, 0x33, 0x05, 0x08, 0x30,
};
static byte sprite_table[][16*2] = {
/*{w:16,h:16,remap:[-5,0,1,2,3,5,6,7,8,9],count:15}*/
{
0x01, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
0x03, 0x86, 0xCD, 0xBE, 0x9F, 0xB1, 0xC0, 0x80,
0x80, 0xC0, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80,
0xC0, 0x61, 0xB3, 0x7D, 0xF9, 0x8D, 0x03, 0x01,
},{
0x00, 0x00, 0x01, 0x03, 0x05, 0x01, 0x01, 0x00,
0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x80, 0xC0, 0xE0, 0xD0, 0xC0, 0xC0, 0x80,
0xA0, 0x80, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00,
},{
0x00, 0x00, 0x02, 0x03, 0x01, 0x01, 0x01, 0x01,
0x03, 0x07, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00,
0x00, 0x00, 0x40, 0xC0, 0x80, 0x80, 0x80, 0x80,
0xC0, 0xE0, 0xE0, 0xC0, 0xC0, 0x80, 0x00, 0x00,
},{
0x00, 0x00, 0x00, 0x04, 0x08, 0x11, 0x04, 0x05,
0x15, 0x24, 0x02, 0x00, 0x08, 0x30, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0xC4, 0x22, 0x08, 0xE8,
0xEA, 0xC9, 0x10, 0x00, 0xC4, 0x03, 0x00, 0x00,
},{
0x00, 0x00, 0x08, 0x30, 0x01, 0x00, 0x08, 0x0A,
0x00, 0x09, 0x04, 0x00, 0x10, 0x00, 0x40, 0x00,
0x00, 0x00, 0x04, 0xC3, 0x20, 0x00, 0x04, 0x14,
0x00, 0x24, 0x08, 0x00, 0x04, 0xC0, 0x01, 0x00,
},{
0x04, 0x10, 0x00, 0x22, 0x00, 0x00, 0x44, 0x02,
0x00, 0x40, 0x02, 0x24, 0x00, 0x00, 0x48, 0x01,
0x08, 0x42, 0x00, 0x11, 0x00, 0x80, 0x91, 0x20,
0x00, 0x00, 0x21, 0x90, 0x82, 0x00, 0x08, 0x21,
},{ // enemy ship rotations
0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x13, 0x02,
0x0F, 0x33, 0x05, 0x08, 0x30, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0xF2, 0xD0,
0xFC, 0xF3, 0xE8, 0xC4, 0x03, 0x00, 0x00, 0x00,
},{
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x1F,
0x12, 0x13, 0x03, 0x02, 0x04, 0x18, 0x00, 0x00,
0x00, 0x00, 0x70, 0x42, 0x4C, 0xF0, 0xBF, 0xF0,
0xF8, 0xF8, 0xF8, 0xF0, 0x80, 0x80, 0x80, 0x00,
},{
0x00, 0x02, 0x04, 0x04, 0x03, 0x02, 0x07, 0x07,
0x02, 0x03, 0x04, 0x04, 0x02, 0x00, 0x00, 0x00,
0x48, 0x48, 0x90, 0xA0, 0xC0, 0xE0, 0xF0, 0xF0,
0xE0, 0xC0, 0xA0, 0x90, 0x48, 0x48, 0x00, 0x00,
},{
0x02, 0x12, 0x0A, 0x0A, 0x27, 0x27, 0x3D, 0x07,
0x07, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0xF0, 0xFE,
0x60, 0xF0, 0x08, 0x04, 0xC4, 0x00, 0x00, 0x00,
},{
0x00, 0x00, 0x00, 0xC0, 0x23, 0x17, 0xCF, 0x3F,
0x0B, 0x4F, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0C, 0x10, 0xA0, 0xCC, 0xF0,
0x40, 0xC8, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
},{
0x00, 0x01, 0x01, 0x01, 0x0F, 0x1F, 0x1F, 0x1F,
0x0F, 0xFD, 0x0F, 0x32, 0x42, 0x0E, 0x00, 0x00,
0x00, 0x00, 0x18, 0x20, 0x40, 0xC0, 0xC8, 0x48,
0xF8, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
},{
0x00, 0x00, 0x12, 0x12, 0x09, 0x05, 0x03, 0x07,
0x0F, 0x0F, 0x07, 0x03, 0x05, 0x09, 0x12, 0x12,
0x00, 0x00, 0x00, 0x40, 0x20, 0x20, 0xC0, 0x40,
0xE0, 0xE0, 0x40, 0xC0, 0x20, 0x20, 0x40, 0x00,
},{
0x00, 0x00, 0x00, 0x23, 0x20, 0x10, 0x0F, 0x06,
0x7F, 0x0F, 0x0F, 0x0F, 0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0xE0,
0xE0, 0xBC, 0xE4, 0xE4, 0x50, 0x50, 0x48, 0x40,
},{
0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x13, 0x02,
0x0F, 0x33, 0x05, 0x08, 0x30, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0xF2, 0xD0,
0xFC, 0xF3, 0xE8, 0xC4, 0x03, 0x00, 0x00, 0x00,
}
};
#define SPRI_SHIP (4*0)
#define SPRI_MISSILE (4*1)
#define SPRI_BOMB (4*2)
#define SPRI_EXPLODE (4*3)
#define SPRI_ENEMY (4*6)
#define COLOR_FORMATION CV_COLOR_LIGHT_GREEN
#define COLOR_ATTACKER CV_COLOR_LIGHT_RED
#define COLOR_PLAYER CV_COLOR_LIGHT_YELLOW
#define COLOR_MISSILE CV_COLOR_WHITE
#define COLOR_SCORE CV_COLOR_LIGHT_BLUE
#define COLOR_EXPLOSION CV_COLOR_RED
void set_shifted_pattern(const byte* src, word dest, byte shift) {
byte y;
for (y=0; y<8; y++) {
byte a = src[y+8];
byte b = src[y];
cvu_voutb(a>>shift, dest);
cvu_voutb(b>>shift | a<<(8-shift), dest+8);
cvu_voutb(b<<(8-shift), dest+16);
dest++;
}
}
/*
PATTERN TABLE:
0-95 6x8 font, starting at ' '
67-82 shifted enemy sprites
*/
void setup_32_column_font() {
byte i;
cv_set_image_table(IMAGE);
// cvu_vmemset(PATTERN, 0, 8);
cvu_memtovmemcpy(PATTERN, (void *)(font_bitmap_0 - 16*8), 96*8);
cvu_memtovmemcpy(SPRITE_PATTERNS, sprite_table, sizeof(sprite_table));
cv_set_character_pattern_t(PATTERN);
cv_set_screen_mode(CV_SCREENMODE_STANDARD);
cv_set_color_table(COLOR);
cvu_vmemset(COLOR, COLOR_SCORE<<4, 8); // set color for chars 0-63
cvu_vmemset(COLOR+8, COLOR_FORMATION<<4, 32-8); // set chars 63-255
cv_set_sprite_pattern_table(SPRITE_PATTERNS);
cv_set_sprite_attribute_table(SPRITES);
cv_set_sprite_big(true);
for (i=0; i<8; i++)
set_shifted_pattern(pattern_table, PATTERN+67*8+i*3*8, i);
}
#define LOCHAR 0x20
#define HICHAR 0xff
#define CHAR(ch) (ch-LOCHAR)
#define BLANK 0
void clrscr() {
cvu_vmemset(IMAGE, CHAR(' '), COLS*ROWS);
}
byte getchar(byte x, byte y) {
return cvu_vinb(IMAGE + y*COLS + x);
}
void putchar(byte x, byte y, byte attr) {
cvu_voutb(attr, IMAGE + y*COLS + x);
}
void putstring(byte x, byte y, const char* string) {
while (*string) {
putchar(x++, y, CHAR(*string++));
}
}
void wait_vsync() {
vint = false;
while (!vint) ;
}
void delay(byte i) {
while (i--) {
wait_vsync();
}
}
void memset_safe(void* _dest, char ch, word size) {
byte* dest = _dest;
while (size--) {
*dest++ = ch;
}
}
char in_rect(byte x, byte y, byte x0, byte y0, byte w, byte h) {
return ((byte)(x-x0) < w && (byte)(y-y0) < h); // unsigned
}
void draw_bcd_word(byte x, byte y, word bcd) {
byte j;
x += 3;
for (j=0; j<4; j++) {
putchar(x, y, CHAR('0'+(bcd&0xf)));
x--;
bcd >>= 4;
}
}
// add two 16-bit BCD values
word bcd_add(word a, word b) {
a; b; // to avoid warning
__asm
ld hl,#4
add hl,sp
ld iy,#2
add iy,sp
ld a,0 (iy)
add a, (hl)
daa
ld c,a
ld a,1 (iy)
inc hl
adc a, (hl)
daa
ld b,a
ld l, c
ld h, b
__endasm;
}
// GAME CODE
typedef struct {
byte shape;
} FormationEnemy;
// should be power of 2 length
typedef struct {
byte findex;
byte shape;
word x;
word y;
byte dir;
byte returning;
} AttackingEnemy;
typedef struct {
signed char dx;
byte xpos;
signed char dy;
byte ypos;
} Missile;
#define ENEMIES_PER_ROW 8
#define ENEMY_ROWS 4
#define MAX_IN_FORMATION (ENEMIES_PER_ROW*ENEMY_ROWS)
#define MAX_ATTACKERS 6
FormationEnemy formation[MAX_IN_FORMATION];
AttackingEnemy attackers[MAX_ATTACKERS];
Missile missiles[NMISSILES];
struct cvu_sprite vsprites[NSPRITES];
byte formation_offset_x;
signed char formation_direction;
byte current_row;
byte player_x;
const byte player_y = 168;
byte player_exploding;
byte enemy_exploding;
byte enemies_left;
word player_score;
word framecount;
void copy_sprites() {
byte i;
word ofs;
cvu_memtovmemcpy(SPRITES, vsprites, sizeof(vsprites));
// copy all "shadow missiles" to video memory
ofs = SPRITES + NSPRITES*4;
for (i=0; i<NMISSILES; i++) {
// sprite struct: {y, x, name, tag}
cvu_voutb(missiles[i].ypos, ofs);
cvu_voutb(missiles[i].xpos, ofs+1);
ofs += 4;
}
}
void add_score(word bcd) {
player_score = bcd_add(player_score, bcd);
draw_bcd_word(0, 1, player_score);
putchar(4, 1, CHAR('0'));
}
void clrobjs() {
byte i;
word ofs;
memset(vsprites, 0, sizeof(vsprites));
for (i=0; i<NSPRITES; i++) {
vsprites[i].y = YOFFSCREEN;
}
ofs = SPRITES + NSPRITES*4;
for (i=0; i<NMISSILES; i++) {
// sprite struct: {y, x, name, tag}
cvu_voutb(i == 7 ? 4 : 8, ofs+2);
cvu_voutb(CV_COLOR_WHITE, ofs+3);
ofs += 4;
missiles[i].ypos = YOFFSCREEN;
}
}
void setup_formation() {
byte i;
memset(formation, 0, sizeof(formation));
memset(attackers, 0, sizeof(attackers));
for (i=0; i<MAX_IN_FORMATION; i++) {
byte flagship = i < ENEMIES_PER_ROW;
formation[i].shape = flagship ? 0x43 : 0x43;
}
enemies_left = MAX_IN_FORMATION;
}
void draw_row(byte row) {
byte i;
byte x = formation_offset_x / 8;
byte xd = (formation_offset_x & 7) * 3;
byte y = 3 + row * 2;
//vcolumns[y].attrib = 0x2;
//vcolumns[y].scroll = formation_offset_x;
for (i=0; i<x; i++)
putchar(i, y, BLANK);
for (i=0; i<ENEMIES_PER_ROW; i++) {
byte shape = formation[i + row*ENEMIES_PER_ROW].shape;
if (shape) {
shape += xd;
putchar(x, y, shape);
putchar(x+1, y, shape+1);
putchar(x+2, y, shape+2);
} else {
putchar(x, y, BLANK);
putchar(x+1, y, BLANK);
putchar(x+2, y, BLANK);
}
x += 3;
}
for (; x<COLS; x++)
putchar(x, y, BLANK);
}
void draw_next_row() {
draw_row(current_row);
if (++current_row == ENEMY_ROWS) {
current_row = 0;
formation_offset_x += formation_direction;
if (formation_offset_x == 71) {
formation_direction = -1;
}
else if (formation_offset_x == 0) {
formation_direction = 1;
}
}
}
const byte DIR_TO_CODE[32] = {
16, 16,
20, 20, 20, 20,
24, 24, 24, 24,
28, 28, 28, 28,
0, 0, 0, 0,
4, 4, 4, 4,
8, 8, 8, 8,
12, 12, 12, 12,
16, 16,
};
const byte SINTBL[32] = {
0, 25, 49, 71, 90, 106, 117, 125,
127, 125, 117, 106, 90, 71, 49, 25,
0, -25, -49, -71, -90, -106, -117, -125,
-127, -125, -117, -106, -90, -71, -49, -25,
};
signed char isin(byte dir) {
return SINTBL[dir & 31];
}
signed char icos(byte dir) {
return isin(dir+8);
}
#define FORMATION_X0 0
#define FORMATION_Y0 19
#define FORMATION_XSPACE 24
#define FORMATION_YSPACE 16
byte get_attacker_x(byte formation_index) {
byte column = (formation_index % ENEMIES_PER_ROW);
return FORMATION_XSPACE*column + FORMATION_X0 + formation_offset_x;
}
byte get_attacker_y(byte formation_index) {
byte row = formation_index / ENEMIES_PER_ROW;
return FORMATION_YSPACE*row + FORMATION_Y0;
}
void draw_attacker(byte i) {
AttackingEnemy* a = &attackers[i];
if (a->findex) {
vsprites[i].name = SPRI_ENEMY + DIR_TO_CODE[a->dir & 31]; // TODO: code + a->shape + 14;
vsprites[i].x = a->x >> 8;
vsprites[i].y = a->y >> 8;
vsprites[i].tag = COLOR_ATTACKER;
} else {
vsprites[i].y = YOFFSCREEN;
}
}
void draw_attackers() {
byte i;
for (i=0; i<MAX_ATTACKERS; i++) {
draw_attacker(i);
}
}
void return_attacker(AttackingEnemy* a) {
byte fi = a->findex-1;
byte destx = get_attacker_x(fi);
byte desty = get_attacker_y(fi);
byte ydist = desty - (a->y >> 8);
// are we close to our formation slot?
if (ydist == 0) {
// convert back to formation enemy
formation[fi].shape = a->shape;
a->findex = 0;
} else {
a->dir = (ydist + 16) & 31;
a->x = destx << 8;
a->y += 128;
}
}
void fly_attacker(AttackingEnemy* a) {
a->x += isin(a->dir) * 2;
a->y += icos(a->dir) * 2;
if ((a->y >> 8) == 0) {
a->returning = 1;
}
}
void move_attackers() {
byte i;
for (i=0; i<MAX_ATTACKERS; i++) {
AttackingEnemy* a = &attackers[i];
if (a->findex) {
if (a->returning)
return_attacker(a);
else
fly_attacker(a);
}
}
}
void think_attackers() {
byte i;
for (i=0; i<MAX_ATTACKERS; i++) {
AttackingEnemy* a = &attackers[i];
if (a->findex) {
// rotate?
byte x = a->x >> 8;
byte y = a->y >> 8;
// don't shoot missiles after player exploded
if (y < 112 || player_exploding) {
if (x < 128) {
a->dir++;
} else {
a->dir--;
}
} else {
// lower half of screen
// shoot a missile?
if (missiles[i].ypos == YOFFSCREEN) {
missiles[i].ypos = y+16;
missiles[i].xpos = x;
missiles[i].dy = 2;
}
}
}
}
}
void formation_to_attacker(byte formation_index) {
byte i;
// out of bounds? return
if (formation_index >= MAX_IN_FORMATION)
return;
// nobody in formation? return
if (!formation[formation_index].shape)
return;
// find an empty attacker slot
for (i=0; i<MAX_ATTACKERS; i++) {
AttackingEnemy* a = &attackers[i];
if (a->findex == 0) {
a->x = get_attacker_x(formation_index) << 8;
a->y = get_attacker_y(formation_index) << 8;
a->shape = formation[formation_index].shape;
a->findex = formation_index+1;
a->dir = 0;
a->returning = 0;
formation[formation_index].shape = 0;
break;
}
}
}
void draw_player() {
vsprites[7].x = player_x;
vsprites[7].y = player_y;
vsprites[7].name = SPRI_SHIP;
vsprites[7].tag = COLOR_PLAYER;
}
void move_player() {
struct cv_controller_state state;
cv_get_controller_state(&state, 0);
// move left/right?
if ((state.joystick & CV_LEFT) && player_x > 16) player_x--;
if ((state.joystick & CV_RIGHT) && player_x < 224) player_x++;
// shoot missile?
if ((state.joystick & CV_FIRE_0) && missiles[7].ypos == YOFFSCREEN) {
missiles[7].ypos = player_y-8; // must be multiple of missile speed
missiles[7].xpos = player_x; // player X position
missiles[7].dy = -4; // player missile speed
}
vsprites[7].x = player_x;
}
void move_missiles() {
byte i;
for (i=0; i<8; i++) {
if (missiles[i].ypos != YOFFSCREEN) {
// hit the bottom or top?
if ((byte)(missiles[i].ypos += missiles[i].dy) > YOFFSCREEN) {
missiles[i].ypos = YOFFSCREEN;
}
}
}
}
void blowup_at(byte x, byte y) {
vsprites[6].tag = COLOR_EXPLOSION;
vsprites[6].name = SPRI_EXPLODE; // TODO
vsprites[6].x = x;
vsprites[6].y = y;
enemy_exploding = 1;
}
void animate_enemy_explosion() {
if (enemy_exploding) {
// animate next frame
if (enemy_exploding >= 8) {
enemy_exploding = 0; // hide explosion after 4 frames
vsprites[6].y = YOFFSCREEN;
} else {
vsprites[6].name = SPRI_EXPLODE + (enemy_exploding += 4); // TODO
}
}
}
void animate_player_explosion() {
byte z = player_exploding;
if (z <= 3) {
if (z == 3) {
vsprites[7].y = YOFFSCREEN;
} else {
vsprites[7].name = SPRI_EXPLODE + z*4;
}
}
}
void hide_player_missile() {
missiles[7].ypos = YOFFSCREEN;
}
void does_player_shoot_formation() {
byte mx = missiles[7].xpos + 8;
byte my = missiles[7].ypos;
signed char row = (my - FORMATION_Y0) / FORMATION_YSPACE;
if (row >= 0 && row < ENEMY_ROWS) {
// ok if unsigned (in fact, must be due to range)
byte xoffset = mx - FORMATION_X0 - formation_offset_x;
byte column = xoffset / FORMATION_XSPACE;
byte localx = xoffset - column * FORMATION_XSPACE;
if (column < ENEMIES_PER_ROW && localx < 16) {
char index = column + row * ENEMIES_PER_ROW;
if (formation[index].shape) {
formation[index].shape = 0;
enemies_left--;
blowup_at(get_attacker_x(index), get_attacker_y(index));
hide_player_missile();
add_score(2);
}
}
}
}
void does_player_shoot_attacker() {
byte mx = missiles[7].xpos + 8;
byte my = missiles[7].ypos;
byte i;
for (i=0; i<MAX_ATTACKERS; i++) {
AttackingEnemy* a = &attackers[i];
if (a->findex && in_rect(mx, my, a->x >> 8, a->y >> 8, 16, 16)) {
blowup_at(a->x >> 8, a->y >> 8);
a->findex = 0;
enemies_left--;
hide_player_missile();
add_score(5);
break;
}
}
}
void does_missile_hit_player() {
byte i;
if (player_exploding)
return;
for (i=0; i<MAX_ATTACKERS; i++) {
if (missiles[i].dy &&
in_rect(missiles[i].xpos + 8, missiles[i].ypos,
player_x, player_y - 8, 16, 16)) {
player_exploding = 1;
break;
}
}
}
void new_attack_wave() {
byte i = rand();
byte j;
// find a random slot that has an enemy
for (j=0; j<MAX_IN_FORMATION; j++) {
i = (i+1) & (MAX_IN_FORMATION-1);
// anyone there?
if (formation[i].shape) {
formation_to_attacker(i);
formation_to_attacker(i+1);
formation_to_attacker(i+ENEMIES_PER_ROW);
formation_to_attacker(i+ENEMIES_PER_ROW+1);
break;
}
}
}
void new_player_ship() {
player_exploding = 0;
player_x = 128;
draw_player();
}
void set_sounds() {
byte i;
// missile fire sound
if (missiles[7].ypos != YOFFSCREEN) {
cv_set_frequency(CV_SOUNDCHANNEL_0, 2000-missiles[7].ypos*4);
cv_set_attenuation(CV_SOUNDCHANNEL_0, 18);
} else {
cv_set_attenuation(CV_SOUNDCHANNEL_0, 32);
}
// enemy explosion sound
if (enemy_exploding) {
cv_set_frequency(CV_SOUNDCHANNEL_1, 500+enemy_exploding*64);
cv_set_attenuation(CV_SOUNDCHANNEL_1, 14);
} else {
cv_set_attenuation(CV_SOUNDCHANNEL_1, 32);
}
cv_set_attenuation(CV_SOUNDCHANNEL_2, 32);
// player explosion
if (player_exploding && player_exploding < 15) {
cv_set_frequency(CV_SOUNDCHANNEL_2, player_exploding*256);
cv_set_attenuation(CV_SOUNDCHANNEL_NOISE, 4+player_exploding);
cv_set_noise(true, 3);
} else {
// set diving sounds for spaceships
cv_set_attenuation(CV_SOUNDCHANNEL_NOISE, 32);
for (i=0; i<3; i++) {
byte y = attackers[i].y >> 8;
if (y >= 0x80) {
cv_set_frequency(CV_SOUNDCHANNEL_2, 4000+y*8);
cv_set_attenuation(CV_SOUNDCHANNEL_2, 28);
break;
}
}
}
}
void wait_for_frame() {
while (((vint_counter ^ framecount) & 3) == 0);
}
void play_round() {
byte end_timer = 255;
player_score = 0;
add_score(0);
putstring(0, 0, "PLAYER 1");
setup_formation();
clrobjs();
formation_direction = 1;
vint_counter = 0;
framecount = 0;
new_player_ship();
while (end_timer) {
//cvu_voutb(cv_get_sprite_collission()*4, COLOR);
if (player_exploding) {
if ((framecount & 7) == 1) {
animate_player_explosion();
if (++player_exploding > 32 && enemies_left) {
new_player_ship();
}
}
} else {
if ((framecount & 0x7f) == 0 || enemies_left < 8) {
new_attack_wave();
}
move_player();
does_missile_hit_player();
}
if ((framecount & 3) == 0) animate_enemy_explosion();
move_attackers();
move_missiles();
does_player_shoot_formation();
does_player_shoot_attacker();
draw_next_row();
draw_attackers();
if ((framecount & 0xf) == 0) think_attackers();
set_sounds();
framecount++;
if (!enemies_left) end_timer--;
if (0) {
putchar(12,0,vint_counter&3);
putchar(13,0,framecount&3);
putchar(14,0,(vint_counter^framecount)&3);
}
wait_for_frame();
copy_sprites();
}
}
void main() {
cv_set_screen_active(false);
setup_32_column_font();
clrscr();
cv_set_screen_active(true);
cv_set_vint_handler(&vint_handler);
play_round();
main();
}

View File

@ -132,8 +132,8 @@ void init_game() {
memset(players, 0, sizeof(players)); memset(players, 0, sizeof(players));
players[0].head_attr = CHAR('1'); players[0].head_attr = CHAR('1');
players[1].head_attr = CHAR('2'); players[1].head_attr = CHAR('2');
players[0].tail_attr = '~'; players[0].tail_attr = '@';
players[1].tail_attr = '@'; players[1].tail_attr = '%';
frames_per_move = START_SPEED; frames_per_move = START_SPEED;
} }

42
presets/nes/hello.c Normal file
View File

@ -0,0 +1,42 @@
#include "nes.h"
unsigned char index;
const unsigned char TEXT[]={"Hello PPU!!!"};
const unsigned char PALETTE[]={0x1, 0x00, 0x10, 0x20}; //blue, gray, lt gray, white
void main (void) {
// turn off the screen
PPU.control = 0;
PPU.mask = 0;
// load the palette
PPU.vram.address = 0x3f;
PPU.vram.address = 0x0;
for(index = 0; index < sizeof(PALETTE); ++index){
PPU.vram.data = PALETTE[index];
}
// load the text
PPU.vram.address = 0x21; // set an address in the PPU of 0x21ca
PPU.vram.address = 0xca; // about the middle of the screen
for( index = 0; index < sizeof(TEXT); ++index ){
PPU.vram.data = TEXT[index];
}
// reset the scroll position
PPU.vram.address = 0x20;
PPU.vram.address = 0x0;
PPU.scroll = 0;
PPU.scroll = 0;
// turn on screen
PPU.control = 0x80; // NMI on
PPU.mask = 0x1e; // screen on
// infinite loop
while (1);
}

View File

@ -395,15 +395,17 @@ var Base6502Platform = function() {
this.cpuStateToLongString = function(c) { this.cpuStateToLongString = function(c) {
return cpuStateToLongString_6502(c); return cpuStateToLongString_6502(c);
} }
this.getToolForFilename = function(fn) { this.getToolForFilename = getToolForFilename_6502;
if (fn.endsWith(".pla")) return "plasm";
if (fn.endsWith(".c")) return "cc65";
if (fn.endsWith(".s")) return "ca65";
return "dasm";
}
this.getDefaultExtension = function() { return ".a"; }; this.getDefaultExtension = function() { return ".a"; };
} }
function getToolForFilename_6502(fn) {
if (fn.endsWith(".pla")) return "plasm";
if (fn.endsWith(".c")) return "cc65";
if (fn.endsWith(".s")) return "ca65";
return "dasm";
}
function dumpRAM(ram, ramofs, ramlen) { function dumpRAM(ram, ramofs, ramlen) {
var s = ""; var s = "";
// TODO: show scrollable RAM for other platforms // TODO: show scrollable RAM for other platforms
@ -926,6 +928,7 @@ var BaseMAMEPlatform = function() {
this.startModule = function(mainElement, opts) { this.startModule = function(mainElement, opts) {
romfn = opts.romfn; romfn = opts.romfn;
if (opts.romdata) romdata = opts.romdata;
if (!romdata) romdata = new RAM(opts.romsize).mem; if (!romdata) romdata = new RAM(opts.romsize).mem;
// create canvas // create canvas
video = new RasterVideo(mainElement, opts.width, opts.height); video = new RasterVideo(mainElement, opts.width, opts.height);
@ -988,12 +991,18 @@ var BaseMAMEPlatform = function() {
document.getElementsByTagName('head')[0].appendChild(script); document.getElementsByTagName('head')[0].appendChild(script);
} }
this.loadRegion = function(region, data) { this.loadROMFile = function(data) {
romdata = data; romdata = data;
if (loaded) { if (loaded) {
FS.writeFile(romfn, data, {encoding:'binary'}); FS.writeFile(romfn, data, {encoding:'binary'});
}
}
this.loadRegion = function(region, data) {
if (loaded) {
//self.luacall('cart=manager:machine().images["cart"]\nprint(cart:filename())\ncart:load("' + romfn + '")\n'); //self.luacall('cart=manager:machine().images["cart"]\nprint(cart:filename())\ncart:load("' + romfn + '")\n');
var s = 'mem = manager:machine():memory().regions["' + region + '"]\n'; var s = 'mem = manager:machine():memory().regions["' + region + '"]\n';
//s += 'print(mem.size)\n';
for (var i=0; i<data.length; i+=4) { for (var i=0; i<data.length; i+=4) {
var v = data[i] + (data[i+1]<<8) + (data[i+2]<<16) + (data[i+3]<<24); var v = data[i] + (data[i+1]<<8) + (data[i+2]<<16) + (data[i+3]<<24);
s += 'mem:write_u32(' + i + ',' + v + ')\n'; // TODO: endian? s += 'mem:write_u32(' + i + ',' + v + ')\n'; // TODO: endian?

View File

@ -21,7 +21,7 @@ function PixelEditor(parentDiv, fmt, palette, initialData, thumbnails) {
ctx.putImageData(pixdata, 0, 0); ctx.putImageData(pixdata, 0, 0);
} }
function updateThumbnails() { function commit() {
if (!thumbnails) return; if (!thumbnails) return;
for (var i=0; i<thumbnails.length; i++) { for (var i=0; i<thumbnails.length; i++) {
thumbnails[i].copyImageFrom(self); thumbnails[i].copyImageFrom(self);
@ -33,12 +33,15 @@ function PixelEditor(parentDiv, fmt, palette, initialData, thumbnails) {
updateImage(); updateImage();
} }
this.getImageData = function() { return pixints; } this.getImageData = function() { return pixints.slice(0); }
function fitCanvas() { function fitCanvas() {
var w = $(parentDiv).width(); var w = $(parentDiv).width();
var h = $(parentDiv).height(); var h = $(parentDiv).height();
pixcanvas.style.height = Math.floor(h)+"px"; if (h > w)
pixcanvas.style.height = Math.floor(h)+"px";
else
pixcanvas.style.height = Math.floor(h/2)+"px";
// TODO // TODO
} }
this.resize = fitCanvas; this.resize = fitCanvas;
@ -150,10 +153,35 @@ function PixelEditor(parentDiv, fmt, palette, initialData, thumbnails) {
var pos = getPositionFromEvent(e); var pos = getPositionFromEvent(e);
setPixel(pos.x, pos.y, dragcol); setPixel(pos.x, pos.y, dragcol);
dragging = false; dragging = false;
updateThumbnails(); commit();
pixcanvas.releaseCapture(); pixcanvas.releaseCapture();
}); });
} }
this.rotate = function(deg) {
console.log("rotate " + deg);
var s1 = Math.sin(deg * Math.PI / 180);
var c1 = Math.cos(deg * Math.PI / 180);
var p = self.getImageColors();
var i = 0;
for (var y=0; y<height; y++) {
for (var x=0; x<width; x++) {
var xx = x + 0.5 - width/2.0;
var yy = y + 0.5 - height/2.0;
var xx2 = xx*c1 - yy*s1 + width/2.0 - 0.5;
var yy2 = yy*c1 + xx*s1 + height/2.0 - 0.5;
var col = getPixel(Math.round(xx2), Math.round(yy2));
p[i++] = col;
}
}
i = 0;
for (var y=0; y<height; y++) {
for (var x=0; x<width; x++) {
setPixel(x, y, p[i++]);
}
}
commit();
}
} }
///////////////// /////////////////
@ -402,5 +430,23 @@ function pixelEditorKeypress(e) {
currentPixelEditor.setCurrentColor(c-48); currentPixelEditor.setCurrentColor(c-48);
} else if (c >= 97 && c <= 102) { } else if (c >= 97 && c <= 102) {
currentPixelEditor.setCurrentColor(c-97+10); currentPixelEditor.setCurrentColor(c-97+10);
} else {
switch (e.keyCode) {
case 33: // PgUp
currentPixelEditor.rotate(-90);
break;
case 34: // PgDn
currentPixelEditor.rotate(90);
break;
case 35: // PgUp
currentPixelEditor.rotate(-45);
break;
case 36: // PgDn
currentPixelEditor.rotate(45);
break;
default:
console.log(e);
break;
}
} }
} }

View File

@ -4,6 +4,7 @@
// http://www.colecovision.eu/ColecoVision/development/libcv.shtml // http://www.colecovision.eu/ColecoVision/development/libcv.shtml
// http://www.kernelcrash.com/blog/recreating-the-colecovision/2016/01/27/ // http://www.kernelcrash.com/blog/recreating-the-colecovision/2016/01/27/
// http://www.atarihq.com/danb/files/CV-Tech.txt // http://www.atarihq.com/danb/files/CV-Tech.txt
// http://www.atarihq.com/danb/files/CV-Sound.txt
// http://www.colecoboxart.com/faq/FAQ05.htm // http://www.colecoboxart.com/faq/FAQ05.htm
// http://www.theadamresource.com/manuals/technical/Jeffcoleco.html // http://www.theadamresource.com/manuals/technical/Jeffcoleco.html
// http://bifi.msxnet.org/msxnet//tech/tms9918a.txt // http://bifi.msxnet.org/msxnet//tech/tms9918a.txt
@ -19,6 +20,7 @@ var ColecoVision_PRESETS = [
{id:'cursorsmooth.c', name:'Moving Cursor'}, {id:'cursorsmooth.c', name:'Moving Cursor'},
{id:'simplemusic.c', name:'Simple Music'}, {id:'simplemusic.c', name:'Simple Music'},
{id:'siegegame.c', name:'Siege Game'}, {id:'siegegame.c', name:'Siege Game'},
{id:'shoot.c', name:'Solarian Game'},
]; ];
// doesn't work, use MAME // doesn't work, use MAME
@ -208,6 +210,7 @@ var ColecoVisionMAMEPlatform = function(mainElement) {
} }
this.loadROM = function(title, data) { this.loadROM = function(title, data) {
this.loadROMFile(data);
this.loadRegion(":coleco_cart:rom", data); this.loadRegion(":coleco_cart:rom", data);
} }

407
src/platform/nes.js Normal file
View File

@ -0,0 +1,407 @@
"use strict";
var NES_PRESETS = [
{id:'hello.c', name:'Hello PPU'},
];
/// JSNES
var JSNESPlatform = function(mainElement) {
var self = this;
var nes;
var rom;
this.getPresets = function() { return NES_PRESETS; }
this.start = function() {
nes = new JSNES({
'ui': $('#emulator').JSNESUI({})
});
}
this.loadROM = function(title, data) {
nes.loadRom(data);
}
this.getToolForFilename = getToolForFilename_6502;
this.getDefaultExtension = function() { return ".c"; };
this.isRunning = function() { return nes.isRunning; }
this.pause = function() { if (rom) nes.stop(); }
this.resume = function() { if (rom) nes.start(); }
this.clearDebug = function() { // TODO
}
}
/// MAME support
var NESMAMEPlatform = function(mainElement) {
var self = this;
this.__proto__ = new BaseMAMEPlatform();
//
this.start = function() {
self.startModule(mainElement, {
jsfile:'mamenes.js',
//cfgfile:'nes.cfg',
driver:'nes',
width:256*2,
height:240*2,
romfn:'/emulator/cart.nes',
romsize:0xa000,
romdata:NES_DEFAULT_ROM,
preInit:function(_self) {
},
});
}
this.loadROM = function(title, data) {
this.loadROMFile(data);
this.loadRegion(":nes_slot:cart:prg_rom", data.slice(0x10, 0x8010));
this.loadRegion(":nes_slot:cart:chr_rom", data.slice(0x8010, 0xa010));
}
this.getPresets = function() { return NES_PRESETS; }
this.getToolForFilename = getToolForFilename_6502;
this.getDefaultExtension = function() { return ".c"; };
}
///
//PLATFORMS['nes'] = JSNESPlatform;
PLATFORMS['nes'] = NESMAMEPlatform;
///
var NES_DEFAULT_ROM_LZG = [
76,90,71,0,0,160,16,0,0,40,189,23,128,224,255,1,188,206,237,180,78,69,83,26,2,1,1,0,180,6,70,108,
117,66,66,97,32,89,97,68,180,132,216,120,173,2,32,133,24,173,22,64,133,25,237,2,16,251,162,0,142,0,32,134,
88,142,1,32,202,154,160,7,132,1,160,0,132,0,169,0,145,0,136,208,251,198,1,16,247,32,60,173,169,0,32,96,
173,169,2,133,89,169,13,32,78,174,169,154,133,0,169,129,133,1,237,14,111,237,19,141,3,32,169,78,141,0,7,169,
1,141,1,7,237,7,2,7,169,102,141,3,7,173,56,129,141,4,7,169,2,141,5,237,82,6,7,169,64,141,7,237,
87,5,32,180,65,133,0,133,1,133,2,133,82,133,3,133,6,169,136,141,0,32,169,30,141,1,32,165,82,240,252,173,
2,32,48,251,180,129,41,64,208,249,169,0,133,82,166,0,237,69,16,208,249,165,16,41,16,240,3,76,27,149,230,2,
165,2,201,2,208,22,237,22,2,189,61,129,141,5,32,206,3,78,232,224,64,208,2,162,237,166,64,240,203,206,6,97,
237,46,32,240,37,165,6,208,46,169,1,133,6,230,3,166,3,189,206,3,144,165,3,201,5,208,10,237,59,3,206,4,
160,76,53,129,237,5,6,237,39,208,206,3,93,76,170,128,96,112,128,144,160,1,3,7,13,20,30,40,50,60,70,80,
90,95,100,101,102,103,103,104,103,100,90,85,80,74,67,59,49,36,2,1,2,3,3,4,4,3,3,2,2,1,1,1,
2,180,1,180,193,237,12,4,5,180,1,4,3,237,6,0,237,73,206,7,13,6,5,5,237,13,0,0,237,35,180,163,
48,49,50,51,52,32,180,3,70,105,114,115,116,32,108,105,110,101,237,200,55,56,57,48,49,48,237,196,180,6,73,206,
12,7,32,49,32,65,65,65,68,237,196,237,194,180,161,180,5,206,5,24,32,32,206,6,24,237,130,237,143,180,2,237,
142,206,5,24,237,179,206,8,24,68,180,131,206,8,24,237,172,180,162,206,22,56,206,12,88,68,180,1,206,10,24,237,
138,180,228,206,10,30,206,8,24,237,131,206,5,1,206,15,24,206,3,69,206,9,216,237,136,206,6,14,206,42,24,48,
180,17,206,46,56,180,14,206,8,24,80,80,85,32,84,101,115,116,32,40,71,114,97,112,104,105,99,115,41,206,13,88,
206,27,56,32,112,65,206,7,57,83,111,117,110,100,237,118,206,28,56,206,7,24,67,206,7,55,67,111,100,101,237,246,
206,28,56,206,7,24,73,79,45,80,111,114,116,115,237,120,110,116,114,111,108,108,101,114,115,41,206,28,56,180,5,69,
120,105,116,206,26,24,206,27,56,206,26,24,45,180,25,206,29,88,206,30,24,206,28,24,206,6,24,206,104,152,32,76,
97,115,116,32,76,206,108,152,206,167,91,180,29,180,9,1,0,2,3,4,206,7,6,5,6,7,8,9,206,9,22,10,
11,12,13,14,15,16,206,6,7,17,18,19,20,21,22,23,206,8,24,24,25,26,27,28,29,0,30,31,32,33,34,35,
36,0,37,38,39,40,41,42,43,206,6,7,0,0,44,45,46,47,48,49,0,50,51,52,53,54,55,56,0,57,58,59,
60,61,62,206,7,7,180,2,63,64,65,0,0,66,67,68,69,70,71,46,0,72,0,0,73,74,75,206,7,7,180,2,
76,77,206,11,167,78,79,80,206,11,8,81,82,206,11,7,83,84,85,206,11,8,0,86,206,7,2,87,180,97,88,89,
90,206,12,23,180,1,91,180,130,92,93,94,95,96,97,98,99,206,162,90,104,237,73,105,206,12,29,106,107,108,109,110,
111,112,113,114,115,116,117,118,206,13,57,105,237,59,119,120,121,122,123,124,125,126,127,128,129,130,131,0,0,132,206,11,
85,180,1,133,134,135,136,137,138,139,140,141,142,143,144,145,206,15,123,206,18,138,146,237,196,180,197,147,148,149,150,151,
152,0,153,151,152,148,154,237,72,155,206,16,41,180,9,206,3,119,237,77,156,157,180,194,158,206,7,67,237,5,132,237,
135,206,5,42,159,160,180,228,149,161,162,0,163,149,161,164,152,149,150,150,162,152,206,11,68,206,35,1,164,153,149,206,
9,24,148,105,237,183,237,82,206,2,151,206,10,167,206,6,16,156,157,206,9,144,146,237,1,158,206,5,55,148,237,204,
206,3,113,237,3,105,206,2,134,206,17,183,206,6,84,206,5,71,180,97,163,152,162,165,166,164,148,206,3,82,206,6,
101,155,206,4,211,237,75,237,91,237,143,206,5,203,158,237,9,237,136,146,0,105,237,11,132,237,4,206,35,14,237,223,
206,6,106,167,168,169,170,237,124,171,172,173,173,173,0,163,174,163,0,175,151,174,162,148,206,4,180,105,0,105,176,177,
178,179,237,41,163,163,149,180,0,162,150,150,181,165,166,152,162,163,164,182,163,151,0,0,158,206,3,109,183,184,185,186,
0,105,237,3,146,206,36,80,146,206,3,133,158,132,0,146,91,159,160,146,206,4,214,105,158,237,67,0,187,237,21,180,
193,237,5,105,0,146,146,0,158,237,86,64,80,16,0,80,80,0,0,4,85,85,85,5,85,85,21,4,33,0,3,5,
1,192,0,196,8,129,160,160,96,192,16,170,46,86,84,82,94,164,130,78,104,42,85,85,234,164,200,94,158,87,90,88,
94,150,186,6,13,7,14,10,9,11,7,206,154,214,180,2,10,32,42,206,200,83,49,58,32,36,50,48,48,53,47,54,
47,55,46,206,131,60,42,32,10,206,27,55,237,122,10,237,185,78,111,114,109,97,108,32,119,114,105,116,101,47,114,101,
97,100,58,237,208,87,237,73,44,32,237,74,44,237,214,206,5,17,188,4,0,71,237,80,32,116,104,101,110,206,22,20,
99,111,114,114,101,99,116,206,5,17,77,105,120,101,100,32,97,100,114,47,100,97,116,97,206,11,44,36,51,48,48,48,
237,25,114,114,111,114,105,110,103,206,7,14,70,70,70,45,36,237,19,48,32,98,206,194,240,97,114,121,237,19,77,105,
120,237,245,115,32,116,111,206,6,237,237,16,82,206,2,107,237,71,50,237,80,114,101,115,101,116,32,108,97,116,99,104,
237,20,85,115,101,237,211,47,53,237,85,237,83,97,100,114,206,5,96,80,97,108,101,116,116,101,206,11,248,10,32,83,
99,111,114,101,58,32,32,32,47,49,49,237,7,180,7,80,114,101,115,115,32,83,116,97,114,116,0,206,60,154,206,40,
154,50,58,32,83,112,206,3,176,206,36,152,206,60,154,206,35,154,237,237,32,67,111,108,108,105,115,105,111,110,58,206,
7,11,76,105,109,180,193,206,2,191,206,226,218,206,3,183,237,130,206,37,187,68,77,65,206,17,13,105,102,46,206,19,
18,180,12,206,10,247,51,206,29,247,206,19,247,51,58,32,86,66,108,32,40,206,35,127,41,206,2,251,206,28,247,10,
10,32,66,105,116,32,55,32,99,108,101,97,114,206,66,55,102,116,101,114,206,19,170,206,14,174,52,206,29,174,206,10,
174,188,8,1,106,206,98,80,52,48,48,48,45,180,162,51,46,206,28,174,237,58,180,18,206,9,148,48,206,29,147,206,
10,147,188,7,1,197,49,58,32,65,114,105,116,109,101,116,104,105,99,32,111,112,115,206,28,147,206,34,73,237,121,65,
68,67,206,69,46,83,66,206,6,2,67,77,80,206,6,2,80,88,206,7,2,89,206,5,2,73,78,206,6,32,68,69,
206,6,2,73,78,206,6,32,68,69,206,6,2,73,78,206,6,42,68,69,206,6,2,65,83,76,206,5,2,76,83,82,
206,5,2,82,79,206,6,12,82,79,237,12,206,46,182,53,206,61,27,206,51,27,50,58,32,76,111,103,206,37,22,206,
124,107,206,42,27,76,68,65,206,6,173,68,206,6,213,76,68,206,6,203,84,65,206,6,12,84,65,206,7,12,83,206,
7,12,88,206,6,52,84,88,83,206,6,2,89,206,6,12,80,76,206,6,2,65,78,68,206,5,2,69,206,2,253,237,
130,79,82,206,6,22,66,73,84,206,69,221,206,41,18,50,57,206,61,18,206,51,18,51,58,32,65,100,100,237,118,101,
206,60,18,206,40,18,65,100,114,32,73,109,109,101,100,105,97,206,163,182,237,72,90,101,114,111,32,80,97,103,206,15,
8,44,206,34,8,237,74,65,98,115,111,108,117,206,7,41,206,6,7,206,15,24,44,206,34,67,237,73,40,73,110,100,
105,206,194,52,44,88,41,206,14,11,41,237,158,74,206,67,166,180,161,40,237,89,74,206,67,80,82,84,206,34,101,82,
84,73,206,134,20,206,41,48,52,50,206,61,48,206,51,48,52,58,32,77,105,115,99,206,8,66,206,60,48,206,34,48,
206,227,67,32,47,206,228,16,206,3,165,66,82,75,32,102,108,97,103,115,206,5,4,114,101,116,117,114,110,206,197,143,
83,116,97,99,107,206,5,4,206,99,28,65,77,206,8,2,206,229,33,206,141,249,206,10,228,56,206,29,228,206,10,228,
73,79,206,138,242,49,54,44,180,195,188,3,0,77,206,28,228,206,2,130,237,175,206,229,137,49,45,56,206,230,148,57,
45,49,206,231,160,49,55,45,50,52,206,226,95,237,100,55,206,28,36,206,9,230,206,178,66,206,5,221,101,108,101,99,
116,32,38,206,5,230,188,18,6,24,10,32,124,32,32,94,206,41,184,180,1,124,237,77,60,111,62,206,16,13,32,118,
237,2,83,101,32,83,116,32,32,66,32,65,237,77,206,19,76,206,31,97,206,31,97,206,29,97,180,7,206,60,200,206,
40,200,49,76,97,116,0,50,180,130,68,80,106,114,0,70,97,109,105,0,78,69,83,0,89,101,115,0,78,111,0,79,
107,0,69,206,98,17,180,164,32,105,110,32,90,45,70,108,97,103,206,8,8,78,206,13,8,86,206,13,8,67,206,13,
8,68,206,10,8,73,206,10,5,66,206,13,34,114,101,115,117,108,116,206,8,8,119,114,97,112,0,165,3,201,0,240,
18,201,1,240,11,201,2,240,13,201,3,240,12,76,20,173,76,84,166,76,140,166,76,125,150,188,8,13,21,142,1,32,
32,60,173,169,173,133,0,169,145,133,1,169,32,133,2,169,64,133,3,32,23,174,188,8,12,180,169,0,133,7,165,82,
240,252,24,169,33,141,6,32,165,7,10,10,201,96,48,2,105,64,105,12,237,135,24,105,8,170,160,8,202,189,0,5,
74,180,1,24,105,48,141,7,32,237,5,41,15,237,130,136,208,229,24,165,7,105,8,201,48,208,2,206,2,65,76,182,
149,180,193,82,188,6,12,187,73,48,208,164,162,35,160,40,32,231,172,32,37,173,206,15,143,155,133,0,169,146,206,21,
143,206,2,139,169,32,141,6,32,169,100,180,129,162,94,173,3,5,41,1,240,2,162,1,142,7,32,237,208,131,237,80,
60,173,1,206,14,16,133,237,80,62,173,0,206,14,16,164,237,80,86,173,2,206,9,16,206,12,163,140,32,37,173,165,
16,41,208,208,250,76,16,128,188,13,14,89,206,2,167,76,133,0,169,141,206,12,167,206,35,57,33,237,8,9,133,3,
237,12,6,184,169,130,201,4,240,51,48,55,112,59,144,63,36,6,169,126,201,126,208,37,48,41,80,45,144,49,201,127,
240,27,16,31,80,35,176,39,184,169,255,237,29,14,16,18,112,22,144,26,32,141,173,230,48,76,2,151,32,163,173,180,
162,174,180,163,185,180,163,196,173,206,3,83,41,133,3,24,184,169,130,162,130,224,4,240,52,48,56,112,60,144,64,162,
126,233,4,224,126,208,38,48,42,80,46,144,50,224,127,240,28,16,32,80,36,176,40,162,255,233,126,237,30,206,11,83,
93,206,3,83,180,161,174,180,163,185,180,163,206,5,83,73,206,4,83,160,130,192,206,7,83,160,126,233,4,192,206,7,
83,192,206,7,83,160,255,233,126,237,30,206,11,83,184,206,3,83,180,161,174,180,163,185,180,163,196,173,206,35,25,201,
133,3,24,169,122,105,4,240,73,48,77,112,81,176,85,237,2,63,16,67,80,71,176,75,105,112,240,53,16,57,112,61,
176,65,105,14,208,43,48,47,112,51,144,55,169,148,105,127,240,31,48,35,112,39,144,43,105,14,201,35,208,43,24,248,
169,8,105,8,201,16,216,208,38,206,4,101,49,152,206,2,101,180,161,174,180,163,185,180,163,196,180,163,240,180,163,207,
206,4,113,233,206,2,113,130,233,129,208,110,56,169,58,233,58,208,103,237,70,4,240,72,48,76,80,80,144,84,233,125,
208,62,48,66,112,70,144,74,233,7,240,52,16,56,112,60,176,64,233,121,240,42,48,46,80,50,144,54,201,127,208,56,
24,169,126,233,127,240,25,16,29,112,33,176,37,56,248,169,16,233,8,201,8,206,7,126,183,206,3,126,180,161,174,180,
163,185,180,163,196,180,163,240,180,163,207,206,36,82,105,133,3,36,6,56,169,254,133,4,169,0,230,4,240,45,16,49,
80,53,144,57,24,169,1,230,4,208,32,48,36,80,40,176,44,56,184,169,127,206,5,23,206,43,78,14,153,206,2,91,
180,161,174,180,163,185,180,163,206,37,169,137,206,4,79,1,237,48,254,198,4,206,34,54,80,51,144,55,24,198,4,240,
32,16,206,6,77,128,237,21,0,237,10,14,48,206,9,77,99,206,3,77,180,161,174,180,163,185,180,163,206,5,77,169,
206,3,77,162,254,169,0,232,240,41,16,45,80,49,144,53,24,169,1,232,208,29,48,33,80,37,176,41,56,184,162,127,
237,83,206,11,157,179,206,3,72,180,161,174,180,163,185,180,163,206,5,72,201,206,4,72,1,169,254,202,208,39,48,43,
80,47,144,51,24,202,240,29,16,206,6,70,128,169,0,202,206,12,150,1,154,206,2,70,180,161,174,180,163,185,180,163,
206,5,70,233,206,3,70,160,254,169,0,200,206,9,150,200,206,8,150,160,127,237,83,206,11,150,81,206,3,72,180,161,
174,180,163,185,180,163,196,173,169,34,206,100,162,206,2,72,1,169,254,136,206,7,150,136,206,8,150,160,128,169,0,136,
206,12,150,159,206,3,70,180,161,174,180,163,185,180,163,206,5,70,41,206,36,137,64,10,240,24,16,28,80,32,176,36,
184,10,208,206,5,53,230,48,237,55,76,220,237,181,180,161,237,53,180,161,237,53,180,161,206,5,53,73,237,245,2,74,
240,35,48,39,80,43,176,47,184,74,208,25,48,29,112,33,144,37,169,194,74,206,4,125,176,206,5,125,36,155,206,2,
64,180,161,174,180,163,185,180,163,206,5,64,206,69,101,0,42,240,48,48,52,80,56,176,60,169,85,42,240,37,16,41,
80,45,176,49,184,169,128,42,206,8,77,42,206,44,32,121,206,3,77,180,161,174,180,163,185,180,163,206,5,77,206,69,
99,14,106,206,68,181,176,57,106,240,36,48,40,80,44,144,48,24,184,169,1,106,208,23,48,27,112,31,144,35,106,206,
4,74,206,6,159,203,206,3,74,180,161,174,180,163,185,180,163,196,173,206,185,253,111,133,0,169,142,206,177,78,206,133,
61,206,3,124,240,46,48,50,80,54,144,58,169,0,208,206,5,124,184,24,169,170,206,34,107,112,32,176,36,169,206,37,
246,206,6,124,79,156,206,2,124,180,161,174,180,163,185,180,163,206,133,143,206,68,70,162,153,240,46,16,206,3,74,162,
206,9,74,162,234,206,6,74,162,69,206,44,117,161,206,3,74,180,161,174,180,163,185,180,163,206,69,152,206,69,72,178,
206,6,74,160,206,9,74,160,206,7,156,160,56,206,12,74,243,206,3,74,180,161,174,180,163,185,180,163,206,168,233,206,
3,238,162,144,170,240,55,48,59,80,63,144,67,169,0,162,255,170,208,206,133,158,206,2,244,162,0,170,206,194,71,112,
35,176,39,169,200,162,50,170,206,12,250,81,157,206,67,248,157,206,67,248,157,206,67,248,157,206,169,236,206,3,86,160,
144,168,206,8,86,160,255,168,206,10,86,160,0,168,206,8,86,160,50,168,206,12,86,175,206,3,86,180,161,174,180,163,
185,180,163,206,5,86,105,133,3,186,138,168,206,34,91,37,154,162,147,186,240,61,48,68,80,75,144,82,162,0,154,162,
255,186,208,47,48,54,80,61,144,68,184,24,162,250,154,162,0,186,240,31,16,38,112,45,176,52,162,185,154,162,127,186,
240,17,16,24,112,31,176,38,152,170,154,206,4,96,35,158,237,67,163,173,206,5,1,174,206,6,1,185,206,6,1,206,
171,13,162,14,169,144,138,206,6,202,162,0,169,255,138,206,8,202,162,170,169,0,138,206,6,202,162,200,169,50,138,206,
12,202,129,158,206,2,95,180,161,174,180,163,185,180,163,206,168,22,206,5,202,144,169,14,154,240,58,48,65,80,72,144,
79,162,255,169,0,154,208,45,48,52,80,59,144,66,184,24,162,0,169,170,154,240,30,16,37,112,44,176,51,162,50,169,
200,154,206,15,198,241,206,6,198,237,193,174,206,6,1,185,206,6,1,206,171,54,160,14,169,144,152,206,6,198,160,0,
169,255,152,206,8,198,160,170,169,0,152,206,6,198,160,200,169,50,152,206,77,248,159,206,67,248,159,206,67,248,159,206,
67,248,159,206,172,70,169,14,72,162,144,104,240,58,48,62,80,66,144,70,169,0,72,162,255,104,208,44,48,48,80,52,
144,56,206,34,248,72,162,0,104,206,226,241,112,36,176,40,169,200,72,162,50,104,206,12,90,177,206,3,90,180,161,174,
180,163,185,180,163,206,171,88,169,200,162,89,41,159,240,62,16,66,80,70,144,74,206,66,183,41,197,208,206,131,150,144,
60,184,24,237,22,131,41,55,206,226,1,112,40,176,44,206,66,198,41,143,240,18,16,22,112,26,176,30,201,138,208,32,
206,4,94,29,160,206,2,94,180,161,174,180,163,185,180,163,196,180,163,240,206,171,118,158,162,144,73,129,240,62,48,206,
4,100,1,162,255,73,1,206,9,100,170,162,0,73,113,206,226,24,206,3,100,200,162,50,73,102,206,7,100,174,206,6,
100,137,206,3,100,180,161,174,180,163,185,180,163,196,180,163,206,5,100,206,102,48,162,144,9,32,206,7,100,0,162,255,
9,0,206,9,100,10,162,0,9,160,206,7,100,8,162,50,9,192,206,7,100,200,206,6,100,245,206,3,100,180,161,174,
180,163,185,180,163,196,180,163,206,5,100,105,133,3,56,169,94,133,5,169,151,36,5,240,63,48,67,80,71,144,75,169,
5,237,8,240,36,5,208,47,48,51,112,55,144,59,24,169,197,237,9,58,237,9,30,16,34,80,38,176,42,169,153,237,
8,109,237,41,206,43,163,92,161,206,2,101,180,161,174,180,163,185,180,163,206,187,137,137,133,0,169,143,206,181,137,210,
133,3,169,94,240,24,48,22,201,35,240,18,201,94,208,14,169,130,240,10,16,8,206,4,99,181,161,32,152,206,164,94,
242,237,31,0,133,5,169,147,133,6,169,69,133,7,165,5,208,22,48,20,165,6,240,16,16,14,165,7,240,10,48,206,
5,41,230,237,169,206,66,143,18,237,105,141,6,1,206,8,44,162,4,181,1,208,59,48,57,181,2,201,147,208,51,162,
8,181,254,180,225,37,162,254,181,8,240,31,16,29,197,6,208,25,205,6,1,240,20,162,0,181,7,240,20,48,18,201,
69,208,14,206,4,77,65,162,32,251,173,180,162,206,5,83,50,206,2,171,141,0,2,173,254,254,201,170,208,29,173,0,
2,201,94,208,22,173,255,254,201,85,208,15,173,0,254,201,255,208,206,5,135,117,206,7,44,82,237,44,17,133,5,237,
48,25,2,162,25,189,237,171,46,189,230,237,107,39,189,231,254,201,34,208,26,162,37,189,224,255,201,17,208,17,162,217,
189,37,206,2,82,206,5,119,192,206,3,119,180,161,206,5,67,114,206,9,67,160,25,185,206,4,67,185,206,4,67,185,
206,4,67,160,38,185,223,206,3,67,160,218,185,36,206,9,67,11,163,206,2,67,180,161,206,5,67,146,206,35,78,6,
169,254,133,7,180,97,8,180,97,9,162,0,161,6,201,255,208,36,162,1,193,5,208,30,162,4,161,4,237,55,22,162,
39,161,225,180,225,206,5,207,82,237,191,180,161,206,5,63,178,206,16,63,160,0,177,237,127,46,160,3,180,225,187,208,
38,160,254,180,225,170,208,30,160,2,177,8,201,34,208,22,160,1,180,225,85,206,6,73,163,206,3,73,180,161,206,5,
73,210,133,3,76,178,163,169,0,240,206,5,24,189,206,7,18,206,66,0,214,141,0,2,169,163,141,1,2,108,180,225,
0,240,32,169,253,237,73,0,141,255,2,169,252,141,0,3,108,255,2,237,238,249,206,3,78,180,161,237,52,206,66,252,
18,133,3,184,32,8,164,80,57,234,104,168,104,201,164,208,49,152,201,4,208,44,237,228,31,164,206,6,30,206,34,214,
164,72,169,50,72,169,1,96,234,234,173,208,3,76,64,164,237,220,67,206,7,28,206,34,198,237,28,85,72,8,64,237,
91,206,5,158,99,237,88,206,89,255,193,133,0,169,144,206,85,255,209,133,3,169,255,72,40,8,104,201,255,208,25,169,
4,237,2,120,104,201,52,206,38,176,195,164,32,229,173,180,162,206,101,6,241,237,38,4,133,7,72,40,0,234,8,104,
41,16,240,60,165,7,180,161,54,180,161,4,240,42,169,0,133,7,237,122,237,84,168,237,9,25,152,237,20,26,237,154,
20,237,154,206,5,167,30,165,32,218,173,180,162,229,180,163,206,37,89,17,133,3,0,206,2,237,53,165,237,222,56,206,
7,18,49,133,3,169,85,186,72,221,0,1,208,43,104,169,170,237,194,33,169,170,141,0,1,169,85,141,0,2,162,254,
154,104,104,206,72,29,119,165,206,34,118,180,161,206,5,55,81,133,3,162,6,160,7,132,5,160,0,132,4,169,85,145,
4,136,208,251,198,5,202,208,246,206,10,14,209,4,208,62,136,208,249,237,80,244,206,9,16,170,206,19,38,170,237,38,
16,206,6,38,206,101,248,206,7,103,113,206,2,166,206,66,16,170,141,1,206,66,21,2,2,169,255,141,3,2,206,98,
165,85,208,53,173,0,10,180,193,46,173,3,10,201,255,208,39,173,1,18,201,170,208,32,173,2,26,201,0,208,25,173,
3,26,237,13,18,237,44,0,18,237,39,206,6,200,65,166,206,43,214,188,26,7,207,177,133,0,169,140,206,43,225,206,
28,48,237,48,90,237,48,137,237,48,206,2,184,32,237,176,169,0,133,48,188,4,8,100,33,180,129,162,48,142,7,32,
232,224,58,208,248,206,10,12,134,4,160,10,173,7,188,4,8,45,187,133,3,237,3,197,4,208,13,230,4,136,206,38,
13,251,206,2,178,237,234,65,206,8,62,53,208,248,237,35,232,206,12,74,70,180,130,206,2,65,219,133,3,162,54,134,
4,160,4,237,28,180,65,201,0,208,20,206,16,81,84,167,206,7,81,96,180,129,237,25,206,14,154,97,206,6,154,9,
206,6,154,251,206,18,154,157,206,8,65,129,206,8,154,57,208,248,174,188,6,9,99,138,180,129,188,7,9,112,237,220,
206,6,240,206,98,137,27,206,18,78,243,206,8,78,161,206,10,240,5,169,38,237,7,224,58,208,239,169,1,237,85,206,
9,26,206,10,76,59,206,18,76,71,168,206,2,76,48,237,106,193,206,49,138,237,204,206,10,62,91,206,18,62,141,237,
190,62,237,106,225,180,130,4,141,0,32,162,136,206,36,99,202,208,247,206,66,115,206,15,83,237,97,206,12,83,123,206,
18,83,232,206,3,83,36,237,106,37,237,106,99,237,190,115,237,62,237,71,206,3,67,188,3,10,162,232,224,17,206,6,
12,237,165,0,141,5,206,6,22,134,4,160,16,206,3,89,155,206,3,89,206,16,92,121,169,237,167,162,99,237,162,237,
124,206,7,31,19,237,159,169,112,133,0,169,148,133,1,32,23,174,237,37,206,7,137,5,180,129,162,51,206,3,117,67,
208,248,237,204,180,130,206,9,137,237,71,173,2,237,207,206,5,40,134,4,160,7,206,3,135,206,68,213,206,16,135,224,
206,2,135,6,32,206,7,95,2,206,40,145,176,208,248,237,148,180,132,40,206,2,220,2,180,130,1,141,0,206,5,7,
206,7,92,206,4,235,219,206,21,92,76,170,206,6,64,5,206,2,152,206,2,100,63,206,13,203,206,34,162,237,140,206,
35,112,206,8,175,206,71,234,21,206,36,20,117,206,39,20,230,48,76,179,170,206,11,20,127,206,12,20,206,219,72,169,
252,237,37,138,206,204,72,255,32,96,206,196,26,212,133,3,169,200,141,0,7,169,7,141,20,64,169,24,141,1,32,188,
3,34,8,16,251,142,5,32,180,66,6,180,66,188,6,34,89,10,48,81,144,248,169,80,206,6,39,206,20,27,35,144,
248,76,107,171,169,8,141,1,237,150,206,16,25,13,144,248,206,2,145,206,35,39,113,171,237,67,206,197,166,244,133,3,
162,0,206,3,124,206,3,122,206,6,42,168,41,32,208,69,152,16,245,169,80,141,4,7,141,8,7,141,12,7,141,16,
7,141,20,7,141,24,7,141,28,7,141,32,206,4,134,206,15,44,6,237,44,76,215,206,3,89,206,3,100,221,206,6,
100,206,130,87,20,206,2,100,142,3,32,142,4,32,232,208,250,134,4,237,3,173,4,206,37,197,232,206,38,197,12,172,
206,6,39,52,206,5,39,138,24,157,0,5,105,1,232,208,248,169,5,141,20,64,206,21,48,68,206,7,48,84,133,3,
169,36,141,3,32,162,0,206,15,50,237,144,206,16,52,128,237,116,206,57,197,251,133,0,169,139,206,44,197,206,34,99,
237,136,218,133,3,237,168,169,0,206,36,60,188,6,2,230,212,206,12,76,206,199,83,134,2,132,3,237,49,50,165,48,
201,10,48,15,169,48,237,66,230,50,56,233,10,201,10,16,247,24,105,48,133,51,169,50,133,0,169,0,133,1,76,6,
188,13,15,25,76,34,173,206,9,9,206,3,73,180,162,240,250,96,206,132,126,206,66,253,162,0,160,16,141,206,130,161,
250,136,206,131,164,3,32,168,141,4,32,136,208,250,96,162,8,142,3,32,157,0,7,237,7,232,208,247,96,10,10,105,
206,7,45,160,0,162,4,177,0,237,47,200,208,248,230,1,202,208,243,96,169,138,206,68,229,206,2,124,141,206,8,3,
147,206,8,3,163,206,8,3,179,206,8,3,195,206,8,3,211,206,8,3,227,206,8,3,240,206,8,3,253,206,8,3,
13,237,3,149,237,131,206,35,68,206,227,85,188,4,15,163,96,165,206,130,42,165,3,206,3,158,177,0,240,14,201,10,
240,11,206,3,162,242,230,1,208,238,96,24,165,3,105,32,144,2,230,2,41,224,166,2,142,6,32,133,237,98,76,46,
174,170,169,134,133,36,169,174,133,37,224,0,240,16,165,36,24,105,32,133,36,165,37,105,0,133,37,202,208,240,162,63,
237,34,162,0,180,129,160,0,162,32,177,36,141,7,32,153,0,6,200,202,208,244,96,13,39,55,2,13,23,39,18,13,
7,23,34,13,6,39,56,13,10,26,42,45,5,38,55,13,0,0,0,180,99,6,16,30,13,7,0,46,13,8,45,29,
206,19,24,22,38,3,13,6,22,4,13,7,6,5,206,19,24,32,50,48,13,40,42,55,13,22,40,39,206,19,24,40,
56,6,13,23,40,48,13,23,39,22,206,19,24,60,32,48,13,59,60,60,13,43,59,44,206,19,24,33,49,44,13,17,
33,28,13,1,17,12,206,11,24,44,60,48,237,220,16,30,13,45,0,47,13,11,206,21,184,19,35,22,13,3,19,39,
13,1,3,56,206,6,24,13,206,10,24,206,2,144,7,23,40,13,12,27,41,206,19,24,45,16,32,13,180,10,6,22,
54,13,10,42,58,13,0,206,5,16,2,39,32,13,8,39,55,13,17,33,49,13,7,22,40,13,28,60,237,8,0,16,
13,3,19,180,97,6,22,13,6,26,56,13,1,0,48,13,1,17,33,13,33,49,48,13,7,23,39,13,22,38,55,13,
18,60,48,206,3,104,16,16,16,13,22,40,57,13,45,16,48,13,29,1,17,13,29,40,23,237,188,25,48,48,206,5,
104,38,237,172,8,24,40,13,9,25,41,206,11,132,180,1,141,0,1,152,72,173,0,1,160,255,56,200,233,10,176,251,
105,10,237,74,10,180,1,13,0,1,237,3,104,168,237,21,96,206,196,36,206,100,72,142,237,37,32,174,0,1,189,0,
6,170,189,202,176,141,7,237,69,157,0,6,238,0,1,136,208,231,198,27,206,70,162,169,136,5,88,133,88,141,0,32,
96,45,29,1,2,5,6,29,6,9,29,9,12,29,13,13,13,0,188,3,39,79,6,7,8,9,10,11,12,46,14,14,
61,188,5,35,24,188,4,35,14,30,30,188,3,34,254,188,5,35,12,44,16,46,46,8,72,138,72,152,72,169,1,133,
82,165,83,73,1,133,83,162,1,142,22,64,202,180,97,134,16,134,17,134,18,134,19,134,20,134,21,160,5,188,4,3,
98,160,7,173,22,64,145,4,106,181,16,42,149,16,136,16,242,165,4,105,8,133,4,232,232,224,6,208,228,165,27,240,
16,165,81,208,10,32,140,176,169,4,133,81,76,103,177,198,81,165,89,201,1,208,25,165,80,240,2,198,80,165,90,240,
4,169,0,133,90,206,6,187,76,192,177,201,2,208,37,237,11,206,226,129,180,65,230,1,165,1,237,10,16,237,10,1,
230,0,165,0,201,64,208,237,105,0,237,33,169,64,169,137,141,0,32,133,88,206,7,248,206,194,9,104,168,104,170,104,
40,64,120,72,8,104,133,7,104,64,188,13,33,170,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,27,76,240,163,206,30,67,180,31,
180,29,180,3,76,232,206,31,248,180,30,180,29,206,36,244,255,136,68,187,206,30,72,180,31,180,29,0,0,170,85,34,
51,206,30,68,180,31,180,29,10,177,16,128,204,177,206,14,14,255,180,5,206,22,16,180,14,237,213,180,33,206,5,1,
10,180,1,11,251,0,255,7,180,3,255,0,247,251,247,47,223,255,1,255,14,6,14,222,254,254,254,0,208,224,210,225,
180,97,246,255,255,253,254,180,97,0,245,250,181,120,245,250,180,0,208,0,0,64,128,180,97,0,175,95,173,30,175,95,
45,11,0,0,2,1,180,97,0,11,7,75,135,180,97,111,255,255,191,127,180,97,0,0,7,31,63,114,64,144,2,180,
226,125,127,239,253,0,192,240,248,28,68,14,62,0,192,176,248,252,188,0,242,192,128,236,254,126,124,57,28,7,127,19,
1,1,3,6,3,0,30,138,20,0,80,0,112,192,224,116,234,252,172,248,128,206,60,16,180,31,180,30,180,29,180,4,
8,0,8,8,180,162,180,193,180,129,0,0,36,180,33,180,3,36,180,228,36,0,126,36,126,237,76,36,180,225,180,193,
8,0,40,28,10,237,104,30,180,225,60,237,90,100,8,16,0,70,0,0,98,180,225,38,0,0,48,0,72,48,74,0,
58,0,0,72,180,225,68,0,0,4,0,188,5,116,168,237,30,180,2,237,8,16,16,180,161,237,8,16,16,237,63,32,
206,3,113,32,0,0,16,180,225,237,27,8,0,28,62,28,180,161,0,42,180,225,42,237,177,62,206,3,145,8,180,225,
237,129,206,9,69,237,200,206,70,180,206,73,188,24,180,201,4,237,37,64,0,0,2,180,225,32,0,0,60,0,78,78,
78,180,161,180,194,237,1,0,12,0,60,28,28,0,28,0,0,28,180,225,180,193,237,24,12,24,0,126,237,88,12,24,
54,237,72,14,28,14,237,168,180,225,237,232,92,92,237,232,92,92,237,31,126,0,124,14,237,152,64,180,225,237,24,60,
237,1,206,4,88,180,225,237,8,126,0,14,12,24,206,2,129,78,180,225,180,193,60,0,78,60,237,216,180,225,237,168,
78,62,237,184,78,180,225,237,8,206,6,205,180,227,237,131,180,130,206,36,18,180,66,14,0,48,96,48,180,161,0,24,
180,225,206,3,216,126,180,33,180,232,112,0,12,6,12,180,161,0,24,180,225,206,3,104,2,12,16,206,34,124,66,180,
226,0,0,28,0,74,86,76,0,30,0,0,34,180,225,32,237,31,0,114,98,98,0,98,237,33,180,225,237,57,124,0,
98,124,102,180,161,0,102,180,225,237,79,0,96,96,96,180,161,0,102,180,225,102,237,88,50,50,50,237,88,180,193,237,
1,0,126,0,96,124,96,180,161,0,98,180,225,237,40,237,8,120,96,0,96,237,72,120,237,49,237,120,110,98,237,248,
110,98,237,24,98,0,98,126,206,3,104,98,180,225,206,3,88,24,24,24,237,88,180,193,237,1,0,30,0,12,12,12,
0,56,0,180,194,12,108,237,104,104,120,108,237,104,100,180,225,102,206,2,216,206,2,136,126,0,180,194,206,2,104,98,
0,126,106,206,3,72,118,180,225,237,136,122,110,102,237,72,114,180,225,206,3,88,98,237,15,60,237,17,180,2,206,3,
216,98,124,206,3,152,180,225,206,3,152,98,98,106,206,66,168,237,8,106,100,237,152,124,206,3,104,237,23,206,2,104,
60,0,96,60,6,206,4,184,60,6,237,8,126,206,3,168,24,206,7,168,98,206,13,88,237,8,52,52,237,88,98,180,
225,237,216,106,126,0,34,237,72,106,126,118,237,72,52,24,44,206,99,40,180,225,180,194,0,98,60,206,3,72,98,180,
225,180,193,126,0,4,24,48,206,35,72,180,225,206,3,184,32,32,32,180,161,180,194,237,1,237,2,153,161,161,0,66,
60,0,66,180,225,153,237,72,4,4,4,237,88,180,193,237,1,0,8,206,2,100,180,2,20,180,228,188,12,76,21,126,
206,98,114,180,4,206,162,103,180,4,4,60,206,2,248,0,60,4,60,68,237,168,98,66,0,92,237,1,92,98,66,98,
237,152,66,64,206,2,88,0,60,66,64,66,237,47,0,0,70,66,237,104,2,58,70,66,70,237,216,126,206,5,24,126,
237,53,12,0,0,124,206,67,104,18,16,124,16,206,100,158,70,70,0,2,237,25,58,70,70,237,47,206,4,88,66,206,
4,88,180,193,206,131,114,206,98,72,0,24,206,131,122,4,180,65,4,0,68,206,34,249,206,3,200,237,40,72,80,0,
206,2,145,68,72,80,104,206,99,203,237,232,237,38,206,133,8,73,73,0,73,180,193,118,73,237,1,180,2,206,4,88,
0,206,4,88,180,1,180,193,206,4,152,206,5,8,98,98,0,64,64,237,88,98,92,206,7,152,2,206,6,152,237,88,
64,206,35,46,92,98,237,94,180,1,64,60,206,66,232,0,62,64,60,237,30,16,180,65,16,206,2,222,206,2,215,18,
206,6,88,237,113,66,66,206,38,8,66,206,131,113,237,8,206,164,59,73,73,0,54,180,193,65,206,6,152,36,24,206,
3,152,66,36,24,237,216,237,47,206,34,24,237,55,206,4,120,4,206,131,120,0,126,4,24,32,206,98,232,0,32,16,
180,162,16,16,32,206,34,72,206,4,235,206,133,20,180,97,112,237,40,8,180,162,8,8,4,206,34,8,48,237,152,180,
1,73,6,206,6,2,51,188,3,0,235,255,180,226,255,0,7,39,46,102,112,112,243,99,72,200,192,128,128,128,0,0,
254,253,241,239,219,184,176,10,255,254,254,240,224,192,198,132,127,191,191,207,55,107,97,194,255,127,127,63,79,135,143,13,
206,226,236,254,245,203,51,180,226,255,254,244,192,255,252,243,174,16,242,38,130,255,255,252,240,224,0,0,24,127,159,199,
56,59,120,48,10,255,127,63,71,64,0,6,4,237,95,63,95,97,195,237,168,191,159,12,155,68,185,19,32,96,99,195,
255,187,2,0,64,134,140,12,255,207,195,191,185,185,237,40,255,255,195,195,193,135,237,104,102,241,63,211,99,255,255,247,
102,96,160,206,167,217,180,23,206,14,184,75,6,22,16,48,114,38,130,4,48,96,96,64,0,0,24,5,5,73,59,206,
2,136,2,50,50,64,206,2,136,136,154,206,4,120,48,33,206,4,120,0,0,131,70,60,242,33,103,255,255,124,185,195,
1,30,24,255,253,243,230,220,178,161,0,254,254,252,249,227,193,222,255,127,191,63,47,7,15,125,71,255,127,127,223,255,
243,3,128,206,3,239,246,225,188,4,1,8,253,222,180,97,242,161,5,15,124,71,255,254,252,240,248,240,0,128,255,63,
199,225,64,129,199,126,127,223,31,14,63,126,56,237,160,191,223,1,231,180,226,127,63,127,24,187,18,1,16,92,166,64,
74,223,100,252,239,3,0,184,16,255,207,199,195,139,155,249,142,255,255,251,191,245,229,2,1,255,255,247,124,122,51,174,
125,180,225,100,97,164,80,188,27,0,169,180,2,25,37,131,6,28,242,33,0,0,24,124,249,227,1,30,127,12,135,34,
33,206,2,136,240,120,28,192,206,2,136,192,63,198,206,3,136,63,128,0,206,3,136,232,192,0,163,136,194,1,231,7,
31,63,28,0,60,126,24,4,34,128,209,171,119,30,76,251,221,127,46,20,8,206,34,248,242,234,192,146,129,52,206,2,
200,224,204,158,139,127,191,191,79,247,235,249,153,255,127,63,63,15,23,3,206,3,200,254,244,202,76,180,226,255,255,245,
131,255,253,242,170,0,146,1,237,168,160,12,237,40,159,167,120,242,232,237,104,31,7,12,20,188,4,2,48,63,159,193,
100,237,167,127,63,27,223,206,2,104,114,26,76,187,206,2,104,12,4,0,255,207,211,187,161,147,237,56,255,207,195,131,
141,158,139,206,34,240,240,171,237,56,180,225,108,52,206,27,243,180,3,68,206,2,72,112,26,76,8,28,127,46,20,15,
5,3,24,235,86,58,32,146,1,52,7,206,130,209,12,158,139,34,128,178,121,206,2,136,129,206,226,0,20,0,0,139,
110,85,19,137,133,194,100,4,1,34,96,112,120,60,26,64,192,225,112,20,24,147,195,62,60,28,12,206,66,102,255,255,
240,241,252,242,193,147,254,252,252,236,192,128,128,237,8,255,63,63,215,147,227,206,2,247,7,35,97,28,206,3,248,254,
247,206,67,200,254,244,192,237,24,248,252,186,49,9,156,255,252,240,160,4,14,54,2,127,63,103,243,252,240,65,3,127,
223,159,12,206,2,152,237,96,127,223,151,225,180,226,63,63,237,56,6,99,243,253,240,65,19,155,217,156,237,216,239,227,
243,255,241,193,3,255,223,223,143,129,129,237,104,247,102,115,241,144,224,180,225,103,96,32,96,206,162,1,180,27,66,206,
3,184,19,3,48,56,206,4,184,212,104,48,140,26,49,9,156,40,16,0,0,206,2,136,1,5,96,240,206,2,136,0,
216,206,4,104,143,198,193,2,51,209,144,224,237,3,1,0,32,96,28,228,172,242,173,194,97,148,130,0,83,13,82,53,
158,106,53,254,252,240,225,202,129,213,242,206,99,223,254,170,5,127,63,127,95,191,111,147,101,255,255,191,175,71,131,69,
16,206,4,240,205,125,206,36,248,242,128,255,252,240,161,2,45,85,138,237,79,253,210,170,84,127,63,95,108,191,111,189,
250,255,223,167,147,64,144,64,206,69,248,165,82,206,37,247,5,155,54,29,6,142,91,205,166,255,201,226,249,113,164,18,
206,66,248,139,191,175,253,90,255,255,251,247,193,209,0,128,255,255,247,238,244,108,176,193,180,225,102,97,33,3,14,206,
27,245,180,1,228,208,160,1,130,1,5,2,0,3,15,30,61,62,122,125,11,55,95,127,190,126,253,252,116,200,160,128,
64,128,0,0,5,11,5,11,63,47,253,122,122,244,250,244,192,208,0,128,189,122,244,232,144,64,32,129,237,84,1,1,
3,14,227,57,86,170,85,234,118,220,28,198,129,206,34,11,35,254,253,250,242,245,238,213,43,255,254,253,252,248,240,224,
192,127,159,15,231,127,179,113,242,255,127,255,31,7,15,15,206,132,248,248,133,43,206,132,248,248,128,255,250,229,143,124,
177,115,243,255,253,248,240,131,14,12,12,255,175,115,0,30,107,213,170,255,95,143,255,225,128,206,69,248,207,241,220,237,
168,63,15,35,240,1,85,254,215,109,85,170,255,254,170,0,32,18,206,66,88,211,237,0,253,49,237,56,231,239,147,131,
206,0,140,12,237,30,102,126,237,120,255,247,255,225,160,206,27,243,180,3,85,171,126,2,117,254,213,171,0,0,129,252,
136,237,8,182,186,21,239,206,2,136,65,64,224,16,3,14,12,12,87,171,126,206,3,136,237,24,206,3,136,227,57,86,
43,85,235,246,206,2,232,128,128,0,1,35,210,129,1,153,25,1,129,1,255,254,254,246,230,254,254,254,0,254,254,186,
152,212,234,230,255,255,255,187,187,215,239,239,0,255,255,193,221,221,190,221,237,8,255,227,227,193,227,0,255,192,160,180,
2,237,7,192,180,2,188,7,5,242,188,6,6,43,255,7,11,11,11,10,11,237,8,188,3,5,250,1,255,255,223,175,
119,251,119,254,180,1,222,142,6,142,237,33,163,209,224,204,200,237,24,131,161,153,153,129,237,8,239,199,231,231,206,162,
24,143,175,207,207,207,237,8,227,209,160,158,193,237,8,195,161,157,131,193,206,35,57,207,167,71,180,194,255,143,79,63,
0,255,128,206,13,120,1,5,180,2,237,8,3,180,2,237,40,211,169,160,200,248,237,120,145,153,249,243,1,180,5,206,
2,120,180,2,230,230,246,180,161,186,152,239,239,237,26,255,187,187,235,247,255,255,0,255,247,232,180,195,255,255,247,160,
160,160,192,32,180,130,192,192,0,180,97,192,11,11,11,7,8,11,11,10,7,7,7,0,180,97,7,119,7,255,255,1,
255,223,47,142,206,35,35,254,222,192,129,143,207,237,48,194,131,159,159,206,195,10,231,199,199,206,2,196,90,207,207,237,
79,255,165,228,138,196,206,99,244,185,133,206,131,43,0,31,59,132,196,237,65,63,13,137,237,136,206,3,197,128,206,5,
197,237,8,206,3,197,1,206,5,197,237,8,1,1,1,25,25,1,1,91,254,206,36,152,164,206,5,104,90,206,5,104,
165,241,225,237,111,255,79,231,193,129,237,72,191,212,234,214,170,152,220,254,255,215,239,215,187,187,237,56,222,190,222,232,
247,255,0,255,225,193,225,247,206,7,104,191,0,206,4,104,192,188,15,7,223,0,254,254,206,13,9,188,5,2,41,64,
224,206,5,1,0,60,60,188,3,5,223,0,188,5,4,95,180,31,180,29,180,13,56,0,198,198,198,180,161,0,76,180,
225,100,0,0,24,188,3,3,200,126,237,17,188,4,3,200,124,0,14,60,120,0,254,0,0,198,180,225,224,206,2,237,
24,60,6,237,14,0,12,180,225,198,0,0,28,0,108,204,254,0,12,0,0,60,180,225,180,193,252,0,252,6,237,152,
192,180,225,237,24,60,237,1,198,237,72,96,180,225,237,8,237,36,24,48,0,48,0,0,198,180,225,180,193,120,0,228,
120,134,237,88,196,180,225,134,206,2,104,198,126,6,237,14,0,198,180,225,12,206,4,152,254,0,237,49,108,180,225,180,
193,252,0,198,252,198,180,161,237,15,206,3,72,60,206,66,158,180,161,0,102,180,225,102,0,0,248,206,3,200,248,0,
0,204,180,225,204,206,2,104,192,252,192,180,161,237,31,252,237,33,206,5,8,237,1,206,5,8,0,4,10,7,48,117,
21,0,0,3,7,127,127,31,10,0,0,16,128,224,0,84,88,0,0,240,0,248,252,248,160,0,16,32,12,91,123,47,
144,29,180,225,95,119,55,62,124,20,231,25,125,213,18,98,96,20,255,255,11,171,109,254,254,28,105,42,16,222,12,42,
4,43,55,52,63,122,58,30,10,64,2,8,4,32,0,4,0,64,0,8,4,0,32,188,3,7,210,21,71,10,158,3,
180,225,53,77,180,225,16,0,0,34,160,208,24,64,16,16,180,225,240,156,64,74,0,136,25,12,4,13,7,74,5,172,
25,15,19,10,5,4,114,0,52,0,224,96,176,20,118,168,228,100,232,240,240,0,1,0,8,16,132,0,0,0,1,66,
40,180,225,1,0,2,33,237,5,32,0,0,26,36,64,180,227,180,29,180,14,52,90,126,62,90,52,0,0,8,60,60,
124,60,8,0,52,94,189,127,254,189,90,60,8,60,126,254,127,126,60,0,40,180,226,254,62,16,20,126,255,127,254,127,
124,44,8,60,110,194,71,230,60,32,52,126,247,103,226,127,126,28,52,82,165,65,128,165,66,44,0,44,66,2,66,66,
60,0,52,66,129,129,128,129,237,1,180,5,36,2,128,1,128,1,66,40,206,29,143,180,31,180,31,180,31,180,31,180,
31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,
31,180,31,180,31,180,31,180,30,180,27,180,1
]
var NES_DEFAULT_ROM = new lzgmini().decode(NES_DEFAULT_ROM_LZG).slice(0, 0xa000);

View File

@ -286,6 +286,7 @@ var VCSMAMEPlatform = function(mainElement) {
} }
this.loadROM = function(title, data) { this.loadROM = function(title, data) {
this.loadROMFile(data);
this.loadRegion(":cartslot:cart:rom", data); this.loadRegion(":cartslot:cart:rom", data);
} }

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,7 @@ Module.expectedDataFileDownloads++;
} else { } else {
throw 'using preloaded data can only be done on a web page or in a web worker'; throw 'using preloaded data can only be done on a web page or in a web worker';
} }
var PACKAGE_NAME = 'js/fs65.data'; var PACKAGE_NAME = 'fs65.data';
var REMOTE_PACKAGE_BASE = 'fs65.data'; var REMOTE_PACKAGE_BASE = 'fs65.data';
if (typeof Module['locateFilePackage'] === 'function' && !Module['locateFile']) { if (typeof Module['locateFilePackage'] === 'function' && !Module['locateFile']) {
Module['locateFile'] = Module['locateFilePackage']; Module['locateFile'] = Module['locateFilePackage'];
@ -85,8 +85,10 @@ Module.expectedDataFileDownloads++;
console.error('package error:', error); console.error('package error:', error);
}; };
var fetched = null, fetchedCallback = null; var fetchedCallback = null;
fetchRemotePackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE, function(data) { var fetched = Module['getPreloadedPackage'] ? Module['getPreloadedPackage'](REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE) : null;
if (!fetched) fetchRemotePackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE, function(data) {
if (fetchedCallback) { if (fetchedCallback) {
fetchedCallback(data); fetchedCallback(data);
fetchedCallback = null; fetchedCallback = null;
@ -119,6 +121,11 @@ Module['FS_createPath']('/target/apple2/drv', 'emd', true, true);
Module['FS_createPath']('/target/apple2/drv', 'mou', true, true); Module['FS_createPath']('/target/apple2/drv', 'mou', true, true);
Module['FS_createPath']('/target/apple2/drv', 'ser', true, true); Module['FS_createPath']('/target/apple2/drv', 'ser', true, true);
Module['FS_createPath']('/target/apple2', 'util', true, true); Module['FS_createPath']('/target/apple2', 'util', true, true);
Module['FS_createPath']('/target', 'nes', true, true);
Module['FS_createPath']('/target/nes', 'drv', true, true);
Module['FS_createPath']('/target/nes/drv', 'tgi', true, true);
Module['FS_createPath']('/target/nes/drv', 'joy', true, true);
Module['FS_createPath']('/', 'neslib', true, true);
function DataRequest(start, end, crunched, audio) { function DataRequest(start, end, crunched, audio) {
this.start = start; this.start = start;
@ -174,10 +181,10 @@ Module['FS_createPath']('/target/apple2', 'util', true, true);
for (i = 0; i < files.length; ++i) { for (i = 0; i < files.length; ++i) {
DataRequest.prototype.requests[files[i].filename].onload(); DataRequest.prototype.requests[files[i].filename].onload();
} }
Module['removeRunDependency']('datafile_js/fs65.data'); Module['removeRunDependency']('datafile_fs65.data');
}; };
Module['addRunDependency']('datafile_js/fs65.data'); Module['addRunDependency']('datafile_fs65.data');
if (!Module.preloadResults) Module.preloadResults = {}; if (!Module.preloadResults) Module.preloadResults = {};

File diff suppressed because one or more lines are too long

View File

@ -483,6 +483,10 @@ function parseCA65Listing(code, mapfile) {
} }
function assemblelinkCA65(code, platform, warnings) { function assemblelinkCA65(code, platform, warnings) {
var errors = "";
function error_fn(s) {
errors += s + "\n";
}
load("ca65"); load("ca65");
load("ld65"); load("ld65");
var objout, lstout; var objout, lstout;
@ -504,25 +508,30 @@ function assemblelinkCA65(code, platform, warnings) {
noInitialRun:true, noInitialRun:true,
//logReadFiles:true, //logReadFiles:true,
print:print_fn, print:print_fn,
printErr:print_fn, printErr:error_fn,
}); });
var FS = LD65['FS']; var FS = LD65['FS'];
var cfgfile = '/' + platform + '.cfg'; var cfgfile = '/' + platform + '.cfg';
setupFS(FS, '65'); setupFS(FS, '65');
FS.writeFile("main.o", objout, {encoding:'binary'}); FS.writeFile("main.o", objout, {encoding:'binary'});
LD65.callMain(['--cfg-path', '/share/cfg', '--lib-path', '/share/lib', LD65.callMain(['--cfg-path', '/share/cfg', '--lib-path', '/share/lib',
//'--start-addr', '0x6000', // TODO
'-C', cfgfile, '-C', cfgfile,
//'--dbgfile', 'main.dbg',
'-o', 'main', '-m', 'main.map', 'main.o', '-o', 'main', '-m', 'main.map', 'main.o',
'apple2.lib']); platform+'.lib']);
if (errors.length) {
return {errors:[{line:1,msg:errors}]};
}
var aout = FS.readFile("main", {encoding:'binary'}); var aout = FS.readFile("main", {encoding:'binary'});
var mapout = FS.readFile("main.map", {encoding:'utf8'}); var mapout = FS.readFile("main.map", {encoding:'utf8'});
var listing = parseCA65Listing(lstout, mapout); var listing = parseCA65Listing(lstout, mapout);
//console.log(lstout); //console.log(lstout);
//console.log(mapout); //console.log(mapout);
var srclines = parseSourceLines(lstout, /[.]dbg\s+line, "main[.]c", (\d+)/i, /^\s*([0-9A-F]+)r/i);
return { return {
output:aout.slice(4), output:aout.slice(0),
lines:listing.lines, lines:listing.lines,
srclines:srclines,
errors:listing.errors, errors:listing.errors,
intermediate:{listing:lstout, map:mapout}, intermediate:{listing:lstout, map:mapout},
}; };
@ -555,17 +564,18 @@ function compileCC65(code, platform) {
var FS = CC65['FS']; var FS = CC65['FS'];
setupFS(FS, '65'); setupFS(FS, '65');
FS.writeFile("main.c", code, {encoding:'utf8'}); FS.writeFile("main.c", code, {encoding:'utf8'});
CC65.callMain(['-v', '-T', '-g', /*'-Cl',*/ '-Oirs', '-I', '/share/include', "main.c"]); CC65.callMain(['-v', '-T', '-g', /*'-Cl',*/
'-Oirs',
'-I', '/share/include',
'-D__' + platform.toUpperCase() + '__',
"main.c"]);
try { try {
var asmout = FS.readFile("main.s", {encoding:'utf8'}); var asmout = FS.readFile("main.s", {encoding:'utf8'});
//console.log(asmout); //console.log(asmout);
var result = assemblelinkCA65(asmout, platform, errors); var result = assemblelinkCA65(asmout, platform, errors);
/*
result.asmlines = result.lines; result.asmlines = result.lines;
result.lines = result.srclines; result.lines = result.srclines;
result.srclines = null; result.srclines = null;
*/
//console.log(result.intermediate.listing);
return result; return result;
} catch(e) { } catch(e) {
return {errors:errors}; return {errors:errors};

View File

@ -10,10 +10,11 @@ parser.add_argument('-s', '--start', type=int, default=0, help="index of first c
parser.add_argument('-e', '--end', type=int, default=255, help="index of last character") parser.add_argument('-e', '--end', type=int, default=255, help="index of last character")
parser.add_argument('-H', '--height', type=int, default=8, help="character height") parser.add_argument('-H', '--height', type=int, default=8, help="character height")
parser.add_argument('-i', '--invert', action="store_true", help="invert bits") parser.add_argument('-i', '--invert', action="store_true", help="invert bits")
parser.add_argument('-r', '--rotate', action="store_true", help="rotate bits (vertical)") parser.add_argument('-r', '--rotate', action="store_true", help="rotate bits")
parser.add_argument('-f', '--flip', action="store_true", help="flip bits (horizontal)") parser.add_argument('-f', '--flip', action="store_true", help="flip bits (vertically")
outfmtgroup = parser.add_mutually_exclusive_group() outfmtgroup = parser.add_mutually_exclusive_group()
outfmtgroup.add_argument("-A", "--asmhex", action="store_true", help="DASM-compatible hex") outfmtgroup.add_argument("-A", "--asmhex", action="store_true", help="DASM-compatible hex")
outfmtgroup.add_argument("-B", "--asmdb", action="store_true", help="Z80ASM-compatible hex")
outfmtgroup.add_argument("-C", "--carray", action="store_true", help="Nested C array") outfmtgroup.add_argument("-C", "--carray", action="store_true", help="Nested C array")
outfmtgroup.add_argument("-F", "--flatcarray", action="store_true", help="Flat C array") outfmtgroup.add_argument("-F", "--flatcarray", action="store_true", help="Flat C array")
parser.add_argument('bdffile', help="BDF bitmap file") parser.add_argument('bdffile', help="BDF bitmap file")
@ -84,6 +85,9 @@ def tohex2(v):
for arr in [output]: for arr in [output]:
if args.asmhex: if args.asmhex:
print '\thex ' + string.join(map(tohex,arr),'') print '\thex ' + string.join(map(tohex,arr),'')
if args.asmdb:
for i in range(0,len(output),height):
print '.DB', string.join(map(tohex2,arr[i:i+height]),','), ';%d'%(i/height+lochar)
if args.carray: if args.carray:
print "static char FONT[%d][%d] = {" % (hichar-lochar+1, height) print "static char FONT[%d][%d] = {" % (hichar-lochar+1, height)
for i in range(0,len(output),height): for i in range(0,len(output),height):