Compare commits

...

393 Commits

Author SHA1 Message Date
Steven Hugg d733a2cd27 arm32: fixed VCVT, VLDR/VSTR 2024-01-09 15:56:10 -05:00
Steven Hugg 098dcda93a arm32: parse dwarf info tree, convert to number 2024-01-06 11:55:59 -05:00
Steven Hugg 886e19611e arm32: crt0 update for malloc 2024-01-05 12:23:54 -05:00
Steven Hugg 02986aed38 arm32: parse dwarf 2024-01-04 22:30:53 -05:00
Steven Hugg d5b5734ef9 arm: fixed fpu, raster frame sync 2024-01-02 13:49:55 -05:00
Steven Hugg 579e58e966 close button for debug info 2024-01-01 15:27:42 -05:00
Steven Hugg 47a7aa5a83 arm: started on fpu insns 2024-01-01 15:21:52 -05:00
Steven Hugg 9142328468 arm: merged libc and libtcc1 2023-12-31 14:45:51 -05:00
Steven Hugg 70eee2bdae arm: fixing libc 2023-12-30 16:08:16 -05:00
Steven Hugg 949e216c69 make sure display + serial is updated if advanceFrame() throws 2023-12-30 15:24:57 -05:00
Steven Hugg b160fb2ef2 license: clarified multi-license 2023-12-30 15:07:29 -05:00
Steven Hugg 63ee25741b arm: libc 2023-12-30 11:53:56 -05:00
Steven Hugg 8bdbae36e3 arm: parse ELF 2023-12-29 20:41:40 -05:00
Steven Hugg c0909bef1b arm: arm-tcc 2023-12-28 17:26:44 -05:00
Steven Hugg 8023d56b88 c64: presets 2023-12-25 10:24:31 -05:00
Steven Hugg 45bc17d7ee exidy: started platform, c example 2023-12-15 19:46:06 -05:00
Steven Hugg 8452fe73a1 galaxian: update skeleton 2023-12-15 10:18:04 -05:00
Steven Hugg dff5c73d6a directive #embed for sdcc and cmoc 2023-12-13 23:38:38 -05:00
Steven Hugg f8462de014 williams: updated presets 2023-12-13 21:27:54 -05:00
Steven Hugg d08d73f422 astrocade: worked on arcade emulation 2023-12-13 20:54:42 -05:00
Steven Hugg 0ede0e514b sdcc: link errors no longer vanish if compile errors occur 2023-12-13 13:35:01 -05:00
Steven Hugg dbe73c4fb2 verilog: added example categories 2023-12-04 13:20:35 -06:00
Steven Hugg 9ecfb3cfa8 ide: refactored ui.ts a bit 2023-12-04 11:59:51 -06:00
Steven Hugg 312cb3d025 c64: removed wait_vblank macro 2023-12-01 11:14:18 -06:00
Steven Hugg bd63ef1268 dasm: started testing wasi
dasm:
2023-11-30 12:04:05 -06:00
Steven Hugg 2e0382b0a6 worker: refactor 2023-11-29 15:04:05 -06:00
Steven Hugg 611c174aed c64: set_raster_irq(), wait_vblank() 2023-11-29 12:51:42 -06:00
Steven Hugg d9001df5d4 cc7800 2023-11-28 18:08:02 -06:00
Steven Hugg e6c3dc98e1 fixed tests 2023-11-25 13:18:41 -06:00
Steven Hugg 43d844fa79 cleaned up Memory Map view
apple2: no logIOWrite for reads
2023-11-25 12:33:08 -06:00
Steven Hugg c5bcd8ad9b npm audit fix 2023-11-23 14:12:30 -06:00
Steven Hugg c189875be3 apple2: AppleSingle header for CC65 by default, try to parse 4-byte DOS headers 2023-11-22 21:43:30 -06:00
Steven Hugg 16fcf33881 c64: presets 2023-11-20 18:44:26 -06:00
Steven Hugg 8091985fde wasi: working on shim 2023-11-20 13:45:22 -06:00
Steven Hugg c9354a83ea changed #incbin to #embed (loosely based on C23 standard) 2023-11-17 10:29:35 -06:00
Steven Hugg 73c7ac5941 added category field to presets 2023-11-16 13:40:23 -06:00
Steven Hugg 19e3bbbea3 c64: updated examples 2023-11-14 15:24:49 -06:00
Steven Hugg 12957d7740 changed file selector to <optgroup> 2023-11-14 10:57:37 -06:00
Steven Hugg a252ea65bd vic20: default tiny bios 2023-11-13 22:35:49 -06:00
Steven Hugg 1c0b3e2fdd vcs: fixed test with null Context2D 2023-11-13 16:10:07 -06:00
Steven Hugg 44271fe9b8 added acme assembler
vcslib: increased # of lines in kernel
2023-11-13 12:37:38 -06:00
Steven Hugg f6452a719f c64: update presets, refactor analysis 2023-11-11 22:01:39 -06:00
Steven Hugg de6250b0cd show raster x/y crosshair when stopped (getRasterCanvasPosition) 2023-11-10 12:56:16 -06:00
Steven Hugg c6345ec728 server: updated parsing, flags 2023-11-09 10:10:45 -06:00
Steven Hugg d31a8c4efe tweaks to analysis, fixed verilog ball reset bug 2023-11-06 14:10:18 -06:00
Steven Hugg 3a08c24869 EmuHalt is squelched
nes: fixed loadState() npe
2023-11-05 21:27:27 -06:00
Steven Hugg 99370530f5 vcs: new skeleton for cc65 2023-11-05 20:07:33 -06:00
Steven Hugg fe6a8a6514 tool container setup 2023-11-05 14:43:54 -06:00
Steven Hugg a2d818c3e5 removed script platform 2023-11-05 12:16:39 -06:00
Steven Hugg fbd9089a8d updated nightwatch tests 2023-11-05 12:12:14 -06:00
Steven Hugg f18365cf9f remote: updates for multiple linked files, c64 samples 2023-11-05 06:21:31 -06:00
Steven Hugg 99f7ff41bb c64: updated music player, sid macros 2023-11-03 15:24:11 -05:00
Steven Hugg 2de919a225 hacked in "incbin" for C files, c64 lz4 example 2023-11-03 11:02:04 -05:00
Steven Hugg dd96813b76 pce: aspect ratio 2023-11-03 11:01:56 -05:00
Steven Hugg fc432a3bbf c64: .wiz 2023-11-02 12:39:11 -05:00
Steven Hugg 483675fded c64: .tap export 2023-11-01 16:48:19 -05:00
Steven Hugg 64ef7cc885 pce: hello.wiz 2023-10-31 23:09:58 -05:00
Steven Hugg 69600744df pce: optimizations, 32KB carts 2023-10-31 20:43:10 -05:00
Steven Hugg 5bc85161eb pce: pc engine started 2023-10-31 19:45:33 -05:00
Steven Hugg d11c1d1664 vcs: forgot vcslib.ca65 2023-10-31 11:35:23 -05:00
Steven Hugg 64f27879d7 multiple controllers no longer interfere 2023-10-31 11:25:45 -05:00
Steven Hugg 92fde04422 vcs: added vcslib demo 2023-10-30 23:16:36 -05:00
Steven Hugg d5460c991f ecs: C export if no system instances 2023-10-27 16:42:34 -05:00
Steven Hugg 73c74c519e vcs: changed .cfg file for TigerVision (3E) mapper
vcs: mappers 3E/3F don't correct bank offsets, so banks must not overlap
ca65: parse .proc symbols
2023-10-27 14:24:21 -05:00
Steven Hugg 2e2996bd73 ca65: fixed listing parsing 2023-10-15 10:28:48 -05:00
Steven Hugg 9e6fc9a0e3 vcs: added prelim cc65 support (using old compiler, new .lib/.h and custom .cfg) 2023-10-13 12:13:09 -05:00
Steven Hugg 0bf41a39c7 fixes for updated typescript 2023-09-12 21:57:08 -05:00
Steven Hugg ac9c14351f updated typescript 2023-08-31 14:27:57 -05:00
Steven Hugg f4d9124102 removed BaseWASIMachine, fixed wiz compile bug 2023-08-31 12:00:36 -05:00
Steven Hugg 70fdb68622 npm audit fix 2023-08-01 23:15:58 -05:00
Steven Hugg 3dba86c75d add d-pad switches to game controller
mapped some 2-button controllers to Z and X also
2023-08-01 13:53:26 -05:00
Steven Hugg cc385b7d98 atari7800: fixed write mode 2023-07-16 21:43:10 -05:00
Steven Hugg 3cea5a7d15 apple2: support shifted characters again 2023-07-13 14:26:38 -05:00
Steven Hugg b131d29663 7800: tweaks to debug info 2023-07-12 16:37:29 -05:00
Steven Hugg d4b8473b86 7800: implemented missing gfx modes, color kill, kangaroo mode 2023-07-12 16:21:39 -05:00
Steven Hugg 02834db8a1 atari7800: added 7800.h 2023-07-12 14:08:54 -05:00
Steven Hugg 37633d8875 atari8: fixed bug in debug tree 2023-07-09 23:35:02 -05:00
Steven Hugg 5a93bc8b75 a7800: pia timer, timing changes 2023-07-08 14:57:30 -05:00
Steven Hugg 47cabad5ec atari8: debug tree display list 2023-07-07 23:59:44 -05:00
Steven Hugg de12d20459 atari7800: debug tree for dlist, fixed dma hole bug 2023-07-06 21:18:00 -05:00
Steven Hugg c186d478fb removed ga 2023-07-02 10:11:04 -05:00
Steven Hugg 3bacf50409 forgot to upload tools/remote 2023-05-22 11:10:36 -05:00
Steven Hugg ac8f7c3f8b fixed audit msg by overriding node-fetch@2.6.7 2023-05-20 12:55:15 -05:00
Steven Hugg ee3ced574b more work on server, listings, platforms 2023-05-19 12:38:28 -05:00
Steven Hugg ba179160d6 started on server 2023-05-19 11:27:50 -05:00
Steven Hugg 5d11dd37df c64: decode SYS value for start addr, fix SYS xxxx kbd sticky issue 2023-05-19 11:27:50 -05:00
Steven Hugg 61443f586f modify link tags 2023-05-13 08:58:10 -05:00
Steven Hugg 0f011ee856 updated sentry.io 2023-05-11 11:28:42 -05:00
Steven Hugg 13656092c5 version bump 2023-04-25 12:44:49 -05:00
Steven Hugg f30850fdf1 atari-vector: fixed music.c
ui: fixed auto-play
2023-04-24 12:23:05 -05:00
Steven Hugg b707c5bf09 6502: fixed OPS_6502 stats as per https://github.com/TomHarte/ProcessorTests 2023-03-15 11:50:20 -05:00
Steven Hugg 232c027445 npm update 2023-02-15 17:24:09 -05:00
Steven Hugg 7bd5bffab5 fixed README for git url 2023-02-07 14:41:00 -05:00
Steven Hugg a3d7cc7dca c64: fixed presets 2023-02-07 14:26:35 -05:00
Steven Hugg 3972da4a13 c64: fixed presets 2023-02-07 14:24:42 -05:00
Steven Hugg a5a8b94991 c64: fixed presets 2023-02-07 14:16:38 -05:00
Steven Hugg 63d3b88a7a atari8: paddle inputs 2023-02-07 12:30:44 -05:00
Steven Hugg 9d39edf452 atari5200: added menu item, presets 2023-02-06 14:03:25 -05:00
Steven Hugg 2f8a5bee84 github: fixed delete repository 2023-02-06 13:50:31 -05:00
Steven Hugg e724ccb7d2 atari800: music preset; removed twitter link 2023-02-02 14:46:41 -05:00
Steven Hugg 3671054b16 vector-ataricolor: fixed examples for new cc65 2022-12-04 12:51:50 -06:00
Steven Hugg 4b88223d04 ui: hide download sym file if not available 2022-10-04 10:58:44 -05:00
Steven Hugg 03eb4f5e6f 7800: fixed vsync bug 2022-10-04 10:33:55 -05:00
Steven Hugg fc767a6e1f updated nightwatch 2022-10-04 10:01:40 -05:00
Steven Hugg 30e66fa26c sms: fixed npe 2022-10-04 09:51:12 -05:00
Steven Hugg ee91bd6da5 gamegear: fixed symlink so build doesnt fail 2022-10-03 15:00:34 -05:00
Steven Hugg d9dccb3df6 msx: msx.rom bios supported 2022-09-16 12:34:31 -07:00
Steven Hugg 868026c3f9 ui: moved help to main menu, changed showHelp() 2022-09-15 12:03:38 -07:00
Steven Hugg 4164ec1fcb ui: use DOMPurify to sanitize inputs to bootbox 2022-09-13 22:28:26 -05:00
Steven Hugg 7f998b7ed1 removed ecsroot 2022-09-11 23:34:39 -05:00
Steven Hugg 6e2b94fb68 vcs: remove ctrl-click break, use CRT view from now on 2022-09-11 19:09:21 -05:00
Steven Hugg 3018ddf27a verilog, apple2: don't use KeyPress event anymore, use KeyDown/KeyUp 2022-09-11 18:24:32 -05:00
Steven Hugg 20954fd5ce atari8: fixed help links 2022-09-07 20:38:45 -05:00
Steven Hugg 162113b915 reload debug break state before resuming, fixes frame de-sync problem 2022-09-07 12:23:53 -05:00
Steven Hugg 58e3f3f9fb atari8: fixed rom .extensions, removed wasm 2022-09-06 14:53:45 -05:00
Steven Hugg 3853f9a86a vic20: added cart support, fixed bugs 2022-09-06 14:43:39 -05:00
Steven Hugg 30342d2618 atari8: fixed VSCROL, pokey freq, performance 2022-09-04 18:28:49 -05:00
Steven Hugg 9f1c5377b3 atari8: fixes, xex load from cc65 2022-09-03 16:54:06 -05:00
Steven Hugg 5735135add atari8: wait/dma events, new kbd 2022-09-03 15:28:59 -05:00
Steven Hugg 56e8fca270 atari8: added VDELAY, fixed p-p collisions 2022-09-03 10:50:38 -05:00
Steven Hugg afe73e23e3 ui: moved Toolbar to ide/ 2022-09-03 10:24:33 -05:00
Steven Hugg 33b2e92396 atari8: fixes, faked .xex loading 2022-09-02 22:19:24 -05:00
Steven Hugg c572834c8c atari8: fixes, tests 2022-09-01 17:23:16 -05:00
Steven Hugg 363691b964 debug: click to breakpoint in probe views 2022-09-01 13:43:09 -05:00
Steven Hugg 664cecf4f7 stellerator: library update 2022-09-01 11:23:36 -05:00
Steven Hugg 02cb20ec87 moved ProbeRecorder to own module 2022-09-01 10:19:20 -05:00
Steven Hugg 8338c3a3d7 atari8: more fixes, POKEY timers, vscroll, irq flag in 6502 2022-09-01 00:01:35 -05:00
Steven Hugg 586a793df5 atari8: some fixes 2022-08-31 10:07:39 -05:00
Steven Hugg e2e47cd436 bump version, VRAM_READ shows as dark on crt scope 2022-08-30 19:55:04 -05:00
Steven Hugg a86e554336 Merge branch 2022-08-30 19:50:37 -05:00
Steven Hugg ed7758d7e0 atari8: started on js platform 2022-08-30 19:37:30 -05:00
Steven Hugg 8ff713a910 Merge branch 'master' into c64book 2022-08-28 23:11:17 -05:00
Steven Hugg e4af92927d sms: added game gear 2022-08-28 22:19:27 -05:00
Steven Hugg 51b6f0025c williams: started porting to Machine 2022-08-28 18:28:35 -05:00
Steven Hugg fe8f3de450 c64: presets 2022-08-26 09:56:44 -05:00
Steven Hugg 936608d6d5 c64: use light pen registers w/ screen pointer 2022-08-24 20:28:09 -05:00
Steven Hugg ba2644e7d0 debugviews: new CRT Probe 2022-08-24 14:28:00 -05:00
Steven Hugg f8985e3858 c64: debug info raster x/y 2022-08-23 17:57:27 -05:00
Steven Hugg fcad9abcd9 c64: presets 2022-08-21 23:39:12 -05:00
Steven Hugg 1f17baf88e debug views track stack pointer 2022-08-21 21:08:11 -05:00
Steven Hugg 2555798b11 c64/zx/cpc: .wasm uses clock ticks, not msec 2022-08-20 18:15:36 -05:00
Steven Hugg 472b9f952d c64: presets, new vsync 2022-08-20 18:03:54 -05:00
Steven Hugg 340ef9a4bc c64: fixed program start bug 2022-08-14 22:20:52 -05:00
Steven Hugg a3f2496785 pixeleditor: added wpimg, asset editor error msg 2022-08-11 15:22:48 -05:00
Steven Hugg 9c25eb1fe9 c64: fixed restart bug when kbd stuck 2022-08-11 13:22:56 -05:00
Steven Hugg 50cac5afd4 debugger: made debug views "sticky" but not listings or certain debug commands 2022-08-10 17:22:29 -05:00
Steven Hugg cc8ce51f05 c64: presets use common.h 2022-08-09 20:08:59 -05:00
Steven Hugg 66017f8316 c64: presets 2022-08-09 13:28:55 -05:00
Steven Hugg f33dc817f3 c64: new wasm, show badlines 2022-08-09 09:24:04 -05:00
Steven Hugg 9345fad794 c64: presets, reset keyboard 2022-08-08 20:51:00 -05:00
Steven Hugg 74a8795152 css: increased screen margin 2022-08-07 11:15:48 -05:00
Steven Hugg 59c3b756bd c64: more keys supported 2022-08-07 11:12:13 -05:00
Steven Hugg fa815fc9b7 Merge branch 'master' into c64book 2022-08-02 17:24:21 -05:00
Steven Hugg 62c7bd41b3 ld65: better listing parser, can't rely on segment start, use symbols instead 2022-08-02 17:22:50 -05:00
Steven Hugg a173597bda nes: download Mesen symbol file (contrib from NotExactlySiev) 2022-07-29 18:24:30 -05:00
NotExactlySiev d511034428 Update index.html 2022-07-29 18:24:23 -05:00
NotExactlySiev bf97dc18c4 Update ui.ts 2022-07-29 18:24:23 -05:00
Steven Hugg 42b2ded666 c64: update wasm, debugging 2022-07-29 11:33:54 -05:00
Steven Hugg d99260c87e c64: update presets 2022-07-26 20:21:16 -05:00
Steven Hugg c4fcf51e55 c64: fixed zp/stack ram debug 2022-07-26 20:21:07 -05:00
Steven Hugg a611697819 wiz: updated compiler 2022-07-26 20:21:07 -05:00
Steven Hugg b0d4f8f1f5 c64: added sid music/sfx, updated memmap, examples 2022-07-20 13:13:14 -05:00
Steven Hugg 3beef5626c c64: updated openroms 2022-07-19 10:46:04 -05:00
Steven Hugg 3766576bae z80: fixed bug in "add iy,sp" 2022-07-13 15:04:25 -05:00
Steven Hugg e69a5d433d npm audit fix 2022-06-30 13:49:42 -05:00
Steven Hugg fa09db6026 Merge branch 'ecs' 2022-06-30 13:31:29 -05:00
Steven Hugg b284fc694d fixed tests, removed listings from parseCA65Listing 2022-06-22 12:22:47 -05:00
Steven Hugg 0fc860f524 ecs: updated unit tests 2022-02-27 19:46:33 -06:00
Steven Hugg e09f115084 ecs: refactored working and index register sets 2022-02-27 19:24:24 -06:00
Steven Hugg c73263d944 ecs: added label sources 2022-02-27 11:38:34 -06:00
Steven Hugg 6f3affaaef ecs: nested labels 2022-02-27 10:17:27 -06:00
Steven Hugg e86eb56570 ecs: moved query ops to exprs 2022-02-25 16:18:16 -06:00
Steven Hugg 50a75a7d3e updated README 2022-02-25 12:07:02 -06:00
Steven Hugg fc79cf9b0f ecs: block statement expr 2022-02-25 11:45:13 -06:00
Steven Hugg 05965397fd ecs: started on expressions 2022-02-24 21:15:26 -06:00
Steven Hugg a965bc83d1 ecs: default values work now 2022-02-24 14:02:18 -06:00
Steven Hugg 614fdf92f7 ecs: token.eol; fixed bugs and tests 2022-02-24 13:31:09 -06:00
Steven Hugg d87a05747e ecs: only register events when used in a system instance 2022-02-24 12:59:45 -06:00
Steven Hugg 37b3d58de0 wasm: fixed unit tests 2022-02-24 12:36:05 -06:00
Steven Hugg 30db34837c nes: updated memory map 2022-02-24 12:27:56 -06:00
Steven Hugg e7e5ea7847 ecs: skip parsing demo if not in main file 2022-02-24 11:35:20 -06:00
Steven Hugg 75fb2a8e5c worker: debuginfo passed thru to link step 2022-02-24 09:48:54 -06:00
Steven Hugg ec089b2d89 vic20: sort of functional (need res/vic20.bios, basic+chars+kernel) 2022-02-23 15:57:27 -06:00
Steven Hugg c9e75ae77d ecs: EVENT__xxx defines 2022-02-23 12:13:55 -06:00
Steven Hugg 5afd3cf498 ecs: better subroutine finding 2022-02-23 11:07:09 -06:00
Steven Hugg f7099b8e8f ecs: enum keyword, entity.field constants 2022-02-22 23:26:40 -06:00
Steven Hugg b6467ce314 fixed github actions again, back to the way it was 2022-02-22 13:46:41 -06:00
Steven Hugg 03254b28ff fixed github actions 2022-02-22 13:37:14 -06:00
Steven Hugg fdd7d79aaa fixed williams test, github build stops if test fails 2022-02-22 13:36:10 -06:00
Steven Hugg 6ca0a707e1 Merge branch 'master' into ecs 2022-02-22 11:49:13 -06:00
Steven Hugg 3d05c0ed1a ecs: use name2cfpairs, fixed identity thing, test errors 2022-02-22 11:06:50 -06:00
Steven Hugg 37edd8268a ecs: shared init data 2022-02-22 10:42:23 -06:00
Steven Hugg b9fc162885 cmoc: better listing parser, williams: updated presets 2022-02-22 09:48:41 -06:00
Steven Hugg 8c63bef8c9 williams: options=rotate%3D<deg> 2022-02-21 21:23:10 -06:00
Steven Hugg 0682af1eed fixed atari-vector 6502, pass options=... to platform constructor 2022-02-21 16:54:33 -06:00
Steven Hugg d7626be789 updated README 2022-02-21 10:43:58 -06:00
Steven Hugg 9351406450 ecs: set up for nes 2022-02-21 10:36:32 -06:00
Steven Hugg 1d3b8ab99c github: load config.js from 8bitworkshop.com 2022-02-21 09:39:49 -06:00
Steven Hugg 3a960c3e6e github: fix for build 2022-02-21 09:33:59 -06:00
Steven Hugg 69a5779975 github: gh-pages build 2022-02-21 09:30:12 -06:00
Steven Hugg 07c0ae2f9c ecs: default field values 2022-02-20 19:28:12 -06:00
Steven Hugg a444de693b ecs: field, ref type checking, start cmd 2022-02-20 09:59:46 -06:00
Steven Hugg 7767608595 ecs: query takes [#entity] list 2022-02-19 22:28:14 -06:00
Steven Hugg 38462bceac ecs: added eid cmd 2022-02-19 17:52:24 -06:00
Steven Hugg eb30e5cf85 ecs: automatically init bss when 'start' event 2022-02-19 17:34:23 -06:00
Steven Hugg 7b9f635bc0 editor: set focus when switching between files 2022-02-19 17:27:26 -06:00
Steven Hugg d96296675b ecs: accept 0/1 for bitmaps 2022-02-19 16:19:16 -06:00
Steven Hugg 479c2f24b8 ecs: unroll keyword 2022-02-19 15:39:44 -06:00
Steven Hugg 3fe2a151da ecs: show svg of bin packing, fixed bug 2022-02-19 14:44:20 -06:00
Steven Hugg c73c5ee185 ecs: check page boundary for critical subs 2022-02-19 11:51:48 -06:00
Steven Hugg 600e62f0c6 worker: can return listings with error result 2022-02-19 11:43:40 -06:00
Steven Hugg 38920c6dce ca65: return listings if errors 2022-02-19 11:35:30 -06:00
Steven Hugg 349c45d7c0 ecs: fold common subroutines, align/page crossing 2022-02-19 11:35:25 -06:00
Steven Hugg a87dbf03cf ecs: resources have their own labels, auto-find resources 2022-02-19 03:25:50 -06:00
Steven Hugg 2d02b64464 williams: working on cmoc 2022-02-18 14:15:30 -06:00
Steven Hugg d61e2391ce ecs: highlighting changes 2022-02-18 12:34:09 -06:00
Steven Hugg 73ab50f9b6 Merge branch 'master' into ecs 2022-02-18 11:01:43 -06:00
Steven Hugg 4749e18b35 ecs: critical code, sorta 2022-02-17 12:52:35 -06:00
Steven Hugg b4dbcb83eb ecs: temp symbols, not equates 2022-02-17 09:58:13 -06:00
Steven Hugg 75f36d95dc ecs: const, multiple sys instances for params 2022-02-17 09:48:50 -06:00
Steven Hugg 0451e8ea33 ecs: fixed indexregister offset, for now 2022-02-16 21:46:50 -06:00
Steven Hugg c7f0fd4cd0 vcs: scanline io viewer logs i/o only 2022-02-16 19:19:46 -06:00
Steven Hugg a425012b2b ecs: started w/ new IndexRegister 2022-02-16 14:21:46 -06:00
Steven Hugg 3268925638 ecs: tests, refactor, event args, fixed c.f 2022-02-16 11:32:41 -06:00
Steven Hugg 10baf3abc6 vcs: scanline io viewer logs i/o only 2022-02-15 14:20:19 -06:00
Steven Hugg fbe07c33d2 ecs: playfield decoder 2022-02-15 10:46:50 -06:00
Steven Hugg 4f05ea487b 6809: updated lwasm for raw targets (.asm extension) 2022-02-14 20:35:42 -06:00
Steven Hugg 1a062650ad fixed more repo= qs stuff 2022-02-13 13:25:57 -06:00
Steven Hugg f73e1dbf66 added testimport.js, fixed repo= qs handling 2022-02-13 12:47:33 -06:00
Steven Hugg e461ae41d9 ecs: no actionstats 2022-02-11 10:25:35 -06:00
Steven Hugg 4584cc778f ecs: system instance, with #entity.field 2022-02-10 21:53:28 -06:00
Steven Hugg acb50ac4b9 ecs: changed constant array declaraiton 2022-02-10 15:33:27 -06:00
Steven Hugg bea49e2b11 ecs: var/init/const allocation 2022-02-10 12:56:01 -06:00
Steven Hugg fc0a43b9af ecs: forward entity refs, deferred components, %binary 2022-02-10 11:11:35 -06:00
Steven Hugg 999aed9cb4 ecs: data <field>, 48 pixel decoder 2022-02-09 14:38:10 -06:00
Steven Hugg 5081307d81 ecs: bin pack temp vars 2022-02-09 10:22:45 -06:00
Steven Hugg bc7cd6f1a3 ecs: temp vars 2022-02-08 22:21:23 -06:00
Steven Hugg 01056c66a8 ecs: sys, action stats 2022-02-08 20:40:36 -06:00
Steven Hugg dda51c3467 ecs: asc desc 2022-02-08 12:43:41 -06:00
Steven Hugg 2dfe65932b ecs: test files 2022-02-08 06:03:43 -06:00
Steven Hugg 8e8a65d44b updated syncdev script 2022-02-07 16:08:36 -06:00
Steven Hugg 109e60ae10 ecs: Init, main_init, bss_init 2022-02-07 14:42:23 -06:00
Steven Hugg e3d54b9150 ecs: don't need archetypematch? 2022-02-06 11:27:08 -06:00
Steven Hugg d986cda3b3 ecs: start tests 2022-02-05 22:23:24 -06:00
Steven Hugg 0904e83bf6 ecs: decoders 2022-02-05 20:28:23 -06:00
Steven Hugg 3a77e31e47 ecs: baseoffset 2022-02-04 20:10:28 -06:00
Steven Hugg 1f64a623aa ecs: fixed eidofs 2022-02-04 14:51:53 -06:00
Steven Hugg 2d5eec8ba3 ecs: moved everything to dialect 2022-02-04 11:48:07 -06:00
Steven Hugg 186baf8c13 fixed ca65 listings 2022-02-04 08:25:31 -06:00
Steven Hugg 40ca02fc6b ecs: separate temp regions for now 2022-02-03 22:38:35 -06:00
Steven Hugg dbc84c94b2 ecs: no error if select is empty 2022-02-03 20:42:41 -06:00
Steven Hugg 8b23e9872e fixed bug when importing github project on first IDE run 2022-02-03 18:52:40 -06:00
Steven Hugg 513fb85b8e ecs: fixed import 2022-02-03 18:40:34 -06:00
Steven Hugg 01de3b8d6b ecs: local system 2022-02-03 17:14:03 -06:00
Steven Hugg 51f0f6ffea ecs: entity.lookup 2022-02-03 16:44:43 -06:00
Steven Hugg a66d060c08 ecs: scope events 2022-02-03 16:04:48 -06:00
Steven Hugg 167dff50a5 ecs: refactored limit, loops, but needs more 2022-02-03 15:44:58 -06:00
Steven Hugg 5d3cae4804 ecs: -query, get/set, imported 2022-02-03 13:38:09 -06:00
Steven Hugg bc3b2cd81d ecs: with/if 2022-02-03 09:24:18 -06:00
Steven Hugg a7f708a303 ecs: better with filter 2022-02-03 08:54:46 -06:00
Steven Hugg c299bcddae ecs: with, select queries 2022-02-03 07:44:47 -06:00
Steven Hugg dcb11a7080 ecs: import 2022-02-02 20:27:58 -06:00
Steven Hugg 83238f30f1 ecs: scoping, start labels, subscopes (need unions for data) 2022-02-02 18:15:04 -06:00
Steven Hugg b28a4b5be4 ecs: using, fixed tokenizer start/end column 2022-02-02 16:49:01 -06:00
Steven Hugg d9b8b8b7d3 ecs: refactor, QueryResult, filter 2022-02-02 14:41:40 -06:00
Steven Hugg 2dea6b1fcf Merge branch 'master' into ecs 2022-02-01 11:36:43 -06:00
Steven Hugg 4076b742fe
Merge pull request #94 from micahcowan/kbdinput
Grab control-key keyboard input
2022-02-01 11:35:56 -06:00
Steven Hugg e439f16249
Merge pull request #93 from micahcowan/apple2
Apple2: Allow uploaded firmware ROM replacement
2022-02-01 11:35:45 -06:00
Steven Hugg 7759cc52f1 ecs: can use {{cmd args...}} format 2022-02-01 11:31:39 -06:00
Steven Hugg 4e5beb6c74 tokenizer is no longer line-based 2022-02-01 09:49:49 -06:00
Steven Hugg 40cc5ee118 ecs: refactor into ActionEval 2022-02-01 08:16:53 -06:00
Steven Hugg 10784585d9 ecs: codesegment vs data 2022-02-01 08:07:33 -06:00
Steven Hugg 0803b80485 ecs: fixed init 16-bit values 2022-01-31 21:50:45 -06:00
Steven Hugg ce1c444900 ecs: trying to do arrays, scores 2022-01-31 19:05:45 -06:00
Steven Hugg ec73e41f8c ecs: resources 2022-01-31 12:11:50 -06:00
Steven Hugg 87eb8e2f05 ecs: event2system 2022-01-31 09:48:19 -06:00
Steven Hugg c54b6a1150 ecs: {{%props}}, ecs errors w/ $loc 2022-01-31 09:03:05 -06:00
Steven Hugg 249d4735eb ecs: added join, limit, fixed some things, took out ca65 listing for now 2022-01-30 10:11:04 -06:00
Steven Hugg 69cd28aa0e codemirror ecs mode 2022-01-29 20:36:36 -06:00
Steven Hugg ce21eb29e5 moved SourceLocated to workertypes 2022-01-29 13:07:21 -06:00
Steven Hugg 0784eb8f77 cc65 uses fs65-none library 2022-01-29 12:47:37 -06:00
Steven Hugg 9b6f797451 ecs: debug info 2022-01-29 12:47:37 -06:00
Steven Hugg 3f241bfcc2 ecs: worker tool 2022-01-29 12:47:37 -06:00
Steven Hugg 8b96c746a2 ecs: ref types? 2022-01-29 12:47:37 -06:00
Steven Hugg 310ce87bcc ecs: actions emit? 2022-01-29 12:47:37 -06:00
Steven Hugg d2caee8cc3 use {{ }} delimiters, tokenizer, testecs, compiler 2022-01-29 12:47:37 -06:00
Steven Hugg 46f6063929 typescript unit tests in src/test 2022-01-29 12:47:37 -06:00
Steven Hugg dd5a95688f ecs: dialect 2022-01-29 12:47:37 -06:00
Steven Hugg b0810a2f66 ecs: yaml? 2022-01-29 12:47:37 -06:00
Steven Hugg 44ffa5e988 ecs: allocate init data table 2022-01-29 12:47:37 -06:00
Steven Hugg ba73d7bb19 ecs: all includes[] must be present 2022-01-29 12:47:37 -06:00
Steven Hugg c022c16dc2 ecs: const values 2022-01-29 12:47:37 -06:00
Steven Hugg 47461b5a28 ecs: actions have queries 2022-01-29 12:47:37 -06:00
Steven Hugg 4c2442dd90 ecs: use ca65 syntax 2022-01-29 12:47:37 -06:00
Steven Hugg 37167a2202 ecs init values 2022-01-29 12:47:37 -06:00
Steven Hugg b00d43d1ea ecs 1st compile 2022-01-29 12:47:37 -06:00
Steven Hugg 3f87b5dbb8 ecs branch 2022-01-29 12:47:37 -06:00
Steven Hugg 0cc8d1bc37 ca65: fixed line numbers(?) 2022-01-29 12:47:27 -06:00
Micah Cowan 9df41590be apple2: Ctrl+Bksp -> soft RESET 2022-01-28 23:44:03 -08:00
Micah Cowan 45ee1b5c28 Capture Ctrl keys in keydown, not keypress 2022-01-28 23:44:03 -08:00
Micah Cowan 3681bc65e8 apple2: don't modify uploaded ROMs with RTS byte 2022-01-28 23:42:23 -08:00
Micah Cowan fc59dd30c3 apple2: repair "DOS fake" bytes after loadROM 2022-01-28 23:42:23 -08:00
Micah Cowan 7071f70bb2 apple2: force hard resets, fixing loadROM 2022-01-28 23:42:23 -08:00
Micah Cowan c58d999ee4 apple2 fakeDrive: PROM bytes on read, JMP on exec 2022-01-28 23:42:23 -08:00
Micah Cowan 8e3f929098 apple2: allow mis-sized BIOS files 2022-01-28 23:42:23 -08:00
Micah Cowan 5970ae5bcc apple2: implement loadBIOS / apple2.rom 2022-01-28 23:42:23 -08:00
Steven Hugg b3d42f944b ca65: parse new error msgs 2022-01-27 08:42:05 -06:00
Steven Hugg 0b059b48f5 updated atari8 cc65 fs, ignore cc65 warning 2022-01-26 10:54:17 -06:00
Steven Hugg 7054ae2360 got rid of Sentry error msg on localhost 2022-01-25 12:00:50 -06:00
Steven Hugg 3244c17ce1 removed electron, upgrade npm pkgs 2022-01-25 09:32:40 -06:00
Steven Hugg 73389b1d1d fixed some cc65 stuff, wiz too 2022-01-24 18:51:39 -06:00
Steven Hugg 5a39828bf5 fixed tests 2022-01-24 16:56:44 -06:00
Steven Hugg c42beda98f upgraded cc65 2022-01-24 13:26:11 -06:00
Steven Hugg 0345834bb5 updated wiz.wasm 2022-01-22 20:17:47 -06:00
Steven Hugg 48eb75882b fixed instanceof EmuHalt 2021-12-22 08:50:02 -06:00
Steven Hugg 82ebc47caa cpc: music player 2021-12-22 08:50:02 -06:00
Steven Hugg 6c0c610514 vcs: resizeobserver
cpc: siege game
2021-12-03 08:25:57 -06:00
Steven Hugg c3403a0506 cpc: cpctelera, start @ 0x4000, new vsync 2021-12-02 13:01:02 -06:00
Steven Hugg 68320b8ee9 Merge branch 'master' of github.com:sehugg/8bitworkshop 2021-12-01 14:08:42 -06:00
Steven Hugg 8fa0389da1 cpc: started investigation, cpcrslib, aspect 2021-12-01 14:03:26 -06:00
Steven Hugg 9393b75b01
Merge pull request #88 from kremnev8/master
Fix 2 issues with asset editor
2021-10-16 12:30:37 -05:00
kremnev8 599ced82d4 Revert "Update node.js.yml"
This reverts commit 751933e771.
2021-10-15 21:55:04 +03:00
kremnev8 95c3026bd7 Merge branch 'master' of https://github.com/kremnev8/8bitworkshop 2021-10-15 21:53:56 +03:00
kremnev8 dc8eca58ff Fix asset editor issues on verilog-vga platform 2021-10-15 21:51:54 +03:00
kremnev8 751933e771
Update node.js.yml 2021-10-15 17:31:21 +03:00
Steven Hugg f2ea25d0c3 Merge branch 'master' of github.com:sehugg/8bitworkshop 2021-10-10 21:56:52 -05:00
Steven Hugg 7a12047652
Update README.md 2021-10-10 21:56:41 -05:00
Steven Hugg 5a813557b7 electron: made optional dependencies 2021-10-09 21:29:06 -05:00
Steven Hugg 3c148e7200 testing: github secret 2021-09-21 11:19:30 -05:00
Steven Hugg c9d97edbd0 testing: binaryen module abort()s on linux, don't know why, so moved to test/verilog for now 2021-09-20 18:02:39 -05:00
Steven Hugg 97248cf399 vcs: listen for kbd on emulator div 2021-09-20 16:08:31 -05:00
Steven Hugg 6e568d0c42 github ci fixes? removed travis 2021-09-16 11:46:36 -05:00
Steven Hugg 89cc76c14b
Create node.js.yml 2021-09-16 11:34:01 -05:00
Steven Hugg 9f171bcf75 github: added octokat.js back in 2021-09-15 21:53:38 -05:00
Steven Hugg 9a2e411587 added vcs.stellerator platform 2021-09-15 14:41:25 -05:00
Steven Hugg 6441129dc1 scripting: use persistent store 2021-09-15 09:52:08 -05:00
Steven Hugg 3d22e5d614
Merge pull request #80 from taylorza/master
Fixed putchar for ZX Spectrum
2021-09-06 11:38:23 -05:00
Steven Hugg 1d66f77f9a scripting: dropdown mode for ui.select 2021-08-30 12:07:56 -05:00
Steven Hugg 5542555193 scripting: fixed cache, io.module(), return values, button, blank() 2021-08-27 10:42:02 -05:00
Steven Hugg 6343c75953 scripting: io.mutable(), $ vs $$ 2021-08-23 11:17:23 -05:00
Steven Hugg 005adcc9ba scripting: updates, moved interact to ui pkg 2021-08-23 09:10:12 -05:00
Steven Hugg 65a16db7b7 scripting: don't need $$reset (i think?) 2021-08-22 14:51:42 -05:00
Steven Hugg 8fc94aad25 scripting: started on interact(), ui.select, chromas 2021-08-22 12:39:03 -05:00
Steven Hugg 6cee4e26e4 scripting: print(), css, palette layout, flex
make syncdev/prod: fixed mime type upload
2021-08-20 12:25:05 -05:00
Steven Hugg 9076ede5c1 scripting: use chroma-js 2021-08-18 15:40:50 -05:00
Steven Hugg 05ab17d3da ui: don't print alert if lose visibility before compile 2021-08-17 20:01:43 -05:00
Steven Hugg 6134a8c89c scripting: working on notebook, functions, files, setItem(), fixed tests 2021-08-17 19:38:48 -05:00
Steven Hugg 7f86ed0cb6 use preact for scripting notebook, moved files 2021-08-14 22:05:24 -05:00
Chris Taylor c8e639cbd6 Fixed putchar for ZX Spectrum 2021-08-14 18:23:00 -04:00
Steven Hugg a8b2b7c043 starting on js scripting language; worker msgs can run async functions (but we don't need to ... yet) 2021-08-13 21:23:23 -05:00
Steven Hugg bd00d98b77 split workermain into tools/* modules; share parseXMLPoorly() 2021-08-12 13:51:10 -05:00
Steven Hugg a12d1a0638 removed redundant 'use strict' from ts files 2021-08-11 11:18:41 -05:00
Steven Hugg d1f51a2dd7 terrible hack to get around esbuild bug #1511 2021-08-09 17:04:09 -05:00
Steven Hugg b52d3e95ba made optionalDependencies section in package.json 2021-08-09 12:55:14 -05:00
Steven Hugg 02e97d11bd update node version in .travis.yml 2021-08-09 12:17:29 -05:00
Steven Hugg 3b21a23336 no really, fixed the build 2021-08-09 12:09:44 -05:00
Steven Hugg f472bc99ee fixed build 2021-08-09 12:06:38 -05:00
Steven Hugg b774557422 zx: fixes for msxbios 2021-08-09 11:35:29 -05:00
Steven Hugg ee64907fb5
Merge pull request #78 from taylorza/fix-zx-sprite
Fix ZX sprite rendering
2021-08-09 11:34:48 -05:00
Steven Hugg f073ce2350 updated worker with result type-checking 2021-08-08 13:54:20 -05:00
Chris Taylor c43c413540 Fix ZX sprite rendering 2021-08-08 13:39:19 -04:00
Steven Hugg 505492d1c7 renamed embed.html to player.html 2021-08-07 09:04:17 -05:00
Steven Hugg 0bb450944c rewrote AnimationTimer loop, use setTimeout() 2021-08-07 08:41:28 -05:00
Steven Hugg 5eb3e864fb fixed file upload after esbuild refactor 2021-08-06 21:02:45 -05:00
Steven Hugg 79b1d8ba4b fixed saveAs; more async usage; importURL ignores if embed=1/ignore=1 2021-08-06 11:53:02 -05:00
Steven Hugg 42f3febb29 vcs: moved Javatari to loadScript() in Platform.start() 2021-08-06 09:07:40 -05:00
Steven Hugg 4cb8b890da moved firebase imports to dynamic load 2021-08-06 08:50:40 -05:00
Steven Hugg f5ba481c1d intro tour: dynamic import of .js file; renamed 6809.js to .ts 2021-08-06 08:10:13 -05:00
Steven Hugg 6f6b617723 embed: use IntersectionObserver to load/pause/resume when scrolling 2021-08-05 21:14:47 -05:00
Steven Hugg ed41c1fb2a split baseplatform.ts into mame/wasm 2021-08-05 19:16:13 -05:00
Steven Hugg e1b6a2397d add highlight=<start>,<end> option in query string 2021-08-05 16:51:29 -05:00
Steven Hugg be679ecc10 fixed unit tests 2021-08-04 21:20:55 -05:00
Steven Hugg df44459c7a fixed AnimationTimer w/ requestAnimationFrame (nes) 2021-08-04 21:09:25 -05:00
Steven Hugg dd57c65897 moved octokat to import(), removed unused lib/ files 2021-08-04 20:48:50 -05:00
Steven Hugg 91d0031366 split ide/views.ts into ide/views/* 2021-08-04 17:57:43 -05:00
Steven Hugg 8f6432f0d4 refactoring: UIQueryString UserPrefs, moved createNewPersistentStore, es2017, fixed tests, style changes for embed 2021-08-04 16:54:01 -05:00
Steven Hugg ef01639a06 embed=1 uses referrer as storage location; use requestAnimationFrame() 2021-08-03 19:33:29 -05:00
Steven Hugg a1e2e2aafc moved clipboard, jszip, FileSaver libs to import(), fixed embed 2021-08-03 14:48:14 -05:00
Steven Hugg e00819da59 fixed error when platform is invalid 2021-08-02 14:08:07 -05:00
Steven Hugg 1daa080e70 fixed npm run build; isolatedModules=true; es2017; fixed electron 2021-08-02 09:44:18 -05:00
Steven Hugg 4506ebd7e0 started migration to esbuild modules 2021-08-02 08:32:46 -05:00
Steven Hugg 5c52862a0b mame: made 6502/z80 subclasses 2021-07-31 17:01:19 -05:00
Steven Hugg 34322dd3d7 worker: convert globals to FileWorkingStore and Builder classes, emscripten types 2021-07-30 20:09:28 -05:00
Steven Hugg 29f0238b90 worker: use imports instead of require() 2021-07-30 09:54:35 -05:00
Steven Hugg f3bf1602d5 started bundling worker with esbuild 2021-07-27 11:13:58 -05:00
Steven Hugg 55735b4039 starting on WASI emulator support, atari800 2021-07-27 11:13:50 -05:00
Steven Hugg 820985cb73 revert back to single tsconfig.json 2021-07-24 11:40:46 -05:00
Steven Hugg f634007e51 verilog: genModuleSync (for testing) 2021-07-24 09:40:55 -05:00
Steven Hugg 565d7d947c verilog: test for silice ccast bug 2021-07-22 16:04:26 -05:00
Steven Hugg 0532df8ec9 npm test: standard output 2021-07-22 11:14:05 -05:00
Steven Hugg 658e161550 removed store.ts, working on local fs (https://web.dev/file-system-access/) 2021-07-22 11:14:05 -05:00
Steven Hugg e82245d7bd worker: uses import and require() 2021-07-22 11:14:05 -05:00
Steven Hugg 954490e1b6 forgot to commit src/worker/loader.ts 2021-07-22 11:14:05 -05:00
515 changed files with 364115 additions and 148826 deletions

38
.github/workflows/node.js.yml vendored Normal file
View File

@ -0,0 +1,38 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: git submodule init
- run: git submodule update
- run: npm ci
- run: npm run build --if-present
- run: npm test
env:
TEST8BIT_GITHUB_TOKEN: ${{ secrets.TEST8BIT_GITHUB_TOKEN }}
- run: make distro
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages
folder: tmp/dist

17
.gitignore vendored
View File

@ -1,10 +1,13 @@
*~
node_modules
local/
tests_output/
test/output/
/local/
/tests_output/
/test/output/
.DS_Store
tmp/
web/
release/
gen/
/tmp/
/web/
/release/
/gen/
config.js
chromedriver.log
nightwatch.conf.js

3
.gitmodules vendored
View File

@ -16,6 +16,3 @@
[submodule "nanoasm"]
path = nanoasm
url = https://github.com/sehugg/nanoasm
[submodule "unicorn.js"]
path = unicorn.js
url = https://github.com/AlexAltea/unicorn.js

View File

@ -1,14 +0,0 @@
# Handle git submodules yourself
git:
submodules: false
# Use sed to replace the SSH URL with the public URL, then initialize submodules
before_install:
- sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules
- git submodule update --init --recursive
language: node_js
node_js:
- "14.3.0"
script:
- npm run build
- npm test

View File

@ -3,51 +3,35 @@ TSC=./node_modules/typescript/bin/tsc --build
TMP=./tmp/dist
buildtsc:
npm run esbuild-clean
$(TSC) tsconfig.json
npm run esbuild
prepare: buildtsc
patch -i meta/electron.diff -o electron.html
#cp nanoasm/src/assembler.ts src/worker/
cp node_modules/jquery/dist/jquery.min.js ./jquery/
cp -r node_modules/bootstrap/dist/* ./bootstrap/
cp node_modules/bootstrap-tourist/*.css node_modules/bootstrap-tourist/*.js ./lib/
cp node_modules/clipboard/dist/clipboard.min.js ./lib/
cp node_modules/mousetrap/mousetrap*.min.js ./lib/
#cp node_modules/octokat/dist/octokat.js ./lib/
cp node_modules/split.js/dist/split.min.js ./lib/
cp node_modules/localforage/dist/localforage.min.js ./lib/
cp node_modules/jszip/dist/jszip.min.js ./lib/
cp node_modules/file-saver/dist/*.min.js ./lib/
cp node_modules/binaryen/index.js ./lib/binaryen.js
cp unicorn.js/dist/unicorn-arm.min.js ./unicorn.js/demos/externals/capstone-arm.min.js ./lib/
#cp ./unicorn.js/demos/externals/capstone-arm.min.js ./lib/
cp gif.js/dist/* ./lib/
cd jsnes && npm i
mkdoc:
npm run mkdoc
distro:
distro: buildtsc
rm -fr $(TMP) && mkdir -p $(TMP)
git archive HEAD | tar x -C $(TMP)
cp -rp gen $(TMP)
cp -rp codemirror tss $(TMP)
rm -r $(TMP)/doc $(TMP)/scripts $(TMP)/test* $(TMP)/tools $(TMP)/.[a-z]* $(TMP)/ts*.json # $(TMP)/meta
rm -f $(TMP)/javatari && mkdir -p $(TMP)/javatari && cp -p javatari.js/release/javatari/* $(TMP)/javatari/
tar cf - `cat electron.html | egrep "^<(script|link)" | egrep -o '"([^"]+).(js|css)"' | cut -d '"' -f2` | tar x -C $(TMP)
desktop: distro
pushd $(TMP) && npm i && popd $(TMP)
mkdir -p $(TMP)/resources
./node_modules/.bin/electron-builder -mlw --project $(TMP) # --prepackaged $(TMP)
mv $(TMP)/dist/*.* ./release/desktop/
meta/electron.diff: index.html electron.html
-diff -u index.html electron.html > $@
web:
(ip addr || ifconfig) | grep inet
python3 scripts/serveit.py 2>> /dev/null #http.out
tsweb:
npm run esbuild-clean
(ip addr || ifconfig) | grep inet
$(TSC) -w &
$(TSC) -w --preserveWatchOutput &
sleep 9999999 | npm run esbuild-worker -- --watch &
sleep 9999999 | npm run esbuild-ui -- --watch &
python3 scripts/serveit.py 2>> /dev/null #http.out
astrolibre.b64.txt: astrolibre.rom
@ -58,8 +42,8 @@ VERSION := $(shell git tag -l --points-at HEAD)
syncdev: distro
cp config.js $(TMP)
#aws --profile pzp s3 sync --follow-symlinks $(TMP)/ s3://8bitworkshop.com/dev/
s3cmd -c ~/.s3pzp sync -MFP $(TMP)/ s3://8bitworkshop.com/dev/
rsync --stats -riltz --chmod=a+rx -e "ssh" $(TMP)/ config.js $(RSYNC_PATH)/dev/
s3cmd -c ~/.s3pzp sync -MFP --no-mime-magic $(TMP)/ s3://8bitworkshop.com/dev/
rsync --stats -riltz --delete --chmod=a+rx -e "ssh" $(TMP)/ config.js $(RSYNC_PATH)/dev/
syncprod: distro
@[ "${VERSION}" ] || ( echo ">> No version set at HEAD, tag it first"; exit 1 )
@ -69,5 +53,5 @@ syncprod: distro
read
cp config.js $(TMP)
#aws --profile pzp s3 sync --follow-symlinks $(TMP)/ s3://8bitworkshop.com/v$(VERSION)/
s3cmd -c ~/.s3pzp sync -MFP $(TMP)/ config.js s3://8bitworkshop.com/v$(VERSION)/
rsync --stats -riltz --chmod=a+rx -e "ssh" $(TMP)/ config.js $(RSYNC_PATH)/v$(VERSION)/
s3cmd -c ~/.s3pzp sync -MFP --no-mime-magic $(TMP)/ config.js s3://8bitworkshop.com/v$(VERSION)/
rsync --stats --del -riltz --chmod=a+rx -e "ssh" $(TMP)/ config.js $(RSYNC_PATH)/v$(VERSION)/

View File

@ -1,14 +1,21 @@
# 8bitworkshop
[![Build Status](https://travis-ci.com/sehugg/8bitworkshop.svg?branch=master)](https://travis-ci.com/sehugg/8bitworkshop)
![Build Status](https://github.com/sehugg/8bitworkshop/actions/workflows/node.js.yml/badge.svg)
## Use Online
* Latest release: https://8bitworkshop.com/
* Dev build: https://8bitworkshop.com/dev/
* Latest Github build: https://sehugg.github.io/8bitworkshop/
## Install Locally
To clone just the main branch:
```sh
git clone -b master --single-branch git@github.com:sehugg/8bitworkshop.git
```
To build the 8bitworkshop IDE:
```sh
@ -18,7 +25,9 @@ npm i
npm run build
```
### Start Server
To use GitHub integration locally, download the Firebase config file, e.g. https://8bitworkshop.com/v[version]/config.js
### Start Local Web Server
Start a web server on http://localhost:8000/ while TypeScript compiles in the background:
@ -32,24 +41,26 @@ make tsweb
npm test
```
Note: Github tests may fail due to lack of permissions.
Note: Github tests may fail due to lack of API key.
## License
Copyright © 2016-2021 [Steven Hugg](https://github.com/sehugg).
Copyright © 2016-2024 [Steven E. Hugg](https://github.com/sehugg).
This project is [GPL-3.0](https://github.com/sehugg/8bitworkshop/blob/master/LICENSE) licensed.
Dependencies retain their original licenses.
This project, unless specifically noted, is multi-licensed.
You may choose to adhere to the terms of either the [GPL-3.0](https://github.com/sehugg/8bitworkshop/blob/master/LICENSE) License for the entire project or respect the individual licenses of its dependencies and included code samples, as applicable.
All included code samples (all files under the presets/ directory) are licensed under
This project includes various dependencies, modules, and components that retain their original licenses.
For detailed licensing information for each dependency, please refer to the respective files and documentation.
All included code samples located in the presets/ directory are licensed under
[CC0](https://creativecommons.org/publicdomain/zero/1.0/)
unless otherwise licensed.
unless a different license is explicitly stated within the specific code sample.
## Dependencies
The IDE uses custom forks for many of these, found at https://github.com/sehugg?tab=repositories
### Emulators
* https://javatari.org/
@ -59,6 +70,8 @@ The IDE uses custom forks for many of these, found at https://github.com/sehugg?
* https://github.com/DrGoldfire/Z80.js
* http://www.twitchasylum.com/jsvecx/
* https://github.com/curiousdannii/ifvms.js/
* https://6502ts.github.io/typedoc/stellerator-embedded/
* https://github.com/yhzmr442/jspce
### Compilers
@ -72,6 +85,8 @@ The IDE uses custom forks for many of these, found at https://github.com/sehugg?
* https://github.com/dmsc/fastbasic
* https://github.com/wiz-lang/wiz
* https://github.com/sylefeb/Silice
* https://github.com/steux/cc7800
* https://bellard.org/tcc/
### Assemblers/Linkers
@ -86,6 +101,7 @@ The IDE uses custom forks for many of these, found at https://github.com/sehugg?
* https://shiru.untergrund.net/code.shtml
* http://www.colecovision.eu/ColecoVision/development/libcv.shtml
* https://github.com/toyoshim/tss
* https://github.com/lronaldo/cpctelera
### Firmware
@ -99,3 +115,22 @@ The IDE uses custom forks for many of these, found at https://github.com/sehugg?
* https://github.com/sehugg/8bitworkshop-compilers
* https://github.com/sehugg/8bit-tools
* https://github.com/sehugg/awesome-8bitgamedev
* https://github.com/sehugg?tab=repositories
## Tool Server (experimental)
This is an experimental feature that relies on a Docker container to provide compiler tools like [llvm-mos](https://github.com/llvm-mos/llvm-mos-sdk).
Right now, you have to run locally and build your own docker container.
```sh
docker build -t 8bitws-server-debian scripts/docker
docker run -p 3009:3009 8bitws-server-debian
echo '{"REMOTE_URL":"http://localhost:3009/build"}' > remote.json
```
Then add "&tool=llvm-mos" to your URL, like
[this](http://localhost:8000/?platform=c64&file=sprite_collision.c&tool=llvm-mos).
You can also rename your C files to have the suffix "-llvm.c".
Right now only the platforms c64, atari8, nes (NROM), and pce are supported.
Not very many of the current examples work with the new toolchain.

View File

@ -30,6 +30,9 @@
.currentpc-marker-blocked {
color: #ffee33;
}
.hilite-span {
background-color: #003399;
}
.mark-error {
text-decoration-line: underline;
text-decoration-style: wavy;
@ -124,13 +127,15 @@ div.mem_info {
bottom: 10px;
background-color: #333;
color: #66ff66;
white-space: pre;
padding: 20px;
z-index: 12;
font-family: "Andale Mono", "Menlo", "Lucida Console", monospace;
font-size: 12pt;
box-shadow: 0px 0px 8px rgba(0,0,0,.5);
max-height: 90vh;
}
div.mem_info_msg {
white-space: pre;
padding: 20px;
max-height: 80vh;
overflow-y: auto;
}
div.mem_info a {
@ -145,6 +150,9 @@ div.mem_info a:hover {
div.mem_info a.selected {
color: #ffffff;
}
div.mem_info button {
color: #fff;
}
.mem_info_links {
text-align:right;
}
@ -166,10 +174,6 @@ div.mem_info a.selected {
.btn_label {
color: #ccc;
}
.btn_group.debug_group {
}
.btn_group.view_group {
}
.btn_active {
color: #33cc33 !important;
}
@ -293,9 +297,9 @@ div.emuspacer {
padding: 20px;
background: #000;
margin-top:40px;
margin-left:5%;
margin-right:5%;
width:90%;
margin-left:3%;
margin-right:3%;
width:94%;
pointer-events:auto;
}
.emuvideo:focus {
@ -340,8 +344,6 @@ canvas.pixelated {
a.toolbarMenuButton {
padding:0.3em;
}
a.dropdown-toggle {
}
a.dropdown-toggle:hover {
color:#ffffff;
text-shadow: 0px 0px 2px black;
@ -594,6 +596,8 @@ div.asset_toolbar {
}
.control-def {
color: #ccc;
white-space: nowrap;
line-height:2em;
}
.book-title {
font-size:12pt;
@ -715,7 +719,8 @@ div.asset_toolbar {
padding-top: 0.5em;
}
.tree-header {
border: 2px solid #555;
display: flex;
border: 1px solid #555;
border-radius:8px;
color: #fff;
background-color:#666;
@ -727,8 +732,11 @@ div.asset_toolbar {
padding-right:0.75em;
font-size: small;
}
.tree-key {
padding-right:1em;
}
.tree-value {
float:right;
margin-left:auto;
font-weight:normal;
padding-right:1em;
}
@ -760,8 +768,88 @@ div.asset_toolbar {
.tree-level-9 { background-color: #7b8363;}
.tree-level-10 { background-color: #738363;}
.waverow {
}
.waverow.editable:hover {
background-color: #336633;
}
.scripting-cell {
background: #444;
color: #99cc99;
padding: 0.5em;
margin-right: 0.5em;
font-family: "Andale Mono", "Menlo", "Lucida Console", monospace;
word-wrap: break-word;
pointer-events: auto;
}
.scripting-cell canvas {
min-height: 20em;
max-width: 95%;
border: 0;
outline-color: #ccc;
background: #000;
padding: 0;
margin: 0;
image-rendering: pixelated;
image-rendering: crisp-edges;
}
.scripting-cell pre {
background-color: #333;
border: 1px inset #666;
color: #99dd99;
}
.scripting-flex canvas {
min-height: 2vw;
max-height: 20vw;
}
div.scripting-editor {
width: 100%;
}
.scripting-editor canvas {
min-height: 30vw;
max-height: 50vw;
}
div.scripting-color {
min-width: 2em;
min-height: 2em;
border: 3px solid black;
}
div.scripting-color span {
visibility: hidden;
}
div.scripting-color:hover span {
visibility: visible;
}
div.scripting-grid {
display: grid;
grid-template-columns: repeat( auto-fill, minmax(4em, 1fr) );
justify-items: center;
}
div.scripting-flex {
display: flex;
flex-wrap: wrap;
align-items: center;
}
div.scripting-select > div {
border-radius: 2px;
border-style: dotted;
border-color: transparent;
margin: 0.25em;
}
div.scripting-select > div:hover {
border-color: #eee;
}
div.scripting-select > .scripting-selected {
border-style: solid;
border-color: #eee;
}
div.scripting-cell button {
background-color: #333;
color: #fff;
padding: 0.5em;
}
div.scripting-cell button:hover {
border-color: #fff;
}
div.scripting-cell button.scripting-enabled {
background-color: #339999;
}

View File

@ -38,7 +38,7 @@ gcc6809 - need to check this out
SmallerC - https://github.com/alexfru/SmallerC
vbcc - Targets 68K, patch for z-machine
http://sun.hasenbraten.de/vbcc/\
http://sun.hasenbraten.de/vbcc/
OTHER COMPILERS

90
doc/ecsroot/kernel.txt Normal file
View File

@ -0,0 +1,90 @@
# Kernel
# A Kernel draws a set of scanlines to the screen.
component Kernel
lines: 0..255 "Height of region in scanlines"
bgcolor: 0..255 "Background color"
end
system SimpleKernel
tempbytes 8
on preframe do once [Kernel] ---
lda #192 ; TODO: numlines
sec
sbc ypos_ypos_b0+ent
sta {{$5}}+ofs
ldy hasbitmap_bitmap_b0+ent
lda bitmap_bitmapdata_b0,y
sec
sbc {{$5}}+ofs
sta {{$0}}+ofs
lda bitmap_bitmapdata_b8,y
sbc #0
sta {{$1}}+ofs
ldy hascolormap_colormap_b0+ent
lda colormap_colormapdata_b0,y
sec
sbc {{$5}}+ofs
sta {{$2}}+ofs
lda colormap_colormapdata_b8,y
sbc #0
sta {{$3}}+ofs
lda sprite_height_b0+ent
sta {{$4}}+ofs
lda ypos_ypos_b0+ent
sta {{$5}}+ofs
---
on preframe do once [Sprite,HasBitmap,HasColormap,HasYpos] --
{{@KernelSetup}} 0,0
{{@KernelSetup}} 1,6
--
on kernel do once [Kernel]:
lda %{<bgcolor}
sta COLUBK
ldy %{<lines}
@LVScan:
lda %{$4} ; height
dcp %{$5}
bcs @DoDraw1
lda #0
.byte $2C
@DoDraw1:
lda (%{$0}),y
sta WSYNC
sta GRP0
lda (%{$2}),y
sta COLUP0
lda %{$10} ; height
dcp %{$11}
bcs @DoDraw2
lda #0
.byte $2C
@DoDraw2:
lda (%{$6}),y
sta GRP1
lda (%{$8}),y
sta COLUP1
dey ; decrement
bne @LVScan ; repeat until 192 lines
--
end
scope Root
entity kernel [SimpleKernel]
const lines = 100
end
entity player1 [Sprite,HasBitmap,HasColormap,HasYpos]
const plyrindex = 0
init height = 8
init xpos = 100
init ypos = 100
end
end scope

View File

@ -166,6 +166,7 @@ TODO:
- renaming main file doesn't change repo def.
- can't edit or push files until successful compile
- changing platform of repo makes one platform redirect to another platform
- should be able to change vcs -> vcs.mame for exmaple
- keyboard shortcuts
- ctrl+alt+l on ubuntu locks screen
- alt-D doesn't work anymore
@ -223,6 +224,10 @@ vcs: input not preserved when replaying frames?
compile errors disappear when focus returns
Stellerator
- window eats keystrokes (e.g. "i")
- more features, debugging
WEB WORKER FORMAT
@ -362,6 +367,22 @@ Programmatic Asset Language
- RLE compression
- check constraints
https://github.com/endojs/endo/blob/master/packages/ses/README.md
- CPU-independent IR
- structured assembler IR
- ECS/macros module
- HLL
- static analysis module
- linker/placement module
- inlining, data reuse
- nested tag for segments
- binary generation module
- remote fetch module
- asset module (bitmaps, sprites, tiles, palettes, compression...)
- asset editor UI
- debugging API (custom state, per-cycle watchpoints)
---
@ -535,7 +556,6 @@ Should call trap() every cycle or insn of frame, or exit when returns true?
BETTER DEBUGGING
Need to mark start/end columns, not just line number
Know if we are actively debugging or trap occurred
isRunning() = stopped, running, waiting, debugging...
Showing running PC may be distracting, maybe lines visited?
@ -544,6 +564,7 @@ Use tick() and refresh(), not callbacks
Show current datum when using READ
Use https://codemirror.net/doc/manual.html#markText
Reset doesn't break @ start unless debugging tools expanded
Single-step can un-sync frame/scanline timing
PORTING CC65 TO IDE
@ -555,3 +576,4 @@ preprocessor differences (#define FOO 1 so #if works)
extern void do_func(void)
#pragma warnings
CFG files

View File

@ -1,139 +0,0 @@
"use strict";
// preload.js for Electron app
const { ipcRenderer } = require('electron');
const fs = require('fs');
const _path = require('path');
const chokidar = require('chokidar');
const homeDirectory = require('os').homedir();
const wsroot = process.env.HOME_8BITWORKSHOP || _path.join(homeDirectory, '8bitworkshop');
function getLocalDir() {
const _ui = window.ui_1 || window.ui || window; // TODO: module naming
var dir = _ui.repo_id || _ui.platform_id || 'default';
return _path.join(wsroot, dir);
}
function getLocalFilePath(path) {
return _path.join(getLocalDir(), path);
}
function isProbablyBinary(path, data) {
var score = 0;
// decode as UTF-8
for (var i = 0; i < (data?data.length:0);) {
let c = data[i++];
if ((c & 0x80) == 0) {
// more likely binary if we see a NUL or obscure control character
if (c < 9 || (c >= 14 && c < 26) || c == 0x7f) {
score++;
break;
}
} else {
// look for invalid unicode sequences
var nextra = 0;
if ((c & 0xe0) == 0xc0) nextra = 1;
else if ((c & 0xf0) == 0xe0) nextra = 2;
else if ((c & 0xf8) == 0xf0) nextra = 3;
else if (c < 0xa0) score++;
else if (c == 0xff) score++;
while (nextra--) {
if (i >= data.length || (data[i++] & 0xc0) != 0x80) {
score++;
break;
}
}
}
}
return score > 0;
}
// this is before startUI is called
process.once('loaded', () => {
var watcher;
var allfiles = new Set();
// get workspace root dir
// from browser: read workspace files asynchronously
window.alternateLocalFilesystem = {
getFileData: (path) => {
let fullpath = getLocalFilePath(path);
allfiles.add(fullpath);
if (!fs.existsSync(fullpath)) {
return null;
}
return new Promise( (resolve, reject) => {
fs.readFile(fullpath, (err,buf) => {
if (err) {
resolve(err);
} else {
let isBinary = isProbablyBinary(path, buf);
let data = isBinary ? buf : buf.toString('utf-8');
console.log("getWorkspaceFile", path, isBinary, data.length);
resolve(data);
}
});
});
},
setFileData: (path, data) => {
let fullpath = getLocalFilePath(path);
allfiles.add(fullpath);
let encoding = typeof data === 'string' ? 'utf8' : null;
console.log("setWorkspaceFile", fullpath, data.length);
return new Promise( (resolve, reject) => {
fs.mkdir(_path.dirname(fullpath), {recursive:true}, (err,dirpath) => {
fs.writeFile(fullpath, data, {encoding:encoding}, (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
});
}
}
// watch/unwatch files as browser loses/gains focus
window.addEventListener("blur", (e) => {
let localdir = getLocalDir();
if (!watcher && localdir) {
// watch files for changes
watcher = chokidar.watch(Array.from(allfiles), {
//awaitWriteFinish: {pollInterval:50,stabilityThreshold:300},
ignoreInitial: true
});
watcher.on('all', (event, path) => {
path = path.substring(localdir.length + 1); //strip off prefix
console.log('WATCH', event, path);
// we don't use awaitWriteFinish b/c we might close() the watcher
setTimeout(() => {
window.reloadWorkspaceFile(path);
}, 300);
});
console.log('watching', getLocalDir());
}
});
window.addEventListener("focus", (e) => {
if (watcher) {
watcher.close();
watcher = null;
}
console.log('stopped watching');
});
// from electron.js: set workspace root directory
/*
TODO
ipcRenderer.on('setWorkspaceRoot', (event, data) => {
wsroot = data.root;
var binpath = _path.join(wsroot, 'bin');
if (!fs.existsSync(binpath)) fs.mkdirSync(binpath, {});
console.log('setWorkspaceRoot', wsroot);
});
// from electron.js: file changed
ipcRenderer.on('fileChanged', (event, data) => {
var path = data.path;
window.reloadWorkspaceFile(path);
});
*/
console.log('loaded preload', window.alternateLocalFilesystem, window.startUI);
});

View File

@ -1,257 +0,0 @@
--- index.html 2020-08-11 11:10:30.000000000 -0500
+++ electron.html 2020-08-11 14:45:27.000000000 -0500
@@ -3,16 +3,6 @@
<head>
<title>8bitworkshop IDE</title>
-<link rel="manifest" href="manifest.json">
-<meta name="googlebot" content="nosnippet" />
-<meta name="mobile-web-app-capable" content="yes">
-<meta name="apple-mobile-web-app-capable" content="yes">
-<meta name="application-name" content="8bitworkshop">
-<meta name="apple-mobile-web-app-title" content="8bitworkshop">
-<meta name="theme-color" content="#ffffff">
-<meta name="msapplication-navbutton-color" content="#ffffff">
-<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
-<meta name="msapplication-starturl" content="/redir.html">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=yes">
<style type="text/css" media="screen">
body {
@@ -21,46 +11,6 @@
}
</style>
<link rel="stylesheet" href="css/ui.css">
-
-<!-- google analytics -->
-<script>
-window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
-if (window.location.host.endsWith('8bitworkshop.com')) {
- ga('create', 'UA-54497476-9', 'auto');
- ga('set', 'anonymizeIp', true);
-}
-</script>
-<script async src='https://www.google-analytics.com/analytics.js'></script>
-
-<!-- firebase libs -->
-<script defer src="https://www.gstatic.com/firebasejs/5.11.1/firebase-app.js"></script>
-<script defer src="https://www.gstatic.com/firebasejs/5.11.1/firebase-auth.js"></script>
-<script defer src="config.js"></script>
-
-<!-- Sentry error reporting -->
-<script
- src="https://browser.sentry-cdn.com/5.20.1/bundle.min.js"
- integrity="sha384-O8HdAJg1h8RARFowXd2J/r5fIWuinSBtjhwQoPesfVILeXzGpJxvyY/77OaPPXUo"
- crossorigin="anonymous"></script>
-<script>
-if (window.location.host.endsWith('8bitworkshop.com')) {
- Sentry.init({
- dsn: 'https://bf329df3d1b34afa9f5b5e8ecd80ad11@sentry.io/1813925',
- beforeBreadcrumb(breadcrumb, hint) {
- if (breadcrumb.category === 'xhr' && typeof breadcrumb.data.url === 'string') {
- if (breadcrumb.data.url.startsWith('http')) return null; // discard external scripts
- }
- return breadcrumb;
- },
- beforeSend(event, hint) {
- const error = hint.originalException;
- if (error instanceof EmuHalt) return null; // ignore EmuHalt
- return event;
- },
- });
-}
-</script>
-
</head>
<body>
@@ -88,26 +38,6 @@
<hr>
<li><a class="dropdown-item" href="#" id="item_addfile_include">Add Include File...</a></li>
<li><a class="dropdown-item" href="#" id="item_addfile_link">Add Linked File...</a></li>
- <hr>
- <!--
- <li><a class="dropdown-item" href="#" id="item_switch_https" style="display:none">Switch to HTTPS...</a></li>
- -->
- <li><a class="dropdown-item" href="#" id="item_request_persist">Request Local Storage Permissions</a></li>
- </ul>
- </li>
- <li class="dropdown dropdown-submenu">
- <a tabindex="-1" href="#">Sync</a>
- <ul class="dropdown-menu">
- <li><a class="dropdown-item" href="#" id="item_github_login">Sign in to Github...</a></li>
- <li><a class="dropdown-item" href="#" id="item_github_logout">Log out</a></li>
- <hr>
- <li><a class="dropdown-item" href="#" id="item_github_import">Import Project from GitHub...</a></li>
- <li><a class="dropdown-item" href="#" id="item_github_pull">Pull Latest from Repository</a></li>
- <hr>
- <li><a class="dropdown-item" href="#" id="item_github_publish">Publish Project on GitHub...</a></li>
- <li><a class="dropdown-item" href="#" id="item_github_push">Push Changes to Repository...</a></li>
- <hr>
- <li><a class="dropdown-item" href="#" id="item_repo_delete">Delete Local Repository...</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
@@ -133,36 +63,6 @@
<li><a class="dropdown-item" href="#" id="item_debug_expr">Break Expression...</a></li>
</ul>
</li>
- <li class="dropdown dropdown-submenu">
- <a tabindex="-1" href="#">Tools</a>
- <ul class="dropdown-menu">
- <li><a class="dropdown-item" target="_8bws_tools" href="https://8bitworkshop.com/dithertron/">Dithertron Image Converter</a></li>
- <li><a class="dropdown-item" target="_8bws_tools" href="https://8bitworkshop.com/bitmapfontgenerator/">Bitmap Font Generator</a></li>
- <li><a class="dropdown-item" target="_8bws_tools" href="http://tomeko.net/online_tools/file_to_hex.php?lang=en">Binary File to Hex Converter</a></li>
- <li class="dropdown dropdown-submenu">
- <a tabindex="-1" href="#">Atari 2600</a>
- <ul class="dropdown-menu">
- <li><a class="dropdown-item" target="_8bws_tools" href="https://alienbill.com/2600/playerpalnext.html">playerpal 2600</a></li>
- <li><a class="dropdown-item" target="_8bws_tools" href="https://alienbill.com/2600/playfieldpal.html">playfieldpal 2600</a></li>
- </ul>
- </li>
- </ul>
- </li>
- <hr>
- <li class="dropdown dropdown-submenu">
- <a tabindex="-1" href="#">About</a>
- <ul class="dropdown-menu">
- <li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/blog">Latest News</a></li>
- <li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/projects">Projects</a></li>
- <li><a class="dropdown-item" target="_8bws_about" href="https://twitter.com/8bitworkshop">Twitter</a></li>
- <li><a class="dropdown-item" target="_8bws_about" href="https://github.com/sehugg/8bitworkshop">GitHub</a></li>
- <li><a class="dropdown-item" target="_8bws_about" href="https://github.com/sehugg/8bitworkshop/issues/new">Report an Issue</a></li>
- <li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/blog/docs/ide.md.html">IDE Help</a></li>
- </ul>
- </li>
- <!--
- <hr><li><a class="dropdown-item" href="/redir.html">Use Latest Version</a></li>
- -->
</ul>
</span>
@@ -258,39 +158,6 @@
<span class="label"><span id="settle_label"></span> evals/clk</span>
</span>
- <!-- BOOKS menu -->
- <span class="dropdown pull-right">
- <a class="btn dropdown-toggle hidden-xs toolbarMenuButton" id="booksMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
- <span class="glyphicon glyphicon-book" aria-hidden="true"></span>
- Get Books <span class="caret"></span>
- </a>
- <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="booksMenuButton">
- <li>
- <a class="dropdown-item dropdown-link book-vcs" target="_book_a2600" href="https://www.amazon.com/gp/product/1541021304/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&tag=pzp-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B01N4DSRIZ&linkId=04d39e274c06e6c93b93d20a9a977111">
- <img src="images/book_a2600.png"/>
- &nbsp;&nbsp;<span class="book-title">Making Games For The Atari 2600</span>
- </a>
- </li>
- <li>
- <a class="dropdown-item dropdown-link book-arcade" target="_book_arcade" href="https://www.amazon.com/gp/product/1545484759/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1545484759&linkCode=as2&tag=pzp-20&linkId=b27709c022d2ebe639e90316d9f4fd5b">
- <img src="images/book_arcade.png"/>
- &nbsp;&nbsp;<span class="book-title">Making 8-bit Arcade Games in C</span>
- </a>
- </li>
- <li>
- <a class="dropdown-item dropdown-link book-verilog" target="_book_verilog" href="https://www.amazon.com/gp/product/1728619440/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1728619440&linkCode=as2&tag=pzp-20&linkId=7237a25861cb6b49a4128ba53d84c3e2">
- <img src="images/book_verilog.png"/>
- &nbsp;&nbsp;<span class="book-title">Designing Video Game Hardware in Verilog</span>
- </a>
- </li>
- <li>
- <a class="dropdown-item dropdown-link book-nes" target="_book_nes" href="https://www.amazon.com/gp/product/1075952727/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1075952727&linkCode=as2&tag=pzp-20&linkId=633176e8b36fea7f927020e2c322d80a">
- <img src="images/book_nes.png"/>
- &nbsp;&nbsp;<span class="book-title">Making Games For The NES</span>
- </a>
- </li>
- </ul>
- </span>
<!-- 8bitworkshop logo -->
<span class="logo-gradient hidden-xs hidden-sm hidden-md pull-right" style="margin-left:auto" onclick="window.open('/','_8bitws');">8bitworkshop</span>
@@ -477,73 +344,6 @@
</div>
</div>
</div>
-<div id="importGithubModal" class="modal fade">
- <div class="modal-dialog modal-md" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h3 class="modal-title">Import Project from GitHub</h3>
- </div>
- <div class="modal-body">
- <p>Enter the GitHub repository URL:</p>
- <p><input id="importGithubURL" size="60" placeholder="https://github.com/user/repo"></input></p>
- <p>If the project is compatible with 8bitworkshop, it should build automatically.</p>
- <p>Otherwise, some work may be required -- make sure you've selected the correct platform.</p>
- <p>Source files must be in the root folder of the repository.</p>
- <p><button type="button" class="btn btn-primary" id="importGithubButton">Import Project</button></p>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
- </div>
- </div>
- </div>
-</div>
-<div id="publishGithubModal" class="modal fade">
- <div class="modal-dialog modal-md" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h3 class="modal-title">Publish Project on GitHub</h3>
- </div>
- <div class="modal-body">
- <p>This will migrate your existing project to a new GitHub repository.</p>
- <p>https://github.com/username/&nbsp;<input id="githubRepoName" size="35" placeholder="Enter a project name"></input></p>
- <p><input id="githubRepoDesc" size="60" placeholder="Enter a project description"></input></p>
- <p>Your repository will be <select id="githubRepoPrivate">
- <option value="public">Public</option>
- <option value="private">Private</option>
- </select></p>
- <p>License: <select id="githubRepoLicense">
- <option value="">Will decide later / all rights reserved</option>
- <option value="cc0-1.0">CC Zero (public domain, remix-friendly)</option>
- <option value="mit">MIT (must preserve notices)</option>
- <option value="cc-by-4.0">CC BY (must attribute)</option>
- <option value="cc-by-sa-4.0">CC BY-SA (must attribute, use same license)</option>
- <option value="gpl-3.0">GPL v3 (must publish source)</option>
- </select></p>
- <p><button type="button" class="btn btn-primary" id="publishGithubButton">Upload Project</button></p>
- <p>Your existing file will be moved to a new folder in the IDE.</p>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
- </div>
- </div>
- </div>
-</div>
-<div id="pushGithubModal" class="modal fade">
- <div class="modal-dialog modal-md" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h3 class="modal-title">Push Project Changes to GitHub</h3>
- </div>
- <div class="modal-body">
- <p><input id="githubCommitMsg" size="50" placeholder="Enter a commit message"></input></p>
- <p><button type="button" class="btn btn-primary" id="pushGithubButton">Push Changes</button></p>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
- </div>
- </div>
- </div>
-</div>
<script src="jquery/jquery.min.js"></script>
@@ -635,12 +435,5 @@
startUI();
</script>
-<script>
-/*
- var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
- if (!isFirefox && platform_id != 'vcs') { $("#best_in_firefox").show(); }
-*/
-</script>
-
</body>
</html>

View File

@ -1,441 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>8bitworkshop IDE</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=yes">
<style type="text/css" media="screen">
body {
overflow: hidden;
font-size: 11px;
}
</style>
<link rel="stylesheet" href="css/ui.css">
</head>
<body>
<!-- for file upload -->
<input type="file" id="uploadFileElem" multiple accept="*" style="display:none" onchange="handleFileUpload(this.files)">
<div id="controls_top" class="disable-select">
<div id="controls_dynamic" style="visibility:hidden">
<!-- main menu -->
<span class="dropdown">
<a class="btn dropdown-toggle toolbarMenuButton" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Menu">
<span class="glyphicon glyphicon-menu-hamburger" aria-hidden="true"></span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-left" aria-labelledby="dropdownMenuButton" style="left:auto">
<li><a class="dropdown-item" href="#" id="item_new_file">New Project...</a></li>
<li><a class="dropdown-item" href="#" id="item_upload_file">Upload...</a></li>
<hr>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">File</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#" id="item_reset_file">Revert to Original...</a></li>
<li><a class="dropdown-item" href="#" id="item_rename_file">Rename File...</a></li>
<li><a class="dropdown-item" href="#" id="item_delete_file">Delete File...</a></li>
<hr>
<li><a class="dropdown-item" href="#" id="item_addfile_include">Add Include File...</a></li>
<li><a class="dropdown-item" href="#" id="item_addfile_link">Add Linked File...</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Download</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#" id="item_download_file">Download Source File</a></li>
<li><a class="dropdown-item" href="#" id="item_download_rom">Download ROM Image</a></li>
<li><a class="dropdown-item" href="#" id="item_download_zip">Download Project as ZIP</a></li>
<li><a class="dropdown-item" href="#" id="item_download_allzip">Download All Changes as ZIP</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Share</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#" id="item_share_file">Share Playable Link...</a></li>
<li><a class="dropdown-item" href="#" id="item_record_video">Record Video...</a></li>
<li><a class="dropdown-item" href="#" id="item_export_cassette">Make Cassette Audio...</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Debug</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#" id="item_debug_expr">Break Expression...</a></li>
</ul>
</li>
</ul>
</span>
<!-- PLATFORMS menu -->
<span class="dropdown">
<a class="btn dropdown-toggle toolbarMenuButton" id="platformsMenuButton" style="min-width:90px" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="platform_name">PLATFORMS</span> <span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="platformsMenuButton">
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Game Consoles</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=vcs">Atari 2600</a></li>
<li><a class="dropdown-item" href="?platform=nes">NES</a></li>
<hr>
<li><a class="dropdown-item" href="?platform=astrocade">Bally Astrocade</a></li>
<li><a class="dropdown-item" href="?platform=coleco">ColecoVision</a></li>
<li><a class="dropdown-item" href="?platform=sms-sg1000-libcv">Sega SG-1000</a></li>
<li><a class="dropdown-item" href="?platform=sms-sms-libcv">Sega Master System</a></li>
<li><a class="dropdown-item" href="?platform=atari7800">Atari 7800</a></li>
<!--
<li><a class="dropdown-item" href="?platform=vectrex">Vectrex</a></li>
-->
</ul>
</li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Computers</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=c64">Commodore 64</a></li>
<li><a class="dropdown-item" href="?platform=msx">MSX (BIOS)</a></li>
<li><a class="dropdown-item" href="?platform=msx-libcv">MSX (libCV)</a></li>
<li><a class="dropdown-item" href="?platform=apple2">Apple ][+</a></li>
<li><a class="dropdown-item" href="?platform=zx">ZX Spectrum</a></li>
<li><a class="dropdown-item" href="?platform=x86">x86 (FreeDOS)</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Arcade Systems</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=vicdual">VIC Dual</a></li>
<li><a class="dropdown-item" href="?platform=mw8080bw">Midway 8080</a></li>
<li><a class="dropdown-item" href="?platform=galaxian-scramble">Galaxian/Scramble</a></li>
<li><a class="dropdown-item" href="?platform=vector-z80color">Atari Color Vector (Z80)</a></li>
<li><a class="dropdown-item" href="?platform=vector-ataricolor">Atari Color Vector (6502)</a></li>
<li><a class="dropdown-item" href="?platform=williams-z80">Williams (Z80)</a></li>
<li><a class="dropdown-item" href="?platform=sound_williams-z80">Williams Sound (Z80)</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Hardware</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=verilog">Verilog</a></li>
<li><a class="dropdown-item" href="?platform=verilog-vga">Verilog (VGA @ 25 Mhz)</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Interpreters</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=basic">BASIC</a></li>
<li><a class="dropdown-item" href="?platform=zmachine">Z-Machine</a></li>
<li><a class="dropdown-item" href="?platform=markdown">Markdown Text Editor</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">MAME Emulators</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=atari8-800xl.mame">Atari 800XL (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=atari8-5200.mame">Atari 5200 (MAME)</a></li>
<hr>
<li><a class="dropdown-item" href="?platform=vcs.mame">Atari 2600 (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=coleco.mame">ColecoVision (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=nes.mame">NES (MAME)</a></li>
</ul>
</li>
</ul>
</span>
<!-- project selector -->
<span id="repo_name" class="hidden-sm" style="color:#eee; font-size: small"></span>
<select id="preset_select" name="" title="Project Select" style="max-width:20em;visibility:hidden;height:2.3em">
</select>
<img id="compile_spinner" src="images/spinner.gif" style="visibility:hidden;margin-left:8px;margin-right:8px;height:2em">
<span id="toolbar" class="hidden-xs"></span>
<span class="btn_group view_group hidden-sm hidden-xs" id="speed_bar" style="display:none">
<button id="dbg_slowest" class="btn" title="Slowest"><span class="glyphicon glyphicon-fast-backward" aria-hidden="true"></span></button>
<button id="dbg_slower" class="btn" title="Slower"><span class="glyphicon glyphicon-backward" aria-hidden="true"></span></button>
<span class="label"><span id="fps_label">60.00</span> fps</span>
<button id="dbg_faster" class="btn" title="Faster"><span class="glyphicon glyphicon-forward" aria-hidden="true"></span></button>
<button id="dbg_fastest" class="btn" title="Faster"><span class="glyphicon glyphicon-fast-forward" aria-hidden="true"></span></button>
</span>
<span id="verilog_bar" style="display:none">
<span class="label"><span id="settle_label"></span> evals/clk</span>
</span>
<!-- 8bitworkshop logo -->
<span class="logo-gradient hidden-xs hidden-sm hidden-md pull-right" style="margin-left:auto" onclick="window.open('/','_8bitws');">8bitworkshop</span>
</div><!-- controls_dynamic -->
</div><!-- controls_top -->
<div id="notebook">
<div id="sidebar">
<ul id="windowMenuList">
</ul>
</div>
<div id="workspace">
</div>
<div class="emulator disable-select" id="emulator">
<!-- replay slider -->
<div id="replaydiv" class="replaydiv" style="display:none;color:#ccc;text-align:left">
<div style="display:grid; grid-template-columns: 3em 3em auto 3em; grid-gap: 1em">
<button id="replay_back" class="btn" title="Back one frame"><span class="glyphicon glyphicon-backward" aria-hidden="true"></span></button>
<div>
Frame<br>
<span id="replay_frame" style="width:3em">-</span>
</div>
<input type="range" min="0" max="0" value="0" class="slider" id="replayslider">
<button id="replay_fwd" class="btn" title="Ahead one frame"><span class="glyphicon glyphicon-forward" aria-hidden="true"></span></button>
<button id="clock_back" class="btn" title="Back one step"><span class="glyphicon glyphicon-backward" aria-hidden="true"></span></button>
<div>
Step<br>
<span id="replay_clock" style="width:3em">-</span>
</div>
<input type="range" min="0" max="0" value="0" class="slider" id="clockslider">
<button id="clock_fwd" class="btn" title="Forward one step"><span class="glyphicon glyphicon-forward" aria-hidden="true"></span></button>
</div>
</div>
<!-- emulator video -->
<div id="emuscreen">
</div>
<!-- for Javatari only -->
<div id="javatari-div" style="float:center;margin:10px;display:none">
<div id="javatari-screen" style="margin: 0 auto; box-shadow: 2px 2px 10px rgb(60, 60, 60);"></div>
<div id="javatari-console-panel" style="margin: 0 auto; box-shadow: 2px 2px 10px rgb(60, 60, 60);"></div>
</div>
<!-- control instructions -->
<div class="emucontrols-vcs emucontrols-c64 text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joystick</span>
<span class="control-def"><span class="control-key small">Space</span> Button</span>
</div>
<div class="emucontrols-nes emucontrols-atari7800 text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joypad</span>
<span class="control-def"><span class="control-key small">Space</span> Button A</span>
<span class="control-def"><span class="control-key small">Shift</span> Button B</span>
<span class="control-def"><span class="control-key small">\</span> Select</span>
<span class="control-def"><span class="control-key small">Enter</span> Start</span>
</div>
<div class="emucontrols-msx emucontrols-coleco emucontrols-sms text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joypad</span>
<span class="control-def"><span class="control-key small">Space</span> Button A</span>
<span class="control-def"><span class="control-key small">Shift</span> Button B</span>
</div>
<div class="emucontrols-vicdual emucontrols-galaxian emucontrols-vector text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joystick</span>
<span class="control-def"><span class="control-key small">Space</span> Button 1</span>
<span class="control-def"><span class="control-key small">Shift</span> Button 2</span>
<span class="control-def"><span class="control-key">\</span> Coin</span>
<span class="control-def"><span class="control-key small">Enter</span> Start</span>
</div>
<div class="emucontrols-mw8080bw text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&nbsp;&#x2192;</span> Joystick</span>
<span class="control-def"><span class="control-key small">Space</span> Fire</span>
</div>
<div class="emucontrols-williams text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">A W S D</span> Move</span>
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Fire</span>
<span class="control-def"><span class="control-key">\</span> Coin</span>
<span class="control-def"><span class="control-key small">Enter</span> Start</span>
<span class="control-def"><span class="control-key small">6 7 8 9</span> Extra</span>
</div>
<div class="emucontrols-astrocade text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joystick</span>
<span class="control-def"><span class="control-key small">Space</span> Trigger</span>
<span class="control-def"><span class="control-key small">Mouse X</span> Knob</span>
<span class="control-def"><span class="control-key small" style="display:inline-block;font-family:monospace">
U I O P<br>
J K L /<br>
7 8 9 X<br>
4 5 6 -<br>
1 2 3 ,<br>
\ 0 . =</span> Keypad</span>
</div>
<div class="emucontrols-vectrex text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joystick</span>
<span class="control-def"><span class="control-key">Z X C V</span> Buttons</span>
</div>
<div class="emucontrols-atari8 text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joystick</span>
<span class="control-def"><span class="control-key">Z</span> Button 1</span>
<span class="control-def"><span class="control-key">X</span> Button 2</span>
<span class="control-def"><span class="control-key">1</span> Start</span>
</div>
<!-- -->
<div id="emuoverlay" class="emuoverlay" style="display:none">
</div>
</div>
<div id="mem_info" class="mem_info" style="display:none">
</div>
<div id="error_alert" class="alert alert-danger alert-dismissable" style="position:absolute;right:0;top:0;display:none">
<button type="button" class="close" onclick="$('.alert').hide()" aria-hidden="true">&times;</button>
<div id="error_alert_msg"></div>
</div>
</div>
<!--
<div class="twitbtn">
<a target="_new" href="https://twitter.com/8bitworkshop" class="twitter-follow-button" data-show-count="false">Follow @8bitworkshop</a>-->
<!--<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>-->
<!--</div>-->
<div id="pleaseWaitModal" class="modal fade">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-body">
Please wait...
<div class="progress">
<div class="progress-bar progress-bar-striped active" role="progressbar" id="pleaseWaitProgressBar">
</div>
</div>
</div>
</div>
</div>
</div>
<div id="videoPreviewModal" class="modal fade">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Video Preview - Right-click to save</h3>
</div>
<div class="modal-body">
<img id="videoPreviewImage">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div id="embedLinkModal" class="modal fade">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Share Playable Link</h3>
</div>
<div class="modal-body">
<p>Here's a direct link to a playable version of your game:</p>
<textarea rows="4" cols="80" id="embedLinkTextarea" class="cliptext"></textarea>
<button type="button" class="btn btn-primary" data-clipboard-target="#embedLinkTextarea">Copy Direct Link</button>
<p>You can also embed it into an IFRAME:</p>
<textarea rows="4" cols="80" id="embedIframeTextarea" class="cliptext"></textarea>
<button type="button" class="btn btn-primary" data-clipboard-target="#embedIframeTextarea">Copy IFRAME Tag</button>
<p id="embedAdviceWarnIE">Note: These links may be too long for IE/Edge browsers.</p>
<p id="embedAdviceWarnAll">Note: These links may be too long for some browsers.</p>
</div>
<div class="modal-footer">
Choose one (or none) then
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div id="debugExprModal" class="modal fade">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Break Expression</h3>
</div>
<div class="modal-body">
<p>Enter a break expression:</p>
<p><input id="debugExprInput" size="60"></input></p>
<p>Examples:</p>
<pre id="debugExprExamples"></pre>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="debugExprSubmit">Debug</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
<script src="jquery/jquery.min.js"></script>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="bootstrap/js/bootbox.all.min.js"></script>
<script src="src/codemirror/codemirror.js"></script>
<script src="codemirror/mode/clike/clike.js"></script>
<script src="codemirror/mode/z80/z80.js"></script>
<script src="codemirror/mode/verilog/verilog.js"></script>
<script src="codemirror/mode/markdown/markdown.js"></script>
<script src="codemirror/mode/javascript/javascript.js"></script>
<script src="codemirror/mode/gas/gas.js"></script>
<script src="src/codemirror/6502.js"></script>
<script src="src/codemirror/bataribasic.js"></script>
<script src="src/codemirror/inform6.js"></script>
<script src="src/codemirror/fastbasic.js"></script>
<script src="src/codemirror/basic.js"></script>
<script src="src/codemirror/wiz.js"></script>
<script src="src/codemirror/vasm.js"></script>
<link rel="stylesheet" href="css/codemirror.css">
<script src="codemirror/addon/edit/matchbrackets.js"></script>
<script src="codemirror/addon/search/search.js"></script>
<script src="codemirror/addon/search/searchcursor.js"></script>
<script src="codemirror/addon/search/jump-to-line.js"></script>
<script src="codemirror/addon/dialog/dialog.js"></script>
<script src="codemirror/addon/selection/active-line.js"></script>
<link rel="stylesheet" href="codemirror/addon/dialog/dialog.css">
<script src="javatari.js/release/javatari/javatari.js"></script>
<script src="jsnes/dist/jsnes.min.js"></script>
<script src="src/common/cpu/6809.js"></script>
<script src="lib/mousetrap.min.js"></script>
<script src="lib/mousetrap-global-bind.min.js"></script>
<!-- UI-only stuff -->
<link rel="stylesheet" href="lib/bootstrap-tourist.css">
<script src="lib/bootstrap-tourist.js"></script>
<script src="lib/FileSaver.min.js"></script>
<script src="lib/localforage.min.js"></script>
<script src="lib/split.min.js"></script>
<script>
var exports = {};
function require(modname) {
if (modname == 'jquery') return $;
else if (modname.startsWith('.')) return exports;
else { console.log("Unknown require()", modname); return exports; }
}
</script>
<script src="lib/octokat.js"></script>
<script src="tss/js/tss/PsgDeviceChannel.js"></script>
<script src="tss/js/tss/MasterChannel.js"></script>
<script src="tss/js/tss/AudioLooper.js"></script>
<script src="tss/js/Log.js"></script>
<script src="gen/ide/vlist.js"></script>
<script src="gen/common/video/tms9918a.js"></script>
<script src="gen/common/util.js"></script>
<script src="gen/ide/store.js"></script>
<script src="gen/common/emu.js"></script>
<script src="gen/common/baseplatform.js"></script>
<script src="gen/common/analysis.js"></script>
<script src="gen/common/audio.js"></script>
<script src="gen/common/cpu/disasm6502.js"></script>
<script src="gen/common/cpu/disasmz80.js"></script>
<script src="gen/common/workertypes.js"></script>
<script src="gen/ide/project.js"></script>
<script src="gen/ide/windows.js"></script>
<script src="gen/ide/views.js"></script>
<script src="gen/common/recorder.js"></script>
<script src="gen/ide/waveform.js"></script>
<script src="gen/ide/pixeleditor.js"></script>
<script src="gen/ide/services.js"></script>
<script src="gen/ide/ui.js"></script>
<script src="gen/common/devices.js"></script>
<script src="gen/common/cpu/MOS6502.js"></script>
<script src="gen/common/cpu/ZilogZ80.js"></script>
<script src="gen/common/cpu/ARM.js"></script>
<script src="gen/machine/vdp_z80.js"></script>
<script>
// submenus open on click + hover
$( ".dropdown-submenu" ).click(function(event) {
event.stopPropagation();
$(this).parent().siblings().removeClass('open');
$(this).parent().toggleClass('open');
});
</script>
<script>
startUI();
</script>
</body>
</html>

View File

@ -1,255 +0,0 @@
"use strict";
const { app, dialog, Menu, BrowserWindow } = require('electron')
const _path = require('path')
const isMac = process.platform === 'darwin'
const homeDirectory = require('os').homedir();
const wsroot = process.env.HOME_8BITWORKSHOP || _path.join(homeDirectory, '8bitworkshop');
// call updater
require('update-electron-app')()
// init sentry
require('@sentry/electron').init({ dsn: "https://bf329df3d1b34afa9f5b5e8ecd80ad11@o320878.ingest.sentry.io/1813925" });
function openURL(url) {
return async () => {
const { shell } = require('electron')
await shell.openExternal(url);
}
}
function createWindow (platform, repo, mainfile) {
// Create the browser window.
const win = new BrowserWindow({
width: 1024,
height: 768,
backgroundColor: '#fff',
webPreferences: {
preload: _path.join(__dirname, './electron-preload.js'),
nodeIntegration: false,
enableRemoteModule: false,
contextIsolation: false,
sandbox: false,
}
})
// and load the index.html of the app.
var qs = 'electron=1&';
if (platform != null) {
qs += 'platform=' + platform + '&';
}
if (mainfile != null) {
qs += 'file=' + mainfile + '&'
}
qs += 'repo=' + (repo || '/');
win.loadFile('electron.html', {
search: qs
});
// Maximize
win.maximize();
return win;
}
// TODO: doesn't work if browser window reloads itself
function reloadCurrentWindow() {
var wnd = BrowserWindow.getFocusedWindow();
wnd.reload();
}
function openWorkspaceWindow(mainfilepath) {
var relpath = _path.relative(wsroot, mainfilepath);
if (relpath.startsWith('.')) {
dialog.showErrorBox('Error', `Your workspace directory must be directly under "${wsroot}/<platform>/"`);
return;
}
var toks = relpath.split(_path.sep);
if (toks.length < 3) {
dialog.showErrorBox('Error', `You must create a directory for your project, e.g. "${toks[0]||'<platform>'}/myproject/"`);
return;
}
if (toks.length > 3) {
dialog.showErrorBox('Error', `Your main file must be directly under "${wsroot}/<platform>/<project>/"`);
return;
}
var wnd = BrowserWindow.getFocusedWindow();
if (wnd) wnd.close();
createWindow(toks[0], toks[0] + '/' + toks[1], toks[2]);
}
function openWorkspaceDialog() {
dialog.showOpenDialog({
title: "Open Project",
defaultPath: wsroot,
properties: ['openFile', 'promptToCreate'],
message: "Choose the main source file in your project directory (i.e. ~/8bitworkshop/c64/myproject/main.c)",
}).then((rtn) => {
if (!rtn.canceled && rtn.filePaths && rtn.filePaths.length > 0) {
var path = rtn.filePaths[0];
if (path) {
openWorkspaceWindow(path);
}
}
});
}
///
function buildMenu() {
const template = [
// { role: 'appMenu' }
...(isMac ? [{
label: app.name,
submenu: [
{ role: 'about' },
{ type: 'separator' },
{ role: 'services' },
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideothers' },
{ role: 'unhide' },
{ type: 'separator' },
{ role: 'quit' }
]
}] : []),
// { role: 'fileMenu' }
{
label: 'File',
submenu: [
{
label: 'Open Workspace...',
click: openWorkspaceDialog,
accelerator: 'CmdOrCtrl+O',
},
// When a file is requested from the recent documents menu, the open-file event of app module will be emitted for it.
{
"label":"Open Recent",
"role":"recentdocuments",
"submenu":[
{
"label":"Clear Recent",
"role":"clearrecentdocuments"
}
]
},
{ type: 'separator' },
isMac ? { role: 'close' } : { role: 'quit' }
]
},
// { role: 'editMenu' }
{
label: 'Edit',
submenu: [
{ role: 'undo' },
{ role: 'redo' },
{ type: 'separator' },
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
...(isMac ? [
{ role: 'pasteAndMatchStyle' },
{ role: 'delete' },
{ role: 'selectAll' },
{ type: 'separator' },
{
label: 'Speech',
submenu: [
{ role: 'startspeaking' },
{ role: 'stopspeaking' }
]
}
] : [
{ role: 'delete' },
{ type: 'separator' },
{ role: 'selectAll' }
])
]
},
// { role: 'viewMenu' }
{
label: 'View',
submenu: [
{
label: 'Reload Window',
click: reloadCurrentWindow
},
{ role: 'toggledevtools' },
{ type: 'separator' },
{ role: 'resetzoom' },
{ role: 'zoomin' },
{ role: 'zoomout' },
{ type: 'separator' },
{ role: 'togglefullscreen' }
]
},
// { role: 'windowMenu' }
{
label: 'Window',
submenu: [
{ role: 'minimize' },
{ role: 'zoom' },
...(isMac ? [
{ type: 'separator' },
{ role: 'front' },
{ type: 'separator' },
{ role: 'window' }
] : [
{ role: 'close' }
])
]
},
{
role: 'help',
submenu: [
{
label: 'IDE Help',
click: openURL('https://8bitworkshop.com/docs/docs/ide.html')
},
{
label: 'Latest News',
click: openURL('https://8bitworkshop.com/docs/blog.html')
},
{
label: 'Report an Issue',
click: openURL('https://github.com/sehugg/8bitworkshop/issues/new')
},
{ type: 'separator' },
{
label: 'Follow @8bitworkshop on Twitter',
click: openURL('https://twitter.com/8bitworkshop')
},
{
label: 'Become a Patreon',
click: openURL('https://www.patreon.com/8bitworkshop')
},
{
label: 'Buy 8bitworkshop Books',
click: openURL('https://www.amazon.com/s?k=8bitworkshop&i=stripbooks&dc&qid=1598884483&tag=pzp-20')
},
]
}
]
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
}
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
app.quit()
})
app.on('open-file', (event, path) => {
openWorkspaceWindow(path);
})
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(buildMenu).then(createWindow)

View File

@ -23,27 +23,9 @@ body {
</style>
<link rel="stylesheet" href="css/ui.css">
<!-- google analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
if (window.location.host.endsWith('8bitworkshop.com')) {
ga('create', 'UA-54497476-9', 'auto');
ga('set', 'anonymizeIp', true);
}
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- firebase libs -->
<script defer src="https://www.gstatic.com/firebasejs/8.3.2/firebase-app.js"></script>
<script defer src="https://www.gstatic.com/firebasejs/8.3.2/firebase-auth.js"></script>
<script defer src="config.js"></script>
</head>
<body>
<!-- for file upload -->
<input type="file" id="uploadFileElem" multiple accept="*" style="display:none" onchange="handleFileUpload(this.files)">
<div id="controls_top" class="disable-select">
<div id="controls_dynamic" style="visibility:hidden">
<!-- main menu -->
@ -55,6 +37,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<ul class="dropdown-menu dropdown-menu-left" aria-labelledby="dropdownMenuButton" style="left:auto">
<li><a class="dropdown-item" href="#" id="item_new_file">New Project...</a></li>
<li><a class="dropdown-item" href="#" id="item_upload_file">Upload...</a></li>
<!--
<li><a class="dropdown-item" href="#" id="item_open_directory">Open Local Directory...</a></li>
-->
<hr>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">File</a>
@ -94,6 +79,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<li><a class="dropdown-item" href="#" id="item_download_rom">Download ROM Image</a></li>
<li><a class="dropdown-item" href="#" id="item_download_zip">Download Project as ZIP</a></li>
<li><a class="dropdown-item" href="#" id="item_download_allzip">Download All Changes as ZIP</a></li>
<li><a class="dropdown-item" href="#" id="item_download_sym">Download Debug Symbols</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
@ -126,14 +112,19 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
</ul>
</li>
<hr>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Help</a>
<ul class="dropdown-menu" id="help_menu">
<li><a class="dropdown-item" target="_8bws_help" href="https://8bitworkshop.com/docs/docs/ide.html">IDE Help</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">About</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/">Website</a></li>
<li><a class="dropdown-item" target="_8bws_about" href="https://twitter.com/8bitworkshop">Twitter</a></li>
<li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/docs/blog.html">Latest News</a></li>
<li><a class="dropdown-item" target="_8bws_about" href="https://github.com/sehugg/8bitworkshop/issues/new">Report an Issue</a></li>
<li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/docs/docs/ide.html">User Manual</a></li>
<li><a class="dropdown-item" target="_8bws_help" href="https://8bitworkshop.com/">Website</a></li>
<li><a class="dropdown-item" target="_8bws_help" href="https://oldbytes.space/@8bitworkshop">Mastodon</a></li>
<li><a class="dropdown-item" target="_8bws_help" href="https://8bitworkshop.com/docs/blog.html">Latest News</a></li>
<li><a class="dropdown-item" target="_8bws_help" href="https://github.com/sehugg/8bitworkshop/issues/new">Report an Issue</a></li>
</ul>
</li>
<!--
@ -158,7 +149,10 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<li><a class="dropdown-item" href="?platform=coleco">ColecoVision</a></li>
<li><a class="dropdown-item" href="?platform=sms-sg1000-libcv">Sega SG-1000</a></li>
<li><a class="dropdown-item" href="?platform=sms-sms-libcv">Sega Master System</a></li>
<li><a class="dropdown-item" href="?platform=sms-gg-libcv">Sega Game Gear</a></li>
<li><a class="dropdown-item" href="?platform=atari8-5200">Atari 5200</a></li>
<li><a class="dropdown-item" href="?platform=atari7800">Atari 7800</a></li>
<li><a class="dropdown-item" href="?platform=pce">PC Engine</a></li>
<!--
<li><a class="dropdown-item" href="?platform=vectrex">Vectrex</a></li>
-->
@ -168,11 +162,12 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<a tabindex="-1" href="#">Computers</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=c64">Commodore 64</a></li>
<li><a class="dropdown-item" href="?platform=atari8-800">Atari 800</a></li>
<li><a class="dropdown-item" href="?platform=msx">MSX (BIOS)</a></li>
<li><a class="dropdown-item" href="?platform=msx-libcv">MSX (libCV)</a></li>
<li><a class="dropdown-item" href="?platform=apple2">Apple ][+</a></li>
<li><a class="dropdown-item" href="?platform=zx">ZX Spectrum</a></li>
<li><a class="dropdown-item" href="?platform=x86">x86 (FreeDOS)</a></li>
<li><a class="dropdown-item" href="?platform=cpc.6128">Amstrad CPC6128</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
@ -199,18 +194,21 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=basic">BASIC</a></li>
<li><a class="dropdown-item" href="?platform=zmachine">Z-Machine</a></li>
<li><a class="dropdown-item" href="?platform=markdown">Markdown Text Editor</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">MAME Emulators</a>
<a tabindex="-1" href="#">MAME/Other</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=atari8-800xl.mame">Atari 800XL (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=atari8-800.xlmame">Atari 800XL (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=atari8-5200.mame">Atari 5200 (MAME)</a></li>
<hr>
<li><a class="dropdown-item" href="?platform=vcs.stellerator">Atari 2600 (Stellerator)</a></li>
<li><a class="dropdown-item" href="?platform=vcs.mame">Atari 2600 (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=coleco.mame">ColecoVision (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=nes.mame">NES (MAME)</a></li>
<hr>
<li><a class="dropdown-item" href="?platform=williams">Williams (6809)</a></li>
<li><a class="dropdown-item" href="?platform=x86">x86 (FreeDOS)</a></li>
</ul>
</li>
</ul>
@ -222,7 +220,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
</select>
<img id="compile_spinner" src="images/spinner.gif" style="visibility:hidden;margin-left:8px;margin-right:8px;height:2em">
<span id="toolbar" class="hidden-xs"></span>
<span id="toolbar"></span>
<span class="btn_group view_group hidden-sm hidden-xs" id="speed_bar" style="display:none">
<button id="dbg_slowest" class="btn" title="Slowest"><span class="glyphicon glyphicon-fast-backward" aria-hidden="true"></span></button>
<button id="dbg_slower" class="btn" title="Slower"><span class="glyphicon glyphicon-backward" aria-hidden="true"></span></button>
@ -242,25 +240,25 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
</a>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="booksMenuButton">
<li>
<a class="dropdown-item dropdown-link book-vcs" target="_book_a2600" href="https://www.amazon.com/gp/product/1541021304/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&tag=pzp-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B01N4DSRIZ&linkId=04d39e274c06e6c93b93d20a9a977111">
<a class="dropdown-item dropdown-link book-vcs" target="_book_a2600" href="https://www.amazon.com/gp/product/1541021304/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1789&creative=9325&linkCode=as2&creativeASIN=B01N4DSRIZ">
<img src="images/book_a2600.png"/>
&nbsp;&nbsp;<span class="book-title">Making Games For The Atari 2600</span>
</a>
</li>
<li>
<a class="dropdown-item dropdown-link book-arcade" target="_book_arcade" href="https://www.amazon.com/gp/product/1545484759/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1545484759&linkCode=as2&tag=pzp-20&linkId=b27709c022d2ebe639e90316d9f4fd5b">
<a class="dropdown-item dropdown-link book-arcade" target="_book_arcade" href="https://www.amazon.com/gp/product/1545484759/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1545484759&linkCode=as2">
<img src="images/book_arcade.png"/>
&nbsp;&nbsp;<span class="book-title">Making 8-bit Arcade Games in C</span>
</a>
</li>
<li>
<a class="dropdown-item dropdown-link book-verilog" target="_book_verilog" href="https://www.amazon.com/gp/product/1728619440/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1728619440&linkCode=as2&tag=pzp-20&linkId=7237a25861cb6b49a4128ba53d84c3e2">
<a class="dropdown-item dropdown-link book-verilog" target="_book_verilog" href="https://www.amazon.com/gp/product/1728619440/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1728619440&linkCode=as2">
<img src="images/book_verilog.png"/>
&nbsp;&nbsp;<span class="book-title">Designing Video Game Hardware in Verilog</span>
</a>
</li>
<li>
<a class="dropdown-item dropdown-link book-nes" target="_book_nes" href="https://www.amazon.com/gp/product/1075952727/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1075952727&linkCode=as2&tag=pzp-20&linkId=633176e8b36fea7f927020e2c322d80a">
<a class="dropdown-item dropdown-link book-nes" target="_book_nes" href="https://www.amazon.com/gp/product/1075952727/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1075952727&linkCode=as2">
<img src="images/book_nes.png"/>
&nbsp;&nbsp;<span class="book-title">Making Games For The NES</span>
</a>
@ -268,8 +266,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
</ul>
</span>
<!-- 8bitworkshop logo -->
<span class="logo-gradient hidden-xs hidden-sm pull-right" style="margin-left:auto" onclick="window.open('/','_8bitws');">8bitworkshop</span>
<span class="logo-gradient pull-right" style="margin-left:auto" onclick="window.open('https://8bitworkshop.com/','_8bitws');">8bitworkshop</span>
</div><!-- controls_dynamic -->
</div><!-- controls_top -->
@ -317,18 +314,24 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joystick</span>
<span class="control-def"><span class="control-key small">Space</span> Button</span>
</div>
<div class="emucontrols-nes emucontrols-atari7800 text-center small control-insns" style="display:none">
<div class="emucontrols-nes emucontrols-atari7800 emucontrols-pce text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joypad</span>
<span class="control-def"><span class="control-key small">Space</span> Button A</span>
<span class="control-def"><span class="control-key small">Shift</span> Button B</span>
<span class="control-def"><span class="control-key small">\</span> Select</span>
<span class="control-def"><span class="control-key small">Enter</span> Start</span>
</div>
<div class="emucontrols-msx emucontrols-coleco emucontrols-sms text-center small control-insns" style="display:none">
<div class="emucontrols-msx emucontrols-coleco text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joypad</span>
<span class="control-def"><span class="control-key small">Space</span> Button A</span>
<span class="control-def"><span class="control-key small">Shift</span> Button B</span>
</div>
<div class="emucontrols-sms text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joypad</span>
<span class="control-def"><span class="control-key small">Space</span> Button A</span>
<span class="control-def"><span class="control-key small">Shift</span> Button B</span>
<span class="control-def"><span class="control-key small">Enter</span> Start</span>
</div>
<div class="emucontrols-vicdual emucontrols-galaxian emucontrols-vector text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joystick</span>
<span class="control-def"><span class="control-key small">Space</span> Button 1</span>
@ -365,15 +368,18 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
</div>
<div class="emucontrols-atari8 text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joystick</span>
<span class="control-def"><span class="control-key">Z</span> Button 1</span>
<span class="control-def"><span class="control-key">X</span> Button 2</span>
<span class="control-def"><span class="control-key">1</span> Start</span>
<span class="control-def"><span class="control-key">Shift</span> Button</span>
<span class="control-def"><span class="control-key">F1</span> Start</span>
<span class="control-def"><span class="control-key">F2</span> Select</span>
<span class="control-def"><span class="control-key">F3</span> Option</span>
</div>
<!-- -->
<div id="emuoverlay" class="emuoverlay" style="display:none">
</div>
</div>
<div id="mem_info" class="mem_info" style="display:none">
<div><button type="button" class="close" onclick="$('.mem_info').hide()" aria-hidden="true">&times;</button></div>
<div id="mem_info_msg" class="mem_info_msg"></div>
</div>
<div id="error_alert" class="alert alert-danger alert-dismissable" style="position:absolute;right:0;top:0;display:none">
<button type="button" class="close" onclick="$('.alert').hide()" aria-hidden="true">&times;</button>
@ -528,6 +534,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="bootstrap/js/bootbox.all.min.js"></script>
<link rel="stylesheet" href="lib/bootstrap-tourist.css">
<script src="src/codemirror/codemirror.js"></script>
<script src="codemirror/mode/clike/clike.js"></script>
@ -543,6 +550,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<script src="src/codemirror/basic.js"></script>
<script src="src/codemirror/wiz.js"></script>
<script src="src/codemirror/vasm.js"></script>
<script src="src/codemirror/ecs.js"></script>
<link rel="stylesheet" href="css/codemirror.css">
<script src="codemirror/addon/edit/matchbrackets.js"></script>
<script src="codemirror/addon/search/search.js"></script>
@ -551,57 +559,14 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<script src="codemirror/addon/dialog/dialog.js"></script>
<script src="codemirror/addon/selection/active-line.js"></script>
<link rel="stylesheet" href="codemirror/addon/dialog/dialog.css">
<script src="javatari.js/release/javatari/javatari.js"></script>
<script src="jsnes/dist/jsnes.min.js"></script>
<script src="src/common/cpu/6809.js"></script>
<script src="lib/mousetrap.min.js"></script>
<script src="lib/mousetrap-global-bind.min.js"></script>
<!-- UI-only stuff -->
<link rel="stylesheet" href="lib/bootstrap-tourist.css">
<script src="lib/bootstrap-tourist.js"></script>
<script src="lib/FileSaver.min.js"></script>
<script src="lib/localforage.min.js"></script>
<script src="lib/split.min.js"></script>
<script>
var exports = {};
function require(modname) {
if (modname == 'jquery') return $;
else if (modname.startsWith('.')) return exports;
else { console.log("Unknown require()", modname); return exports; }
}
</script>
<script src="lib/octokat.js"></script>
<script src="tss/js/tss/PsgDeviceChannel.js"></script>
<script src="tss/js/tss/MasterChannel.js"></script>
<script src="tss/js/tss/AudioLooper.js"></script>
<script src="tss/js/Log.js"></script>
<script src="gen/ide/vlist.js"></script>
<script src="gen/common/video/tms9918a.js"></script>
<script src="gen/common/util.js"></script>
<script src="gen/ide/store.js"></script>
<script src="gen/common/emu.js"></script>
<script src="gen/common/baseplatform.js"></script>
<script src="gen/common/analysis.js"></script>
<script src="gen/common/audio.js"></script>
<script src="gen/common/cpu/disasm6502.js"></script>
<script src="gen/common/cpu/disasmz80.js"></script>
<script src="gen/common/workertypes.js"></script>
<script src="gen/ide/project.js"></script>
<script src="gen/ide/windows.js"></script>
<script src="gen/ide/views.js"></script>
<script src="gen/common/recorder.js"></script>
<script src="gen/ide/waveform.js"></script>
<script src="gen/ide/pixeleditor.js"></script>
<script src="gen/ide/services.js"></script>
<script src="gen/ide/ui.js"></script>
<script src="gen/common/devices.js"></script>
<script src="gen/common/cpu/MOS6502.js"></script>
<script src="gen/common/cpu/ZilogZ80.js"></script>
<script src="gen/common/cpu/ARM.js"></script>
<script src="gen/machine/vdp_z80.js"></script>
<!-- main IDE module -->
<script src="gen/ui.js" type="module"></script>
<script>
// submenus open on click + hover
@ -612,31 +577,20 @@ $( ".dropdown-submenu" ).click(function(event) {
});
</script>
<script>
startUI();
</script>
<!-- Sentry error reporting -->
<script
src="https://browser.sentry-cdn.com/6.4.1/bundle.min.js"
integrity="sha384-THoc7rflwZFKTdZNgv6jLFFDn299Uv3t1SW5B4yGLvLiCRTYP9ys6vXZcMl95TQF"
crossorigin="anonymous"
></script>
<script src='https://js.sentry-cdn.com/1fdd10e76a524c6e8d1e0a47f215fb28.min.js' crossorigin="anonymous"></script>
<script>
Sentry.init({
dsn: 'https://bf329df3d1b34afa9f5b5e8ecd80ad11@o320878.ingest.sentry.io/1813925',
beforeBreadcrumb(breadcrumb, hint) {
if (breadcrumb.category === 'xhr' && typeof breadcrumb.data.url === 'string') {
if (breadcrumb.data.url.startsWith('http')) return null; // discard external scripts
}
return breadcrumb;
},
beforeSend(event, hint) {
const error = hint.originalException;
if (error instanceof EmuHalt) return null; // ignore EmuHalt
return event;
},
});
if (window.Sentry) Sentry.onLoad(function() {
Sentry.init({
sampleRate: window.location.host.endsWith('8bitworkshop.com') ? 0.5 : 0.05,
beforeSend(event, hint) {
const error = hint.originalException;
if (error && error.hasOwnProperty('$loc')) return null; // ignore EmuHalt
if (error && error.squelchError) return null; // ignore EmuHalt
return event;
},
});
});
</script>
</body>

@ -1 +1 @@
Subproject commit 9d124f087e1f0c7f74f9244b9679cc62e71fa524
Subproject commit 113cd5741e5c414bbbe47ef8be7a896652d48f64

File diff suppressed because one or more lines are too long

View File

@ -1,3 +0,0 @@
(function(a,b){if("function"==typeof define&&define.amd)define([],b);else if("undefined"!=typeof exports)b();else{b(),a.FileSaver={exports:{}}.exports}})(this,function(){"use strict";function b(a,b){return"undefined"==typeof b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Deprecated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(a,b,c){var d=new XMLHttpRequest;d.open("GET",a),d.responseType="blob",d.onload=function(){g(d.response,b,c)},d.onerror=function(){console.error("could not download file")},d.send()}function d(a){var b=new XMLHttpRequest;b.open("HEAD",a,!1);try{b.send()}catch(a){}return 200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0,a=f.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),g=f.saveAs||("object"!=typeof window||window!==f?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement("a");g=g||b.name||"download",j.download=g,j.rel="noopener","string"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target="_blank")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href)},4E4),setTimeout(function(){e(j)},0))}:"msSaveOrOpenBlob"in navigator?function(f,g,h){if(g=g||f.name||"download","string"!=typeof f)navigator.msSaveOrOpenBlob(b(f,h),g);else if(d(f))c(f,g,h);else{var i=document.createElement("a");i.href=f,i.target="_blank",setTimeout(function(){e(i)})}}:function(b,d,e,g){if(g=g||open("","_blank"),g&&(g.document.title=g.document.body.innerText="downloading..."),"string"==typeof b)return c(b,d,e);var h="application/octet-stream"===b.type,i=/constructor/i.test(f.HTMLElement)||f.safari,j=/CriOS\/[\d]+/.test(navigator.userAgent);if((j||h&&i||a)&&"undefined"!=typeof FileReader){var k=new FileReader;k.onloadend=function(){var a=k.result;a=j?a:a.replace(/^data:[^;]*;/,"data:attachment/file;"),g?g.location.href=a:location=a,g=null},k.readAsDataURL(b)}else{var l=f.URL||f.webkitURL,m=l.createObjectURL(b);g?g.location=m:location.href=m,g=null,setTimeout(function(){l.revokeObjectURL(m)},4E4)}});f.saveAs=g.saveAs=g,"undefined"!=typeof module&&(module.exports=g)});
//# sourceMappingURL=FileSaver.min.js.map

File diff suppressed because one or more lines are too long

173
lib/capstone-arm.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

13
lib/jszip.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
(function(a){var c={},d=a.prototype.stopCallback;a.prototype.stopCallback=function(e,b,a,f){return this.paused?!0:c[a]||c[f]?!1:d.call(this,e,b,a)};a.prototype.bindGlobal=function(a,b,d){this.bind(a,b,d);if(a instanceof Array)for(b=0;b<a.length;b++)c[a[b]]=!0;else c[a]=!0};a.init()})(Mousetrap);

11
lib/mousetrap.min.js vendored
View File

@ -1,11 +0,0 @@
/* mousetrap v1.6.5 craig.is/killing/mice */
(function(q,u,c){function v(a,b,g){a.addEventListener?a.addEventListener(b,g,!1):a.attachEvent("on"+b,g)}function z(a){if("keypress"==a.type){var b=String.fromCharCode(a.which);a.shiftKey||(b=b.toLowerCase());return b}return n[a.which]?n[a.which]:r[a.which]?r[a.which]:String.fromCharCode(a.which).toLowerCase()}function F(a){var b=[];a.shiftKey&&b.push("shift");a.altKey&&b.push("alt");a.ctrlKey&&b.push("ctrl");a.metaKey&&b.push("meta");return b}function w(a){return"shift"==a||"ctrl"==a||"alt"==a||
"meta"==a}function A(a,b){var g,d=[];var e=a;"+"===e?e=["+"]:(e=e.replace(/\+{2}/g,"+plus"),e=e.split("+"));for(g=0;g<e.length;++g){var m=e[g];B[m]&&(m=B[m]);b&&"keypress"!=b&&C[m]&&(m=C[m],d.push("shift"));w(m)&&d.push(m)}e=m;g=b;if(!g){if(!p){p={};for(var c in n)95<c&&112>c||n.hasOwnProperty(c)&&(p[n[c]]=c)}g=p[e]?"keydown":"keypress"}"keypress"==g&&d.length&&(g="keydown");return{key:m,modifiers:d,action:g}}function D(a,b){return null===a||a===u?!1:a===b?!0:D(a.parentNode,b)}function d(a){function b(a){a=
a||{};var b=!1,l;for(l in p)a[l]?b=!0:p[l]=0;b||(x=!1)}function g(a,b,t,f,g,d){var l,E=[],h=t.type;if(!k._callbacks[a])return[];"keyup"==h&&w(a)&&(b=[a]);for(l=0;l<k._callbacks[a].length;++l){var c=k._callbacks[a][l];if((f||!c.seq||p[c.seq]==c.level)&&h==c.action){var e;(e="keypress"==h&&!t.metaKey&&!t.ctrlKey)||(e=c.modifiers,e=b.sort().join(",")===e.sort().join(","));e&&(e=f&&c.seq==f&&c.level==d,(!f&&c.combo==g||e)&&k._callbacks[a].splice(l,1),E.push(c))}}return E}function c(a,b,c,f){k.stopCallback(b,
b.target||b.srcElement,c,f)||!1!==a(b,c)||(b.preventDefault?b.preventDefault():b.returnValue=!1,b.stopPropagation?b.stopPropagation():b.cancelBubble=!0)}function e(a){"number"!==typeof a.which&&(a.which=a.keyCode);var b=z(a);b&&("keyup"==a.type&&y===b?y=!1:k.handleKey(b,F(a),a))}function m(a,g,t,f){function h(c){return function(){x=c;++p[a];clearTimeout(q);q=setTimeout(b,1E3)}}function l(g){c(t,g,a);"keyup"!==f&&(y=z(g));setTimeout(b,10)}for(var d=p[a]=0;d<g.length;++d){var e=d+1===g.length?l:h(f||
A(g[d+1]).action);n(g[d],e,f,a,d)}}function n(a,b,c,f,d){k._directMap[a+":"+c]=b;a=a.replace(/\s+/g," ");var e=a.split(" ");1<e.length?m(a,e,b,c):(c=A(a,c),k._callbacks[c.key]=k._callbacks[c.key]||[],g(c.key,c.modifiers,{type:c.action},f,a,d),k._callbacks[c.key][f?"unshift":"push"]({callback:b,modifiers:c.modifiers,action:c.action,seq:f,level:d,combo:a}))}var k=this;a=a||u;if(!(k instanceof d))return new d(a);k.target=a;k._callbacks={};k._directMap={};var p={},q,y=!1,r=!1,x=!1;k._handleKey=function(a,
d,e){var f=g(a,d,e),h;d={};var k=0,l=!1;for(h=0;h<f.length;++h)f[h].seq&&(k=Math.max(k,f[h].level));for(h=0;h<f.length;++h)f[h].seq?f[h].level==k&&(l=!0,d[f[h].seq]=1,c(f[h].callback,e,f[h].combo,f[h].seq)):l||c(f[h].callback,e,f[h].combo);f="keypress"==e.type&&r;e.type!=x||w(a)||f||b(d);r=l&&"keydown"==e.type};k._bindMultiple=function(a,b,c){for(var d=0;d<a.length;++d)n(a[d],b,c)};v(a,"keypress",e);v(a,"keydown",e);v(a,"keyup",e)}if(q){var n={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",
18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},r={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},C={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},B={option:"alt",command:"meta","return":"enter",
escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},p;for(c=1;20>c;++c)n[111+c]="f"+c;for(c=0;9>=c;++c)n[c+96]=c.toString();d.prototype.bind=function(a,b,c){a=a instanceof Array?a:[a];this._bindMultiple.call(this,a,b,c);return this};d.prototype.unbind=function(a,b){return this.bind.call(this,a,function(){},b)};d.prototype.trigger=function(a,b){if(this._directMap[a+":"+b])this._directMap[a+":"+b]({},a);return this};d.prototype.reset=function(){this._callbacks={};
this._directMap={};return this};d.prototype.stopCallback=function(a,b){if(-1<(" "+b.className+" ").indexOf(" mousetrap ")||D(b,this.target))return!1;if("composedPath"in a&&"function"===typeof a.composedPath){var c=a.composedPath()[0];c!==a.target&&(b=c)}return"INPUT"==b.tagName||"SELECT"==b.tagName||"TEXTAREA"==b.tagName||b.isContentEditable};d.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)};d.addKeycodes=function(a){for(var b in a)a.hasOwnProperty(b)&&(n[b]=a[b]);p=null};
d.init=function(){var a=d(u),b;for(b in a)"_"!==b.charAt(0)&&(d[b]=function(b){return function(){return a[b].apply(a,arguments)}}(b))};d.init();q.Mousetrap=d;"undefined"!==typeof module&&module.exports&&(module.exports=d);"function"===typeof define&&define.amd&&define(function(){return d})}})("undefined"!==typeof window?window:null,"undefined"!==typeof window?document:null);

3
lib/split.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

31
lib/stellerator/stellerator.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -71,4 +71,14 @@ function string.tohex(str)
end))
end
function table.tojson(t)
local result = {}
for key, value in pairs(t) do
-- prepare json key-value pairs and save them in separate table
table.insert(result, string.format("\"%s\":\"%s\"", key, value))
end
-- get simple json string
return "{" .. table.concat(result, ",") .. "}"
end
print("parsed Lua debugger script")

View File

@ -1,5 +1,5 @@
--- index.html 2021-07-11 18:38:37.000000000 -0500
+++ electron.html 2021-07-10 13:34:48.000000000 -0500
--- index.html 2022-01-22 20:17:39.000000000 -0600
+++ electron.html 2022-01-24 15:54:13.000000000 -0600
@@ -3,18 +3,7 @@
<head>
@ -19,30 +19,17 @@
<style type="text/css" media="screen">
body {
overflow: hidden;
@@ -22,22 +11,6 @@
}
</style>
<link rel="stylesheet" href="css/ui.css">
-
-<!-- google analytics -->
-<script>
-window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
-if (window.location.host.endsWith('8bitworkshop.com')) {
- ga('create', 'UA-54497476-9', 'auto');
- ga('set', 'anonymizeIp', true);
-}
-</script>
-<script async src='https://www.google-analytics.com/analytics.js'></script>
-
-<!-- firebase libs -->
-<script defer src="https://www.gstatic.com/firebasejs/8.3.2/firebase-app.js"></script>
-<script defer src="https://www.gstatic.com/firebasejs/8.3.2/firebase-auth.js"></script>
-<script defer src="config.js"></script>
-
</head>
<body>
@@ -65,26 +38,6 @@
@@ -47,9 +36,6 @@
<ul class="dropdown-menu dropdown-menu-left" aria-labelledby="dropdownMenuButton" style="left:auto">
<li><a class="dropdown-item" href="#" id="item_new_file">New Project...</a></li>
<li><a class="dropdown-item" href="#" id="item_upload_file">Upload...</a></li>
- <!--
- <li><a class="dropdown-item" href="#" id="item_open_directory">Open Local Directory...</a></li>
- -->
<hr>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">File</a>
@@ -60,26 +46,6 @@
<hr>
<li><a class="dropdown-item" href="#" id="item_addfile_include">Add Include File...</a></li>
<li><a class="dropdown-item" href="#" id="item_addfile_link">Add Linked File...</a></li>
@ -69,7 +56,7 @@
</ul>
</li>
<li class="dropdown dropdown-submenu">
@@ -110,35 +63,6 @@
@@ -105,35 +71,6 @@
<li><a class="dropdown-item" href="#" id="item_debug_expr">Break Expression...</a></li>
</ul>
</li>
@ -105,50 +92,34 @@
</ul>
</span>
@@ -234,41 +158,8 @@
<span class="label"><span id="settle_label"></span> evals/clk</span>
</span>
- <!-- BOOKS menu -->
- <span class="dropdown pull-right">
- <a class="btn dropdown-toggle hidden-xs hiddem-sm toolbarMenuButton" id="booksMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
- <span class="glyphicon glyphicon-book" aria-hidden="true"></span>
- Books <span class="caret"></span>
- </a>
- <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="booksMenuButton">
- <li>
- <a class="dropdown-item dropdown-link book-vcs" target="_book_a2600" href="https://www.amazon.com/gp/product/1541021304/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&tag=pzp-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B01N4DSRIZ&linkId=04d39e274c06e6c93b93d20a9a977111">
- <img src="images/book_a2600.png"/>
- &nbsp;&nbsp;<span class="book-title">Making Games For The Atari 2600</span>
- </a>
- </li>
- <li>
- <a class="dropdown-item dropdown-link book-arcade" target="_book_arcade" href="https://www.amazon.com/gp/product/1545484759/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1545484759&linkCode=as2&tag=pzp-20&linkId=b27709c022d2ebe639e90316d9f4fd5b">
- <img src="images/book_arcade.png"/>
- &nbsp;&nbsp;<span class="book-title">Making 8-bit Arcade Games in C</span>
- </a>
- </li>
- <li>
- <a class="dropdown-item dropdown-link book-verilog" target="_book_verilog" href="https://www.amazon.com/gp/product/1728619440/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1728619440&linkCode=as2&tag=pzp-20&linkId=7237a25861cb6b49a4128ba53d84c3e2">
- <img src="images/book_verilog.png"/>
- &nbsp;&nbsp;<span class="book-title">Designing Video Game Hardware in Verilog</span>
- </a>
- </li>
- <li>
- <a class="dropdown-item dropdown-link book-nes" target="_book_nes" href="https://www.amazon.com/gp/product/1075952727/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1075952727&linkCode=as2&tag=pzp-20&linkId=633176e8b36fea7f927020e2c322d80a">
- <img src="images/book_nes.png"/>
- &nbsp;&nbsp;<span class="book-title">Making Games For The NES</span>
- </a>
- </li>
- </ul>
- </span>
<!-- 8bitworkshop logo -->
- <span class="logo-gradient hidden-xs hidden-sm pull-right" style="margin-left:auto" onclick="window.open('/','_8bitws');">8bitworkshop</span>
+ <span class="logo-gradient hidden-xs hidden-sm hidden-md pull-right" style="margin-left:auto" onclick="window.open('/','_8bitws');">8bitworkshop</span>
</div><!-- controls_dynamic -->
</div><!-- controls_top -->
@@ -452,73 +343,6 @@
@@ -279,24 +216,21 @@
<div class="emulator disable-select" id="emulator">
<!-- replay slider -->
<div id="replaydiv" class="replaydiv" style="display:none;color:#ccc;text-align:left">
- <div style="display:grid; grid-template-columns: 3em 3em auto 1em 3em; grid-gap: 1em">
- <!-- first row -->
+ <div style="display:grid; grid-template-columns: 3em 3em auto 3em; grid-gap: 1em">
<button id="replay_back" class="btn" title="Back one frame"><span class="glyphicon glyphicon-backward" aria-hidden="true"></span></button>
<div>
Frame<br>
<span id="replay_frame" style="width:3em">-</span>
</div>
<input type="range" min="0" max="0" value="0" class="slider" id="replayslider">
- <div>&nbsp;</div>
<button id="replay_fwd" class="btn" title="Ahead one frame"><span class="glyphicon glyphicon-forward" aria-hidden="true"></span></button>
- <!-- second row -->
+
<button id="clock_back" class="btn" title="Back one step"><span class="glyphicon glyphicon-backward" aria-hidden="true"></span></button>
<div>
Step<br>
<span id="replay_clock" style="width:3em">-</span>
</div>
<input type="range" min="0" max="0" value="0" class="slider" id="clockslider">
- <div>&nbsp;</div>
<button id="clock_fwd" class="btn" title="Forward one step"><span class="glyphicon glyphicon-forward" aria-hidden="true"></span></button>
</div>
</div>
@@ -451,73 +385,6 @@
</div>
</div>
</div>
@ -222,32 +193,3 @@
<script src="jquery/jquery.min.js"></script>
@@ -613,28 +437,5 @@
startUI();
</script>
-<!-- Sentry error reporting -->
-<script
- src="https://browser.sentry-cdn.com/6.4.1/bundle.min.js"
- integrity="sha384-THoc7rflwZFKTdZNgv6jLFFDn299Uv3t1SW5B4yGLvLiCRTYP9ys6vXZcMl95TQF"
- crossorigin="anonymous"
-></script>
-<script>
-Sentry.init({
- dsn: 'https://bf329df3d1b34afa9f5b5e8ecd80ad11@o320878.ingest.sentry.io/1813925',
- beforeBreadcrumb(breadcrumb, hint) {
- if (breadcrumb.category === 'xhr' && typeof breadcrumb.data.url === 'string') {
- if (breadcrumb.data.url.startsWith('http')) return null; // discard external scripts
- }
- return breadcrumb;
- },
- beforeSend(event, hint) {
- const error = hint.originalException;
- if (error instanceof EmuHalt) return null; // ignore EmuHalt
- return event;
- },
-});
-</script>
-
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -3,7 +3,7 @@
test_settings: {
default: {
launch_url: 'https://8bitworkshop.com',
launch_url: 'https://sehugg.github.io/8bitworkshop/'
},
safari: {

21191
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,75 +1,86 @@
{
"name": "8bitworkshop",
"version": "3.8.0b2",
"version": "3.11.0",
"author": "Steven Hugg",
"category": "Development",
"description": "Desktop version of 8bitworkshop.com retro programming IDE",
"description": "8bitworkshop.com retro programming IDE",
"repository": {
"type": "git",
"url": "git+https://github.com/sehugg/8bitworkshop.git"
},
"license": "GPL-3.0",
"dependencies": {
"@sentry/electron": "^2.5.1",
"@types/dompurify": "^2.3.4",
"@types/emscripten": "^1.39.5",
"atob": "^2.1.x",
"binaryen": "^101.0.0",
"chokidar": "^3.5.0",
"jquery": "^3.5.1",
"reflect-metadata": "^0.1.13",
"update-electron-app": "^2.0.1"
"btoa": "^1.2.x",
"clipboard": "^2.0.6",
"dompurify": "^2.4.0",
"file-saver": "^2.0.5",
"jquery": "^3.6.3",
"jszip": "^3.7.0",
"localforage": "^1.9.0",
"mousetrap": "^1.6.5",
"octokat": "^0.10.0",
"split.js": "^1.6.2"
},
"devDependencies": {
"@types/bootbox": "^5.1.3",
"@types/bootstrap": "^3.4.0",
"@types/file-saver": "^2.0.1",
"@types/expect": "^24.3.0",
"@types/file-saver": "^2.0.3",
"@types/jquery": "^3.5.5",
"@types/mocha": "^9.1.0",
"@types/node": "^14.14.20",
"atob": "^2.1.x",
"bootstrap": "^3.4.1",
"bootstrap-tourist": "^0.2.1",
"btoa": "^1.2.x",
"chromedriver": "^90.0.1",
"clipboard": "^2.0.6",
"command-exists": "^1.2.9",
"electron": "^9.4.0",
"electron-builder": "^22.11.7",
"electron-packager": "^15.2.0",
"file-saver": "^2.0.5",
"heapdump": "^0.3.15",
"jsdom": "^12.2.0",
"jsfuzz": "^1.0.14",
"jszip": "^3.5.0",
"localforage": "^1.9.0",
"cors": "^2.8.5",
"esbuild": "^0.12.29",
"express": "^4.18.2",
"fast-png": "^5.0.4",
"jsdom": "^21.1.0",
"lzg": "^1.0.x",
"mocha": "^7.2.0",
"mocha": "^9.2.0",
"mocha-simple-html-reporter": "^2.0.0",
"mousetrap": "^1.6.5",
"nightwatch": "^1.6.4",
"octokat": "^0.10.0",
"pngjs": "^3.4.0",
"rgbquant": "^1.1.2",
"split.js": "^1.6.2",
"typedoc": "^0.21.0",
"typescript": "^4.3.4",
"typescript-formatter": "^7.2.2",
"vgm-parser": "^0.6.3"
"typescript": "^5.2.2",
"typescript-formatter": "^7.2.2"
},
"optionalDependencies": {
"chromedriver": "*",
"heapdump": "^0.3.15",
"jsfuzz": "^1.0.14",
"nightwatch": "*"
},
"overrides": {
"fetch-vcr": {
"node-fetch": "2.6.7"
}
},
"scripts": {
"build": "tsc --build tsconfig.json",
"build": "make prepare",
"test": "npm run test-node",
"tsbuild": "tsc --build tsconfig.json",
"esbuild": "npm run esbuild-worker && npm run esbuild-ui && npm run esbuild-server",
"esbuild-clean": "rm -f ./gen/*.*",
"esbuild-server": "esbuild src/worker/server/server.ts --platform=node --bundle --sourcemap --target=es2020 --outfile=./gen/server/server.js",
"esbuild-worker": "esbuild src/worker/workermain.ts --bundle --sourcemap --target=es2017 --outfile=./gen/worker/bundle.js",
"esbuild-ui": "esbuild src/ide/ui.ts src/ide/embedui.ts --splitting --format=esm --bundle --minify --sourcemap --target=es2017 --outdir=./gen/ --external:path --external:fs",
"server": "npm run esbuild-server && rm -fr ./server-root/sessions && node gen/server/server.js",
"test-one": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000",
"test-node": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 --reporter mocha-simple-html-reporter --reporter-options output=test/output/cli.html test/cli",
"test-profile": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 --prof test/cli",
"test-node": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 test/cli gen/test",
"test-profile": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 --prof test/cli gen/test",
"test-worker": "NODE_PATH=$(pwd) mocha --timeout 60000 test/cli/testworker.js",
"test-platforms": "NODE_PATH=$(pwd) mocha --timeout 60000 test/cli/testplatforms.js",
"test-verilog": "NODE_PATH=$(pwd) mocha --timeout 60000 --reporter mocha-simple-html-reporter --reporter-options output=test/output/verilog.html test/cli/testverilog.js",
"test-web": "nightwatch -e chrome test/web",
"start": "electron .",
"test-verilog": "NODE_PATH=$(pwd) mocha --timeout 60000 --reporter mocha-simple-html-reporter --reporter-options output=test/output/verilog.html test/verilog/testverilog.js",
"test-web-quick": "nightwatch -e chrome test/web/testembed.js",
"test-web-all": "nightwatch -e chrome test/web",
"fuzzbasic": "jsfuzz gen/common/basic/fuzz.js ~/basic/corpus/ --versifier false",
"fuzzhdl": "jsfuzz -r binaryen gen/common/hdl/fuzz.js ~/verilator/corpus/ --versifier false",
"machine": "node gen/tools/runmachine.js",
"mkdoc": "typedoc --out web/jsdoc src/common/"
},
"main": "electron.js",
"keywords": [
"8bit",
"ide",
@ -84,7 +95,7 @@
"build": {
"appId": "com.8bitworkshop.ide",
"icon": "meta/icons/8bitworkshop-icon-1024.png",
"copyright": "Copyright (c) 2021 Puzzling Plans LLC",
"copyright": "Copyright (c) 2023 Puzzling Plans LLC",
"linux": {
"category": "Development"
}

View File

@ -55,48 +55,13 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<script src="jquery/jquery.min.js"></script>
<script src="javatari.js/release/javatari/javatari.js"></script>
<script src="jsnes/dist/jsnes.min.js"></script>
<script src="src/common/cpu/6809.js"></script>
<script src="lib/FileSaver.min.js"></script>
<script src="lib/mousetrap.min.js"></script>
<script src="lib/mousetrap-global-bind.min.js"></script>
<script>
var exports = {};
function require(modname) {
if (modname == 'jquery') return $;
else if (modname.startsWith('.')) return exports;
else { console.log("Unknown require()", modname); return exports; }
}
</script>
<script src="tss/js/tss/PsgDeviceChannel.js"></script>
<script src="tss/js/tss/MasterChannel.js"></script>
<script src="tss/js/tss/AudioLooper.js"></script>
<script src="tss/js/Log.js"></script>
<script src="gen/common/video/tms9918a.js"></script>
<script src="gen/common/util.js"></script>
<script src="gen/common/emu.js"></script>
<script src="gen/common/baseplatform.js"></script>
<script src="gen/common/audio.js"></script>
<script src="gen/common/recorder.js"></script>
<script src="gen/common/devices.js"></script>
<script src="gen/common/cpu/MOS6502.js"></script>
<script src="gen/common/cpu/ZilogZ80.js"></script>
<script src="gen/machine/vdp_z80.js"></script>
<script src="gen/ide/embedui.js"></script>
<script src="lib/liblzg.js"></script>
<script>
// are we not in an iframe?
if(self === top) {
document.body.style.backgroundColor = '#555';
}
startEmbed();
</script>
<script src="gen/embedui.js" type="module"></script>
</body>
</html>

View File

@ -1,4 +1,9 @@
// reserve space for the HGR1 screen buffer
#define CFGFILE apple2-hgr.cfg
#pragma data-name(push,"HGR")
#pragma data-name(pop)
/*
* An Apple ][ port of the Cosmic Impalas game
* described in the book

55
presets/apple2/lz4test.c Normal file
View File

@ -0,0 +1,55 @@
/*
Test of the LZ4 decompression library
with a hires graphics image.
*/
// CC65 config, reserves space for the HGR1 screen buffer
#define CFGFILE apple2-hgr.cfg
#pragma data-name(push,"HGR")
// this segment is required, but we leave it empty
// since we're going to decompress the image here
#pragma data-name(pop)
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
#include <string.h>
#include <apple2.h>
#include <peekpoke.h>
#include <lz4.h>
// STROBE = write any value to an I/O address
#define STROBE(addr) __asm__ ("sta %w", addr)
// start address of the two hi-res graphics regions
#define HGR1 0x2000
#define HGR2 0x4000
// the LZ4 compressed data
const unsigned char BITMAP_DATA_LZ4[] = {
#embed "parrot-apple2.hires.lz4"
};
// clear screen and set graphics mode
void clear_hgr1() {
memset((char*)HGR1, 0, 0x2000); // clear page 1
STROBE(0xc052); // turn off mixed-mode
STROBE(0xc054); // page 1
STROBE(0xc057); // hi-res
STROBE(0xc050); // set graphics mode
}
int main (void)
{
// set hgr1 mode and clear
clear_hgr1();
// skip the header (usually 11 bytes)
decompress_lz4(BITMAP_DATA_LZ4+11, (char*)HGR1, 0x2000);
// wait for a key
cgetc();
return EXIT_SUCCESS;
}

View File

@ -1,3 +1,9 @@
// reserve space for the HGR1 screen buffer
#define CFGFILE apple2-hgr.cfg
#pragma data-name(push,"HGR")
#pragma data-name(pop)
/*
Test of the LZG decompression library
with a hires graphics image.
@ -38,7 +44,7 @@ void clrscr() {
int main (void)
{
clrscr();
lzg_decode_vram(BITMAP_DATA_LZG, (char*)0x2000, (char*)0x4000);
lzg_decode_vram(BITMAP_DATA_LZG, (unsigned char*)0x2000, (unsigned char*)0x4000);
printf("\nHello! Press a key to reboot...\n");
cgetc();
return EXIT_SUCCESS;

View File

@ -32,6 +32,7 @@
/* Workaround missing clock stuff */
#ifdef __APPLE2__
# define clock() 0
# undef CLK_TCK
# define CLK_TCK 1
#endif

Binary file not shown.

View File

@ -143,7 +143,7 @@ static void DoDiagram (void)
/* Calculate the next points */
X = (int) (((long) (MaxX - 19) * I) / 360);
Y = (int) (((long) Amp * -cc65_sin (I)) / 256);
Y = (int) (((long) Amp * -_sin (I)) / 256);
/* Draw the line */
tgi_lineto (XOrigin + X, YOrigin + Y);

View File

@ -0,0 +1,7 @@
#define SERIAL_OUT ((int*)0x4000048)
void putchar_(char c) {
*SERIAL_OUT = c;
}

35
presets/arm32/sieve.c Normal file
View File

@ -0,0 +1,35 @@
#include <string.h>
#include <stdio.h>
#define true 1
#define false 0
#define size 8190
#define sizepl 8191
//#link "serialout.c"
main() {
char flags[sizepl];
int i, prime, k, count, iter;
printf("Running benchmark...\n");
for (iter = 1; iter <= 10; iter ++) {
count=0;
for (i = 0; i <= size; i++)
flags[i] = true;
for (i = 0; i <= size; i++) {
if (flags[i]) {
prime = i + i + 3;
k = i + prime;
while (k <= size) {
flags[k] = false;
k += prime;
}
count = count + 1;
}
}
}
printf("Primes: %d\n", count);
return 0;
}

View File

@ -0,0 +1,11 @@
#include <string.h>
#include <stdio.h>
//#link "serialout.c"
int main() {
int x = 2024;
printf("Hello World! %d\n", x);
return 0;
}

25
presets/arm32/vidfill.c Normal file
View File

@ -0,0 +1,25 @@
const char const str[] = "HELLO WORLD!";
int global = 0x1234;
int global2 = 0x123456;
#define VIDBASE ((int*)0x4000080)
int vidbuf[160*128];
int main() {
*VIDBASE = (int)vidbuf;
global += str[0];
global++;
global2++;
int c = 0xff880000;
c += str[0];
int* p = (int*) vidbuf;
for (int i=0; i<160*128; i++) {
p[i] = c++;
}
return 0;
}

141
presets/atari7800/7800.h Normal file
View File

@ -0,0 +1,141 @@
; 7800.h
; Version 1.0, 2019/12/13
; This file defines hardware registers and memory mapping for the
; Atari 7800. It is distributed as a companion machine-specific support package
; for the DASM compiler. Updates to this file, DASM, and associated tools are
; available at https://github.com/dasm-assembler/dasm
; ******************** 7800 Hardware Adresses ***************************
;
; MEMORY MAP USAGE OF THE 7800
;
; 00 - 1F TIA REGISTERS
; 20 - 3F MARIA REGISTERS
; 40 - FF RAM block 0 (zero page)
; 100 - 11F TIA (mirror of 0000-001f)
; 120 - 13F MARIA (mirror of 0020-003f)
; 140 - 1FF RAM block 1 (stack)
; 200 - 21F TIA (mirror of 0000-001f)
; 220 - 23F MARIA (mirror of 0020-003f)
; 240 - 27F ???
; 280 - 2FF RIOT I/O ports and timers
; 300 - 31F TIA (mirror of 0000-001f)
; 320 - 33F MARIA (mirror of 0020-003f)
; 340 - 3FF ???
; 400 - 47F unused address space
; 480 - 4FF RIOT RAM
; 500 - 57F unused address space
; 580 - 5FF RIOT RAM (mirror of 0480-04ff)
; 600 - 17FF unused address space
; 1800 - 203F RAM
; 2040 - 20FF RAM block 0 (mirror of 0000-001f)
; 2100 - 213F RAM
; 2140 - 21FF RAM block 1 (mirror of 0140-01ff)
; 2200 - 27FF RAM
; 2800 - 2FFF mirror of 1800-27ff
; 3000 - 3FFF unused address space
; 4000 - FF7F potential cartridge address space
; FF80 - FFF9 RESERVED FOR ENCRYPTION
; FFFA - FFFF 6502 VECTORS
;****** 00-1F ********* TIA REGISTERS ******************
INPTCTRL = $01 ;Input control. In same address space as TIA. write-only
VBLANK = $01 ;VBLANK. D7=1:dump paddle caps to ground. write-only
INPT0 = $08 ;Paddle Control Input 0 read-only
INPT1 = $09 ;Paddle Control Input 1 read-only
INPT2 = $0A ;Paddle Control Input 2 read-only
INPT3 = $0B ;Paddle Control Input 3 read-only
; ** some common alternate names for INPT0/1/2/3
INPT4B = $08 ;Joystick 0 Fire 1 read-only
INPT4A = $09 ;Joystick 0 Fire 1 read-only
INPT5B = $0A ;Joystick 1 Fire 0 read-only
INPT5A = $0B ;Joystick 1 Fire 1 read-only
INPT4R = $08 ;Joystick 0 Fire 1 read-only
INPT4L = $09 ;Joystick 0 Fire 1 read-only
INPT5R = $0A ;Joystick 1 Fire 0 read-only
INPT5L = $0B ;Joystick 1 Fire 1 read-only
INPT4 = $0C ;Player 0 Fire Button Input read-only
INPT5 = $0D ;Player 1 Fire Button Input read-only
AUDC0 = $15 ;Audio Control Channel 0 write-only
AUDC1 = $16 ;Audio Control Channel 1 write-only
AUDF0 = $17 ;Audio Frequency Channel 0 write-only
AUDF1 = $18 ;Audio Frequency Channel 1 write-only
AUDV0 = $19 ;Audio Volume Channel 0 write-only
AUDV1 = $1A ;Audio Volume Channel 1 write-only
;****** 20-3F ********* MARIA REGISTERS ***************
BACKGRND = $20 ;Background Color write-only
P0C1 = $21 ;Palette 0 - Color 1 write-only
P0C2 = $22 ;Palette 0 - Color 2 write-only
P0C3 = $23 ;Palette 0 - Color 3 write-only
WSYNC = $24 ;Wait For Sync write-only
P1C1 = $25 ;Palette 1 - Color 1 write-only
P1C2 = $26 ;Palette 1 - Color 2 write-only
P1C3 = $27 ;Palette 1 - Color 3 write-only
MSTAT = $28 ;Maria Status read-only
P2C1 = $29 ;Palette 2 - Color 1 write-only
P2C2 = $2A ;Palette 2 - Color 2 write-only
P2C3 = $2B ;Palette 2 - Color 3 write-only
DPPH = $2C ;Display List List Pointer High write-only
P3C1 = $2D ;Palette 3 - Color 1 write-only
P3C2 = $2E ;Palette 3 - Color 2 write-only
P3C3 = $2F ;Palette 3 - Color 3 write-only
DPPL = $30 ;Display List List Pointer Low write-only
P4C1 = $31 ;Palette 4 - Color 1 write-only
P4C2 = $32 ;Palette 4 - Color 2 write-only
P4C3 = $33 ;Palette 4 - Color 3 write-only
CHARBASE = $34 ;Character Base Address write-only
CHBASE = $34 ;Character Base Address write-only
P5C1 = $35 ;Palette 5 - Color 1 write-only
P5C2 = $36 ;Palette 5 - Color 2 write-only
P5C3 = $37 ;Palette 5 - Color 3 write-only
OFFSET = $38 ;Unused - Store zero here write-only
P6C1 = $39 ;Palette 6 - Color 1 write-only
P6C2 = $3A ;Palette 6 - Color 2 write-only
P6C3 = $3B ;Palette 6 - Color 3 write-only
CTRL = $3C ;Maria Control Register write-only
P7C1 = $3D ;Palette 7 - Color 1 write-only
P7C2 = $3E ;Palette 7 - Color 2 write-only
P7C3 = $3F ;Palette 7 - Color 3 write-only
;****** 280-2FF ******* PIA PORTS AND TIMERS ************
SWCHA = $280 ;P0+P1 Joystick Directional Input read-write
CTLSWA = $281 ;I/O Control for SCHWA read-write
SWACNT = $281 ;VCS name for above read-write
SWCHB = $282 ;Console Switches read-write
CTLSWB = $283 ;I/O Control for SCHWB read-write
SWBCNT = $283 ;VCS name for above read-write
INTIM = $284 ;Iterval Timer Read read-only
TIM1T = $294 ;Set 1 CLK Interval (838 nsec/interval) write-only
TIM8T = $295 ;Set 8 CLK Interval (6.7 usec/interval) write-only
TIM64T = $296 ;Set 64 CLK Interval (63.6 usec/interval) write-only
T1024T = $297 ;Set 1024 CLK Interval (858.2 usec/interval) write-only
TIM64TI = $29E ;Interrupt timer 64T write-only
;XM
XCTRL = $470 ; 7=YM2151 6=RAM@6k 5=RAM@4k 4=pokey@450 3=hsc 2=cart 1=RoF_bank1 0=RoF_bank2
; Pokey register relative locations, since its base may be different
; depending on the hardware.
PAUDF0 = $0 ; extra audio channels and frequencies
PAUDC0 = $1
PAUDF1 = $2
PAUDC1 = $3
PAUDF2 = $4
PAUDC2 = $5
PAUDF3 = $6
PAUDC3 = $7
PAUDCTL = $8 ; Audio Control
PRANDOM = $A ; 17 bit polycounter pseudo random
PSKCTL = $F ; Serial Port control

View File

@ -0,0 +1,59 @@
// example from https://github.com/steux/cc7800 - license: GPLv3
#include "prosystem.h"
#include "multisprite.h"
char i, xpos, ypos;
#define NB_SMALL_SPRITES 128
ramchip short sp_xpos[NB_SMALL_SPRITES], sp_ypos[NB_SMALL_SPRITES];
ramchip char sp_direction[NB_SMALL_SPRITES];
const signed short dx[24] = {300, 289, 259, 212, 149, 77, 0, -77, -150, -212, -259, -289, -300, -289, -259, -212, -149, -77, 0, 77, 149, 212, 259, 289};
const signed short dy[24] = {0, 124, 240, 339, 415, 463, 480, 463, 415, 339, 240, 124, 0, -124, -239, -339, -415, -463, -480, -463, -415, -339, -240, -124};
const char horizontal_pingpong[24] = { 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13 };
const char vertical_pingpong[24] = { 0, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
// Generated with sprites7800 missile.yaml
holeydma reversed scattered(16,1) char missile[16] = {
0x18, 0x96, 0x7a, 0x7e, 0x7e, 0x6e, 0x9a, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void main()
{
multisprite_init();
*P0C1 = multisprite_color(0x1c); // Yellow
*P0C2 = multisprite_color(0x37); // Orange
*P0C3 = multisprite_color(0x43); // Red
// Initialize small sprites
for (ypos = 0, xpos = 0, i = 0, X = 0; X != NB_SMALL_SPRITES; xpos++, ypos++, X++) {
sp_xpos[X] = xpos << 8;
sp_ypos[X] = ypos << 8;
sp_direction[X] = i++;
if (i == 24) i = 0;
}
// Main loop
do {
multisprite_flip();
for (i = 0; i != NB_SMALL_SPRITES; i++) {
X = i;
Y = sp_direction[X];
sp_xpos[X] += dx[Y];
sp_ypos[X] += dy[Y];
xpos = sp_xpos[X] >> 8;
ypos = sp_ypos[X] >> 8;
if ((xpos < 5 && (dx[Y] >> 8) < 0) ||
(xpos >= 150 && (dx[Y] >> 8) >= 0)) {
sp_direction[X] = horizontal_pingpong[Y];
}
if ((ypos < 5 && (dy[Y] >> 8) < 0) ||
(ypos >= MS_YMAX - 20 && (dy[Y] >> 8) >= 0)) {
sp_direction[X] = vertical_pingpong[Y];
}
multisprite_display_small_sprite(xpos, ypos, missile, 1, 0, 8);
}
} while(1);
}

View File

@ -0,0 +1,110 @@
// example from https://github.com/steux/cc7800 - license: GPLv3
#include "prosystem.h"
#include "gfx.h"
#define DMA_CHECK
#define VERTICAL_SCROLLING
#define _MS_DL_SIZE 64
#define _MS_DL_MALLOC(y) ((y == 6 || y == 7 || y == 8)?_MS_DL_SIZE * 2:_MS_DL_SIZE)
#include "multisprite.h"
char i, counter, xpos, ypos;
char *ptr;
char xchest;
#define NB_SPRITES 32
ramchip short sp_xpos[NB_SPRITES], sp_ypos[NB_SPRITES];
ramchip char sp_direction[NB_SPRITES];
const signed short dx[24] = {300, 289, 259, 212, 149, 77, 0, -77, -150, -212, -259, -289, -300, -289, -259, -212, -149, -77, 0, 77, 149, 212, 259, 289};
const signed short dy[24] = {0, 124, 240, 339, 415, 463, 480, 463, 415, 339, 240, 124, 0, -124, -239, -339, -415, -463, -480, -463, -415, -339, -240, -124};
const char horizontal_pingpong[24] = { 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13 };
const char vertical_pingpong[24] = { 0, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
const char background[22] = { 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0 };
#define LTR(x) (((x) - ' ') * 2)
const char hello_world[] = { LTR('H'), LTR('E'), LTR('L'), LTR('L'), LTR('O'), LTR(' '), LTR('W'), LTR('O'), LTR('R'), LTR('L'), LTR('D') };
void main()
{
counter = 0;
multisprite_init();
multisprite_set_charbase(tiles);
// Set up a full background
for (counter = 0; counter < _MS_DLL_ARRAY_SIZE; counter++) {
if (counter & 2) {
ptr = background + 2;
} else {
ptr = background;
}
multisprite_display_tiles(0, _MS_DLL_ARRAY_SIZE - 1 - counter, ptr, 20, 1);
}
multisprite_save();
*P0C1 = multisprite_color(0x1c); // Setup Palette 0: Yellow
*P0C2 = multisprite_color(0xc5); // Green
*P0C3 = 0x0f; // White
*P1C1 = multisprite_color(0x55); // Dark pink
*P1C2 = multisprite_color(0x5B); // Light pink
*P2C1 = multisprite_color(0x32);
*P2C2 = multisprite_color(0x3D);
*P2C3 = multisprite_color(0x37);
*P3C1 = multisprite_color(0x92);
*P3C2 = multisprite_color(0x97);
*P3C3 = multisprite_color(0x9D);
// Initialize sprites
for (ypos = 0, xpos = 0, i = 0, X = 0; X != NB_SPRITES; xpos++, ypos++, X++) {
sp_xpos[X] = xpos << 8;
sp_ypos[X] = ypos << 8;
sp_direction[X] = i++;
if (i == 24) i = 0;
}
// Main loop
do {
// Prepare scrolling data
if (multisprite_vscroll_buffer_empty()) {
if (counter & 2) {
ptr = background + 2;
} else {
ptr = background;
}
multisprite_vscroll_buffer_tiles(0, ptr, 20, 1);
multisprite_vscroll_buffer_sprite(xchest, chest, 2, 3);
xchest += 45;
counter++;
}
while (*MSTAT & 0x80);
multisprite_flip();
multisprite_vertical_scrolling(-1);
multisprite_reserve_dma(104, sizeof(hello_world), 2);
for (i = 0; i != NB_SPRITES; i++) {
X = i;
Y = sp_direction[X];
sp_xpos[X] += dx[Y];
sp_ypos[X] += dy[Y];
xpos = sp_xpos[X] >> 8;
ypos = sp_ypos[X] >> 8;
if ((xpos < 5 && (dx[Y] >> 8) < 0) ||
(xpos >= 150 && (dx[Y] >> 8) >= 0)) {
sp_direction[X] = horizontal_pingpong[Y];
}
if ((ypos < 5 && (dy[Y] >> 8) < 0) ||
(ypos >= MS_YMAX - 20 && (dy[Y] >> 8) >= 0)) {
sp_direction[X] = vertical_pingpong[Y];
}
multisprite_display_sprite(xpos, ypos, bb_char1, 2, 0);
}
for (xpos = 40, i = 0; i != sizeof(hello_world); xpos += 8, i++) {
ptr = chars0 + hello_world[X = i];
multisprite_display_sprite_fast(xpos, 104, ptr, 2, 2);
}
} while(1);
}

152
presets/atari7800/gfx.h Normal file
View File

@ -0,0 +1,152 @@
// example from https://github.com/steux/cc7800 - license: GPLv3
reversed scattered(16,4) char tiles[64] = {
0x5a, 0x5a, 0x95, 0x95, 0x69, 0x69, 0x65, 0x65, 0x69, 0x69, 0x95, 0x95, 0xa5, 0xa5, 0x65, 0x65,
0xa5, 0xa5, 0xa9, 0xa9, 0x96, 0x96, 0xa6, 0xa6, 0x96, 0x96, 0xa9, 0xa9, 0x5a, 0x5a, 0xa6, 0xa6,
0x5a, 0x5a, 0x95, 0x95, 0x69, 0x69, 0x65, 0x65, 0x69, 0x69, 0x95, 0x95, 0xa5, 0xa5, 0x65, 0x65,
0xa5, 0xa5, 0xa9, 0xa9, 0x96, 0x96, 0xa6, 0xa6, 0x96, 0x96, 0xa9, 0xa9, 0x5a, 0x5a, 0xa6, 0xa6
};
holeydma reversed scattered(16,32) char chars0[512] = {
0x00, 0x00, 0x05, 0x00, 0x50, 0x50, 0x51, 0x40, 0x05, 0x00, 0x50, 0x10, 0x15, 0x40, 0x00, 0x50,
0x01, 0x40, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x50, 0x50, 0x51, 0x40, 0x05, 0x00, 0x50, 0x10, 0x15, 0x40, 0x00, 0x50,
0x01, 0x40, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x09, 0x00, 0x60, 0x90, 0x62, 0x40, 0x16, 0x60, 0x90, 0x60, 0x5f, 0x90, 0x01, 0xb0,
0x06, 0xc0, 0x36, 0x00, 0x90, 0x60, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24,
0x00, 0x00, 0x05, 0x00, 0x50, 0x50, 0x51, 0x80, 0x25, 0x50, 0x50, 0x50, 0x90, 0x60, 0x01, 0x40,
0x05, 0x00, 0x05, 0x00, 0x50, 0x50, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14,
0x00, 0x00, 0x09, 0x00, 0x50, 0x92, 0x65, 0x90, 0x6f, 0xf0, 0xf2, 0x70, 0xd9, 0x70, 0x09, 0xc0,
0x27, 0x00, 0x0e, 0x40, 0xd6, 0x70, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c,
0x00, 0x00, 0x06, 0x00, 0x90, 0x61, 0x99, 0x60, 0x50, 0x00, 0x01, 0x80, 0x26, 0x40, 0x06, 0x00,
0x18, 0x00, 0x01, 0x80, 0x25, 0x80, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90,
0x00, 0x00, 0x06, 0x00, 0xf0, 0xf3, 0x6e, 0x70, 0xe6, 0x40, 0x06, 0xc0, 0x26, 0xc0, 0x0f, 0x00,
0x24, 0x00, 0x02, 0x42, 0x66, 0x64, 0x66, 0x60, 0x00, 0x00, 0x66, 0x60, 0x00, 0x00, 0x02, 0x70,
0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x62, 0x40, 0x26, 0x40, 0x06, 0x00, 0x26, 0x00, 0x00, 0x00,
0x24, 0x00, 0x02, 0x42, 0x66, 0x64, 0x66, 0x60, 0x00, 0x00, 0x66, 0x60, 0x00, 0x00, 0x02, 0x40,
0x00, 0x00, 0x0f, 0x00, 0x00, 0x02, 0x6a, 0x60, 0x3f, 0xa0, 0x1b, 0x00, 0x6d, 0xa0, 0x00, 0x00,
0x28, 0x00, 0x02, 0x83, 0xda, 0x7c, 0xf6, 0xf0, 0x00, 0x00, 0xff, 0xf0, 0x00, 0x00, 0x09, 0xc0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xa6, 0x90, 0x00, 0x90, 0x28, 0x00, 0x92, 0x60, 0x00, 0x00,
0x24, 0x00, 0x01, 0x80, 0x29, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xae, 0xb0, 0x6a, 0xb0, 0xac, 0xa0, 0xa2, 0x70, 0x00, 0x00,
0x36, 0x00, 0x0a, 0xc0, 0xaf, 0xa0, 0x0a, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x27, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x40, 0xa6, 0x80, 0x90, 0x60, 0x62, 0x80, 0x00, 0x00,
0x0a, 0x00, 0x06, 0x00, 0x90, 0x60, 0x09, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, 0x28, 0x00,
0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xa2, 0x80, 0xfa, 0xc0, 0xb0, 0xa0, 0xea, 0xa0, 0x00, 0x00,
0x0e, 0x80, 0x2b, 0x00, 0xf0, 0xf0, 0x0f, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x0a, 0x00, 0xac, 0x00,
0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xa2, 0x80, 0x0a, 0x00, 0x80, 0xa0, 0x2a, 0xa0, 0x00, 0x00,
0x02, 0x80, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x0a, 0x00, 0xa0, 0x00,
0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf3, 0xc0, 0x0f, 0x00, 0xc0, 0xf0, 0x3f, 0xf0, 0x00, 0x00,
0x03, 0xc0, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x0f, 0x00, 0xf0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
holeydma reversed scattered(16,32) char chars1[512] = {
0x15, 0x40, 0x05, 0x00, 0x15, 0x40, 0x15, 0x40, 0x01, 0x40, 0x55, 0x50, 0x15, 0x40, 0x55, 0x50,
0x15, 0x40, 0x15, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0x50, 0x00, 0x00, 0x54, 0x00, 0x15, 0x40,
0x15, 0x40, 0x05, 0x00, 0x15, 0x40, 0x15, 0x40, 0x01, 0x40, 0x55, 0x50, 0x15, 0x40, 0x55, 0x50,
0x15, 0x40, 0x15, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0x50, 0x00, 0x00, 0x54, 0x00, 0x15, 0x40,
0x5a, 0x70, 0x0d, 0x00, 0x7a, 0xd0, 0x7a, 0x50, 0x07, 0x40, 0xda, 0xa0, 0x5a, 0xd0, 0x7a, 0xd0,
0x7a, 0x50, 0xda, 0x70, 0x00, 0x00, 0x00, 0x00, 0x05, 0xa0, 0x00, 0x00, 0xa7, 0x00, 0xda, 0x70,
0x70, 0xd0, 0x05, 0x00, 0x50, 0x50, 0x50, 0xd0, 0x05, 0x40, 0x50, 0x00, 0xd0, 0x70, 0x50, 0x50,
0x50, 0xd0, 0x70, 0x50, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x50, 0x50,
0x51, 0x70, 0x1d, 0x00, 0xa0, 0xd0, 0xa0, 0xd0, 0x37, 0x40, 0xd7, 0x40, 0xd0, 0xa0, 0xa1, 0xe0,
0x70, 0xd0, 0x70, 0x50, 0x07, 0x00, 0x0d, 0x00, 0x1e, 0x00, 0x75, 0xd0, 0x0b, 0x40, 0xa0, 0x70,
0xd3, 0x50, 0x37, 0x00, 0x00, 0x70, 0x00, 0x70, 0x1d, 0xc0, 0x75, 0xc0, 0x70, 0x00, 0x03, 0x40,
0xd0, 0x70, 0x50, 0xd0, 0x05, 0x00, 0x07, 0x00, 0x14, 0x00, 0xdd, 0x70, 0x01, 0xc0, 0x00, 0xd0,
0x76, 0xd0, 0x27, 0x00, 0x03, 0x60, 0x07, 0x60, 0x6b, 0x40, 0xaa, 0x70, 0x77, 0x40, 0x07, 0x80,
0xb7, 0x60, 0xb7, 0x70, 0x0a, 0x00, 0x0a, 0x00, 0x78, 0x00, 0xaa, 0xa0, 0x02, 0x70, 0x03, 0x60,
0xdc, 0x70, 0x07, 0x00, 0x03, 0x40, 0x07, 0x40, 0x43, 0x40, 0x00, 0x70, 0x77, 0x40, 0x07, 0x00,
0x37, 0x40, 0x37, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x03, 0x40,
0xd8, 0xf0, 0x0d, 0x00, 0x36, 0x80, 0x0a, 0x70, 0xf7, 0xf0, 0x00, 0x70, 0x7a, 0xf0, 0x07, 0x00,
0x7a, 0x70, 0x2a, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x00, 0xdf, 0x70, 0x03, 0xe0, 0x0d, 0x80,
0xf0, 0x70, 0x0f, 0x00, 0x1c, 0x00, 0x00, 0xd0, 0x7d, 0xd0, 0x00, 0xf0, 0xd0, 0x70, 0x0f, 0x00,
0xf0, 0xd0, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x7d, 0xf0, 0x03, 0x40, 0x07, 0x00,
0xf0, 0xd0, 0x0f, 0x00, 0xf8, 0x00, 0xf0, 0xf0, 0xab, 0xe0, 0xf0, 0xf0, 0xf0, 0x70, 0x0f, 0x00,
0xf0, 0xf0, 0x70, 0xf0, 0x0f, 0x00, 0x0f, 0x00, 0x2f, 0x00, 0xaa, 0xa0, 0x0f, 0x80, 0x0a, 0x00,
0xd0, 0xf0, 0x0f, 0x00, 0xd0, 0x00, 0xf0, 0x70, 0x03, 0xc0, 0xd0, 0x70, 0x70, 0xf0, 0x0d, 0x00,
0x70, 0x70, 0xf0, 0xd0, 0x0f, 0x00, 0x0d, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
0xbd, 0xe0, 0xff, 0xf0, 0xff, 0xf0, 0xbf, 0xe0, 0x03, 0xc0, 0xbf, 0xe0, 0xbf, 0xe0, 0x0f, 0x00,
0xbf, 0xe0, 0xbf, 0xe0, 0x0a, 0x00, 0x3e, 0x00, 0x0b, 0xf0, 0x00, 0x00, 0xfe, 0x00, 0x0d, 0x00,
0x3f, 0xc0, 0xff, 0xf0, 0xff, 0xf0, 0x3f, 0xc0, 0x03, 0xc0, 0x3f, 0xc0, 0x3f, 0xc0, 0x0f, 0x00,
0x3f, 0xc0, 0x3f, 0xc0, 0x00, 0x00, 0x3c, 0x00, 0x03, 0xf0, 0x00, 0x00, 0xfc, 0x00, 0x0f, 0x00,
0x2a, 0x80, 0xaa, 0xa0, 0xaa, 0xa0, 0x2a, 0x80, 0x02, 0x80, 0x2a, 0x80, 0x2a, 0x80, 0x0a, 0x00,
0x2a, 0x80, 0x2a, 0x80, 0x00, 0x00, 0x28, 0x00, 0x02, 0xa0, 0x00, 0x00, 0xa8, 0x00, 0x0a, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
holeydma reversed scattered(16,32) char chars2[512] = {
0x15, 0x40, 0x05, 0x00, 0x55, 0x40, 0x15, 0x40, 0x55, 0x00, 0x55, 0x50, 0x55, 0x50, 0x15, 0x40,
0x50, 0x50, 0x15, 0x40, 0x05, 0x50, 0x50, 0x50, 0x50, 0x00, 0x50, 0x14, 0x50, 0x50, 0x15, 0x40,
0x15, 0x40, 0x05, 0x00, 0x55, 0x40, 0x15, 0x40, 0x55, 0x00, 0x55, 0x50, 0x55, 0x50, 0x15, 0x40,
0x50, 0x50, 0x15, 0x40, 0x05, 0x50, 0x50, 0x50, 0x50, 0x00, 0x50, 0x14, 0x50, 0x50, 0x15, 0x40,
0x5a, 0x70, 0x1d, 0xc0, 0x7a, 0xd0, 0x7a, 0x50, 0xdb, 0x40, 0xda, 0xa0, 0x5a, 0xa0, 0x7a, 0xd0,
0x70, 0x50, 0x27, 0x80, 0x09, 0x60, 0x51, 0xe0, 0x70, 0x00, 0x74, 0x5c, 0xd4, 0x70, 0xda, 0x70,
0x70, 0xd0, 0x15, 0x40, 0x50, 0x50, 0x50, 0xd0, 0x71, 0x40, 0x50, 0x00, 0xd0, 0x00, 0x50, 0x50,
0x50, 0xd0, 0x05, 0x00, 0x03, 0x40, 0xd1, 0x40, 0x50, 0x00, 0x54, 0xd4, 0x74, 0x50, 0x50, 0x50,
0x51, 0x70, 0xda, 0x70, 0x50, 0xd0, 0x70, 0xa0, 0x72, 0x50, 0xd0, 0x00, 0xd0, 0x00, 0x50, 0xa0,
0x70, 0xd0, 0x07, 0x00, 0x03, 0x40, 0xdd, 0x80, 0x50, 0x00, 0x75, 0xdc, 0x77, 0x50, 0xd0, 0x70,
0xd3, 0x50, 0x70, 0x50, 0xd0, 0x70, 0xd0, 0x00, 0x50, 0xd0, 0x70, 0x00, 0x70, 0x00, 0xd0, 0x00,
0xd0, 0x70, 0x0d, 0x00, 0x01, 0xc0, 0x77, 0x00, 0xd0, 0x00, 0xdd, 0x74, 0x5d, 0xd0, 0x70, 0xd0,
0x73, 0xd0, 0x77, 0x70, 0x77, 0x60, 0x70, 0x00, 0x70, 0x70, 0x77, 0x00, 0x77, 0x00, 0x73, 0x70,
0x77, 0x70, 0x07, 0x00, 0x03, 0x40, 0x76, 0x00, 0x70, 0x00, 0x7b, 0xb4, 0x77, 0x70, 0x70, 0x70,
0xd1, 0x70, 0x77, 0x70, 0x77, 0x40, 0x70, 0x00, 0x70, 0x70, 0x77, 0x00, 0x77, 0x00, 0x73, 0x70,
0x77, 0x70, 0x07, 0x00, 0x03, 0x40, 0x74, 0x00, 0x70, 0x00, 0x73, 0x34, 0x77, 0x70, 0x70, 0x70,
0xd2, 0xa0, 0x7a, 0xf0, 0xfa, 0xd0, 0x70, 0x00, 0xf0, 0xf0, 0xda, 0x00, 0x7a, 0x00, 0xf2, 0xd0,
0x7a, 0x70, 0x07, 0x00, 0x03, 0x40, 0xf7, 0x00, 0x70, 0x00, 0xd2, 0x3c, 0xfb, 0xd0, 0x70, 0xf0,
0xf0, 0x00, 0xd0, 0x70, 0xd0, 0x70, 0xf0, 0x00, 0x70, 0xd0, 0x70, 0x00, 0xd0, 0x00, 0xd0, 0x70,
0xf0, 0xd0, 0x0d, 0x00, 0x01, 0xc0, 0xdf, 0x00, 0xf0, 0x00, 0x70, 0x34, 0xd3, 0x70, 0xf0, 0xd0,
0xf0, 0x10, 0xf0, 0x70, 0xf0, 0xf0, 0xf0, 0xf0, 0x73, 0xe0, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0xf0,
0xf0, 0xf0, 0x0f, 0x00, 0xf3, 0xc0, 0xfb, 0xc0, 0xf0, 0x00, 0xf0, 0x3c, 0xf2, 0xf0, 0xf0, 0xf0,
0xd0, 0x30, 0xd0, 0xf0, 0xd0, 0x70, 0xf0, 0x70, 0xf3, 0xc0, 0xd0, 0x00, 0x70, 0x00, 0xd0, 0xd0,
0x70, 0x70, 0x07, 0x00, 0xd3, 0x40, 0xd1, 0xc0, 0x70, 0x00, 0xd0, 0x34, 0xd0, 0xf0, 0xf0, 0xf0,
0xbd, 0xe0, 0xf0, 0xf0, 0xff, 0xe0, 0xbf, 0xe0, 0xff, 0x80, 0xff, 0xf0, 0xf0, 0x00, 0xbf, 0xe0,
0xf0, 0xf0, 0x3f, 0xc0, 0xbf, 0x80, 0xf2, 0xf0, 0xff, 0xf0, 0xf0, 0x3c, 0xf0, 0xf0, 0xbd, 0xe0,
0x3f, 0xc0, 0xf0, 0xf0, 0xff, 0xc0, 0x3f, 0xc0, 0xff, 0x00, 0xff, 0xf0, 0xf0, 0x00, 0x3f, 0xc0,
0xf0, 0xf0, 0x3f, 0xc0, 0x3f, 0x00, 0xf0, 0xf0, 0xff, 0xf0, 0xf0, 0x3c, 0xf0, 0xf0, 0x3f, 0xc0,
0x2a, 0x80, 0xa0, 0xa0, 0xaa, 0x80, 0x2a, 0x80, 0xaa, 0x00, 0xaa, 0xa0, 0xa0, 0x00, 0x2a, 0x80,
0xa0, 0xa0, 0x2a, 0x80, 0x2a, 0x00, 0xa0, 0xa0, 0xaa, 0xa0, 0xa0, 0x28, 0xa0, 0xa0, 0x2a, 0x80,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
holeydma reversed scattered(16,32) char chars3[512] = {
0x55, 0x40, 0x15, 0x40, 0x55, 0x40, 0x15, 0x40, 0x55, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x14,
0x50, 0x50, 0x50, 0x50, 0x55, 0x50, 0x15, 0x40, 0x00, 0x50, 0x15, 0x40, 0x00, 0x00, 0x00, 0x00,
0x55, 0x40, 0x15, 0x40, 0x55, 0x40, 0x15, 0x40, 0x55, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x14,
0x50, 0x50, 0x50, 0x50, 0x55, 0x50, 0x15, 0x40, 0x00, 0x50, 0x15, 0x40, 0x00, 0x00, 0x00, 0x00,
0x5a, 0x70, 0x5a, 0xd0, 0x7a, 0xd0, 0x7a, 0x50, 0xa7, 0xa0, 0xd0, 0x70, 0x50, 0xd0, 0x70, 0x1c,
0x70, 0x50, 0xd0, 0x70, 0xaa, 0x70, 0x1e, 0x80, 0x01, 0xac, 0x2b, 0x40, 0x07, 0x00, 0x0c, 0x00,
0x70, 0xd0, 0xd0, 0x70, 0x50, 0x50, 0x50, 0xd0, 0x05, 0x00, 0x50, 0x50, 0xd0, 0x70, 0x50, 0x14,
0x50, 0xd0, 0x70, 0x50, 0x00, 0x50, 0x14, 0x00, 0x01, 0x04, 0x01, 0xc0, 0x05, 0x00, 0x04, 0x00,
0x50, 0x70, 0xd0, 0x70, 0x50, 0xd0, 0x70, 0xa0, 0x07, 0x00, 0xd0, 0x70, 0xd0, 0x70, 0x50, 0x14,
0xb5, 0xe0, 0x70, 0x50, 0x03, 0x60, 0x1c, 0x00, 0x0d, 0x08, 0x01, 0xc0, 0x37, 0x40, 0x14, 0x00,
0xd0, 0x50, 0x70, 0x50, 0xd0, 0x70, 0xd0, 0x00, 0x0d, 0x00, 0x70, 0xd0, 0x70, 0x50, 0xd0, 0x34,
0x1d, 0x40, 0x50, 0xd0, 0x01, 0xc0, 0x34, 0x00, 0x07, 0x00, 0x01, 0x40, 0x1d, 0xc0, 0x34, 0x00,
0x77, 0xe0, 0x70, 0x70, 0x77, 0x60, 0xb7, 0x40, 0x07, 0x00, 0x70, 0x70, 0x70, 0x70, 0x73, 0x34,
0x27, 0x80, 0xb7, 0x60, 0x07, 0x80, 0x34, 0x00, 0x37, 0x70, 0x03, 0x40, 0x77, 0x70, 0x77, 0x74,
0xdd, 0x40, 0x70, 0x70, 0x77, 0x40, 0x37, 0x40, 0x07, 0x00, 0x70, 0x70, 0x70, 0x70, 0x73, 0x34,
0x07, 0x00, 0x37, 0x40, 0x07, 0x00, 0x34, 0x00, 0x37, 0x70, 0x03, 0x40, 0x77, 0x70, 0x77, 0x74,
0xda, 0x80, 0x70, 0xf0, 0xf7, 0x80, 0x2a, 0x70, 0x07, 0x00, 0xd0, 0x70, 0x70, 0xf0, 0xf7, 0xdc,
0x3f, 0x40, 0x27, 0x80, 0x1e, 0x00, 0x34, 0x00, 0x2d, 0xa0, 0x03, 0x40, 0xa7, 0xa0, 0x7d, 0xf4,
0xf0, 0x00, 0xd0, 0x70, 0xdf, 0x00, 0x00, 0xd0, 0x0d, 0x00, 0x70, 0xf0, 0xd0, 0x70, 0xdf, 0x7c,
0x37, 0xc0, 0x0d, 0x00, 0x3c, 0x00, 0x1c, 0x00, 0x07, 0x00, 0x01, 0xc0, 0x0f, 0x00, 0xf7, 0xdc,
0xf0, 0x00, 0xbf, 0x60, 0xfb, 0xc0, 0xf0, 0xf0, 0x0f, 0x00, 0xf0, 0xf0, 0xbf, 0x60, 0xfe, 0xfc,
0xfa, 0xf0, 0x0f, 0x00, 0xf8, 0x00, 0x3c, 0x00, 0x3e, 0x0c, 0x03, 0xc0, 0x0f, 0x00, 0xb6, 0xa8,
0xd0, 0x00, 0x1f, 0xc0, 0xd3, 0x40, 0xf0, 0x70, 0x07, 0x00, 0xd0, 0x70, 0x3f, 0xc0, 0xdc, 0xdc,
0x70, 0x70, 0x07, 0x00, 0xd0, 0x00, 0x1c, 0x00, 0x34, 0x0c, 0x03, 0x40, 0x0d, 0x00, 0x3c, 0x00,
0xf0, 0x00, 0x2b, 0xf0, 0xf2, 0xf0, 0xbf, 0xe0, 0x0f, 0x00, 0xbf, 0xe0, 0x2f, 0x80, 0xf8, 0xbc,
0xf0, 0xf0, 0x0f, 0x00, 0xff, 0xf0, 0x3f, 0xc0, 0xff, 0xf8, 0x3f, 0xc0, 0x0f, 0x00, 0x2c, 0x00,
0xf0, 0x00, 0x03, 0xf0, 0xf0, 0xf0, 0x3f, 0xc0, 0x0f, 0x00, 0x3f, 0xc0, 0x0f, 0x00, 0xf0, 0x3c,
0xf0, 0xf0, 0x0f, 0x00, 0xff, 0xf0, 0x3f, 0xc0, 0xff, 0xf0, 0x3f, 0xc0, 0x0f, 0x00, 0x0c, 0x00,
0xa0, 0x00, 0x02, 0xa0, 0xa0, 0xa0, 0x2a, 0x80, 0x0a, 0x00, 0x2a, 0x80, 0x0a, 0x00, 0xa0, 0x28,
0xa0, 0xa0, 0x0a, 0x00, 0xaa, 0xa0, 0x2a, 0x80, 0xaa, 0xa0, 0x2a, 0x80, 0x0a, 0x00, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
holeydma reversed scattered(16,2) char bb_char1[32] = {
0x01, 0x00, 0x01, 0x40, 0x0a, 0x94, 0x2a, 0x90, 0x3b, 0xa0, 0xc8, 0xe5, 0xc8, 0xe4, 0xc8, 0xd0,
0xc8, 0xe5, 0xbb, 0x84, 0x0c, 0x20, 0x2a, 0x90, 0x0e, 0x50, 0x3f, 0x94, 0x3d, 0x68, 0x5d, 0x6a
};
reversed scattered(16,2) char chest[32] = {
0x00, 0x00, 0x05, 0x50, 0x2b, 0xf4, 0x96, 0xfc, 0x69, 0xbd, 0xbe, 0x6a, 0x55, 0x55, 0xaa, 0xbf,
0xd5, 0xd5, 0xd9, 0xb7, 0xef, 0x9d, 0xef, 0x9d, 0xef, 0x9d, 0xdd, 0x9d, 0xd5, 0xf7, 0xff, 0x95
};

View File

@ -0,0 +1,16 @@
// example from https://github.com/steux/cc7800 - license: GPLv3
#include "conio.h"
char i;
void main()
{
clrscr();
for (i = 0; i != 8; i++) {
textcolor(i);
gotoxy(0, i);
cputs("Hello World!");
}
while(1);
}

View File

@ -6,66 +6,11 @@
;
processor 6502
; ************ Hardware Adresses ***************************
INPTCTRL equ $01 ;Input control
AUDC0 equ $15 ;Audio Control Channel 0
AUDC1 equ $16 ;Audio Control Channel 1
AUDF0 equ $17 ;Audio Frequency Channel 0
AUDF1 equ $18 ;Audio Frequency Channel 1
AUDV0 equ $19 ;Audio Volume Channel 0
AUDV1 equ $1A ;Audio Volume Channel 1
INPT0 equ $08 ;Paddle Control Input 0
INPT1 equ $09 ;Paddle Control Input 1
INPT2 equ $0A ;Paddle Control Input 2
INPT3 equ $0B ;Paddle Control Input 3
INPT4 equ $0C ;Player 0 Fire Button Input
INPT5 equ $0D ;Player 1 Fire Button Input
BACKGRND equ $20 ;Background Color
P0C1 equ $21 ;Palette 0 - Color 1
P0C2 equ $22 ;Palette 0 - Color 2
P0C3 equ $23 ;Palette 0 - Color 3
WSYNC equ $24 ;Wait For Sync
P1C1 equ $25 ;Palette 1 - Color 1
P1C2 equ $26 ;Palette 1 - Color 2
P1C3 equ $27 ;Palette 1 - Color 3
MSTAT equ $28 ;Maria Status
P2C1 equ $29 ;Palette 2 - Color 1
P2C2 equ $2A ;Palette 2 - Color 2
P2C3 equ $2B ;Palette 2 - Color 3
DPPH equ $2C ;Display List List Pointer High
P3C1 equ $2D ;Palette 3 - Color 1
P3C2 equ $2E ;Palette 3 - Color 2
P3C3 equ $2F ;Palette 3 - Color 3
DPPL equ $30 ;Display List List Pointer Low
P4C1 equ $31 ;Palette 4 - Color 1
P4C2 equ $32 ;Palette 4 - Color 2
P4C3 equ $33 ;Palette 4 - Color 3
CHARBASE equ $34 ;Character Base Address
P5C1 equ $35 ;Palette 5 - Color 1
P5C2 equ $36 ;Palette 5 - Color 2
P5C3 equ $37 ;Palette 5 - Color 3
OFFSET equ $38 ;Unused - Store zero here
P6C1 equ $39 ;Palette 6 - Color 1
P6C2 equ $3A ;Palette 6 - Color 2
P6C3 equ $3B ;Palette 6 - Color 3
CTRL equ $3C ;Maria Control Register
P7C1 equ $3D ;Palette 7 - Color 1
P7C2 equ $3E ;Palette 7 - Color 2
P7C3 equ $3F ;Palette 7 - Color 3
SWCHA equ $280 ;P0, P1 Joystick Directional Input
SWCHB equ $282 ;Console Switches
CTLSWA equ $281 ;I/O Control for SCHWA
CTLSWB equ $283 ;I/O Control for SCHWB
SEG.U data
include "7800.h"
;******* Vairables ********************************
SEG.U data
org $40
xpos ds.b 1 ;X Position of sprite
@ -75,12 +20,9 @@ dlpnt ds.w 1
dlend ds.b 12 ;Index of end of each DL
;**********************************************************
SEG code
SEG code
org $4000 ;Start of code
START

View File

@ -0,0 +1,69 @@
// example from https://github.com/steux/cc7800 - license: GPLv3
#include "conio.h"
#include "assert.h"
char i;
reversed scattered(8,1) char special_char[8] = {
0x66, 0xff, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00
};
void main()
{
clrscr();
// Draw a square
gotoxy(0, 0);
textcolor(7);
putch(CONIO_TL_CORNER);
for (i = 0; i != 20; i++) {
putch(CONIO_HBAR);
}
putch(CONIO_TR_CORNER);
for (i = 0; i != 8; i++) {
gotoxy(0, i + 1);
putch(CONIO_VBAR);
gotoxy(21, i + 1);
putch(CONIO_VBAR);
}
gotoxy(0, 9);
putch(CONIO_BL_CORNER);
for (i = 0; i != 20; i++) {
putch(CONIO_HBAR);
}
putch(CONIO_BR_CORNER);
// Write some text
for (i = 0; i != 8; i++) {
textcolor(i);
gotoxy(i + 1, i + 1);
cputs("Hello World!");
}
// Long text test
gotoxy(0, 10);
cputs("This is a long text that fits in a line.");
gotoxy(10, 11);
cputs("World!");
gotoxy(4, 11);
cputs("Hello");
gotoxy(10, 12);
cputs("World!");
gotoxy(4, 12);
textcolor(4);
cputs("Hello");
gotoxy(0, 13);
for (i = 0; i != 8; i++) {
textcolor(i);
putch('!');
}
gotoxy(0, 14);
for (i = 0; i != 8; i++) {
textcolor(7 - i);
putch(128); // Special character
}
while(1);
}

View File

@ -1,4 +1,4 @@
; Atari 8-bit "Hello World" sample code
; Written by Daniel Boris (danlb_2000@yahoo.com)
; Modified by Steven Hugg @8bitworkshop
@ -10,7 +10,7 @@
include "atari.inc"
org $a000 ;Start of left cartridge area
Start
Start
ldx #(dlistend-dlist)
dlloop ;Create Display List
lda dlist,x ;Get byte
@ -20,15 +20,16 @@ dlloop ;Create Display List
lda #$06
sta CHACTL ;Set Character Control
lda #$84 ;Set color PF2
sta COLOR0+2
sta COLOR0+4 ; bakground
lda #$0F ;Set color PF1
sta COLOR0+1
lda #$3f
lda #$28
sta COLOR0+0
lda #$0F
sta COLOR0+1
lda #$d6
sta COLOR0+2
lda #$58
sta COLOR0+3
lda #$84
sta COLOR0+4 ; bakground
lda #$00 ;Set Display list pointer
sta SDLSTL ;Shadow DLISTL
lda #$10
@ -36,6 +37,7 @@ dlloop ;Create Display List
lda #$e0 ;Set Charcter Set Base
sta CHBAS
lda #$22 ;Enable DMA
lda #$21
sta SDMCTL ;Shadow DMACTL
print
@ -57,19 +59,31 @@ wait
jmp wait
;Display list data (starts at $1000)
dlist .byte $70,$70,$70 ;24 blank scanlines
.byte $42,$00,$18,$02 ;mode 2 @ $1800
.byte $43,$00,$18,$02 ;mode 3 @ $1800
.byte $44,$00,$18,$02 ;mode 4 @ $1800
.byte $45,$00,$18,$02 ;mode 5 @ $1800
.byte $46,$00,$18,$06 ;mode 6 @ $1800
.byte $47,$00,$18,$06 ;mode 7 @ $1800
dlist .byte $70,$70 ;16 blank scanlines
.byte $42,$00,$18,$02,$70 ;mode 2 @ $1800
.byte $43,$00,$18,$70 ;mode 3 @ $1800
.byte $44,$00,$18,$70 ;mode 4 @ $1800
.byte $45,$00,$18,$70 ;mode 5 @ $1800
.byte $46,$00,$18,$70 ;mode 6 @ $1800
.byte $47,$00,$18,$70 ;mode 7 @ $1800
.byte $48,$00,$18,$08,$70 ;mode 2 @ $1800
.byte $49,$00,$18,$70 ;mode 3 @ $1800
.byte $4a,$00,$18,$70 ;mode 4 @ $1800
.byte $4b,$00,$18,$70 ;mode 5 @ $1800
.byte $4c,$00,$18,$70 ;mode 6 @ $1800
.byte $4d,$00,$18,$70 ;mode 7 @ $1800
.byte $4e,$00,$18,$70 ;mode 7 @ $1800
.byte $4f,$00,$18,$70 ;mode 7 @ $1800
.byte $41,$00,$10 ;JMP -> $1000
dlistend
;Text data
text1 .byte "Hello World! "
.byte $a1,$a2,$a3
.repeat 16
.byte 32
.repend
.byte "12345"
.byte 0
;Cartridge footer

View File

@ -0,0 +1,164 @@
AUDF0 = $d200
AUDC0 = $d201
AUDCTL = $d208
.data
Chan0dur: .res 4 ; current note duration channel 0
Chan0note: .res 4 ; current note pitch channel 0
Chan0duty: .res 4 ; current duty bits channel 0
DurationTimer: .res 1 ; duration until next cmd
CurChannel: .res 1 ; next channel to add note
Volume: .res 1 ; initial volume of note (0-31)
; set_irq() saves/restores entire zeropage segment
; which we don't want!
; so we have to set this with an equate
SongPtr = $fe
;.segment "EXTZP"
;SongPtr: .res 2 ; ptr to next song byte
.code
; Update channel pitch in AUDF0
; 8-bit rotation of duty cycle bits
.export _music_duty
_music_duty:
ldx #3
ldy #0
@loop:
lda Chan0dur,x
beq :++
lda Chan0duty,x
asl
bcc :+
ora #1
: sta Chan0duty,x
lda Chan0note,x
beq :+
; If next bit is set, add 1 to AUDF0
adc #0
sta AUDF0,y
:
iny
iny
dex
bpl @loop
rts
; Decrement the volumes for each channel
.export _music_tick
_music_tick:
ldx #3
ldy #0
@loop1:
lda Chan0dur,x
beq :+
lsr
ora #$a0
sta AUDC0,y
dec Chan0dur,x
:
iny
iny
dex
bpl @loop1
; Also decrement next-note timer, fetch next note
lda DurationTimer
bmi @Done
beq @NextData
dec DurationTimer
rts
; Timer ran out, so fetch next note
@NextData:
ldx #0
lda (SongPtr,x)
bmi @LoadDuration
; < $80, play next note
ldx CurChannel ; next channel
tay
jsr music_do_note
inx
txa
and #3
sta CurChannel ; inc next channel
jsr @IncDataPtr
jmp @NextData
; >= $80, load next duration
@LoadDuration:
cmp #$ff ; $ff = end of song
bne @NoResetTrack
sta DurationTimer
jmp music_done
@NoResetTrack:
and #$7f
; asl
sta DurationTimer ; store duration * 2
@IncDataPtr:
; increment song pointer
inc SongPtr
bne @Done
inc SongPtr+1
@Done:
rts
music_do_note:
; Play a note
; X = channel (0,1)
; Y = note index (0-63)
lda FREQZ,y
sta Chan0note,x
lda DUTYZ,y
sta Chan0duty,x
lda Volume
sta Chan0dur,x
rts
music_done:
rts
.export _music_start
_music_start:
sta SongPtr
stx SongPtr+1
lda #24
sta Volume
lda #0
sta DurationTimer
sta CurChannel
ldx #3
: sta Chan0dur,x
dex
bpl :-
lda #$01
sta AUDCTL
rts
.export _music_get_ptr
_music_get_ptr:
lda SongPtr
ldx SongPtr+1
rts
.export _music_is_done
_music_is_done:
ldx #0
lda (SongPtr,x)
cmp #$ff
php
pla
lsr
and #1
rts
; Table of AUDF base values for each note
FREQZ:
.byte 254, 254, 254, 255, 240, 227, 214, 202, 190, 180, 169, 160, 151, 142, 134, 127, 119, 113, 106, 100, 94, 89, 84, 79, 75, 70, 66, 63, 59, 56, 52, 49, 47, 44, 41, 39, 37, 34, 32, 31, 29, 27, 25, 24, 23, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 11, 10, 9, 9, 8, 8, 7, 7
; Table of duty-cycle bits for each note
DUTYZ:
.byte 0, 0, 0, 0, 181, 1, 17, 1, 219, 0, 239, 17, 17, 181, 181, 0, 239, 0, 181, 181, 239, 85, 73, 181, 1, 239, 219, 0, 73, 0, 239, 219, 0, 17, 219, 73, 0, 239, 239, 0, 17, 85, 239, 73, 0, 181, 73, 1, 0, 0, 0, 0, 1, 17, 85, 219, 0, 73, 181, 1, 85, 0, 85, 0

File diff suppressed because one or more lines are too long

80
presets/c64/23matches.c Normal file
View File

@ -0,0 +1,80 @@
#include "common.h"
#include <cbm_petscii_charmap.h>
int matches; // number of matches remaining
int take; // # of matches to take on this turn
void print_matches() {
printf("\nThere are %d matches left.\n", matches);
}
void human_moves() {
print_matches();
// loop until we get a valid move
while (1) {
printf("\n>> Your turn. Take 1, 2, or 3 matches?");
// did we get exactly one input value?
if (scanf("%d", &take) == 1) {
// is it between 1 and 3?
if (take >= 1 && take <= 3) {
// are there not enough matches?
if (take > matches) {
printf("Not enough matches! Try again.\n");
continue; // go back to start of loop
} else {
// take the appropriate number of matches
printf("You took %d matches.\n", take);
matches -= take;
break; // break out of loop
}
}
}
printf("Bad input! Type a number from 1 to 3.\n");
}
}
void computer_moves() {
print_matches();
// simple AI: hard coded if 1-4 matches left
// otherwise take random number from 1 to 3
switch (matches) {
case 1: take = 1; break;
case 2: take = 1; break;
case 3: take = 2; break;
case 4: take = 3; break;
default: take = (rand() % 3) + 1; break;
}
printf("\n<< My turn. I'll take %d matches.\n", take);
matches -= take;
}
void play_game(void) {
printf(
"When it is your turn, you may take\n"
"1, 2 or 3 matches. I will do the same.\n\n"
"Whoever takes the last match loses.\n");
matches = 23;
// loop until no more matches
while (matches > 0) {
// move human, check if they lost
human_moves();
if (matches == 0) {
printf("You lose, turkey!\nBetter luck next time.\n");
break;
}
// move computer, check if they lost
computer_moves();
if (matches == 0) {
printf("I lost! You must be good!\n");
break;
}
}
}
void main(void) {
clrscr();
printf("*** 23 MATCHES ***\n\n");
play_game();
}

Binary file not shown.

View File

@ -0,0 +1,7 @@
* = $0801
!word Start
!byte $00,$00,$9e
!text "2066"
!byte $00,$00,$00
* = $0812

View File

@ -5,6 +5,6 @@
.org $0801 ; start of BASIC program
.word BASIC_END, 10 ; Next line and current line number
.byte $9e," 2064",0 ; SYS 2064
.byte $9e," 2062",0 ; SYS 2062
BASIC_END:
.word 0 ; End of program

View File

@ -2,12 +2,19 @@
#include "common.h"
word bcd_add(word a, word b) {
register word c, d; // intermediate values
c = a + 0x0666; // add 6 to each BCD digit
d = c ^ b; // sum without carry propagation
c += b; // provisional sum
d = ~(c ^ d) & 0x1110; // just the BCD carry bits
d = (d >> 2) | (d >> 3); // correction
return c - d; // corrected BCD sum
asm("sed");
a += b;
asm("cld");
return a;
}
void draw_bcd_word(word address, word bcd) {
byte i;
address += 4;
for (i=0; i<4; i++) {
POKE(address, (bcd & 0b1111) + '0');
address--;
bcd >>= 4;
}
}

View File

@ -1,3 +1,7 @@
/* add two BCD numbers */
unsigned int bcd_add(unsigned int a, unsigned int b);
unsigned int bcd_add2(unsigned int a, unsigned int b);
/* print a 16-bit BCD to a specific address */
void draw_bcd_word(word address, word bcd_value);

49
presets/c64/c64-sid.cfg Normal file
View File

@ -0,0 +1,49 @@
FEATURES {
STARTADDRESS: default = $0801;
}
SYMBOLS {
__LOADADDR__: type = import;
__EXEHDR__: type = import;
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__HIMEM__: type = weak, value = $8000;
}
MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = %S - 2, size = $0002;
HEADER: file = %O, define = yes, start = %S, size = $000D;
LOWMAIN: file = %O, define = yes, start = __HEADER_LAST__, size = $1000 - __HEADER_LAST__, fill = yes;
SIDFILE: file = %O, define = yes, start = $1000, size = $1000, fill = yes;
MAIN: file = %O, define = yes, start = $2000, size = __HIMEM__ - $2000;
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
VICBANK: file = %O, start = $8000, size = $4000;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro;
STARTUP: load = LOWMAIN, type = ro;
LOWCODE: load = LOWMAIN, type = ro, optional = yes;
SIDFILE: load = SIDFILE, type = ro, optional = yes;
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
INIT: load = MAIN, type = rw;
ONCE: load = MAIN, type = ro, define = yes;
BSS: load = BSS, type = bss, define = yes;
VICBANK: load = MAIN, type = ro, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
segment = RODATA;
CONDES: type = interruptor,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__,
segment = RODATA,
import = __CALLIRQ__;
}

127
presets/c64/c64.wiz Normal file
View File

@ -0,0 +1,127 @@
struct CoordXY {
x : u8,
y : u8
}
struct SIDVoice {
freq : u16, /* Frequency */
pw : u16, /* Pulse width */
ctrl : u16, /* Control register */
ad : u16, /* Attack/decay */
sr : u16 /* Sustain/release */
}
typealias SpriteData : [u8; 64];
union VICBank {
spritedata : [SpriteData; 256],
data : [u8; 0x4000]
}
namespace c64 {
extern var colorram @ 0xD800 : [u8; 0x400];
namespace color {
let BLACK = 0x00;
let WHITE = 0x01;
let RED = 0x02;
let CYAN = 0x03;
let PURPLE = 0x04;
let GREEN = 0x05;
let BLUE = 0x06;
let YELLOW = 0x07;
let ORANGE = 0x08;
let BROWN = 0x09;
let LIGHTRED = 0x0A;
let GRAY1 = 0x0B;
let GRAY2 = 0x0C;
let LIGHTGREEN = 0x0D;
let LIGHTBLUE = 0x0E;
let GRAY3 = 0x0F;
}
namespace vic {
namespace sprite {
extern var pos @ 0xD000 : [CoordXY; 8];
extern var coord @ 0xD000 : [u8; 16];
extern var hi_x @ 0xD010 : u8;
extern var enable @ 0xD015 : u8;
extern var expand_y @ 0xD017 : u8;
extern var priority @ 0xD01B : u8;
extern var multicolor @ 0xD01C : u8;
extern var expand_x @ 0xD01D : u8;
extern var coll @ 0xD01E : u8;
extern var coll_bg @ 0xD01F : u8;
extern var mcolor @ 0xD025 : [u8; 2];
extern var color @ 0xD027 : [u8; 8];
}
extern var control1 @ 0xD011 : u8;
extern var rasterline @ 0xD012 : u8;
extern var lightpen @ 0xD013 : CoordXY;
extern var control2 @ 0xD016 : u8;
extern var mem @ 0xD018 : u8;
extern var irr @ 0xD019 : u8;
extern var imr @ 0xD01A : u8;
extern var bordercolor @ 0xD020 : u8;
extern var bgcolor @ 0xD021 : [u8; 4];
}
namespace sid {
extern writeonly v1 @ 0xd400 : [SIDVoice; 3];
extern writeonly flt_freq @ 0xd415 : u16;/* Filter frequency */
extern writeonly flt_ctrl @ 0xd417 : u8; /* Filter control register */
extern writeonly amp @ 0xd418 : u8; /* Amplitude */
extern writeonly ad1 @ 0xd419 : u8; /* A/D converter 1 */
extern writeonly ad2 @ 0xd41a : u8; /* A/D converter 2 */
extern writeonly noise @ 0xd41b : u8; /* Noise generator */
extern const read3 @ 0xd41c : u8; /* Value of voice 3 */
}
namespace cia1 {
// CIA1 Registers
extern writeonly port_a @ 0xDC00 : u8;
extern const port_b @ 0xDC01 : u8;
extern writeonly data_direction_a @ 0xDC02 : u8;
extern writeonly data_direction_b @ 0xDC03 : u8;
extern const timer_a_lo @ 0xDC04 : u8;
extern const timer_a_hi @ 0xDC05 : u8;
extern const timer_b_lo @ 0xDC06 : u8;
extern const timer_b_hi @ 0xDC07 : u8;
extern const sdr @ 0xDC0C : u8;
extern const icr @ 0xDC0D : u8;
extern const cra @ 0xDC0E : u8;
extern const crb @ 0xDC0F : u8;
}
namespace cia2 {
// CIA2 Registers
extern writeonly port_a @ 0xDD00 : u8;
extern const port_b @ 0xDD01 : u8;
extern writeonly data_direction_a @ 0xDD02 : u8;
extern writeonly data_direction_b @ 0xDD03 : u8;
extern const timer_a_lo @ 0xDD04 : u8;
extern const timer_a_hi @ 0xDD05 : u8;
extern const timer_b_lo @ 0xDD06 : u8;
extern const timer_b_hi @ 0xDD07 : u8;
extern const sdr @ 0xDD0C : u8;
extern const icr @ 0xDD0D : u8;
extern const cra @ 0xDD0E : u8;
extern const crb @ 0xDD0F : u8;
}
namespace kernal {
let ioinit = 0xFDA3 as func;
let rantam = 0xFD50 as func;
let restor = 0xFD15 as func;
let cint = 0xFF5B as func;
let scnkey = 0xEA87 as func;
let chrin = 0xF157 as func : u8 in a;
let chrout = 0xF1CA as func(char : u8 in a);
let screen = 0xE505 as func : u16 in xy;
let plot_save = 0xE50A as func(save : bool in carry) : u16 in xy;
let plot_restore = 0xE50A as func(x : u8 in x, y : u8 in y, save : bool in carry);
}
}

View File

@ -0,0 +1,30 @@
* = $7ffe
; 2-byte load address for ROM image
!word $8000
; http://swut.net/c64cart-howto.html
; https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image
!word CartKReset ; cold start vector
!word CartWStart ; warm start vector
!byte $c3, $c2, $cd, $38, $30 ; "CBM80"
CartKReset
STX $D016 ; Turn on VIC for PAL / NTSC check
JSR $FDA3 ; IOINIT - Init CIA chips
JSR $FD50 ; RANTAM - Clear/test system RAM
JSR $FD15 ; RESTOR - Init KERNAL RAM vectors
JSR $FF5B ; CINT - Init VIC and screen editor
CLI ; Re-enable IRQ interrupts
CartBReset
; init BASIC?
!ifdef CART_INIT_BASIC {
JSR $E453 ; Init BASIC RAM vectors
JSR $E3BF ; Main BASIC RAM Init routine
JSR $E422 ; Power-up message / NEW command
LDX #$FB
TXS ; Reduce stack pointer for BASIC
; don't init BASIC, just NOP
} else {
!fill 12, $ea ; nop
}
CartWStart
; should be * = $x025

View File

@ -1,24 +1,31 @@
#include <stdlib.h>
#include <string.h>
#include <c64.h>
#include <joystick.h>
#include "bcd.h"
//#link "bcd.c"
//#resource "c64-sid.cfg"
#define CFGFILE c64-sid.cfg
#include "common.h"
//#link "common.c"
#include "sidplaysfx.h"
//#resource "sidmusic1.bin"
//#link "sidplaysfx.ca65"
#include "rasterirq.h"
//#link "rasterirq.ca65"
#include "bcd.h"
//#link "bcd.c"
#include "scrolling.h"
//#link "scrolling.c"
#include "sprites.h"
//#link "sprites.c"
// indices of sound effects (0..3)
typedef enum { SND_START, SND_HIT, SND_COIN, SND_JUMP } SFXIndex;
// indices of sound effects
#define SND_JUMP 0
#define SND_HIT 2
#define SND_COIN 1
#define SND_FALL 3
///// DEFINES
@ -62,7 +69,7 @@ const byte ITEM_CHARS[3][4] = {
#define NUM_SPRITE_PATTERNS 13
/*{w:12,h:21,bpp:2,brev:1,count:13,aspect:2}*/
const char SPRITE_DATA[NUM_SPRITE_PATTERNS][3*21] = {
const char SPRITE_DATA[NUM_SPRITE_PATTERNS][64] = {
// left direction
{
0x00,0x00,0x00,0x00,0xA8,0x00,0x02,0xEA,0x00,
@ -372,8 +379,9 @@ void refresh_floor(byte floor) {
byte explode_timer = 0;
#define SPRITE_SHAPE_FIRST 192
#define SPRITE_XPLODE 7
#define SHAPE_XPLODE0 (32+10)
#define SHAPE_XPLODE0 (SPRITE_SHAPE_FIRST+10)
#define NUM_XPLODE_SHAPES 3
void explode(int x, byte y) {
@ -446,7 +454,7 @@ void draw_actor(byte i) {
a->onscreen = 0;
return; // offscreen vertically
}
name = 32 + (a->state - WALKING);
name = SPRITE_SHAPE_FIRST + (a->state - WALKING);
switch (a->state) {
case INACTIVE:
a->onscreen = 0;
@ -469,7 +477,7 @@ void draw_actor(byte i) {
void refresh_actors() {
byte i;
yscroll = BOTTOM_Y + scroll_fine_y + (START_ORIGIN_Y - origin_y)*8;
sprite_clear();
sprshad.spr_ena = 0; // make all sprites invisible
for (i=0; i<MAX_ACTORS; i++)
draw_actor(i);
animate_explosion();
@ -541,6 +549,7 @@ void move_actor(struct Actor* actor, byte joystick, bool scroll) {
actor->yvel = 15;
if (joystick & JOY_LEFT_MASK) actor->xvel = -1;
if (joystick & JOY_RIGHT_MASK) actor->xvel = 1;
if (scroll) sid_sfx(SND_JUMP);
} else if (joystick & JOY_LEFT_MASK) {
actor->x--;
actor->dir = 1;
@ -605,6 +614,7 @@ void move_actor(struct Actor* actor, byte joystick, bool scroll) {
if (actor->state == WALKING &&
is_in_gap(actor->x, floors[actor->level].gap)) {
fall_down(actor);
if (scroll) sid_sfx(SND_FALL);
}
}
@ -626,11 +636,11 @@ void pickup_object(Actor* actor) {
if (objtype == ITEM_MINE) {
// we hit a mine, fall down
fall_down(actor);
//sfx_play(SND_HIT,0);
sid_sfx(SND_HIT);
} else {
// we picked up an object, add to score
//score = bcd_add(score, 1);
//sfx_play(SND_COIN,0);
sid_sfx(SND_COIN);
}
}
}
@ -664,7 +674,7 @@ bool check_collision(Actor* a) {
///
void draw_blimp(struct cvu_sprite* sprite) {
void draw_blimp() {
/*
sprite->name = 48;
wait_vblank();
@ -680,7 +690,6 @@ void draw_blimp(struct cvu_sprite* sprite) {
cvu_set_sprite(SPRITES, 31, sprite);
refresh_actors();
*/
sprite=sprite;
}
void blimp_pickup_scene() {
@ -718,6 +727,9 @@ void play_scene() {
create_actors_on_floor(2);
refresh_screen();
sid_init(1);
sid_start();
while (actors[0].level != MAX_FLOORS-1) {
refresh_actors();
move_player();
@ -729,6 +741,7 @@ void play_scene() {
if (VIC.spr_coll & 0x01) {
if (actors[0].level > 0 && check_collision(&actors[0])) {
fall_down(&actors[0]);
sid_sfx(SND_HIT);
}
}
if (swap_needed) sprite_update(hidbuf);
@ -740,26 +753,34 @@ void play_scene() {
blimp_pickup_scene();
}
// main display list
void game_displaylist(void) {
// VIC.bordercolor = 2;
sid_update();
// VIC.bordercolor = 0;
// DLIST_NEXT(42);
// VIC.bordercolor = 3;
DLIST_RESTART(20);
}
// main program
void main() {
byte i;
// set up scrolling
scroll_setup();
// set up sprites
sprite_clear();
for (i=0; i<NUM_SPRITE_PATTERNS; i++) {
sprite_shape(hidbuf, 32+i, SPRITE_DATA[i]);
}
sprite_set_shapes(SPRITE_DATA, SPRITE_SHAPE_FIRST, NUM_SPRITE_PATTERNS);
sprshad.spr_mcolor = 0xff;
sprshad.spr_mcolor0 = 0x0f;
sprshad.spr_mcolor1 = 0x00;
VIC.spr_mcolor0 = 0x0f;
VIC.spr_mcolor1 = 0x00;
// select character set 2
VIC.addr = 0x15;
// start scrolling @ bottom of level
origin_y = START_ORIGIN_Y;
// install joystick
joy_install (joy_static_stddrv);
// setup display list
DLIST_SETUP(game_displaylist);
// main game loop
while (1) {
make_floors();

View File

@ -1,10 +1,40 @@
#include "common.h"
void raster_wait(unsigned char line) {
void raster_wait(byte line) {
while (VIC.rasterline < line) ;
}
void wait_vblank(void) {
raster_wait(255);
raster_wait(250);
}
static byte VIC_BANK_PAGE[4] = {
0xc0, 0x80, 0x40, 0x00
};
char* get_vic_bank_start() {
return (char*)(VIC_BANK_PAGE[CIA2.pra & 3] << 8);
}
char* get_screen_memory() {
return ((VIC.addr & 0xf0) << 6) + get_vic_bank_start();
}
#ifdef __CC65__
char __fastcall__ poll_keyboard() {
asm("jmp $f142");
return __A__;
}
#endif
void set_raster_irq(char scanline) {
// deactivate CIA interrupts (keyboard, etc)
CIA1.icr = 0x7f;
// set raster line for interrupt
VIC.ctrl1 &= 0x7f; // clear raster line bit 8
VIC.rasterline = scanline;
// activate VIC raster interrupts
VIC.imr = 1;
}

View File

@ -1,18 +1,141 @@
#ifndef _COMMON_H
#define _COMMON_H
#include <c64.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <peekpoke.h>
#include <string.h>
#include <c64.h>
typedef uint8_t byte;
typedef uint16_t word;
typedef int8_t sbyte;
typedef enum { false, true } bool;
#ifdef __CC65__
#include <conio.h>
#include <joystick.h>
#endif
#define COLS 40
#define ROWS 25
typedef uint8_t byte; // 8-bit unsigned
typedef int8_t sbyte; // 8-bit signed
typedef uint16_t word; // 16-bit unsigned
typedef enum { false, true } bool; // boolean
void raster_wait(unsigned char line);
void wait_vblank(void);
#define COLS 40 // total # of columns
#define ROWS 25 // total # of rows
///// MACROS /////
// VIC Control Register 1 Flags
#define VIC_CTRL1_RST8 0x80 // Bit 8 of RASTER (read) or raster line interrupt set (write)
#define VIC_CTRL1_ECM 0x40 // Extended Color Mode
#define VIC_CTRL1_BMM 0x20 // Bitmap Mode
#define VIC_CTRL1_DEN 0x10 // Display Enable
#define VIC_CTRL1_RSEL 0x08 // Row Select (25 or 24 rows)
#define VIC_CTRL1_YSCROLL_MASK 0x07 // Vertical Fine Scrolling
// VIC Control Register 2 Flags
#define VIC_CTRL2_RES 0x20 // Chip reset
#define VIC_CTRL2_MCM 0x10 // Multicolor Mode Enable
#define VIC_CTRL2_CSEL 0x08 // Column Select (40 or 38 columns)
#define VIC_CTRL2_XSCROLL_MASK 0x07 // Horizontal Fine Scrolling
// VIC Memory Control Register Flags
#define VIC_ADDR_VM_MASK 0xf0 // Video Matrix Base Address Mask (character data)
#define VIC_ADDR_CB_MASK 0x0e // Character Bank Base Address Mask (screen memory)
// VIC Interrupt Register Flags
#define VIC_IRR_IRQ 0x80 // Interrupt Request
#define VIC_IRR_ILP 0x08 // Light Pen Interrupt
#define VIC_IRR_IMMC 0x04 // Sprite-Sprite Collision Interrupt
#define VIC_IRR_IMBC 0x02 // Sprite-Background Collision Interrupt
#define VIC_IRR_IRST 0x01 // Raster Line Interrupt
// VIC Interrupt Mask Register Flags
#define VIC_IMR_ELP 0x08 // Enable Light Pen Interrupt
#define VIC_IMR_EMMC 0x04 // Enable Sprite-Sprite Collision Interrupt
#define VIC_IMR_EMBC 0x02 // Enable Sprite-Background Collision Interrupt
#define VIC_IMR_ERST 0x01 // Enable Raster Interrupt
// lookup screen address macro
#define SCRNADR(base,col,row) ((base)+(col)+(row)*40)
// default screen base address on startup
#define DEFAULT_SCREEN ((void*)0x400)
// is raster line > 255?
#define RASTER_HIBIT (VIC.ctrl1 & 0x80)
// set VIC Bank (given the start address)
#define SET_VIC_BANK(_addr) \
CIA2.pra = (CIA2.pra & ~3) | (((((_addr)>>8)&0xc0)>>6)^3);
// set VIC character memory (given the start address)
#define SET_VIC_BITMAP(_addr) \
VIC.addr = (VIC.addr & 0b11110001) | ((((_addr)>>8)&0x38)>>2);
// set VIC screen memory (given the start address)
#define SET_VIC_SCREEN(_addr) \
VIC.addr = (VIC.addr & 0b00001111) | ((((_addr)>>8)&0x3c)<<2);
// set scrolling registers
#define SET_SCROLL_Y(_y) \
VIC.ctrl1 = (VIC.ctrl1 & 0xf8) | (_y & 7);
#define SET_SCROLL_X(_x) \
VIC.ctrl2 = (VIC.ctrl2 & 0xf8) | (_x & 7);
// enable RAM from 0xa000-0xffff, disable interrupts
#define ENABLE_HIMEM() \
asm("php"); \
asm("sei"); \
POKE(1, PEEK(1) & ~0b111);
// enable ROM and interrupts
#define DISABLE_HIMEM() \
POKE(1, PEEK(1) | 0b111); \
asm("plp");
///// FUNCTIONS /////
// wait until specific raster line
void raster_wait(byte line);
// wait until end of frame
void wait_vblank();
// get current VIC bank start address
char* get_vic_bank_start();
// get current screen memory address
char* get_screen_memory();
// read joystick fast
#define READ_STICK(index) ~PEEK(0xdc01-(index))
#define STICK_UP(joy) ((joy & 0x1) != 0)
#define STICK_DOWN(joy) ((joy & 0x2) != 0)
#define STICK_LEFT(joy) ((joy & 0x4) != 0)
#define STICK_RIGHT(joy) ((joy & 0x8) != 0)
#define STICK_BUTTON(joy) ((joy & 0x10) != 0)
#define STICK_MOVED(joy) ((joy & 0x1f) != 0)
#ifdef __CC65__
// return key in buffer, or 0 if none (BIOS call)
char __fastcall__ poll_keyboard();
#endif
#ifndef __CC65__
inline void clrscr() {
__asm__ volatile ("jsr $E544" : : : "a","x","y"); // regs clobbered
}
inline void waitvsync() {
raster_wait(255);
}
#endif
// for use with set_irq()
// sets up the VIC to send raster interrupts
// and disables CIA interrupts
void set_raster_irq(char scanline);
#endif

View File

@ -0,0 +1,638 @@
#include <stdio.h>
#include <conio.h>
#include <c64.h>
#include <cbm_petscii_charmap.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <joystick.h>
//#resource "c64-sid.cfg"
#define CFGFILE c64-sid.cfg
#include "common.h"
//#link "common.c"
#include "scrolling.h"
//#link "scrolling2.c"
#include "sprites.h"
//#link "sprites.c"
//#link "level2.ca65"
#define CAMERA_OFFSET_X 158
#define CAMERA_OFFSET_Y 120
#define CAMERA_MAX_DX 12
#define CAMERA_MAX_DY 8
#define MAX_ACTORS 8
#define ACTOR_OFFSET_X 28
#define ACTOR_OFFSET_Y 30
#define ACTOR_WIDTH 24
#define ACTOR_HEIGHT 21
#define JUMP_VELOCITY -36
#define MAX_FALL_VELOCITY 64
#define MAX_HORIZ_VELOCITY 16
#define MAP_COLS 16
#define MAP_ROWS 16
#define DEFAULT_CHAR chartileset_data[16]
#define DEFAULT_COLOR chartileset_colour_data[1]
#define FLAG_SOLID 1
#define FLAG_PLATFORM 2
#define FLAG_LADDER 4
// level map data
extern const byte charset_data[];
extern const byte charset_attrib_data[];
extern const byte chartileset_data[];
extern const byte chartileset_colour_data[];
extern const byte chartileset_tag_data[];
extern const byte map_data[];
static byte framecount;
static byte framemask;
const byte BITMASKS[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
static byte tileflagmap[MAP_ROWS*MAP_COLS];
static byte tileindex;
static byte tilechar;
static bool get_cell_at(byte world_x, byte world_y) {
sbyte col = world_x >> 2;
sbyte row = world_y >> 2;
byte xofs = world_x & 3;
byte yofs = world_y & 3;
if (col < 0 || col >= MAP_COLS || row < 0 || row >= MAP_ROWS) {
return false;
} else {
tileindex = map_data[col + row * MAP_ROWS];
tilechar = chartileset_data[xofs + (yofs + tileindex*4)*4];
return true;
}
}
byte compute_tile_flags() {
switch (tileindex) {
case 3: return FLAG_PLATFORM;
case 4: return FLAG_PLATFORM;
case 5: return FLAG_SOLID;
case 6: return FLAG_LADDER;
case 7: return FLAG_PLATFORM | FLAG_LADDER;
case 8: return FLAG_SOLID;
default: return 0;
}
}
byte get_tile_flags(word world_x, word world_y) {
byte tilex = world_x >> 5;
byte tiley = world_y >> 5;
if (tilex < MAP_COLS && tiley < MAP_ROWS)
return tileflagmap[tilex + tiley*MAP_COLS];
else
return 0;
}
static void build_tile_flag_map(void) {
byte x,y;
byte i=0;
for (y=0; y<MAP_ROWS; y++) {
for (x=0; x<MAP_COLS; x++) {
if (get_cell_at(x*4, y*4))
tileflagmap[i++] = compute_tile_flags();
}
}
}
static void draw_cell(word ofs, byte scrn_x, byte scrn_y) {
byte ch, color;
if (get_cell_at(scrn_x + origin_x, scrn_y + origin_y)) {
ch = tilechar;
color = chartileset_colour_data[tileindex];
} else {
ch = DEFAULT_CHAR;
color = DEFAULT_COLOR;
}
hidbuf[ofs] = ch;
colorbuf[ofs] = color;
}
void scroll_draw_column(byte col) {
byte y;
word ofs = col;
for (y=0; y<ROWS; y++) {
draw_cell(ofs, col, y);
ofs += COLS;
}
}
void scroll_draw_row(byte row) {
byte x;
word ofs = row * COLS;
for (x=0; x<COLS; x++) {
draw_cell(ofs, x, row);
++ofs;
}
}
#define NUM_SPRITE_PATTERNS 13
/*{w:12,h:21,bpp:2,brev:1,count:13,aspect:2}*/
const char SPRITE_DATA[NUM_SPRITE_PATTERNS][64] = {
// left direction
{
0x00,0x00,0x00,0x00,0xA8,0x00,0x02,0xEA,0x00,
0x02,0xEA,0x00,0x02,0xEA,0x00,0x02,0xEA,0x00,
0x00,0xA8,0x50,0x00,0x15,0x50,0x00,0xAA,0x50,
0x00,0xAA,0x50,0x00,0xAA,0x50,0x0A,0xAA,0x50,
0x02,0xAA,0x50,0x00,0xFF,0x00,0x00,0xAA,0x00,
0x00,0xAA,0x00,0x00,0xA2,0x80,0x00,0xA2,0x80,
0x00,0x22,0x80,0x01,0x51,0x40,0x01,0x51,0x40
},
{
0x00,0x00,0x00,0x00,0xA8,0x00,0x02,0xAA,0x00,
0x02,0xAA,0x00,0x22,0xAA,0x00,0x22,0xAA,0x00,
0x20,0xA8,0x00,0x28,0x54,0x00,0x2A,0x56,0x80,
0x0A,0x56,0xA0,0x02,0x56,0xA0,0x02,0x56,0x20,
0x02,0x56,0x20,0x03,0xFF,0x20,0x02,0xAA,0x00,
0x02,0x8A,0x00,0x02,0x8A,0x00,0x01,0x4A,0x00,
0x05,0x4A,0x00,0x00,0x05,0x00,0x00,0x05,0x40
},
{
0x00,0x00,0x00,0x00,0xA8,0x00,0x02,0xEA,0x00,
0x02,0xEA,0x00,0x02,0xEA,0x00,0x02,0xEA,0x00,
0x00,0xA8,0x50,0x00,0x15,0x50,0x00,0xAA,0x50,
0x20,0xAA,0x50,0x2A,0xAA,0x50,0x0A,0xAA,0x50,
0x00,0xAA,0x50,0x00,0xFF,0x00,0x00,0xAA,0x00,
0x00,0xAA,0x00,0x0A,0xA2,0x80,0x0A,0xA2,0x94,
0x0A,0x02,0x94,0x15,0x00,0x94,0x15,0x00,0x04
},
{
0x00,0x00,0x00,0x00,0x2A,0x00,0x00,0xBF,0x80,
0x00,0xAE,0x80,0x00,0xAE,0x80,0x00,0xAE,0x80,
0x00,0x2A,0x00,0x00,0x15,0x02,0x20,0xAA,0xAA,
0x2A,0xBF,0xA8,0x0A,0xAA,0xA0,0x02,0xBF,0x80,
0x00,0xAA,0x80,0x00,0xFF,0xC0,0x00,0xAA,0x80,
0x00,0xAA,0x80,0x02,0xA2,0xA0,0x02,0x80,0xA0,
0x02,0x80,0xA0,0x01,0x40,0x50,0x05,0x40,0x54
},
{
0x00,0x00,0x00,0x00,0xA8,0x00,0x02,0xEA,0x00,
0x02,0xEA,0x00,0x02,0xEA,0x00,0x02,0xEA,0x00,
0x00,0xA8,0x50,0x00,0x15,0x50,0x00,0xAA,0x50,
0x08,0xAA,0x90,0x0A,0xAA,0xA0,0x02,0xAA,0x60,
0x00,0xAA,0x50,0x00,0xFF,0x00,0x00,0xAA,0x00,
0x00,0xA2,0x00,0x00,0xA8,0x80,0x00,0x2A,0x80,
0x02,0x8A,0x90,0x01,0x40,0x50,0x05,0x41,0x40
},
// right direction
{
0x00,0x00,0x00,0x00,0x2A,0x00,0x00,0xAB,0x80,
0x00,0xAB,0x80,0x00,0xAB,0x80,0x00,0xAB,0x80,
0x05,0x2A,0x00,0x05,0x54,0x00,0x05,0xAA,0x00,
0x05,0xAA,0x00,0x05,0xAA,0x00,0x05,0xAA,0xA0,
0x05,0xAA,0x80,0x00,0xFF,0x00,0x00,0xAA,0x00,
0x00,0xAA,0x00,0x02,0x8A,0x00,0x02,0x8A,0x00,
0x02,0x88,0x00,0x01,0x45,0x40,0x01,0x45,0x40
},
{
0x00,0x00,0x00,0x00,0xA8,0x00,0x02,0xAA,0x00,
0x02,0xAA,0x00,0x02,0xAA,0x20,0x02,0xAA,0x20,
0x00,0xA8,0x20,0x00,0x54,0xA0,0x0A,0x56,0xA0,
0x2A,0x56,0x80,0x2A,0x56,0x00,0x22,0x56,0x00,
0x22,0x56,0x00,0x23,0xFF,0x00,0x02,0xAA,0x00,
0x02,0x8A,0x00,0x02,0x8A,0x00,0x02,0x85,0x00,
0x02,0x85,0x40,0x01,0x40,0x00,0x05,0x40,0x00
},
{
0x00,0x00,0x00,0x00,0x2A,0x00,0x00,0xAB,0x80,
0x00,0xAB,0x80,0x00,0xAB,0x80,0x00,0xAB,0x80,
0x05,0x2A,0x00,0x05,0x54,0x00,0x05,0xAA,0x00,
0x05,0xAA,0x08,0x05,0xAA,0xA8,0x05,0xAA,0xA0,
0x05,0xAA,0x00,0x00,0xFF,0x00,0x00,0xAA,0x00,
0x00,0xAA,0x00,0x02,0x8A,0xA0,0x16,0x8A,0xA0,
0x16,0x80,0xA0,0x16,0x00,0x54,0x10,0x00,0x54
},
{
0x00,0x00,0x00,0x00,0x2A,0x00,0x00,0xBF,0x80,
0x00,0xAE,0x80,0x00,0xAE,0x80,0x00,0xAE,0x80,
0x00,0x2A,0x00,0x20,0x15,0x00,0x2A,0xAA,0x82,
0x0A,0xBF,0xAA,0x02,0xAA,0xA8,0x00,0xBF,0xA0,
0x00,0xAA,0x80,0x00,0xFF,0xC0,0x00,0xAA,0x80,
0x00,0xAA,0x80,0x02,0xA2,0xA0,0x02,0x80,0xA0,
0x02,0x80,0xA0,0x01,0x40,0x50,0x05,0x40,0x54
},
{
0x00,0x00,0x00,0x00,0x2A,0x00,0x00,0xAB,0x80,
0x00,0xAB,0x80,0x00,0xAB,0x80,0x00,0xAB,0x80,
0x05,0x2A,0x00,0x05,0x54,0x00,0x05,0xAA,0x00,
0x06,0xAA,0x20,0x0A,0xAA,0xA0,0x09,0xAA,0x80,
0x05,0xAA,0x00,0x00,0xFF,0x00,0x00,0xAA,0x00,
0x00,0x8A,0x00,0x02,0x2A,0x00,0x02,0xA8,0x00,
0x06,0xA2,0x80,0x05,0x01,0x40,0x01,0x41,0x50
},
// explosion
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,
0x00,0x20,0x00,0x08,0x20,0x80,0x02,0x02,0x00,
0x00,0x10,0x00,0x00,0x54,0x00,0x00,0x10,0x00,
0x02,0x02,0x00,0x08,0x20,0x80,0x00,0x20,0x00,
0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
},
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xA8,0x00,0x02,0x02,0x00,
0x08,0x00,0x80,0x20,0x00,0x20,0x20,0x54,0x20,
0x21,0x01,0x20,0x21,0x01,0x20,0x21,0x01,0x20,
0x20,0x54,0x20,0x20,0x00,0xA0,0x08,0x00,0x80,
0x02,0x02,0x00,0x00,0xA8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
},
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xA8,0x00,0x02,0x02,0x00,
0x08,0x10,0x80,0x08,0x54,0x80,0x08,0x10,0x80,
0x02,0x02,0x00,0x00,0xA8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
},
};
typedef enum {
STANDING, JUMPING, CLIMBING
} ActorState;
typedef struct Actor {
word xx;
word yy;
sbyte xvel;
sbyte yvel;
ActorState state;
bool faceleft;
} Actor;
Actor actors[MAX_ACTORS];
Actor* const player = &actors[0];
void draw_actor(register Actor* actor, byte index) {
byte shape = 240;
word xpos = actor->xx + pixofs_x + fine_correct_x + ACTOR_OFFSET_X;
word ypos = actor->yy + pixofs_y + fine_correct_y + ACTOR_OFFSET_Y;
if (xpos > 320 || ypos > 250) {
ypos = 255;
}
switch (actor->state) {
case STANDING:
if (actor->xvel && actor->xx & 4) shape += 4;
if (!actor->faceleft) shape += 5;
break;
case JUMPING:
shape += 2;
if (!actor->faceleft) shape += 5;
break;
case CLIMBING:
shape += 1;
if (actor->yy & 2) shape += 5;
break;
}
sprite_draw(index, xpos, ypos, shape);
}
const char velocity_bitmasks[8] = {
0b00000000, // 0/8
0b00001000, // 1/8
0b00100010, // 2/8
0b10010010, // 3/8
0b01010101, // 4/8
0b01110101, // 5/8
0b11101110, // 6/8
0b11110111, // 7/8
// 0b11111111, // 8/8
};
static byte box[4]; // hit box
/*
void actor_set_position(register Actor* actor,
word world_x,
word world_y,
ActorState state) {
actor->xx = world_x;
actor->yy = world_y;
actor->state = state;
actor->tileindex = (world_x>>5) | (world_y>>5)*MAP_COLS;
}
*/
void move_actor(register Actor* actor,
sbyte cmd_dx,
sbyte cmd_dy) {
word xx,yy;
byte flags;
sbyte dx = cmd_dx;
sbyte dy = cmd_dy;
bool state = actor->state;
xx = actor->xx + dx;
yy = actor->yy + dy;
// if we are standing, move hit box 1 pixel below our feet
if (state == STANDING) {
yy += 1 - dy; // cancel out any climbing vertical offset (dy)
dy = 0;
}
// get hit box flags on all 4 corners
{
box[0] = get_tile_flags(xx, yy-ACTOR_HEIGHT);
box[1] = get_tile_flags(xx+ACTOR_WIDTH, yy-ACTOR_HEIGHT);
box[2] = get_tile_flags(xx, yy);
box[3] = get_tile_flags(xx+ACTOR_WIDTH, yy);
// cancel x velocity if either top corners is solid
if (dx < 0 && ((box[0] | box[2]) & FLAG_SOLID)) {
if (state != STANDING || box[0] & FLAG_SOLID) {
actor->xvel = 0;
dx = 0;
}
}
else if (dx > 0 && ((box[1] | box[3]) & FLAG_SOLID)) {
if (state != STANDING || box[1] & FLAG_SOLID) {
actor->xvel = 0;
dx = 0;
}
}
// cancel upward velocity if both top corners are solid
if (dy < 0 && ((box[0] | box[1]) & FLAG_SOLID)) {
actor->yvel = 0;
dy = 0;
}
switch (state) {
case JUMPING:
// are we moving downward?
if (dy > 0) {
// hit a solid brick?
flags = box[2] | box[3];
if (flags & FLAG_SOLID) {
// don't land if we are bumping against a wall
// but land if entire bottom border is solid
if (box[2] & box[3] & FLAG_SOLID) flags = FLAG_PLATFORM;
else if (box[0] & box[2] & FLAG_SOLID) { }
else if (box[1] & box[3] & FLAG_SOLID) { }
else flags = FLAG_PLATFORM;
}
// land on platform, but only if we
// transit past the lower boundary of a cell
if (flags & FLAG_PLATFORM) {
// maximum speed is 8 pixels/frame
if ((yy & 31) <= 8) {
if ((actor->yy & 31) >= 24) {
actor->yy |= 31;
actor->yvel = 0;
dy = 0;
actor->state = STANDING;
}
}
}
}
break;
case STANDING:
// if either bottom corner is empty, fall down
if ((box[2] | box[3]) == 0) {
actor->state = JUMPING;
}
// climbing a ladder?
else if (cmd_dy) {
// look at top corners if going up, bottom corners if down
flags = cmd_dy < 0 ? box[0] & box[1] : box[2] & box[3];
if (flags & FLAG_LADDER) {
actor->state = CLIMBING;
} else {
dy = 0;
}
}
break;
case CLIMBING:
// any flags set on bottom corners?
flags = box[2] & box[3];
if (!(flags & FLAG_LADDER)) {
// top of ladder, stand up
if (dy < 0) {
actor->state = STANDING;
} else {
// bottom of ladder, don't go thru floor
actor->state = JUMPING;
dy = 0;
}
}
break;
}
}
// update position and tile coordinate
// unless we zeroed out the velocity
if (dx) actor->xx += dx;
if (dy) actor->yy += dy;
}
void control_actor(register Actor* actor, byte joy) {
sbyte dx = 0;
sbyte dy = 0;
sbyte speed = 1;
ActorState state = actor->state;
// jump button
if (JOY_BTN_1(joy) && state == STANDING) {
actor->yvel = JUMP_VELOCITY;
actor->state = state = JUMPING;
framecount = 0; // TODO?
}
// update position based on x/y velocity
if (actor->xvel) {
dx += actor->xvel >> 3;
if (framemask & velocity_bitmasks[actor->xvel & 7]) {
dx++;
}
}
if (actor->yvel) {
dy += actor->yvel >> 3;
if (framemask & velocity_bitmasks[actor->yvel & 7]) {
dy++;
}
}
// apply gravity when jumping or falling
if (state == JUMPING &&
actor->yvel < MAX_FALL_VELOCITY) {
actor->yvel += 2;
}
// arrow keys give left/right velocity
if (JOY_LEFT(joy)) {
actor->faceleft = true;
if (actor->xvel > -MAX_HORIZ_VELOCITY)
actor->xvel -= speed;
} else if (JOY_RIGHT(joy)) {
actor->faceleft = false;
if (actor->xvel < MAX_HORIZ_VELOCITY)
actor->xvel += speed;
} else {
// slow down actor to a stop, horizontally
if (actor->xvel) actor->xvel /= 2;
}
// climb ladder?
if (state == STANDING || state == CLIMBING) {
if (JOY_UP(joy)) { dy = -1; }
if (JOY_DOWN(joy)) { dy = 1; }
}
// move sprite
if (dx | dy) {
move_actor(actor, dx, dy);
}
}
void camera_follow(register Actor* actor) {
int dx, dy;
byte moving = actor->xvel || actor->yvel;
// compute distance between player and camera
dx = CAMERA_OFFSET_X - pixofs_x - actor->xx;
dy = CAMERA_OFFSET_Y - pixofs_y - actor->yy;
// if we are moving, scroll only when distance
// from center is greater
if (moving) {
if (dx < -CAMERA_MAX_DX) dx += CAMERA_MAX_DX;
else if (dx > CAMERA_MAX_DX) dx -= CAMERA_MAX_DX;
else dx = 0;
if (dy < -CAMERA_MAX_DY) dy += CAMERA_MAX_DY;
else if (dy > CAMERA_MAX_DY) dy -= CAMERA_MAX_DY;
else dy = 0;
}
// divide dx and dy by 16
dx >>= 4;
dy >>= 4;
// do we need to scroll?
if (dx || dy) {
// what direction?
byte dir = 0;
if (dx < 0) dir |= SCROLL_LEFT;
if (dx > 0) dir |= SCROLL_RIGHT;
if (dy < 0) dir |= SCROLL_UP;
if (dy > 0) dir |= SCROLL_DOWN;
// start the scroll (ignored if one is already going)
scroll_start(dir);
// fast 8-pixel scroll if screen is moving too fast
if (moving && (abs(dx) >= 4 || abs(dy) >= 4)) {
scroll_finish();
}
}
}
void control_enemy(struct Actor* enemy) {
byte control = 0;
int pdx = player->xx - enemy->xx;
int pdy = player->yy - enemy->yy;
if (pdy > 0) {
control |= JOY_DOWN_MASK;
} else if (pdy < 0) {
control |= JOY_UP_MASK;
}
if (pdx < -32) {
control |= JOY_LEFT_MASK;
} else if (pdx > 32) {
control |= JOY_RIGHT_MASK;
}
control_actor(enemy, control);
}
void next_frame() {
char joy;
// increment frame counter
framemask = BITMASKS[++framecount & 7];
// get joystick bits
joy = joy_read(0);
// move player
control_actor(player, joy);
// move enemy
control_enemy(&actors[1]);
// move the camera if needed
camera_follow(player);
// animate sprites in shadow sprite ram
draw_actor(&actors[0], 0);
draw_actor(&actors[1], 1);
// wait for vblank
wait_vblank();
// then update sprite registers
sprite_update(visbuf);
// do scrolling stuff each frame
scroll_update();
}
void setup_sprites(void) {
sprite_clear();
sprite_set_shapes(SPRITE_DATA, 240, NUM_SPRITE_PATTERNS);
sprshad.spr_color[0] = COLOR_WHITE;
sprshad.spr_color[1] = COLOR_LIGHTRED;
sprshad.spr_mcolor = 0xff;
VIC.spr_mcolor0 = 12;
VIC.spr_mcolor1 = 14;
}
void setup_charset() {
// multicolor character mode
VIC.ctrl2 |= 0x10;
VIC.bgcolor0 = 6;
VIC.bgcolor1 = 0;
VIC.bgcolor2 = 1;
// select character set @ 0x8800
VIC.addr = 0x12;
memcpy((char*)0x8800, charset_data, 0x800);
}
void main(void) {
clrscr();
// setup scrolling library
scroll_setup();
// setup the character set for the level
setup_charset();
// copy sprites to VIC bank
setup_sprites();
// build cache for actor-level collisions
build_tile_flag_map();
// install the joystick driver
joy_install (joy_static_stddrv);
// repaint screen memory w/ the map
scroll_refresh();
player->xx = 3*32+8;
player->yy = 2*32+8-16;
player->xx = 0;
player->yy = 31;
player->state = STANDING;
/*
player->xx = 32;
player->yy = 0;
player->xx = 33;
player->yy = 100;
player->state = JUMPING;
*/
// actor_set_position(player, 63, 63, STANDING);
actors[1].xx = 128;
// infinite loop
while (1) {
next_frame();
}
}

42
presets/c64/hello.acme Normal file
View File

@ -0,0 +1,42 @@
!src "cartheader.acme"
!address {
Temp = $02
}
Start:
sei ; turn off interrupts
ldy #0
Loop:
lda Message,y ; load message byte
beq EOM ; 0 = end of string
clc
adc #$40
sta $400+41,y ; store to screen
iny
bne Loop ; next character
EOM:
Wait1:
lda $d011
bmi Wait1 ; wait for line < 256
Wait2:
lda $d012 ; get current scanline
Wait3:
cmp $d012
beq Wait3 ; wait for scanline to change
lsr ; divide by 2
lsr ; divide by 2
clc
adc Temp ; add to frame counter
sta $d020 ; set border color
lda $d011 ; get status bits
bpl Wait2 ; repeat until line >= 256
sty $d020 ; reset border color
dec Temp ; change frame counter
jmp Wait1 ; endless loop
Message:
!scr "HELLO WORLD", 0

View File

@ -3,7 +3,9 @@
; program start
Temp equ $03
Start
jsr $FF81 ; CINT (clear screen)
sei ; turn off interrupts
ldy #0
sty $d020 ; reset border color

181
presets/c64/hello.wiz Normal file
View File

@ -0,0 +1,181 @@
import "c64.wiz";
bank zeropage @ 0x02 : [vardata; 254];
bank stackpage @ 0x100 : [vardata; 256];
bank textscrn @ 0x400 : [vardata; 0x400];
bank ram @ 0x2000 : [vardata; 0x7800];
bank prghdr @ 0x7ff : [prgdata; 0x2];
bank prg @ 0x801 : [varinitdata; 0x7000];
in textscrn {
var scrn: [u8; 40*25];
var _unused: [u8; 16];
var spriteptr: [u8; 8];
}
extern var vicbank @ 0x0000 : VICBank;
// PRG file header
in prghdr {
const prgstart : u16 = 0x801;
}
// BASIC header
in prg {
namespace prgheader {
const nextline = &BASIC_END;
const linenum : u16 = 10;
const sysstmt = "\x9e 2062\0";
BASIC_END:
const hdrend : u16 = 0;
}
PRG_START:
/*
c64.kernal.ioinit();
c64.kernal.rantam();
c64.kernal.restor();
c64.kernal.cint();
*/
c64.vic.bordercolor = a = c64.color.ORANGE;
c64.kernal.chrout('A');
for x in 0..250 {
// scrn[x] = a = x;
// (&scrn[40*8])[x] = a = x;
// (0x600 as *u8)[x] = a = x;
(&scrn[40*12])[x] = a = message[x] + 0xc0;
}
for x in 0..255 {
a = message[x];
break if zero;
a += 0xc0;
(&scrn[40*20])[x] = a;
}
upandaway();
return;
const message = "HELLO WORLD!\0";
const SPRITE : [u8; 3*21] = [
/*{w:24,h:21,bpp:1,brev:1}*/
0x00,0x7F,0x00,0x01,0xFF,0xC0,0x03,0xFF,0xE0,
0x03,0xE7,0xE0,0x07,0xD9,0xF0,0x07,0xDF,0xF0,
0x07,0xD9,0xF0,0x03,0xE7,0xE0,0x03,0xFF,0xE0,
0x03,0xFF,0xE0,0x02,0xFF,0xA0,0x01,0x7F,0x40,
0x01,0x3E,0x40,0x00,0x9C,0x80,0x00,0x9C,0x80,
0x00,0x49,0x00,0x00,0x49,0x00,0x00,0x3E,0x00,
0x00,0x3E,0x00,0x00,0x3E,0x00,0x00,0x1C,0x00
];
const yValues : [u8] = [
32, 35, 38, 41, 44, 47, 49, 52,
54, 56, 58, 60, 61, 62, 63, 63,
64, 63, 63, 62, 61, 60, 58, 56,
54, 52, 49, 47, 44, 41, 38, 35,
32, 28, 25, 22, 19, 16, 14, 11,
9, 7, 5, 3, 2, 1, 0, 0,
0, 0, 0, 1, 2, 3, 5, 7,
9, 11, 14, 16, 19, 22, 25, 28
];
const pwr2 : [u8] = [
0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80
];
in zeropage {
var b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15 : u8;
var w0 @ &b0, w2 @ &b2, w4 @ &b4, w6 @ &b6, w8 @ &b8, w10 @ &b10 : u16;
var ptr0 @ &b0, ptr2 @ &b2, ptr4 @ &b4, ptr6 @ &b6, ptr8 @ &b8, ptr10 @ &b10 : *u8;
}
inline func rasterWait(line : u8 in a) {
while (c64.vic.rasterline < line) { }
}
func upandaway() {
//unsigned char n, t;
//int rx, x;
//char sx, msb;
var xp : u16 in w0;
var rx : u16 in w2;
var msb : u8 in b4;
let sprdata = &vicbank.spritedata[13] as *u8;
c64.vic.bgcolor[0] = a = 3;
nointerrupt = true; // clear interrupts to avoid glitching
for y in 0..(sizeof(typeof(SPRITE)) - 1) {
sprdata[y] = a = SPRITE[y];
//POKE(832 + n, sprite[n]);
}
c64.vic.sprite.enable = a = 255;
for x in 0..7 {
spriteptr[x] = a = 13;
y = a = x<<1;
c64.vic.sprite.coord[y] = a = 50;
y ++;
c64.vic.sprite.coord[y] = a = 50;
//POKE(2040 + t, 13); // Set sprite x data from 13th block for all sprites
}
do {
<:xp = a = 0;
>:xp = a = 0;
//while (xp < 550) {
while (true) {
<:xp = a = <:xp + 1;
>:xp = a = >:xp +# 0;
msb = a = 0; // MSB of X coordinates
// Wait until raster hits position 250 before drawing upper sprites
rasterWait(250);
// Set border color, which indicates the raster position
c64.vic.bordercolor = a = 1;
<:rx = a = <:xp;
>:rx = a = >:xp;
for x in 0..7 {
<:rx = a = <:rx - 24;
>:rx = a = >:rx -# 0;
//if (rx >= 0 && rx < 366)
if (true) {
// if (rx > 255)
a = >:rx;
if (!zero) {
// Set MSB of x coordinate for sprite if x position > 255
a = msb;
a |= pwr2[x];
msb = a;
}
y = a = x<<1;
c64.vic.sprite.coord[y] = a = <:rx;
// Y position is an indirect Sinus function of X, using array
// index for retrieving the Y value
y = a = <:rx & 63;
a = yValues[y] + 40;
push(a);
y = a = (x<<1) + 1;
a = pop();
c64.vic.sprite.coord[y] = a;
} else {
c64.vic.sprite.pos[y].x = 0;
}
}
c64.vic.sprite.hi_x = a = msb; // Set MSB of x coordinate
// Wait until raster hits position 135 before drawing lower sprites
rasterWait(135);
c64.vic.bordercolor = a = 2; // Set border color
for x in 0..7 {
// Add 128 to current sprite Y position
y = a = (x<<1) + 1;
c64.vic.sprite.coord[y] = a = c64.vic.sprite.coord[y]+128;
}
cmp(a = >:xp, >:550);
if (zero) {
cmp(a = <:xp, <:550);
break if zero;
}
}
} while (true);
return;
}
}

16
presets/c64/helloc.c Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
#include <conio.h>
#include <c64.h>
#include <cbm_petscii_charmap.h>
void main(void) {
clrscr(); // clear screen
puts("Hello World!\n"); // write message at cursor
chline(12); // horizontal line
bordercolor(COLOR_LIGHTBLUE); // set color to blue
bgcolor(COLOR_GREEN); // set background color
textcolor(COLOR_YELLOW); // set text color
puts("\nThis text is yellow!\n"); // write message
cgetc(); // wait for input
}

Binary file not shown.

131
presets/c64/joygame.c Normal file
View File

@ -0,0 +1,131 @@
#include "common.h"
//#link "common.c"
#include "sprites.h"
//#link "sprites.c"
#define NUM_SPRITES 3
/*{w:12,h:21,bpp:2,brev:1,wpimg:64,count:3,aspect:2}*/
const char SPRITE_MC_DATA[64*NUM_SPRITES] = {
0x0A,0xAA,0x80,0x0A,0xAA,0x80,0x2A,0xAA,
0xA0,0x2A,0xAA,0xA0,0xAA,0xAA,0xAA,0xFF,
0xD5,0x40,0x0D,0xD7,0x40,0x3D,0xD5,0x54,
0x37,0x55,0x54,0x37,0x55,0x54,0x35,0x55,
0x00,0x3A,0xA0,0x00,0xEA,0xA8,0x00,0xAB,
0xAA,0x00,0xAB,0xAA,0x00,0xAB,0xAA,0x80,
0xAA,0xEA,0x80,0xAA,0xAA,0x80,0x0F,0xFC,
0x00,0x0F,0xFC,0x00,0x0F,0xFF,0xC0,0x00,
0x02,0xAA,0xA0,0x02,0xAA,0xA0,0x0A,0xAA,
0xA8,0x0A,0xAA,0xA8,0xAA,0xAA,0xAA,0x01,
0x57,0xFF,0x01,0xD7,0x70,0x15,0x57,0x7C,
0x15,0x55,0xDC,0x15,0x55,0xDC,0x00,0x55,
0x5C,0x00,0x0A,0xAC,0x00,0x2A,0xAB,0x00,
0xAA,0xEA,0x00,0xAA,0xEA,0x02,0xAA,0xEA,
0x02,0xAB,0xAA,0x02,0xAA,0xAA,0x00,0x3F,
0xF0,0x00,0x3F,0xF0,0x03,0xFF,0xF0,0x00,
0x00,0xAA,0x80,0x02,0xAA,0xA0,0x0A,0xAA,0xA8,
0x0A,0xAE,0xA8,0x0A,0xBB,0xA8,0x0A,0xBA,0xA8,
0x0A,0xBB,0xA8,0x0A,0xAE,0xA8,0x0A,0xAA,0xA8,
0x09,0xAA,0x98,0x08,0x6A,0x48,0x08,0x1D,0x08,
0x02,0x0C,0x20,0x02,0x0C,0x20,0x02,0x0C,0x20,
0x00,0x8C,0x80,0x00,0x8C,0x80,0x00,0x55,0x40,
0x00,0x77,0x40,0x00,0x5D,0x40,0x00,0x15,0x00,
0x80,
};
// starting index for sprites
#define SPRITE_SHAPE 192
// player data
int player_x = 172;
byte player_y = 145;
byte faceleft = 0; // 0 = face right, 1 = face left
void init_sprite_shapes(void) {
byte i;
for (i=0; i<NUM_SPRITES; i++) {
sprite_shape(SPRITE_SHAPE+i, SPRITE_MC_DATA+64*i);
}
}
void init_sprite_positions(void) {
byte i;
// setup sprite positions
player_x = 172;
player_y = 145;
// set random positions for non-players
// and draw them to sprite shadow buffer
srand(7);
for (i=1; i<8; i++) {
int x = rand() % (320 - 24) + 24;
byte y = rand() % (229 - 50) + 50;
sprite_draw(i, x, y, SPRITE_SHAPE + 2);
sprshad.spr_color[i] = i | 8;
}
}
void move_player(byte joy) {
// move sprite based on joystick
if (JOY_LEFT(joy)) { player_x -= 1; faceleft = 1; } // move left 1 pixel
if (JOY_RIGHT(joy)) { player_x += 1; faceleft = 0; } // move right 1 pixel
if (JOY_UP(joy)) { player_y -= 1; } // move up 1 pixel
if (JOY_DOWN(joy)) { player_y += 1; } // move down 1 pixel
// draw player into sprite shadow buffer
sprite_draw(0, player_x, player_y, SPRITE_SHAPE + faceleft);
}
void move_non_players(void) {
byte i;
// wiggle non-player sprites randomly
for (i=1; i<8; i++) {
sprshad.spr_pos[i].y += rand() & i;
}
}
void main(void) {
// variables
byte bgcoll; // sprite background collision flags
byte sprcoll; // sprite collision flags
byte joy; // joystick flags
clrscr();
// install the joystick driver
joy_install (joy_static_stddrv);
// set multicolor sprites and colors
sprshad.spr_mcolor = 0b11111111;
sprshad.spr_color[0] = SPRITE_MC_DATA[63];
VIC.spr_mcolor0 = COLOR_GRAY2;
VIC.spr_mcolor1 = COLOR_BLACK;
// setup sprites
init_sprite_shapes();
init_sprite_positions();
// loop forever
while (1) {
// wait for end of frame
waitvsync();
// update sprite registers from sprite shadow
// buffer before frame starts drawing
sprite_update(DEFAULT_SCREEN);
// get joystick bits
joy = joy_read(0);
move_player(joy);
// move other objects
move_non_players();
// grab and reset collision flags
sprcoll = VIC.spr_coll;
bgcoll = VIC.spr_bg_coll;
// change color when player collides with sprite
sprshad.spr_color[0] = (sprcoll & 1) ? 10 : 3;
}
}

View File

@ -1,94 +1,59 @@
// ported from
// https://odensskjegg.home.blog/2018/12/29/recreating-the-commodore-64-user-guide-code-samples-in-cc65-part-three-sprites/
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <peekpoke.h>
#include <c64.h>
#include <joystick.h>
#include "common.h"
/*{w:24,h:21,bpp:1,brev:1}*/
const char sprite[3*21] = {
0x00,0x7F,0x00,0x01,0xFF,0xC0,0x03,0xFF,0xE0,
0x03,0xE7,0xE0,0x07,0xD9,0xF0,0x07,0xDF,0xF0,
0x07,0xD9,0xF0,0x03,0xE7,0xE0,0x03,0xFF,0xE0,
0x03,0xFF,0xE0,0x02,0xFF,0xA0,0x01,0x7F,0x40,
0x01,0x3E,0x40,0x00,0x9C,0x80,0x00,0x9C,0x80,
0x00,0x49,0x00,0x00,0x49,0x00,0x00,0x3E,0x00,
0x00,0x3E,0x00,0x00,0x3E,0x00,0x00,0x1C,0x00
/*{w:24,h:21,bpp:1,brev:1,count:1}*/
const char SPRITE_DATA[64] = {
0x0f,0xff,0x80,0x17,0xff,0x40,0x2b,0xfe,
0xa0,0x7f,0xff,0xf0,0xff,0xc0,0x3f,0xe0,
0x3f,0xc0,0x17,0xbe,0xc0,0x2d,0x7f,0xf0,
0x2b,0x7f,0xf8,0x2a,0xff,0xf8,0x15,0xf6,
0x00,0x3f,0xf8,0x00,0xfd,0xfc,0x00,0xfd,
0xff,0x00,0xfe,0xff,0x80,0xff,0x7f,0xc0,
0xff,0xff,0xc0,0xff,0xff,0xc0,0x0a,0xa8,
0x00,0x0f,0xf8,0x00,0x0f,0xff,0x80,0x03,
};
/*{w:12,h:21,bpp:2,brev:1}*/
const char spritemc[3*21] = {
0x00,0xFF,0xC0,0x03,0xFF,0xF0,0x0F,0xFF,0xFC,
0x0F,0xFB,0xFC,0x0F,0xEE,0xFC,0x0F,0xEF,0xFC,
0x0F,0xEE,0xFC,0x0F,0xFB,0xFC,0x0F,0xFF,0xFC,
0x09,0xFF,0xD8,0x08,0x7F,0x48,0x08,0x1D,0x08,
0x02,0x0C,0x20,0x02,0x0C,0x20,0x02,0x0C,0x20,
0x00,0x8C,0x80,0x00,0x8C,0x80,0x00,0x55,0x40,
0x00,0x77,0x40,0x00,0x5D,0x40,0x00,0x15,0x00
};
void main(void) {
// variables
int x = 172; // sprite X position (16-bit)
byte y = 145; // sprite Y position (8-bit)
byte bgcoll; // sprite background collision flags
byte joy; // joystick flags
// Raster wait with line argument
void rasterWait(unsigned char line) {
while (VIC.rasterline < line) ;
}
int main (void)
{
int n;
int x,y;
char bgcoll;
// copy sprite pattern to RAM address 0x3800
memcpy((char*)0x3800, SPRITE_DATA, sizeof(SPRITE_DATA));
// set sprite #0 shape entry (224)
POKE(0x400 + 0x3f8 + 0, 0x3800 / 64);
// set position and color
VIC.spr_pos[0].x = 172;
VIC.spr_pos[0].y = 145;
VIC.spr_color[0] = COLOR_GREEN;
// enable sprite #0
VIC.spr_ena = 0b00000001;
// install the joystick driver
joy_install (joy_static_stddrv);
// set background color
VIC.bgcolor0 = 3;
// clear interrupts to avoid glitching
__asm__("SEI");
// set sprite bitmap data
for (n = 0 ; n < sizeof(sprite) ; n++) {
POKE(0x340 + n, sprite[n]);
POKE(0x380 + n, spritemc[n]);
}
// enable 1st and 2nd sprite
VIC.spr_ena = 0x03;
VIC.spr_mcolor = 0x02;
// set colors
VIC.spr_mcolor0 = 4;
VIC.spr_mcolor1 = 7;
// 2x zoom 1st sprite
VIC.spr_exp_x = 0x01;
VIC.spr_exp_y = 0x01;
// set address of sprite data
POKE(0x7f8, 13);
POKE(0x7f9, 14);
// set initial x/y positions
x = 160;
y = 128;
// loop
// loop forever
while (1) {
// get joystick bits
char joy = joy_read(0);
// move sprite based on arrow keys
if (JOY_LEFT(joy)) --x;
if (JOY_UP(joy)) --y;
if (JOY_RIGHT(joy)) ++x;
if (JOY_DOWN(joy)) ++y;
// set VIC registers based on position
VIC.spr0_x = x;
VIC.spr0_y = y-32;
VIC.spr1_x = x;
VIC.spr1_y = y+32;
VIC.spr_hi_x = (x & 256) ? 1 : 0;
// change color when we collide with background
bgcoll = VIC.spr_bg_coll;
VIC.spr0_color = (bgcoll & 1) ? 10 : 0;
VIC.spr1_color = (bgcoll & 2) ? 10 : 0;
joy = joy_read(0);
// move sprite based on joystick
if (JOY_LEFT(joy)) { x -= 1; } // move left 1 pixel
if (JOY_RIGHT(joy)) { x += 1; } // move right 1 pixel
if (JOY_UP(joy)) { y -= 1; } // move up 1 pixel
if (JOY_DOWN(joy)) { y += 1; } // move down 1 pixel
// wait for end of frame
rasterWait(255);
waitvsync();
// set sprite registers based on position
VIC.spr_pos[0].x = x;
VIC.spr_pos[0].y = y;
// set X coordinate high bit
VIC.spr_hi_x = (x & 0x100) ? 1 : 0;
// grab and reset collision flags
bgcoll = VIC.spr_bg_coll;
// change color when we collide with background
VIC.spr_color[0] = (bgcoll & 1) ?
COLOR_LIGHTRED : COLOR_CYAN;
}
// uninstall joystick driver (not really necessary)
joy_uninstall();
return EXIT_SUCCESS;
}

294
presets/c64/level2.ca65 Normal file
View File

@ -0,0 +1,294 @@
; Generated by CharPad 2.8, Subchrist Software, 2021.
; Assemble with 64TASS or similar.
; Character display mode : Multi-colour.
; Character colouring method : Per-Tile.
; Colour values...
COLR_SCREEN = 11
COLR_CHAR_DEF = 13
COLR_CHAR_MC1 = 0
COLR_CHAR_MC2 = 1
; Quantities and dimensions...
CHAR_COUNT = 256
TILE_COUNT = 16
TILE_WID = 4
TILE_HEI = 4
MAP_WID = 16
MAP_HEI = 16
MAP_WID_CHRS = 64
MAP_HEI_CHRS = 64
MAP_WID_PXLS = 512
MAP_HEI_PXLS = 512
; Data block sizes (in bytes)...
SZ_CHARSET_DATA = 2048 ; ($800)
SZ_CHARSET_ATTRIB_DATA = 256 ; ($100)
SZ_TILESET_DATA = 256 ; ($100)
SZ_TILESET_ATTRIB_DATA = 16 ; ($10)
SZ_MAP_DATA = 256 ; ($100)
; * INSERT EXAMPLE PROGRAM HERE! * (Or just include this file in your project).
.global _charset_data
.global _chartileset_data
.global _charset_attrib_data
.global _chartileset_colour_data
.global _map_row_pointers
.global _map_data
; CHARSET IMAGE DATA...
; 256 images, 8 bytes per image, total size is 2048 ($800) bytes.
_charset_data:
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$C0,$91,$95,$91,$80,$C0,$F2,$F5
.byte $03,$11,$55,$11,$01,$03,$AF,$4F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $AA,$AA,$88,$22,$CC,$33,$DD,$55,$AA,$AA,$88,$22,$CC,$33,$DD,$55
.byte $AA,$AA,$88,$22,$CC,$33,$DD,$55,$AA,$AA,$88,$22,$CC,$33,$DD,$55
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $AA,$BB,$FE,$FF,$FF,$CF,$33,$55,$AA,$BB,$FE,$FF,$FF,$CF,$33,$55
.byte $AA,$BB,$FE,$FF,$FF,$CF,$33,$55,$AA,$BB,$FE,$FF,$FF,$CF,$33,$55
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $AA,$AF,$B3,$AC,$B0,$AC,$B0,$AC,$AA,$FD,$35,$11,$05,$11,$05,$11
.byte $AA,$BF,$B3,$BC,$B0,$BC,$B0,$BC,$AA,$FD,$35,$11,$05,$11,$05,$11
.byte $B0,$AC,$B0,$AC,$B0,$AD,$B4,$95,$05,$11,$05,$11,$05,$11,$45,$55
.byte $B0,$BC,$B0,$BC,$B0,$BD,$B4,$95,$05,$11,$05,$11,$05,$11,$45,$55
.byte $AA,$BF,$B3,$BC,$B0,$BC,$B0,$BC,$AA,$FD,$35,$11,$05,$11,$05,$11
.byte $AA,$BF,$B3,$BC,$B0,$BC,$B0,$BC,$AA,$FD,$35,$11,$05,$11,$05,$11
.byte $B0,$BC,$B0,$BC,$B0,$BD,$B4,$95,$05,$11,$05,$11,$05,$11,$45,$55
.byte $B0,$BC,$B0,$BC,$B0,$BD,$B4,$95,$05,$11,$05,$11,$05,$11,$45,$55
.byte $02,$02,$02,$02,$02,$02,$02,$02,$D0,$D0,$D0,$EA,$FF,$D5,$D0,$D0
.byte $0B,$0B,$0B,$AB,$FF,$5B,$0B,$0B,$40,$40,$40,$40,$40,$40,$40,$40
.byte $02,$02,$02,$02,$02,$02,$02,$02,$D0,$D0,$D0,$EA,$FF,$D5,$D0,$D0
.byte $0B,$0B,$0B,$AB,$FF,$5B,$0B,$0B,$40,$40,$40,$40,$40,$40,$40,$40
.byte $02,$02,$02,$02,$02,$02,$02,$02,$D0,$D0,$D0,$EA,$FF,$D5,$D0,$D0
.byte $0B,$0B,$0B,$AB,$FF,$5B,$0B,$0B,$40,$40,$40,$40,$40,$40,$40,$40
.byte $02,$02,$02,$02,$02,$02,$02,$02,$D0,$D0,$D0,$EA,$FF,$D5,$D0,$D0
.byte $0B,$0B,$0B,$AB,$FF,$5B,$0B,$0B,$40,$40,$40,$40,$40,$40,$40,$40
.byte $AA,$BB,$FE,$FF,$FF,$CF,$33,$55,$AA,$BB,$FE,$FF,$FF,$CF,$33,$55
.byte $AA,$BB,$FE,$FF,$FF,$CF,$33,$55,$AA,$BB,$FE,$FF,$FF,$CF,$33,$55
.byte $02,$02,$02,$02,$02,$02,$02,$02,$D0,$D0,$D0,$EA,$FF,$D5,$D0,$D0
.byte $0B,$0B,$0B,$AB,$FF,$5B,$0B,$0B,$40,$40,$40,$40,$40,$40,$40,$40
.byte $02,$02,$02,$02,$02,$02,$02,$02,$D0,$D0,$D0,$EA,$FF,$D5,$D0,$D0
.byte $0B,$0B,$0B,$AB,$FF,$5B,$0B,$0B,$40,$40,$40,$40,$40,$40,$40,$40
.byte $02,$02,$02,$02,$02,$02,$02,$02,$D0,$D0,$D0,$EA,$FF,$D5,$D0,$D0
.byte $0B,$0B,$0B,$AB,$FF,$5B,$0B,$0B,$40,$40,$40,$40,$40,$40,$40,$40
.byte $AA,$00,$B3,$EF,$BF,$EF,$9D,$55,$AA,$00,$33,$FF,$FF,$FF,$DD,$55
.byte $AA,$00,$33,$FF,$FF,$FF,$DD,$55,$AA,$00,$31,$FF,$FD,$F7,$DD,$55
.byte $EF,$BF,$EF,$BB,$EF,$BF,$EF,$BB,$DF,$FD,$F4,$DD,$FF,$FD,$F4,$DD
.byte $55,$15,$45,$15,$51,$15,$45,$15,$55,$55,$55,$55,$55,$55,$55,$55
.byte $EF,$BF,$EF,$BB,$EF,$BF,$EF,$BB,$DF,$FD,$F4,$DD,$FF,$FD,$F4,$DD
.byte $55,$15,$45,$15,$51,$15,$45,$15,$55,$55,$55,$55,$55,$55,$55,$55
.byte $EF,$BF,$EF,$BB,$EF,$BF,$EF,$BB,$DF,$FD,$F4,$DD,$FF,$FD,$F4,$D1
.byte $55,$15,$45,$15,$51,$15,$45,$15,$55,$55,$55,$55,$55,$55,$55,$55
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$02,$02,$02,$0B,$0B,$2F,$BF,$00,$00,$00,$00,$80,$80,$E0,$F8
.byte $00,$02,$02,$02,$0B,$0B,$2F,$BF,$00,$00,$00,$00,$80,$80,$E0,$F8
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$FE,$FE,$FC,$FD,$F9,$F9
.byte $FF,$FF,$7F,$7F,$3F,$BF,$9F,$9F,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$F1,$F1,$E0,$E1,$C1,$C0,$FF,$FF
.byte $8F,$8F,$07,$87,$83,$03,$FF,$FF,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $AA,$25,$0B,$02,$00,$02,$09,$24,$AA,$56,$F9,$E7,$9F,$6F,$1B,$06
.byte $AA,$95,$6F,$DB,$F6,$F9,$E4,$90,$AA,$58,$E0,$80,$00,$80,$60,$18
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$02,$02,$0B,$0B,$2F,$2F,$BF,$BF
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $02,$02,$0B,$0B,$2F,$2F,$BF,$BF,$FD,$FD,$F4,$F4,$D0,$D0,$40,$40
.byte $00,$00,$00,$00,$00,$00,$00,$00,$02,$02,$0B,$0B,$2F,$2F,$BF,$BF
.byte $FD,$FD,$F4,$F4,$D0,$D0,$40,$40,$00,$00,$00,$00,$00,$00,$00,$00
.byte $02,$02,$0B,$0B,$2F,$2F,$BF,$95,$FD,$FD,$F4,$F4,$D0,$D0,$40,$40
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $80,$80,$E0,$E0,$F8,$F8,$FE,$FE,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $7F,$7F,$1F,$1F,$07,$07,$01,$01,$80,$80,$E0,$E0,$F8,$F8,$FE,$FE
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$7F,$7F,$1F,$1F,$07,$07,$01,$01
.byte $80,$80,$E0,$E0,$F8,$F8,$FE,$FE,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $7F,$7F,$1F,$1F,$07,$07,$01,$01,$80,$80,$E0,$E0,$F8,$F8,$FE,$56
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$01,$03,$01,$01,$03,$03,$07,$0F,$5E,$FA,$EA
.byte $00,$00,$00,$40,$C0,$D5,$BF,$AD,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$7A,$1E,$0F,$3D,$34,$D0,$40,$00
.byte $B4,$D0,$C0,$F0,$70,$1C,$04,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$80,$E0,$FA,$D5,$40,$00,$00,$00,$00,$00,$AA,$55,$00,$00,$00
.byte $00,$00,$00,$AA,$55,$00,$00,$00,$00,$02,$0B,$AF,$57,$01,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
; CHARSET IMAGE ATTRIBUTE DATA...
; 256 attributes, 1 attribute per image, 8 bits per attribute, total size is 256 ($100) bytes.
; nb. Upper nybbles = material, lower nybbles = colour.
_charset_attrib_data:
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.byte $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
; CHARTILESET DATA...
; 16 tiles, 4x4 (16) cells per tile, 8 bits per cell, total size is 256 ($100) bytes.
_chartileset_data:
.byte $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0D,$0E,$0F
.byte $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1A,$1B,$1C,$1D,$1E,$1F
.byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F
.byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
.byte $40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$4A,$4B,$4C,$4D,$4E,$4F
.byte $50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5A,$5B,$5C,$5D,$5E,$5F
.byte $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6A,$6B,$6C,$6D,$6E,$6F
.byte $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7A,$7B,$7C,$7D,$7E,$7F
.byte $80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$8A,$8B,$8C,$8D,$8E,$8F
.byte $90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$9A,$9B,$9C,$9D,$9E,$9F
.byte $A0,$A1,$A2,$A3,$A4,$A5,$A6,$A7,$A8,$A9,$AA,$AB,$AC,$AD,$AE,$AF
.byte $B0,$B1,$B2,$B3,$B4,$B5,$B6,$B7,$B8,$B9,$BA,$BB,$BC,$BD,$BE,$BF
.byte $C0,$C1,$C2,$C3,$C4,$C5,$C6,$C7,$C8,$C9,$CA,$CB,$CC,$CD,$CE,$CF
.byte $D0,$D1,$D2,$D3,$D4,$D5,$D6,$D7,$D8,$D9,$DA,$DB,$DC,$DD,$DE,$DF
.byte $E0,$E1,$E2,$E3,$E4,$E5,$E6,$E7,$E8,$E9,$EA,$EB,$EC,$ED,$EE,$EF
.byte $F0,$F1,$F2,$F3,$F4,$F5,$F6,$F7,$F8,$F9,$FA,$FB,$FC,$FD,$FE,$FF
; CHARTILESET COLOUR DATA...
; 16 colours, 1 colour per tile, 8 bits per colour, total size is 16 ($10) bytes.
; nb. Lower nybbles = colour, upper nybbles are unused.
_chartileset_colour_data:
.byte $03,$03,$03,$0B,$0D,$0B,$0D,$0D,$0D,$0A,$06,$0C,$0C,$0C,$0F,$0D
; CHARTILESET TAG DATA...
; 16 tags, 1 tag per tile, 8 bits per tag, total size is 16 ($10) bytes.
_chartileset_tag_data:
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
; MAP DATA...
; 16x16 (256) cells, 8 bits per cell, total size is 256 ($100) bytes.
_map_data:
map_data:
.byte $01,$01,$02,$01,$01,$01,$01,$01,$02,$01,$01,$01,$01,$01,$01,$01
.byte $05,$03,$03,$03,$06,$03,$05,$03,$03,$03,$03,$03,$03,$03,$03,$05
.byte $05,$00,$00,$04,$06,$06,$06,$09,$08,$00,$00,$00,$00,$00,$00,$05
.byte $05,$0F,$04,$04,$07,$07,$07,$04,$08,$0F,$00,$0B,$00,$0C,$05,$05
.byte $05,$00,$00,$05,$05,$05,$05,$05,$05,$00,$00,$05,$05,$00,$00,$05
.byte $05,$0E,$0A,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$05
.byte $05,$05,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$05
.byte $05,$00,$00,$04,$00,$04,$00,$04,$04,$07,$00,$00,$00,$00,$00,$05
.byte $05,$0E,$00,$00,$00,$00,$00,$00,$00,$06,$00,$00,$00,$00,$00,$05
.byte $05,$05,$00,$07,$04,$04,$0F,$0F,$0F,$07,$00,$00,$00,$00,$00,$05
.byte $05,$00,$0A,$06,$00,$00,$00,$00,$00,$06,$00,$00,$00,$00,$00,$05
.byte $05,$00,$09,$04,$04,$04,$07,$00,$00,$06,$00,$00,$00,$00,$00,$05
.byte $05,$00,$05,$00,$00,$00,$06,$00,$00,$05,$0D,$00,$00,$00,$00,$05
.byte $05,$00,$00,$00,$00,$05,$05,$00,$00,$00,$00,$05,$0D,$00,$00,$05
.byte $05,$00,$00,$00,$05,$05,$00,$00,$00,$00,$00,$00,$00,$05,$00,$05
.byte $05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05
.global _map_row_pointers
_map_row_pointers:
.word map_data + 0*16
.word map_data + 1*16
.word map_data + 2*16
.word map_data + 3*16
.word map_data + 4*16
.word map_data + 5*16
.word map_data + 6*16
.word map_data + 7*16
.word map_data + 8*16
.word map_data + 9*16
.word map_data + 10*16
.word map_data + 11*16
.word map_data + 12*16
.word map_data + 13*16
.word map_data + 14*16
.word map_data + 15*16

View File

@ -12,18 +12,17 @@
#include "common.h"
//#link "multilines.c"
void setup_bitmap_multi();
void set_pixel(byte x, byte y, byte color);
//#link "mcbitmap.c"
#include "mcbitmap.h"
/* Graphics definitions */
#define SCREEN_X 160
#define SCREEN_Y 192
#define MAXCOL 16
#define maxiterations 16
#define maxiterations 64
#define fpshift (10)
#define fpone (1<<fpshift)
#define tofp(_x) ((_x)<<fpshift)
#define fromfp(_x) ((_x)>>fpshift)
#define fpabs(_x) (abs(_x))
@ -71,10 +70,11 @@ void mandelbrot (signed short x1, signed short y1, signed short x2,
if (count == maxiterations) {
color = (0);
} else {
color = COLORS[count % MAXCOL];
color = count < MAXCOL
? COLORS[count]
: COLORS[MAXCOL-1];
set_pixel(x, y, color);
}
/* Set pixel */
set_pixel(x, y, color);
}
}
}
@ -85,11 +85,11 @@ int main (void)
VIC.bgcolor0 = 0x00;
/* Calc mandelbrot set */
mandelbrot (tofp (-2), tofp (-2), tofp (2), tofp (2));
mandelbrot (-fpone/2, -fpone, 0, -fpone/2);
/* Fetch the character from the keyboard buffer and discard it */
cgetc ();
/* Done */
return EXIT_SUCCESS;
}

View File

@ -1,36 +1,35 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <c64.h>
#include <peekpoke.h>
#include "common.h"
//#link "common.c"
#include "mcbitmap.h"
void setup_bitmap_multi() {
VIC.ctrl1 = 0x38;
VIC.ctrl2 = 0x18;
// set VIC bank ($4000-$7FFF)
// https://www.c64-wiki.com/wiki/VIC_bank
CIA2.pra = 0x02;
// set VIC screen to $6000
VIC.addr = 0x80;
// clear bitmap and screen RAM
memset((void*)0x4000, 0, 0x2000);
memset((void*)0xd800, 0, 40*25);
SET_VIC_BANK(MCB_BITMAP);
SET_VIC_BITMAP(MCB_BITMAP);
SET_VIC_SCREEN(MCB_COLORS);
memset((void*)MCB_BITMAP, 0, 0x2000);
memset((void*)MCB_COLORS, 0, 0x800);
memset(COLOR_RAM, 0, 40*25);
}
const byte PIXMASK[4] = { ~0xc0, ~0x30, ~0x0c, ~0x03 };
const byte PIXSHIFT[4] = { 6, 4, 2, 0 };
byte is_pixel(byte x, byte y) {
word ofs = ((x>>2)*8 + (y>>3)*320) | (y&7) | 0x4000;
return PEEK(ofs) & ~PIXMASK[x & 3];
word ofs = ((x>>2)*8 + (y>>3)*320) | (y&7) | MCB_BITMAP;
byte pixvalue;
ENABLE_HIMEM();
pixvalue = PEEK(ofs);
DISABLE_HIMEM();
return pixvalue & ~PIXMASK[x & 3];;
}
void set_pixel(byte x, byte y, byte color) {
word ofs,b,cram,sram;
byte ccol,scol;
byte ccol,scol,used;
byte val;
if (x >= 160 || y >= 192) return;
@ -40,35 +39,44 @@ void set_pixel(byte x, byte y, byte color) {
if (color == VIC.bgcolor0) {
val = 0;
} else {
// calculate character (and color RAM) offset
cram = ((x>>2) + (y>>3)*40);
sram = cram | 0x6000;
sram = cram | MCB_COLORS;
cram |= 0xd800;
// read color ram, screen memory, and used bits
ENABLE_HIMEM();
ccol = PEEK(cram);
scol = PEEK(sram);
// color RAM contains unused bits (0x10 and 0x20)
used = PEEK(sram | 0x400);
DISABLE_HIMEM();
// unused in lower nibble of screen RAM? (value 2)
if (color == (scol & 0xf) || !(ccol & 0x10)) {
if (color == (scol & 0xf) || !(used & 0x10)) {
val = 2;
scol = (scol & 0xf0) | color;
ccol |= 0x10;
used |= 0x10;
POKE(sram, scol);
// unused in upper nibble of screen RAM? (value 1)
} else if (color == (scol >> 4) || !(ccol & 0x20)) {
} else if (color == (scol >> 4) || !(used & 0x20)) {
val = 1;
scol = (scol & 0xf) | (color << 4);
ccol |= 0x20;
used |= 0x20;
POKE(sram, scol);
// all other colors in use, use color RAM
} else {
val = 3;
ccol = 0x30 | color;
used |= 0x40;
ccol = color;
POKE(cram, ccol);
}
POKE(cram, ccol);
// write to unused bit
POKE(sram | 0x400, used);
}
ofs = ((x>>2)*8 + (y>>3)*320) | (y&7) | 0x4000;
ofs = ((x>>2)*8 + (y>>3)*320) | (y&7) | MCB_BITMAP;
x &= 3;
ENABLE_HIMEM();
b = PEEK(ofs) & PIXMASK[x];
DISABLE_HIMEM();
if (val) {
b |= val << PIXSHIFT[x];
}
@ -91,6 +99,7 @@ void draw_line(int x0, int y0, int x1, int y1, byte color) {
}
}
// support recursion
#pragma static-locals(push,off)
byte flood_fill(byte x, byte y, byte color) {
register byte x1 = x;

16
presets/c64/mcbitmap.h Normal file
View File

@ -0,0 +1,16 @@
#include "common.h"
#define MCB_COLORS 0xc000
#define MCB_BITMAP 0xe000
void setup_bitmap_multi();
byte is_pixel(byte x, byte y);
void set_pixel(byte x, byte y, byte color);
void draw_line(int x0, int y0, int x1, int y1, byte color);
byte flood_fill(byte x, byte y, byte color);

View File

@ -0,0 +1,208 @@
VIC_BASE = $0
VIC_SCRN_BASE = VIC_BASE + $400
MAX_MSPRITES = 28
MIN_Y_SPACING = 35
DEBUG = 0
.code
.global _msprite_render_init
_msprite_render_init:
lda #0
sta j
sta k
sta $d001 ; ypos #0
sta $d003
sta $d005
sta $d007
sta $d009
sta $d00b
sta $d00d
sta $d00f ; ypos #7
lda #$ff
sta $d015 ; sprite enable
rts
.global _msprite_render_section
_msprite_render_section:
lda $d012
clc
adc #MIN_Y_SPACING
sta bailout_line
@loop:
.if DEBUG
inc $d020
.endif
lda $d012
cmp bailout_line
bcs @loopexit
ldy k
cpy #MAX_MSPRITES
bcs @loopexit
lda _msprite_order,y ; $ff = end of sprite list
tay ; Y = sprite index from sort array
lda j
asl
tax ; X = j * 2
; if (VIC.spr_pos[j].y >= 250) break;
lda $d001,x
cmp #250
bcs @loopexit ; offscreen?
; if (VIC.spr_pos[j].y+22 >= VIC.rasterline) break;
clc
adc #22
cmp $d012 ; are we done drawing
bcs @loopexit ; this sprite yet?
; VIC.spr_pos[j].y = msprite_y[i];
lda _msprite_y,y
sta $d001,x
; VIC.spr_pos[j].x = msprite_x[i];
lda _msprite_x_lo,y
sta $d000,x
ldx j ; X = j
; VIC.spr_color[j] = msprite_color[i];
lda _msprite_color,y
sta $d027,x
; POKE(0x7f8+j, msprite_shape[i]);
lda _msprite_shape,y
sta VIC_SCRN_BASE + $03f8,x
; set hi X bit
lda _msprite_x_hi,y
lsr
lda NOTBITS,x
and $d010
bcc @nohix
ora BITS,x
@nohix:
sta $d010 ; update X hi bits
inc k ; next object
inx
txa
and #7
sta j ; next h/w sprite
jmp @loop
@loopexit:
.if DEBUG
lda #0
sta $d020
.endif
rts
; http://selmiak.bplaced.net/games/c64/index.php?lang=eng&game=Tutorials&page=Sprite-Multiplexing
.global _msprite_sort
_msprite_sort:
ldx #$00
@sortloop:
ldy _msprite_order+1,x
lda _msprite_y,y
ldy _msprite_order,x
cmp _msprite_y,y
bcs @sortskip
stx @sortreload+1
@sortswap:
lda _msprite_order+1,x
sta _msprite_order,x
tya
sta _msprite_order+1,x
cpx #$00
beq @sortreload
dex
ldy _msprite_order+1,x
lda _msprite_y,y
ldy _msprite_order,x
cmp _msprite_y,y
bcc @sortswap
@sortreload:
ldx #$00 ; self-modifying code
@sortskip:
inx
cpx #MAX_MSPRITES-1
bcc @sortloop
rts
.global _msprite_add_velocity
_msprite_add_velocity:
tay
dey
@loop:
lda _msprite_y_frac,y
clc
adc _msprite_yvel_lo,y
sta _msprite_y_frac,y
lda _msprite_y,y
adc _msprite_yvel_hi,y
sta _msprite_y,y
lda _msprite_x_frac,y
clc
adc _msprite_xvel_lo,y
sta _msprite_x_frac,y
lda _msprite_xvel_hi,y
bmi @xneg
lda _msprite_x_lo,y
adc _msprite_xvel_hi,y
sta _msprite_x_lo,y
lda _msprite_x_hi,y
adc #0
sta _msprite_x_hi,y
dey
bpl @loop
rts
@xneg:
lda _msprite_x_lo,y
adc _msprite_xvel_hi,y
sta _msprite_x_lo,y
lda _msprite_x_hi,y
adc #$ff
sta _msprite_x_hi,y
dey
bpl @loop
rts
BITS:
.byte $01,$02,$04,$08,$10,$20,$40,$80
NOTBITS:
.byte $FE,$FD,$FB,$F7,$EF,$DF,$BF,$7F
;;;;;
.data
j: .res 1 ; h/w sprite index
k: .res 1 ; object index
bailout_line: .res 1
.global _msprite_order
.global _msprite_x_lo
.global _msprite_x_hi
.global _msprite_y
.global _msprite_color
.global _msprite_shape
.global _msprite_flags
.global _msprite_last_y
_msprite_order: .res MAX_MSPRITES
_msprite_x_lo: .res MAX_MSPRITES
_msprite_x_hi: .res MAX_MSPRITES
_msprite_y: .res MAX_MSPRITES
_msprite_color: .res MAX_MSPRITES
_msprite_shape: .res MAX_MSPRITES
_msprite_flags: .res MAX_MSPRITES
_msprite_last_y:.res 1
.global _msprite_x_frac
.global _msprite_xvel_lo
.global _msprite_xvel_hi
.global _msprite_y_frac
.global _msprite_yvel_lo
.global _msprite_yvel_hi
_msprite_x_frac: .res MAX_MSPRITES
_msprite_xvel_lo: .res MAX_MSPRITES
_msprite_xvel_hi: .res MAX_MSPRITES
_msprite_y_frac: .res MAX_MSPRITES
_msprite_yvel_lo: .res MAX_MSPRITES
_msprite_yvel_hi: .res MAX_MSPRITES

24
presets/c64/multisprite.h Normal file
View File

@ -0,0 +1,24 @@
#include "common.h"
#define MAX_MSPRITES 28
extern byte msprite_order[MAX_MSPRITES];
extern byte msprite_x_lo[MAX_MSPRITES];
extern byte msprite_x_hi[MAX_MSPRITES];
extern byte msprite_y[MAX_MSPRITES];
extern byte msprite_color[MAX_MSPRITES];
extern byte msprite_shape[MAX_MSPRITES];
//extern byte msprite_flags[MAX_MSPRITES];
extern byte msprite_xvel_lo[MAX_MSPRITES];
extern byte msprite_xvel_hi[MAX_MSPRITES];
extern byte msprite_yvel_lo[MAX_MSPRITES];
extern byte msprite_yvel_hi[MAX_MSPRITES];
extern byte msprite_last_y;
void __fastcall__ msprite_render_init();
void __fastcall__ msprite_render_section();
void __fastcall__ msprite_sort();
void __fastcall__ msprite_add_velocity(byte numsprites);

File diff suppressed because one or more lines are too long

300
presets/c64/plasma.c Normal file
View File

@ -0,0 +1,300 @@
/*****************************************************************************\
** plasma test program for cc65. **
** **
** (w)2001 by groepaz **
** **
** Cleanup and porting by Ullrich von Bassewitz. **
** **
\*****************************************************************************/
#include <stdlib.h>
#include <time.h>
#include <conio.h>
#include <cc65.h>
#if defined(__C64__) || defined(__C128__)
# define SCREEN1 0xE000
# define SCREEN2 0xE400
# define CHARSET 0xE800
# define outb(addr,val) (*(addr)) = (val)
# define inb(addr) (*(addr))
#elif defined(__CBM510__)
# define SCREEN1 0xF000
# define SCREEN2 0xF400
# define CHARSET 0xE000
# define outb(addr,val) pokebsys ((unsigned)(addr), val)
# define inb(addr) peekbsys ((unsigned)(addr))
#elif defined(__PLUS4__)
# define SCREEN1 0x6400
# define SCREEN2 0x6C00
# define CHARSET 0x7000
# define outb(addr,val) (*(addr)) = (val)
# define inb(addr) (*(addr))
#endif
/* Values for the VIC address register to switch between the two pages */
#if defined(__PLUS4__)
#define PAGE1 ((SCREEN1 >> 8) & 0xF8)
#define PAGE2 ((SCREEN2 >> 8) & 0xF8)
#define CHARADR ((CHARSET >> 8) & 0xFC)
#else
#define PAGE1 ((SCREEN1 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E)
#define PAGE2 ((SCREEN2 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E)
#endif
/* Use static local variables for speed */
#pragma static-locals (1);
static const unsigned char sinustable[0x100] = {
0x80, 0x7d, 0x7a, 0x77, 0x74, 0x70, 0x6d, 0x6a,
0x67, 0x64, 0x61, 0x5e, 0x5b, 0x58, 0x55, 0x52,
0x4f, 0x4d, 0x4a, 0x47, 0x44, 0x41, 0x3f, 0x3c,
0x39, 0x37, 0x34, 0x32, 0x2f, 0x2d, 0x2b, 0x28,
0x26, 0x24, 0x22, 0x20, 0x1e, 0x1c, 0x1a, 0x18,
0x16, 0x15, 0x13, 0x11, 0x10, 0x0f, 0x0d, 0x0c,
0x0b, 0x0a, 0x08, 0x07, 0x06, 0x06, 0x05, 0x04,
0x03, 0x03, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03,
0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x0a,
0x0b, 0x0c, 0x0d, 0x0f, 0x10, 0x11, 0x13, 0x15,
0x16, 0x18, 0x1a, 0x1c, 0x1e, 0x20, 0x22, 0x24,
0x26, 0x28, 0x2b, 0x2d, 0x2f, 0x32, 0x34, 0x37,
0x39, 0x3c, 0x3f, 0x41, 0x44, 0x47, 0x4a, 0x4d,
0x4f, 0x52, 0x55, 0x58, 0x5b, 0x5e, 0x61, 0x64,
0x67, 0x6a, 0x6d, 0x70, 0x74, 0x77, 0x7a, 0x7d,
0x80, 0x83, 0x86, 0x89, 0x8c, 0x90, 0x93, 0x96,
0x99, 0x9c, 0x9f, 0xa2, 0xa5, 0xa8, 0xab, 0xae,
0xb1, 0xb3, 0xb6, 0xb9, 0xbc, 0xbf, 0xc1, 0xc4,
0xc7, 0xc9, 0xcc, 0xce, 0xd1, 0xd3, 0xd5, 0xd8,
0xda, 0xdc, 0xde, 0xe0, 0xe2, 0xe4, 0xe6, 0xe8,
0xea, 0xeb, 0xed, 0xef, 0xf0, 0xf1, 0xf3, 0xf4,
0xf5, 0xf6, 0xf8, 0xf9, 0xfa, 0xfa, 0xfb, 0xfc,
0xfd, 0xfd, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfd,
0xfd, 0xfc, 0xfb, 0xfa, 0xfa, 0xf9, 0xf8, 0xf6,
0xf5, 0xf4, 0xf3, 0xf1, 0xf0, 0xef, 0xed, 0xeb,
0xea, 0xe8, 0xe6, 0xe4, 0xe2, 0xe0, 0xde, 0xdc,
0xda, 0xd8, 0xd5, 0xd3, 0xd1, 0xce, 0xcc, 0xc9,
0xc7, 0xc4, 0xc1, 0xbf, 0xbc, 0xb9, 0xb6, 0xb3,
0xb1, 0xae, 0xab, 0xa8, 0xa5, 0xa2, 0x9f, 0x9c,
0x99, 0x96, 0x93, 0x90, 0x8c, 0x89, 0x86, 0x83
};
static void doplasma (register unsigned char* scrn)
{
unsigned char xbuf[40];
unsigned char ybuf[25];
unsigned char c1a,c1b;
unsigned char c2a,c2b;
unsigned char c1A,c1B;
unsigned char c2A,c2B;
register unsigned char i, ii;
c1a = c1A;
c1b = c1B;
for (ii = 0; ii < 25; ++ii) {
ybuf[ii] = (sinustable[c1a] + sinustable[c1b]);
c1a += 4;
c1b += 9;
}
c1A += 3;
c1B -= 5;
c2a = c2A;
c2b = c2B;
for (i = 0; i < 40; ++i) {
xbuf[i] = (sinustable[c2a] + sinustable[c2b]);
c2a += 3;
c2b += 7;
}
c2A += 2;
c2B -= 3;
for (ii = 0; ii < 25; ++ii) {
/* Unrolling the following loop will give a speed increase of
** nearly 100% (~24fps), but it will also increase the code
** size a lot.
*/
for (i = 0; i < 40; ++i, ++scrn) {
*scrn = (xbuf[i] + ybuf[ii]);
}
}
}
static void makechar (void)
{
static const unsigned char bittab[8] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
};
unsigned char i, ii, b, s;
unsigned c;
gotoxy (0, 1);
for (c = 0; c < 0x100; ++c) {
s = sinustable[c];
for (i = 0; i < 8; ++i){
b = 0;
for (ii = 0; ii < 8; ++ii) {
if ((rand() & 0xFFu) > s) {
b |= bittab[ii];
}
}
((unsigned char*)CHARSET) [(c*8) + i] = b;
}
if ((c & 0x07) == 0) {
cputc ('.');
}
}
}
int main (void)
{
unsigned char border;
unsigned char background;
unsigned char text;
unsigned char v;
clock_t t;
unsigned long f = 0;
unsigned long sec;
unsigned sec10;
unsigned long fps;
unsigned fps10;
#if defined(__C64__)
unsigned char block;
#endif
#if defined(__C128__)
unsigned char block;
unsigned char initflag;
unsigned char graphflag;
#endif
#if defined(__PLUS4__)
unsigned int i;
unsigned char v2;
#endif
clrscr ();
cprintf ("Making charset, mompls");
makechar();
/* Set the border and background colors */
border = bordercolor (COLOR_BLUE);
background = bgcolor (COLOR_BLUE);
text = textcolor (COLOR_BLACK);
clrscr ();
#if defined(__C64__) || defined(__C128__)
/* Move the VIC 16K block */
block = inb (&CIA2.pra);
outb (&CIA2.pra, (block & 0xFC) | ((SCREEN1 >> 14) ^ 0x03));
#endif
#if defined(__C128__)
/* Save and change some flags, so that kernal/basic interrupt handler will
** not interfere with our routine.
*/
initflag = *(unsigned char*) 0xA04;
*(unsigned char*) 0xA04 &= 0xFE;
graphflag = *(unsigned char*) 0xD8;
*(unsigned char*) 0xD8 = 0xFF;
#endif
/* Remember the VIC address register */
#if defined(__PLUS4__)
v = inb (&TED.char_addr);
v2 = inb (&TED.video_addr);
#else
v = inb (&VIC.addr);
#endif
#if defined(__PLUS4__)
for (i=0;i<1000;i++) {
((unsigned char *) (SCREEN1-0x0400))[i] = 0;
((unsigned char *) (SCREEN2-0x0400))[i] = 0;
}
outb (&TED.char_addr, CHARADR);
#endif
/* Run the demo until a key was hit */
t = clock ();
while (!kbhit()) {
/* Build page 1, then make it visible */
doplasma ((unsigned char*)SCREEN1);
#if defined(__PLUS4__)
outb (&TED.video_addr, PAGE1);
#else
outb (&VIC.addr, PAGE1);
#endif
/* Build page 2, then make it visible */
doplasma ((unsigned char*)SCREEN2);
#if defined(__PLUS4__)
outb (&TED.video_addr, PAGE2);
#else
outb (&VIC.addr, PAGE2);
#endif
/* Count frames */
f += 2;
}
t = clock() - t;
/* Switch back the VIC screen */
#if defined(__PLUS4__)
outb (&TED.video_addr, v2);
outb (&TED.char_addr, v);
#else
outb (&VIC.addr, v);
#endif
#if defined(__C64__) || defined(__C128__)
/* Move back the VIC 16K block */
outb (&CIA2.pra, block);
#endif
#if defined(__C128__)
/* Restore the flags */
*(unsigned char*) 0xA04 = initflag;
*(unsigned char*) 0xD8 = graphflag;
#endif
/* Fetch the character from the keyboard buffer and discard it */
(void) cgetc();
/* Reset screen colors */
bordercolor (border);
bgcolor (background);
textcolor (text);
clrscr ();
/* Calculate stats */
sec = (t * 10) / CLK_TCK;
sec10 = sec % 10;
sec /= 10;
fps = (f * (CLK_TCK * 10)) / t;
fps10 = fps % 10;
fps /= 10;
/* Output stats */
gotoxy (0, 0); cprintf ("time : %lu.%us", sec, sec10);
gotoxy (0, 1); cprintf ("frames: %lu", f);
gotoxy (0, 2); cprintf ("fps : %lu.%u", fps, fps10);
if (doesclrscrafterexit ()) {
cputsxy (0, 4, "Press any key when done...");
(void) cgetc ();
}
/* Done */
return EXIT_SUCCESS;
}

111
presets/c64/rasterirq.ca65 Normal file
View File

@ -0,0 +1,111 @@
; use CC65's interrupter (slower)
USE_INTERRUPTOR = 0
.segment "DATA"
StartDlist: .word NullDlist-1
NextDlist: .word NullDlist-1
.segment "CODE"
.global ___dlist_setup
.global ___dlist_done
.global DLIST_IRQ_NEXT
.global DLIST_IRQ_RESTART
.if USE_INTERRUPTOR
.interruptor DLIST_IRQ
.endif
___dlist_setup:
sei ; set interrupt bit, make the CPU ignore interrupt requests
sta StartDlist+0 ; save XA as pointer to start of dlist
stx StartDlist+1
lda #%01111111 ; switch off interrupt signals from CIA-1
sta $DC0D
and $D011 ; clear most significant bit of VIC's raster register
sta $D011
lda $DC0D ; acknowledge pending interrupts from CIA-1
lda $DD0D ; acknowledge pending interrupts from CIA-2
lda #252 ; set rasterline where interrupt shall occur
sta $D012
.if !USE_INTERRUPTOR
lda #<DLIST_IRQ ; set interrupt vectors, pointing to interrupt service routine below
sta $0314
lda #>DLIST_IRQ
sta $0315
.endif
lda #%00000001 ; enable raster interrupt signals from VIC
sta $D01A
cli
rts
DLIST_IRQ:
DLIST_CALL:
lda NextDlist+1
pha
lda NextDlist+0
pha
rts
DLIST_IRQ_RESTART:
sta $D012 ; set IRQ raster line
lda StartDlist+0
sta NextDlist+0
lda StartDlist+1
sta NextDlist+1
bne DLIST_ACK
DLIST_IRQ_NEXT:
sta $D012
pla
sta NextDlist+0
pla
sta NextDlist+1
DLIST_ACK:
asl $D019 ; acknowledge the interrupt by clearing the VIC's interrupt flag
.if USE_INTERRUPTOR
clc
rts
.else
pla
tay
pla
tax
pla
rti ; return from interrupt
.endif
___dlist_done:
php
sei ; disable interrupts
lda #$0 ; disable raster interrupt signals from VIC
sta $D01A
lda #$ff
sta $DC0D
.if !USE_INTERRUPTOR
lda #$31 ; set interrupt vectors back to KERNAL
sta $0314
lda #$ea
sta $0315
.else
lda #<(NullDlist-1)
sta StartDlist
lda #>(NullDlist-1)
sta StartDlist+1
.endif
plp
rts
NullDlist:
lda #252
jmp DLIST_IRQ_RESTART

26
presets/c64/rasterirq.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef _RASTERIRQ_H
#define _RASTERIRQ_H
// internal function, use macro instead
void __dlist_setup(void* ptr);
void __dlist_done();
// initialize display list with function 'func'
#define DLIST_SETUP(func) \
__dlist_setup(((char*)func)-1)
// continue on line 'line'
#define DLIST_NEXT(line) \
__A__ = line; \
asm ("jsr DLIST_IRQ_NEXT");
// restart display list on line 'line'
#define DLIST_RESTART(line) \
__A__ = line; \
asm ("jmp DLIST_IRQ_RESTART");
// stop display list
#define DLIST_DONE() __dlist_done();
#endif

29
presets/c64/screen_ram.c Normal file
View File

@ -0,0 +1,29 @@
#include "common.h"
//#link "common.c"
#include <cbm_screen_charmap.h>
void main(void) {
unsigned int i;
clrscr(); // clear the screen
POKE(0x400, 'A'); // write to first byte of screen memory
POKE(0x400, 65); // character code for 'A'
POKE(0x400 + 40*24 + 39, 'Z'); // row 24, column 39
// fill with random characters
for (i=0; i<40*25; i++)
POKE(0x400 + i, 205 + (rand() & 1));
// set character set to uppercase + graphics characters
SET_VIC_BITMAP(0x1000);
// set color map underlying characters
for (i=0; i<40*25; i++)
COLOR_RAM[i] = COLOR_GREEN;
// infinite loop (avoid "ready" prompt)
while (1);
}

Some files were not shown because too many files have changed in this diff Show More