Compare commits

...

977 Commits

Author SHA1 Message Date
Devine Lu Linvega bb57b85f57 Fixed issue with comments in macros, fixed by jjbliss 2024-05-10 08:15:27 -07:00
Devine Lu Linvega 3a696f8fa9 Removed old tests 2024-05-06 08:23:27 -07:00
Devine Lu Linvega b0bfb38dcc Fixed typo in system expansion test 2024-04-15 17:12:24 -07:00
Devine Lu Linvega b7d80643e8 Fix non-ASCII bytes being detected as whitespace 2024-04-13 19:31:09 -07:00
Devine Lu Linvega 41567558bc (mandelbrot) Improvements from d6 2024-04-05 09:14:03 -07:00
Devine Lu Linvega 11d32db150 (uxnasm) Print token during nested macro error 2024-04-03 21:08:17 -07:00
Devine Lu Linvega fc7ae4301c (uxnasm) Only find hex glyph once 2024-04-03 20:58:55 -07:00
Devine Lu Linvega 182c727680 (uxnasm) Report the correct line number in references 2024-04-03 20:35:24 -07:00
Devine Lu Linvega aae4446dfb (uxnasm) References print file and line number 2024-04-03 20:21:13 -07:00
Devine Lu Linvega ab2dd4082a (uxnasm) No context for findopcode 2024-04-03 19:46:50 -07:00
Devine Lu Linvega 4331025178 (uxnasm) Report unknown mode 2024-04-03 19:37:16 -07:00
Devine Lu Linvega a74df86d06 (uxnasm) Fixed issue with skipped last token in include 2024-04-03 19:20:10 -07:00
Devine Lu Linvega 9564868464 (uxnasm) Fixed issue with long hex values 2024-04-03 09:08:28 -07:00
Devine Lu Linvega 01135b0bb4 (uxnasm) Allow lambdas in macros 2024-04-02 15:13:26 -07:00
Devine Lu Linvega fde8305d65 (uxnasm) Start line number at 1 2024-04-02 08:38:19 -07:00
Devine Lu Linvega fc6ec0b387 (uxnasm) Improved errors 2024-03-30 20:05:52 -07:00
Lobo Torres f6cda36187 (uxnasm) Explicit error for empty rom 2024-03-29 11:36:57 -07:00
Devine Lu Linvega e47a14f673 (uxnasm) Catch missized #hex 2024-03-29 10:43:22 -07:00
Devine Lu Linvega 68d6a5f604 (uxnasm) More explicit resolve errors 2024-03-29 10:26:25 -07:00
Devine Lu Linvega cdd6008b7a (uxnasm) Larger dict buffer 2024-03-28 20:33:28 -07:00
Devine Lu Linvega 80d01b7113 (uxnasm) Optimization 2024-03-28 20:25:16 -07:00
Devine Lu Linvega fe515570a2 (uxnasm) Added ishex() macro 2024-03-28 17:22:05 -07:00
Devine Lu Linvega 5e593e7931 (uxnasm) Recover 2024-03-28 14:39:52 -07:00
Devine Lu Linvega f55a6a0b55 (uxnasm) Housekeeping 2024-03-28 14:29:34 -07:00
Devine Lu Linvega cf552bb50b (uxnasm) Removed scpy 2024-03-28 14:26:59 -07:00
Devine Lu Linvega e080125437 (uxnasm) Removed slen macro 2024-03-28 14:03:25 -07:00
Devine Lu Linvega 9af23e1090 (uxnasm) Generalized makesublabel 2024-03-28 13:24:41 -07:00
Devine Lu Linvega 84cc003dec (uxnasm) Catch buffer overflows 2024-03-28 12:08:10 -07:00
Devine Lu Linvega 8d06f3e1b9 (uxnasm) Fixed issue with comments inside macros 2024-03-28 12:04:25 -07:00
Devine Lu Linvega 6c3888f306 (uxnasm) Housekeeping 2024-03-28 11:57:54 -07:00
Devine Lu Linvega 19a06cfd17 Starting to report unused macros 2024-03-28 11:43:21 -07:00
Devine Lu Linvega 3dbdb19225 (uxnasm) Use save() to cat path 2024-03-28 10:47:46 -07:00
Devine Lu Linvega 4a028ed63b (uxnasm) Housekeeping 2024-03-28 10:37:16 -07:00
Devine Lu Linvega 389d6ce364 (uxnasm) Merge build functions 2024-03-28 10:07:37 -07:00
Devine Lu Linvega a1a6271622 (uxnasm) Created build step 2024-03-28 09:48:07 -07:00
Devine Lu Linvega ea8f512fcd (uxnasm)Check for output size after resolving symbols 2024-03-28 09:30:23 -07:00
Devine Lu Linvega fe414183b0 (uxnasm) Renamed makeinclude to assemble 2024-03-28 09:25:15 -07:00
Devine Lu Linvega c0ba862911 (uxnasm) Reduced dictionary 2024-03-28 09:23:13 -07:00
Devine Lu Linvega 7c1492908c (uxnasm) Merged item name validation 2024-03-27 21:18:15 -07:00
Devine Lu Linvega 0098007b63 (uxnasm) Housekeeping 2024-03-27 17:37:48 -07:00
Devine Lu Linvega 5801d4fc9f (uxnasm) Merged ref resolution functions 2024-03-27 17:08:32 -07:00
Devine Lu Linvega a252da617c (uxnasm) Housekeeping 2024-03-27 17:00:08 -07:00
Devine Lu Linvega 652bff0a93 (uxnasm) Housekeeping 2024-03-27 16:48:56 -07:00
Devine Lu Linvega 632f9fc0fa (uxnasm) Asbtracted ref resolve 2024-03-27 16:36:28 -07:00
Devine Lu Linvega 9eee73f411 (uxnasm) Removed rune from Item 2024-03-27 16:21:39 -07:00
Devine Lu Linvega 6b355e3d8e (uxnasm) Housekeeping 2024-03-27 16:14:02 -07:00
Devine Lu Linvega 3c1a4ec45c (uxnasm) Merge findlabels 2024-03-27 16:07:26 -07:00
Devine Lu Linvega 24319c55e9 (uxnasm) Housekeeping 2024-03-27 15:59:03 -07:00
Devine Lu Linvega aedc593434 (uxnasm) Abstracted write string 2024-03-27 15:55:16 -07:00
Devine Lu Linvega 966aab7bb8 (uxnasm) Report file name in error correctly 2024-03-27 13:55:48 -07:00
Devine Lu Linvega 0f64cb61e9 (uxnasm) Pass context with path 2024-03-27 13:43:13 -07:00
Devine Lu Linvega c3738a9eb0 (uxnasm) Display the correct line number on error 2024-03-27 13:34:44 -07:00
Devine Lu Linvega aafef20ba5 (uxnasm) Increment line value at pointer 2024-03-27 13:23:16 -07:00
Devine Lu Linvega 03caf9317b (uxnasm) Stop assembling on error 2024-03-27 13:18:42 -07:00
Devine Lu Linvega af87818228 (uxnasm) Preserve line context across includes 2024-03-27 13:11:17 -07:00
Devine Lu Linvega 56131efa43 Saveguard against empty file 2024-03-27 12:11:51 -07:00
Devine Lu Linvega 4713261184 (uxnasm) Removed unused buffer 2024-03-27 12:05:19 -07:00
Devine Lu Linvega f50e915e42 (uxnasm) Count line number during macros 2024-03-27 12:03:24 -07:00
Devine Lu Linvega 59b7ee83c5 (uxnasm) Removed unused param in walkcomment 2024-03-27 11:49:05 -07:00
Devine Lu Linvega 5c4e14555b Count lines in comment 2024-03-27 11:41:48 -07:00
Devine Lu Linvega e10f7b8cb2 (uxnasm) Housekeeping 2024-03-27 11:33:07 -07:00
Devine Lu Linvega 41331ee4fc (uxnasm) Removed program struct 2024-03-27 11:01:58 -07:00
Devine Lu Linvega 93a409500a (uxmasm) Merged item finding routines 2024-03-27 10:47:12 -07:00
Devine Lu Linvega a56a4e0be0 (uxnasm) Merged token types 2024-03-27 10:39:34 -07:00
Devine Lu Linvega 1df9b12efd (uxnasm) Store macros into dict 2024-03-27 10:37:03 -07:00
Devine Lu Linvega 0db728a46b (uxnasm) push cap char 2024-03-27 10:27:17 -07:00
Devine Lu Linvega 278a4391c9 (uxnasm) Removed macro length 2024-03-27 10:20:33 -07:00
Devine Lu Linvega 7760593a88 (uxnasm) Walk macro 2024-03-27 10:18:06 -07:00
Devine Lu Linvega fe4103cadb (uxnasm) Report error when walking comment 2024-03-27 09:48:09 -07:00
Devine Lu Linvega 4c7ec082f5 (uxnasm) Store refs as labels 2024-03-27 09:42:15 -07:00
Devine Lu Linvega 0414a98b0e (uxnasm) Reference store strings in dict 2024-03-27 09:37:19 -07:00
Devine Lu Linvega c9f2eb0aad (uxnasm) Macros names are stored in dict 2024-03-27 09:24:51 -07:00
Devine Lu Linvega 18f545f3c9 (uxnasm) Starting to merge buffers 2024-03-27 09:21:34 -07:00
Devine Lu Linvega c5a5eaff0e (uxnasm) Quieted warning 2024-03-26 21:56:50 -07:00
Devine Lu Linvega 9d6587ffa5 (uxnasm) Converted functions to macros 2024-03-26 21:46:41 -07:00
Devine Lu Linvega 2f3eb460d6 (uxnasm) Removed unnecessary masking 2024-03-26 21:11:31 -07:00
Devine Lu Linvega c64fe94038 (uxnasm) Walk across comments in macros 2024-03-26 13:53:23 -07:00
Devine Lu Linvega 0ae8812680 (uxnasm) Read characters into char buffers 2024-03-26 13:45:08 -07:00
Devine Lu Linvega 832ba26e30 Improved comment walking 2024-03-26 13:41:52 -07:00
Devine Lu Linvega a197c24b2a Abstracted walk-comment 2024-03-26 13:35:37 -07:00
Devine Lu Linvega bcdd08bc4e (uxnasm) makelabel can set scope 2024-03-26 13:31:11 -07:00
Devine Lu Linvega fafc4e1734 (uxnasm) single-line handlers 2024-03-26 13:11:07 -07:00
Devine Lu Linvega ad6528be66 (uxnasm) Clearer error for subroutine ref error 2024-03-26 13:03:47 -07:00
Devine Lu Linvega a2ed2226f3 (uxnasm) Optimized writehex 2024-03-26 12:53:06 -07:00
Devine Lu Linvega a6fb9a22c5 (uxnasm) Abstracted writehex 2024-03-26 12:40:43 -07:00
Devine Lu Linvega f1fa4f6ea1 (uxnasm) Removed refinc to parent labels 2024-03-26 11:51:48 -07:00
Devine Lu Linvega 20a11c0f4c (uxnasm) makesub use global scope 2024-03-26 11:47:16 -07:00
Devine Lu Linvega 7819add659 (uxnasm) addref use global scope 2024-03-26 11:46:15 -07:00
Devine Lu Linvega 5d6d9ef4b1 (uxnasm) Program length should be int 2024-03-26 11:38:32 -07:00
Devine Lu Linvega e0c907f088 (uxnasm) Keep actual copy of source name 2024-03-26 11:33:25 -07:00
Devine Lu Linvega 5a109cb203 (uxnasm) Lambda string is public 2024-03-26 11:27:45 -07:00
Devine Lu Linvega 5c2cd9de04 (uxnasm) Make scope global 2024-03-26 11:22:02 -07:00
Devine Lu Linvega db25349114 (uxnasm) Removed setlocation 2024-03-26 11:19:01 -07:00
Devine Lu Linvega b1ec78a806 (uxnasm) Move setup in main 2024-03-26 11:16:36 -07:00
Devine Lu Linvega 26c8d5f6e7 Removed redundant primitive 2024-03-26 11:14:00 -07:00
Devine Lu Linvega 9f7391395f makelabel detects sublabels 2024-03-26 11:10:08 -07:00
Devine Lu Linvega 683eb6b859 (uxnasm)Catch overflow proper 2024-03-26 11:02:11 -07:00
Devine Lu Linvega c6674605fd (uxnasm) Merge tokenizers 2024-03-26 10:58:55 -07:00
Devine Lu Linvega e871d8dc0c Include uses tokenizer 2024-03-26 10:49:29 -07:00
Devine Lu Linvega 553e559e4e (uxnasm) Abstracted tokenizer 2024-03-26 10:45:25 -07:00
Devine Lu Linvega e632579243 (uxnasm) Minor optimizations 2024-03-26 10:34:20 -07:00
Devine Lu Linvega ac31bea4bb (uxnasm) Use cndx for runic 2024-03-26 10:01:54 -07:00
Devine Lu Linvega 5f9c860edf Faster sublabel detection 2024-03-25 20:47:04 -07:00
Devine Lu Linvega 6ac22a1e1a findlabel can find sublabels 2024-03-25 20:41:02 -07:00
Devine Lu Linvega d96902b2d7 (uxnasm) Abstracted padding logic 2024-03-25 20:30:55 -07:00
Devine Lu Linvega 0673cbed98 Connected line reporting 2024-03-25 19:52:29 -07:00
Devine Lu Linvega 418ae6fa0e (uxnasm) New tokenizer 2024-03-25 19:49:04 -07:00
Devine Lu Linvega bdf45bbdaa (uxnasm) Housekeeping 2024-03-25 15:27:45 -07:00
Devine Lu Linvega acf79df9d5 (uxnasm) Keep global token for error 2024-03-25 15:20:43 -07:00
Devine Lu Linvega 858b38b967 (uxnasm) Optimizations 2024-03-25 15:09:56 -07:00
Devine Lu Linvega 3777f30281 (uxnasm) Removed writelitbyte 2024-03-25 14:58:45 -07:00
Devine Lu Linvega 0c13a40916 Abstracted isopcode 2024-03-25 14:48:37 -07:00
Devine Lu Linvega 6fdc6e6791 (uxnasm) Improved lambda symbols 2024-03-25 14:21:16 -07:00
Devine Lu Linvega 5668efaac8 Added tak 2024-03-24 11:53:02 -07:00
Devine Lu Linvega 3e2082dddf (snake) Fixed death bug 2024-03-24 11:31:28 -07:00
Devine Lu Linvega 5cf69a2659 (snake) Improved movement 2024-03-24 11:09:33 -07:00
Devine Lu Linvega 852e34c304 * 2024-03-24 10:56:15 -07:00
Devine Lu Linvega 4d329e7e5f (snake) Faster positions 2024-03-24 10:55:51 -07:00
Devine Lu Linvega c73f1e066a (snake) Optimizations 2024-03-24 10:46:24 -07:00
Devine Lu Linvega 220983d694 (snake) Faster tail drawing 2024-03-24 10:36:25 -07:00
Devine Lu Linvega c9b691448b (snake) Optimizations 2024-03-24 10:29:34 -07:00
Devine Lu Linvega 641872fe21 (Snake) Improved formatting 2024-03-24 09:54:15 -07:00
Devine Lu Linvega 370c3a60c9 Minor optimizations to examples 2024-03-24 09:46:30 -07:00
Devine Lu Linvega 250aecc920 Updated expansion port example 2024-03-18 10:46:07 -07:00
Devine Lu Linvega 086b1d9a47 Added extra Expansion commands 2024-03-18 10:44:19 -07:00
Devine Lu Linvega 5d3cf8b614 Fixed error in build 2024-03-16 14:05:05 -07:00
Devine Lu Linvega cf964e4377 (fizzbuzz) Modernized 2024-03-10 10:54:28 -07:00
Devine Lu Linvega b1549867e4 (sierpinski) Tiny improvement 2024-03-08 16:48:51 -08:00
Devine Lu Linvega d7ee187d1d (sierpinski) Optimization 2024-03-08 16:39:45 -08:00
Devine Lu Linvega 24dbf258fd (sierpinski) Optimization 2024-03-08 16:16:18 -08:00
Devine Lu Linvega 4ef304c579 (sierpinski) Optimization 2024-03-08 15:55:58 -08:00
Devine Lu Linvega 8cccc5c919 (uxnasm) Print assembly result to stdout 2024-03-07 21:00:42 -08:00
Devine Lu Linvega 901c7bb9a3 (sierpinski) Housekeeping 2024-03-07 16:20:57 -08:00
Devine Lu Linvega c39f8f20dd Swapped order of referencing 2024-03-06 08:59:14 -08:00
Devine Lu Linvega 9f9ca9c5a7 Removed demos rom 2024-03-06 08:49:48 -08:00
Devine Lu Linvega 225faa73f0 (uxnasm) Stop after hitting refcount limit 2024-03-06 08:49:16 -08:00
Devine Lu Linvega e7c25fad05 Fixed issue with debug port 2024-03-04 09:19:08 -08:00
Devine Lu Linvega c3c140b5e9 Added deprecated warning for : rune 2024-03-03 15:31:37 -08:00
Devine Lu Linvega 2a582b7b6d (life.tal) Stop reading nbors at 4 2024-03-02 21:05:33 -08:00
Devine Lu Linvega 28da4f5dfc (life.tal)Faster drawing routine 2024-03-02 20:57:25 -08:00
Devine Lu Linvega a5e25d905a (life.tal) Optimizations 2024-03-02 20:44:47 -08:00
Devine Lu Linvega 537d9a8dbf (life.tal) Merged LITs 2024-03-02 20:12:47 -08:00
Devine Lu Linvega 4885cbe23b (life.tal) Make use of System/expansion 2024-03-02 20:09:03 -08:00
Devine Lu Linvega d8b83e80b5 (life.tal)Modernizing codebase 2024-03-02 19:57:59 -08:00
Devine Lu Linvega 259b9dcf56 Removed old examples 2024-03-02 19:37:45 -08:00
Devine Lu Linvega c5d8ba4e3a Mute scope reporting in resolve loop 2024-03-02 08:43:19 -08:00
Devine Lu Linvega d322e787fa (uxnasm) Print scope on error 2024-03-01 17:37:36 -08:00
Devine Lu Linvega a5ff070dd0 (uxnasm) Only display location in internal errors 2024-03-01 17:26:49 -08:00
Devine Lu Linvega 80e2f9cc0c (uxnasm) Print active file in error 2024-03-01 17:24:17 -08:00
Devine Lu Linvega 25e3e4e3ba (sierpinski.tal) Name size variable 2024-02-29 15:54:22 -08:00
Devine Lu Linvega ae4d48bf56 (sierpinski.tal) Added example 2024-02-29 15:44:58 -08:00
Devine Lu Linvega c7ce358d0d Improved stack printing 2024-02-28 09:03:56 -08:00
Devine Lu Linvega 24299dcc58 (screen.blending) Display on the fg 2024-02-26 09:25:29 -08:00
Devine Lu Linvega 7fc1b0887f (uxnasm) Fixed crashing but on no-output 2024-02-25 17:37:03 -08:00
Devine Lu Linvega 9f1df5f944 (uxnasm) Disallow runic labels 2024-02-25 17:23:49 -08:00
Devine Lu Linvega 202ca78800 (uxnasm) Added support for partial label jsi 2024-02-25 16:06:54 -08:00
Devine Lu Linvega de4a534bf4 (timer.tal) Updated example 2024-02-25 13:16:48 -08:00
Devine Lu Linvega b00cafe0f2 (timer.tal) Added OOP example 2024-02-25 13:09:38 -08:00
Devine Lu Linvega 0dffbf6c0e (uxnasm)Passing uxntal scope requirements 2024-02-24 08:49:32 -08:00
Devine Lu Linvega 4765924b37 Added wallpaper for potato 2024-02-22 15:33:42 -08:00
Devine Lu Linvega db720a0f7e Updated potato to warn about oversize rom 2024-02-22 15:04:00 -08:00
Devine Lu Linvega 1b16e45488 Updated potato 2024-02-22 14:21:57 -08:00
Devine Lu Linvega 079f215a5c Merged conflicts 2024-02-22 14:17:42 -08:00
Devine Lu Linvega 2017a8de7c Added potato to boot 2024-02-22 14:16:28 -08:00
Sigrid Solveig Haflínudóttir 6e960c7ad3 fix a few warnings and update version dates 2024-02-19 19:33:51 +00:00
Sigrid Solveig Haflínudóttir 5f4cb9ba05 uxnemu: delay for 25ms if failed to push stdin event - queue is probably full 2024-02-19 19:29:54 +00:00
Devine Lu Linvega 1bba517f37 (abc-disp) Added dispatch table implementation core 2024-02-19 10:35:28 -08:00
Devine Lu Linvega 124d0bf193 (cores/abc) Removed unreachable case 2024-02-18 21:24:21 -08:00
Devine Lu Linvega d9861c1a04 Improved abc core 2024-02-18 21:18:08 -08:00
Devine Lu Linvega 99d41a2027 Updated core with memory wrapping 2024-02-18 18:01:19 -08:00
Devine Lu Linvega c37d2cd75c (brainfuck.tal) Optimizations 2024-02-15 21:00:00 -08:00
Devine Lu Linvega 3bd7ea944f (brainfuck.tal) Minor optimizations 2024-02-15 20:47:53 -08:00
Devine Lu Linvega a41f1ce3e8 (brainfuck.tal) Modernizing 2024-02-15 20:31:27 -08:00
Devine Lu Linvega 57396faa94 uxncli will exit if no console vector 2024-02-15 15:31:16 -08:00
Devine Lu Linvega 8abb621b12 Updated date 2024-02-14 15:25:48 -08:00
Devine Lu Linvega c39d656b52 Added support for multi-byte keyboard input 2024-02-14 15:20:41 -08:00
Devine Lu Linvega 9da44f52d4 Added system.cat example 2024-02-14 15:17:08 -08:00
Sigrid Solveig Haflínudóttir 3fa01a63d8 screen: fix an UB 2024-02-14 16:28:50 +00:00
Devine Lu Linvega 300a3d7b3e (button.tal) Formatting 2024-02-07 10:01:55 -08:00
Devine Lu Linvega ff7c82f9e5 (button.tal) Because sometimes you just need a button 2024-02-07 09:59:53 -08:00
Devine Lu Linvega 3e1183285a (hilbert) Optimizations 2024-01-21 09:51:23 -08:00
Devine Lu Linvega 46e2374049 (hilbert) Housekeeping 2024-01-21 09:42:10 -08:00
Devine Lu Linvega f34bab675a (hilbert) Terminate properly 2024-01-21 09:38:25 -08:00
Devine Lu Linvega af7a59623b (hilbert) Faster drawing routine 2024-01-21 09:17:20 -08:00
Devine Lu Linvega f3d86c5384 (hilbert) Cache last pos 2024-01-21 08:58:34 -08:00
Devine Lu Linvega 2560216ed0 (hilbert) Housekeeping 2024-01-21 08:39:29 -08:00
Devine Lu Linvega 8212ca5edb (controller.tal) Housekeeping 2024-01-15 15:21:04 -08:00
Devine Lu Linvega 4a303fab90 (bunnymark) Added controller input 2024-01-15 08:45:41 -08:00
Devine Lu Linvega 17e6d4df22 (bunnymark) Optimizations 2024-01-15 08:41:54 -08:00
Devine Lu Linvega 362dee8b1b (bunnymark) Housekeeping 2024-01-15 08:30:25 -08:00
Devine Lu Linvega 950a5085ee (bunnymark) Optimizations 2024-01-15 08:23:10 -08:00
Devine Lu Linvega 6fbf4ff535 (bifurcan) Optimizations 2024-01-14 16:16:54 -08:00
Devine Lu Linvega 6e50e4ce92 (bifurcan) Modernize style 2024-01-14 16:06:24 -08:00
Devine Lu Linvega 6128c79b18 Fixed issue with EOF 2024-01-13 16:50:05 -08:00
Devine Lu Linvega 7bf469dca2 (file) Clamp length for stat 2024-01-04 19:03:08 -08:00
Devine Lu Linvega 2878639cd7 (file) Expand stat port to show longer file length than a short 2024-01-04 17:20:50 -08:00
Devine Lu Linvega 6712c3eeb9 (file) atomic result for stating 2024-01-04 16:42:47 -08:00
Devine Lu Linvega 69ddbdf0c3 (file) Do not stat twice 2024-01-04 14:26:21 -08:00
Devine Lu Linvega 9ca712237b (file) put_line use put_info 2024-01-04 11:28:21 -08:00
Devine Lu Linvega 1f622ff541 (file) Can File/stat with only 4 bytes of length 2024-01-04 10:58:57 -08:00
Devine Lu Linvega 29823e5bd1 (file) Removed PEEK2 macros 2024-01-04 09:44:46 -08:00
Devine Lu Linvega 22af2ba9c3 (screen) Cache the content of the auto byte 2024-01-03 09:19:09 -08:00
Devine Lu Linvega 011662e1dd (screen) cache elements of the auto byte 2024-01-03 09:05:16 -08:00
Devine Lu Linvega 163d48ec34 Removed extra variable 2024-01-03 08:44:31 -08:00
Devine Lu Linvega 6ba21f8470 (screen) Cache temp values 2024-01-03 08:30:36 -08:00
Devine Lu Linvega 1796eb938f Removed unused variable 2024-01-02 20:24:42 -08:00
Devine Lu Linvega 02f7add4ac Housekeeping 2024-01-02 19:20:16 -08:00
Devine Lu Linvega 78526d56e3 Make uxn instance public 2024-01-02 11:54:12 -08:00
Devine Lu Linvega 8c212fed3e Housekeeping 2024-01-02 11:29:02 -08:00
Devine Lu Linvega a4f4eb7460 Minor optimization in system 2024-01-02 09:55:52 -08:00
neauoire 3f252c0ee3 Fixed crash from missing dev page 2023-12-25 14:39:29 -08:00
Bad Diode 7ec95315ce Fix audio device regression 2023-12-20 09:20:22 +01:00
neauoire 8ca6c75e29 Removed old screen.flip example 2023-12-19 11:16:10 -08:00
neauoire 5fa8fb8401 Removed old system.catch example 2023-12-19 11:12:23 -08:00
neauoire 6e45b5700f (screen.auto) Added a auto port testing file 2023-12-19 10:52:15 -08:00
neauoire b952a2417b (screen) Fixed issue with blending modes 2023-12-18 17:47:24 -08:00
neauoire a62fce6316 Faster screen drawing routines 2023-12-18 14:44:36 -08:00
neauoire 14bf95ba39 (console.tal) Improved example 2023-12-05 11:55:46 -08:00
neauoire 94f6627145 (816.uf1) Added font 2023-11-25 15:52:59 -08:00
neauoire e016461263 (screen) Fixed pixel fill bug 2023-11-18 10:56:34 -08:00
neauoire 86c46be310 (Screen) Removed unused variable 2023-11-12 17:05:46 -08:00
neauoire efd70d34be (Screen) Pass addr to sprite 2023-11-12 17:01:16 -08:00
neauoire f744a95a70 (Screen) Cached row only written when visible 2023-11-12 16:54:19 -08:00
neauoire 94f314280c (Screen) Cache row during sprite drawing 2023-11-12 16:46:44 -08:00
neauoire d6a966e113 (Screen) Faster sprite drawing 2023-11-12 12:38:43 -08:00
neauoire 99c492d385 Store instance device in Uxn itself 2023-11-11 20:57:28 -08:00
neauoire 0d055306a8 (screen) Added fill() function 2023-11-11 20:44:15 -08:00
neauoire dd1f3e0725 Housekeeping 2023-11-11 20:32:52 -08:00
neauoire 228a951f22 (screen.pixel) Added pixel testing program by @aw 2023-11-10 14:47:51 -08:00
neauoire f9de13652c Redraw on resize 2023-11-09 14:45:51 -08:00
neauoire d0a521745a (mouse.tal) Improved implementation 2023-11-09 14:01:11 -08:00
neauoire 6bdb6ca168 Optimized core 2023-11-09 13:46:10 -08:00
neauoire fa6d62c70a (screen.blending) Draw foreground sprites too 2023-11-08 09:30:49 -08:00
neauoire 9924af3593 (screen.blending.tal) Added 1bpp demo 2023-11-05 11:07:56 -08:00
Capital 76732db18a (uxnasm.c) Add check for missing output file 2023-11-04 19:04:08 -07:00
Bad Diode 798ebafdc8 Fix potential out of bounds when doing tuning lookup 2023-11-02 17:30:14 -07:00
neauoire 6381ebb545 (audio-test) Loop melody 2023-11-02 17:30:14 -07:00
neauoire f1d903c775 (audio-test) Fixed durations 2023-11-02 17:30:14 -07:00
d_m 6a091365a2 Take pitch into account when computing duration. 2023-11-02 17:30:14 -07:00
d_m dbf1c72f21 Detect duration for note_off as well as note_on. 2023-11-02 17:30:14 -07:00
neauoire 87d6798593 Formatting 2023-11-02 17:30:14 -07:00
neauoire c4ec4a6340 (audio.c) Default duration is sample length 2023-11-02 17:30:14 -07:00
neauoire 328f52128b (piano.tal) Support new volume port 2023-11-02 17:30:14 -07:00
Bad Diode c26c27a730 Add dei ports 0x2 and 0x4 to audio devices 2023-11-02 17:30:14 -07:00
Bad Diode 9c8ae94825 Change sdl audio to not play until the first pitch is sent 2023-11-02 17:30:14 -07:00
Bad Diode 1d7c96dd3d Update default envelope 2023-11-02 17:30:14 -07:00
Bad Diode 8f3d7b9020 Add minimum decay/release of 10ms 2023-11-02 17:30:14 -07:00
Bad Diode d1c156d56c Fix uxncli missing device pointer 2023-11-02 17:30:14 -07:00
Bad Diode e1074c9018 Increase base volume 4x (1 channel max -12dB) 2023-11-02 17:30:14 -07:00
Bad Diode ae11965898 Update audio-tests.tal example 2023-11-02 17:30:14 -07:00
Bad Diode 0f3b070313 Try to avoid audio callback from working after free 2023-11-02 17:30:14 -07:00
Bad Diode 2c3f9f0f47 Fix wrong freeing of memory 2023-11-02 17:30:14 -07:00
Bad Diode 56c500f25e Restore sample stretching behaviour 2023-11-02 17:30:14 -07:00
Bad Diode 41b143b8e0 Update audio-tests to use proper sine function 2023-11-02 17:30:14 -07:00
Bad Diode 6569c9d749 Add per-cent tuning and change note-off to #00 2023-11-02 17:30:14 -07:00
Bad Diode b2e67c0319 Make sure device memory is freed 2023-11-02 17:30:14 -07:00
Bad Diode e6cf770d2e Fix memory bug and restore previous looping behaviour 2023-11-02 17:30:14 -07:00
Bad Diode 4b64ced669 Restore audio port layout and use 0x5 for duration 2023-11-02 17:30:14 -07:00
Bad Diode 9d1013d3bf Make sure ADSR uses the audiobuf macros 2023-11-02 17:30:14 -07:00
Bad Diode c6713b6d1b Reduce the detuning/pitch table for now 2023-11-02 17:30:14 -07:00
Bad Diode 88ba7a8623 Cleanup warnings 2023-11-02 17:30:14 -07:00
Bad Diode 32853ce8f7 Fix xfading issues 2023-11-02 17:30:14 -07:00
Bad Diode 9437c4e520 Add sample duration handling 2023-11-02 17:30:14 -07:00
Bad Diode 49eda85851 Add initial WIP sample player for new audio device 2023-11-02 17:30:14 -07:00
neauoire 632816a58e (uxn.c) Housekeeping 2023-11-01 20:37:46 -07:00
neauoire d28f4f8165 (uxn.c) Simpler switch argument 2023-11-01 19:14:31 -07:00
neauoire 5c79d2813a (uxn.c) Wrap zero-page 2023-11-01 09:54:57 -07:00
neauoire be438b40c6 (uxn.c) Ram wrapping for LDZ 2023-11-01 09:35:38 -07:00
neauoire 7dfcd2b579 (uxn.c) Wrap RAM on LDA/STA 2023-11-01 09:25:39 -07:00
neauoire 8e976310d3 Improved cli stack debugger 2023-10-31 11:24:00 -07:00
neauoire 81a3dbee5e Better on-screen stack debugging 2023-10-31 11:17:33 -07:00
neauoire 2e32545a8b (cube3d.tal) Optimizations 2023-10-30 15:32:02 -07:00
neauoire 8b2d16ffea (uxn.c) Reconnected tnl core without device masks 2023-10-30 15:12:25 -07:00
neauoire 3d9408e605 (uxn.c) Removed useless mask 2023-10-30 14:22:19 -07:00
neauoire b35bded3e4 (uxn.c) Reconnected old abc core 2023-10-30 14:14:02 -07:00
neauoire 5abea12b46 Made a backup of tnl core 2023-10-30 11:35:46 -07:00
neauoire d167b88996 (uxncli) Zeroing Uxn 2023-10-30 11:24:04 -07:00
Remko Tronçon 0189721956 (uxn.c) Fix pointer wrapping issues 2023-10-30 11:13:46 -07:00
neauoire f1f1babd47 (uxn.c) Removed used of stack pointer for circular arithmetic 2023-10-30 09:29:40 -07:00
Remko Tronçon bb99a02bf7 (build.sh) Remove special handling of SDL2 library on macOS.
--static-libs already uses the static library, so the special handling
does nothing.
Depending on the `brew` executable in the build blocks using the build
script inside a brew formula.
2023-10-29 14:20:59 -07:00
neauoire 6e96b22e36 (move.tal) Minor optimizations 2023-10-28 10:17:10 -07:00
neauoire a0fa9ca9a3 (move.tal) Housekeeping 2023-10-28 10:08:01 -07:00
neauoire b513014fa8 (screen.blending.tal) Fixed issue with sprite position 2023-10-27 19:53:42 -07:00
neauoire 85d22bbb90 (uxnasm) Date 2023-10-27 08:43:48 -07:00
Remko Tronçon cff5746e03 (uxnasm.c) Support outputting to stdout using `-` 2023-10-27 08:42:41 -07:00
neauoire 187f92d31d (console.write.tal) Added output example to /error port 2023-10-26 11:29:49 -07:00
neauoire 413f3a82f8 Fixed warnings 2023-10-25 15:25:32 -07:00
neauoire 5babd72e6a Clear screen on debugger toggle 2023-10-25 15:23:56 -07:00
neauoire d97fa9e8b8 Added F12 to toggle borderless 2023-10-25 14:16:23 -07:00
neauoire 7cc77a47f4 Formatted 2023-10-25 11:24:37 -04:00
Leonora Tindall b57554a098 (uxnemu) add fullscreen mode and improve argument handling 2023-10-25 11:23:27 -04:00
Andrew Alderwick 249829c614 Update builds to new hostnames. 2023-10-23 15:48:02 +01:00
neauoire c71842aa84 (dvd.tal) Optimized 2023-09-29 14:01:13 -04:00
Sigrid Solveig Haflínudóttir f8c7e44ea1 console: add a newline at eof 2023-09-21 17:13:17 +00:00
neauoire d7f96acb93 (fizzbuzz.tal) Housekeeping 2023-09-05 20:05:14 -07:00
neauoire 5d39dcdbdc (uxncli) Send zero byte and EOF on stdin 2023-09-05 16:34:49 -07:00
neauoire a323cb5c56 (screen.c)Fixed redraw issue 2023-09-02 18:34:04 -07:00
neauoire fb892e4329 Uxn can no longer error 2023-09-02 13:51:03 -07:00
neauoire a65c1cb9a8 Removed LINK req in uxncli 2023-09-01 15:15:15 -07:00
neauoire cfd29ac511 (uxnemu.c) Cache audio values before POKE2 2023-08-30 12:12:30 -07:00
neauoire 3b526bbed6 (screen.c) Always cache value before PEEK/POKE 2023-08-30 12:06:04 -07:00
neauoire f4caad2d51 (uxn.h) Removed unused macro 2023-08-30 11:46:00 -07:00
neauoire 107a25295b (mouse.c) Do not use POKE2 macro 2023-08-30 11:25:15 -07:00
neauoire 1adb6a8cf0 (uxn.c) Do no check for underflow for push-only opcodes 2023-08-30 11:09:46 -07:00
neauoire 55aae6fee9 (uxn.c) Always cache address before PEEK2 2023-08-30 10:49:00 -07:00
neauoire e35501976c (uxn.c) Standardized setter macros 2023-08-30 10:40:04 -07:00
neauoire e5617f83c9 Removed redundant macros 2023-08-30 10:16:38 -07:00
neauoire aeb38c0819 (uxn.c) Cache intermediary result in POKE2 usage 2023-08-30 09:52:47 -07:00
neauoire 07dc45c0e7 (uxn.c) Faster stack registers 2023-08-30 09:40:45 -07:00
neauoire d974111939 (uxn.c) Catch underflow with JCI 2023-08-30 09:24:09 -07:00
neauoire c9183a02e5 (uxn.c) Only one writing macro per line 2023-08-29 10:48:19 -07:00
neauoire 7992d54115 (uxn.c) Removed needless masking of opcode lookup 2023-08-29 09:41:00 -07:00
neauoire a18f8697f0 (uxn.c) Removed unnecessary negation 2023-08-25 13:05:45 -07:00
neauoire 1b1c9fc710 Make emu_masks globals 2023-08-25 09:38:03 -07:00
neauoire d3081fd93d Zero ram on reboot 2023-08-19 07:58:44 -07:00
neauoire 15d09cf15b Added stack pointer accessors to system device 2023-08-19 07:34:14 -07:00
neauoire c6a628e6ae Pre-process dei/deo masks 2023-08-17 09:25:24 -07:00
neauoire 5a77c3e1e3 Removed unused ports from system deo mask 2023-08-16 20:46:24 -07:00
neauoire 63d5dd681a Tightened screen debugger redraw 2023-08-16 14:33:45 -07:00
neauoire d3371d1f73 Muted warnings 2023-08-16 13:53:31 -07:00
neauoire 13bd3ce2d8 Made debugger private to screen 2023-08-16 13:46:07 -07:00
neauoire cfe02013fd Inlined system_cmd 2023-08-15 19:23:55 -07:00
neauoire d8532e7c0e system_load() is now private 2023-08-15 19:21:06 -07:00
neauoire b737dfca85 Combined all system reboots 2023-08-15 19:19:06 -07:00
neauoire bd8b2026b8 Keep boot rom path in system 2023-08-15 18:53:51 -07:00
neauoire ddd3a46156 Standardized main() in uxncli and uxnemu 2023-08-15 18:47:34 -07:00
neauoire b66d3f2612 Abstracted emu_end() 2023-08-15 18:44:16 -07:00
neauoire 4d7ce3e893 Made a console_listen function 2023-08-15 16:24:40 -07:00
neauoire 8d4074b372 Removed console queue from emu_start 2023-08-15 16:11:21 -07:00
neauoire c0d45d1440 Try loading rom during system init 2023-08-15 16:06:29 -07:00
neauoire 9a7a11003f System device handles boot 2023-08-15 15:59:32 -07:00
neauoire a77434a671 Reset device page on soft reboot 2023-08-13 21:11:18 -07:00
neauoire de7b24e820 Added soft reboot 2023-08-13 18:48:32 -07:00
neauoire a394dcb999 Updated date 2023-08-10 08:50:14 -07:00
neauoire c7884b625f Fixed issue where redraw region always started at 0 2023-08-10 08:47:34 -07:00
neauoire 015072fea4 (uxn.c) Removed offset in PUT() 2023-08-09 19:43:28 -07:00
neauoire 18302105c6 (uxn.c) PUT2 should not use POKE 2023-08-09 19:38:18 -07:00
neauoire b610a88083 (uxn.c) Faster SET() macro 2023-08-09 19:31:33 -07:00
neauoire 23203381a7 (uxn.c) Aligned macros 2023-08-09 16:18:35 -07:00
neauoire 1bd67977fb (uxn.c) Added missing labels 2023-08-09 16:11:38 -07:00
neauoire 837b839b4c (uxn.c) Using tnl core 2023-08-09 13:20:03 -07:00
neauoire 1d8babb397 (uxn-tnl) Use stack pointer for arithmetic 2023-08-09 12:57:51 -07:00
neauoire 61896abc7f Added a copy of abc core with joint pops/pushes 2023-08-09 12:12:31 -07:00
neauoire e90c716cdc Merged POP2 calls 2023-08-08 20:00:27 -07:00
neauoire 5675d8e65d (uxn.c) Merged PUSH calls 2023-08-08 19:53:23 -07:00
neauoire b523162cf8 (uxn.c) Joined POP22 PUSH22 2023-08-08 19:38:09 -07:00
neauoire 52fac7c52b Faster Pushxx 2023-08-08 17:23:18 -07:00
neauoire 901f76ed52 Merged POPxPOPx and PUSHxPUSHx 2023-08-08 17:13:39 -07:00
neauoire a11660f57d (uxnasm.c) Fixed issue with lambda 2023-08-08 16:46:35 -07:00
neauoire d15b2367f3 (uxnasm.c) Added comma after date 2023-08-08 16:39:33 -07:00
neauoire c26de05efa Added version to uxnasm 2023-08-08 16:35:35 -07:00
neauoire 2e25f6c27e Added version flag to uxnemu 2023-08-08 15:56:40 -07:00
neauoire 9c25f801d0 Print system versions for uxncli with -v flag 2023-08-08 15:31:48 -07:00
neauoire 2e1b56018b Added per-device versions 2023-08-08 14:44:17 -07:00
neauoire 97d299261f Setting up stage to add versioning 2023-08-08 14:13:07 -07:00
neauoire 13570f790d (screen.c) Hide stack debugger when empty 2023-08-08 10:39:11 -07:00
neauoire 7090ab72b9 Returned the on-screen debugger 2023-08-08 10:27:41 -07:00
neauoire 27ff275cea Merge branch 'main' of git.sr.ht:~rabbits/uxn 2023-08-08 09:23:49 -07:00
neauoire a1d2bfbbb0 Removed DEI/DEO from uxn-tnl core 2023-08-08 09:23:11 -07:00
Sigrid Solveig Haflínudóttir 9888dcba03 DEVR: use bitwise OR to avoid C compiler (kencc) promoting types to int and doing other weird stuff 2023-08-08 04:22:10 +02:00
Sigrid Solveig Haflínudóttir a87ececb71 remove SDL_RENDERER_TARGETTEXTURE (unused) 2023-08-08 02:49:02 +02:00
neauoire fda12df0f1 Housekeeping 2023-08-07 16:35:34 -07:00
neauoire c68936b475 (uxn.c) Renamed POP/PUSH to POPx/PUSHx 2023-08-07 16:22:57 -07:00
neauoire fcf12a12dc (uxn.c) Connected to device masks 2023-08-07 16:12:12 -07:00
neauoire 6d7696a760 (uxn.c) Reconnected old core 2023-08-07 12:20:50 -07:00
neauoire e0bbf38af5 (uxn.c) Reconnected the wires to the old core to be compatible with emu 2023-08-07 12:07:39 -07:00
neauoire 222246748e (screen.c) Inlined sprite drawing function 2023-08-05 10:31:22 -07:00
neauoire 789fb0cd8b (screen.c) Faster sprite drawing 2023-08-05 09:59:08 -07:00
neauoire d6691fddef (screen.flip) Added example to test flip bit in screen/sprite port 2023-08-05 08:56:32 -07:00
neauoire b4d7818632 Added auto byte sprite flipping 2023-08-04 11:55:17 -07:00
Derek Stevens ffc604fba3 run: set window title from rom
Signed-off-by: Derek Stevens <nilix@nilfm.cc>
2023-08-04 11:47:37 -07:00
neauoire 2ddc20b1b6 (uxnasm) Generalized lambdas as common labels 2023-08-02 19:48:48 -07:00
Cellmaker 9ca8e9623d added microtonality to the audio device 2023-07-30 15:03:34 -07:00
Devine Lu Linvega 538294220d (launcher.tal) Clear screen using Screen/pixel 2023-07-29 18:46:25 -07:00
Devine Lu Linvega 3a8cc42e0e Better labels for lambdas 2023-07-29 16:24:39 -07:00
Devine Lu Linvega 32cc690539 (uxnasm) Lambdas support 2023-07-29 16:14:19 -07:00
Devine Lu Linvega e2e5e86531 Added screen.blending.tal 2023-07-26 09:57:36 -07:00
Devine Lu Linvega 0efea06b46 Only update viewport rect on resize 2023-07-26 08:37:58 -07:00
Devine Lu Linvega 289d13aeb4 Returned emulator border 2023-07-25 21:43:26 -07:00
Devine Lu Linvega 12509b7e6b Merged show() and gameloop() 2023-07-25 14:56:26 -07:00
Devine Lu Linvega db2117ee0a Resize emulator on start 2023-07-25 14:46:37 -07:00
Devine Lu Linvega 4286e0ba53 Grouped emulator routines together in uxnemu 2023-07-25 14:42:10 -07:00
Devine Lu Linvega 969f03e0ba Uxnemu skips resizing window until reset vector is done. 2023-07-25 14:30:51 -07:00
Devine Lu Linvega 07f2ea43f7 (mouse.tal) Fixed issue with clearing 2023-07-24 10:47:52 -07:00
Devine Lu Linvega dcb434760b Housekeeping 2023-07-24 09:48:49 -07:00
Devine Lu Linvega eb07d9fba6 (bunnymark.tal) Fixed issue with clear 2023-07-23 20:48:22 -07:00
Devine Lu Linvega 737f4af8ab (amiga.tal) Fixed issue with clearing 2023-07-23 20:43:16 -07:00
Devine Lu Linvega 26bc456a1b (screen.c) Blending 00 only clears in accordance to sprite at addr 2023-07-23 19:32:41 -07:00
Devine Lu Linvega 867883409e Emulator functions prefixed with emu_ instead of uxn_ 2023-07-23 19:18:11 -07:00
Devine Lu Linvega ec973c2ea6 Only set emu size on screen resize, no constant checks 2023-07-23 16:24:09 -07:00
Devine Lu Linvega 29e664c6b8 Do not re-set window size when unchanged 2023-07-23 16:10:48 -07:00
Devine Lu Linvega 4db53c1cc6 (uxn.c) Housekeeping 2023-07-23 11:06:21 -07:00
Devine Lu Linvega cb41bdfa9a (uxn.c) Removed PUSH/PUSH2 macros 2023-07-23 10:13:16 -07:00
Devine Lu Linvega bf1ee0298d (uxn.c) Fixed issue where JSRr was pushing to wrong stack 2023-07-23 09:57:32 -07:00
Devine Lu Linvega db6f7d9fbf (uxn.c) Aligned BRK/JCI/JMI 2023-07-23 09:52:20 -07:00
Devine Lu Linvega bc4ec9ea5f (uxn.c) JSI makes use of SET() macro 2023-07-23 09:41:11 -07:00
Devine Lu Linvega 6f15a96d91 (uxn.c) LIT opcodes use SET() macro 2023-07-23 09:36:18 -07:00
Devine Lu Linvega b020732d6d (uxn.c) PUT2 should use POKE2 macro 2023-07-23 09:21:09 -07:00
Devine Lu Linvega 41a3a6b358 (uxn) Removed z stack assignment 2023-07-22 20:53:23 -07:00
Devine Lu Linvega 92e06e2eda Removed window padding 2023-07-22 19:52:17 -07:00
Devine Lu Linvega a673d63336 (fizzbuzz.tal) Formatting 2023-07-21 11:35:56 -07:00
Devine Lu Linvega 050690181a (fib.tal) Housekeeping 2023-07-21 10:42:04 -07:00
Devine Lu Linvega 98a0c7d609 (fib.tal) Formatted 2023-07-21 10:18:49 -07:00
Sigrid Solveig Haflínudóttir 0c9e67b9be uxncli: stop on EOF as there is nothing left to run (besides endless loop) 2023-07-17 00:52:52 +02:00
Sigrid Solveig Haflínudóttir 51d43a6989 screen: don't leak memory and don't crash if failed to adjust for new screen size 2023-07-17 00:50:19 +02:00
Devine Lu Linvega a75f4a1496 (datetime.tal) Added numeric display of date 2023-07-16 11:59:30 -07:00
Devine Lu Linvega a0b739f8da (datetime) Improved example 2023-07-16 11:41:44 -07:00
Devine Lu Linvega 8508fd3dec Improved console device examples 2023-07-16 10:04:40 -07:00
Devine Lu Linvega 7f35e1863a Improved device examples 2023-07-16 09:41:40 -07:00
Devine Lu Linvega f0377ca2d9 (system.expansion.tal) Added expansion port test file 2023-07-15 21:58:41 -07:00
Devine Lu Linvega 1880b1cd2a (system.catch) Improved test file. 2023-07-15 21:46:04 -07:00
Sigrid Solveig Haflínudóttir dbcb8ed050 retry_realpath: check before possibly writing out of bounds 2023-07-10 17:21:36 +00:00
Sigrid Solveig Haflínudóttir 784467564c uxnemu: fix two warnings on 9front build 2023-07-10 15:37:42 +00:00
Sigrid Solveig Haflínudóttir 05356e23b1 capture_screen: check for errors 2023-07-10 15:35:35 +00:00
Devine Lu Linvega ff6d9e39ca (uxnemu) Fixes issue where non-zero console/type occurs even when empty, fixed by hikari_no_yume 2023-06-29 14:23:16 -07:00
Weeble f5c816d215 (screen.c) Fix sprite draw at screen edge
Problem - Sprites can be drawn at X/Y coordinates >= 0xfff9 to appear
partially over the left/upper screen boundary. But the dirty-rectangle
calculation doesn't account for this, so these updates will only appear
on the screen if something *else* dirties this area of the screen. This
can be observed in /projects/examples/devices/screen.tal where these
edges of the screen show stale content.

Solution - Detect wrapping and expand the dirty rectangle appropriately.
Change screen_change to take Uint16 to make sure values are truncated to
the intended range. Ignore changes that are fully off the screen.
2023-06-29 07:41:42 -07:00
Devine Lu Linvega 49d74b89d0 (subleq.tal) Ported to immediate modes 2023-06-27 11:27:27 -07:00
Devine Lu Linvega f3674b2562 (circle128) Added radius arg 2023-06-09 10:53:23 -07:00
Andrew Alderwick f6b7195578 Update binary builds to point to drive.100r.co. 2023-06-09 18:13:44 +01:00
Devine Lu Linvega e930804c4b Do not print message on quit 2023-06-09 09:29:25 -07:00
Devine Lu Linvega 6d93884d85 (circle128) Minor opt 2023-06-08 22:11:49 -07:00
Devine Lu Linvega f80279e1f2 (circle128) Fixed build instructions 2023-06-08 21:32:29 -07:00
Devine Lu Linvega ade58a229a (tables.c) Renamed to circle128.c 2023-06-08 21:21:22 -07:00
Devine Lu Linvega fe10cfecef Improved usage standard message 2023-06-08 09:47:18 -07:00
Devine Lu Linvega 650c38115d Removed the echo prints from the build file 2023-06-08 09:31:01 -07:00
Devine Lu Linvega b4a6a16da8 (wireworld.tal) Removed, moved to uxn-utils 2023-06-07 16:36:57 -07:00
neauoire 59035ab291 (wireworld.tal) Fixed mouse picking issue 2023-06-07 09:58:10 -07:00
neauoire 3f162f6258 (wireworld.tal) Match colors to standard wireworld specs 2023-06-07 09:51:27 -07:00
neauoire 5dd7fec729 Removed clear between redraws and moved to set_window_size 2023-06-07 08:23:42 -07:00
neauoire e147b46b55 Snake_cased some SDL variables 2023-06-07 08:03:28 -07:00
neauoire 2810592c1b (fib.tal) Fixed incorrect definition 2023-06-06 14:33:20 -07:00
neauoire 1666aebea2 Merge branch 'main' of git.sr.ht:~rabbits/uxn 2023-06-06 11:49:37 -07:00
neauoire 6fc314b5a0 (fib.tal) Added tail-recursive version 2023-06-06 11:49:28 -07:00
Andrew Alderwick c543827b76 (asma) Correct exit status from software/asma.tal runs. 2023-06-05 19:06:13 +01:00
Devine Lu Linvega 8d90298e57 (fib.tal) Improved example 2023-06-01 21:53:28 -07:00
Devine Lu Linvega 1d4ae74e41 Removed multiplication from SET macro in uxn core 2023-05-17 20:39:03 -07:00
Sevan Janiyan 305b8469b0 Use the correct definition to obtain snprintf(3)
At some point snprintf(3) prototype became guarded off in stdio.h.
Defining _C99_SOURCE makes it visible.
On legacy Darwin, such a guard was not present so the definition
has no impact on the build, but on "modern" macos it has the desired
effect.
Build tested on OS X 10.4 and macos 10.15.
2023-05-15 08:32:48 -07:00
Sevan Janiyan b5b3177c68 Switch to using SDL_CreateRGBSurface() SDL_CreateRGBSurfaceWithFormat() was introduced in SDL 2.0.5 whereas SDL_CreateRGBSurface() is available since SDL 2.0. This allows uxn to run on legacy systems where it's not possible to reach SDL 2.0.5 but prior versions are, such as Mac OS X Tiger. 2023-05-14 19:34:55 -07:00
Sevan Janiyan 822a7fea54 Use the audio format native to host AUDIO_S16 defaults to little endian format which causes issues when running on big endian systems. Use AUDIO_S16SYS instead which sets to whatever endian the system uxn is being built on is. 2023-05-14 19:34:55 -07:00
d_m 310ba97ef6 Improve screen vector timing somewhat.
This patch tries to improve the accuracy of our
screen refresh timing. Notably, it tries to ensure
we don't introduce extra delay in our timing based
on how long the screen vector takes to evaluate.

We also try to ensure we only call SDL_Delay when
we have at least 1ms to wait.
2023-05-09 13:12:23 -07:00
Devine Lu Linvega 09d9990a62 (screen) Fixes warnings 2023-05-04 20:45:52 -07:00
Devine Lu Linvega 77edd1dbbf (screen) Renamed pixels attr to layer 2023-05-04 20:32:44 -07:00
Devine Lu Linvega d80885ee22 (screen) Housekeeping 2023-05-04 20:17:38 -07:00
Devine Lu Linvega 98bd2a7849 (screen) Use uxn_screen global 2023-05-04 17:43:44 -07:00
Devine Lu Linvega 1fdb91ecb8 (amiga.tal) Tiny refactoring 2023-05-04 17:15:27 -07:00
Devine Lu Linvega 204805b586 (amiga.tal) Do not flip rotation direction on floor collision 2023-05-04 16:25:41 -07:00
Nojus Raskevicius 64f2692734 Remove fps limit on bounce for amiga.tal 2023-05-04 15:58:34 -07:00
d_m 11a893d10d Reverse ball rotation after bouncing. 2023-05-04 15:57:00 -07:00
Devine Lu Linvega 9416a0e813 Removed layer struct 2023-05-04 11:33:31 -07:00
Devine Lu Linvega 8f98281d89 (screen) Only repaint changed pixels 2023-05-04 11:15:16 -07:00
Sigrid Solveig Haflínudóttir a740105b76 enable "install" target on Plan 9, install as games/uxn* 2023-05-02 23:01:29 +00:00
Sigrid Solveig Haflínudóttir c7f3014fe9 zoom: ignore if 0, ie if the screen is somehow TOO small to do any scaling 2023-05-02 22:53:07 +00:00
Devine Lu Linvega 83ba7e05ea Added mock behavior for the friend port 2023-05-02 10:31:33 -07:00
Matus Laslofi d2e054346f Declare snprintf to fix builds on macOS
For some reason on macOS, the functions `snprintf` and `vsnprintf` are
not in the X/Open 5 (ANSI C89) standard but rather in the X/Open
6 (ISO C99). A simplest solution seems to be to declaring the missing
functions before using them, which is what I did here. Another option
is to use the C99 standard with `#define _XOPEN_SOURCE 600`, which
seems to be an overkill for such a niche issue.

Quoting from the STANDARDS section in `man 3 snprintf` on macOS:

> ...the snprintf() and vsnprintf() functions conform to ISO/IEC
> 9899:1999 (“ISO C99”)...
2023-05-01 09:27:49 -07:00
Devine Lu Linvega ce0cc5a352 Do not center on resize 2023-04-26 12:04:44 -07:00
Devine Lu Linvega 0da70d6bd1 Allow tiny sizes for the screen 2023-04-26 12:01:45 -07:00
Devine Lu Linvega ebf31ecb03 (uxnemu) Removed debug line 2023-04-22 14:57:26 -07:00
Devine Lu Linvega 40d6c889bc Set Console/type after memory is initialized 2023-04-22 14:56:12 -07:00
Devine Lu Linvega 3038d5c40b (console) Use 0x00 for no-queue 2023-04-17 11:27:54 -07:00
Devine Lu Linvega d8bee29626 (console) Use 0x1 for no-args 2023-04-17 11:19:37 -07:00
Devine Lu Linvega 98282cb1a6 Moved error printing to system.c 2023-04-17 11:03:11 -07:00
Devine Lu Linvega b76b7b6e9b (console.tal) Test argument queue 2023-04-17 10:55:45 -07:00
Devine Lu Linvega 9a882a64c7 (uxnemu) Write arguments end in console device 2023-04-17 10:41:03 -07:00
Devine Lu Linvega 1bf0ffc5e5 (uxnemu) Display usage when no roms and no params 2023-04-17 10:29:39 -07:00
Devine Lu Linvega 453f491918 (uxnemu) Display new zoom values in usage 2023-04-17 09:59:00 -07:00
Devine Lu Linvega 72e23f0260 (uxnemu) Simplified boot sequence 2023-04-17 09:48:27 -07:00
Devine Lu Linvega d1dc143912 (uxnemu) Only set zoom scale once on boot 2023-04-17 09:36:55 -07:00
Devine Lu Linvega 6021b2b63d (console.tal) Fixed underflow error on quit 2023-04-16 22:07:47 -07:00
Devine Lu Linvega a9527fbd95 (console.tal) Added input type port to example 2023-04-16 22:03:44 -07:00
Devine Lu Linvega fbba9b304d (console) Implemented 0x17 port with stream type based on design by zzo38 2023-04-16 21:13:50 -07:00
Devine Lu Linvega 5e927cdfde (datetime.tal) Added day of the year 2023-04-16 14:51:00 -07:00
Devine Lu Linvega 04c6472819 (datetime.tal) Created a test file for the datetime device 2023-04-16 14:39:20 -07:00
Devine Lu Linvega c70ba4238a (system.tal) Made example dynamic 2023-04-15 20:06:34 -07:00
Devine Lu Linvega 07f9785fab (quine.tal) Added quine example 2023-04-15 12:44:36 -07:00
Devine Lu Linvega 32fa0f95c3 (uxn.c) Catch div-by-zero errors 2023-04-15 09:52:08 -07:00
Devine Lu Linvega 14b704fd01 (system.tal) Added error handler example 2023-04-15 09:49:58 -07:00
Devine Lu Linvega 25cc4a1329 (screen.tal) Improved screen testing rom 2023-04-14 19:51:05 -07:00
Devine Lu Linvega c7203de2ea (uxn.c) Less indirections in uxn core 2023-04-14 10:30:08 -07:00
Devine Lu Linvega 99874908e4 (screen.c) Skip blit when color is 0 2023-04-14 10:19:57 -07:00
Devine Lu Linvega 0f75b123a4 (screen) sprite address wrapping 2023-04-14 10:05:15 -07:00
Devine Lu Linvega 04554dd1d3 (screen.c) Reduced number of variables indirections 2023-04-14 09:51:50 -07:00
Devine Lu Linvega b6e6839d25 (screen.c) Removed pixel function 2023-04-13 21:57:17 -07:00
Devine Lu Linvega d0db4f9223 (screen.c) Improved readability of the code 2023-04-13 21:33:16 -07:00
Devine Lu Linvega 891204610a Fixed issue with screen/fill layer 2023-04-13 09:58:09 -07:00
Devine Lu Linvega 2acc7edb6f Added comment for blending LUT 2023-04-13 09:53:05 -07:00
Devine Lu Linvega d043ce633d (screen.c) Faster drawing of pixel 2023-04-13 09:42:59 -07:00
Devine Lu Linvega a44dbd9696 (screen.c) Merge all checks 2023-04-12 20:00:17 -07:00
Devine Lu Linvega 8aae16a9d0 (screen) Removed clamp function 2023-04-12 19:20:11 -07:00
Devine Lu Linvega 540847694e Removed screen_wipe 2023-04-12 14:35:48 -07:00
Devine Lu Linvega be138f5952 Removed FIXED_SIZE flag 2023-04-12 12:22:17 -07:00
Devine Lu Linvega 11e9b635c8 Removed mono mode to screen 2023-04-12 11:58:32 -07:00
Lior Stern 847b3f2b56 uxnemu: Add dpad support
More info about joyhats in SDL2:
	https://wiki.libsdl.org/SDL2/SDL_JoyHatEvent
2023-04-12 11:08:48 -07:00
Devine Lu Linvega 344c5c9904 Added flip-x/flip-y to pixel fill mode 2023-04-11 11:31:36 -07:00
Devine Lu Linvega 07e8306616 (screen) Created static fill function 2023-04-11 11:11:12 -07:00
Devine Lu Linvega 24dbc7d5f8 (screen) Rename screen_clear to screen_fill 2023-04-11 10:42:32 -07:00
Devine Lu Linvega daa421c259 (uxn.c) Cache stack pointer 2023-04-11 10:32:23 -07:00
Devine Lu Linvega fc8400dcac (uxn.c) Formatting 2023-04-11 10:24:54 -07:00
Devine Lu Linvega 3973bc2ab8 Made the uxn stacks private again 2023-04-11 10:14:29 -07:00
Devine Lu Linvega 83237c9641 (launcher.tal) Do not try to open extra-large ROMs 2023-04-09 15:24:55 -07:00
Devine Lu Linvega 6f55ed496c (uxncli) Fixed issue with DateTime device mask 2023-04-08 08:53:56 -07:00
Devine Lu Linvega eaf7d095ec (system.c) The debug port will always print the stacks, even if empty 2023-04-06 17:50:03 -07:00
Devine Lu Linvega 38ec3ef7e7 Removed mention of uxn-fast from README 2023-04-05 19:25:40 -07:00
Devine Lu Linvega f19d3262ff (console.tal) Do not eval on space 2023-04-05 17:18:03 -07:00
Devine Lu Linvega 21e41874cb (console.tal)Added quit option 2023-04-05 16:50:06 -07:00
Devine Lu Linvega 00ed056e51 (uxnasm) Added support for label sized pads 2023-04-04 20:02:33 -07:00
Devine Lu Linvega edfa734817 (metadata.tal) Removed, moved to uxn-utils 2023-04-04 15:44:52 -07:00
Devine Lu Linvega a55d2c80ca (mouse.tal) Drawing button states 2023-04-03 21:15:52 -07:00
Devine Lu Linvega 3b10969f9e Fixed issue where a screen redraw might occur after it has been unset 2023-04-02 20:27:15 -07:00
Devine Lu Linvega 8b43d0d7ae Removed redundant pixel param from screen routines 2023-03-27 08:38:54 -07:00
Sigrid Solveig Haflínudóttir 8a3c86a879 core: in plan 9 C it does not wrap around, fix the crash 2023-03-20 16:29:46 +00:00
Sigrid Solveig Haflínudóttir 37afbc25fb file: sprintf → snprintf 2023-03-20 16:58:45 +01:00
Sigrid Solveig Haflínudóttir 562153d09e fix a few long-standing compilation warnings 2023-03-20 16:58:09 +01:00
Sigrid Solveig Haflínudóttir 21f8130f0d fix plan 9 build now that we decided to use ifdefs 2023-03-20 16:57:43 +01:00
Devine Lu Linvega e386c3aeaa Fixed issue with Windows builds 2023-03-19 14:12:14 -07:00
Deadly Headshot 05fd9771ca A more elegant solution to the Windows bugs in filepaths and MinGW compilation 2023-03-19 14:11:42 -07:00
Devine Lu Linvega 7d66d81e63 Fixed issue with datetime mask 2023-03-17 21:45:03 -07:00
Devine Lu Linvega 4f9b375895 Fixed issue with device deo mask in uxnemu 2023-03-14 12:40:31 -07:00
Devine Lu Linvega 35c90d8a24 Merge branch 'main' of git.sr.ht:~rabbits/uxn 2023-03-13 10:32:44 -07:00
Devine Lu Linvega b38e328078 (hilbert.tal) Animated 2023-03-13 10:22:19 -07:00
Andrew Alderwick c701b95541 Detect stack overflows with greater than 255 bytes. 2023-03-13 06:04:33 +00:00
Andrew Alderwick 4464b1ec56 Correct SET values for NIP. 2023-03-13 06:03:44 +00:00
Devine Lu Linvega 39fa5851eb (hilbert.tal) Updated colors 2023-03-12 22:24:25 -07:00
Devine Lu Linvega 79cb56a718 (hilbert.tal) Added Hilbert demo 2023-03-12 22:10:28 -07:00
Devine Lu Linvega b68af3d173 Replaced macros in PUT2/PUSH2 2023-03-12 18:29:08 -07:00
Devine Lu Linvega 1de2cea576 Ordered the SWP writes 2023-03-12 16:15:27 -07:00
Devine Lu Linvega 3ecbfe5e03 Make use of macros in PUT/PUSH 2023-03-12 15:54:20 -07:00
Devine Lu Linvega 4e77d3d5ae Renamed PEEK16/POKE16 to PEEK2/POKE2 2023-03-12 15:25:52 -07:00
Devine Lu Linvega 43ce262a07 Moved opcodes side-by-side 2023-03-12 15:16:10 -07:00
Devine Lu Linvega 6c068b7774 Removed device page from addressable memory 2023-03-12 14:56:44 -07:00
Devine Lu Linvega bdd071cab4 Archived old core 2023-03-12 14:49:58 -07:00
Devine Lu Linvega 13ab0e5d95 Temporarily override uxn.c with fast until I can port the devices macros 2023-03-11 23:00:32 -08:00
Sigrid Solveig Haflínudóttir 8420c81d52 system.h: no need to redefine the same macro 2023-03-12 02:39:20 +01:00
Devine Lu Linvega 75af0e3cad Removed redundant mask in SFT opcode 2023-03-08 09:25:55 -08:00
Devine Lu Linvega c4856aabf0 Added missing ports in device mask 2023-03-07 19:48:24 -08:00
Devine Lu Linvega 77c8e82419 Moved dei/deo masks into emulators 2023-03-06 10:36:24 -08:00
Devine Lu Linvega 76be67efa0 (uxn-fast.c) Housekeeping 2023-03-06 08:40:00 -08:00
Devine Lu Linvega d08efece3d (uxn-fast.c) Removed redundant macro 2023-03-06 08:31:08 -08:00
Devine Lu Linvega 559d2ae8f2 (examples) Housekeeping 2023-03-05 21:09:38 -08:00
Devine Lu Linvega d4ee3a4760 (life.tal) Migrated to immediate opcodes 2023-03-05 20:58:55 -08:00
Devine Lu Linvega 1245b44d2a (dvd.tal) Migrated to immediate opcodes 2023-03-05 20:49:13 -08:00
Devine Lu Linvega 2c20d282a8 (uxn-fast) Standardized STH opcodes 2023-03-05 11:35:53 -08:00
Devine Lu Linvega 9f4231c59a (uxn-fast) Housekeeping 2023-03-05 11:33:33 -08:00
Devine Lu Linvega 3da461e14d (uxn-fast) Housekeeping 2023-03-05 11:31:37 -08:00
Devine Lu Linvega 211c4afa2d (uxn-fast) Use macros for STH 2023-03-05 11:29:58 -08:00
Devine Lu Linvega 497b01fcfb (mandelbrot) Improved speed 2023-03-05 11:06:45 -08:00
Devine Lu Linvega 8ae1c191d7 (uxn-fast.c) Removed function pointers, instead use exterm 2023-03-05 10:44:23 -08:00
Devine Lu Linvega 3190cf3238 Catch overflow in lit opcodes 2023-03-05 10:02:26 -08:00
Devine Lu Linvega f66b975a9c (mandelbrot) Fixed issues 2023-03-04 19:39:07 -08:00
Devine Lu Linvega 268ec45780 (Screen) Use fast timer if vector short is set 2023-03-04 11:07:11 -08:00
Devine Lu Linvega 3457f665a7 Use device masks for DEI 2023-03-04 10:51:23 -08:00
Devine Lu Linvega aeceaf75bf Removed file dei event 2023-03-03 21:04:26 -08:00
Devine Lu Linvega 9ac7f06fde (uxn-fast) Housekeeping 2023-03-03 20:47:20 -08:00
Devine Lu Linvega 4cacc0d26b Removed unused deo param 2023-03-03 20:37:43 -08:00
Devine Lu Linvega 8f979ec0fe Use uxn-fast in bug until the callback masks are ported 2023-03-03 12:02:42 -08:00
Devine Lu Linvega 32539d02a9 Added file device mask 2023-03-03 11:16:24 -08:00
Devine Lu Linvega 6eac5226e1 (bunnymark) Ported to immediate opcodes 2023-03-03 11:03:38 -08:00
Devine Lu Linvega 70e756b2d7 Removed test file 2023-03-02 20:53:35 -08:00
Devine Lu Linvega 895bfc8675 (mandelbrot.tal) Migrated to immediate opcodes 2023-03-02 20:45:19 -08:00
Devine Lu Linvega 617e3d1f41 (uxn-fast) Added overflow error 2023-03-02 19:47:24 -08:00
Devine Lu Linvega b09d5708b8 Use -O2 2023-03-02 16:56:49 -08:00
Devine Lu Linvega 61393d0d83 (uxn-fast) First draft 2023-03-02 16:37:14 -08:00
Devine Lu Linvega 8c4b1b0592 Use switch for console_deo 2023-03-01 12:04:05 -08:00
Devine Lu Linvega ea0d81a9b1 (uxnasm) Fixed refs limit check 2023-03-01 11:46:44 -08:00
Devine Lu Linvega 96a19b4887 Merge branch 'main' of git.sr.ht:~rabbits/uxn 2023-03-01 11:31:10 -08:00
Devine Lu Linvega dae025af20 Date and Screen devices DEI do no need device ptr 2023-03-01 11:28:14 -08:00
Andrew Alderwick 075747f2bd Address compiler warning about switch case falling through. 2023-03-01 19:24:18 +00:00
Andrew Alderwick d12b948e82 Remove unitialised memory. 2023-03-01 19:23:13 +00:00
Devine Lu Linvega abd7ab403e Removed POKDEV 2023-03-01 10:53:44 -08:00
Devine Lu Linvega 486a60b1bd Removed PEKDEV macro 2023-03-01 10:49:25 -08:00
Devine Lu Linvega 53f3c18dcf Removed GETVEC macro 2023-03-01 10:42:03 -08:00
Devine Lu Linvega 87de244d37 Replaced some macros 2023-03-01 10:35:42 -08:00
Devine Lu Linvega 18de47cc1c Fixed issue with out-of-screen painting 2023-02-28 21:54:52 -08:00
Devine Lu Linvega 85df5f2d36 (uxnasm) Fixed issue with makeref() 2023-02-28 21:47:45 -08:00
Devine Lu Linvega bd01e71c35 Sprite wipe helper 2023-02-28 20:54:32 -08:00
Devine Lu Linvega 5709511c7e (screen.c) Do not shift a zero in 1bpp 2023-02-28 19:34:13 -08:00
Devine Lu Linvega 3818720eb2 Removed opacity lut 2023-02-28 17:00:21 -08:00
Devine Lu Linvega 3b128c04d4 (piano.tal) Add softening 2023-02-27 20:11:15 -08:00
Devine Lu Linvega a5ca148862 (piano.tal) Paint waveform with right-click 2023-02-27 19:26:41 -08:00
Devine Lu Linvega 417fac1a83 (piano.tal) Improved knobs 2023-02-27 19:18:37 -08:00
Devine Lu Linvega 09c7365bc3 (piano.tal)Added sharps to keyboard mode 2023-02-27 18:23:40 -08:00
Devine Lu Linvega 41294b7537 (picture.tal) Optimization 2023-02-27 11:21:03 -08:00
Devine Lu Linvega 5091d90e77 (primes.tal) Optimized 2023-02-27 10:41:35 -08:00
Devine Lu Linvega 89d13c6b3d (piano.tal) Improved layout 2023-02-26 21:16:56 -08:00
Devine Lu Linvega 612c15e59a (piano.tal) Faster waveform drawing 2023-02-26 20:39:05 -08:00
Devine Lu Linvega 5d9dc11ec5 (piano.tal) Rewrite 2023-02-26 20:16:41 -08:00
Devine Lu Linvega 91386f4832 (uxn.c) Housekeeping 2023-02-26 14:28:50 -08:00
Devine Lu Linvega 254f0031e5 (uxn.c) Housekeeping 2023-02-26 13:07:48 -08:00
Devine Lu Linvega c6110a50d5 Removed param in PUSH() macro 2023-02-26 09:55:39 -08:00
Devine Lu Linvega 85e4383332 (fizzbuzz.tal) Migrated to immediate opcodes 2023-02-23 19:04:34 -08:00
Devine Lu Linvega 42ade9e8c8 Merge branch 'main' of git.sr.ht:~rabbits/uxn 2023-02-22 12:45:13 -08:00
Devine Lu Linvega 9e663250bf (amiga.tal) Optimizations 2023-02-22 12:45:06 -08:00
Andrew Alderwick f07775a9a2 (file device) Fix buffer overflow. 2023-02-17 21:39:14 +00:00
Devine Lu Linvega 60080d8fe8 (file device)Add / suffix to folder names 2023-02-17 10:08:00 -08:00
d_m c61be654d6 Pass through more keysyms when control is pressed. 2023-02-14 18:33:51 -08:00
Devine Lu Linvega 1014229b8c (uxncli)Use System/halt as exit code 2023-02-13 09:33:57 -08:00
Sigrid Solveig Haflínudóttir c11dcc3771 remove nonsense return 0 2023-02-07 12:08:17 +00:00
Devine Lu Linvega 9f4e85b1b3 Named arguments in system_cmd 2023-02-02 10:40:47 -08:00
Devine Lu Linvega 36a70ed605 Protect system_cmd from reading out of bounds 2023-02-02 10:20:19 -08:00
Devine Lu Linvega 33d6ef8cd2 Reversed arguments in system loader 2023-02-02 09:35:05 -08:00
Devine Lu Linvega 0dcc3b4c2e Simplified system_cmd 2023-01-31 09:49:32 -08:00
Devine Lu Linvega e20b572c20 Moved all system memory functions into system.c 2023-01-31 09:38:06 -08:00
Andrew Alderwick b0b60ca20b Re-enable automated Windows build. 2023-01-31 17:17:11 +00:00
Andrew Alderwick 5538e539d2 Minor optimisation. 2023-01-31 17:11:54 +00:00
Andrew Alderwick 9d9d094e6a Bare minimum changes to get Windows builds running again. 2023-01-31 17:05:01 +00:00
Devine Lu Linvega 0aa4aeff41 Load rom in chunks of 64kb 2023-01-28 18:38:37 -08:00
Devine Lu Linvega 390ae8138a Extend loaded rom size 2023-01-28 15:05:24 -08:00
Devine Lu Linvega f14f762893 Removed test file 2023-01-28 14:45:51 -08:00
Devine Lu Linvega fd84ff44d7 Initial draft for MMU 2023-01-28 14:45:31 -08:00
Devine Lu Linvega 22797644b5 Returned to simpler run function 2023-01-28 10:54:54 -08:00
Devine Lu Linvega b894ba4c57 Fixed issue with screen vector run 2023-01-27 09:36:04 -08:00
Devine Lu Linvega 63108c178a Tighter run 2023-01-26 10:56:14 -08:00
Devine Lu Linvega b5fa665cdb Reduce refresh requests without screen vector 2023-01-26 09:35:56 -08:00
Devine Lu Linvega 6d95f000b1 Added symbol files to gitignore 2023-01-24 09:10:59 -08:00
Devine Lu Linvega aca040b8b2 (amiga.tal) Remove symbol file 2023-01-24 09:10:10 -08:00
Devine Lu Linvega 998c182a44 (amiga.tal) Use call opcodes 2023-01-24 09:09:36 -08:00
Devine Lu Linvega 4ab97a6c1f (README) Removed link to cheatsheet 2023-01-22 17:42:16 -08:00
Devine Lu Linvega e327373950 Increased refs limit 2023-01-21 18:24:11 -08:00
Andrew Alderwick ddf10cf832 (asma) Rebalance the rune tree. 2023-01-15 12:39:57 +00:00
Andrew Alderwick 7c5d90ba66 (asma) Implement new jump and call syntax. 2023-01-15 12:39:57 +00:00
Andrew Alderwick 3d68e08f6c (asma) Auto-start at 0x100. 2023-01-15 12:39:57 +00:00
Devine Lu Linvega cfeeb85712 Catch invalid sublabels 2023-01-14 15:08:40 -08:00
Devine Lu Linvega ffb0a9c9bc (uxnasm.c) Auto-start at 0x100 2023-01-13 10:14:20 -08:00
Devine Lu Linvega fad574816d Removed errcode from stacks 2023-01-12 20:35:42 -08:00
Devine Lu Linvega bc26d9d60d (uxn.c) Removed mask to LDR and write in Uint16 var instead 2023-01-12 19:00:54 -08:00
Devine Lu Linvega c7d574b230 (uxn.c) Unallow LDR/STR to reach outside of ram 2023-01-12 18:47:19 -08:00
Devine Lu Linvega a5442ea4fd (uxn.c) Swapped JMI/JCI 2023-01-12 09:44:27 -08:00
Devine Lu Linvega 5e1c896554 (uxnasm) endian-agnostic handling of symbols file writing 2023-01-12 08:40:33 -08:00
Andrew Alderwick 0f68e08688 Disable flag for rebuild while Windows build is not working. 2023-01-12 13:26:57 +00:00
Andrew Alderwick f202944566 Make JMI, JCI and JSI relative. 2023-01-12 13:22:21 +00:00
Andrew Alderwick 7490666878 (uxnasm) Simplify handling of references. 2023-01-12 13:15:07 +00:00
Andrew Alderwick 230e8dda34 Optimize opcode 0 handling. 2023-01-12 13:02:04 +00:00
Devine Lu Linvega e0c2da0700 (uxnasm) Use correct address in symbol export 2023-01-11 21:01:56 -08:00
Devine Lu Linvega 8cd011b602 (screen.tal) Housekeeping 2023-01-09 19:14:31 -08:00
Devine Lu Linvega 69fa3e008f (screen.tal) Display screen size 2023-01-09 19:04:52 -08:00
Devine Lu Linvega d5d6a7a186 Removed DEO masks, already fed to Uint8 expecting function 2023-01-09 15:54:05 -08:00
Devine Lu Linvega 6d73a4ed9d (metadata.tal) Updated to new format 2023-01-08 12:08:01 -08:00
Devine Lu Linvega a1bc00ce5f (uxnasm) Fixed buffer overflow in tokenizer 2023-01-07 11:59:00 -08:00
Devine Lu Linvega 4e68dc7753 Fixed crash vector where STR/LDR can access outside of bounds 2023-01-07 11:31:03 -08:00
Devine Lu Linvega 6cbe51b4ab (uxn.c)Use same macro format sequence for all CALL opcodes 2023-01-03 11:17:55 -08:00
Devine Lu Linvega 9b8cd748ad Faster CALL opcodes 2023-01-03 10:48:17 -08:00
Devine Lu Linvega 0e7137e016 (uxnasm) Experimental implementation of JM/JC/JS runes 2023-01-02 17:45:06 -08:00
Devine Lu Linvega 5b6aad6be2 Clearer routing of LIT/CALL opcodes 2023-01-02 13:11:52 -08:00
Devine Lu Linvega cc2b2e77b0 Merge branch 'main' of git.sr.ht:~rabbits/uxn 2023-01-02 09:50:57 -08:00
Devine Lu Linvega 491e4b7435 Returned the k variable in uxn core 2023-01-02 09:50:09 -08:00
Andrew Alderwick 5cacb3f241 Fix macOS build. 2023-01-02 15:23:28 +00:00
Andrew Alderwick 50e08f12cd Disable Windows build until new File device is fixed. 2023-01-02 15:14:19 +00:00
Andrew Alderwick 1cb66df868 (asma) Disable recursion tests that no longer function. 2023-01-02 15:07:34 +00:00
Andrew Alderwick d94a84bc93 Port Audio to new devices scheme. 2023-01-02 15:01:55 +00:00
Andrew Alderwick c2b0667496 Update Copyright years. 2023-01-02 14:40:23 +00:00
Devine Lu Linvega a450959e9f Removed extraneous j variable 2023-01-01 18:26:28 -08:00
Devine Lu Linvega 6d0b51fa7f Added support for CALL 2023-01-01 18:03:36 -08:00
Devine Lu Linvega 22cbd38fab Do not check twice for short mode in LIT opcode 2023-01-01 16:44:18 -08:00
Devine Lu Linvega 48596a6ee7 Removed PEEK16 macro 2023-01-01 16:22:37 -08:00
Devine Lu Linvega 7f275772ef Added HALT macro 2023-01-01 16:21:05 -08:00
Devine Lu Linvega 5ac6ff4313 All devices but audio ported to new devices scheme 2023-01-01 16:13:34 -08:00
Devine Lu Linvega 2fb5f560a7 Use the File device load_rom function 2023-01-01 14:18:27 -08:00
Devine Lu Linvega 794ce1bdfd Housekeeping 2023-01-01 13:40:58 -08:00
Devine Lu Linvega bf4ee03d27 Ported screen to new device 2023-01-01 13:34:20 -08:00
Devine Lu Linvega 7afe1f39c7 Screen device is half ported to new device handlers 2023-01-01 13:19:40 -08:00
Devine Lu Linvega 679aec047a Device memory is not a member of ram 2023-01-01 12:21:30 -08:00
Devine Lu Linvega 68d706be25 Will connect devices to devold while I migrate to new router 2023-01-01 12:12:59 -08:00
Devine Lu Linvega 0fd68e96f0 Connecting new device ports to uxn core 2023-01-01 12:04:54 -08:00
Devine Lu Linvega d1ca328b98 Removed devmouse and devctrl globals 2023-01-01 11:47:52 -08:00
Devine Lu Linvega 9aefeebf25 Removed Device struct from controller device 2023-01-01 11:37:34 -08:00
Devine Lu Linvega 062bbac37d Removed Device struct from mouse device 2023-01-01 11:31:14 -08:00
Sigrid Solveig Haflínudóttir 6317b5cf18 fix uxnasm: missing semicolon 2022-12-11 04:54:58 +01:00
neauoire c97aa87faf (uxnasm)Allow more space for symbols filename, and check for length 2022-12-10 11:07:45 -08:00
neauoire 2f3954d398 Uxnasm should use BE to store addresses 2022-12-09 12:52:34 -08:00
neauoire d4c55e2f48 Uxnasm now outputs a symbols file 2022-12-09 12:30:04 -08:00
Andrew Alderwick 42aab23dc1 Remove many macros. 2022-11-20 22:50:19 +00:00
neauoire 5eadd7695b (metadata.tal) Removed unused routine 2022-11-14 10:44:43 -08:00
neauoire 6224e1eb2f (metadata.tal) Slightly larger window 2022-11-14 10:25:15 -08:00
neauoire cfe3fdda2b (metadata.tal) Catch no metadata case 2022-11-14 10:17:56 -08:00
neauoire 94043c4ff9 (metadata.tal) Added metadata viewer rom 2022-11-14 10:04:56 -08:00
neauoire b11217449a (clock.tal) Thiner frame 2022-11-12 10:14:13 -08:00
Andrew Alderwick d48407f9c3 Reduce timeouts for checking build computers. 2022-11-12 11:03:56 +00:00
Andrew Alderwick 4cb893232e Don't fail build if 9front VM is unavailable. 2022-11-12 10:53:20 +00:00
neauoire c8fc397054 Relaunch boot rom if launcher is not found 2022-11-11 21:12:30 -08:00
Andrew Alderwick 3a834fdfc1 Optimise “#xy STH” to “LITr xy”. 2022-11-11 08:56:28 +00:00
Andrew Alderwick fd55e929e1 (asma) Add support for _ rune. 2022-11-11 08:55:44 +00:00
neauoire f59b214ac1 Added _rune 2022-11-10 20:54:53 -08:00
Andrew Alderwick 02ecc2ee7d (asma) Rebalance the rune tree. 2022-11-10 23:47:14 +00:00
Andrew Alderwick 4abb47e6e1 Remove all symbol macros from projects. 2022-11-10 22:49:53 +00:00
Andrew Alderwick cd01d69b8a (asma) Add fail tests to test suite. 2022-11-10 22:03:36 +00:00
Andrew Alderwick f6b0f0052f (asma) Add support for - rune. 2022-11-10 21:59:14 +00:00
Andrew Alderwick 59ca47d42c (asma) Add support for = rune. 2022-11-10 21:55:28 +00:00
Andrew Alderwick fc3232a8e8 Replace now-invalid macros in projects. 2022-11-10 21:54:32 +00:00
neauoire adae0a0348 (screen.tal) Optimizations 2022-11-10 09:21:02 -08:00
neauoire 4270d48422 (exercises) Housekeeping 2022-11-10 09:08:21 -08:00
neauoire da5e581442 (uxnasm) Fixed issue with = rune 2022-11-09 16:40:07 -08:00
neauoire 261b574671 (uxnasm) Added support for = and - runes 2022-11-09 16:21:07 -08:00
neauoire 1b2049e238 (cream.uf2) Fixed glyphs 2022-10-22 14:52:17 -07:00
neauoire 742081a40d (st72.uf2) Added new font 2022-10-21 19:58:14 -07:00
Andrew Alderwick 1064d88b33 (asma) Remove LIT merging optimisation. 2022-10-19 12:29:20 +01:00
Andrew Alderwick ca6d755bd6 (asma) Remove tail call optimisation. 2022-10-19 12:28:31 +01:00
Andrew Alderwick 55f5f7a800 (asma) Add check that asma itself can be assembled in asma-test.sh. 2022-10-19 12:25:00 +01:00
Andrew Alderwick dd21ae5de8 (asma) Remove deprecated rawchr support. 2022-10-19 12:24:44 +01:00
neauoire 5496712ae1 (controller.tal) Made buttons visible in monochromatic 2022-09-30 10:10:33 -07:00
Andrew Alderwick cbc61578b7 Reuse old artifacts if no solar build computers are reachable.
Non-Linux builds are run on computers powered by solar panels in one
geographical location, so they are not available 100% of the time. When
they are not available, the build script will reuse the previous build
artifacts for Windows and macOS, as well as create an empty file at
https://rabbits.srht.site/uxn/needs-solar-build so that this situation
can be detected. When both build computers are available, the
needs-solar-build file will not be present in the Sourcehut upload, so
that URL will return a 404 status.
2022-09-20 13:17:54 +01:00
Devine Lu Linvega 92027cf278 Merge branch 'main' of git.sr.ht:~rabbits/uxn 2022-09-15 11:13:34 -07:00
Devine Lu Linvega 24285d1d5d Fixed issue with monochromatic 2022-09-15 11:12:57 -07:00
Devine Lu Linvega ac6e4fed10 Toggle monochromatic mode 2022-09-15 09:11:20 -07:00
neauoire 36136ccb0e Merge branch 'main' of git.sr.ht:~rabbits/uxn 2022-09-04 13:08:49 -07:00
neauoire ab108643cf (brainfuck.tal) Converted assci runes 2022-09-04 13:08:38 -07:00
Devine Lu Linvega c8707a8cca (logic.tal) Renamed to bitwise.tal 2022-08-17 00:12:39 -07:00
Devine Lu Linvega 85ae1f6ebe Fixed CI 2022-08-15 09:28:02 -07:00
Devine Lu Linvega 79e085088a Optimized a few examples 2022-08-14 12:17:44 -07:00
Devine Lu Linvega f348d24606 Removing rawchr run 2022-08-14 12:06:23 -07:00
Devine Lu Linvega ef30fb8f8e Removed JSR JMP2r tail-call optimisations for now 2022-08-06 11:05:16 -07:00
Devine Lu Linvega 4d7f35df6f Housekeeping in pictures 2022-08-02 02:20:05 -07:00
Devine Lu Linvega 806b8c0fa9 (hexdump.tal)Removed trailing short 2022-07-31 11:35:45 -07:00
Devine Lu Linvega c6ed7170e7 (thue.tal) Added a Thue esolang interpreter 2022-07-23 12:59:47 -07:00
Devine Lu Linvega b94d0204c2 Housekeeping on some of the example files 2022-07-22 11:57:45 -07:00
Devine Lu Linvega 861c8494a8 (mouse.tal) Something fun! 2022-07-16 11:54:16 -07:00
Devine Lu Linvega 982f0180e4 Housekeeping on a few examples 2022-07-14 14:57:56 -07:00
Devine Lu Linvega c148f4da81 (ergo.bit)Fixed wrong size 2022-07-09 10:31:57 -07:00
Devine Lu Linvega e5639f6378 Renamed a few pictures 2022-07-09 10:24:17 -07:00
Devine Lu Linvega 5a3ca07439 (pc98.chr)Added size to graphic 2022-07-09 09:51:13 -07:00
Dave VanEe a0f5231adc Add tests for most k (keep) variations of UXN instructions, based on the
existing instruction tests.
2022-07-09 11:36:37 +01:00
Devine Lu Linvega abd0be0fba A bit of housekeeping on the example files 2022-07-06 19:25:54 -07:00
Devine Lu Linvega a2053d9654 (tests.tal) Put into projects/ 2022-07-06 14:04:52 -07:00
Devine Lu Linvega aee9411d0b (tests.tal) Added tests 2022-07-06 14:03:14 -07:00
Devine Lu Linvega bba64f4da7 (label.tal) Housekeeping 2022-07-05 11:05:00 -07:00
Devine Lu Linvega 0c908a9379 (calc.tal) Fixes issue with pushing any value comprised of two bytes which add to zero 2022-06-16 15:17:14 -07:00
Andrew Alderwick fb030288f9 Disable execution timeouts for now.
This is a quick hack to disable the execution timeout, while still
making the application able to exit if the window is requested to close.
Execution limits may be reintroduced with more debugging features, but
not enabled by default.
2022-06-13 09:15:20 +01:00
Andrew Alderwick dc65cc0f1d (bunnymark) Conserve bun energy on y-bounce. 2022-06-12 14:02:11 +01:00
Devine Lu Linvega 55d9ba4d71 Added test rom 2022-06-11 11:53:28 -07:00
Andrew Alderwick 04352a8c89 Switch back to single thread for handling redraws.
This reverts commit a283264df2 while
keeping the enhancements made later on (detection of overlong
execution).

This change fixes compatibility for learn-uxn and current npe.
2022-06-10 07:58:29 +01:00
Andrew Alderwick cabccd61fc (asma) only ignore [ or ] if it is a whole token 2022-06-09 21:42:30 +01:00
Devine Lu Linvega f7498cff5c (tables.c) Improved sin table generator 2022-06-09 09:19:15 -07:00
Andrew Alderwick 0b134ff6b8 (asma) Minor optimisations 2022-06-08 00:53:14 +01:00
Andrew Alderwick 02696fa437 (asma) Optimise advancing asma/addr 2022-06-08 00:38:55 +01:00
Andrew Alderwick 9ae2c0b788 (asma) Add tail call optimisation, bringing it up-to-date with uxnasm 2022-06-08 00:10:24 +01:00
Andrew Alderwick 9f97976ac8 Update README 2022-06-07 20:14:27 +01:00
Andrew Alderwick 978713474a (uxnasm) Prevent tail call optimisation when required, fixes asma
Literals do not get squashed across absolute or relative pads and
labels, now the tail call optimisations do not occur under the same
conditions. etc/asma-test.tal was identifying serious errors with
asma.rom, which uses "JSR2 &skip JMP2r" in @asma-macro-body.
2022-06-07 20:03:12 +01:00
Andrew Alderwick 0ff2a3586d Deal with compiler warnings. 2022-06-07 19:39:43 +01:00
Devine Lu Linvega 0fafd652f1 (uxnasm) Better parent label reference counting 2022-06-06 09:42:26 -07:00
Devine Lu Linvega bf81d07113 (uxnasm)Quiet label warnings with sublabels 2022-06-06 07:57:29 -07:00
phoebos a014cd8da9 (uxnasm) only ignore [ or ] if it is a whole token
Currently, tokens beginning with a [ or ] character are completely
ignored, which forbids a macro from beginning with these characters.
Specifically, a macro can be declared eg. as `%[x { ... }` but cannot be
dereferenced as `[x`.
This patch only ignores these tokens if they have a length of 1;
otherwise the switch falls through to the default case.
2022-06-05 16:29:06 -07:00
phoebos 1ac7c45d10 tal.sublime-syntax: comments must be opened by a single ( token
surrounding whitespace isn't optional
2022-06-03 14:48:41 -07:00
Andrew Alderwick eb8c496feb Revert "Fix for hanging on quit", replacing it with improved code 2022-06-03 22:42:54 +01:00
Devine Lu Linvega 17fd40af43 (uxnasm) Minor cleanup 2022-05-31 14:04:54 -07:00
Devine Lu Linvega 18b73f4861 (uxnasm)Optimize tail-call for subroutines too 2022-05-31 13:55:00 -07:00
Devine Lu Linvega 3c06af41c3 Tiny change to uxnasm 2022-05-31 13:38:21 -07:00
Devine Lu Linvega 852e33e6f3 General improvements to example files 2022-05-31 13:25:41 -07:00
Devine Lu Linvega 8176ab93c8 Extended timeout to 20 frames to give RPIs a chance 2022-05-31 12:29:55 -07:00
Devine Lu Linvega 56d08285b7 Fix for hanging on quit 2022-05-31 12:25:25 -07:00
Devine Lu Linvega 79262774fe But we also made sure it appeared in lots of other, less conspicuous places. 2022-05-31 08:44:18 -07:00
Devine Lu Linvega f9b158e2c2 (wireworld.tal) Updated 2022-05-28 10:00:31 -07:00
Devine Lu Linvega 755efc4fbd Minor changes to a few example projects 2022-05-27 20:12:59 -07:00
Devine Lu Linvega 41f7eaed6c (calc.tal)Fixed warnings from the linter 2022-05-27 20:01:32 -07:00
Devine Lu Linvega 5a0e0c56aa Added tail-call optimization 2022-05-26 20:26:21 -07:00
Andrew Alderwick e00e74b9d0 (uxnasm) Raise an error if the output rom would be empty. 2022-05-09 21:13:28 +01:00
neauoire fec233db2a Use helpers for LIT 2022-04-18 12:33:30 -07:00
Andrew Alderwick d5253086b5 Move stack opcodes. 2022-04-18 09:45:33 +01:00
Andrew Alderwick c2ffe63cc3 (uxnasm) Fix valid macro names being rejected.
Macro names that begin with the name of an opcode were being rejected
incorrectly. “STA” would not be a valid macro name since it is an
opcode, but “STACK” should be fine.
2022-04-14 18:24:48 +01:00
neauoire d49981c4ce Removed runes 2022-04-11 17:27:33 -07:00
neauoire a3c42c23b9 Fixed issue with oprunes 2022-04-11 17:16:05 -07:00
neauoire dcc37fd0d5 Added logic/arithmetic symbols to uxnasm 2022-04-11 16:07:15 -07:00
neauoire 60315ff3dc Raised label limit in uxnasm 2022-04-11 15:34:53 -07:00
Andrew Alderwick 4c59498f14 (Windows) Fix uxnemu freezing on exit. 2022-04-09 12:22:24 +01:00
Andrew Alderwick 219cfee472 (Windows) Fix output not flushing automatically. 2022-04-09 12:21:39 +01:00
Andrew Alderwick 72c7296a47 Revert "Switch to SDL Timer for redraw handler." 2022-04-09 12:19:27 +01:00
Andrew Alderwick 96f4510a03 Switch to SDL Timer for redraw handler. 2022-04-09 11:37:51 +01:00
Andrew Alderwick a35ef6b242 Fix build warning on Windows. 2022-04-09 11:37:06 +01:00
neauoire 1e0edd7461 Improved label.tal 2022-04-08 11:41:07 -07:00
neauoire 9ade9bd524 (pig.tal) Added pig game in exercises 2022-04-06 11:24:43 -07:00
neauoire dd0ba4f191 Minor change to bresenham helpers 2022-04-05 16:41:49 -07:00
neauoire d64600e711 (amiga.tal) Bounce on walls 2022-03-29 10:30:54 -07:00
Sigrid Solveig Haflínudóttir 2a892a23b1 uxnemu: fix a memory leak (ram) in start() and reduce types clutter 2022-03-29 19:24:15 +02:00
neauoire 708148bb1d (amiga.tal) Added bounce 2022-03-29 09:49:30 -07:00
neauoire 3cdabb9d80 (amiga.tal) Started a boing ball demo 2022-03-28 21:30:26 -07:00
Andrew Alderwick 47f65c7b82 (uxncli) Load ROM using the File device functions. 2022-03-28 18:51:29 +01:00
Andrew Alderwick 42dea5b914 Replace file_i_deo and file_i_dei. 2022-03-28 18:16:44 +01:00
Sigrid Solveig Haflínudóttir 0b75afc415 uxnemu: use read() in stdin thread and close(0) at shutdown for the thread to exit 2022-03-28 17:49:54 +02:00
Sigrid Solveig Haflínudóttir f06494477a uxnemu: fix the stuck threads on quit, SOMEWHAT
Create threads in detached mode and check if events failed to be
pushed. Stdin thread is still blocking on fread hence the "SOMEWHAT".
2022-03-28 17:24:35 +02:00
neauoire a325798cb3 (file.tal) Changed poem in file device 2022-03-27 13:42:14 -07:00
neauoire f683e49ad5 (file.tal) Flush file pointer 2022-03-27 13:22:19 -07:00
neauoire 45c31327ec (examples/devices) Revamped a lot of the device examples 2022-03-27 11:53:24 -07:00
neauoire 0c587b9e0e (mouse.tal) Optimized 2022-03-27 09:43:24 -07:00
neauoire c4f7483027 Arranged include order 2022-03-27 09:18:02 -07:00
Andrew Alderwick 2de41fd4c3 Move life-infinite-loop.tal to examples/exercises/. 2022-03-27 14:07:59 +01:00
Andrew Alderwick 91125f33a2 Add a version of life.tal with an infinite loop. 2022-03-27 13:57:52 +01:00
Andrew Alderwick 0e7ebb69e6 (uxnemu) Interrupt infinite loops with an error. 2022-03-27 13:53:25 +01:00
Andrew Alderwick b9ff19d857 (uxnemu) Update indentation with clang-format.
The main loop now uses SDL_WaitEvent instead of SDL_PollEvent, and the
indentation level needs to change. For clarity, the previous commit
contains the code changes, while this one updates the indentation.
2022-03-27 13:18:37 +01:00
Andrew Alderwick a283264df2 (uxnemu) Use a separate thread for triggering redraws.
The main loop now uses SDL_WaitEvent instead of SDL_PollEvent, and the
indentation level needs to change. For clarity, this commit contains the
code changes, while the next one updates the indentation.
2022-03-27 13:16:40 +01:00
neauoire 1f7a15d05b (screen.tal) Improved layout 2022-03-26 18:29:38 -07:00
Andrew Alderwick f2c644f680 Move DateTime to 0xc0, add second File to 0xb0. 2022-03-26 17:54:29 +00:00
neauoire bb2aabee54 (life.tal) General optimizations 2022-03-25 21:36:33 -07:00
neauoire 0b3ac97752 (examples/) Improved a few demos 2022-03-25 12:05:11 -07:00
neauoire 9a59e9d1d9 (exercises/) Cleanup 2022-03-25 10:29:45 -07:00
neauoire 19172bf049 (dvd.tal) Optimized 2022-03-25 09:49:51 -07:00
neauoire 05d8b4479c (clock.tal) Optimizations 2022-03-24 13:15:50 -07:00
neauoire f6e23cddb0 Use new paths for essentials 2022-03-22 14:45:25 -07:00
neauoire b2891da133 Merge branch 'main' of git.sr.ht:~rabbits/uxn 2022-03-18 11:03:07 -07:00
neauoire 25fc9ca5fd (label.tal) Rewrote with the screen/auto support 2022-03-18 11:02:27 -07:00
Andrew Alderwick 7ce8cc1d24 Add file reading with .File/read DEI(2). 2022-03-17 19:09:34 +00:00
Andrew Alderwick 205cc89bcb Keep a local copy of File/name; don't try to read it beyond end of RAM. 2022-03-17 18:41:55 +00:00
Andrew Alderwick 27089a77e4 Prepare for more than one File device. 2022-03-17 18:35:49 +00:00
Andrew Alderwick bca73244f0 Minor fix to audio.c. 2022-03-17 18:29:44 +00:00
Andrew Alderwick a3b87e021f Rename file_deo variables. 2022-03-17 17:08:03 +00:00
Andrew Alderwick 5dcf0a2b35 Make the UxnAudio struct private to audio.c. 2022-03-17 16:59:36 +00:00
neauoire 084a0f5ab4 (hexdump.tal) Rewrote 2022-03-15 11:42:17 -07:00
neauoire 24474b6b32 (calc.tal) Merged a few unnecessary SFT 2022-03-15 11:13:35 -07:00
neauoire a63322e207 (calc.tal) Optimized to use screen/auto 2022-03-15 11:03:09 -07:00
neauoire 5057dd160a (screen.tal) Centered 2022-03-15 09:57:33 -07:00
neauoire 8ec8c7c1f4 (screen.tal) Optimized to fit GBA screen 2022-03-14 14:02:43 -07:00
neauoire 3293a1b639 (piano.tal) Implemented new auto byte 2022-03-14 11:04:49 -07:00
neauoire 21f3a2d870 Moved some demos to /old 2022-03-14 10:21:36 -07:00
neauoire 4019add040 Cleaned up a few demos 2022-03-14 09:55:31 -07:00
neauoire 6ffedca0b4 (polycat.tal) Cleanup 2022-03-13 20:39:03 -07:00
neauoire 9e9313d064 (move.tal)Cleaned up demo 2022-03-13 20:32:32 -07:00
neauoire 162400cb54 (fizzbuzz.tal) Removed macros from fizzbuzz 2022-03-10 10:05:00 -08:00
neauoire cfedb19dca (primes.tal) Removed macros 2022-03-10 09:37:11 -08:00
Andrew Alderwick 1ecbd571e0 Add asma.rom to uploads. 2022-03-08 19:04:33 +00:00
neauoire bdb451cd28 (picture.tal) Added fast drawing routine 2022-03-06 15:04:03 -08:00
Andrew Alderwick 1d694c43ea Fix sprite address check. 2022-03-06 20:39:27 +00:00
neauoire 3b3386b544 (screen.tal) Optimizations 2022-03-06 11:00:02 -08:00
neauoire 708d418833 (screen.tal) Ported to the new auto-byte 2022-03-06 10:25:27 -08:00
Andrew Alderwick fef8806493 Fix comment at end of uxn.h. 2022-03-06 18:02:34 +00:00
Andrew Alderwick 314dd5a431 screen/auto: Replace draft looping with block width control. 2022-03-06 18:02:34 +00:00
neauoire 941ac55f1f (screen.tal) Starting new auto-byte high nibble implementation 2022-03-06 09:56:50 -08:00
Andrew Alderwick 1b04e0814b (draft) Add looping functionality to Screen/auto. 2022-03-06 13:42:59 +00:00
Bad Diode 11c9ec8b49 Add header guard to uxn.h 2022-03-05 13:58:03 -08:00
neauoire b482b5f93e Added missing image size to pictures/bit 2022-03-04 12:06:47 -08:00
neauoire 56432c1fcd (fib.tal) Little optimization 2022-02-23 15:37:29 -08:00
neauoire 1993eb9b5f (fib.tal) Added fib example 2022-02-23 15:23:38 -08:00
neauoire f87c15c8b5 Optimized line-rect routine 2022-02-21 10:30:55 -08:00
Andrew Alderwick 0c819b9f59 clang-format 2022-02-19 01:02:47 +00:00
Andrew Alderwick 550aceee23 (uxnasm) Allow writing the 0xffff byte of RAM. 2022-02-19 00:29:40 +00:00
Andrew Alderwick 8b84813c6e (uxnasm) Raise error when memory is overwritten. 2022-02-19 00:27:28 +00:00
Andrew Alderwick da4f0e70a5 (uxnasm) Allow returning errors from writebyte(). 2022-02-19 00:26:55 +00:00
Andrew Alderwick 0ae6992089 (uxnasm) Fix calculation of usage. 2022-02-18 23:02:42 +00:00
neauoire b2d6aa5fce (calc.tal) Better ampersand glyph 2022-02-18 13:48:03 -08:00
neauoire 99f9fc85a0 (calc.tal)Improved glyphs 2022-02-18 13:30:01 -08:00
Andrew Alderwick b1bbfb3976 (asma) Fix sublabel references when no labels are defined.
An example of code that failed with asma is in brainfuck.tal.
2022-02-18 09:27:58 +00:00
Andrew Alderwick f06498f6a6 Remove unused constants. 2022-02-17 18:17:17 +00:00
neauoire 85a6d348ba (brainfuck.tal) Optimized 2022-02-15 10:24:11 -08:00
neauoire c982eb988b (controller.tal) Print debugger on start button 2022-02-10 19:29:50 -08:00
sroccaserra ed22793a69 (monospace.tal) Remove values left on the stack
Functions draw-uf1 and draw-uf1-linebreaks are leaving two 8 bit values
on the stack, this commit removes them.
2022-02-10 08:10:20 -08:00
neauoire 5abb885eb5 (life.tal) Minor cleanup 2022-02-08 20:04:18 -08:00
neauoire db431f75fe (piano.tal) Optimized octave drawing routine 2022-02-08 19:45:29 -08:00
neauoire 51c422c9cb (math32.tal) Removed globals 2022-02-07 19:35:07 -08:00
Andrew Alderwick b5669a52be Saturate multiplication in mandelbrot. 2022-02-08 01:34:24 +00:00
neauoire 20d6ab3cb4 (mandelbrot.tal) Added fractal 2022-02-07 16:59:34 -08:00
neauoire 1a34fcefa9 Added libraries for math32 2022-02-07 15:52:22 -08:00
neauoire 3496a38606 Added a few extra fonts 2022-02-06 20:03:45 -08:00
neauoire a3dfbe19a0 (launcher.tal) Resizes on launch 2022-02-06 11:56:42 -08:00
neauoire 272b1ed162 (cube3d.tal) Added new demo 2022-02-05 15:37:04 -08:00
Liam Cooke 33940d3b5b Fix blurry pixels on high-DPI displays
Creates the uxnemu window in high-DPI mode when supported. Now it looks
pixel perfect on a display with 2:1 pixel density.

Should have no effect on a 1:1 display, but I don't have access to one
to test this.
2022-02-04 08:52:31 -08:00
neauoire 7511f4c2ac Added --install flag to build script 2022-02-03 19:52:12 -08:00
neauoire 7c46d9ce8e Ported fonts to AUTO-Y 2022-02-01 09:46:49 -08:00
neauoire 3f94152050 (calc.tal) Optimizations 2022-01-26 10:14:18 -08:00
Andrew Alderwick 055fa9bcd0 Close some security holes. 2022-01-23 23:17:54 +00:00
Andrew Alderwick 3ee8a2394b Update README with new build URLs. 2022-01-23 23:17:54 +00:00
neauoire 61be564f09 Merge branch 'main' of git.sr.ht:~rabbits/uxn 2022-01-23 14:19:19 -08:00
neauoire 94882720be (dos.tal) Improved error reporting 2022-01-23 14:19:10 -08:00
Andrew Alderwick 178b63b951 Rename build outputs. 2022-01-23 21:39:43 +00:00
Andrew Alderwick a960133b06 Fix inclusion of rompack files. 2022-01-23 21:19:00 +00:00
Andrew Alderwick b45745b25a Fix names of outputs. 2022-01-23 21:09:27 +00:00
Andrew Alderwick 251d7cae71 Build combined archives with starter packs. 2022-01-23 21:01:41 +00:00
Andrew Alderwick deace3b79a Remove old debugging support. 2022-01-23 19:35:18 +00:00
neauoire b486d9585b (dos.tal) When in doubt, add flowers 2022-01-23 11:18:55 -08:00
neauoire dacd2ff26c (dos.tal) Improved hx view 2022-01-23 10:48:26 -08:00
neauoire 44789e4c00 (dos.tal) Impemented time[tm] command 2022-01-23 10:31:32 -08:00
neauoire 97003d1ae2 (dos.tal) Added command documentation in ls cmd 2022-01-23 10:03:15 -08:00
Andrew Alderwick edd05ed1d1 Fix compiler warning. 2022-01-23 11:23:52 +00:00
Andrew Alderwick 6577d3c8a0 Remove jump-based infinite loop detection. 2022-01-23 11:17:07 +00:00
neauoire ebf5b633a5 (dos.tal) Started a mini DOS 2022-01-22 20:47:01 -08:00
neauoire 56528dbcd7 (wireworld.tal) Minor cleanup 2022-01-22 16:32:46 -08:00
DeltaF1 774dd27a53 Remove memory copying from wireworld
- Store two world buffers and swap between them each update
2022-01-22 16:29:08 -08:00
neauoire 0932e4165b (wireworld.tal) Clear on select+start 2022-01-22 14:54:02 -08:00
neauoire 4ad5c8f9fa (wireworld.tal) Optimized morph 2022-01-22 14:48:07 -08:00
neauoire a17b442fe2 (launcher.tal) Release inputs on load-rom 2022-01-21 20:44:29 -08:00
neauoire 42a804ddc0 (wireworld.tal) Erase with mouse2 2022-01-21 15:23:02 -08:00
neauoire a0f2fa4462 (wireworld.tal) Cleanup 2022-01-21 15:14:36 -08:00
neauoire 30cef63b91 (wireworld.tal) Added wireworld implementation 2022-01-21 15:02:46 -08:00
Andrew Alderwick fbd9c49f84 Fix resize when only width or height are set. 2022-01-20 01:34:44 +00:00
Andrew Alderwick d186b7a038 Perform resizing of SDL screen during redraw. 2022-01-20 01:24:22 +00:00
Andrew Alderwick cd0ca2eb17 Move clamp() to screen.c. 2022-01-20 01:24:20 +00:00
Andrew Alderwick cf84a5d661 Prevent invalid screen sizes. 2022-01-19 18:30:32 +00:00
Andrew Alderwick 37f2ba6a5a Move uploaded binaries inside uxn directory. 2022-01-17 23:29:35 +00:00
Andrew Alderwick 2d42a58136 Remove uploaded binaries in preparation for new URLs. 2022-01-17 23:27:10 +00:00
neauoire f9e8faa8c3 (proquints.tal) Added a proquints encoder 2022-01-17 12:06:50 -08:00
neauoire c1d42a97ce (binstr.tal) Added a binary to string file converter in utils 2022-01-16 14:30:46 -08:00
neauoire 35953312ea (calc.tal) Removed leading zeros 2022-01-16 10:44:32 -08:00
neauoire acbd654165 (launcher.tal) Fixed scrolling issue after assembly 2022-01-16 09:22:37 -08:00
neauoire 4d9ba05045 (calc.tal) Modified the multiply symbol 2022-01-15 19:41:22 -08:00
Andrew Alderwick 76be4519b7 Include rompacks in published site. 2022-01-16 02:36:39 +00:00
Andrew Alderwick ea3b6416f8 Add rompack to automated builds. 2022-01-16 02:30:06 +00:00
Andrew Alderwick 7ffaa25475 Renamed devices/datetime.tal to demos/clock.tal. 2022-01-16 01:50:06 +00:00
neauoire 2ead7840fd Launcher now assembles tal files 2022-01-15 11:15:47 -08:00
neauoire bec7096c0b Implemented proper decimal mode 2022-01-15 10:13:20 -08:00
Andrew Alderwick 2c47425c41 Remove trailing space in stack printing 2022-01-14 07:59:42 +00:00
neauoire 4ea8cc2819 Removed extra specing around bytes in stack printing 2022-01-13 14:52:37 -08:00
neauoire fc659b9094 Removed devsystem 2022-01-13 10:55:02 -08:00
neauoire b48db8278f (monospace.tal) Added a 8x8 label drawing example 2022-01-13 10:25:31 -08:00
neauoire f1cc022e9b Uxncli now uses the system_inspect 2022-01-13 08:34:32 -08:00
neauoire 44a7f5ef0e Removed old debug files 2022-01-13 08:26:35 -08:00
neauoire 031f63a13c Print stack with DEO on 0x0f 2022-01-13 08:25:59 -08:00
neauoire ee4308196a Starting a debugging device 2022-01-12 21:22:33 -08:00
neauoire 6a6a2ec383 Removed external memory bank 2022-01-12 18:56:59 -08:00
neauoire 459855d825 Removed supervisor 2022-01-12 18:40:51 -08:00
neauoire 0518385a6d Added uxn32 and uxn16 chr pictures 2022-01-12 11:54:19 -08:00
Andrew Alderwick 696ef03f12 Remove goto/label for jumps. 2022-01-12 13:09:45 +00:00
Andrew Alderwick 41de322a75 Add support for interrupting Uxn during execution. 2022-01-12 11:33:49 +00:00
Andrew Alderwick b1ba95336c Remove unistd.h from uxnemu.c. 2022-01-11 23:50:41 +00:00
neauoire 5e2bb92e4c Removed unistd from uxncli 2022-01-11 15:13:12 -08:00
neauoire 06b694d406 Removed ram helper in uxn 2022-01-11 14:51:25 -08:00
neauoire 61c7f9f0c1 Removed device globals 2022-01-11 14:38:55 -08:00
neauoire cd30b48665 Rename memory banks 2022-01-11 14:16:27 -08:00
neauoire ede186b226 Minor cleanup 2022-01-11 11:07:25 -08:00
neauoire 38d2c7cbd7 (boot.rom) Renamed to launcher.rom 2022-01-10 20:35:34 -08:00
Vlad-Stefan Harbuz bdef6c3dbd add uxn resources to README.md
Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
2022-01-10 19:10:44 -08:00
Andrew Alderwick 4134cef4b8 Add 9front automated build. 2022-01-10 16:53:54 +00:00
Andrew Alderwick 9fcb0c335b Remove use of snprintf. 2022-01-10 11:35:45 +00:00
Andrew Alderwick 0d242d704e Correct cast for snprintf 2022-01-10 09:59:00 +00:00
neauoire 91560c6d24 (picture.tal) Added example of drawing a picture 2022-01-09 18:13:18 -08:00
neauoire 4657fe2490 (gui/label.tal) Use UF2 properly 2022-01-09 17:04:54 -08:00
neauoire a8c384daec (animation.tal) Minor optimizations 2022-01-09 13:07:48 -08:00
neauoire 37497060dc Removed stdlib from screen header 2022-01-08 19:38:53 -08:00
neauoire 3ed8a61625 (boot.tal) Fixed issue with empty folders 2022-01-08 17:42:38 -08:00
neauoire e89ad768aa (boot.tal) Added little folder icons 2022-01-08 17:22:04 -08:00
neauoire 715205f2dd (boot.tal) Fixed issue with scroll 2022-01-08 14:13:36 -08:00
neauoire e6ac67d01b (bool.tal) Added mouse scroll 2022-01-08 14:00:33 -08:00
neauoire 35b0d84ceb (boot.tal) Optimizaitons 2022-01-08 13:34:26 -08:00
neauoire 5004ee1339 The file device cannot write on the supervisor 2022-01-08 10:03:21 -08:00
neauoire 78f38e80e5 Added TODOs 2022-01-08 09:07:32 -08:00
neauoire c866b0938a Use proper memory size 2022-01-07 16:51:43 -08:00
neauoire 8fdb039926 Merge branch 'main' of git.sr.ht:~rabbits/uxn 2022-01-07 16:47:01 -08:00
neauoire f5278f3a13 Removed device vector variable 2022-01-07 16:46:50 -08:00
Sigrid Solveig Haflínudóttir db4f5a931a fix Plan 9 build (again) 2022-01-07 23:58:48 +01:00
Sigrid Solveig Haflínudóttir eeb0dc9e45 put back newlines to avoid compilation warnings 2022-01-07 23:46:39 +01:00
Sigrid Solveig Haflínudóttir f0bde9ab98 git ignore plan 9 built files 2022-01-07 23:30:49 +01:00
neauoire 180984f8fb Removed device port masks 2022-01-07 11:48:09 -08:00
neauoire b328a4e87d Commented the fkey controls temporarily 2022-01-07 11:36:04 -08:00
neauoire 38334a633b Pass fn keys directly to the supervisor 2022-01-07 10:55:09 -08:00
neauoire 19a8e56cd6 Started device port masking 2022-01-07 10:02:28 -08:00
Sigrid Solveig Haflínudóttir bb05c7808c mkfile: get rid of trailing whitespace 2022-01-07 17:19:50 +01:00
Sigrid Solveig Haflínudóttir 3d9aa3b7e5 fix Plan 9 build (npe update required as well) 2022-01-07 17:19:01 +01:00
neauoire 41d0911d13 The supervisor program now uses its own vectors 2022-01-06 19:51:34 -08:00
neauoire 1a7af4d8d0 Supervisor is now watching the device page 2022-01-06 19:20:50 -08:00
neauoire 28b9265042 Let us make a device page in shadow memory 2022-01-06 18:49:54 -08:00
neauoire a82f7d79f8 Defined the location of stacks in shadow memory 2022-01-06 17:29:34 -08:00
neauoire 4c6821189e Merge branch 'main' of git.sr.ht:~rabbits/uxn 2022-01-06 14:32:35 -08:00
neauoire ed1f6e6263 Connected error reporting and the hypervisor 2022-01-06 14:32:28 -08:00
Sigrid Solveig Haflínudóttir d21bfb20e0 SDL_PIXELFORMAT_XRGB8888 → SDL_PIXELFORMAT_RGB888 (for older SDL2 versions) 2022-01-06 18:24:35 +01:00
Vlad-Stefan Harbuz b94c52cbbf correctly parse arguments in build.sh
Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
2022-01-06 08:33:28 -08:00
neauoire adc4780630 (hypervisor)Added visual guides 2022-01-05 21:18:46 -08:00
neauoire 3cc2ba98f0 First hypervisor 2022-01-05 20:44:33 -08:00
neauoire b9a37077c3 Started work on the hypervisor 2022-01-05 19:48:51 -08:00
Sigrid Solveig Haflínudóttir 4cd52209ac make the SDL texture XRGB8888 (no alpha) and remove padding pixels from it 2022-01-05 22:45:49 +01:00
Andrew Alderwick f48a09c482 Stop LeakSanitizer complaining about Uxn's RAM. 2022-01-05 18:18:13 +00:00
Andrew Alderwick 9024963de1 Add basic in-Uxn debugger and usage example. 2022-01-05 17:27:50 +00:00
Andrew Alderwick 4cbb661f48 Implement System/vector for debugging. 2022-01-05 17:27:24 +00:00
Andrew Alderwick 0fd288de79 Fix compiler suggestion. 2022-01-05 14:37:37 +00:00
Andrew Alderwick 291cb3d1a2 Simplify stack determination logic. 2022-01-05 14:02:06 +00:00
Andrew Alderwick 646d79fff5 Factor out common parts of system_dei/deo. 2022-01-05 13:29:18 +00:00
Andrew Alderwick c77799dac2 Just pass an error code to uxn_halt. 2022-01-05 13:07:04 +00:00
Andrew Alderwick c37831749f Split uxn_halt into beginnings of System device file. 2022-01-05 13:03:17 +00:00
Andrew Alderwick c827fdc960 Move errored stack identification to after error handling label.
Partial revert of commits 1ce8b9bc27 (and
c296187ea9).
2022-01-05 01:27:27 +00:00
Andrew Alderwick c296187ea9 Rename ERROR/err to FAULT/fault 2022-01-04 02:15:38 +00:00
Andrew Alderwick 2a825de2fd Switch void context increments from pre to post 2022-01-04 02:05:32 +00:00
Andrew Alderwick 1ce8b9bc27 Bring back working/return stack identification on errors 2022-01-04 02:05:32 +00:00
Andrew Alderwick 7e3353ea72 Rename u->ram.dat to u->ram, u->ram.ptr to pc. 2022-01-04 01:40:48 +00:00
Andrew Alderwick 205f63cc43 Clear up SDL_KEYDOWN/SDL_TEXTINPUT logic 2022-01-04 01:12:17 +00:00
neauoire 4789d8ccef Removed peek16 2022-01-03 13:29:47 -08:00
neauoire 0ee477615b Removed poke16 2022-01-03 13:23:57 -08:00
neauoire c4746c2601 (polycat) Rewrote 2022-01-03 10:19:08 -08:00
cancel 416389bcf4 Improvements to uxn.c 2022-01-03 13:41:20 +00:00
cancel 1cab0dffeb Removed unused fields in uxn.h 2022-01-02 23:26:13 +00:00
Andrew Alderwick 52598bdad7 Remove uxn-fast.c since new reference core is almost as fast. 2022-01-02 23:05:28 +00:00
cancel 6980abacfc Refactor uxn.c. 2022-01-02 23:03:06 +00:00
neauoire ecc2654165 Prefixed helpers in uxn.c 2022-01-02 11:04:13 -08:00
neauoire 4ac632f227 Remove debugger from console.tal 2022-01-01 15:24:18 -08:00
neauoire cca1253376 Use calloc for memory array 2022-01-01 15:20:48 -08:00
Sigrid Solveig Haflínudóttir 22c6e07fca emu: make sure to handle key down event if the same key is up at the same frame 2021-12-29 23:32:18 +01:00
148 changed files with 10324 additions and 14220 deletions

View File

@ -4,45 +4,85 @@ packages:
- build-essential
- libsdl2-dev
- rsync
- wget
- zip
oauth: pages.sr.ht/PAGES:RW
environment:
SITE: rabbits.srht.site
SITE: rabbits.srht.site/uxn
SSH_HOST_KEYS: |
[w1.uxn-build.ald.nu]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP+IYCB4JrKklFjWSMRkPBTqUjBqUuhlDQy6/X3l8xj5
[m1.uxn-build.ald.nu]:2223 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDvWVqlHh3XQ5ziEbT55K896/mW2BVDdkU6hWgIfU9md
[w1-uxn.build.alderwick.co.uk]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP+IYCB4JrKklFjWSMRkPBTqUjBqUuhlDQy6/X3l8xj5
[m1-uxn.build.alderwick.co.uk]:2223 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDvWVqlHh3XQ5ziEbT55K896/mW2BVDdkU6hWgIfU9md
[p1-uxn.build.alderwick.co.uk]:2224 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAgduGa60Tx3PsnEaJDyUzmPmpzGYmDeLFtLcVoU5tJs
secrets:
- 138ad607-a4ec-4d74-88a1-8f3be2ba2d03
sources:
- https://git.sr.ht/~rabbits/uxn
tasks:
- prepare: |
rm -f out
mkdir -p out
rm -f out build
mkdir -p out build/uxn-lin64 build/uxn-win64 build/uxn-mac64 build/essentials/uxn
umask 077
mkdir -p ~/.ssh
printf '%s\n' "${SSH_HOST_KEYS}" > ~/.ssh/known_hosts
printf 'User build\nStrictHostKeyChecking yes\nCheckHostIP no\nHost win\nHostName w1.uxn-build.ald.nu\nPort 2222\nHost mac\nHostName m1.uxn-build.ald.nu\nPort 2223\n' > ~/.ssh/config
printf 'User build\nStrictHostKeyChecking yes\nCheckHostIP no\nHost win\nHostName w1-uxn.build.alderwick.co.uk\nPort 2222\nHost mac\nHostName m1-uxn.build.alderwick.co.uk\nPort 2223\nHost 9front\nHostName p1-uxn.build.alderwick.co.uk\nPort 2224\n' > ~/.ssh/config
- build-linux: |
cd uxn
./build.sh --no-run
mv bin uxn
tar -czf ../out/uxn-linux-amd64.tar.gz uxn
cd ..
mv bin ../build/uxn-lin64/uxn
- build-essentials: |
for F in uxn/projects/software/calc.tal uxn/projects/software/launcher.tal uxn/projects/examples/demos/piano.tal uxn/projects/examples/software/clock.tal catclock/src/catclock.tal dexe/src/dexe.tal donsol/src/main.tal left/src/left.tal nasu/src/nasu.tal noodle/src/noodle.tal orca-toy/src/orca.tal:orca.rom turye/src/turye.tal; do
PROJECT="${F%%/*}"
if [ "${F}" = "${F%:*}" ]; then
ROMNAME="${F##*/}"
ROMNAME="${ROMNAME%.tal}.rom"
[ "${ROMNAME}" != main.rom ] || ROMNAME="${PROJECT}.rom"
else
ROMNAME="${F##*:}"
F="${F%:*}"
fi
[ -d "${PROJECT}" ] || git clone "https://git.sr.ht/~rabbits/${PROJECT}"
( cd "${PROJECT}" && ../build/uxn-lin64/uxn/uxnasm "${F#*/}" "../build/essentials/uxn/${ROMNAME}" || rm -f "../build/essentials/uxn/${ROMNAME}" )
done
[ -e ~/.ssh/id_rsa ] || complete-build
- build-windows: |
ssh win "rm -f uxn-windows-64bit.zip; export PATH=\"\${PATH}:/mingw64/bin\"; set -ex; cd uxn; git fetch; git checkout .; git clean -xfd; git checkout $(cd uxn && git rev-parse HEAD); MSYSTEM=MSYS ./build.sh --no-run; mv bin uxn; zip -qr ../uxn-windows-64bit.zip uxn"
rsync win:uxn-windows-64bit.zip out/
if ssh -o ConnectTimeout=10 win true; then
ssh win "export PATH=\"\${PATH}:/mingw64/bin\"; set -ex; cd uxn; git fetch; git checkout .; git clean -xfd; git checkout $(cd uxn && git rev-parse HEAD); MSYSTEM=MSYS ./build.sh --no-run"
rsync -rp win:uxn/bin/ build/uxn-win64/uxn/
else
wget -nv -NP out "https://${SITE}/"uxn{,-essentials}-win64.{tar.gz,zip} || true
touch out/needs-solar-build
fi
- build-macos: |
ssh mac "rm -f uxn-macos.tar.gz; export PATH=\"\${PATH}:/usr/local/bin\"; set -ex; cd uxn; git fetch; git checkout .; git clean -xfd; git checkout $(cd uxn && git rev-parse HEAD); ./build.sh --no-run; mv bin uxn; tar -zcf ../uxn-macos.tar.gz uxn"
rsync mac:uxn-macos.tar.gz out/
if ssh -o ConnectTimeout=10 mac true; then
ssh mac "export PATH=\"\${PATH}:/usr/local/bin\"; set -ex; cd uxn; git fetch; git checkout .; git clean -xfd; git checkout $(cd uxn && git rev-parse HEAD); ./build.sh --no-run"
rsync -rp mac:uxn/bin/ build/uxn-mac64/uxn/
else
wget -nv -NP out "https://${SITE}/"uxn{,-essentials}-mac64.{tar.gz,zip} || true
touch out/needs-solar-build
fi
- archive: |
for PROJECT in uxn-lin64 uxn-win64 uxn-mac64 essentials; do
[ -d "build/${PROJECT}/uxn" ] || continue
tar -czf "out/${PROJECT}.tar.gz" -C "build/${PROJECT}" uxn
( cd "build/${PROJECT}" && zip -qr "../../out/${PROJECT}.zip" uxn )
if [ "${PROJECT}" != essentials ]; then
cp build/essentials/uxn/* "build/${PROJECT}/uxn/"
tar -czf "out/uxn-essentials-${PROJECT#uxn-}.tar.gz" -C "build/${PROJECT}" uxn
( cd "build/${PROJECT}" && zip -qr "../../out/uxn-essentials-${PROJECT#uxn-}.zip" uxn )
fi
done
- upload: |
if [ "$(cd uxn && git rev-parse HEAD)" != "$(cd uxn && git rev-parse origin/main)" ]; then exit; fi
ls -l out
tar -czf out.tar.gz -C out uxn-linux-amd64.tar.gz uxn-windows-64bit.zip uxn-macos.tar.gz
if [ "$(cd uxn && git rev-parse HEAD)" != "$(cd uxn && git rev-parse origin/main)" ]; then exit; fi
tar -czf out.tar.gz -C out .
acurl() {
set +x
curl -H "Authorization: Bearer ${OAUTH2_TOKEN}" "${@}"
set -x
}
acurl -f "https://pages.sr.ht/publish/${SITE}" -Fcontent=@out.tar.gz
acurl -f "https://pages.sr.ht/publish/${SITE}" -Fcontent=@out.tar.gz -Fprotocol=GEMINI
acurl -fsS "https://pages.sr.ht/publish/${SITE}" -Fcontent=@out.tar.gz
acurl -fsS "https://pages.sr.ht/publish/${SITE}" -Fcontent=@out.tar.gz -Fprotocol=GEMINI
- build-9front: |
if ssh -o ConnectTimeout=10 9front true; then
ssh 9front "$(cd uxn && git rev-parse HEAD)"
fi

4
.gitignore vendored
View File

@ -12,4 +12,6 @@
*snarf
*theme
*.rom
*.rom.sym
*.[o0125678vqki]

BIN
.wallpaper Normal file

Binary file not shown.

View File

@ -4,7 +4,7 @@ An assembler and emulator for the [Uxn stack-machine](https://wiki.xxiivv.com/si
## Download binaries
Binaries are available for 64-bit x86 computers running [Linux](https://rabbits.srht.site/uxn-linux-amd64.tar.gz), [Windows](https://rabbits.srht.site/uxn-windows-64bit.zip) and [macOS](https://rabbits.srht.site/uxn-macos.tar.gz).
Binaries are available for 64-bit x86 computers running [Linux](https://drive.100r.co/uxn/uxn-essentials-lin64.tar.gz), [Windows](https://drive.100r.co/uxn/uxn-essentials-win64.zip) and [macOS](https://drive.100r.co/uxn/uxn-essentials-mac64.tar.gz).
## Build
@ -25,20 +25,21 @@ Build the assembler and emulator by running the `build.sh` script. The assembler
./build.sh
--debug # Add debug flags to compiler
--format # Format source code
--install # Copy to ~/bin
```
If you wish to build the emulator without graphics mode:
```sh
cc src/devices/file.c src/uxn.c -DNDEBUG -Os -g0 -s src/uxncli.c -o bin/uxncli
cc src/devices/datetime.c src/devices/system.c src/devices/console.c src/devices/file.c src/uxn.c -DNDEBUG -Os -g0 -s src/uxncli.c -o bin/uxncli
```
### Plan 9
To build the Uxn emulator on [9front](http://9front.org/), via [npe](https://git.sr.ht/~ft/npe):
To build and install the Uxn emulator on [9front](http://9front.org/), via [npe](https://git.sr.ht/~ft/npe):
```rc
mk
mk install
```
If the build fails on 9front because of missing headers or functions, try again after `rm -r /sys/include/npe`.
@ -85,18 +86,24 @@ You can send events from Uxn to another application, or another instance of uxn,
uxnemu orca.rom | shim
```
## Emulator Options
## GUI Emulator Options
- `-s 1`, `-s 2` or `-s 3` set zoom (default 1)
- `-2x` Force medium scale
- `-3x` Force large scale
- `-f` Force fullscreen mode
- `--` Force next argument to be read as ROM name. (This is useful if your ROM file is named `-v`, `-2x`, and so forth.)
## Emulator Controls
## GUI Emulator Controls
- `F1` toggle zoom
- `F2` toggle debug
- `F3` capture screen
- `F4` load boot.rom
- `F4` reboot
- `F5` soft reboot
- `F11` toggle fullscreen
- `F12` toggle decorations
### Buttons
### GUI Buttons
- `LCTRL` A
- `LALT` B
@ -105,7 +112,12 @@ uxnemu orca.rom | shim
## Need a hand?
Find us in [`#uxn` on irc.esper.net](ircs://irc.esper.net:6697/#uxn).
The following resources are a good place to start:
* [XXIIVV — uxntal](https://wiki.xxiivv.com/site/uxntal.html)
* [XXIIVV — uxntal reference](https://wiki.xxiivv.com/site/uxntal_reference.html)
* [compudanzas — uxn tutorial](https://compudanzas.net/uxn_tutorial.html)
* [Fediverse — #uxn tag](https://merveilles.town/tags/uxn)
## Contributing

BIN
boot.rom Normal file

Binary file not shown.

103
build.sh
View File

@ -1,32 +1,53 @@
#!/bin/sh -e
echo "Cleaning.."
rm -f ./bin/uxnasm
rm -f ./bin/uxnemu
rm -f ./bin/uxncli
rm -f ./bin/boot.rom
rm -f ./bin/asma.rom
format=0
console=0
install=0
debug=0
norun=0
while [ $# -gt 0 ]; do
case $1 in
--format)
format=1
shift
;;
--console)
console=1
shift
;;
--install)
install=1
shift
;;
--debug)
debug=1
shift
;;
--no-run)
norun=1
shift
;;
*)
shift
esac
done
rm -f bin/*
# When clang-format is present
if [ "${1}" = '--format' ];
if [ $format = 1 ];
then
echo "Formatting.."
clang-format -i src/uxn.h
clang-format -i src/uxn.c
clang-format -i src/devices/screen.h
clang-format -i src/devices/screen.c
clang-format -i src/devices/audio.h
clang-format -i src/devices/audio.c
clang-format -i src/devices/file.h
clang-format -i src/devices/file.c
clang-format -i src/devices/mouse.h
clang-format -i src/devices/mouse.c
clang-format -i src/devices/controller.h
clang-format -i src/devices/controller.c
clang-format -i src/uxnasm.c
clang-format -i src/uxnemu.c
clang-format -i src/uxncli.c
clang-format -i src/uxnemu.c
clang-format -i src/devices/*
fi
mkdir -p bin
@ -34,7 +55,8 @@ CC="${CC:-cc}"
CFLAGS="${CFLAGS:--std=c89 -Wall -Wno-unknown-pragmas}"
case "$(uname -s 2>/dev/null)" in
MSYS_NT*|MINGW*) # MSYS2 on Windows
if [ "${1}" = '--console' ];
FILE_LDFLAGS="-liberty"
if [ $console = 1 ];
then
UXNEMU_LDFLAGS="-static $(sdl2-config --cflags --static-libs | sed -e 's/ -mwindows//g')"
else
@ -42,48 +64,39 @@ MSYS_NT*|MINGW*) # MSYS2 on Windows
fi
;;
Darwin) # macOS
CFLAGS="${CFLAGS} -Wno-typedef-redefinition"
UXNEMU_LDFLAGS="$(brew --prefix)/lib/libSDL2.a $(sdl2-config --cflags --static-libs | sed -e 's/-lSDL2 //')"
CFLAGS="${CFLAGS} -Wno-typedef-redefinition -D_C99_SOURCE"
UXNEMU_LDFLAGS="$(sdl2-config --cflags --static-libs)"
;;
Linux|*)
UXNEMU_LDFLAGS="-L/usr/local/lib $(sdl2-config --cflags --libs)"
;;
esac
if [ "${1}" = '--debug' ];
if [ $debug = 1 ];
then
echo "[debug]"
CFLAGS="${CFLAGS} -DDEBUG -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined"
CORE='src/uxn.c'
else
CFLAGS="${CFLAGS} -DNDEBUG -Os -g0 -s"
CORE='src/uxn-fast.c'
CFLAGS="${CFLAGS} -DNDEBUG -O2 -g0 -s"
fi
echo "Building.."
${CC} ${CFLAGS} src/uxnasm.c -o bin/uxnasm
${CC} ${CFLAGS} ${CORE} src/devices/file.c src/devices/mouse.c src/devices/controller.c src/devices/screen.c src/devices/audio.c src/uxnemu.c ${UXNEMU_LDFLAGS} -o bin/uxnemu
${CC} ${CFLAGS} ${CORE} src/devices/file.c src/uxncli.c -o bin/uxncli
${CC} ${CFLAGS} src/uxn.c src/devices/system.c src/devices/console.c src/devices/file.c src/devices/datetime.c src/devices/mouse.c src/devices/controller.c src/devices/screen.c src/devices/audio.c src/uxnemu.c ${UXNEMU_LDFLAGS} ${FILE_LDFLAGS} -o bin/uxnemu
${CC} ${CFLAGS} src/uxn.c src/devices/system.c src/devices/console.c src/devices/file.c src/devices/datetime.c src/uxncli.c ${FILE_LDFLAGS} -o bin/uxncli
if [ -d "$HOME/bin" ]
if [ $install = 1 ]
then
echo "Installing in $HOME/bin"
cp bin/uxnemu bin/uxnasm bin/uxncli $HOME/bin/
fi
echo "Assembling(boot).."
./bin/uxnasm projects/software/boot.tal bin/boot.rom
echo "Assembling(asma).."
./bin/uxnasm projects/software/asma.tal bin/asma.rom
if [ $norun = 1 ]; then exit; fi
if [ "${1}" = '--no-run' ]; then exit; fi
# Test version
echo "Assembling(piano).."
bin/uxncli bin/asma.rom projects/examples/demos/piano.tal bin/piano.rom 2> bin/piano.log
bin/uxnasm -v
bin/uxncli -v
bin/uxnemu -v
echo "Running.."
cd bin
./uxnemu piano.rom
# Start potato
echo "Done."
cd ..
bin/uxnemu -2x

View File

@ -10,11 +10,16 @@ expect_failure() {
if ! grep -qF "${1}" asma-test/asma.log; then
echo "error: asma didn't report error ${1} in faulty code"
cat asma-test/asma.log
exit 1
fi
}
echo 'Assembling asma with uxnasm'
bin/uxnasm projects/software/asma.tal asma-test/asma.rom > asma-test/uxnasm.log
if ! bin/uxnasm projects/software/asma.tal asma-test/asma.rom > asma-test/uxnasm.log; then
echo 'Failed to assemble asma!'
cat asma-test/uxnasm.log
exit 1
fi
for F in $(find projects -path projects/library -prune -false -or -path projects/assets -prune -false -or -type f -name '*.tal' | sort); do
echo "Comparing assembly of ${F}"
@ -52,21 +57,25 @@ EOD
expect_failure 'Invalid hexadecimal: #000' <<'EOD'
|1000 #000
EOD
expect_failure 'Unrecognised token: 0' <<'EOD'
expect_failure 'Label not found: 0' <<'EOD'
|1000 0
EOD
expect_failure 'Unrecognised token: 000' <<'EOD'
expect_failure 'Label not found: 000' <<'EOD'
|1000 000
EOD
expect_failure 'Address not in zero page: .hello' <<'EOD'
|1000 @hello
.hello
EOD
expect_failure 'Address not in zero page: -hello' <<'EOD'
|1000 @hello
-hello
EOD
expect_failure 'Address outside range: ,hello' <<'EOD'
|1000 @hello
|2000 ,hello
EOD
expect_failure 'Unrecognised token: hello' <<'EOD'
expect_failure 'Label not found: hello' <<'EOD'
hello
EOD
expect_failure 'Macro already exists: %me' <<'EOD'
@ -77,22 +86,34 @@ expect_failure 'Memory overwrite: SUB' <<'EOD'
|2000 ADD
|1000 SUB
EOD
expect_failure 'Recursion level too deep:' <<'EOD'
%me { you }
%you { me }
|1000 me
EOD
expect_failure 'Recursion level too deep: ~asma-test/in.tal' <<'EOD'
~asma-test/in.tal
EOD
# expect_failure 'Recursion level too deep:' <<'EOD'
# %me { you }
# %you { me }
# |1000 me
# EOD
# expect_failure 'Recursion level too deep: ~asma-test/in.tal' <<'EOD'
# ~asma-test/in.tal
# EOD
expect_failure 'Label not found: ;blah' <<'EOD'
|1000 ;blah
EOD
expect_failure 'Label not found: :blah' <<'EOD'
|1000 :blah
EOD
expect_failure 'Label not found: =blah' <<'EOD'
|1000 =blah
EOD
expect_failure 'Label not found: -blah' <<'EOD'
|1000 -blah
EOD
expect_failure 'Label not found: ,blah' <<'EOD'
|1000 ,blah
EOD
expect_failure 'Label not found: .blah' <<'EOD'
|1000 .blah
EOD
expect_failure "Label not found: 'a" <<'EOD'
|1000 'a
EOD
echo 'All OK'

View File

@ -1,196 +1,103 @@
local spairs
spairs = function(t)
local keys
local output = assert(io.open('.asma.tal', 'w'))
local process_subtree
process_subtree = function(items)
local middle = math.floor(#items / 2 + 1.25)
local node = items[middle]
if not node then
return
end
node.left = process_subtree((function()
local _accum_0 = { }
local _len_0 = 1
for i, item in ipairs(items) do
if i < middle then
_accum_0[_len_0] = item
_len_0 = _len_0 + 1
end
end
return _accum_0
end)())
node.right = process_subtree((function()
local _accum_0 = { }
local _len_0 = 1
for i, item in ipairs(items) do
if i > middle then
_accum_0[_len_0] = item
_len_0 = _len_0 + 1
end
end
return _accum_0
end)())
return node
end
local process_tree
process_tree = function(items)
local sorted_items
do
local _accum_0 = { }
local _len_0 = 1
for k in pairs(t) do
_accum_0[_len_0] = k
for _index_0 = 1, #items do
local item = items[_index_0]
_accum_0[_len_0] = item
_len_0 = _len_0 + 1
end
keys = _accum_0
sorted_items = _accum_0
end
table.sort(keys)
local i = 0
return function()
i = i + 1
return keys[i], t[keys[i]]
table.sort(sorted_items, function(a, b)
return a.order < b.order
end);
(process_subtree(sorted_items)).label = '&_entry'
for _index_0 = 1, #items do
local item = items[_index_0]
output:write(('\t%-11s %-10s %-12s %s%s\n'):format(item.label, item.left and item.left.ref or ' $2', (item.right and item.right.ref or ' $2') .. item.extra, item.key, item.rest))
end
end
local trees = {
['asma-opcodes'] = { }
}
local opcodes_in_order = { }
do
local wanted = false
for l in assert(io.lines('src/uxnasm.c')) do
if l == 'static char ops[][4] = {' then
wanted = true
elseif wanted then
if l == '};' then
break
end
for w in l:gmatch('[^%s",][^%s",][^%s",]') do
if w ~= '---' then
trees['asma-opcodes'][w] = {
('"%s 00'):format(w),
''
}
end
table.insert(opcodes_in_order, w)
end
local parse_tree
parse_tree = function(it)
local items = { }
for l in it do
if l == '' then
process_tree(items)
output:write('\n')
return
end
end
assert(#opcodes_in_order == 32, 'didn\'t find 32 opcodes in assembler code!')
end
do
local representation = setmetatable({
['&'] = '26 00 ( & )'
}, {
__index = function(self, c)
return ("'%s 00"):format(c)
local item = {
extra = ''
}
item.key, item.rest = l:match('^%s*%S+%s+%S+%s+%S+%s+(%S+)(.*)')
if item.key:match('^%&') then
item.extra = (' %s'):format(item.key)
item.key, item.rest = item.rest:match('^%s+(%S+)(.*)')
end
})
local process
process = function(label, t)
trees[label] = { }
for k, v in pairs(t) do
trees[label][('%02x'):format(k:byte())] = {
representation[k],
(':%s'):format(v)
}
end
end
process('asma-first-char-normal', {
['%'] = 'asma-macro-define',
['|'] = 'asma-pad-absolute',
['$'] = 'asma-pad-relative',
['@'] = 'asma-label-define',
['&'] = 'asma-sublabel-define',
['#'] = 'asma-literal-hex',
['.'] = 'asma-literal-zero-addr',
[','] = 'asma-literal-rel-addr',
[';'] = 'asma-literal-abs-addr',
[':'] = 'asma-abs-addr',
["'"] = 'asma-raw-char',
['"'] = 'asma-raw-word',
['{'] = 'asma-ignore',
['}'] = 'asma-ignore',
['['] = 'asma-ignore',
[']'] = 'asma-ignore',
['('] = 'asma-comment-start',
[')'] = 'asma-comment-end',
['~'] = 'asma-include'
})
process('asma-first-char-macro', {
['('] = 'asma-comment-start',
[')'] = 'asma-comment-end',
['{'] = 'asma-ignore',
['}'] = 'asma-macro-end'
})
process('asma-first-char-comment', {
['('] = 'asma-comment-more',
[')'] = 'asma-comment-less'
})
end
local traverse_node
traverse_node = function(t, min, max, lefts, rights)
local i = math.ceil((min + max) / 2)
if min < i then
lefts[t[i]] = (':&%s'):format(traverse_node(t, min, i - 1, lefts, rights))
end
if i < max then
rights[t[i]] = (':&%s'):format(traverse_node(t, i + 1, max, lefts, rights))
end
return t[i]
end
local traverse_tree
traverse_tree = function(t)
local lefts, rights = { }, { }
local keys
do
local _accum_0 = { }
local _len_0 = 1
for k in pairs(t) do
_accum_0[_len_0] = k
_len_0 = _len_0 + 1
end
keys = _accum_0
end
table.sort(keys)
return lefts, rights, traverse_node(keys, 1, #keys, lefts, rights)
end
local ptr
ptr = function(s)
if s then
return (':&%s'):format(s)
end
return ' $2'
end
local ordered_opcodes
ordered_opcodes = function(t)
local i = 0
return function()
i = i + 1
local v = opcodes_in_order[i]
if t[v] then
return v, t[v]
elseif v then
return false, {
'"--- 00',
''
}
end
end
end
local printout = true
local fmt
fmt = function(...)
return (('\t%-11s %-10s %-12s %-14s %s '):format(...):gsub(' +$', '\n'))
end
do
local _with_0 = assert(io.open('projects/library/asma.tal.tmp', 'w'))
for l in assert(io.lines('projects/library/asma.tal')) do
if l:match('--- cut here ---') then
break
end
_with_0:write(l)
_with_0:write('\n')
end
_with_0:write('( --- 8< ------- 8< --- cut here --- 8< ------- 8< --- )\n')
_with_0:write('( automatically generated code below )\n')
_with_0:write('( see etc/asma.moon for instructions )\n')
_with_0:write('\n(')
_with_0:write(fmt('label', 'less', 'greater', 'key', 'binary'))
_with_0:write(fmt('', 'than', 'than', 'string', 'data )'))
_with_0:write('\n')
for name, tree in spairs(trees) do
_with_0:write(('@%s\n'):format(name))
local lefts, rights, entry = traverse_tree(tree)
local sort_fn
if name == 'asma-opcodes' then
if rights[opcodes_in_order[1]] then
rights[opcodes_in_order[1]] = rights[opcodes_in_order[1]] .. ' &_disasm'
else
rights[opcodes_in_order[1]] = ' $2 &_disasm'
end
sort_fn = ordered_opcodes
if item.key:match('^%"') then
item.order = item.key:sub(2)
elseif item.key:match('^%x%x') then
item.order = string.char(tonumber(item.key, 16))
else
sort_fn = spairs
error(('unknown key: %q'):format(item.key))
end
for k, v in sort_fn(tree) do
local label
if k == entry then
label = '&_entry'
elseif k then
label = ('&%s'):format(k)
else
label = ''
end
_with_0:write(fmt(label, lefts[k] or ' $2', rights[k] or ' $2', unpack(v)))
if item.order:match('^%a') then
item.label = ('&%s'):format(item.order)
elseif item.order:match('^.$') then
item.label = ('&%x'):format(item.order:byte())
else
error(('unknown label: %q'):format(item.order))
end
_with_0:write('\n')
item.ref = (':%s'):format(item.label)
table.insert(items, item)
end
_with_0:close()
end
return os.execute('mv projects/library/asma.tal.tmp projects/library/asma.tal')
local it = assert(io.lines('projects/library/asma.tal'))
local waiting_for_cut = true
for l in it do
output:write(l)
output:write('\n')
if l:find('--- cut here ---', 1, true) then
waiting_for_cut = false
end
if not waiting_for_cut and '@' == l:sub(1, 1) then
parse_tree(it)
end
end
output:close()
return os.execute('mv .asma.tal projects/library/asma.tal')

View File

@ -1,10 +1,7 @@
--
-- Asma tree helper script
--
-- This script updates the trees at the end of projects/library/asma.tal when
-- Uxn's opcode set changes or new runes (first character of tokens) are
-- created, so that new changes in the C assembler can be incorporated rapidly
-- into asma.
-- This script balances the trees at the end of projects/library/asma.tal.
--
-- To run, you need Lua or LuaJIT, and just run etc/asma.lua from the top
-- directory of Uxn's git repository:
@ -18,145 +15,60 @@
-- file changes.
--
spairs = (t) ->
keys = [ k for k in pairs t ]
table.sort keys
i = 0
->
i = i + 1
keys[i], t[keys[i]]
output = assert io.open '.asma.tal', 'w'
trees = {
['asma-opcodes']: {}
}
process_subtree = (items) ->
middle = math.floor #items / 2 + 1.25
node = items[middle]
if not node
return
node.left = process_subtree [ item for i, item in ipairs items when i < middle ]
node.right = process_subtree [ item for i, item in ipairs items when i > middle ]
node
opcodes_in_order = {}
process_tree = (items) ->
sorted_items = [ item for item in *items ]
table.sort sorted_items, (a, b) -> a.order < b.order
(process_subtree sorted_items).label = '&_entry'
for item in *items
output\write '\t%-11s %-10s %-12s %s%s\n'\format item.label, item.left and item.left.ref or ' $2', (item.right and item.right.ref or ' $2') .. item.extra, item.key, item.rest
do -- opcodes
wanted = false
for l in assert io.lines 'src/uxnasm.c'
if l == 'static char ops[][4] = {'
wanted = true
elseif wanted
if l == '};'
break
for w in l\gmatch '[^%s",][^%s",][^%s",]'
if w != '---'
trees['asma-opcodes'][w] = {
'"%s 00'\format w
''
}
table.insert opcodes_in_order, w
assert #opcodes_in_order == 32, 'didn\'t find 32 opcodes in assembler code!'
parse_tree = (it) ->
items = {}
for l in it
if l == ''
process_tree items
output\write '\n'
return
item = { extra: '' }
item.key, item.rest = l\match '^%s*%S+%s+%S+%s+%S+%s+(%S+)(.*)'
if item.key\match '^%&'
item.extra = ' %s'\format item.key
item.key, item.rest = item.rest\match '^%s+(%S+)(.*)'
if item.key\match '^%"'
item.order = item.key\sub 2
elseif item.key\match '^%x%x'
item.order = string.char tonumber item.key, 16
else
error 'unknown key: %q'\format item.key
if item.order\match '^%a'
item.label = '&%s'\format item.order
elseif item.order\match '^.$'
item.label = '&%x'\format item.order\byte!
else
error 'unknown label: %q'\format item.order
item.ref = ':%s'\format item.label
table.insert items, item
do -- first characters
representation = setmetatable {
'&': '26 00 ( & )'
},
__index: (c) => "'%s 00"\format c
process = (label, t) ->
trees[label] = {}
for k, v in pairs t
trees[label]['%02x'\format k\byte!] = {
representation[k]
':%s'\format v
}
process 'asma-first-char-normal',
'%': 'asma-macro-define'
'|': 'asma-pad-absolute'
'$': 'asma-pad-relative'
'@': 'asma-label-define'
'&': 'asma-sublabel-define'
'#': 'asma-literal-hex'
'.': 'asma-literal-zero-addr'
',': 'asma-literal-rel-addr'
';': 'asma-literal-abs-addr'
':': 'asma-abs-addr'
"'": 'asma-raw-char'
'"': 'asma-raw-word'
'{': 'asma-ignore'
'}': 'asma-ignore'
'[': 'asma-ignore'
']': 'asma-ignore'
'(': 'asma-comment-start'
')': 'asma-comment-end'
'~': 'asma-include'
process 'asma-first-char-macro',
'(': 'asma-comment-start'
')': 'asma-comment-end'
'{': 'asma-ignore'
'}': 'asma-macro-end'
process 'asma-first-char-comment',
'(': 'asma-comment-more'
')': 'asma-comment-less'
traverse_node = (t, min, max, lefts, rights) ->
i = math.ceil (min + max) / 2
if min < i
lefts[t[i]] = ':&%s'\format traverse_node t, min, i - 1, lefts, rights
if i < max
rights[t[i]] = ':&%s'\format traverse_node t, i + 1, max, lefts, rights
return t[i]
traverse_tree = (t) ->
lefts, rights = {}, {}
keys = [ k for k in pairs t ]
table.sort keys
lefts, rights, traverse_node keys, 1, #keys, lefts, rights
ptr = (s) ->
if s
return ':&%s'\format s
return ' $2'
ordered_opcodes = (t) ->
i = 0
->
i = i + 1
v = opcodes_in_order[i]
if t[v]
return v, t[v]
elseif v
return false, { '"--- 00', '' }
printout = true
fmt = (...) ->
('\t%-11s %-10s %-12s %-14s %s '\format(...)\gsub ' +$', '\n')
with assert io.open 'projects/library/asma.tal.tmp', 'w'
for l in assert io.lines 'projects/library/asma.tal'
if l\match '--- cut here ---'
break
\write l
\write '\n'
\write '( --- 8< ------- 8< --- cut here --- 8< ------- 8< --- )\n'
\write '( automatically generated code below )\n'
\write '( see etc/asma.moon for instructions )\n'
\write '\n('
\write fmt 'label', 'less', 'greater', 'key', 'binary'
\write fmt '', 'than', 'than', 'string', 'data )'
\write '\n'
for name, tree in spairs trees
\write '@%s\n'\format name
lefts, rights, entry = traverse_tree tree
sort_fn = if name == 'asma-opcodes'
if rights[opcodes_in_order[1]]
rights[opcodes_in_order[1]] ..= ' &_disasm'
else
rights[opcodes_in_order[1]] = ' $2 &_disasm'
ordered_opcodes
else
spairs
for k, v in sort_fn tree
label = if k == entry
'&_entry'
elseif k
'&%s'\format k
else
''
\write fmt label, lefts[k] or ' $2', rights[k] or ' $2', unpack v
\write '\n'
\close!
os.execute 'mv projects/library/asma.tal.tmp projects/library/asma.tal'
it = assert io.lines 'projects/library/asma.tal'
waiting_for_cut = true
for l in it
output\write l
output\write '\n'
if l\find '--- cut here ---', 1, true
waiting_for_cut = false
if not waiting_for_cut and '@' == l\sub 1, 1
parse_tree it
output\close!
os.execute 'mv .asma.tal projects/library/asma.tal'

6
etc/circle128/build.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh -e
clang-format -i circle128.c
rm -f circle128
cc -lm -o circle128 circle128.c
./circle128 64

View File

@ -1,8 +1,8 @@
#include <stdio.h>
#include <math.h>
/*
Copyright (c) 2020 Devine Lu Linvega
/*
Copyright (c) 2020-2023 Devine Lu Linvega
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@ -23,14 +23,31 @@ clamp(int val, int min, int max)
}
int
main()
sint(char *s)
{
int i;
printf("60 points on a circle128(bytex,bytey):\n\n");
for(i = 0; i < 60; ++i) {
double cx = 128, cy = 128, r = 128;
double pos = (i - 15) % 60;
double deg = (pos / 60.0) * 360.0;
int i = 0, num = 0;
while(s[i] && s[i] >= '0' && s[i] <= '9')
num = num * 10 + (s[i++] - '0');
return num;
}
int
main(int argc, char *argv[])
{
int seg, offset, i;
double segf, cx = 128, cy = 128, r;
if(argc < 2) {
printf("usage: circle128 length [radius]\n", argc);
return 1;
}
seg = sint(argv[1]);
segf = (double)seg;
offset = seg / 4;
r = argc < 3 ? 128 : (double)sint(argv[2]);
printf("%d points on a circle%d:\n\n", seg, (int)r);
for(i = 0; i < seg; ++i) {
double pos = (i - offset) % seg;
double deg = (pos / segf) * 360.0;
double rad = deg * (PI / 180);
double x = cx + r * cos(rad);
double y = cy + r * sin(rad);

85
etc/cores/uxn-abc-disp.c Normal file
View File

@ -0,0 +1,85 @@
#include "uxn.h"
/*
Copyright (u) 2022-2023 Devine Lu Linvega, Andrew Alderwick, Andrew Richards
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
#define FLIP { s = ins & 0x40 ? &u->wst : &u->rst; }
#define JUMP(x) { if(m2) pc = (x); else pc += (Sint8)(x); }
#define POP1(o) { o = s->dat[--*sp]; }
#define POP2(o) { o = s->dat[--*sp] | (s->dat[--*sp] << 0x8); }
#define POPx(o) { if(m2) { POP2(o) } else POP1(o) }
#define PUSH1(y) { s->dat[s->ptr++] = (y); }
#define PUSH2(y) { tt = (y); s->dat[s->ptr++] = tt >> 0x8; s->dat[s->ptr++] = tt; }
#define PUSHx(y) { if(m2) { PUSH2(y) } else PUSH1(y) }
#define PEEK(o, x, r) { if(m2) { r = (x); o = ram[r++] << 8 | ram[r]; } else o = ram[(x)]; }
#define POKE(x, y, r) { if(m2) { r = (x); ram[r++] = y >> 8; ram[r] = y; } else ram[(x)] = (y); }
#define DEVR(o, p) { if(m2) { o = (emu_dei(u, p) << 8) | emu_dei(u, p + 1); } else o = emu_dei(u, p); }
#define DEVW(p, y) { if(m2) { emu_deo(u, p, y >> 8); emu_deo(u, p + 1, y); } else emu_deo(u, p, y); }
#define next { ins = ram[pc++]; \
m2 = ins & 0x20; \
s = ins & 0x40 ? &u->rst : &u->wst; \
if(ins & 0x80) kp = s->ptr, sp = &kp; else sp = &s->ptr; \
goto *lut[ins & 0x1f]; }
int
uxn_eval(Uxn *u, Uint16 pc)
{
Uint8 t, kp, *sp, ins, m2, *ram = u->ram;
Uint16 tt, a, b, c;
Stack *s;
static void* lut[] = {
&&_imm, &&_inc, &&_pop, &&_nip, &&_swp, &&_rot, &&_dup, &&_ovr,
&&_equ, &&_neq, &&_gth, &&_lth, &&_jmp, &&_jcn, &&_jsr, &&_sth,
&&_ldz, &&_stz, &&_ldr, &&_str, &&_lda, &&_sta, &&_dei, &&_deo,
&&_add, &&_sub, &&_mul, &&_div, &&_and, &&_ora, &&_eor, &&_sft };
if(!pc || u->dev[0x0f]) return 0;
next
_imm:
switch(ins) {
case 0x00: /* BRK */ return 1;
case 0x20: /* JCI */ POP1(b) if(!b) { pc += 2; break; }
case 0x40: /* JMI */ a = ram[pc++] << 8 | ram[pc++]; pc += a; break;
case 0x60: /* JSI */ PUSH2(pc + 2) a = ram[pc++] << 8 | ram[pc++]; pc += a; break;
case 0x80: case 0xc0: /* LIT */ PUSH1(ram[pc++]) break;
case 0xa0: case 0xe0: /* LIT2 */ PUSH1(ram[pc++]) PUSH1(ram[pc++]) break;
} next
_inc: POPx(a) PUSHx(a + 1) next
_pop: POPx(a) next
_nip: POPx(a) POPx(b) PUSHx(a) next
_swp: POPx(a) POPx(b) PUSHx(a) PUSHx(b) next
_rot: POPx(a) POPx(b) POPx(c) PUSHx(b) PUSHx(a) PUSHx(c) next
_dup: POPx(a) PUSHx(a) PUSHx(a) next
_ovr: POPx(a) POPx(b) PUSHx(b) PUSHx(a) PUSHx(b) next
_equ: POPx(a) POPx(b) PUSH1(b == a) next
_neq: POPx(a) POPx(b) PUSH1(b != a) next
_gth: POPx(a) POPx(b) PUSH1(b > a) next
_lth: POPx(a) POPx(b) PUSH1(b < a) next
_jmp: POPx(a) JUMP(a) next
_jcn: POPx(a) POP1(b) if(b) JUMP(a) next
_jsr: POPx(a) FLIP PUSH2(pc) JUMP(a) next
_sth: POPx(a) FLIP PUSHx(a) next
_ldz: POP1(a) PEEK(b, a, t) PUSHx(b) next
_stz: POP1(a) POPx(b) POKE(a, b, t) next
_ldr: POP1(a) PEEK(b, pc + (Sint8)a, tt) PUSHx(b) next
_str: POP1(a) POPx(b) POKE(pc + (Sint8)a, b, tt) next
_lda: POP2(a) PEEK(b, a, tt) PUSHx(b) next
_sta: POP2(a) POPx(b) POKE(a, b, tt) next
_dei: POP1(a) DEVR(b, a) PUSHx(b) next
_deo: POP1(a) POPx(b) DEVW(a, b) next
_add: POPx(a) POPx(b) PUSHx(b + a) next
_sub: POPx(a) POPx(b) PUSHx(b - a) next
_mul: POPx(a) POPx(b) PUSHx(b * a) next
_div: POPx(a) POPx(b) PUSHx(a ? b / a : 0) next
_and: POPx(a) POPx(b) PUSHx(b & a) next
_ora: POPx(a) POPx(b) PUSHx(b | a) next
_eor: POPx(a) POPx(b) PUSHx(b ^ a) next
_sft: POP1(a) POPx(b) PUSHx(b >> (a & 0xf) << (a >> 4)) next
}

81
etc/cores/uxn-abc.c Normal file
View File

@ -0,0 +1,81 @@
#include "uxn.h"
/*
Copyright (u) 2022-2023 Devine Lu Linvega, Andrew Alderwick, Andrew Richards
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
#define FLIP { s = ins & 0x40 ? &u->wst : &u->rst; }
#define JUMP(x) { if(m2) pc = (x); else pc += (Sint8)(x); }
#define POP1(o) { o = s->dat[--*sp]; }
#define POP2(o) { o = s->dat[--*sp] | (s->dat[--*sp] << 0x8); }
#define POPx(o) { if(m2) { POP2(o) } else POP1(o) }
#define PUSH1(y) { s->dat[s->ptr++] = (y); }
#define PUSH2(y) { tt = (y); s->dat[s->ptr++] = tt >> 0x8; s->dat[s->ptr++] = tt; }
#define PUSHx(y) { if(m2) { PUSH2(y) } else PUSH1(y) }
#define PEEK(o, x, r) { if(m2) { r = (x); o = ram[r++] << 8 | ram[r]; } else o = ram[(x)]; }
#define POKE(x, y, r) { if(m2) { r = (x); ram[r++] = y >> 8; ram[r] = y; } else ram[(x)] = (y); }
#define DEVR(o, p) { if(m2) { o = (emu_dei(u, p) << 8) | emu_dei(u, p + 1); } else o = emu_dei(u, p); }
#define DEVW(p, y) { if(m2) { emu_deo(u, p, y >> 8); emu_deo(u, p + 1, y); } else emu_deo(u, p, y); }
int
uxn_eval(Uxn *u, Uint16 pc)
{
Uint8 t, kp, *sp, *ram = u->ram;
Uint16 tt, a, b, c;
if(!pc || u->dev[0x0f]) return 0;
for(;;) {
Uint8 ins = ram[pc++];
/* 2 */ Uint8 m2 = ins & 0x20;
/* r */ Stack *s = ins & 0x40 ? &u->rst : &u->wst;
/* k */ if(ins & 0x80) kp = s->ptr, sp = &kp; else sp = &s->ptr;
switch(ins & 0x1f) {
case 0x00:
switch(ins) {
case 0x00: /* BRK */ return 1;
case 0x20: /* JCI */ POP1(b) if(!b) { pc += 2; break; }
case 0x40: /* JMI */ a = ram[pc++] << 8 | ram[pc++]; pc += a; break;
case 0x60: /* JSI */ PUSH2(pc + 2) a = ram[pc++] << 8 | ram[pc++]; pc += a; break;
case 0x80: case 0xc0: /* LIT */ PUSH1(ram[pc++]) break;
case 0xa0: case 0xe0: /* LIT2 */ PUSH1(ram[pc++]) PUSH1(ram[pc++]) break;
} break;
case 0x01: /* INC */ POPx(a) PUSHx(a + 1) break;
case 0x02: /* POP */ POPx(a) break;
case 0x03: /* NIP */ POPx(a) POPx(b) PUSHx(a) break;
case 0x04: /* SWP */ POPx(a) POPx(b) PUSHx(a) PUSHx(b) break;
case 0x05: /* ROT */ POPx(a) POPx(b) POPx(c) PUSHx(b) PUSHx(a) PUSHx(c) break;
case 0x06: /* DUP */ POPx(a) PUSHx(a) PUSHx(a) break;
case 0x07: /* OVR */ POPx(a) POPx(b) PUSHx(b) PUSHx(a) PUSHx(b) break;
case 0x08: /* EQU */ POPx(a) POPx(b) PUSH1(b == a) break;
case 0x09: /* NEQ */ POPx(a) POPx(b) PUSH1(b != a) break;
case 0x0a: /* GTH */ POPx(a) POPx(b) PUSH1(b > a) break;
case 0x0b: /* LTH */ POPx(a) POPx(b) PUSH1(b < a) break;
case 0x0c: /* JMP */ POPx(a) JUMP(a) break;
case 0x0d: /* JCN */ POPx(a) POP1(b) if(b) JUMP(a) break;
case 0x0e: /* JSR */ POPx(a) FLIP PUSH2(pc) JUMP(a) break;
case 0x0f: /* STH */ POPx(a) FLIP PUSHx(a) break;
case 0x10: /* LDZ */ POP1(a) PEEK(b, a, t) PUSHx(b) break;
case 0x11: /* STZ */ POP1(a) POPx(b) POKE(a, b, t) break;
case 0x12: /* LDR */ POP1(a) PEEK(b, pc + (Sint8)a, tt) PUSHx(b) break;
case 0x13: /* STR */ POP1(a) POPx(b) POKE(pc + (Sint8)a, b, tt) break;
case 0x14: /* LDA */ POP2(a) PEEK(b, a, tt) PUSHx(b) break;
case 0x15: /* STA */ POP2(a) POPx(b) POKE(a, b, tt) break;
case 0x16: /* DEI */ POP1(a) DEVR(b, a) PUSHx(b) break;
case 0x17: /* DEO */ POP1(a) POPx(b) DEVW(a, b) break;
case 0x18: /* ADD */ POPx(a) POPx(b) PUSHx(b + a) break;
case 0x19: /* SUB */ POPx(a) POPx(b) PUSHx(b - a) break;
case 0x1a: /* MUL */ POPx(a) POPx(b) PUSHx(b * a) break;
case 0x1b: /* DIV */ POPx(a) POPx(b) PUSHx(a ? b / a : 0) break;
case 0x1c: /* AND */ POPx(a) POPx(b) PUSHx(b & a) break;
case 0x1d: /* ORA */ POPx(a) POPx(b) PUSHx(b | a) break;
case 0x1e: /* EOR */ POPx(a) POPx(b) PUSHx(b ^ a) break;
case 0x1f: /* SFT */ POP1(a) POPx(b) PUSHx(b >> (a & 0xf) << (a >> 4)) break;
}
}
}

123
etc/cores/uxn-tnl.c Normal file
View File

@ -0,0 +1,123 @@
#include "uxn.h"
/*
Copyright (u) 2022-2023 Devine Lu Linvega, Andrew Alderwick, Andrew Richards
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
/* Registers
[ Z ][ Y ][ X ][ L ][ N ][ T ] <
[ . ][ . ][ . ][ H2 ][ . ] <
[ L2 ][ N2 ][ T2 ] <
*/
#define T *(s->dat + s->ptr)
#define N *(s->dat + (Uint8)(s->ptr - 1))
#define L *(s->dat + (Uint8)(s->ptr - 2))
#define X *(s->dat + (Uint8)(s->ptr - 3))
#define Y *(s->dat + (Uint8)(s->ptr - 4))
#define Z *(s->dat + (Uint8)(s->ptr - 5))
#define T2 (N << 8 | T)
#define H2 (L << 8 | N)
#define N2 (X << 8 | L)
#define L2 (Z << 8 | Y)
#define T2_(v) { r = (v); T = r; N = r >> 8; }
#define N2_(v) { r = (v); L = r; X = r >> 8; }
#define L2_(v) { r = (v); Y = r; Z = r >> 8; }
#define FLIP { s = ins & 0x40 ? &u->wst : &u->rst; }
#define SHIFT(y) { s->ptr += (y); }
#define SET(x, y) { SHIFT((ins & 0x80) ? x + y : y) }
int
uxn_eval(Uxn *u, Uint16 pc)
{
Uint16 t, n, l, r;
Uint8 *ram = u->ram, *rr;
if(!pc || u->dev[0x0f]) return 0;
for(;;) {
Uint8 ins = ram[pc++];
Stack *s = ins & 0x40 ? &u->rst : &u->wst;
switch(ins & 0x3f) {
/* IMM */
case 0x00: case 0x20:
switch(ins) {
case 0x00: /* BRK */ return 1;
case 0x20: /* JCI */ t=T; SHIFT(-1) if(!t) { pc += 2; break; } /* fall-through */
case 0x40: /* JMI */ rr = ram + pc; pc += 2 + PEEK2(rr); break;
case 0x60: /* JSI */ SHIFT( 2) rr = ram + pc; pc += 2; T2_(pc); pc += PEEK2(rr); break;
case 0x80: /* LIT */ case 0xc0: SHIFT( 1) T = ram[pc++]; break;
case 0xa0: /* LIT2 */ case 0xe0: SHIFT( 2) N = ram[pc++]; T = ram[pc++]; break;
} break;
/* ALU */
case 0x01: /* INC */ t=T; SET(1, 0) T = t + 1; break;
case 0x21: /* INC2 */ t=T2; SET(2, 0) T2_(t + 1) break;
case 0x02: /* POP */ SET(1,-1) break;
case 0x22: /* POP2 */ SET(2,-2) break;
case 0x03: /* NIP */ t=T; SET(2,-1) T = t; break;
case 0x23: /* NIP2 */ t=T2; SET(4,-2) T2_(t) break;
case 0x04: /* SWP */ t=T;n=N; SET(2, 0) T = n; N = t; break;
case 0x24: /* SWP2 */ t=T2;n=N2; SET(4, 0) T2_(n) N2_(t) break;
case 0x05: /* ROT */ t=T;n=N;l=L; SET(3, 0) T = l; N = t; L = n; break;
case 0x25: /* ROT2 */ t=T2;n=N2;l=L2; SET(6, 0) T2_(l) N2_(t) L2_(n) break;
case 0x06: /* DUP */ t=T; SET(1, 1) T = t; N = t; break;
case 0x26: /* DUP2 */ t=T2; SET(2, 2) T2_(t) N2_(t) break;
case 0x07: /* OVR */ t=T;n=N; SET(2, 1) T = n; N = t; L = n; break;
case 0x27: /* OVR2 */ t=T2;n=N2; SET(4, 2) T2_(n) N2_(t) L2_(n) break;
case 0x08: /* EQU */ t=T;n=N; SET(2,-1) T = n == t; break;
case 0x28: /* EQU2 */ t=T2;n=N2; SET(4,-3) T = n == t; break;
case 0x09: /* NEQ */ t=T;n=N; SET(2,-1) T = n != t; break;
case 0x29: /* NEQ2 */ t=T2;n=N2; SET(4,-3) T = n != t; break;
case 0x0a: /* GTH */ t=T;n=N; SET(2,-1) T = n > t; break;
case 0x2a: /* GTH2 */ t=T2;n=N2; SET(4,-3) T = n > t; break;
case 0x0b: /* LTH */ t=T;n=N; SET(2,-1) T = n < t; break;
case 0x2b: /* LTH2 */ t=T2;n=N2; SET(4,-3) T = n < t; break;
case 0x0c: /* JMP */ t=T; SET(1,-1) pc += (Sint8)t; break;
case 0x2c: /* JMP2 */ t=T2; SET(2,-2) pc = t; break;
case 0x0d: /* JCN */ t=T;n=N; SET(2,-2) if(n) pc += (Sint8)t; break;
case 0x2d: /* JCN2 */ t=T2;n=L; SET(3,-3) if(n) pc = t; break;
case 0x0e: /* JSR */ t=T; SET(1,-1) FLIP SHIFT(2) T2_(pc) pc += (Sint8)t; break;
case 0x2e: /* JSR2 */ t=T2; SET(2,-2) FLIP SHIFT(2) T2_(pc) pc = t; break;
case 0x0f: /* STH */ t=T; SET(1,-1) FLIP SHIFT(1) T = t; break;
case 0x2f: /* STH2 */ t=T2; SET(2,-2) FLIP SHIFT(2) T2_(t) break;
case 0x10: /* LDZ */ t=T; SET(1, 0) T = ram[t]; break;
case 0x30: /* LDZ2 */ t=T; SET(1, 1) N = ram[t++]; T = ram[(Uint8)t]; break;
case 0x11: /* STZ */ t=T;n=N; SET(2,-2) ram[t] = n; break;
case 0x31: /* STZ2 */ t=T;n=H2; SET(3,-3) ram[t++] = n >> 8; ram[(Uint8)t] = n; break;
case 0x12: /* LDR */ t=T; SET(1, 0) r = pc + (Sint8)t; T = ram[r]; break;
case 0x32: /* LDR2 */ t=T; SET(1, 1) r = pc + (Sint8)t; N = ram[r++]; T = ram[r]; break;
case 0x13: /* STR */ t=T;n=N; SET(2,-2) r = pc + (Sint8)t; ram[r] = n; break;
case 0x33: /* STR2 */ t=T;n=H2; SET(3,-3) r = pc + (Sint8)t; ram[r++] = n >> 8; ram[r] = n; break;
case 0x14: /* LDA */ t=T2; SET(2,-1) T = ram[t]; break;
case 0x34: /* LDA2 */ t=T2; SET(2, 0) N = ram[t++]; T = ram[t]; break;
case 0x15: /* STA */ t=T2;n=L; SET(3,-3) ram[t] = n; break;
case 0x35: /* STA2 */ t=T2;n=N2; SET(4,-4) ram[t++] = n >> 8; ram[t] = n; break;
case 0x16: /* DEI */ t=T; SET(1, 0) T = emu_dei(u, t); break;
case 0x36: /* DEI2 */ t=T; SET(1, 1) N = emu_dei(u, t++); T = emu_dei(u, t); break;
case 0x17: /* DEO */ t=T;n=N; SET(2,-2) emu_deo(u, t, n); break;
case 0x37: /* DEO2 */ t=T;n=N;l=L; SET(3,-3) emu_deo(u, t++, l); emu_deo(u, t, n); break;
case 0x18: /* ADD */ t=T;n=N; SET(2,-1) T = n + t; break;
case 0x38: /* ADD2 */ t=T2;n=N2; SET(4,-2) T2_(n + t) break;
case 0x19: /* SUB */ t=T;n=N; SET(2,-1) T = n - t; break;
case 0x39: /* SUB2 */ t=T2;n=N2; SET(4,-2) T2_(n - t) break;
case 0x1a: /* MUL */ t=T;n=N; SET(2,-1) T = n * t; break;
case 0x3a: /* MUL2 */ t=T2;n=N2; SET(4,-2) T2_(n * t) break;
case 0x1b: /* DIV */ t=T;n=N; SET(2,-1) T = t ? n / t : 0; break;
case 0x3b: /* DIV2 */ t=T2;n=N2; SET(4,-2) T2_(t ? n / t : 0) break;
case 0x1c: /* AND */ t=T;n=N; SET(2,-1) T = n & t; break;
case 0x3c: /* AND2 */ t=T2;n=N2; SET(4,-2) T2_(n & t) break;
case 0x1d: /* ORA */ t=T;n=N; SET(2,-1) T = n | t; break;
case 0x3d: /* ORA2 */ t=T2;n=N2; SET(4,-2) T2_(n | t) break;
case 0x1e: /* EOR */ t=T;n=N; SET(2,-1) T = n ^ t; break;
case 0x3e: /* EOR2 */ t=T2;n=N2; SET(4,-2) T2_(n ^ t) break;
case 0x1f: /* SFT */ t=T;n=N; SET(2,-1) T = n >> (t & 0xf) << (t >> 4); break;
case 0x3f: /* SFT2 */ t=T;n=H2; SET(3,-1) T2_(n >> (t & 0xf) << (t >> 4)) break;
}
}
}

28
etc/hello.tal Normal file
View File

@ -0,0 +1,28 @@
( init )
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
%emit ( byte -- ) { ( hey ) #18 DEO }
|0100 @program
#1234 SWP
#010e DEO
#010f DEO
#1234 #5678 SWP2
;hello-word
&while
( send ) LDAk emit
( loop ) INC2 LDAk ?&while
POP2
#010f DEO
BRK
@program/extend BRK
@hello-word "Hello 20 "World? 00

View File

@ -1,389 +0,0 @@
local generate_labels = false
local replacements = {
op_and16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d & b); push8(u->src, c & a); }',
op_ora16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d | b); push8(u->src, c | a); }',
op_eor16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d ^ b); push8(u->src, c ^ a); }',
op_lit16 = '{ push8(u->src, peek8(u->ram.dat, u->ram.ptr++)); push8(u->src, peek8(u->ram.dat, u->ram.ptr++)); }',
op_swp16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, b); push8(u->src, a); push8(u->src, d); push8(u->src, c); }',
op_ovr16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d); push8(u->src, c); push8(u->src, b); push8(u->src, a); push8(u->src, d); push8(u->src, c); }',
op_dup16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b); push8(u->src, a); push8(u->src, b); push8(u->src, a); }',
op_rot16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src), e = pop8(u->src), f = pop8(u->src); push8(u->src, d); push8(u->src, c); push8(u->src, b); push8(u->src, a); push8(u->src, f); push8(u->src, e); }',
op_sth16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->dst, b); push8(u->dst, a); }'
}
local top, bottom, pushtop
local offset
offset = function(n, s)
if s == nil then
s = ''
end
if n < 0 then
return (' -%s %d'):format(s, -n)
elseif n > 0 then
return (' +%s %d'):format(s, n)
elseif s ~= '' then
return (' +%s 0'):format(s)
else
return ''
end
end
local pop_push
pop_push = function(k, n, s)
local _exp_0 = k
if 'pop' == _exp_0 then
s = s:match('^%((%S+)%)$')
assert(s == 'src')
local _exp_1 = n
if '8' == _exp_1 then
top[s] = top[s] - 1
if bottom[s] > top[s] then
bottom[s] = top[s]
end
return ('%s.dat[%s.ptr%s]'):format(s, s, offset(top[s]))
elseif '16' == _exp_1 then
top[s] = top[s] - 2
if bottom[s] > top[s] then
bottom[s] = top[s]
end
return ('(%s.dat[%s.ptr%s] | (%s.dat[%s.ptr%s] << 8))'):format(s, s, offset(top[s] + 1), s, s, offset(top[s]))
end
elseif 'push' == _exp_0 then
local v
s, v = s:match('^%((%S+), (.*)%)$')
assert(s == 'src' or s == 'dst', s)
local _exp_1 = n
if '8' == _exp_1 then
pushtop[s] = pushtop[s] + 1
return ('%s.dat[%s.ptr%s] = %s'):format(s, s, offset(pushtop[s] - 1), v)
elseif '16' == _exp_1 then
if v:match('%+%+') or v:match('%-%-') then
error('push16 has side effects: ' .. v)
end
local peek, args = v:match('^([md]e[mv]peek)16(%b())$')
if peek then
args = args:sub(2, -2)
return pop_push('push', '8', ('(%s, %s8(%s))'):format(s, peek, args)) .. ';\n' .. pop_push('push', '8', ('(%s, %s8(%s + 1))'):format(s, peek, args))
end
pushtop[s] = pushtop[s] + 2
if v:match(' ') then
v = '(' .. v .. ')'
end
return ('%s.dat[%s.ptr%s] = %s >> 8;\n%s.dat[%s.ptr%s] = %s & 0xff'):format(s, s, offset(pushtop[s] - 2), v, s, s, offset(pushtop[s] - 1), v)
end
else
return nil
end
end
local indented_block
indented_block = function(s)
s = s:gsub('^%{ *', '{\n'):gsub('\n', '\n\t'):gsub('\t%} *$', '}\n')
s = s:gsub('\n[^\n]+%.error = [^\n]+', '%0\n#ifndef NO_STACK_CHECKS\n\tgoto error;\n#endif')
return s
end
local process
process = function(body)
local out_body = body:gsub('^%{ *', ''):gsub(' *%}$', ''):gsub('; ', ';\n'):gsub('%b{} *', indented_block):gsub('(%a+)(%d+)(%b())', pop_push)
local in_ifdef = false
local _list_0 = {
'src',
'dst'
}
for _index_0 = 1, #_list_0 do
local k = _list_0[_index_0]
if bottom[k] ~= 0 then
if not in_ifdef then
out_body = out_body .. '\n#ifndef NO_STACK_CHECKS'
in_ifdef = true
end
out_body = out_body .. ('\nif(__builtin_expect(%s.ptr < %d, 0)) {\n\t%s.error = 1;\n\tgoto error;\n}'):format(k, -bottom[k], k)
end
if pushtop[k] ~= 0 then
if pushtop[k] > 0 then
if not in_ifdef then
out_body = out_body .. '\n#ifndef NO_STACK_CHECKS'
in_ifdef = true
end
out_body = out_body .. ('\nif(__builtin_expect(%s.ptr > %d, 0)) {\n\t%s.error = 2;\n\tgoto error;\n}'):format(k, 255 - pushtop[k], k)
end
if in_ifdef then
out_body = out_body .. '\n#endif'
in_ifdef = false
end
out_body = out_body .. ('\n%s.ptr %s= %d;'):format(k, pushtop[k] < 0 and '-' or '+', math.abs(pushtop[k]))
end
end
if in_ifdef then
out_body = out_body .. '\n#endif'
in_ifdef = false
end
local t = { }
out_body:gsub('[^%w_]([a-f]) = (src%.dat%[[^]]+%])[,;]', function(v, k)
t[k] = v
end)
out_body = out_body:gsub('(src%.dat%[[^]]+%]) = ([a-f]);\n', function(k, v)
if t[k] and t[k] == v then
return ''
end
return nil
end)
return out_body
end
local ops = { }
for l in assert(io.lines('src/uxn.c')) do
local _continue_0 = false
repeat
local name, body = l:match('void (op_%S*)%(Uxn %*u%) (%b{})')
if not name then
_continue_0 = true
break
end
if replacements[name] then
body = replacements[name]
end
body = body:gsub('u%-%>src%-%>', 'src.')
body = body:gsub('u%-%>dst%-%>', 'dst.')
body = body:gsub('u%-%>src', 'src')
body = body:gsub('u%-%>dst', 'dst')
top = {
src = 0,
dst = 0
}
bottom = {
src = 0,
dst = 0
}
pushtop = top
ops[name] = process(body)
top = {
src = 0,
dst = 0
}
bottom = {
src = 0,
dst = 0
}
pushtop = {
src = 0,
dst = 0
}
ops['keep_' .. name] = process(body)
_continue_0 = true
until true
if not _continue_0 then
break
end
end
local dump
dump = function(s, src, dst)
local ret = '\t\t\t{\n'
for l in s:gmatch('[^\n]+') do
if not l:match('^%#') then
ret = ret .. '\t\t\t\t'
end
ret = ret .. ('%s\n'):format(l)
end
ret = ret .. '\t\t\t}\n\t\t\tbreak;\n'
return (ret:gsub('src', src):gsub('dst', dst))
end
local i = 0
local allops = { }
local wanted = false
for l in assert(io.lines('src/uxn.c')) do
if l == 'static void (*ops[])(Uxn *u) = {' then
wanted = true
elseif l == '};' then
wanted = false
elseif wanted then
l = l:gsub('%/%b**%/', '')
for op in l:gmatch('[%w_]+') do
if not ops[op] then
error('missing ' .. op)
end
allops[i + 0x00 + 1] = {
n = {
i + 0x00
},
body = dump(ops[op], 'u->wst', 'u->rst')
}
allops[i + 0x20 + 1] = {
n = {
i + 0x20
},
body = dump(ops[op], 'u->rst', 'u->wst')
}
allops[i + 0x80 + 1] = {
n = {
i + 0x80
},
body = dump(ops['keep_' .. op], 'u->wst', 'u->rst')
}
allops[i + 0xa0 + 1] = {
n = {
i + 0xa0
},
body = dump(ops['keep_' .. op], 'u->rst', 'u->wst')
}
i = i + 1
if i == 0x20 then
i = i + 0x20
end
end
end
end
i = 0
wanted = false
for l in assert(io.lines('src/uxnasm.c')) do
if l == 'static char ops[][4] = {' then
wanted = true
elseif l == '};' then
wanted = false
elseif wanted then
for op in l:gmatch('"(...)"') do
i = i + 1
allops[i + 0x00].name = op
allops[i + 0x20].name = op .. 'r'
allops[i + 0x40].name = op .. '2'
allops[i + 0x60].name = op .. '2r'
allops[i + 0x80].name = op .. 'k'
allops[i + 0xa0].name = op .. 'kr'
allops[i + 0xc0].name = op .. '2k'
allops[i + 0xe0].name = op .. '2kr'
end
end
end
for i = 1, 256 do
local _continue_0 = false
repeat
if not allops[i] then
_continue_0 = true
break
end
for j = i + 1, 256 do
if allops[i].body == allops[j].body then
table.insert(allops[i].n, (table.remove(allops[j].n)))
allops[j].body = nil
end
end
_continue_0 = true
until true
if not _continue_0 then
break
end
end
do
local _with_0 = assert(io.open('src/uxn-fast.c', 'w'))
local f = assert(io.open('src/uxn.c'))
while true do
local l = f:read('*l')
_with_0:write(('%s\n'):format(l))
if l == '*/' then
break
end
end
_with_0:write('\n')
_with_0:write([[/*
^
/!\ THIS FILE IS AUTOMATICALLY GENERATED
---
Its contents can get overwritten with the processed contents of src/uxn.c.
See etc/mkuxn-fast.moon for instructions.
*/
]])
wanted = true
while true do
local _continue_0 = false
repeat
local l = f:read('*l')
if l:match(' push') or l:match('[ *]pop') or l:match('devr16') then
_continue_0 = true
break
end
if l == '/* Stack */' then
wanted = false
end
if wanted then
_with_0:write(('%s\n'):format(l))
end
if l == '}' then
_with_0:write('\n')
break
end
_continue_0 = true
until true
if not _continue_0 then
break
end
end
_with_0:write([[/* clang-format on */
#pragma mark - Core
int
uxn_eval(Uxn *u, Uint16 vec)
{
Uint8 instr;
if(!vec || u->dev[0].dat[0xf])
return 0;
u->ram.ptr = vec;
if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
while((instr = u->ram.dat[u->ram.ptr++])) {
switch(instr) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-value"
#pragma GCC diagnostic ignored "-Wunused-variable"
]])
for i = 1, 256 do
local _continue_0 = false
repeat
if not allops[i].body then
_continue_0 = true
break
end
local _list_0 = allops[i].n
for _index_0 = 1, #_list_0 do
local n = _list_0[_index_0]
_with_0:write(('\t\tcase 0x%02x: /* %s */\n'):format(n, allops[n + 1].name))
end
if generate_labels then
_with_0:write(('\t\t\t__asm__("evaluxn_%02x_%s:");\n'):format(allops[i].n[1], allops[i].name))
end
_with_0:write(allops[i].body)
_continue_0 = true
until true
if not _continue_0 then
break
end
end
_with_0:write([[#pragma GCC diagnostic pop
}
}
return 1;
#ifndef NO_STACK_CHECKS
error:
if(u->wst.error)
return uxn_halt(u, u->wst.error, "Working-stack", instr);
else
return uxn_halt(u, u->rst.error, "Return-stack", instr);
#endif
}
int
]])
wanted = false
while true do
local l = f:read('*l')
if not l then
break
end
if l:match('^uxn_boot') then
wanted = true
end
if wanted then
_with_0:write(('%s\n'):format(l))
end
end
f:close()
_with_0:close()
return _with_0
end

View File

@ -1,280 +0,0 @@
--
-- Uxn core unroller script
--
-- This script updates src/uxn-fast.c when Uxn's opcode set changes, so that
-- updates in the human-readable src/uxn.c core can be easily converted into
-- high-performance code.
--
-- To run, you need Lua or LuaJIT, and just run etc/mkuxn-fast.lua from the top
-- directory of Uxn's git repository:
--
-- lua etc/mkuxn-fast.lua
--
-- This file is written in MoonScript, which is a language that compiles to
-- Lua, the same way as e.g. CoffeeScript compiles to JavaScript. Since
-- installing MoonScript has more dependencies than Lua, the compiled
-- etc/mkuxn-fast.lua is kept in Uxn's repository and will be kept updated as
-- this file changes.
--
generate_labels = false -- add labels to each opcode to inspect disassembled code
replacements =
op_and16: '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d & b); push8(u->src, c & a); }'
op_ora16: '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d | b); push8(u->src, c | a); }'
op_eor16: '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d ^ b); push8(u->src, c ^ a); }'
op_lit16: '{ push8(u->src, peek8(u->ram.dat, u->ram.ptr++)); push8(u->src, peek8(u->ram.dat, u->ram.ptr++)); }'
op_swp16: '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, b); push8(u->src, a); push8(u->src, d); push8(u->src, c); }'
op_ovr16: '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d); push8(u->src, c); push8(u->src, b); push8(u->src, a); push8(u->src, d); push8(u->src, c); }'
op_dup16: '{ Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b); push8(u->src, a); push8(u->src, b); push8(u->src, a); }'
op_rot16: '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src), e = pop8(u->src), f = pop8(u->src); push8(u->src, d); push8(u->src, c); push8(u->src, b); push8(u->src, a); push8(u->src, f); push8(u->src, e); }'
op_sth16: '{ Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->dst, b); push8(u->dst, a); }'
local top, bottom, pushtop
offset = (n, s = '') ->
if n < 0
' -%s %d'\format s, -n
elseif n > 0
' +%s %d'\format s, n
elseif s != ''
' +%s 0'\format s
else
''
pop_push = (k, n, s) ->
switch k
when 'pop'
s = s\match '^%((%S+)%)$'
assert s == 'src'
switch n
when '8'
top[s] -= 1
if bottom[s] > top[s]
bottom[s] = top[s]
'%s.dat[%s.ptr%s]'\format s, s, offset(top[s])
when '16'
top[s] -= 2
if bottom[s] > top[s]
bottom[s] = top[s]
'(%s.dat[%s.ptr%s] | (%s.dat[%s.ptr%s] << 8))'\format s, s, offset(top[s] + 1), s, s, offset(top[s])
when 'push'
s, v = s\match '^%((%S+), (.*)%)$'
assert s == 'src' or s == 'dst', s
switch n
when '8'
pushtop[s] += 1
'%s.dat[%s.ptr%s] = %s'\format s, s, offset(pushtop[s] - 1), v
when '16'
if v\match'%+%+' or v\match'%-%-'
error 'push16 has side effects: ' .. v
peek, args = v\match '^([md]e[mv]peek)16(%b())$'
if peek
args = args\sub 2, -2
return pop_push('push', '8', '(%s, %s8(%s))'\format s, peek, args) .. ';\n' .. pop_push('push', '8', '(%s, %s8(%s + 1))'\format s, peek, args)
pushtop[s] += 2
if v\match ' '
v = '(' .. v .. ')'
'%s.dat[%s.ptr%s] = %s >> 8;\n%s.dat[%s.ptr%s] = %s & 0xff'\format s, s, offset(pushtop[s] - 2), v, s, s, offset(pushtop[s] - 1), v
else
nil
indented_block = (s) ->
s = s\gsub('^%{ *', '{\n')\gsub('\n', '\n\t')\gsub('\t%} *$', '}\n')
s = s\gsub('\n[^\n]+%.error = [^\n]+', '%0\n#ifndef NO_STACK_CHECKS\n\tgoto error;\n#endif')
s
process = (body) ->
out_body = body\gsub('^%{ *', '')\gsub(' *%}$', '')\gsub('; ', ';\n')\gsub('%b{} *', indented_block)\gsub '(%a+)(%d+)(%b())', pop_push
in_ifdef = false
for k in *{'src', 'dst'}
if bottom[k] != 0
if not in_ifdef
out_body ..= '\n#ifndef NO_STACK_CHECKS'
in_ifdef = true
out_body ..= '\nif(__builtin_expect(%s.ptr < %d, 0)) {\n\t%s.error = 1;\n\tgoto error;\n}'\format k, -bottom[k], k
if pushtop[k] != 0
if pushtop[k] > 0
if not in_ifdef
out_body ..= '\n#ifndef NO_STACK_CHECKS'
in_ifdef = true
out_body ..= '\nif(__builtin_expect(%s.ptr > %d, 0)) {\n\t%s.error = 2;\n\tgoto error;\n}'\format k, 255 - pushtop[k], k
if in_ifdef
out_body ..= '\n#endif'
in_ifdef = false
out_body ..= '\n%s.ptr %s= %d;'\format k, pushtop[k] < 0 and '-' or '+', math.abs pushtop[k]
if in_ifdef
out_body ..= '\n#endif'
in_ifdef = false
t = {}
out_body\gsub '[^%w_]([a-f]) = (src%.dat%[[^]]+%])[,;]', (v, k) -> t[k] = v
out_body = out_body\gsub '(src%.dat%[[^]]+%]) = ([a-f]);\n', (k, v) ->
if t[k] and t[k] == v
return ''
return nil
out_body
ops = {}
for l in assert io.lines 'src/uxn.c'
name, body = l\match 'void (op_%S*)%(Uxn %*u%) (%b{})'
if not name
continue
if replacements[name]
body = replacements[name]
body = body\gsub 'u%-%>src%-%>', 'src.'
body = body\gsub 'u%-%>dst%-%>', 'dst.'
body = body\gsub 'u%-%>src', 'src'
body = body\gsub 'u%-%>dst', 'dst'
top = { src: 0, dst: 0 }
bottom = { src: 0, dst: 0 }
pushtop = top
ops[name] = process body
top = { src: 0, dst: 0 }
bottom = { src: 0, dst: 0 }
pushtop = { src: 0, dst: 0 }
ops['keep_' .. name] = process body
dump = (s, src, dst) ->
ret = '\t\t\t{\n'
for l in s\gmatch '[^\n]+'
if not l\match '^%#'
ret ..= '\t\t\t\t'
ret ..= '%s\n'\format l
ret ..= '\t\t\t}\n\t\t\tbreak;\n'
(ret\gsub('src', src)\gsub('dst', dst))
i = 0
allops = {}
wanted = false
for l in assert io.lines 'src/uxn.c'
if l == 'static void (*ops[])(Uxn *u) = {'
wanted = true
elseif l == '};'
wanted = false
elseif wanted
l = l\gsub '%/%b**%/', ''
for op in l\gmatch '[%w_]+'
if not ops[op]
error 'missing ' .. op
allops[i + 0x00 + 1] = { n: { i + 0x00 }, body: dump ops[op], 'u->wst', 'u->rst' }
allops[i + 0x20 + 1] = { n: { i + 0x20 }, body: dump ops[op], 'u->rst', 'u->wst' }
allops[i + 0x80 + 1] = { n: { i + 0x80 }, body: dump ops['keep_' .. op], 'u->wst', 'u->rst' }
allops[i + 0xa0 + 1] = { n: { i + 0xa0 }, body: dump ops['keep_' .. op], 'u->rst', 'u->wst' }
i += 1
if i == 0x20
i += 0x20
i = 0
wanted = false
for l in assert io.lines 'src/uxnasm.c'
if l == 'static char ops[][4] = {'
wanted = true
elseif l == '};'
wanted = false
elseif wanted
for op in l\gmatch '"(...)"'
i += 1
allops[i + 0x00].name = op
allops[i + 0x20].name = op .. 'r'
allops[i + 0x40].name = op .. '2'
allops[i + 0x60].name = op .. '2r'
allops[i + 0x80].name = op .. 'k'
allops[i + 0xa0].name = op .. 'kr'
allops[i + 0xc0].name = op .. '2k'
allops[i + 0xe0].name = op .. '2kr'
for i = 1, 256
if not allops[i]
continue
for j = i + 1, 256
if allops[i].body == allops[j].body
table.insert allops[i].n, (table.remove allops[j].n)
allops[j].body = nil
with assert io.open 'src/uxn-fast.c', 'w'
f = assert io.open 'src/uxn.c'
while true
l = f\read '*l'
\write '%s\n'\format l
if l == '*/'
break
\write '\n'
\write [[
/*
^
/!\ THIS FILE IS AUTOMATICALLY GENERATED
---
Its contents can get overwritten with the processed contents of src/uxn.c.
See etc/mkuxn-fast.moon for instructions.
*/
]]
wanted = true
while true
l = f\read '*l'
if l\match' push' or l\match'[ *]pop' or l\match'devr16'
continue
if l == '/* Stack */'
wanted = false
if wanted
\write '%s\n'\format l
if l == '}'
\write '\n'
break
\write [[
/* clang-format on */
#pragma mark - Core
int
uxn_eval(Uxn *u, Uint16 vec)
{
Uint8 instr;
if(!vec || u->dev[0].dat[0xf])
return 0;
u->ram.ptr = vec;
if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
while((instr = u->ram.dat[u->ram.ptr++])) {
switch(instr) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-value"
#pragma GCC diagnostic ignored "-Wunused-variable"
]]
for i = 1, 256
if not allops[i].body
continue
for n in *allops[i].n
\write '\t\tcase 0x%02x: /* %s */\n'\format n, allops[n + 1].name
if generate_labels
\write '\t\t\t__asm__("evaluxn_%02x_%s:");\n'\format allops[i].n[1], allops[i].name
\write allops[i].body
\write [[
#pragma GCC diagnostic pop
}
}
return 1;
#ifndef NO_STACK_CHECKS
error:
if(u->wst.error)
return uxn_halt(u, u->wst.error, "Working-stack", instr);
else
return uxn_halt(u, u->rst.error, "Return-stack", instr);
#endif
}
int
]]
wanted = false
while true
l = f\read '*l'
if not l
break
if l\match '^uxn_boot'
wanted = true
if wanted
\write '%s\n'\format l
f\close!
\close!

View File

@ -118,9 +118,9 @@ contexts:
- match: '\}'
pop: true
- match: '\( '
- match: '\s\(\s'
scope: comment
push:
- meta_scope: comment.line
- match: ' \)'
- match: '\s\)\s'
pop: true

View File

@ -1,16 +0,0 @@
#!/bin/bash
echo "Formatting.."
clang-format -i tables.c
echo "Cleaning.."
rm -f ../../bin/tables
echo "Building.."
mkdir -p ../../bin
cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined -lm tables.c -o ../../bin/tables
echo "Assembling.."
../../bin/tables
echo "Done."

16
mkfile
View File

@ -1,16 +1,20 @@
</$objtype/mkfile
BIN=/$objtype/bin/games
TARG=bin/uxncli bin/uxnasm bin/uxnemu
USM=`{walk -f projects/ | grep '\.tal$' | grep -v blank.tal | grep -v /assets/ | grep -v /library/}
ROM=${USM:%.tal=%.rom}
CFLAGS=$CFLAGS -D__plan9__ -I/sys/include/npe -I/sys/include/npe/SDL2
CFLAGS=$CFLAGS -p -D__plan9__ -I/sys/include/npe -I/sys/include/npe/SDL2
HFILES=\
/sys/include/npe/stdio.h\
src/devices/audio.h\
src/devices/controller.h\
src/devices/datetime.h\
src/devices/file.h\
src/devices/mouse.h\
src/devices/screen.h\
src/devices/system.h\
src/devices/console.h\
src/uxn.h\
CLEANFILES=$TARG $ROM
@ -31,19 +35,19 @@ bin:
%.rom:Q: %.tal bin/uxnasm
bin/uxnasm $stem.tal $target >/dev/null
bin/uxncli: file.$O uxncli.$O uxn.$O
bin/uxncli: file.$O datetime.$O system.$O console.$O uxncli.$O uxn.$O
$LD $LDFLAGS -o $target $prereq
bin/uxnasm: uxnasm.$O
$LD $LDFLAGS -o $target $prereq
bin/uxnemu: uxnemu.$O audio.$O controller.$O file.$O mouse.$O screen.$O uxn.$O
bin/uxnemu: audio.$O controller.$O datetime.$O file.$O mouse.$O screen.$O system.$O console.$O uxn.$O uxnemu.$O
$LD $LDFLAGS -o $target $prereq
(uxnasm|uxncli|uxnemu|uxn)\.$O:R: src/\1.c
$CC $CFLAGS -Isrc -o $target src/$stem1.c
(audio|controller|file|mouse|screen)\.$O:R: src/devices/\1.c
(audio|controller|datetime|file|mouse|screen|system|console)\.$O:R: src/devices/\1.c
$CC $CFLAGS -Isrc -o $target src/devices/$stem1.c
nuke:V: clean
@ -54,7 +58,7 @@ clean:V:
%.clean:V:
rm -f $stem.[$OS] [$OS].$stem $stem
install:QV: all
exit 'Sorry, there is no install rule yet'
install:V: all
cp $TARG $BIN/
#LDFLAGS=-p

View File

@ -1,38 +1,17 @@
( a blank file )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%2* { #10 SFT } %2/ { #01 SFT } %2** { #10 SFT2 } %2// { #01 SFT2 }
%4* { #20 SFT } %4/ { #02 SFT } %4** { #20 SFT2 } %4// { #02 SFT2 }
%8* { #30 SFT } %8/ { #03 SFT } %8** { #30 SFT2 } %8// { #03 SFT2 }
%10* { #40 SFT } %10/ { #04 SFT } %10** { #40 SFT2 } %10// { #04 SFT2 }
%20* { #50 SFT } %20/ { #05 SFT } %20** { #50 SFT2 } %20// { #05 SFT2 }
%2MOD { #01 AND } %2MOD2 { #0001 AND2 }
%4MOD { #03 AND } %4MOD2 { #0003 AND2 }
%8MOD { #07 AND } %8MOD2 { #0007 AND2 }
%10MOD { #0f AND } %10MOD2 { #000f AND2 }
%DEBUG { ;print-hex/byte JSR2 #0a18 DEO }
%DEBUG2 { ;print-hex JSR2 #0a18 DEO }
%RTN { JMP2r }
( devices )
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|40 @Audio1 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|50 @Audio2 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|60 @Audio3 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|80 @Controller &vector $2 &button $1 &key $1
|80 @Controller &vector $2 &button $1 &key $1 &func $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|b0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
|a0 @File0 &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|b0 @File1 &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
( variables )
@ -49,33 +28,19 @@
BRK
@print-hex ( value* -- )
SWP ,&byte JSR
&byte ( byte -- )
STHk #04 SFT ,&parse JSR #18 DEO
STHr #0f AND ,&parse JSR #18 DEO
RTN
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 + RTN
&above #57 + RTN
@print ( short* -- )
RTN
SWP ,&byte JSR
&byte ( byte -- ) DUP #04 SFT ,&char JSR
&char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO
@print-dec ( value* -- )
JMP2r
#2710 DIV2k DUP #30 ADD #18 DEO MUL2 SUB2
#03e8 DIV2k DUP #30 ADD #18 DEO MUL2 SUB2
#0064 DIV2k DUP #30 ADD #18 DEO MUL2 SUB2
#000a DIV2k DUP #30 ADD #18 DEO MUL2 SUB2
#30 ADD #18 DEO POP
@print-str ( str* -- )
RTN
@print-str ( string* -- )
#0001 --
&while
INC2 LDAk DUP #18 DEO ,&while JCN
LDAk #18 DEO
INC2 LDAk ,&while JCN
POP2
RTN
JMP2r

View File

@ -0,0 +1,314 @@
( Boing )
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|0000
@ball &x $2 &y $2 &vx $2 &vy $2
@timer $1
@frame $1
@direction $1
(
@|vectors )
|0100
( variables )
[ LIT2 01 -direction ] STZ
( vectors )
;on-frame .Screen/vector DEO2
( theme )
#aff5 .System/r DEO2
#af00 .System/g DEO2
#af05 .System/b DEO2
( screen size )
#0140 .Screen/width DEO2
#0100 .Screen/height DEO2
( inital position )
#0020 .ball/x STZ2
#0020 .ball/y STZ2
( initial velocity )
#0003 .ball/vx STZ2
#0000 .ball/vy STZ2
( once )
make-shadow
draw-background
BRK
@on-frame ( -> )
( 12 frames animation )
.frame LDZk .direction LDZ ADD #0c DIVk MUL SUB SWP STZ
move-ball
BRK
(
@|core )
@flip-direction ( zp^ -- )
LDZ2k #ffff EOR2 INC2 ROT STZ2
JMP2r
@check-flip-vx ( x -- x )
( left ) DUP2 #0010 LTH2 ?&flip
( right ) DUP2 .Screen/width DEI2 #0050 SUB2 GTH2 ?&flip
JMP2r
&flip
.direction LDZk #0a EOR SWP STZ
.ball/vx !flip-direction
@check-flip-vy ( y -- y )
( bottom ) DUP2 .Screen/height DEI2 #0050 SUB2 GTH2 ?&flip !&else
&flip .ball/vy !flip-direction
&else
JMP2r
@move-ball ( -- )
( clear )
.ball/x LDZ2 .Screen/x DEO2
.ball/y LDZ2 .Screen/y DEO2
;fill-icn .Screen/addr DEO2
[ LIT2 71 -Screen/auto ] DEO
#f8
&loop-bg
[ LIT2 40 -Screen/sprite ] DEO
INC DUP ?&loop-bg
POP
[ LIT2 76 -Screen/auto ] DEO
.ball/vx LDZ2k STH2k ROT STZ2
.ball/x LDZ2k STH2r ADD2 check-flip-vx ROT STZ2
.timer LDZk INC DUP ROT STZ #06 EQU ?&pull
!&pass
&pull [ LIT2 00 -timer ] STZ .ball/vy LDZ2k INC2 STH2k ROT STZ2 !&end
&pass .ball/vy LDZ2k STH2k ROT STZ2 !&end
&end .ball/y LDZ2k STH2r ADD2 check-flip-vy ROT STZ2
@draw-ball ( -- )
( shadow )
.ball/x LDZ2 #0008 ADD2 .Screen/x DEO2
.ball/y LDZ2 #0008 ADD2 .Screen/y DEO2
;shadow .Screen/addr DEO2
[ LIT2 66 -Screen/auto ] DEO
#f9
&loop-shadow
[ LIT2 4f -Screen/sprite ] DEO
INC DUP ?&loop-shadow
POP
.frame LDZ
( bg )
DUP #06 DIV INC #05 MUL #40 ADD ,&bg STR
.ball/x LDZ2 .Screen/x DEO2
.ball/y LDZ2 .Screen/y DEO2
;bg .Screen/addr DEO2
[ LIT2 66 -Screen/auto ] DEO
#f9
&loop-bg
[ LIT2 &bg $1 -Screen/sprite ] DEO
INC DUP ?&loop-bg
POP
( fg )
DUP #06 DIV #00 EQU INC #05 MUL #40 ADD ,&fg STR
.ball/x LDZ2 .Screen/x DEO2
.ball/y LDZ2 .Screen/y DEO2
#06 DIVk MUL SUB #00 SWP #0188 MUL2 ;ball-icn ADD2 .Screen/addr DEO2
[ LIT2 66 -Screen/auto ] DEO
#f9
&loop-fg
[ LIT2 &fg $1 -Screen/sprite ] DEO
INC DUP ?&loop-fg
POP
JMP2r
@draw-background ( -- )
( hor lines )
[ LIT2 01 -Screen/auto ] DEO
;hor-icn .Screen/addr DEO2
.Screen/height DEI2 #04 SFT2 NIP #04 SUB #00
&horver
#0020 .Screen/x DEO2
#00 OVR #40 SFT2 #0020 ADD2 .Screen/y DEO2
.Screen/width DEI2 #03 SFT2 NIP #08 SUB #00
&horhor
[ LIT2 0f -Screen/sprite ] DEO
INC GTHk ?&horhor
POP2
INC GTHk ?&horver
POP2
( ver lines )
[ LIT2 02 -Screen/auto ] DEO
;ver-icn .Screen/addr DEO2
.Screen/width DEI2 #04 SFT2 NIP #03 SUB #00
&verver
#0027 .Screen/y DEO2
#00 OVR #40 SFT2 #0019 ADD2 .Screen/x DEO2
.Screen/height DEI2 #03 SFT2 NIP #0a SUB #00
&verhor
[ LIT2 0f -Screen/sprite ] DEO
INC GTHk ?&verhor
POP2
INC GTHk ?&verver
POP2
JMP2r
@make-shadow ( -- )
;bg ;shadow #0188 mcpy
#0188 #0000
&loop
DUP2 ;shadow ADD2 LDA2k #aa55 AND2 SWP2 STA2
INC2 INC2 GTH2k ?&loop
POP2 POP2
JMP2r
@mcpy ( src* dst* len* -- )
SWP2 STH2
OVR2 ADD2 SWP2
&loop
LDAk STH2kr STA INC2r
INC2 GTH2k ?&loop
POP2 POP2
POP2r
JMP2r
(
@|assets )
@fill-icn
ffff ffff ffff ffff
@hor-icn
0000 0000 0000 00ff
@ver-icn
0101 0101 0101 0101
@ball-icn ( 56 x 56 )
( 00 )
0000 0000 0000 0000 0000 0000 0304 0830 0000 073f 180c 1f3f 00f4 c103 070f bf8f
0040 0cfc e2c1 c1c1 0000 0000 80a0 e0e4 0000 0000 0000 0000 0000 0000 0101 0303
60c0 01e3 fbf0 f0e0 7fff fefe fc78 000f 8100 0000 0001 0103 8040 f8ff ffff ffff
f2f1 f9f8 1c00 0303 0000 8080 4020 b0e0 0707 0f1f 2720 2060 e0c0 c080 8000 e0fc
0f1f 1f3f 3f3f 7f7f e3ff f8f8 f8f0 f0f0 fefe 7e0e 0001 0103 0101 0101 01c1 f9fe
e0e0 e0f0 f0f0 f0f8 6060 4041 4141 0139 ffff ffff fefe fefe 7f0f 0100 0000 0000
e0e0 e000 3c3f 7f7f 0303 0707 0787 fff1 fefe fefc fcfc fcfc 1804 0606 0e0e 0e0e
3e1e 1e1e 1e0e 0f0f fe1c 0003 0303 0303 0000 0080 f1ff fefe 7fff ffff ffff 3f07
f0e0 e0e0 c0c0 8080 3800 070f 0f1f 1f3f 0e0c 0cfc e0c0 c080 0f09 0400 0001 0000
0303 c37b 3c3c 9e1e fcfc fcfc f818 040f 0000 0101 0303 078f 80e0 feff fffe fcf8
3f7f 7f3e 0603 070e 8000 0000 0000 0000 0000 0000 0000 0000 0e1e 0500 0000 0000
0f0f 0f4f 2703 0200 ffe1 c080 030f 1e00 f0e0 00f9 f8c0 0000 3c70 e0c0 0000 0000
0000 0000 0000 0000
( 01 )
0000 0000 0000 0000 0000 0000 0204 0800 0001 0f7c 101c 3fff 00e7 8307 0f3f ff0f
0040 0cdc c083 8101 0000 0000 80a0 c0e4 0000 0000 0000 0000 0000 0003 0103 0307
4183 07ef f3e0 e0c0 fefe fcf8 f070 181f 0101 0103 0303 0707 01c1 f9fe fefc fcfc
e2f3 f1f8 1804 0707 0000 0080 4060 b0c0 070f 3f1f 2721 0101 c080 8000 0000 e1fd
3f3f 7f7f ffff ffff eff3 f0e0 e0c0 c0c0 fcfc 7c0c 0607 0707 0303 0303 03c3 fbfc
c0e0 e0e4 e0e0 f0f0 4141 4343 4343 433b fefe fcfc fcfc f8f8 7f0f 0100 0000 0001
8080 80c0 fcff ffff 0f0f 0f1f 1f9f efc1 fcf8 f8f8 f8f8 f0f0 100c 0e0e 0e1e 1e1e
3c3c 3c1c 3c1e 0e0e f818 0407 0707 0707 0101 0383 f3f9 f8f8 ffff ffff ffff 3f06
c0c0 8080 0000 0000 3008 1f1f 3f3f 7f7f 1c1c 1cfc c0c4 8000 0e08 0400 0000 0000
0707 c7ff 7838 bc1c f8f8 f0f0 f010 1c1f 0103 0307 070f 0f9f 00e0 fefe fcf8 f0e0
7ffe fe3c 0407 0f1e 0000 0000 4000 0000 0000 0000 0000 0000 0c1e 0400 0000 0000
1f1f 1fdf 2607 0200 cfc1 8001 071f 1c00 e0c0 41fb f080 0000 38f0 e0c0 0000 0000
0000 0000 0000 0000
( 02 )
0000 0000 0000 0000 0000 0000 0000 0001 0001 1ff8 003c fefe 00e7 030f 3f7f 7f0e
0000 1cd8 8003 0303 0000 0000 80c0 c0c4 0000 0000 0000 0000 0000 0103 0307 070f
0307 0fff e3c0 c080 fcf8 f0f0 e040 787f 0203 0707 0f0f 1f1f 03c3 fbf8 f8f8 f8f8
e6e3 e1f1 100c 0f0f 0000 0080 c060 e0c0 0f1f 3f3e 0403 0303 8000 0001 0103 e3fb
7fff ffff ffff ffff ffc3 c080 8080 0000 f8f0 7000 0e1f 1f1f 0f0f 0707 07c7 fff0
c8c0 c0c4 e0e0 e0e2 0303 0707 0707 477f f8f8 f8f8 f0f0 f0f0 7f0e 0001 0303 0307
0000 00c0 fcff ffff 1f3f 3f3f 7fff 8f01 f0f0 f0f0 e0e0 e0e0 001c 1e1e 1e1c 3c3c
7838 3838 3c1c 1c1c f000 1c1f 1f1f 0f0f 0707 078f fff1 f0e0 ffff fefe fefc 3c00
0000 0000 0000 0001 2038 3f7f 7fff fffe 3c3c 3cdc 8004 0800 0c00 0100 0000 0000
0f0f cff7 7078 3818 e0e0 e0e0 e020 3c3f 0707 0f0f 1f1f 3fbf 01e1 fdf8 f0f0 e0c0
fefc fc38 000f 1e3c 1000 2000 4000 0000 0000 0000 0000 0000 1c1c 0400 0000 0000
3f3f 3ffe 6407 0300 8f01 0103 0f3f 1800 8080 c3ff e008 0000 78f0 c080 0000 0000
0000 0000 0000 0000
( 03 )
0000 0000 0000 0000 0000 0000 0000 0003 0001 1ef0 207d fcf8 00c7 071f 7ffe 7c0c
0080 1c9a 0407 0707 0000 0000 80c0 80cc 0000 0000 0000 0000 0000 0103 0307 070f
070f 1fdf c380 8001 f8f0 e0c0 8080 f8ff 060f 0f1f 1f3f 3f7f 07c7 f7f0 f0f0 e0e0
c6c2 e3e1 001c 1f1f 0000 0080 c0c0 e080 0f1e 3c3c 0007 0707 0101 0303 0707 eff3
ffff ffff fefe fcfc 9f03 0000 0000 0000 e0e0 6030 3e3f 7f7f 1f1f 1f1f 1fdf e7e0
8888 80c4 c4c0 c0c2 0707 070f 0f0f 4f77 f0f0 e0e0 e0e0 e0c0 7c08 0607 070f 0f0f
0000 00c0 fcfe fefe 7fff ffff ff7f 0f01 e0e0 c0c0 c0c0 8080 223c 3c3c 3c3c 7c7c
7030 3838 3818 181c c020 3c3f 3f3f 3f3f 1f1f 1f9f cfc1 c0c0 fcfc fcf8 f8f0 3008
0000 0000 0101 0303 4078 ffff fffe fefc 7c7c 7818 0404 0810 0c02 0101 0000 0000
1f1f dfe7 e070 3038 c0c0 c080 8060 7c7f 1f1f 3f3f 3f7f 7f7f 07e7 f1f0 e0c0 8080
fcf8 f830 081f 3e7c 1020 2040 4080 0000 0000 0000 0000 0000 181c 0200 0000 0000
7f7e 3efc 440f 0100 0f00 030f 1f3e 1800 0003 c7f7 c108 0000 f8e0 c080 0000 0000
0000 0000 0000 0000
( 04 )
0000 0000 0000 0000 0000 0000 0000 0103 0001 1ce0 60ff f8f0 0087 0f3f fefc 7800
0080 3c1a 0d0f 0f0f 0000 0000 8040 808c 0000 0000 0000 0000 0000 0103 0307 070e
0f1f 3f9f 8301 0103 e0c0 8000 0080 f8fe 0e1f 3f3f 7f7f ffff 0fdf e7e0 c0c0 c0c0
8686 c3c3 213c 3f3f 0000 0080 c0c0 6000 0e1c 3c38 000f 0f0f 0307 070f 0f1f ffe3
fefe fcfc f8f8 f8f0 1f03 0000 0000 0001 8080 0070 feff ffff 3f3f 3f3f 3fff c780
0808 8884 8484 8482 0f0f 0f0f 1f1f 5f67 c0c0 c0c0 c080 8080 7000 1e1f 1f1f 3f3f
0101 03c3 fff8 f8f8 ffff ffff ff7f 0f01 8080 8080 0000 0000 627e 7c7c 7cfc f8f8
6030 3030 3018 1818 8060 7c7f 7f7f 7f7f 3f7f 7fff 8f81 8080 f0f0 f0e0 e0e0 0038
0101 0303 0307 070f c0f8 fffe fefc fcf8 f8f8 f818 040c 1810 0802 0301 0000 0000
3f3f ffc7 e060 7030 0000 0000 00e0 fdfe 3f7f 7fff ffff ff7e 0fff e1c0 8080 0001
f8f0 f020 387f fcf8 3020 6040 c080 0000 0000 0000 0000 0000 1818 0200 0000 0000
7c7c 7cb8 400f 0100 0e02 0f1f 3f7c d000 0307 cfe7 0318 8000 f0e0 c000 0000 0000
0000 0000 0000 0000
( 05 )
0000 0000 0000 0000 0000 0000 0001 0307 0001 18c0 e1fb f0e0 0087 1f7e fcf8 7010
0080 7012 0d1f 1f1f 0000 0000 0040 100c 0000 0000 0000 0000 0000 0103 0306 060c
0f3f 7f9e 0003 0707 c080 0000 0081 fbfc 3e7f 7fff ffff ffff 3fff c780 8080 0000
0c86 8783 637d 7e7e 0000 0080 80c0 6010 0c18 3830 080f 0f1f 0f0f 1f1f 3f3f 9f83
f8f8 f8f0 f0e0 e0e0 1f02 0101 0303 0307 0000 80f0 feff ffff 7e7f 7f7f 7f3f 0700
1808 080c 0c04 0406 1f1f 1f1f 1f1f 7f67 8080 8080 0000 0000 4030 3e7f 7f7f 7fff
0707 0fcf f3f0 e0e0 fffe fefe fe7c 0c02 0000 0000 0101 0101 e6fe f8f8 f8f8 f8f8
6020 2030 3010 1018 00e0 fcfe fefe fe7e ffff ff7f 0f01 0000 e0c0 c0c0 8080 40f8
0707 070f 0f1f 1f1f c1f9 fcfc f8f8 f0f0 f8f0 f010 0c1c 1830 0806 0301 0100 0000
7e7e bec6 c1e1 6130 0000 0101 01e3 fffc ffff ffff fffe fe7c 3fdf 8100 0000 0103
e0e0 c000 79fe fcf0 3060 60c0 c080 0000 0000 0000 0000 0000 3008 0200 0000 0000
f8f8 f8b0 480e 0100 080e 1f3f 7ef8 e100 070f df87 0318 8000 e0c0 8000 0000 0000
0000 0000 0000 0000
@bg
0000 0000 0000 0000 0000 0000 0307 0f3f
0001 1fff ffff ffff 00ff ffff ffff ffff
00c0 fcfe ffff ffff 0000 0000 80e0 f8fc
0000 0000 0000 0000 0000 0103 0307 070f
7fff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
feff ffff ffff ffff 0000 8080 c0e0 f0f0
0f1f 3f3f 3f3f 7f7f ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
f8f8 f8fc fcfc fcfe 7f7f 7f7f 7f7f 7f7f
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff fefe fefe fefe fefe
7f3f 3f3f 3f1f 1f1f ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
fefe fcfc fcfc f8f0 0f0f 0703 0101 0000
ffff ffff ffff ff7f ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff fffe f0e0 e0c0 c080 0000
0000 0000 0000 0000 3f1f 0701 0000 0000
ffff ffff 7f3f 0300 ffff ffff ffff ff00
ffff ffff fff8 8000 fcf0 e0c0 0000 0000
0000 0000 0000 0000
@shadow $0188

View File

@ -1,102 +0,0 @@
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( vectors )
|0100 @reset
(
Set the log level for helping to debug stuff.
Its value is the bitwise OR of all the following output types:
#01 prints the number of lines in the source code,
#04 dumps all defined labels at end, and
#08 prints the heap usage.
)
#0d ;asma/log-level STA
;asma-heap ;heap STA2
(
Assemble the source code into an output ROM file.
If all you want is to use asma.tal to assemble files, insert a BRK
after this statement.
)
;&source-file ;&dest-file ;asma-assemble-file JSR2
(
If an error has occurred, BRK here, otherwise continue. (The error
message will already have been printed to the Console in
asma-assemble-file.)
)
;asma/error LDA2 #0000 EQU2 JMP BRK
(
Load the output ROM over the currently running program, almost as if
we loaded the ROM with uxnemu directly!
It's not a totally pristine environment, as File/read doesn't zero out
memory beyond the end of the file. So if the assembled program assumes
that all memory above it is zero, it may misbehave.
Asma itself doesn't use the zero page, but this example code writes a
DEO2 instruction to 0x00ff. In order to execute File/read and have the
CPU continue at memory location 0x0100, we write the final DEO2
instruction there and jump there as our final act.
Just in case the assembled code is zero-length (which can occur when
assembling an empty source file), we write a BRK to the reset vector so
that will prevent an infinite loop.
)
;&dest-file .File/name DEO2
#ff00 .File/length DEO2
#0100 .File/read
LIT DEO2 #00ff STA
LIT BRK #0100 STA
#00ff JMP2
&source-file
"projects/examples/demos/piano.tal 00
&dest-file
"bin/asma-boot.rom 00
~projects/library/asma.tal
(
Heap, a large temporary area for keeping track of labels. More complex
programs need more of this space. If there's insufficient space then the
assembly process will fail, but having extra space above what the most
complex program needs provides no benefit.
This heap, and the buffers below, are free to be used to hold temporary
data between assembly runs, and do not need to be initialized with any
particular contents to use the assembler.
)
@asma-heap
|e000 &end
(
Buffer for use with loading source code.
The minimum size is the length of the longest token plus one, which is
0x21 to keep the same capability of the C assembler.
Larger sizes are more efficient, provided there is enough
heap space to keep track of all the labels.
)
@asma-read-buffer
|f800 &end
(
Buffer for use with writing output.
The minimum size is 1, and larger sizes are more efficient.
)
@asma-write-buffer
|ffff &end

View File

@ -1,119 +0,0 @@
( Project by Alex Schroeder - https://alexschroeder.ch )
%RTN { JMP2r }
%INCR { SWP INC SWP }
%CELL { #1000 }
%NEXT { #2000 }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
|0000
( program )
@seed [ &x $1 &w $2 &s $2 ]
|0100 ( -> )
( theme )
#2aac .System/r DEO2
#269b .System/g DEO2
#378d .System/b DEO2
;seed-line JSR2
( run for a few generations )
#00 #ff
&loop
OVR #00 SWP ;print-line JSR2
;compute-next JSR2
;copy-next JSR2
( incr ) INCR
( loop ) LTHk ,&loop JCN
POP2
BRK
@print-line ( y -- )
( set ) .Screen/y DEO2
( loop through cells )
#00 #ff
&loop
( copy ) OVR #00 SWP DUP2
( pos ) .Screen/x DEO2
( addr ) CELL ADD2
( draw ) LDA .Screen/pixel DEO
( incr ) INCR
( loop ) LTHk ,&loop JCN
POP2
RTN
@compute-next ( -- )
( loop through 62 cells )
#01 #fe
&loop
OVR DUP DUP ( three copies of the counter )
#01 SUB #00 SWP CELL ADD2 LDA
SWP
INC #00 SWP CELL ADD2 LDA
( the cell dies if the neighbors are either both dead or both alive, i.e. Rule 90 )
NEQ
( one copy of the counter and the life value )
SWP #00 SWP NEXT ADD2 STA
( incr ) INCR
( loop ) LTHk ,&loop JCN
POP2
RTN
@copy-next ( -- )
( loop through cells )
#00 #ff
&loop
OVR DUP ( two copies of the counter )
#00 SWP NEXT ADD2 LDA ( one copy of the counter and the value )
SWP #00 SWP CELL ADD2 STA
( incr ) INCR
( loop ) LTHk ,&loop JCN
POP2
RTN
@seed-line ( -- )
.DateTime/second DEI .seed/x STZ
#0000 .seed/w STZ2
#e2a9 .seed/s STZ2
( loop through cells )
#01 #fe
&loop
OVR ( one copy of the counter )
;rand JSR2
#10 AND ( pick a bit )
SWP #00 SWP CELL ADD2 STA
( incr ) INCR
( loop ) LTHk ,&loop JCN
POP2
RTN
( https://en.wikipedia.org/wiki/Middle-square_method )
@rand ( -- 1 )
.seed/x LDZ #00 SWP DUP2 MUL2
.seed/w LDZ2 .seed/s LDZ2 ADD2
DUP2 .seed/w STZ2
ADD2
#04 SFT SWP #40 SFT ADD
DUP .seed/x STZ
RTN

View File

@ -1,185 +1,126 @@
(
Bifurcan
Every second, the Labyrinth reorganize itself to display the time.
)
( Bifurcan )
%RTN { JMP2r }
%MOD { DUP2 DIV MUL SUB }
%TOS { #00 SWP }
%2// { #01 SFT2 }
%8** { #30 SFT2 }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
( variables )
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
|80 @Controller &vector $2 &button $1 &key $1
|0000
@last $1
@style $1
@pointer [ &x $2 &y $2 ]
@center [ &x $2 &y $2 ]
@anchor [ &x $2 &y $2 ]
@last $1
@style $1
@center &x $2 &y $2
( program )
|0100
|0100 ( -> )
( theme )
#0f3a .System/r DEO2
#0fda .System/g DEO2
@on-reset ( -> )
( | theme )
#0f3a .System/r DEO2
#0fda .System/g DEO2
#0faa .System/b DEO2
( vectors )
( | vectors )
;on-frame .Screen/vector DEO2
;on-mouse .Mouse/vector DEO2
;on-button .Controller/vector DEO2
( find center )
.Screen/width DEI2 2// .center/x STZ2
.Screen/height DEI2 2// .center/y STZ2
( background )
;tiles ;cover-pattern JSR2
;redraw JSR2
BRK
( | find center )
.Screen/width DEI2 #01 SFT2 .center/x STZ2
.Screen/height DEI2 #01 SFT2 .center/y STZ2
( | background )
;tiles <cover-pattern>
<redraw>
BRK
@on-frame ( -> )
( only draw once per second )
.DateTime/second DEI .last LDZ NEQ #01 JCN [ BRK ]
.DateTime/second DEI .last STZ
;redraw JSR2
BRK
( | only draw once per second )
.DateTime/second DEI .last LDZ NEQk ?{ POP2 BRK }
.last STZ
POP <redraw>
BRK
@on-mouse ( -> )
;draw-cursor JSR2
.Mouse/state DEI #00 EQU ,&no-touch JCN
( incr ) .style LDZ INC #03 MOD .style STZ
( bg ) ;tiles .style LDZ #40 SFT TOS ADD2 ;cover-pattern JSR2
( fg ) ;redraw JSR2
( release ) #00 .Mouse/state DEO
&no-touch
BRK
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;cursor-icn <update-cursor>
.Mouse/state DEI ?{ BRK }
select [ LIT2 00 -Mouse/state ] DEO
BRK
@on-button ( -> )
.Controller/button DEI #00 EQU ,&no-touch JCN
( incr ) .style LDZ INC #03 MOD .style STZ
( bg ) ;tiles .style LDZ #40 SFT TOS ADD2 ;cover-pattern JSR2
( fg ) ;redraw JSR2
( release ) #00 .Mouse/state DEO
&no-touch
BRK
.Controller/button DEI ?{ BRK }
select [ LIT2 00 -Controller/button ] DEO
BRK
@redraw ( -- )
( hrs )
[ .center/x LDZ2 #0018 SUB2 ]
[ .center/y LDZ2 #0048 SUB2 ]
.DateTime/hour DEI #0a DIV ;draw-number JSR2
[ .center/x LDZ2 #0008 ADD2 ]
[ .center/y LDZ2 #0048 SUB2 ]
.DateTime/hour DEI #0a MOD ;draw-number JSR2
( min )
[ .center/x LDZ2 #0018 SUB2 ]
[ .center/y LDZ2 #0018 SUB2 ]
.DateTime/minute DEI #0a DIV ;draw-number JSR2
[ .center/x LDZ2 #0008 ADD2 ]
[ .center/y LDZ2 #0018 SUB2 ]
.DateTime/minute DEI #0a MOD ;draw-number JSR2
( sec )
[ .center/x LDZ2 #0018 SUB2 ]
[ .center/y LDZ2 #0018 ADD2 ]
.DateTime/second DEI #0a DIV
;draw-number JSR2
[ .center/x LDZ2 #0008 ADD2 ]
[ .center/y LDZ2 #0018 ADD2 ]
.DateTime/second DEI #0a MOD
;draw-number JSR2
@select ( -- )
.style LDZ INC #03 DIVk MUL SUB .style STZ
;tiles [ LIT2 00 -style ] LDZ #40 SFT ADD2 <cover-pattern>
( >> )
RTN
@<redraw> ( -- )
( | hrs )
[ .center/x LDZ2 #0018 SUB2 ] [ .center/y LDZ2 #0048 SUB2 ] .DateTime/hour DEI #0a DIV <draw-number>
[ .center/x LDZ2 #0008 ADD2 ] [ .center/y LDZ2 #0048 SUB2 ] .DateTime/hour DEI #0a DIVk MUL SUB <draw-number>
( | min )
[ .center/x LDZ2 #0018 SUB2 ] [ .center/y LDZ2 #0018 SUB2 ] .DateTime/minute DEI #0a DIV <draw-number>
[ .center/x LDZ2 #0008 ADD2 ] [ .center/y LDZ2 #0018 SUB2 ] .DateTime/minute DEI #0a DIVk MUL SUB <draw-number>
( | sec )
[ .center/x LDZ2 #0018 SUB2 ] [ .center/y LDZ2 #0018 ADD2 ] .DateTime/second DEI #0a DIV <draw-number>
[ .center/x LDZ2 #0008 ADD2 ] [ .center/y LDZ2 #0018 ADD2 ] .DateTime/second DEI #0a DIVk MUL SUB
@draw-number ( x* y* n -- )
STH
( save pos ) .anchor/y STZ2 .anchor/x STZ2
#00 #0f
&loop
( save-x ) OVR #03 MOD TOS 8** .anchor/x LDZ2 ADD2 .Screen/x DEO2
( save-y ) OVR #03 DIV TOS 8** .anchor/y LDZ2 ADD2 .Screen/y DEO2
( get digit* ) OVR STHkr DUP ADD TOS ;digits ADD2 LDA2
( get bit ) ROT #0e SWP SUB SFT2 #0001 AND2
( set tile ) 8** ;tiles ADD2
( set style ) .style LDZ #40 SFT TOS ADD2
.Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO
( incr ) SWP INC SWP
LTHk ,&loop JCN
POP2
POPr
@<draw-number> ( x* y* n -- )
,&digit STR
,&y STR2
,&x STR2
#0f00
&loop ( -- )
( save-x ) DUP #03 DIVk MUL SUB #00 SWP #30 SFT2 [ LIT2 &x $2 ] ADD2 .Screen/x DEO2
( save-y ) DUP #03 DIV #00 SWP #30 SFT2 [ LIT2 &y $2 ] ADD2 .Screen/y DEO2
( get digit* ) DUP [ LIT &digit $1 ] DUP ADD #00 SWP ;digits ADD2 LDA2
( get bit ) ROT #0e SWP SUB SFT2 #0001 AND2
( set tile ) #30 SFT2 ;tiles ADD2
( set style ) .style LDZ #40 SFT #00 SWP ADD2 .Screen/addr DEO2
( draw ) [ LIT2 01 -Screen/sprite ] DEO
INC GTHk ?&loop
POP2 JMP2r
RTN
@<cover-pattern> ( addr* -- )
.Screen/addr DEO2
.Screen/height DEI2 #03 SFT2 ,&h STR POP
.Screen/width DEI2 #03 SFT2 ,&w STR POP
[ LIT &h $1 ] #00
&ver ( -- )
#00 OVR #30 SFT2 .Screen/y DEO2
[ LIT &w $1 ] #00
&hor ( -- )
#00 OVR #30 SFT2 .Screen/x DEO2
[ LIT2 01 -Screen/sprite ] DEO
INC GTHk ?&hor
POP2 INC GTHk ?&ver
POP2 JMP2r
@cover-pattern ( addr* -- )
( load ) .Screen/addr DEO2
#0000 .Screen/height DEI2
&ver
( save ) OVR2 .Screen/y DEO2
#0000 .Screen/width DEI2
&hor
( save ) OVR2 .Screen/x DEO2
( draw ) #01 .Screen/sprite DEO
( incr ) SWP2 #0008 ADD2 SWP2
LTH2k ,&hor JCN
POP2 POP2
( incr ) SWP2 #0008 ADD2 SWP2
LTH2k ,&ver JCN
POP2 POP2
@<update-cursor> ( color addr* -- )
[ LIT2 00 -Screen/auto ] DEO
;fill-icn .Screen/addr DEO2
#40 <draw-cursor>
.Mouse/x DEI2 ,<draw-cursor>/x STR2
.Mouse/y DEI2 ,<draw-cursor>/y STR2
.Screen/addr DEO2
( >> )
RTN
@<draw-cursor> ( color -- )
[ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 &y $2 ] .Screen/y DEO2
.Screen/sprite DEO
JMP2r
@draw-cursor ( -- )
( clear last cursor )
;cursor .Screen/addr DEO2
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
#40 .Screen/sprite DEO
( record pointer positions )
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
( colorize on state )
#41 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/sprite DEO
@cursor-icn [ 80c0 e0f0 f8e0 1000 ]
RTN
@cursor [
80c0 e0f0 f8e0 1000 ]
@fill-icn [ ffff ffff ffff ffff ]
@digits [
7b6f 2492 73e7 73cf
5bc9 79cf 49ef 7249
7b6f 2492 73e7 73cf 5bc9 79cf 49ef 7249
7bef 7bc9 ]
@tiles [
0102 0408 1020 4080
8040 2010 0804 0201
0718 2040 4080 8080
0101 0102 0204 18e0
0808 0810 e304 0808
0808 0804 e310 0808 ]
0102 0408 1020 4080 8040 2010 0804 0201
0718 2040 4080 8080 0101 0102 0204 18e0
0808 0810 e304 0808 0808 0804 e310 0808 ]

View File

@ -1,31 +1,4 @@
( a blank file )
%+ { ADD } %- { SUB } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%2* { #10 SFT } %2/ { #01 SFT }
%4* { #20 SFT } %4/ { #02 SFT }
%8* { #30 SFT } %8/ { #03 SFT }
%10* { #40 SFT } %10/ { #04 SFT }
%20* { #50 SFT } %20/ { #05 SFT }
%2** { #10 SFT2 } %2// { #01 SFT2 }
%4** { #20 SFT2 } %4// { #02 SFT2 }
%8** { #30 SFT2 } %8// { #03 SFT2 }
%10** { #40 SFT2 } %10// { #04 SFT2 }
%20** { #50 SFT2 } %20// { #05 SFT2 }
%RELEASE-MOUSE { #0096 DEO }
%AUTO-X { #01 .Screen/auto DEO }
%AUTO-X-ADDR { #05 .Screen/auto DEO }
%AUTO-NONE { #00 .Screen/auto DEO }
%RTN { JMP2r }
%TOS { #00 SWP }
( devices )
( bitwise )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
@ -37,7 +10,7 @@
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
|c0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
( variables )
@ -63,13 +36,13 @@
;on-mouse .Mouse/vector DEO2
.Screen/width DEI2 2//
DUP2 #0040 -- .a-frame/x STZ2 DUP2 #0040 ++ .a-frame/x2 STZ2
DUP2 #0040 -- .b-frame/x STZ2 #0040 ++ .b-frame/x2 STZ2
.Screen/width DEI2 #01 SFT2
DUP2 #0040 SUB2 .a-frame/x STZ2 DUP2 #0040 ADD2 .a-frame/x2 STZ2
DUP2 #0040 SUB2 .b-frame/x STZ2 #0040 ADD2 .b-frame/x2 STZ2
.Screen/height DEI2 2// #0020 --
DUP2 #0010 -- .a-frame/y STZ2 DUP2 #0000 ++ .a-frame/y2 STZ2
DUP2 .b-frame/y STZ2 #0010 ++ .b-frame/y2 STZ2
.Screen/height DEI2 #01 SFT2 #0020 SUB2
DUP2 #0010 SUB2 .a-frame/y STZ2 DUP2 .a-frame/y2 STZ2
DUP2 .b-frame/y STZ2 #0010 ADD2 .b-frame/y2 STZ2
;redraw JSR2
@ -79,7 +52,7 @@ BRK
;draw-cursor JSR2
.Mouse/state DEI #00 ! JMP [ BRK ]
.Mouse/state DEI #00 NEQ JMP [ BRK ]
.Mouse/x DEI2 .Mouse/y DEI2 .a-frame ;within-rect JSR2
;on-touch-a JCN2
@ -90,29 +63,29 @@ BRK
@on-touch-a ( -> )
.Mouse/x DEI2 .a-frame/x LDZ2 --
10// NIP #07 SWP - STH
.Mouse/x DEI2 .a-frame/x LDZ2 SUB2
#04 SFT2 NIP #07 SWP SUB STH
.input/a LDZ
#01 [ STHr #40 SFT ] SFT EOR
.input/a STZ
;redraw JSR2
RELEASE-MOUSE
#00 .Mouse/state DEO
BRK
@on-touch-b ( -> )
.Mouse/x DEI2 .b-frame/x LDZ2 --
10// NIP #07 SWP - STH
.Mouse/x DEI2 .b-frame/x LDZ2 SUB2
#04 SFT2 NIP #07 SWP SUB STH
.input/b LDZ
#01 [ STHr #40 SFT ] SFT EOR
.input/b STZ
;redraw JSR2
RELEASE-MOUSE
#00 .Mouse/state DEO
BRK
@ -127,82 +100,82 @@ BRK
.input/b LDZ #01 ;draw-byte JSR2
.b-frame/x LDZ2 .Screen/x DEO2
.Screen/y DEI2 #000d ++ .Screen/y DEO2
.Screen/y DEI2 #000d ADD2 .Screen/y DEO2
.input LDZ2 AND #03 ;draw-byte JSR2
.b-frame/x LDZ2 .Screen/x DEO2
.Screen/y DEI2 #000d ++ .Screen/y DEO2
.Screen/y DEI2 #000d ADD2 .Screen/y DEO2
.input LDZ2 ORA #03 ;draw-byte JSR2
.b-frame/x LDZ2 .Screen/x DEO2
.Screen/y DEI2 #000d ++ .Screen/y DEO2
.Screen/y DEI2 #000d ADD2 .Screen/y DEO2
.input LDZ2 EOR #03 ;draw-byte JSR2
( labels )
AUTO-X-ADDR
.b-frame/x LDZ2 #0020 -- .Screen/x DEO2
#05 .Screen/auto DEO
.b-frame/x LDZ2 #0020 SUB2 .Screen/x DEO2
;names-icn/and .Screen/addr DEO2
.b-frame/y2 LDZ2 #0004 ++ .Screen/y DEO2
.b-frame/y2 LDZ2 #0004 ADD2 .Screen/y DEO2
,&draw-label JSR
.b-frame/y2 LDZ2 #0014 ++ .Screen/y DEO2
.b-frame/y2 LDZ2 #0014 ADD2 .Screen/y DEO2
,&draw-label JSR
.b-frame/y2 LDZ2 #0024 ++ .Screen/y DEO2
.b-frame/y2 LDZ2 #0024 ADD2 .Screen/y DEO2
,&draw-label JSR
AUTO-NONE
#00 .Screen/auto DEO
RTN
JMP2r
&draw-label
.b-frame/x LDZ2 #0020 -- .Screen/x DEO2
.b-frame/x LDZ2 #0020 SUB2 .Screen/x DEO2
#03 .Screen/sprite DEOk DEOk DEO
RTN
JMP2r
@draw-byte ( value -- )
STH STH
#0800
&loop
DUP #07 SWP -
#07 OVR SUB
STHkr SWP SFT #01 AND OVRr STHr ;draw-bit JSR2
INC GTHk ,&loop JCN
POP2
.Screen/y DEI2 #0003 ++ .Screen/y DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
.Screen/y DEI2 #0003 ADD2 .Screen/y DEO2
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
STHr ;draw-hex JSR2
POPr
RTN
JMP2r
@draw-bit ( value color -- )
STH STH
AUTO-X-ADDR
;button-icns/off [ #00 STHkr 20* ++ ] .Screen/addr DEO2
#05 .Screen/auto DEO
;button-icns/off [ #00 STHkr #50 SFT ADD2 ] .Screen/addr DEO2
OVRr STHr .Screen/sprite DEO
OVRr STHr .Screen/sprite DEO
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
.Screen/x DEI2 #0010 -- .Screen/x DEO2
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
.Screen/x DEI2 #0010 SUB2 .Screen/x DEO2
OVRr STHr .Screen/sprite DEO
OVRr STHr .Screen/sprite DEO
AUTO-NONE
.Screen/y DEI2 #0008 -- .Screen/y DEO2
#00 .Screen/auto DEO
.Screen/y DEI2 #0008 SUB2 .Screen/y DEO2
POPr POPr
POP2r
RTN
JMP2r
@draw-hex ( value -- )
AUTO-X
#01 .Screen/auto DEO
DUP #04 SFT ,&draw JSR
#0f AND ,&draw JSR
AUTO-X
#01 .Screen/auto DEO
RTN
JMP2r
&draw
TOS 8** ;font-hex ++ .Screen/addr DEO2
#00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO
RTN
JMP2r
@draw-cursor ( -- )
@ -215,26 +188,26 @@ RTN
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
( colorize on state )
#42 [ .Mouse/state DEI #00 ! ] + .Screen/sprite DEO
#42 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/sprite DEO
RTN
JMP2r
@within-rect ( x* y* rect -- flag )
STH
( y < rect.y1 ) DUP2 STHkr #02 ADD LDZ2 LTH2 ,&skip JCN
( y < rect.y1 ) DUP2 STHkr INC INC LDZ2 LTH2 ,&skip JCN
( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN
SWP2
( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN
( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN
POP2 POP2 POPr
#01
RTN
JMP2r
&skip
POP2 POP2 POPr
#00
RTN
JMP2r
@cursor
80c0 e0f0 f8e0 1000

View File

@ -0,0 +1,221 @@
( bunnymark.tal )
( November 2021, Kira Oakley )
( March 2022, Devine Lu Linvega )
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
|0000
@frames $2
@last $1
|0100
@on-reset ( -> )
( | theme )
#2ce9 .System/r DEO2
#01c0 .System/g DEO2
#2ce5 .System/b DEO2
( | interrupts )
;on-frame .Screen/vector DEO2
( | fps label )
.Screen/width DEI2 #0046 SUB2 .Screen/x DEO2
#0008 .Screen/y DEO2
;text/fps #42 <draw-str>
( | bunnies label )
#0004 .Screen/x DEO2
;text/bunnies #42 <draw-str>
( | instructions label )
.Screen/width DEI2 #01 SFT2 #0050 SUB2 .Screen/x DEO2
;text/instructions #43 <draw-str>
#0028 #0008 #0000 <draw-dec>
( | seed prng )
prng-init BRK
@on-frame ( -> )
.frames LDZ2k INC2 ROT STZ2
.DateTime/second DEI .last LDZ EQU ?{
.DateTime/second DEI .last STZ
.Screen/width DEI2 #002b SUB2 #0008 .frames LDZ2 <draw-dec>
#0000 .frames STZ2 }
( | mouse handling )
.Mouse/state DEI
( ) DUP #01 NEQ ?{ add-bunny }
( ) #02 LTH ?{ remove-bunny }
( | controller handling )
.Controller/button DEI
( ) DUP #01 NEQ ?{ add-bunny }
( ) #02 LTH ?{ remove-bunny }
( | clear )
#0000 DUP2 .Screen/x DEO2
.Screen/y DEO2
[ LIT2 80 -Screen/pixel ] DEO
;sprite/length LDA2 #0000
&loop ( -- )
EQU2k ?&bail
DUP2 <draw-bunny>
INC2 !&loop
&bail ( -- )
POP2 POP2 BRK
@add-bunny ( -- )
;sprite/length LDA2
( | cap bunny count at 65535 )
DUP2 #ffff EQU2 ?&bail
( | compute the offset to the beginning of this new bunny's data )
DUP2 #30 SFT2 ;sprite/array ADD2
( | populate the new bunny's x/y/xvel/yvel with random values )
#00 rand OVR2 STA2
rand #1f AND rand OVR2 INC2 INC2 STA2
#00 rand #7f AND OVR2 #0004 ADD2 STA2
#00 rand #7f AND OVR2 #0006 ADD2 STA2
( | pop ptr to bunny data )
POP2
( | write new increased array length )
INC2 DUP2 ;sprite/length STA2
( | update label )
STH2k #0028 #0008 STH2r <draw-dec>
&bail ( pop sprite/length )
POP2 JMP2r
@remove-bunny ( -- )
;sprite/length LDA2
( don't let length go below 0 ) ORAk #00 EQU ?&bail
#0001 SUB2 DUP2 ;sprite/length STA2
( update label ) STH2k #0028 #0008 STH2r <draw-dec>
&bail POP2 JMP2r
(
@|drawing )
@<draw-bunny> ( idx -- )
( | compute the offset to the beginning of this bunny's data )
#30 SFT2 ;sprite/array ADD2
( | move the sprite by its velocity )
LDA2k OVR2 #0004 ADD2 LDA2 ADD2 OVR2 STA2
INC2k INC2 LDA2 OVR2 #0006 ADD2 LDA2 ADD2 OVR2 INC2 INC2 STA2
( | check for right wall collision + bounce x )
DUP2 #0004 ADD2 LDA2 #0f SFT2 #0001 EQU2 ?&skip-max-x
LDA2k #05 SFT2 #0008 ADD2 .Screen/width DEI2 LTH2 ?&skip-max-x
DUP2 #0004 ADD2 LDA2 #ffff MUL2 OVR2 #0004 ADD2 STA2
&skip-max-x ( check for left wall collision + bounce x )
LDA2k #0f SFT2 #0000 EQU2 ?&skip-min-x
DUP2 #0004 ADD2 LDA2 #ffff MUL2 OVR2 #0004 ADD2 STA2
&skip-min-x ( check for bottom wall collision + bounce y )
DUP2 #0006 ADD2 LDA2 #0f SFT2 #0001 EQU2 ?&skip-max-y
INC2k INC2 LDA2 #05 SFT2 #0010 ADD2 .Screen/height DEI2 LTH2 ?&skip-max-y
DUP2 #0006 ADD2 LDA2 #ffff MUL2 OVR2 #0006 ADD2 STA2
!&skip-gravity
&skip-max-y ( check for top wall collision + bounce x )
INC2k INC2 LDA2 #0f SFT2 #0000 EQU2 ?&skip-min-y
DUP2 #0006 ADD2 LDA2 #ffff MUL2 OVR2 #0006 ADD2 STA2
!&skip-gravity
&skip-min-y ( apply gravity )
DUP2 #0006 ADD2 LDA2 #0004 ADD2 OVR2 #0006 ADD2 STA2
&skip-gravity ( draw the sprite )
( top ) LDA2k #05 SFT2 .Screen/x DEO2
INC2 INC2 LDA2 #05 SFT2 .Screen/y DEO2
( draw ) [ LIT2 15 -Screen/auto ] DEO
;bunny-chr .Screen/addr DEO2
[ LIT2 85 -Screen/sprite ] DEO
[ LIT2 00 -Screen/auto ] DEO
JMP2r
@<draw-str> ( x* y* text* color -- )
,&t STR
[ LIT2 01 -Screen/auto ] DEO
&loop ( -- )
LDAk #20 SUB #00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2
[ LIT2 &t $1 -Screen/sprite ] DEO
INC2 LDAk ?&loop
POP2 JMP2r
@<draw-dec> ( x* y* num* -- )
[ LIT2 01 -Screen/auto ] DEO
SWP2 .Screen/y DEO2
SWP2 .Screen/x DEO2
#2710 DIV2k DUP <draw-digit>
MUL2 SUB2 #03e8 DIV2k DUP <draw-digit>
MUL2 SUB2 #0064 DIV2k DUP <draw-digit>
MUL2 SUB2 NIP #0a DIVk DUP <draw-digit>
MUL SUB <draw-digit>
[ LIT2 00 -Screen/auto ] DEO
JMP2r
@<draw-digit> ( num -- )
#30 SFT #00 SWP ;font/num ADD2 .Screen/addr DEO2
[ LIT2 41 -Screen/sprite ] DEO
JMP2r
(
@|random )
@prng-init ( -- )
[ LIT2 00 -DateTime/second ] DEI [ LIT2 00 -DateTime/minute ] DEI #60 SFT2 EOR2 [ LIT2 00 -DateTime/hour ] DEI #c0 SFT2 EOR2 ,prng/x STR2
[ LIT2 00 -DateTime/hour ] DEI #04 SFT2 [ LIT2 00 -DateTime/day ] DEI #10 SFT2 EOR2 [ LIT2 00 -DateTime/month ] DEI #60 SFT2 EOR2 .DateTime/year DEI2 #a0 SFT2 EOR2 ,prng/y STR2
JMP2r
@prng ( -- number* )
[ LIT2 &x $2 ] DUP2 #50 SFT2 EOR2 DUP2 #03 SFT2 EOR2 [ LIT2 &y $2 ] DUP2 ,&x STR2
DUP2 #01 SFT2 EOR2 EOR2 ,&y STR2k POP JMP2r
@rand ( -- number )
prng ADD JMP2r
( static string data )
(
@|assets )
@text &fps "FPS: $1
&bunnies "BUNS: $1
&instructions "CLICK 20 "TO 20 "ADD 20 "BUNNIES! $1
@font ( atari8.uf1 )
[
0000 0000 0000 0000 6060 6060 6000 6000
6666 6600 0000 0000 006c fe6c 6cfe 6c00
183e 603c 067c 1800 0066 6c18 3066 4600
386c 3870 decc 7600 6060 6000 0000 0000
0e1c 1818 181c 0e00 7038 1818 1838 7000
0066 3cff 3c66 0000 0018 187e 1818 0000
0000 0000 0030 3060 0000 007e 0000 0000
0000 0000 0018 1800 0206 0c18 3060 4000 ] &num [
3c66 6e76 6666 3c00 1838 1818 1818 7e00
3c66 060c 1830 7e00 7e0c 180c 0666 3c00
0c1c 3c6c 7e0c 0c00 7e60 7c06 0666 3c00
3c60 607c 6666 3c00 7e06 0c18 3030 3000
3c66 663c 6666 3c00 3c66 663e 060c 3800
0060 6000 6060 0000 0030 3000 3030 6000
0c18 3060 3018 0c00 0000 7e00 007e 0000
6030 180c 1830 6000 3c66 060c 1800 1800
3c66 6e6a 6e60 3e00 183c 6666 7e66 6600
7c66 667c 6666 7c00 3c66 6060 6066 3c00
786c 6666 666c 7800 7e60 607c 6060 7e00
7e60 607c 6060 6000 3e60 606e 6666 3e00
6666 667e 6666 6600 7830 3030 3030 7800
0606 0606 0666 3c00 666c 7870 786c 6600
6060 6060 6060 7e00 c6ee fed6 c6c6 c600
6676 7e7e 6e66 6600 3c66 6666 6666 3c00
7c66 667c 6060 6000 3c66 6666 766c 3600
7c66 667c 6c66 6600 3c66 603c 0666 3c00
7e18 1818 1818 1800 6666 6666 6666 3e00
6666 6666 663c 1800 c6c6 c6d6 feee c600
6666 3c18 3c66 6600 6666 663c 1818 1800
7e06 0c18 3060 7e00 7860 6060 6060 7800 ]
@fill-icn [ ffff ffff ffff ffff ]
@bunny-chr [
2466 6600 2424 003c 4200 007e 7e7e 7e7e
1818 3c3c 1800 0000 ff66 4242 667e 4242 ]
(
@|memory )
@sprite &length $2
&array &x 0600 &y 0500 &xvel 0060 &yvel 0010

View File

@ -0,0 +1,127 @@
( Cube3d: Just a cube, y'know )
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|000
@cube &v0 $8 &v4 $8
@center &x $2 &y $2
@timer $1
|100
@on-reset ( -> )
( | theme )
#4fcd .System/r DEO2
#4fc3 .System/g DEO2
#dfc2 .System/b DEO2
( | center )
.Screen/width DEI2 #01 SFT2 #0040 SUB2 .center/x STZ2
.Screen/height DEI2 #01 SFT2 #0040 SUB2 .center/y STZ2
( | begin. )
;on-frame .Screen/vector DEO2
@on-frame ( -> )
[ LIT &f $1 ] INCk ,&f STR
DUP #01 AND ?{ POP BRK }
#01 SFT .timer STZ
( | clear )
#0000 DUP2 .Screen/x DEO2
.Screen/y DEO2
[ LIT2 80 -Screen/pixel ] DEO
( | draw )
<draw-cube>
BRK
@<draw-cube> ( frame -- )
( | create box )
#0800
&>loop ( -- )
STHk [ LIT2 00 -timer ] LDZ #00 STHkr INC #07 AND #60 SFT ADD2 #00ff AND2 ;table ADD2 LDA #01 SFT #00 .timer LDZ #00 STHkr #60 SFT ADD2 #00ff AND2 ;table ADD2 LDA #02 SFT #00 STHkr #62 SFT2 ADD2 .cube/v0 STHr DUP ADD ADD STZ2
INC GTHk ?&>loop
POP2
( | vertices )
#0800
&>ver-loop ( -- )
DUP DUP ADD LDZ2 <draw-vertex>
INC GTHk ?&>ver-loop
POP2
( lines ) #0400
&>line-loop ( -- )
STHk .cube/v0 STHkr DUP ADD ADD .cube/v0 STHkr INC #03 AND DUP ADD ADD <draw-edge>
.cube/v0 STHkr DUP ADD ADD .cube/v4 STHkr DUP ADD ADD <draw-edge>
.cube/v4 STHkr DUP ADD ADD .cube/v4 STHr INC #03 AND DUP ADD ADD <draw-edge>
INC GTHk ?&>line-loop
POP2 JMP2r
@<draw-edge> ( a b -- )
STH
STH
( ) #00 STHkr LDZ .center/x LDZ2 ADD2
( ) #00 STHr INC LDZ .center/y LDZ2 ADD2
( ) #00 STHkr LDZ .center/x LDZ2 ADD2
( ) #00 STHr INC LDZ .center/y LDZ2 ADD2 #05 !<draw-line>
@<draw-vertex> ( x y -- )
#00 SWP #0004 SUB2 .center/y LDZ2 ADD2 .Screen/y DEO2
#00 SWP #0003 SUB2 .center/x LDZ2 ADD2 .Screen/x DEO2
;&icn .Screen/addr DEO2
[ LIT2 05 -Screen/sprite ] DEO
JMP2r
&icn [ 0000 387c 7c7c 3800 ]
@<draw-line> ( x1* y1* x2* y2* color -- )
,&color STR
,&y STR2
,&x STR2
,&y2 STR2
,&x2 STR2
,&x LDR2 ,&x2 LDR2 SUB2 abs2 ,&dx STR2
#0000 ,&y LDR2 ,&y2 LDR2 SUB2 abs2 SUB2 ,&dy STR2
#ffff [ LIT2 00 _&x2 ] LDR2 ,&x LDR2 lts2 DUP2 ADD2 ADD2 ,&sx STR2
#ffff [ LIT2 00 _&y2 ] LDR2 ,&y LDR2 lts2 DUP2 ADD2 ADD2 ,&sy STR2
[ LIT2 &dx $2 ] [ LIT2 &dy $2 ] ADD2 STH2
&while ( -- )
[ LIT2 &x2 $2 ] DUP2 .Screen/x DEO2
[ LIT2 &x $2 ] EQU2 [ LIT2 &y2 $2 ] DUP2 .Screen/y DEO2
[ LIT2 &y $2 ] EQU2 [ LIT2 &color $1 -Screen/pixel ] DEO
AND ?&end
STH2kr DUP2 ADD2 DUP2 ,&dy LDR2 lts2 ?&skipy
STH2r ,&dy LDR2 ADD2 STH2
,&x2 LDR2 [ LIT2 &sx $2 ] ADD2 ,&x2 STR2
&skipy ( -- )
,&dx LDR2 gts2 ?&while
STH2r ,&dx LDR2 ADD2 STH2
,&y2 LDR2 [ LIT2 &sy $2 ] ADD2 ,&y2 STR2
!&while
&end POP2r JMP2r
@abs2 ( a* -- f )
DUP2 #0f SFT2 EQU ?{ #0000 SWP2 SUB2 }
JMP2r
@lts2 ( a* b* -- f )
#8000 STH2k ADD2 SWP2 STH2r ADD2 GTH2 JMP2r
@gts2 ( a* b* -- f )
#8000 STH2k ADD2 SWP2 STH2r ADD2 LTH2 JMP2r
@table ( 256 xy )
[
f7f8 f9fa fbfc fcfd fefe ffff ffff ffff
ffff ffff fffe fefd fcfc fbfa f9f8 f7f6
f5f3 f2f0 efed ecea e8e6 e4e2 e0de dcda
d8d5 d3d1 cecc c9c7 c4c1 bfbc b9b6 b3b0
aeab a8a5 a29f 9c98 9592 8f8c 8986 8380
7c79 7673 706d 6a67 6360 5d5a 5754 514f
4c49 4643 403e 3b38 3633 312e 2c2a 2725
2321 1f1d 1b19 1715 1312 100f 0d0c 0a09
0807 0605 0403 0302 0101 0000 0000 0000
0000 0000 0001 0102 0303 0405 0607 0809
0a0c 0d0f 1012 1315 1719 1b1d 1f21 2325
272a 2c2e 3133 3638 3b3e 4043 4649 4c4f
5154 575a 5d60 6367 6a6d 7073 7679 7c7f
8386 898c 8f92 9598 9c9f a2a5 a8ab aeb0
b3b6 b9bc bfc1 c4c7 c9cc ced1 d3d5 d8da
dcde e0e2 e4e6 e8ea eced eff0 f2f3 f5f6 ]

View File

@ -1,543 +0,0 @@
( darena.tal )
( an open-ended game of rocks and sand )
( contributed by and cc0 sejo 12021 )
( parameters )
%nrocks { #1f }
%nrocks-1 { #1e }
%nrocks_mask { #1f }
%minposx { #0f }
%minposy { #0f }
%maxposx { #f1 }
%maxposy { #f1 }
%anispeedmask_normal { #03 }
%anispeedmask_slow { #07 }
%c_color_normal { #43 }
%c_color_flipx { #53 }
%index_norock { #ff }
( output macros )
%out_screen_x { LDA #00 SWP .Screen/x DEO2 } ( ;addr )
%out_screen_y { LDA #00 SWP .Screen/y DEO2 } ( ;addr )
( helper macros )
%get_bit_n { SFT #01 AND }
%get_nibble_h { #04 SFT #0f AND }
%get_nibble_l { #0f AND }
%is_bit_n_set { get_bit_n #01 EQU }
%set_animate { #01 ;c_state LDA ORA ;c_state STA }
%rst_animate { #00 ;c_state STA }
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
( variables )
|0000
@c_pos [ &x $1 &y $1 ] ( character position )
@c_speed [ &x $1 &y $1 ] ( character speed )
@c_color [ $1 ] ( character color )
@c_sprite [ $2 ] ( character sprite addr )
@c_state [ $1 ] ( high_nibble: animation pointer, bit0: is_animated )
@f_count [ $1 ] ( frame counter )
@ani_speedmask [ $1 ] ( animation speed mask )
@r_speed_x [ $f ]
@r_speed_y [ $f ]
@tog [ &x $1 &y $1 &state $1 ] ( toggle station state )
( program )
|0100 @reset ( -> )
#f396 .System/r DEO2
#e263 .System/g DEO2
#9030 .System/b DEO2
;on_frame .Screen/vector DEO2
( init character )
#50 ;c_pos/x STA
#10 ;c_pos/y STA
#00 ;c_speed/x STA
#00 ;c_speed/y STA
c_color_normal ;c_color STA
;s_monitx_stepfront0 ;c_sprite STA2
rst_animate
anispeedmask_normal ;ani_speedmask STA
( init toggler )
#27 ;tog/x STA
#27 ;tog/y STA
#00 ;tog/state STA
( init background )
;init_bg JSR2
BRK
@on_frame ( -> )
;f_count LDA INC DUP ;f_count STA ( increase frame counter )
;ani_speedmask LDA ( mask with animation speed mask )
AND #00 EQU ,update_frame JCN ( jump to update if it's time )
BRK
@update_frame
( check keyboard )
;check_keys JSR2
( animate character sprite )
;animate_c JSR2
( clear sprites )
;clear JSR2
( update character vars )
;update_c/run JSR2
( update rocks + stand )
;update_r/run JSR2
( draw )
;draw JSR2
BRK
@clear
( clear rocks )
;s_clear .Screen/addr DEO2
nrocks #00
&rocks_loop
DUP ( get rocks_x[i] )
;rocks_x ROT #00 SWP ADD2 out_screen_x
DUP ( get rocks_y[i] )
;rocks_y ROT #00 SWP ADD2 out_screen_y
#40 .Screen/sprite DEO
INC
DUP2
NEQ ,&rocks_loop JCN
POP2
( clear character )
;clear_c JSR2
JMP2r
@draw
( draw toggler )
;tog/x out_screen_x
;tog/x out_screen_y
;s_stand .Screen/addr DEO2
#03 .Screen/sprite DEO
( draw rocks )
;s_bola .Screen/addr DEO2
nrocks #00
&rocks_loop
DUP ( get rocks_x[i] )
;rocks_x ROT #00 SWP ADD2 out_screen_x
DUP ( get rocks_y[i] )
;rocks_y ROT #00 SWP ADD2 out_screen_y
DUP ( get color )
;r_color ROT #00 SWP ADD2 LDA #41 ADD .Screen/sprite DEO
INC
DUP2
NEQ ,&rocks_loop JCN
POP2
( draw character )
;draw_c JSR2
JMP2r
@check_keys
#00 ;c_speed/x STA
#00 ;c_speed/y STA
.Controller/button DEI #07 is_bit_n_set ,&der JCN
.Controller/button DEI #06 is_bit_n_set ,&izq JCN
.Controller/button DEI #05 is_bit_n_set ,&aba JCN
.Controller/button DEI #04 is_bit_n_set ,&arr JCN
rst_animate
JMP2r
&der
#01 ;c_speed/x STA
set_animate
c_color_normal ;c_color STA
;s_monitx_stepside0 ;c_sprite STA2
JMP2r
&izq
#ff ;c_speed/x STA
set_animate
c_color_flipx ;c_color STA
;s_monitx_stepside0 ;c_sprite STA2
JMP2r
&aba
#01 ;c_speed/y STA
set_animate
c_color_normal ;c_color STA
;s_monitx_stepfront0 ;c_sprite STA2
JMP2r
&arr
#ff ;c_speed/y STA
set_animate
c_color_normal ;c_color STA
;s_monitx_stepback0 ;c_sprite STA2
JMP2r
&end
JMP2r
( sub-routines )
( in: sourcex, source y, index, rangex, rangey )
( puts in the stack the index of rock collisioned with )
@collision_rocks
&range_y $1
&range_x $1
&src_i $1
&src_x $1
&src_y $1
&rock_x $1
&rock_y $1
&run
,&range_y STR
,&range_x STR
,&src_i STR
,&src_y STR
,&src_x STR
( check collision with rocks )
( nrocks #00 )
,&src_i LDR nrocks_mask AND DUP INC nrocks_mask AND
&rocks_loop
DUP ( get rocks_x[i] )
;rocks_x ROT #00 SWP ADD2 LDA ,&rock_x STR
DUP ( get rocks_y[i] )
;rocks_y ROT #00 SWP ADD2 LDA ,&rock_y STR
,&src_x LDR ,&rock_x LDR ,&range_x LDR SUB GTH ( if sx > rx - 8 )
,&src_x LDR ,&rock_x LDR ,&range_x LDR ADD LTH ( if sx < rx + 8 )
,&src_y LDR ,&rock_y LDR ,&range_y LDR SUB GTH ( if sy > ry - 8 )
,&src_y LDR ,&rock_y LDR ,&range_y LDR ADD LTH ( if sy < ry + 8 )
ADD ADD ADD #04 EQU ,&found JCN
INC nrocks_mask AND
DUP2
NEQ ,&rocks_loop JCN
POP2
#ff
JMP2r
&found
NIP ( remove loop limit )
DUP ;&src_i LDA NEQ ,&end JCN ( check if result is the same as index )
POP #ff
JMP2r
&end
JMP2r
@update_c ( update character position )
&new_x $1
&new_y $1
&rock_i $1
&rock_x $1
&rock_y $1
&run
;c_speed/x LDA ;c_pos/x LDA ADD
,&new_x STR
;c_speed/y LDA ;c_pos/y LDA ADD
,&new_y STR
anispeedmask_normal ;ani_speedmask STA
&check_x
( check collision with borders )
,&new_x LDR minposx EQU ;&noup_x JCN2
,&new_x LDR maxposx EQU ;&noup_x JCN2
( check collision with rocks )
,&new_x LDR ,&new_y LDR index_norock #09 #06
;collision_rocks/run JSR2
( if it is colliding with rock, check further )
DUP #ff NEQ ,&check_x_collision JCN
POP
,&update_x JMP
&check_x_collision
( DUP DEBUG )
( slow down and save rock index )
anispeedmask_slow ;ani_speedmask STA
,&rock_i STR
( check if rock collides with others )
;rocks_x #00 ,&rock_i LDR ADD2 LDA ,&rock_x STR
;rocks_y #00 ,&rock_i LDR ADD2 LDA ,&rock_y STR
,&rock_x LDR ,&rock_y LDR ,&rock_i LDR #09 #06
;collision_rocks/run JSR2
( DUP DEBUG )
( if it is colliding, then skip adding x )
DUP #ff NEQ ,&check_y JCN
POP
( if not, check for borders )
;&rock_x LDA minposx EQU ;&noup_x JCN2
;&rock_x LDA maxposx EQU ;&noup_x JCN2
( move rock with same speed as c )
;&rock_x LDA ;c_speed/x LDA ADD
;rocks_x #00 ;&rock_i LDA ADD2
STA
&update_x
;&new_x LDA ;c_pos/x STA
,&check_y JMP
&noup_x
&check_y
( check collision with borders )
;&new_y LDA minposy EQU ;&noup_y JCN2
;&new_y LDA maxposy EQU ;&noup_y JCN2
( check collision with rocks )
;&new_x LDA ;&new_y LDA index_norock #06 #09
;collision_rocks/run JSR2
( if it is colliding with rock, check further )
DUP #ff NEQ ,&check_y_collision JCN
POP
,&update_y JMP
&check_y_collision
( DUP DEBUG )
anispeedmask_slow ;ani_speedmask STA
;&rock_i STA
( check if rock collides with others )
;rocks_x #00 ;&rock_i LDA ADD2 LDA ;&rock_x STA
;rocks_y #00 ;&rock_i LDA ADD2 LDA ;&rock_y STA
;&rock_x LDA ;&rock_y LDA ;&rock_i LDA #06 #09
;collision_rocks/run JSR2
( DUP DEBUG )
( if it is colliding, then skip adding y )
DUP #ff NEQ ,&noup_y JCN
POP
( if not, check for borders )
;&rock_y LDA minposx EQU ;&noup_y JCN2
;&rock_y LDA maxposx EQU ;&noup_y JCN2
( if not colliding, then move rock with same speed as c )
;&rock_y LDA ;c_speed/y LDA ADD
;rocks_y #00 ;&rock_i LDA ADD2
STA
&update_y
;&new_y LDA ;c_pos/y STA
JMP2r
&noup_y
JMP2r
@update_r
&rock_i $1
&run
( check collision with rocks )
;tog/x LDA ;tog/y LDA index_norock #02 #02
;collision_rocks/run JSR2
( if it is colliding with rock, check if it needs to change state )
DUP #ff NEQ ,&change_state JCN
( DUP DEBUG )
( if there's no collision, reset toggler )
POP
#00 ;tog/state STA
JMP2r
&change_state
( DUP DEBUG )
,&rock_i STR
;tog/state LDA ,&done JCN ( don't toggle if state is active )
;r_color #00 ,&rock_i LDR ADD2 DUP2 STH2
LDA #01 EOR STH2r STA
#01 ;tog/state STA
&done
JMP2r
@animate_c
( is bit0 -animate- on? )
;c_state LDA DUP #00 get_bit_n #01 NEQ ,&s_no_animate JCN
( increment and save animation pointer )
&s_animate
DUP
get_nibble_h INC #03 AND #40 SFT
SWP get_nibble_l ORA
;c_state STA
JMP2r
&s_no_animate
get_nibble_h #0f AND ;c_state STA
JMP2r
@draw_c ( draw character )
#00 ;c_state LDA get_nibble_h #30 SFT
;c_sprite LDA2 ADD2 .Screen/addr DEO2
;c_pos/x out_screen_x
;c_pos/y out_screen_y
;c_color LDA .Screen/sprite DEO
JMP2r
@clear_c ( clear character )
;s_clear .Screen/addr DEO2
;c_pos/x out_screen_x
;c_pos/y out_screen_y
#40 .Screen/sprite DEO
JMP2r
@init_bg
( init bg )
;s_border .Screen/addr DEO2
.Screen/height DEI2 #0000 STH2
&vertical0loop
DUP2
STH2r
DUP2 .Screen/y DEO2
.Screen/width DEI2 #0000 STH2
&horizontal0loop
DUP2
STH2r
DUP2 .Screen/x DEO2
#03 .Screen/sprite DEO
#0008 ADD2 DUP2 STH2
GTH2 ,&horizontal0loop JCN
STH2r POP2 POP2
#0008 ADD2 DUP2 STH2
GTH2 ,&vertical0loop JCN
STH2r
POP2 POP2
( arena )
;s_clear .Screen/addr DEO2
#00 maxposy #00 minposy STH2
&vertical0loop_clear
DUP2
STH2r
DUP2 .Screen/y DEO2
#00 maxposx #00 minposx STH2
&horizontal0loop_clear
DUP2
STH2r
DUP2 .Screen/x DEO2
#00 .Screen/sprite DEO
#0008 ADD2 DUP2 STH2
GTH2 ,&horizontal0loop_clear JCN
STH2r POP2 POP2
#0008 ADD2 DUP2 STH2 GTH2 ,&vertical0loop_clear JCN
STH2r
POP2 POP2
JMP2r
( rocks )
@rocks_x [ 25 30 42 50 67 90 98 e8 20 43 43 57 5a 7f bc a5
e5 dd a2 20 b7 9b 38 e8 33 43 63 b7 aa cf bc ]
@rocks_y [ 60 48 34 56 23 65 65 65 ba e9 24 22 72 91 22 c5
25 30 42 50 67 90 98 e8 20 43 43 57 5a 7f bc ]
@r_color [ 00 01 01 00 00 00 01 01 01 01 00 00 01 01 00 00
01 00 01 00 00 01 00 01 01 01 01 01 00 00 00 ]
( sprites )
@s_clear [ 0000 0000 0000 0000 ]
@s_border [ 3288 7e83 780d e013 ]
@s_bola [ 3c4e 9ffd f962 3c00 ]
@s_stand [ 0000 0000 0024 7eff ]
@s_stand_original [ 0000 0000 0000 3c7e ]
@s_monitx [ 3c7e 5a7f 1b3c 5a18 ]
@s_monitx_back [ 3c7e 7efe d83c 5a18 ]
@s_monitx_stepfront0 [ 3c7e 5a7f 1b3c 5a18 ]
@s_monitx_stepfront1 [ 3c7e 5a7f 1b3c 5a10 ]
@s_monitx_stepfront2 [ 3c7e 5a7f 1b3c 5a18 ]
@s_monitx_stepfront3 [ 3c7e 5a7f 1b3c 5a08 ]
@s_monitx_stepback0 [ 3c7e 7efe d83c 5a18 ]
@s_monitx_stepback1 [ 3c7e 7efe d83c 5a10 ]
@s_monitx_stepback2 [ 3c7e 7efe d83c 5a18 ]
@s_monitx_stepback3 [ 3c7e 7efe d83c 5a08 ]
@s_monitx_stepside0 [ 1c3c 7afc d81c 1818 ]
@s_monitx_stepside1 [ 1c3c 7afc d81c 1828 ]
@s_monitx_stepside2 [ 1c3c 7afc d81c 3810 ]
@s_monitx_stepside3 [ 1c3c 7afc d81c 1814 ]

View File

@ -8,7 +8,7 @@
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
|c0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
( variables )
@ -22,12 +22,12 @@
#00 .DateTime/minute DEI #60 SFT2 EOR2
#00 .DateTime/hour DEI #c0 SFT2 EOR2 ;prng/x STA2
#00 .DateTime/hour DEI #04 SFT2
#00 .DateTime/day DEI #10 SFT2 EOR2
#00 .DateTime/day DEI DUP2 ADD2 EOR2
#00 .DateTime/month DEI #60 SFT2 EOR2
.DateTime/year DEI2 #a0 SFT2 EOR2 ;prng/y STA2
;prng/x LDA2 ;prng/y LDA2 EOR2
;rabbits STH2 #0f05 &loop-x
LIT2r =rabbits #0f05 &loop-x
#0f05 &loop-y
ROTk SWP STH2kr STA2 POP
INC2r INC2r
@ -93,7 +93,7 @@
DUP2 #00 ,set-occupied JSR
;&possible-moves ( x y possible* / addr* )
OVR2 #01 SUB ,&check-move JSR ( up )
OVR2 #01 ADD ,&check-move JSR ( down )
OVR2 INC INC ,&check-move JSR ( down )
OVR2 #0100 SUB2 ,&check-move JSR ( left )
OVR2 #0100 ADD2 ,&check-move JSR ( right )
;&possible-moves SUB2 ( x y num-possible-times-2* / addr* )
@ -160,7 +160,7 @@
( rabbit is in-between two frames )
#08 OVR SUB ,&from-weight STR
,&to-weight STR ( color n / frame )
#00 SWP #10 SFT2 ;rabbits ADD2 #00c8 #00 STHr MUL2 ADD2 ( color from-addr* )
#00 SWP DUP2 ADD2 ;rabbits ADD2 #00c8 #00 STHr MUL2 ADD2 ( color from-addr* )
LDA2k STH2 #00c8 ADD2 LDA2
&draw ( color to-x to-y / from-x from-y )
STHr ,&mix JSR LIT2 &yoffset $2 ADD2 .Screen/y DEO2
@ -181,7 +181,7 @@
&static ( color n counter / frame )
INCr
POP
#00 SWP #10 SFT2 ;rabbits ADD2 #00c8 #00 STHr MUL2 ADD2
#00 SWP DUP2 ADD2 ;rabbits ADD2 #00c8 #00 STHr MUL2 ADD2
LDA2 STH2k
,&draw JMP

View File

@ -1,726 +0,0 @@
( drum rack )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%2** { #10 SFT2 } %2// { #01 SFT2 }
%4** { #20 SFT2 } %4// { #02 SFT2 }
%8** { #30 SFT2 } %8// { #03 SFT2 }
%10** { #40 SFT2 }
%TOB { NIP } %TOS { #00 SWP }
%RTN { JMP2r }
%MOD { DUP2 / * - }
%LTS2 { #8000 ++ SWP2 #8000 ++ >> } %GTS2 { #8000 ++ SWP2 #8000 ++ << }
%PAD-WIDTH { #0030 }
%PAD-HEIGHT { #0020 }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|70 @Midi [ &vector $2 &channel $1 &note $1 &velocity $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( variables )
|0000
@center [ &x $2 &y $2 ]
@pointer [ &x $2 &y $2 ]
@piano [ &last $1 &octave $1 ]
@pads [ &last $1 ]
@frame [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@pad-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@mix-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@oct-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@wav-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
( TODO: remove )
@color $1
@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@modes [ $1 $1 $1 $1 ] ( single/repeat )
( program )
|0100 ( -> )
( theme )
#0fe5 .System/r DEO2
#0fc5 .System/g DEO2
#0f25 .System/b DEO2
( vectors )
;on-control .Controller/vector DEO2
;on-mouse .Mouse/vector DEO2
;on-frame .Screen/vector DEO2
;on-message .Console/vector DEO2
( channel defaults )
#dd .Audio0/volume DEO
#0118 .Audio0/adsr DEO2
#0200 .Audio0/length DEO2
#ce .Audio1/volume DEO
#0334 .Audio1/adsr DEO2
#0800 .Audio1/length DEO2
#ec .Audio2/volume DEO
#0414 .Audio2/adsr DEO2
#0800 .Audio2/length DEO2
#ee .Audio3/volume DEO
#022c .Audio3/adsr DEO2
#1000 .Audio3/length DEO2
( defaults )
#01 .modes STZ
#01 .piano/octave STZ
( find center )
.Screen/width DEI2 2// .center/x STZ2
.Screen/height DEI2 2// .center/y STZ2
( place frame )
.center/x LDZ2 PAD-WIDTH #0003 ** -- #0010 -- .frame/x1 STZ2
.center/y LDZ2 #0050 -- .frame/y1 STZ2
.center/x LDZ2 PAD-WIDTH #0003 ** ++ #0010 ++ .frame/x2 STZ2
.frame/y1 LDZ2 PAD-HEIGHT 4** ++ #0028 ++ .frame/y2 STZ2
( place pad-view )
.frame/x1 LDZ2 .pad-view/x1 STZ2
.frame/y1 LDZ2 .pad-view/y1 STZ2
.pad-view/x1 LDZ2 #0004 PAD-WIDTH ** ++ .pad-view/x2 STZ2
.pad-view/y1 LDZ2 #0004 PAD-HEIGHT ** ++ .pad-view/y2 STZ2
( place mix-view )
.pad-view/x2 LDZ2 #0006 ++ .mix-view/x1 STZ2
.pad-view/y1 LDZ2 .mix-view/y1 STZ2
.mix-view/x1 LDZ2 #007a ++ .mix-view/x2 STZ2
.pad-view/y2 LDZ2 .mix-view/y2 STZ2
( place oct-view )
.frame/x1 LDZ2 .oct-view/x1 STZ2
.mix-view/y2 LDZ2 #0004 ++ .oct-view/y1 STZ2
.oct-view/x1 LDZ2 #0050 ++ .oct-view/x2 STZ2
.oct-view/y1 LDZ2 #0018 ++ .oct-view/y2 STZ2
( place wav-view )
.oct-view/x2 LDZ2 .wav-view/x1 STZ2
.mix-view/y2 LDZ2 #0004 ++ .wav-view/y1 STZ2
.frame/x2 LDZ2 .wav-view/x2 STZ2
.wav-view/y1 LDZ2 #0020 ++ .wav-view/y2 STZ2
( draw outlines )
.mix-view/x1 LDZ2 #0004 --
.mix-view/y1 LDZ2 #0000 --
.mix-view/x2 LDZ2 #0002 --
.mix-view/y2 LDZ2 #0002 --
#01 ;line-rect JSR2
.wav-view/x1 LDZ2 #0000 --
.wav-view/y1 LDZ2 #0002 --
.wav-view/x2 LDZ2 #0002 --
.wav-view/y2 LDZ2 #0002 ++
#01 ;line-rect JSR2
( initial draw )
#00 #10
&draw-pads
( load sample )
OVR TOS #0019 ** ;pad-path ++ .File/name DEO2
OVR #04 / #40 SFT .Audio0/length + DEI2 .File/length DEO2
OVR TOS 2** ;pad-addr ++ LDA2 .File/read DEO2
( draw pad )
OVR #01 ;draw-pad JSR2
( draw mixer )
OVR #04 / ;draw-mixer JSR2
( incr ) SWP INC SWP
LTHk ,&draw-pads JCN
POP2
;draw-octave JSR2
BRK
@on-message ( -> )
.Console/read DEI #0f AND ;play-pad JSR2
BRK
@on-frame ( -> )
( update VU monitors )
#00 #04
&loop
OVR STH
( x ) .mix-view/x1 LDZ2 #0074 ++
( y ) .mix-view/y1 LDZ2 PAD-HEIGHT STHkr TOS ** ++ #0002 ++
( output ) .Audio0/output STHr #40 SFT + DEI
;draw-monitor JSR2
( incr ) SWP INC SWP
LTHk ,&loop JCN
POP2
BRK
@on-mouse ( -> )
;draw-cursor JSR2
.Mouse/state DEI #00 ! #01 JCN [ BRK ]
.Mouse/x DEI2 DUP2 .pad-view/x1 LDZ2 >> ROT ROT .pad-view/x2 LDZ2 INC2 << #0101 ==
.Mouse/y DEI2 DUP2 .pad-view/y1 LDZ2 >> ROT ROT .pad-view/y2 LDZ2 << #0101 ==
#0101 == ;on-touch-pad JCN2
.Mouse/x DEI2 DUP2 .mix-view/x1 LDZ2 >> ROT ROT .mix-view/x2 LDZ2 INC2 << #0101 ==
.Mouse/y DEI2 DUP2 .mix-view/y1 LDZ2 >> ROT ROT .mix-view/y2 LDZ2 << #0101 ==
#0101 == ;on-touch-mix JCN2
.Mouse/x DEI2 DUP2 .oct-view/x1 LDZ2 >> ROT ROT .oct-view/x2 LDZ2 INC2 << #0101 ==
.Mouse/y DEI2 DUP2 .oct-view/y1 LDZ2 >> ROT ROT .oct-view/y2 LDZ2 << #0101 ==
#0101 == ;on-touch-oct JCN2
BRK
@on-control ( -> )
.Controller/key DEI #00 ! #01 JCN [ BRK ]
.Controller/key DEI
DUP #31 ! ,&no-0 JCN #00 ;play-pad JSR2 &no-0
DUP #32 ! ,&no-1 JCN #01 ;play-pad JSR2 &no-1
DUP #33 ! ,&no-2 JCN #02 ;play-pad JSR2 &no-2
DUP #34 ! ,&no-3 JCN #03 ;play-pad JSR2 &no-3
DUP #71 ! ,&no-4 JCN #04 ;play-pad JSR2 &no-4
DUP #77 ! ,&no-5 JCN #05 ;play-pad JSR2 &no-5
DUP #65 ! ,&no-6 JCN #06 ;play-pad JSR2 &no-6
DUP #72 ! ,&no-7 JCN #07 ;play-pad JSR2 &no-7
DUP #61 ! ,&no-8 JCN #08 ;play-pad JSR2 &no-8
DUP #73 ! ,&no-9 JCN #09 ;play-pad JSR2 &no-9
DUP #64 ! ,&no-a JCN #0a ;play-pad JSR2 &no-a
DUP #66 ! ,&no-b JCN #0b ;play-pad JSR2 &no-b
DUP #7a ! ,&no-c JCN #0c ;play-pad JSR2 &no-c
DUP #78 ! ,&no-d JCN #0d ;play-pad JSR2 &no-d
DUP #63 ! ,&no-e JCN #0e ;play-pad JSR2 &no-e
DUP #76 ! ,&no-f JCN #0f ;play-pad JSR2 &no-f
POP
BRK
@on-touch-pad ( -> )
( x ) .Mouse/x DEI2 .pad-view/x1 LDZ2 -- PAD-WIDTH // TOB
( y ) .Mouse/y DEI2 .pad-view/y1 LDZ2 -- PAD-HEIGHT // TOB #20 SFT +
DUP SWP ;play-pad JSR2
;draw-waveform JSR2
( release ) #00 .Mouse/state DEO
BRK
@on-touch-mix ( -> )
( channel ) .Mouse/y DEI2 .mix-view/y1 LDZ2 -- PAD-HEIGHT // TOB STH
( knob ) .Mouse/x DEI2 .mix-view/x1 LDZ2 -- #0010 // TOB
( adsr )
DUP #00 ! ,&no-a JCN
.Audio0/adsr [ STHkr #40 SFT + ] DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/adsr [ STHkr #40 SFT + ] DEO &no-a
DUP #01 ! ,&no-d JCN
.Audio0/adsr [ STHkr #40 SFT + ] DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr [ STHkr #40 SFT + ] DEO &no-d
DUP #02 ! ,&no-s JCN
.Audio0/adsr [ STHkr #40 SFT + ] INC DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/adsr [ STHkr #40 SFT + ] INC DEO &no-s
DUP #03 ! ,&no-r JCN
.Audio0/adsr [ STHkr #40 SFT + ] INC DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr [ STHkr #40 SFT + ] INC DEO &no-r
( modes )
DUP #04 ! ,&no-repeat JCN
.modes [ STHkr + ] LDZ
#00 =
.modes [ STHkr + ] STZ &no-repeat
( volume )
DUP #05 ! ,&no-left JCN
.Audio0/volume [ STHkr #40 SFT + ] DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/volume [ STHkr #40 SFT + ] DEO &no-left
DUP #06 ! ,&no-right JCN
.Audio0/volume [ STHkr #40 SFT + ] DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/volume [ STHkr #40 SFT + ] DEO &no-right
POP
( release ) #00 .Mouse/state DEO
STHkr ;draw-mixer JSR2
POPr
BRK
@on-touch-oct ( -> )
.Mouse/x DEI2 .oct-view/x1 LDZ2 -- 8// TOB #08 ! ,&no-mod JCN
.Mouse/y DEI2 .oct-view/y1 LDZ2 -- 8// TOB
DUP #00 ! ,&no-incr JCN
.piano/octave LDZ INC .piano/octave STZ &no-incr
DUP #02 ! ,&no-decr JCN
.piano/octave LDZ #01 - .piano/octave STZ &no-decr
POP
( release ) #00 .Mouse/state DEO
;draw-octave JSR2
BRK
&no-mod
.Mouse/x DEI2 .oct-view/x1 LDZ2 -- 8// TOB #06 GTH ,&no-key JCN
.Mouse/x DEI2 .oct-view/x1 LDZ2 -- 8//
( set pitch of pad )
DUP2 ;notes ++ LDA .pads/last LDZ SWP .piano/octave LDZ #02 - #0c * +
( save ) SWP TOS ;pad-pitch ++ STA
( record last note )
TOB .piano/last STZ
.pads/last LDZ ;play-pad JSR2
( release ) #00 .Mouse/state DEO
;draw-octave JSR2
&no-key
BRK
@play-pad ( pad -- )
( unselect last )
.pads/last LDZ #01 ;draw-pad JSR2
DUP .pads/last STZ
( highlight )
DUP #02 ;draw-pad JSR2
( addr )
DUP TOS 2** ;pad-addr ++ LDA2 STH2
DUP #04 / #40 SFT .Audio0/addr + STH2r ROT DEO2
( pitch )
DUP TOS ;pad-pitch ++ LDA STH
DUP #04 / .modes + LDZ #00 = #70 SFT STH ADDr
DUP #04 / #40 SFT .Audio0/pitch + STHr SWP DEO
#04 / ;draw-mixer JSR2
RTN
@draw-waveform ( pad -- )
( stash address )
DUP ADD #00 SWP ;pad-addr ++ LDA2 STH2
( clear )
.wav-view/x1 LDZ2 #0002 ++
.wav-view/y1 LDZ2
.wav-view/x2 LDZ2 #0002 --
.wav-view/y2 LDZ2
#00 ;fill-rect JSR2
.wav-view/x1 LDZ2 #0002 ++ .Screen/x DEO2
( waveform )
#00 #e8
&loop
( dotted line )
OVR #01 AND ,&no-dot JCN
.wav-view/y1 LDZ2 #0010 ++ .Screen/y DEO2
#01 .Screen/pixel DEO
&no-dot
OVR TOS 10** [ DUP2r STH2r ] ++ LDA
#02 /
TOS 4// .wav-view/y1 LDZ2 ++ .Screen/y DEO2
.Screen/x DEI2 INC2 .Screen/x DEO2
( draw ) #02 .Screen/pixel DEO
( incr ) SWP INC SWP
LTHk ,&loop JCN
POP2
POP2r
RTN
@draw-mixer ( mixer -- )
STHk #00 SWP PAD-HEIGHT ** .mix-view/y1 LDZ2 ++ #0003 ++
( adsr )
DUP2 .mix-view/x1 LDZ2 SWP2
.Audio0/adsr [ STHkr #40 SFT + ] DEI #04 SFT ;draw-knob JSR2
DUP2 .mix-view/x1 LDZ2 #0010 ++ SWP2
.Audio0/adsr [ STHkr #40 SFT + ] DEI #0f AND ;draw-knob JSR2
DUP2 .mix-view/x1 LDZ2 #0020 ++ SWP2
.Audio0/adsr [ STHkr #40 SFT + ] INC DEI #04 SFT ;draw-knob JSR2
DUP2 .mix-view/x1 LDZ2 #0030 ++ SWP2
.Audio0/adsr [ STHkr #40 SFT + ] INC DEI #0f AND ;draw-knob JSR2
( once/repeat )
DUP2 .mix-view/x1 LDZ2 #0040 ++ SWP2
.modes [ STHkr + ] LDZ ;draw-switch JSR2
( volume )
DUP2 .mix-view/x1 LDZ2 #0050 ++ SWP2
.Audio0/volume [ STHkr #40 SFT + ] DEI #04 SFT ;draw-knob JSR2
DUP2 .mix-view/x1 LDZ2 #0060 ++ SWP2
.Audio0/volume [ STHkr #40 SFT + ] DEI #0f AND ;draw-knob JSR2
POP2
POPr
RTN
@draw-pad ( pad color -- )
STH STH
STHkr
DUP #04 / SWP #03 AND TOS PAD-WIDTH ** ( center ) .pad-view/x1 LDZ2 ++
ROT TOS PAD-HEIGHT ** ( center ) .pad-view/y1 LDZ2 ++
( draw outline )
OVR2 OVR2
OVR2 PAD-WIDTH #0002 -- ++
OVR2 PAD-HEIGHT #0002 -- ++
OVRr STHr ;line-rect JSR2
( draw name )
OVR2 #0002 ++
OVR2 #0002 ++
;pad-name STHkr TOS #0005 ** ++
#00 OVRr STHr +
;draw-label JSR2
( draw note )
OVR2 #0003 ++ .Screen/x DEO2
DUP2 #0014 ++ .Screen/y DEO2
( get pitch ) STHkr TOS ;pad-pitch ++ LDA
#0c / TOS 8** ;font-hex ++ .Screen/addr DEO2
#01 .Screen/sprite DEO
( draw octave )
OVR2 #000b ++ .Screen/x DEO2
DUP2 #0014 ++ .Screen/y DEO2
( get pitch ) STHkr TOS ;pad-pitch ++ LDA
#0c MOD TOS 8** ;font-notes ++ .Screen/addr DEO2
#01 .Screen/sprite DEO
POP2 POP2
POPr POPr
RTN
@draw-octave ( -- )
.oct-view/x1 LDZ2 .oct-view/y1 LDZ2
OVR2 OVR2 ;keys-left-icns #01 .piano/last LDZ #00 = + ;draw-key JSR2
OVR2 #0008 ++ OVR2 ;keys-middle-icns #01 .piano/last LDZ #01 = + ;draw-key JSR2
OVR2 #0010 ++ OVR2 ;keys-right-icns #01 .piano/last LDZ #02 = + ;draw-key JSR2
OVR2 #0018 ++ OVR2 ;keys-left-icns #01 .piano/last LDZ #03 = + ;draw-key JSR2
OVR2 #0020 ++ OVR2 ;keys-middle-icns #01 .piano/last LDZ #04 = + ;draw-key JSR2
OVR2 #0028 ++ OVR2 ;keys-middle-icns #01 .piano/last LDZ #05 = + ;draw-key JSR2
SWP2 #0030 ++ SWP2 ;keys-right-icns #01 .piano/last LDZ #06 = + ;draw-key JSR2
.oct-view/x1 LDZ2 #0040 ++ .Screen/x DEO2
;arrow-icns .Screen/addr DEO2
.oct-view/y1 LDZ2 .Screen/y DEO2
#01 .Screen/sprite DEO
;arrow-icns #0008 ++ .Screen/addr DEO2
.oct-view/y1 LDZ2 #0010 ++ .Screen/y DEO2
#01 .Screen/sprite DEO
;font-hex .piano/octave LDZ #03 + #00 SWP 8** ++ .Screen/addr DEO2
.oct-view/y1 LDZ2 #0008 ++ .Screen/y DEO2
#03 .Screen/sprite DEO
RTN
@draw-monitor ( x* y* stereo -- )
STH
.Screen/y DEO2
.Screen/x DEO2
#00 #0f
&loop
OVR #10 SWP - STHkr #0f AND < INC .Screen/pixel DEO
.Screen/x DEI2 #0002 ++ .Screen/x DEO2
OVR #10 SWP - STHkr #04 SFT < INC .Screen/pixel DEO
.Screen/x DEI2 #0002 -- .Screen/x DEO2
.Screen/y DEI2 #0002 ++ .Screen/y DEO2
( incr ) SWP INC SWP
LTHk ,&loop JCN
POP2
POPr
RTN
@draw-key ( x* y* addr* color -- )
STH
.Screen/addr DEO2
SWP2 .Screen/x DEO2
DUP2 #0018 ++
&loop
( move ) OVR2 .Screen/y DEO2
( draw ) STHkr .Screen/sprite DEO
( incr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
( incr ) SWP2 #0008 ++ SWP2
LTH2k ,&loop JCN
POP2 POP2
POPr
RTN
@draw-cursor ( -- )
( clear last cursor )
;cursor-icn .Screen/addr DEO2
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
#40 .Screen/sprite DEO
( record pointer positions )
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
( colorize on state )
#43 [ .Mouse/state DEI #00 ! ] - .Screen/sprite DEO
RTN
@draw-knob ( x* y* value -- )
( load ) STH .Screen/y DEO2 .Screen/x DEO2
;knob-icns .Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
;knob-icns #0008 ++ .Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
;knob-icns #0018 ++ .Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO
.Screen/x DEI2 #0008 -- .Screen/x DEO2
;knob-icns #0010 ++ .Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO
.Screen/x DEI2 #0004 ++ .Screen/x DEO2
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
;font-hex #00 STHkr #30 SFT ++ .Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO
.Screen/x DEI2 #0004 -- #00 #00 STHkr ;knob-offsetx ++ LDA ++ .Screen/x DEO2
.Screen/y DEI2 #0010 -- #00 #00 STHr ;knob-offsety ++ LDA ++ .Screen/y DEO2
;knob-icns #0020 ++ .Screen/addr DEO2
( draw ) #05 .Screen/sprite DEO
RTN
@draw-switch ( x* y* value -- )
STH .Screen/y DEO2 .Screen/x DEO2
STHkr #50 SFT #00 SWP ;switch-icns ++
DUP2 .Screen/addr DEO2
( draw ) #01 STHkr + .Screen/sprite DEO
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
DUP2 #0008 ++ .Screen/addr DEO2
( draw ) #01 STHkr + .Screen/sprite DEO
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
.Screen/x DEI2 #0008 -- .Screen/x DEO2
DUP2 #0010 ++ .Screen/addr DEO2
( draw ) #01 STHkr + .Screen/sprite DEO
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
#0018 ++ .Screen/addr DEO2
( draw ) #01 STHr + .Screen/sprite DEO
RTN
@line-rect ( x1* y1* x2* y2* color -- )
( load ) .color STZ STH2k .rect/y2 STZ2 .rect/x2 STZ2 STH2k .rect/y1 STZ2 .rect/x1 STZ2
STH2r INC2 STH2r
&ver
( save ) OVR2 .Screen/y DEO2
( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO
( incr ) SWP2 INC2 SWP2
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2
.rect/x1 LDZ2 INC2 .rect/x2 LDZ2 #0001 --
&hor
( save ) OVR2 .Screen/x DEO2
( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO
( incr ) SWP2 INC2 SWP2
OVR2 OVR2 INC2 LTS2 ,&hor JCN
POP2 POP2
RTN
@draw-label ( x* y* addr* color -- )
( load ) STH STH2 .Screen/y DEO2 .Screen/x DEO2
STH2r
&loop
LDAk #00 SWP #0030 -- 8** ;font-num-uc ++ .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO
( incr ) INC2
( incr ) .Screen/x DEI2 #0008 ++ .Screen/x DEO2
LDAk #00 ! ,&loop JCN
POP2
POPr
RTN
@fill-rect ( x1* y1* x2* y2* color -- )
.color STZ
( x1 x2 y1 y2 ) ROT2 SWP2
&ver
( save ) OVR2 .Screen/y DEO2
STH2 STH2 OVR2 OVR2
&hor
( save ) OVR2 .Screen/x DEO2
( draw ) .color LDZ .Screen/pixel DEO
( incr ) SWP2 INC2 SWP2
OVR2 OVR2 LTS2 ,&hor JCN
POP2 POP2 STH2r STH2r
( incr ) SWP2 INC2 SWP2
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2
RTN
@pad-name [
"PAD1 $1 "SYN1 $1 "SYN2 $1 "CYM1 $1 ( short )
"HHAT $1 "OHAT $1 "CHAT $1 "RIDE $1
"SID1 $1 "SNR1 $1 "SNR2 $1 "SID2 $1 ( long )
"BDR1 $1 "KCK1 $1 "KCK2 $1 "SUB1 $1 ]
@pad-addr [
6000 6400 6800 6c00
7000 7800 8000 8800
9000 9800 a000 a800
b000 c000 d000 e000 $2 ]
@pad-pitch [
30 30 30 30
30 30 30 30
30 30 30 30
30 30 30 30 ]
@pad-path [
"projects/sounds/pad1.pcm $1 "projects/sounds/syn1.pcm $1 "projects/sounds/syn2.pcm $1 "projects/sounds/pad2.pcm $1
"projects/sounds/hhat.pcm $1 "projects/sounds/ohat.pcm $1 "projects/sounds/chat.pcm $1 "projects/sounds/ride.pcm $1
"projects/sounds/sid1.pcm $1 "projects/sounds/snr1.pcm $1 "projects/sounds/snr2.pcm $1 "projects/sounds/sid2.pcm $1
"projects/sounds/bdr1.pcm $1 "projects/sounds/kck1.pcm $1 "projects/sounds/kck2.pcm $1 "projects/sounds/sub1.pcm $1 ]
@notes [
3c 3e 40 41 43 45 47
48 4a 4c 4d 4f 51 53 ]
@cursor-icn [
80c0 e0f0 f8e0 1000 ]
@keys-left-icns [
7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7e7f
7f7f 7f7f 7f7f 3e00 ]
@keys-middle-icns [
1c1c 1c1c 1c1c 1c1c
1c1c 1c1c 1c1c 3e7f
7f7f 7f7f 7f7f 3e00 ]
@keys-right-icns [
1f1f 1f1f 1f1f 1f1f
1f1f 1f1f 1f1f 3f7f
7f7f 7f7f 7f7f 3e00 ]
@arrow-icns [
0010 387c fe10 1000
0010 1010 fe7c 3810 ]
@switch-icns [
001f 2040 4040 4040
00f8 0402 0202 0202
404f 5f5f 4f20 1f00
02f2 fafa f204 f800
001f 204f 5f5f 4f40
00f8 04f2 fafa f202
4040 4040 4020 1f00
0202 0202 0204 f800 ]
@knob-icns [
0003 0c10 2020 4040
00c0 3008 0404 0202
4040 2020 100c 0300
0202 0404 0830 c000
0000 183c 3c18 0000 ]
@knob-offsetx [
01 00 00 00 00 01 02 03
05 06 07 08 08 08 08 07 ]
@knob-offsety [
07 06 05 03 02 01 00 00
00 00 01 02 03 05 06 07 ]
@font-notes [
003e 4140 4040 413e 40ae 4100 4040 413e
007e 4141 4141 417e 40ae 4101 4141 417e
003e 4140 7c40 413e 003f 4040 7e40 4040
40af 4000 7e40 4040 003e 4140 5f41 413e
40ae 4100 5f41 413e 003e 4141 7f41 4141
40ae 4101 7f41 4141 007e 4141 7e41 417e
]
@font-hex ( 0-F )
[
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
007c 8280 fc82 827c 007c 8202 1e02 0202
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080
]
@font-num-uc [
003e 4141 4141 413e 0018 0808 0808 081c
003e 4101 3e40 407f 003e 4101 1f01 413e
0011 2141 7f01 0101 007f 4040 7e01 413e
003e 4140 7e41 413e 003e 4101 0102 0408
003e 4141 3e41 413e 003e 4141 3f01 0102
0000 0800 0000 0800 0000 0800 0000 0800
0000 0800 0000 0810 0000 0408 1008 0400
0000 001c 001c 0000 0000 1008 0408 1000
0000 0000 0000 0000 003e 4101 3f41 413f
007e 4141 7e41 417e 003e 4140 4040 413e
007e 4141 4141 417e 007f 4040 7e40 407f
007f 4040 7e40 4040 003e 4140 5e41 413e
0041 4141 7f41 4141 0008 0808 0808 0808
007f 0101 0101 413e 0041 4244 7844 4241
0040 4040 4040 403f 0076 4949 4949 4949
005e 6141 4141 4141 003e 4141 4141 413e
007e 4141 7e40 4040 003e 4141 4145 423d
007e 4141 7e41 4141 003e 4140 3e01 413e
007f 0808 0808 0808 0041 4141 4141 433d
0041 4141 4122 1408 0049 4949 4949 4976
0041 2214 0814 2241 0041 4141 3f01 413e
007f 0101 3e40 407f ]

View File

@ -1,543 +0,0 @@
( art by @ritualdust )
%+ { ADD } %- { SUB } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%8** { #30 SFT2 }
%10** { #40 SFT2 }
%DEBUG { ;print-hex JSR2 #0a .Console/write DEO }
%DEBUG2 { SWP ;print-hex JSR2 ;print-hex JSR2 #0a .Console/write DEO }
%RTN { JMP2r }
%TOS { #00 SWP }
%DEC { #01 - }
%MOUSE { #82 }
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
|0000
@room
&x $2 &y $2
@player
&x $1 &y $1 &d $1
|0100
( theme )
#067f .System/r DEO2
#036f .System/g DEO2
#003f .System/b DEO2
.Screen/width DEI2 #01 SFT2 #0040 -- .room/x STZ2
.Screen/height DEI2 #01 SFT2 #0040 -- .room/y STZ2
( vectors )
;on-frame .Screen/vector DEO2
;on-button .Controller/vector DEO2
;entrance ;draw-dungeon JSR2
#05 .player/x STZ
#06 .player/y STZ
MOUSE ;draw-mouse JSR2
BRK
@on-button ( -> )
.Controller/button DEI
DUP #00 ! ,&no-null JCN
POP BRK
&no-null
DUP #10 ! ,&no-up JCN
#00 .player/d STZ
#00 ;draw-mouse JSR2
.player/y LDZk DEC SWP STZ
MOUSE ;draw-mouse JSR2
&no-up
DUP #20 ! ,&no-down JCN
#01 .player/d STZ
#00 ;draw-mouse JSR2
.player/y LDZk INC SWP STZ
MOUSE ;draw-mouse JSR2
&no-down
DUP #40 ! ,&no-left JCN
#02 .player/d STZ
#00 ;draw-mouse JSR2
.player/x LDZk DEC SWP STZ
MOUSE ;draw-mouse JSR2
&no-left
DUP #80 ! ,&no-right JCN
#03 .player/d STZ
#00 ;draw-mouse JSR2
.player/x LDZk INC SWP STZ
MOUSE ;draw-mouse JSR2
&no-right
POP
BRK
@on-frame ( -> )
BRK
@draw-mouse ( color -- )
;spritesheet #29 .player/d LDZ + TOS DUP2 DEBUG2 10** ++ .Screen/addr DEO2
.player/x LDZ TOS 8** .room/x LDZ2 ++ .Screen/x DEO2
.player/y LDZ TOS 8** .room/y LDZ2 ++ .Screen/y DEO2
#40 + .Screen/sprite DEO
RTN
@draw-dungeon ( stage* -- )
STH2
#1000
&ver
DUP TOS 8** .room/y LDZ2 ++ .Screen/y DEO2
#1000
&hor
DUP TOS 8** .room/x LDZ2 ++ .Screen/x DEO2
( get id ) STH2 DUP STH2r ROT OVR SWP #40 SFT + TOS
( tile ) DUP2 STH2kr ++ LDA TOS 10** ;spritesheet ++ .Screen/addr DEO2
( color ) STH2kr #0100 ++ ++ LDA .Screen/sprite DEO
INC GTHk ,&hor JCN
POP2
INC GTHk ,&ver JCN
POP2
POP2r
RTN
@print-hex ( value -- )
STHk #04 SFT ,&parse JSR .Console/write DEO
STHr #0f AND ,&parse JSR .Console/write DEO
RTN
&parse ( value -- char )
DUP #09 GTH ,&above JCN #30 ADD RTN &above #09 SUB #60 ADD RTN
RTN
@mouse-icn
ffff ffff ffff ffff 0000 0000 0000 0000
@spritesheet
1111 11f1 1111 111f eeee ee0e eeee eee0
f5bb 55bb 51b1 51ff 0a44 aa44 ae4e ae00
55bb 55bb 1111 1111 aa44 aa44 eeee eeee
ff11 11f1 1111 111f 00ee ee0e eeee eee0
1111 1111 1111 1111 eeee eeee eeee eeee
ff80 8080 80ff 8080 00ff ffff ffff ffff
ff01 0101 01ff 0101 00fe fefe fefe fefe
ffff 11ff 0ffd 71ff 00ee ee00 fa02 ee00
ffff 11ff cffd f9ff 00ee ee00 7a02 6600
ff8c 8f9f 9f8e ff00 0cff fcfe fefd ffff
ff82 820a 390a ff00 007d 7df5 c6f5 ffff
ff7d 7f6f 3d01 ff01 38fe d4fc fafe fefe
0000 0000 0007 0808 0000 0000 0007 0f0f
0000 0000 00ff 9191 0000 0000 006e 6e6e
0000 0000 00ff 1111 0000 0000 00ee eeee
0000 0000 00c0 0000 0000 0000 00c0 e0e0
1111 1111 1111 111f eeee eeee eeee eee0
51b1 51bf 51b1 51f1 ae4e ae40 ae4e ae0e
bb55 3b15 111f 1111 44aa c4ea eee0 eeee
bf55 bb55 1111 1111 40aa 44aa eeee eeee
51b1 51b1 51b1 51f1 ae4e ae4e ae4e ae0e
dfba afbf bfbf 9f80 a0c5 d5d5 d5c0 ffff
f5fd cdfd 8dfd f901 0a06 7606 7606 fefe
ffff 11ff f785 87ff 00ee ee00 7a7a 7800
ffff 11ff cffd fdff 00ee ee00 7a02 6200
381f 0520 2038 7000 0020 3a38 3800 7c00
00ff 0000 0000 0000 0000 ff00 0000 0000
1cec 2010 101c 3800 0010 dc1c 1c00 3e00
0808 0000 0000 0000 0f0f 0700 0000 0000
ff91 9100 0000 0000 6e6e 6e00 0000 0000
ff11 1100 0000 0000 eeee ee00 0000 0000
8000 0000 0000 0000 e0e0 c000 0000 0000
1111 11f1 1111 11ff eeee ee0e eeee ee00
51b1 51b1 1111 1111 ae4e ae4e eeee eeee
aa55 ab95 8181 817f 55aa d4ea fefe fe80
ffab 55ab 51a1 51ff 0054 aa54 ae5e ae00
d5ab d5ab d1a1 d1ff 2a54 2a54 2e5e 2e00
ffbe aaaa bf9f 80bf 80d5 d5d5 c0ff ffc0
fdfd 6d2d fdf9 01f9 0216 96d6 06fe fe06
ffff 817e ffff ffff 007e ff81 0000 0000
ffff 91ff cffd f9ff 006e 6e00 7a02 6600
0000 1c04 1830 303a 0a0e 1f0e 1e2e 2e55
2838 3878 004c 4c00 283a 297d 3e7a 32ff
1070 7878 0123 1200 1172 5375 1c3c 0c7e
080e 1e1e 98c4 4800 884e caae 203c 307e
80e0 8080 80e7 8888 e000 e0e0 e007 efef
0000 0000 00c7 0808 0000 0000 00c7 efef
080e 0808 08ce 0808 0e00 0e0e 0ec0 eeee
55ab 55ab 51a1 51ff aa54 aa54 ae5e ae00
ab55 ab55 8181 817f 54aa 54aa fefe fe80
ab55 ab55 8181 817f 54aa 54aa fefe fe80
bf7f bf77 9f81 817f 5cbe 6abe fcfe fe80
ab55 ab95 8181 817f 54aa d4ea fefe fe80
ffc0 8083 80c0 ffff ffff ffff ffff ff00
ff00 80ff 8000 ffff ffff ffff ffff ff00
ff07 03c3 0307 ffff fefe fefe fefe fe00
ffff 91ff f785 ffd9 006e 6e00 7a7a 006e
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
080e 0808 080e 0808 0e00 0e0e 0e00 0e0e
80e0 8080 80e0 8080 e000 e0e0 e000 e0e0
ee88 88ee 8890 8000 00ee ee00 eefe fe7c
0000 0000 0000 0000 0000 0000 0000 0000
5ea1 51a1 51a1 51ae af5e ae5e ae5e ae5f
7e81 8181 8181 817f fffe fefe fefe fe80
7e81 41a1 51a1 51ff ff7e be5e ae5e ae00
7e81 8185 8783 817f fffe fefa fcfe fefe
7e81 8185 8783 817f fffe fefa fcfe fe80
eaea eaea ffea ffaa 5555 5555 00ff 0055
aaaa aaaa ff00 ffaa 5555 5555 00ff 0055
afaf afaf ff17 ffab 5454 5454 00fe 0054
ffff 11ff cffd c5ff 00ee ee00 7a02 7a00
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0e0e 040a 040e 0808 0000 0a04 0a00 0e0e
e0e0 40a0 40e0 8080 0000 a040 a000 e0e0
80e0 8080 e09f 9191 e000 e0e0 00ee ee6e
080e 0808 0ef0 1012 0e00 0e0e 00ee eeec
5ea1 51a1 51a1 51fe af5e ae5e ae5e ae01
7f80 8080 8080 807f ffff ffff ffff ffff
7e8d 8f9f f1e1 817f f7f6 f0ee 1efe fe80
5ea1 51a1 51a1 51ff af5e ae5e ae5e ae00
7e81 41a1 51a9 51fe ff7e be5e ae56 ae07
ffff 18ff 7873 7474 00e7 e700 c7cc cbcb
ffff 14ff 00ff 0000 00eb eb00 ff00 ffff
ffff 18ff 1ece 2e2e 00e7 e700 e333 d3d3
ffff 11ff ff85 ffd9 00ee ee00 7a7a 006e
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
ff91 91e0 8080 e080 6eee ee00 e0e0 00e0
fe10 100e 0808 0e08 ecee ee00 0e0e 000e
0000 0000 0000 55aa 0000 0000 0000 aa55
552a ff80 efff 80ff aad5 00ff ff00 ffff
55aa ff00 ffff 00ff aa55 00ff ff00 ffff
55ab ff01 dfff 01ff aa54 00fe fe00 fefe
ffff d700 00ff ffff 0000 ffff ff00 7ce2
7474 7474 7000 00ff cbcb cbcb cfff ff00
0000 0000 0000 00ff ffff ffff ffff ff00
2e2e 2e2e 2e0e 0cff d3d3 d3d3 d3f3 f300
ffff 817e ffff fbeb 007e ff81 0004 1414
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
00ff 4444 00ff 4444 00bb bbbb 00bb bbbb
00fc 4848 00fc 4848 00b4 b6b6 02b6 b6b4
ff01 1fff 011f ff01 00fe fe00 fefe 00fe
ff80 ffff 80ff ffff 00ff ff00 ffff 0000
ff00 afff 00fd ffff 00ff ff00 ffff 0000
ff01 ffff 01ff ffff 00fe fe00 fefe 0000
ffff ffff ffff ffff 3e2e ab3d efff d8f7
ffa0 ffa8 58ff a8ff 005f 0057 a700 5700
ff81 ff09 09ff 81ff 007e 00f6 f600 7e00
ff57 5617 270c 0cff 00a9 a9e8 d9f3 f300
ffff b9ef e9ef ffe7 0046 5610 5610 3c18
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
007f 8484 e080 8080 007b fbfb 00e0 e0e0
00ff 4444 0003 0404 00bb bbbb 0003 0707
0000 0000 0000 0000 0000 0000 0000 0000
1fff 011f ff01 1dff fe00 fefe 00fe fe00
5ea3 55ab 55ab 55ff af5c aa54 aa54 aa00
7e81 55ab 55ab 55ff fffe aa54 aa54 aa00
0101 ffff ffff ffff fefe 00ff c7b9 ff67
81c1 ffff ffff ffff 7e3e 00ff 1de7 fff9
ffff 8080 8080 ff55 00ff ffff ffff 00aa
fffe 0101 0101 ff55 00ff fefe fefe 00aa
3f18 181f 4e4e 26ff c7e7 e7e0 b3b1 d900
efef adef efed fdff 185a 5a18 5a1a 5200
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 8080 00e0 8000 8101
0000 0000 0000 0000 0000 0606 3636 b6b6
1e01 0181 8181 817f fffe fefe fefe fe80
ffff ffff ffff ffff ffff ae71 ffff c7fb
ffff ffff ffff ffff fefe fe1c eefe c2be
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
ffff 817e ffff ffff 007e ff81 0008 347e
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
817e ff00 ff18 0081 7eff ffff 00e7 ffff
fe81 c1a1 c1a1 c1ff 7f7e 3e5e 3e5e 3e00
aa55 ab55 01c3 7d01 55aa 54aa febe 82fe
0101 ffff ffff ffff fefe 00fe 78a6 fefa
55ab f51b 11e1 817f aa54 eae4 ee1e fe80
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
ff55 ab81 8181 817f 00aa d4fe fefe fe80
be41 a181 8181 817f 5fbe 5efe fefe fe80
7d7d 017d 7d01 7dff 8282 fe82 82fe 8200
7d7d 017d 7d01 7d7d 8282 fe82 82fe 8282
d5ab 5db0 908f 837f 2a54 af4f eff0 fc80
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
ff88 ce96 f4f0 f695 fff8 def7 fdf1 f7b5
ff0e a634 8270 32c1 ff4f ffff 9ff9 fff7
898d 38fd 4f53 44d1 9fff fdff 7fff dffd
017d 7d01 7d7d 017d fe82 82fe 8282 fe82
ffff ffff ffff ffff ffaa ff55 ffaa 55aa
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
8d85 90b8 f2b7 848d bfc7 91f8 f6ff 9fef
ffff ffff ffff ffff 5fbf 5fa7 59bf 47b8
ffff ffff ffff ffff 55aa 55ff fff9 cfff
ffff ffff ffff ffff 55aa 55bf 53bc 5fbf
ffff ffff ffff ffff feaa fe54 feaa 54aa
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
ffff ffff ffff ffff 5faa 5fb5 5faa 55aa
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
42ff 7d41 82fa 6100 7cfc 027e fcfc 7e00
@sewers
0c0d 0ea2 0e0e 0f00 0000 0000 0000 0000
3c07 58b3 3858 3d00 0000 0000 0000 0000
3c17 18c3 3828 3d00 0000 0000 0000 0000
3c30 3132 3231 4e0e 0e0e 0e0e 0e0e 0f00
3c50 8483 a344 2858 1858 6838 6828 3d00
1c1d 1e5f 9441 0718 2718 5818 1858 3d00
0000 003c 9441 22b4 64a4 3232 3232 3d00
0000 003c 93a3 4183 9383 8383 8341 3d00
0000 001c 5f94 5294 7d7e 6e6e 6f41 3d00
000c 0e0e 4f94 4194 3d3c 5858 1841 3d00
003c 1758 1894 4194 3d3c 1818 1850 3d00
003c 1898 1894 4194 3d3c a024 33b1 3d00
003c d374 d294 4494 3d3c 23b1 4144 3d00
003c d193 9394 4194 3d3c 5052 4141 3d00
004c e0c4 c4d4 82d4 4d1c 1d1e 1e1e 1f00
00bc 0000 0000 00ca 0000 0000 0000 0000
&colors
8080 8080 8080 8000 0000 0000 0000 0000
8080 8080 8080 8000 0000 0000 0000 0000
8080 8080 8080 8000 0000 0000 0000 0000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
0000 0080 8080 8080 8080 8080 8080 8000
0000 0080 8080 8080 8080 8080 8080 8000
0000 0080 8080 80a0 8080 8080 8080 8000
0080 8080 8080 80a0 8080 8080 8080 8000
0080 8080 8080 80a0 8080 8080 8080 8000
0080 8080 8080 80a0 8080 8080 8080 8000
0080 8080 8080 80a0 8080 8080 8080 8000
0080 8080 8080 80a0 8080 8080 8080 8000
00a0 8080 8080 8080 a080 8080 8080 8000
00a0 0000 0000 0080 0000 0000 0000 0000
@crypt
0000 0c0d 0e0e 0f00 0000 0000 0000 0000
0c0d 4f55 5657 4e0e 0f00 0000 0000 0000
3c55 5765 6667 5557 3d00 0000 0000 0000
3c65 6732 3232 6567 3d00 0000 0000 0000
3c30 3235 3637 3233 3d00 0000 0000 0000
3c40 4345 4647 5451 3d00 0000 0000 0000
3c75 7661 6263 7576 3d4c 604d 0000 0000
3c30 3171 7273 3232 3d3c 703d 0000 0000
3c50 4441 4141 4141 4e4f 803d 0000 0000
3c50 ff41 4152 4141 9091 923d 0000 0000
3c50 4141 4141 4141 5e1e 1e1f 0000 0000
3c50 5241 4141 4441 3d00 0000 0000 0000
1c1d 1e5f 415e 1e1e 1f00 0000 0000 0000
0000 004c 824d 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
&colors
0000 8080 8080 8000 0000 0000 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
8080 8080 8080 8080 8080 8080 0000 0000
8080 8080 8080 8080 8080 8080 0000 0000
8080 8080 8080 8080 8080 8080 0000 0000
8080 8080 8080 8080 8080 8080 0000 0000
8080 8080 8080 8080 8080 8080 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
8080 8080 8080 8080 8000 0000 0000 0000
0000 00a0 80a0 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
@entrance
0c0d 0e0e 0e0e 0e0e 0f0c 0d0e 0e0f 0000
3c07 0727 2807 0506 3d3c 1717 173d 0000
3c17 287b 0728 1516 4e4f 1717 173d 0000
3c30 3131 3131 2526 1717 31a2 313d 0000
3c50 a0a1 4141 3432 1717 41b2 443d 0000
3c50 b0b1 5241 4144 3431 4141 413d 0000
3c50 4141 4141 4141 4141 5241 413d 0000
1c1d 1e1e 5f41 5e1e 1e1e 1e1e 1e1f 0000
0000 0000 4c81 4d00 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 9d00 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
&colors
8080 8080 8080 8080 8080 8080 8080 0000
8080 8080 8080 8080 8080 8080 8080 0000
8080 8081 8080 8080 8080 8080 8080 0000
8080 8080 8080 8080 8080 8080 8080 0000
8080 8080 8080 8080 8080 8080 8080 0000
8080 8080 8080 8080 8080 8080 8080 0000
8080 8080 8080 8080 8080 8080 8080 0000
8080 8080 8080 8080 8080 8080 8080 0000
0000 0000 a080 a000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 8000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
@upper
007b 7b7b 7b7b 7b7b 7b0c 0e0e 0e0e 0f7b
cfcf cfcf cfcf cfcf 7b3c 7758 7858 3d00
0c0d 0e2e 0d0e 0e0e 0e2f 8707 8808 3d00
3c05 063e 3868 3807 283e 0102 0202 3d00
3c15 1628 090a 0b17 2828 1100 0010 3d00
3c25 2628 191a 1b01 a028 1100 0020 3d00
3c01 1313 1213 1321 1312 2100 5e1e 1f00
3c14 c0c1 c1c1 c000 1010 1004 3dcf 7e00
3c14 d0c2 c2c2 d010 1000 1041 3d00 0000
3c11 c0c1 c1c1 c004 1010 0419 3d00 0000
3c11 0404 0400 1004 0004 0412 3d00 0000
3c85 8685 865e 5f70 5e5f 8586 3d00 0000
1c1d 1e1e 1e1f 3c80 3d1c 1d1e 1f00 0000
8e8e 8e8e 8e8e 4c60 4d00 0000 0000 0000
0000 0000 00ef efef 0000 0000 0000 0000
&colors
0000 0000 0000 0000 0000 0000 0000 0000
0080 8080 8080 8080 8080 8080 8080 8080
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 8080 8080 8080 8080 8000
8080 8080 8080 9080 8080 8080 8080 8000
8080 80a0 80a0 9080 8080 8080 8000 0000
8080 a0a0 a0a0 b080 8080 8080 8000 0000
8080 8080 8080 8080 8080 8080 8000 0000
8080 8080 8080 8080 8080 8080 8000 0000
8080 8080 8080 8080 8080 8080 8000 0000
8080 8080 8080 a0b0 a000 0000 0000 0000
0000 0000 0080 8080 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000

View File

@ -0,0 +1,56 @@
( DVD Bounce )
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|0000
@dvd &x $2 &y $2
|0100
@on-reset ( -> )
( | theme )
#4cfd .System/r DEO2
#4cf3 .System/g DEO2
#dcf2 .System/b DEO2
( | vectors )
;on-frame .Screen/vector DEO2
( | starting position )
.Screen/width DEI2 #01 SFT2 .dvd/x STZ2
.Screen/height DEI2 #01 SFT2 .dvd/y STZ2
( | set collisions )
.Screen/width DEI2 #0020 SUB2 ;on-frame/hit-hor STA2
.Screen/height DEI2 #0010 SUB2 ;on-frame/hit-ver STA2
( | drawing mode )
[ LIT2 36 -Screen/auto ] DEO
#01 draw-dvd BRK
@on-frame ( -> )
#00 draw-dvd
( | x )
.dvd/x LDZ2
( left ) ORAk ?{ #0001 ,&x STR2 }
( right ) DUP2 [ LIT2 &hit-hor $2 ] NEQ2 ?{ #ffff ,&x STR2 }
[ LIT2 &x 0001 ] ADD2 .dvd/x STZ2
( | y )
.dvd/y LDZ2
( top ) ORAk ?{ #0001 ,&y STR2 }
( bottom ) DUP2 [ LIT2 &hit-ver $2 ] NEQ2 ?{ #ffff ,&y STR2 }
[ LIT2 &y 0001 ] ADD2 .dvd/y STZ2
#01 draw-dvd BRK
@draw-dvd ( color -- )
;dvd-icn .Screen/addr DEO2
.dvd/x LDZ2 .Screen/x DEO2
.dvd/y LDZ2 .Screen/y DEO2
.Screen/sprite DEOk DEO
JMP2r
@dvd-icn ( 4 x 2 )
[
001f 3f38 3838 787f 00fe fe7e 7777 e3c3
000f 1f3b 7b77 e7c7 00fc fe8f 8707 0efc
7f00 000f ff7f 0700 0301 00ff f0f8 ff00
8700 00ff 7f7f ff00 f000 00e0 fcfc 8000 ]

View File

@ -1,194 +0,0 @@
( uxnasm projects/examples/demos/font.tal bin/font.rom && uxnemu bin/font.rom )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%RTN { JMP2r }
%TOS { #00 SWP }
%GET-WIDTH { TOS ;font-data ++ LDA }
%GET-GLYPH { TOS #50 SFT2 ;font-data/glyphs ++ }
%AUTO-NONE { #00 .Screen/auto DEO }
%AUTO-X { #01 .Screen/auto DEO }
%AUTO-Y { #02 .Screen/auto DEO }
%AUTO-ADDR { #04 .Screen/auto DEO }
%AUTO-X-ADDR { #05 .Screen/auto DEO }
%AUTO-Y-ADDR { #06 .Screen/auto DEO }
( devices )
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
( variables )
|0000
( init )
|0100 ( -> )
( theme )
#0fa7 .System/r DEO2
#0fa7 .System/g DEO2
#0fa7 .System/b DEO2
( load font )
#4900 .File/length DEO2
;font-path-large .File/name DEO2
;font-data .File/read DEO2
( draw label )
#0020 #0020 ;title #01 ;draw-uf3 JSR2
( load font )
#2100 .File/length DEO2
;font-path-medium .File/name DEO2
;font-data .File/read DEO2
( draw label )
#0020 #0048 ;body #02 ;draw-uf2 JSR2
( load font )
#0900 .File/length DEO2
;font-path-small .File/name DEO2
;font-data .File/read DEO2
( draw label )
#0030 #00b8 ;footer #03 ;draw-uf1 JSR2
BRK
@draw-uf1 ( x* y* text* color -- )
STH
SWP2 .Screen/y DEO2
SWP2 DUP2 .Screen/x DEO2 SWP2
&loop
LDAk
DUP #0a ! ,&no-linebreak JCN
( move down ) STH OVR2 .Screen/x DEO2 STHr
( incr y ) .Screen/y DEI2 #0010 ++ .Screen/y DEO2
POP ,&continue JMP &no-linebreak
( get addr ) STHk TOS #30 SFT2 ;font-data #0100 ++ ++ .Screen/addr DEO2
( get width ) STHr TOS ;font-data ++ LDA TOS
( draw ) STHkr .Screen/sprite DEO
( use width ) .Screen/x DEI2 ++ .Screen/x DEO2
&continue
( incr addr ) INC2
LDAk ,&loop JCN
POP2 POP2 POPr
RTN
@draw-uf2 ( x* y* text* color -- )
STH
SWP2 .Screen/y DEO2
SWP2 .Screen/x DEO2
AUTO-Y-ADDR
&while
LDAk #0a ! ,&no-linebreak JCN
( reset ) #0020 .Screen/x DEO2
( down ) .Screen/y DEI2k #0010 ++ ROT DEO2
,&continue JMP &no-linebreak
LDAk STHkr ,&sprite JSR
&continue
INC2 LDAk ,&while JCN
POP2 POPr
AUTO-NONE
RTN
&sprite ( char color -- )
.Screen/x DEI2 STH2
.Screen/y DEI2 STH2
( glyph ) OVR GET-GLYPH .Screen/addr DEO2
DUP .Screen/sprite DEOk DEO
STH2kr .Screen/y DEO2
SWP GET-WIDTH
DUP #09 < ,&narrow JCN
.Screen/x DEI2k #0008 ++ ROT DEO2
OVR .Screen/sprite DEOk DEO
STH2kr .Screen/y DEO2
&narrow
POP2r
( width ) TOS STH2r ++ .Screen/x DEO2
POP
RTN
RTN
@draw-uf3 ( x* y* text* color -- )
STH
SWP2 .Screen/y DEO2
SWP2 DUP2 .Screen/x DEO2 SWP2
&loop
LDAk
DUP #0a ! ,&no-linebreak JCN
( move down ) OVR2 .Screen/x DEO2
( incr y ) .Screen/y DEI2 #0010 ++ .Screen/y DEO2
POP ,&continue JMP &no-linebreak
STHkr ,&sprite JSR
&continue
( incr addr ) INC2
LDAk ,&loop JCN
POP2 POP2 POPr
RTN
&sprite ( char color -- )
STH
( get addr ) DUP TOS #30 SFT2 #30 SFT2k ROT POP ADD2 ;font-data #0100 ++ ++ .Screen/addr DEO2
( get width ) TOS ;font-data ++ LDA TOS
#0300
&ver
#0300
&hor
STHkr .Screen/sprite DEO
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
.Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
INC GTHk ,&hor JCN
POP2
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
.Screen/x DEI2 #0018 -- .Screen/x DEO2
INC GTHk ,&ver JCN
POP2
.Screen/y DEI2 #0018 -- .Screen/y DEO2
( use width ) .Screen/x DEI2 ++ .Screen/x DEO2
POPr
RTN
RTN
@title
5468 6520 466f 6720 486f 726e $1
@body
4927 6c6c 206d 616b 6520 6120 736f 756e
6420 7468 6174 2773 2073 6f20 616c 6f6e
6520 0a74 6861 7420 6e6f 206f 6e65 2063
616e 206d 6973 7320 6974 2c20 7468 6174
2077 686f 6576 6572 200a 6865 6172 7320
6974 2077 696c 6c20 7765 6570 2069 6e20
7468 6569 7220 736f 756c 732c 200a 616e
6420 6865 6172 7468 7320 7769 6c6c 2073
6565 6d20 7761 726d 6572 2c20 0a61 6e64
2062 6569 6e67 2069 6e73 6964 6520 7769
6c6c 2073 6565 6d20 6265 7474 6572 200a
746f 2061 6c6c 2077 686f 2068 6561 7220
6974 2069 6e20 7468 6520 6469 7374 616e
7420 746f 776e 732e 20 $1
@footer
2d20 4279 2052 6179 2042 7261 6462 7572
79 $1
@font-path-large
"projects/fonts/geneva24.uf3 $1
@font-path-medium
"projects/fonts/venice14.uf2 $1
@font-path-small
"projects/fonts/atari8.uf1 $1
@font-data $100 &glyphs

View File

@ -0,0 +1,73 @@
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|0100
@on-reset ( -> )
( | theme )
#6f04 .System/r DEO2
#7f00 .System/g DEO2
#8f00 .System/b DEO2
( | screen size )
#00c0
( ) DUP2 .Screen/width DEO2
( ) .Screen/height DEO2
( | pen )
#0020
( ) DUP2 .Screen/x DEO2
( ) .Screen/y DEO2
( | vector )
;on-frame .Screen/vector DEO2
BRK
@on-frame ( -> )
[ LIT2 &f $2 ] INC2 DUP2 ,&f STR2
( | end )
DUP2 #0400 LTH2 ?{
POP2 #0000 .Screen/vector DEO2
BRK }
d2xy
( | draw line )
.Screen/y DEI2 diff ,&y STR2
.Screen/x DEI2 diff ,&x STR2
#0400
&l ( -- )
.Screen/x DEI2k [ LIT2 &x $2 ] ADD2 ROT DEO2
.Screen/y DEI2k [ LIT2 &y $2 ] ADD2 ROT DEO2
[ LIT2 01 -Screen/pixel ] DEO
INC GTHk ?&l
POP2 BRK
@diff ( a* b* -- dir* )
EQU2k ?{
LTH2 ?{ #0001 JMP2r }
#ffff JMP2r }
POP2 POP2 #0000 JMP2r
@d2xy ( d* -- x* y* )
,&t STR2
#0000
( ) DUP2 ,&x STR2
( ) ,&y STR2
#2001
&l ( -- )
#00 OVR STH2
[ LIT2 &t $2 ] DUP2 #02 SFT2 ,&t STR2
( ) DUP2 #01 SFT2 #0001 AND2 DUP2 ,&rx STR2
( ) EOR2 #0001 AND2 ,&ry STR2
[ LIT2 &x $2 ] [ LIT2 &y $2 ] [ LIT2 &ry $2 ]
( ) DUP2r [ LIT2r 0001 ] SUB2r
( | rot )
ORA ?{
[ LIT2 &rx $2 ] #0001 NEQ2 ?{
( rx-n-1 ) SWP2 STH2kr SWP2 SUB2
( ry-n-1 ) SWP2 STH2kr SWP2 SUB2 }
( swap ) SWP2 }
POP2r
( ) STH2kr ,&ry LDR2 MUL2 ADD2 ,&y STR2
( ) STH2r ,&rx LDR2 MUL2 ADD2 ,&x STR2
DUP ADD GTHk ?&l
POP2
( ) ,&x LDR2 #20 SFT2 #0020 ADD2
( ) ,&y LDR2 #20 SFT2 #0020 ADD2 JMP2r

View File

@ -1,356 +1,221 @@
( Game Of Life
Any live cell with fewer than two live neighbours dies, as if by underpopulation.
Any live cell with two or three live neighbours lives on to the next generation.
Any live cell with more than three live neighbours dies, as if by overpopulation.
Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. )
( uxnemu life.rom )
( Any live cell with fewer than two live neighbours dies, as if by underpopulation. )
( Any live cell with two or three live neighbours lives on to the next generation. )
( Any live cell with more than three live neighbours dies, as if by overpopulation. )
( Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. )
%+ { ADD } %- { SUB }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1
|000
%2/ { #01 SFT }
%8/ { #03 SFT }
%2// { #01 SFT2 } %8// { #03 SFT2 }
%2** { #10 SFT2 } %8** { #30 SFT2 }
%40** { #60 SFT2 }
%8MOD { #07 AND } %2MOD { #01 AND }
@world &count $2
@anchor &x $2 &y $2 &x2 $2 &y2 $2
%TOS { #00 SWP }
%RTN { JMP2r }
%SFL { #40 SFT SFT }
|100
%WIDTH { #40 } %HEIGHT { #40 }
%WIDTH-MOD { #3f AND } %HEIGHT-MOD { #3f AND }
%IN-RANGE { INCk SWP SUB2 GTH }
%BANK1 { #8000 } %BANK2 { #a000 }
%GET-SIZE { WIDTH TOS 8// 40** }
%GET-ITERATORS { SWP2k POP NIP }
%GET-ITER { OVR2 NIP OVR SWP }
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
( variables )
|0000
@world [ &frame $1 &count $2 ]
@anchor [ &x $2 &y $2 ]
@pointer [ &x $2 &y $2 ]
@rle [ &x $1 &y $1 &n $1 ]
( program )
|0100 ( -> )
( theme )
#02cf .System/r DEO2
#02ff .System/g DEO2
@on-reset ( -> )
( | theme )
#02cf .System/r DEO2
#02ff .System/g DEO2
#024f .System/b DEO2
( vectors )
;on-input .Console/vector DEO2
;on-frame .Screen/vector DEO2
;on-mouse .Mouse/vector DEO2
( | resize )
#00c0 DUP2 .Screen/width DEO2
.Screen/height DEO2
( | vectors )
;on-frame .Screen/vector DEO2
;on-mouse .Mouse/vector DEO2
;on-control .Controller/vector DEO2
( glider )
#07 #03 ;set-cell JSR2
#07 #04 ;set-cell JSR2
#05 #04 ;set-cell JSR2
#07 #05 ;set-cell JSR2
#06 #05 ;set-cell JSR2
.Screen/width DEI2 2// WIDTH TOS -- .anchor/x STZ2
.Screen/height DEI2 2// HEIGHT TOS -- .anchor/y STZ2
BRK
@on-frame-paused ( -> )
BRK
( | glider )
#0703 <set-cell>
#0704 <set-cell>
#0504 <set-cell>
#0705 <set-cell>
#0605 <set-cell>
( | center )
.Screen/width DEI2 #01 SFT2 #0040 SUB2 DUP2 .anchor/x STZ2
#007e ADD2 .anchor/x2 STZ2
.Screen/height DEI2 #01 SFT2 #0040 SUB2 DUP2 .anchor/y STZ2
#007e ADD2 .anchor/y2 STZ2
BRK
@on-frame ( -> )
.Mouse/state DEI #00 = #01 JCN [ BRK ]
( incr frame ) .world/frame LDZ INC [ DUP ] .world/frame STZ
( reset count ) #0000 .world/count STZ2
#03 AND #00 = #01 JCN [ BRK ]
( clear buffer )
BANK2 STH2k GET-SIZE ++ STH2r
&clear-loop
DUP2 #0000 SWP2 STA2
INC2 INC2 GTH2k ,&clear-loop JCN
POP2 POP2
( run grid )
#00 HEIGHT
&ver
#00 WIDTH
&hor
GET-ITERATORS
( x y ) DUP2
( neighbours ) DUP2 ;get-neighbours JSR2
( state ) ROT ROT ;get-cell JSR2
,run-cell JSR
SWP INC SWP
LTHk ,&hor JCN
POP2
SWP INC SWP
LTHk ,&ver JCN
POP2
( move buffer )
BANK2 DUP2 GET-SIZE ++ SWP2
&copy-loop
DUP2 LDA2k
SWP2 #2000 -- STA2
INC2 INC2 GTH2k ,&copy-loop JCN
POP2 POP2
;draw-grid JSR2
BRK
@run-cell ( x y neighbours state -- )
#00 = ,&dead JCN
&alive
DUP #02 < ,&dies JCN
DUP #03 > ,&dies JCN
&lives POP ,save-cell JSR RTN
&dies POP POP2 RTN
&dead
DUP #03 = ,&birth JCN POP POP2 RTN
&birth POP ,save-cell JSR RTN
RTN
@save-cell ( x y -- )
( get index )
HEIGHT-MOD SWP WIDTH-MOD SWP
TOS 8** ROT 8/ TOS ++ [ BANK2 ++ ]
( incr count )
.world/count LDZ2 INC2 .world/count STZ2
( save in buffer )
STH2
DUP2 POP 8MOD #01 SWP SFL
LDAkr STHr SWP ORA
STH2r STA
RTN
[ LIT2 00 -Mouse/state ] DEI EQU ?{ BRK }
#0000 .world/count STZ2
[ LIT &f $1 ] INCk ,&f STR
( ) #03 AND #00 EQU ?{ BRK }
<run>
BRK
@on-mouse ( -> )
( clear last cursor )
;cursor .Screen/addr DEO2
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
#40 .Screen/sprite DEO
( record pointer positions )
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
( colorize on state )
#42 [ .Mouse/state DEI #00 ! ] + .Screen/sprite DEO
.Mouse/state DEI #00 ! #01 JCN [ BRK ]
.Mouse/x DEI2 DUP2 .anchor/x LDZ2 >> ROT ROT .anchor/x LDZ2 WIDTH DUP ADD TOS ++ INC2 << #0101 ==
.Mouse/y DEI2 DUP2 .anchor/y LDZ2 >> ROT ROT .anchor/y LDZ2 HEIGHT DUP ADD TOS ++ << #0101 ==
#0101 == #01 JCN [ BRK ]
.Mouse/x DEI2 .anchor/x LDZ2 SUB2 2/ NIP
.Mouse/y DEI2 .anchor/y LDZ2 SUB2 2/ NIP
;set-cell JSR2
;draw-grid JSR2
BRK
[ LIT2 00 -Mouse/state ] DEI NEQ #42 ADD ;cursor-icn <update-cursor>
( | on touch in rect )
.Mouse/state DEI ?{ BRK }
.Mouse/x DEI2 .Mouse/y DEI2 .anchor within-rect ?{ BRK }
( | paint )
.Mouse/x DEI2 .anchor/x LDZ2 SUB2 #01 SFT NIP
( ) .Mouse/y DEI2 .anchor/y LDZ2 SUB2 #01 SFT NIP <set-cell>
<redraw>
BRK
@on-control ( -> )
.Controller/key DEI
( ) DUP #20 NEQ ?{
#0000 ;on-frame .Screen/vector DEI2 ORA ?{ SWP2 }
POP2 .Screen/vector DEO2 }
( ) #1b NEQ ?{ ;MMU/clear1 .System/expansion DEO2 }
BRK
.Controller/key DEI #00 ! #01 JCN [ BRK ]
(
@|core )
.Controller/key DEI #20 ! ,&no-toggle JCN
;on-frame
.Screen/vector DEI2 ;on-frame-paused == ,&swap JCN
POP2 ;on-frame-paused
&swap
.Screen/vector DEO2
&no-toggle
BRK
@draw-grid ( -- )
( draw cell count )
.anchor/x LDZ2 .Screen/x DEO2
.anchor/y LDZ2 HEIGHT DUP ADD TOS ++ .Screen/y DEO2
.world/count LDZ2 #03 ;draw-short JSR2
HEIGHT #00
&ver
DUP TOS 2** .anchor/y LDZ2 ++ .Screen/y DEO2
WIDTH #00
&hor
DUP TOS 2** .anchor/x LDZ2 ++ .Screen/x DEO2
GET-ITER ,get-cell JSR INC .Screen/pixel DEO
INC GTHk ,&hor JCN
POP2
INC GTHk ,&ver JCN
@<run> ( -- )
;MMU/clear2 .System/expansion DEO2
#4000
&ver ( -- )
DUP ,&y STR
#4000
&hor ( -- )
DUP [ LIT &y $1 ] <run-cell>
INC GTHk ?&hor
POP2 INC GTHk ?&ver
POP2
( move ) ;MMU/move21 .System/expansion DEO2
!<redraw>
RTN
@<run-cell> ( x y -- )
( x y ) DUP2 STH2k
( neighbours ) get-neighbours
( state ) STH2r get-index LDA #00 EQU ?&dead
DUP #02 LTH ?&dies
DUP #03 GTH ?&dies
POP !&save
&dies POP POP2 JMP2r
&dead ( -- )
DUP #03 EQU ?&birth
POP POP2 JMP2r
&birth POP !&save
&save ( x y -- )
STH2
#01 STH2r get-index #1000 ADD2 STA
.world/count LDZ2 INC2 .world/count STZ2
JMP2r
@get-index ( x y -- index* )
HEIGHT-MOD SWP WIDTH-MOD SWP
TOS 8** ROT 8/ TOS ++ [ BANK1 ++ ]
( y ) #3f AND #00 SWP #60 SFT2 ROT
( x ) #3f AND #00 SWP ADD2 ;bank1 ADD2 JMP2r
RTN
@set-cell ( x y -- )
DUP2 ,get-index JSR STH2
POP 8MOD #01 SWP SFL
LDAkr STHr SWP ORA
STH2r STA
RTN
@unset-cell ( x y -- )
DUP2 ,get-index JSR STH2
POP 8MOD #01 SWP SFL #ff EOR
LDAkr STHr SWP AND
STH2r STA
RTN
@get-cell ( x y -- cell )
DUP2 ,get-index JSR LDA
NIP SWP
8MOD
SFT 2MOD
RTN
@<set-cell> ( x y -- )
get-index STH2
#01 STH2r STA
JMP2r
@get-neighbours ( x y -- neighbours )
( -1,-1 ) DUP2 #01 - [ SWP #01 - SWP ] ,get-cell JSR STH
( 0,-1 ) DUP2 #01 - ,get-cell JSR STH ADDr
( +1,-1 ) DUP2 #01 - [ SWP INC SWP ] ,get-cell JSR STH ADDr
( -1, 0 ) DUP2 [ SWP #01 - SWP ] ,get-cell JSR STH ADDr
( +1, 0 ) DUP2 [ SWP INC SWP ] ,get-cell JSR STH ADDr
( -1,+1 ) DUP2 INC [ SWP #01 - SWP ] ,get-cell JSR STH ADDr
( 0,+1 ) DUP2 INC ,get-cell JSR STH ADDr
( +1,+1 ) INC [ SWP INC SWP ] ,get-cell JSR STH ADDr
STHr
,&y STR
,&x STR
[ LITr 00 ] #0800
&l ( -- )
#00 OVRk ADD2 ;&mask ADD2 LDA2
( ) [ LIT &y $1 ] ADD SWP
( ) [ LIT &x $1 ] ADD SWP get-index LDA [ STH ADDr ]
( stop at 3 ) DUPr [ LITr 03 ] GTHr [ LITr _&end ] JCNr
( ) INC GTHk ?&l
&end POP2 STHr JMP2r
&mask [
ffff 00ff 01ff ff00 0100 ff01 0001 0101 ]
RTN
@within-rect ( x* y* rect -- flag )
STH
( y < rect.y1 ) DUP2 STHkr INC INC LDZ2 LTH2 ?&skip
( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ?&skip
SWP2
( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ?&skip
( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ?&skip
POP2 POP2 POPr #01 JMP2r
&skip POP2 POP2 POPr #00 JMP2r
@draw-short ( short* color -- )
(
@|drawing )
STH SWP
DUP #04 SFT TOS 8** ;font-hex ++ .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO
#0f AND TOS 8** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO
DUP #04 SFT TOS 8** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO
#0f AND TOS 8** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHr .Screen/sprite DEO
@<redraw> ( -- )
( | draw count )
.anchor/x LDZ2 .Screen/x DEO2
.anchor/y2 LDZ2 #0008 ADD2 .Screen/y DEO2
[ LIT2 01 -Screen/auto ] DEO
.world/count LDZ2 <draw-short>
( | draw grid )
[ LIT2 01 -Screen/auto ] DEO
.anchor/y LDZ2 .Screen/y DEO2
;bank2 ;bank1
&l ( -- )
DUP #3f AND ?{
.Screen/y DEI2k INC2 INC2 ROT DEO2
.anchor/x LDZ2 .Screen/x DEO2 }
LDAk INC .Screen/pixel DEO
[ LIT2 00 -Screen/pixel ] DEO
INC2 GTH2k ?&l
POP2 POP2 JMP2r
RTN
@<draw-short> ( short* -- )
SWP <draw-byte>
( >> )
@on-input ( -> )
,&main JSR
BRK
@<draw-byte> ( byte color -- )
DUP #04 SFT <draw-hex>
#0f AND
( >> )
&main
.Console/read DEI #20 GTH JMP JMP2r ( ignore whitespace )
.Console/read DEI LIT 'b EQU ,unset-run JCN
.Console/read DEI LIT 'o EQU ,set-run JCN
.Console/read DEI LIT '$ EQU ,input-eol JCN
.Console/read DEI LIT '! EQU ,input-eop JCN
LIT2 '0 '9 .Console/read DEI IN-RANGE ,input-number JCN
;on-ignore-until-eol .Console/vector DEO2
@<draw-hex> ( char color -- )
#00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
[ LIT2 03 -Screen/sprite ] DEO
JMP2r
@unset-run ( -- )
;unset-cell ,run JMP ( tail call )
@<update-cursor> ( color addr* -- )
[ LIT2 00 -Screen/auto ] DEO
;fill-icn .Screen/addr DEO2
#40 <draw-cursor>
.Mouse/x DEI2 ,<draw-cursor>/x STR2
.Mouse/y DEI2 ,<draw-cursor>/y STR2
.Screen/addr DEO2
( >> )
@set-run ( -- )
;set-cell ( fall through )
@run ( cell-fn* -- )
STH2
;on-frame-paused .Screen/vector DEO2
.rle/n LDZk #00 ROT STZ
DUP #00 NEQ JMP INC
&loop ( count / cell-fn* )
DUP #00 EQU ,&end JCN
.rle/x LDZ .rle/y LDZ STH2kr JSR2
.rle/x LDZk INC SWP STZ
#01 SUB
,&loop JMP
&end
POP POP2r
@<draw-cursor> ( color -- )
[ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 &y $2 ] .Screen/y DEO2
.Screen/sprite DEO
JMP2r
@input-number ( -- )
.rle/n LDZk #0a MUL
.Console/read DEI LIT '0 SUB
ADD SWP STZ
JMP2r
(
@|assets )
@input-eol ( -- )
WIDTH .rle/x LDZ SUB .rle/n STZ
,unset-run JSR
#00 .rle/x STZ
.rle/y LDZk INC SWP STZ
JMP2r
@MMU ( programs )
&clear1 [ 01 1000 0000 =bank3 0000 =bank1 ]
&clear2 [ 01 1000 0000 =bank3 0000 =bank2 ]
&move21 [ 01 1000 0000 =bank2 0000 =bank1 ]
@input-eop ( -- )
,input-eol JSR
HEIGHT .rle/y LDZ GTH ,input-eop JCN
;on-frame .Screen/vector DEO2
#00 .rle/y STZ
BRK
@cursor-icn [ 80c0 e0f0 f8e0 1000 ]
@on-ignore-until-eol ( -> )
.Console/read DEI #0a EQU JMP BRK
;on-input .Console/vector DEO2
BRK
@fill-icn [ ffff ffff ffff ffff ]
@cursor
80c0 e0f0 f8e0 1000
@font-hex [
7c82 8282 8282 7c00 3010 1010 1010 3800
7c82 027c 8080 fe00 7c82 021c 0282 7c00
2242 82fe 0202 0200 fe80 807c 0282 7c00
7c82 80fc 8282 7c00 fe82 0408 0810 1000
7c82 827c 8282 7c00 7c82 827e 0202 0200
7c82 82fe 8282 8200 fc82 82fc 8282 fc00
7c82 8080 8082 7c00 fc82 8282 8282 fc00
fe80 80f0 8080 fe00 fe80 80f0 8080 8000 ]
(
@|memory )
|8000 @bank1 $1000
@bank2 $1000
@bank3 $1000
@font-hex
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
007c 8280 fc82 827c 007c 8202 1e02 0202
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080

View File

@ -0,0 +1,172 @@
( mandelbrot.tal )
( )
( by alderwick and d_m )
( )
( uses 4.12 fixed point arithmetic. )
( SCALE LOGICAL SCREENSIZE )
( #0001 21x16 42x32 )
( #0002 42x32 84x64 )
( #0004 84x64 168x128 )
( #0008 168x128 336x256 )
( #0010 336x256 672x512 )
( #0020 672x512 1344x1024 )
%SCALE { #0009 } ( 32 )
%WIDTH { #0015 } ( 21 )
%HEIGHT { #0010 } ( 16 )
%XMIN { #de69 } ( -8601 => -8601/4096 => -2.100 )
%XMAX { #0b33 } ( 2867 => 2867/4096 => 0.700 )
%YMIN { #ecc7 } ( -4915 => -4915/4096 => -1.200 )
%YMAX { #1333 } ( 4915 => 4915/4096 => 1.200 )
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|0100 ( -> )
( set colors )
#00ff .System/r DEO2
#0ff0 .System/g DEO2
#0f0f .System/b DEO2
( set window size )
width #10 SFT2 .Screen/width DEO2
height #10 SFT2 .Screen/height DEO2
( run )
draw-mandel BRK
( logical width )
@width ( -> w* )
WIDTH SCALE MUL2 JMP2r
( logical height )
@height ( -> h* )
HEIGHT SCALE MUL2 JMP2r
( draw the mandelbrot set using 4.12 fixed point numbers )
@draw-mandel ( -> )
XMAX XMIN SUB2 width DIV2 ,&dx STR2 ( ; &dx<-{xmax-min}/width )
YMAX YMIN SUB2 height DIV2 ,&dy STR2 ( ; &dy<-{ymax-ymin}/height )
[ LIT2 01 -Screen/auto ] DEO ( ; auto<-1 )
LIT2r 8000 ( [8000] )
YMAX YMIN ( ymax* ymin* [8000] )
&yloop ( ymax* y* [8000] )
XMAX XMIN ( ymax* y* xmax* xmin* [8000] )
&xloop ( ymax* y* xmax* x* [8000] )
ROT2k evaluate ( ymax* y* xmax* x* xmax* count^ [8000] )
draw-px POP2 ( ymax* y* xmax* x* [8000] )
[ LIT2 &dx $2 ] ADD2 ( ymax* y* xmax* x+dx* [8000] )
OVR2 STH2kr ADD2 ( ymax* y* xmax* x+dx* 8000+xmax* [8000] )
OVR2 STH2kr ADD2 ( ymax* y* xmax* x+dx* 8000+xmax* 8000+x+dx* [8000] )
GTH2 ?&xloop ( ymax* y* xmax* x+dx* [8000] )
POP2 POP2 ( ymax* y* [8000] )
#0000 .Screen/x DEO2 ( ymax* y* [8000] ; sc/x<-0 )
.Screen/y ;inc2 adjust ( ymax* y* [8000] ; sc/y<-sy+1 )
[ LIT2 &dy $2 ] ADD2 ( ymax* y+dy* [8000] )
OVR2 STH2kr ADD2 ( ymax* y+dy* 8000+ymax* [8000] )
OVR2 STH2kr ADD2 ( ymax* y+dy* 8000+ymax* 8000+y+dy* [8000] )
GTH2 ?&yloop ( ymax* y+dy* [8000] )
POP2 POP2 POP2r JMP2r ( )
( dithering pattern for 2x2 pixels: )
( )
( |o o| -> |x o| -> |x o| -> |x x| -> |x x| )
( |o o| -> |o o| -> |o x| -> |o x| -> |x x| )
( )
( |[p+3]/4 [px+1]/4| )
( |[p+0]/4 [px+2]/4| )
@draw-px ( px^ -> )
INCk INCk INC ( p+0 p+1 p+3 )
draw-quad draw-quad ( p+0 ; draw NW, NE )
.Screen/y ;inc1 adjust ( ; y<-y+1 )
.Screen/x ;sub2 adjust ( ; x<-x-2 )
INCk INC SWP ( p+2 p+0 )
draw-quad draw-quad ( ; draw SW, SE )
.Screen/y ;sub1 !adjust ( ; y<-y-1 )
( draw one quadrant of a 2x2 area )
@draw-quad ( p^ -> )
#02 SFT .Screen/pixel DEO JMP2r ( ; pixel<-p/4 )
( evaluate the mandelbrot function at one point )
@evaluate ( x* y* -> count^ )
#0000 DUP2 ,&x1 STR2 ( x* y* ; x1<-0 )
DUP2 ,&y1 STR2 ( x* y* ; y1<-0 )
DUP2 ,&x2 STR2 ( x* y* ; x2<-0 )
,&y2 STR2 ( x* y* ; y2<-0 )
LIT2r 2000 ( x* y* [20 00] )
&loop ( x* y* [20 n^] )
[ LIT2 &x1 $2 ] ( x* y* x1* [20 n^] )
[ LIT2 &y1 $2 ] ( x* y* x1* y1* [20 n^] )
smul2 DUP2 ADD2 ( x* y* 2x1y1* [20 n^] )
OVR2 ADD2 ,&y1 STR2 ( x* y* [20 n^] ; y1<-2x1y1+y* )
SWP2 [ LIT2 &x2 $2 ] ( y* x* x2* [20 n^] )
[ LIT2 &y2 $2 ] SUB2 ( y* x* x2-y2* [20 n^] )
OVR2 ADD2 ,&x1 STR2 SWP2 ( x* y* [20 n^] ; x1<-x2-y2+x* )
,&x1 LDR2 square ( x* y* x1^2* [20 n^] )
DUP2 ,&x2 STR2 ( x* y* x1^2* [20 n^] ; x2<-x1^2* )
,&y1 LDR2 square ( x* y* x1^2* y1^2* [20 n^] )
DUP2 ,&y2 STR2 ( x* y* x1^2* y1^2* [20 n^] ; y2<-y1^2* )
ADD2 #4000 GTH2 ?&end ( x* y* [20 n^] )
INCr GTHkr STHr ?&loop ( x* y* [20 n+1*] )
&end ( x* y* [20 count^] )
POP2 POP2 NIPr STHr JMP2r ( count^ )
( is x a non-negative signed value? )
@non-negative ( x* -> x* x>=0^ )
DUP2 #8000 LTH2 JMP2r
( multiply two signed 4.12 fixed point numbers )
@smul2 ( a* b* -> ab* )
LIT2r 0001 non-negative ?{ negate SWPr } ( a* |b|* [sign*] )
SWP2 non-negative ?{ negate SWPr } ( |b|* |a|* [sign*] )
smul2-pos STHr ?{ negate } POPr JMP2r ( ab* )
( multiply two non-negative fixed point numbers )
( )
( a * b = {a0/16 + a1/4096} * {b0/16 + b1/4096} )
( = a0b0/256 + a1b0/65536 + a0b1/65536 + a1b1/16777216 )
( = x + y + z + 0 ; the last term is too small to represent, i.e. zero )
( )
( x = a0b0 << 4 )
( y = a1b0 >> 4 )
( z = a0b1 >> 4 )
@smul2-pos ( a* b* -> ab* )
aerate ROT2 aerate ( b0* b1* a0* a1* )
STH2 ROT2k STH2 MUL2r ( b0* b1* a0* b1* a0* [a1b0*] )
MUL2 STH2 ADD2r ( b0* b1* a0* [a1b0+a0b1*] )
NIP2 MUL2 #07ff min #40 SFT2 ( a0b0* [y+z*] )
STH2r #04 SFT2 ADD2 ( x* [y+z*] )
#7fff !min ( ab* )
( equivalent to DUP2 smul2 but faster )
@square ( a* -> aa* )
non-negative ?{ negate } ( |a|* )
aerate ( 00 ahi^ 00 alo^ )
OVR2 MUL2 #03 SFT2 SWP2 ( yz* ahi* )
DUP2 MUL2 #07ff min #40 SFT2 ( x* yz* )
ADD2 #7fff !min ( aa* )
( update a device d^ given a function f: x* -> f[x]* )
@adjust ( d^ f* -> )
STH2 DEI2k STH2r JSR2 ROT DEO2 JMP2r
( return the minimum of two non-negative numbers. )
@min ( x* y* )
GTH2k [ JMP SWP2 ] NIP2 JMP2r
( convert each byte of a a short into a short )
@aerate ( x* -> 00 xhi^ 00 xlo^ )
SWP #0000 ROT SWP2 SWP JMP2r
( negate a fixed point number. doesn't work for #8000 )
@negate ( x* -> -x* )
DUP2k EOR2 SWP2 SUB2 JMP2r
( useful arithmetic operations )
@inc2 ( n* -> n+2* ) INC2
@inc1 ( n* -> n+1* ) INC2 JMP2r
@sub1 ( n* -> n-1* ) #0001 SUB2 JMP2r
@sub2 ( n* -> n-2* ) #0002 SUB2 JMP2r

View File

@ -1,89 +1,63 @@
( dev/controller/buttons )
( Move: Use controller arrows, leave a slime. )
%++ { INC2 }
%-- { #0001 SUB2 }
%2// { #01 SFT2 }
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller &vector $2 &button $1 &key $1
|000
( devices )
@hello &x $2 &y $2
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|100
( variables )
|0000
@slime $1
( init )
|0100 ( -> )
( theme )
#0daf .System/r DEO2
#02ff .System/g DEO2
#035f .System/b DEO2
( vectors )
@on-reset ( -> )
( | theme )
#c0f4 .System/r DEO2
#c0fc .System/g DEO2
#c0f7 .System/b DEO2
( | vectors )
;on-frame .Screen/vector DEO2
( set origin )
.Screen/width DEI2 2// .Screen/x DEO2
.Screen/height DEI2 2// .Screen/y DEO2
;default_icn .Screen/addr DEO2
#41 .Screen/sprite DEO
#0a .slime STZ
BRK
( | set origin )
.Screen/width DEI2 #01 SFT2 .hello/x STZ2
.Screen/height DEI2 #01 SFT2 .hello/y STZ2
[ LIT2 16 -Screen/auto ] DEO
#00 !on-frame/draw
@on-frame ( -> )
.Controller/button DEI DUP ?{ POP BRK }
( flip ) #ff EOR
( | movement )
DUP #10 AND ?{
.hello/y LDZ2k #0001 SUB2 ROT STZ2 }
DUP #20 AND ?{
.hello/y LDZ2k INC2 ROT STZ2 }
DUP #40 AND ?{
.hello/x LDZ2k #0001 SUB2 ROT STZ2 }
DUP #80 AND ?{
.hello/x LDZ2k INC2 ROT STZ2 }
&draw ( button -> )
.hello/x LDZ2 STH2k .Screen/x DEO2
.hello/y LDZ2 STH2k .Screen/y DEO2
;hello-chr .Screen/addr DEO2
[ LIT2 c1 -Screen/sprite ] DEOk DEO
( | draw slime )
[ LITr -Screen/y ] DEO2r
[ LITr -Screen/x ] DEO2r
;slime-icn .Screen/addr DEO2
get-slime .Screen/sprite DEOk DEO
BRK
#0a .slime STZ
;default_icn .Screen/addr DEO2
@get-slime ( button -- color )
DUP #01 AND ?{ POP #05 JMP2r }
#02 AND ?{ #0a JMP2r }
#0f JMP2r
( hold ctrl key to change slime color )
.Controller/button DEI #0f AND
DUP #01 NEQ ,&no-ctrl JCN #05 .slime STZ &no-ctrl
DUP #02 NEQ ,&no-alt JCN #0f .slime STZ &no-alt
POP
@hello-chr [
0007 1820 2040 4044 0000 071f 1f3f 3f3b
00e0 1804 0402 0222 0000 e0f8 f8fc fcdc
4040 4423 2018 0700 3f3f 3b1c 1f07 0000
0202 22c4 0418 e000 fcfc dc38 f8e0 0000 ]
( clear ) #40 .Screen/sprite DEO
( detect movement )
.Controller/button DEI #f0 AND
DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN
( move )
.Screen/y DEI2 -- .Screen/y DEO2
;up_icn .Screen/addr DEO2 &no-up
DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN
( move )
.Screen/y DEI2 ++ .Screen/y DEO2
;down_icn .Screen/addr DEO2 &no-down
DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN
( move )
.Screen/x DEI2 -- .Screen/x DEO2
;left_icn .Screen/addr DEO2 &no-left
DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN
( move )
.Screen/x DEI2 ++ .Screen/x DEO2
;right_icn .Screen/addr DEO2 &no-right
POP
( draw face )
#41 .Screen/sprite DEO
( draw slime )
;slime_icn .Screen/addr DEO2
.slime LDZ .Screen/sprite DEO
BRK
@default_icn [ 3c7e ffdb ffe7 7e3c ]
@up_icn [ 2466 e7db ffff 7e3c ]
@down_icn [ 3c7e ffff dbe7 6624 ]
@left_icn [ 3c7e ef1f 1fef 7e3c ]
@right_icn [ 3c7e f7f8 f8f7 7e3c ]
@slime_icn [ 0000 183c 3c18 0000 ]
@slime-icn [
0000 0000 0003 0707 0000 0000 00c0 e0e0
0707 0300 0000 0000 e0e0 c000 0000 0000 ]

View File

@ -1,232 +0,0 @@
(
uxnasm projects/examples/demos/nametable.tal bin/nametable.rom
uxnemu bin/nametable.rom
)
%+ { ADD } %- { SUB } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%2** { #10 SFT2 } %2// { #01 SFT2 }
%8** { #30 SFT2 } %8// { #03 SFT2 }
%10** { #40 SFT2 } %10// { #04 SFT2 }
%MOD2 { DIV2k MUL2 SUB2 }
%MOD { DIVk MUL SUB }
%RTN { JMP2r }
%WIDTH { #0037 }
%HEIGHT { #0029 } ( 08cf )
%LENGTH { WIDTH HEIGHT MUL2 10** }
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( variables )
|0000
( program )
@tiles-frame
&x $2 &y $2
@nametable-frame
&x $2 &y $2
@buffer $10
|0100 ( -> )
( theme )
#34cd .System/r DEO2
#28ac .System/g DEO2
#297b .System/b DEO2
WIDTH 8** #0010 ++ .Screen/width DEO2
#01e8 .Screen/height DEO2
#0008 .tiles-frame/x STZ2
HEIGHT 8** #0008 ++ .tiles-frame/y STZ2
#0008 .nametable-frame/x STZ2
#0008 .nametable-frame/y STZ2
;input-name
DUP2 ,load JSR
;assoc JSR2
;draw-tiles JSR2
;draw-nametable JSR2
;draw-short JSR2
BRK
@load ( filename* -- )
LIT2r 0000
.File/name DEO2
&stream
#0010 .File/length DEO2
;buffer
DUP2 .File/read DEO2
,find-tile JSR #ffff !! ,&skip JCN
;buffer ;add-tile JSR2
&skip
INC2r
.File/success DEI2 #0000 !! ,&stream JCN
STH2r #0001 -- ;result/tiles STA2
RTN
@find-tile ( addr* -- addr* )
STH2
;result/length LDA2 #0000
&loop
DUP2 10** ;result/data ++ STH2kr ;tiles-equal JSR2 #00 = ,&continue JCN
NIP2 POP2r RTN
&continue
INC2 GTH2k ,&loop JCN
POP2 POP2 POP2r
( default ) #ffff
RTN
@tiles-equal ( a* b* -- bool )
STH2
DUP2 #0010 ++ SWP2
&loop
LDAk LDAkr STHr = ,&continue JCN
POP2 POP2 POP2r #00 RTN
&continue
INC2r
INC2 GTH2k ,&loop JCN
POP2 POP2 POP2r #01
RTN
@add-tile ( addr* -- addr* )
STH2
#0010 #0000
&loop
( addr* ) DUP2 ;result/length LDA2 10** ;result/data ++ ++
( data ) OVR2 STH2kr ++ LDA
( order ) ROT ROT STA
INC2 GTH2k ,&loop JCN
POP2 POP2
POP2r
( incr ) ;result/length LDA2 INC2 ;result/length STA2
RTN
@assoc ( -- length )
LIT2r 0000
.File/name DEO2
&stream
#0010 .File/length DEO2
;buffer
DUP2 .File/read DEO2
;find-tile JSR2 STH2kr SWP2 ;set-tile JSR2
INC2r
.File/success DEI2 #0000 !! ,&stream JCN
POP2r
RTN
( draw )
@draw-tiles ( -- )
.tiles-frame/x LDZ2 .Screen/x DEO2
.tiles-frame/y LDZ2 .Screen/y DEO2
;result/data .Screen/addr DEO2
( width ) LITr 00
( auto x addr ) #05 .Screen/auto DEO
;result/data ;result/length LDA2 10** ++ ;result/data
&loop
STHkr WIDTH NIP MOD ,&continue JCN
.tiles-frame/x LDZ2 .Screen/x DEO2
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
POPr LITr 00
&continue
INCr
#81 .Screen/sprite DEO
#0010 ++ GTH2k ,&loop JCN
POP2 POP2
( auto none ) #00 .Screen/auto DEO
POPr
RTN
@set-tile ( id* addr* -- )
SWP2 2** ;result/data ++ ;result/length LDA2 10** ++ STA2
RTN
@get-tile ( id* -- addr* )
2** ;result/length LDA2 10** ;result/data ++ ++ LDA2
RTN
@draw-nametable ( -- )
;result/tiles LDA2 #0000
&loop
DUP2 WIDTH MOD2 8** .nametable-frame/x LDZ2 ++ .Screen/x DEO2
DUP2 WIDTH DIV2 8** .nametable-frame/y LDZ2 ++ .Screen/y DEO2
DUP2 ;get-tile JSR2 10** ;result/data ++ .Screen/addr DEO2
#81 .Screen/sprite DEO
INC2 GTH2k ,&loop JCN
POP2 POP2
RTN
@draw-short ( -- )
#0008 .Screen/x DEO2
#0008 .Screen/y DEO2
#01 .Screen/auto DEO
;result/length LDA2 SWP
( high ) ,&draw-byte JSR
( low ) ,&draw-byte JSR
#05 .Screen/auto DEO
RTN
&draw-byte ( byte -- )
DUP
( high ) #04 SFT ,&draw-char JSR
( low ) #0f AND ,&draw-char JSR
RTN
&draw-char ( num -- )
#30 SFT #00 SWP ;font-hex ADD2 .Screen/addr DEO2
#01 .Screen/sprite DEO
RTN
@input-name "projects/pictures/bulma37x29.chr $1
@font-hex ( 0-F )
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
007c 8280 fc82 827c 007c 8202 1e02 0202
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080
@result
&length $2
&tiles $2
&data

View File

@ -1,619 +0,0 @@
( piano )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%!~ { NEQk NIP }
%HALT { #01 #0f DEO }
%RTN { JMP2r }
%TOS { #00 SWP }
%MOD { DUP2 / * - }
%GTS2 { #8000 ++ SWP2 #8000 ++ << }
%2/ { #01 SFT }
%2// { #01 SFT2 }
%4// { #02 SFT2 }
%8// { #03 SFT2 }
%8** { #30 SFT2 }
( devices )
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|20 @Screen &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
( variables )
|0000
@last-note $1
@octave $1
@pointer
&x $2 &y $2
@center
&x $2 &y $2
@adsr-view
&x1 $2 &y1 $2 &x2 $2 &y2 $2
@wave-view
&x1 $2 &y1 $2 &x2 $2 &y2 $2
@octave-view
&x1 $2 &y1 $2 &x2 $2 &y2 $2
( program )
|0100 ( -> )
( theme )
#0fe5 .System/r DEO2
#0fc5 .System/g DEO2
#0f25 .System/b DEO2
( vectors )
;on-frame .Screen/vector DEO2
;on-control .Controller/vector DEO2
;on-mouse .Mouse/vector DEO2
;on-message .Console/vector DEO2
( find center )
.Screen/width DEI2 2// .center/x STZ2
.Screen/height DEI2 2// .center/y STZ2
( place octave )
.center/x LDZ2 #0080 -- .octave-view/x1 STZ2
.center/y LDZ2 #0008 ++ .octave-view/y1 STZ2
.octave-view/x1 LDZ2 #0050 ++ .octave-view/x2 STZ2
.octave-view/y1 LDZ2 #0018 ++ .octave-view/y2 STZ2
( place adsr )
.center/x LDZ2 #0020 -- .adsr-view/x1 STZ2
.center/y LDZ2 #0008 ++ .adsr-view/y1 STZ2
.adsr-view/x1 LDZ2 #00a0 ++ .adsr-view/x2 STZ2
.adsr-view/y1 LDZ2 #0018 ++ .adsr-view/y2 STZ2
( place waveform )
.center/x LDZ2 #0080 -- .wave-view/x1 STZ2
.center/y LDZ2 #0020 -- .wave-view/y1 STZ2
.wave-view/x1 LDZ2 #0100 ++ .wave-view/x2 STZ2
.wave-view/y1 LDZ2 #0020 ++ .wave-view/y2 STZ2
( default settings )
#ff .last-note STZ
#041c .Audio0/adsr DEO2
#dd .Audio0/volume DEO
;sin-pcm .Audio0/addr DEO2
#0100 .Audio0/length DEO2
( inital drawing )
;draw-octave JSR2
;draw-adsr JSR2
;draw-wave JSR2
BRK
@on-frame ( -> )
.adsr-view/y2 LDZ2 #0020 -- .Screen/y DEO2
#10 #00
&loop
.adsr-view/x2 LDZ2 #003a -- .Screen/x DEO2
#10 OVR - .Audio0/output DEI #0f AND < .Screen/pixel DEO
.adsr-view/x2 LDZ2 #003a -- INC2 INC2 .Screen/x DEO2
#10 OVR - .Audio0/output DEI #04 SFT < .Screen/pixel DEO
.Screen/y DEI2 INC2 INC2 .Screen/y DEO2
INC GTHk ,&loop JCN
POP2
BRK
@on-control ( -> )
( clear last cursor )
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
#40 .Screen/sprite DEO
.Controller/key DEI
[ LIT 'a ] !~ ,&no-c JCN
#30 .octave LDZ #0c * + ;play JSR2 &no-c
[ LIT 's ] !~ ,&no-d JCN
#32 .octave LDZ #0c * + ;play JSR2 &no-d
[ LIT 'd ] !~ ,&no-e JCN
#34 .octave LDZ #0c * + ;play JSR2 &no-e
[ LIT 'f ] !~ ,&no-f JCN
#35 .octave LDZ #0c * + ;play JSR2 &no-f
[ LIT 'g ] !~ ,&no-g JCN
#37 .octave LDZ #0c * + ;play JSR2 &no-g
[ LIT 'h ] !~ ,&no-a JCN
#39 .octave LDZ #0c * + ;play JSR2 &no-a
[ LIT 'j ] !~ ,&no-b JCN
#3b .octave LDZ #0c * + ;play JSR2 &no-b
[ LIT 'k ] !~ ,&no-c2 JCN
#3c .octave LDZ #0c * + ;play JSR2 &no-c2
[ #1b ] !~ ,&no-esc JCN HALT &no-esc
POP
( release )
#00 .Controller/key DEO
.Controller/button DEI
DUP #11 ! ,&cu JCN #3c ;play JSR2 &cu
DUP #21 ! ,&cd JCN #3d ;play JSR2 &cd
DUP #41 ! ,&cl JCN #3e ;play JSR2 &cl
DUP #81 ! ,&cr JCN #3f ;play JSR2 &cr
DUP #12 ! ,&au JCN #40 ;play JSR2 &au
DUP #22 ! ,&ad JCN #41 ;play JSR2 &ad
DUP #42 ! ,&al JCN #42 ;play JSR2 &al
DUP #82 ! ,&ar JCN #43 ;play JSR2 &ar
DUP #14 ! ,&su JCN #44 ;play JSR2 &su
DUP #24 ! ,&sd JCN #45 ;play JSR2 &sd
DUP #44 ! ,&sl JCN #46 ;play JSR2 &sl
DUP #84 ! ,&sr JCN #47 ;play JSR2 &sr
DUP #40 ! ,&l JCN .Audio0/addr DEI2 #0010 -- .Audio0/addr DEO2 &l
DUP #80 ! ,&r JCN .Audio0/addr DEI2 #0010 ++ .Audio0/addr DEO2 &r
POP
;draw-octave JSR2
;draw-wave JSR2
BRK
@on-message ( -> )
.Console/read DEI ;play JSR2
;draw-octave JSR2
BRK
@on-mouse ( -> )
;draw-cursor JSR2
.Mouse/state DEI #00 ! #01 JCN [ BRK ]
.Mouse/x DEI2 .Mouse/y DEI2 .wave-view ;within-rect JSR2
;on-touch-wave-view JCN2
.Mouse/x DEI2 .Mouse/y DEI2 .adsr-view ;within-rect JSR2
;on-touch-adsr-view JCN2
.Mouse/x DEI2 .Mouse/y DEI2 .octave-view ;within-rect JSR2
;on-touch-octave-view JCN2
BRK
@on-touch-wave-view ( -> )
.Mouse/x DEI2 .wave-view/x1 LDZ2 -- .Audio0/length DEO2
;draw-wave JSR2
;draw-cursor JSR2
BRK
@on-touch-octave-view ( -> )
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// NIP #09 ! ,&no-mod JCN
.Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// NIP
[ #00 ] !~ ,&no-incr JCN
.octave LDZ #03 = ,&no-incr JCN
.octave LDZ INC .octave STZ &no-incr
[ #02 ] !~ ,&no-decr JCN
.octave LDZ #ff = ,&no-decr JCN
.octave LDZ #01 - .octave STZ &no-decr
POP
( release ) #00 .Mouse/state DEO
;draw-octave JSR2
BRK
&no-mod
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// NIP #06 > ,&no-key JCN
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// ;notes ++ LDA .octave LDZ #0c * + ;play JSR2
( release ) #00 .Mouse/state DEO
;draw-octave JSR2
&no-key
BRK
@on-touch-adsr-view ( -> )
.Mouse/x DEI2 .adsr-view/x1 LDZ2 -- 8// NIP #03 /
[ #00 ] !~ ,&no-a JCN
.Audio0/adsr DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/adsr DEO &no-a
[ #01 ] !~ ,&no-d JCN
.Audio0/adsr DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr DEO &no-d
[ #02 ] !~ ,&no-s JCN
.Audio0/adsr INC DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/adsr INC DEO &no-s
[ #03 ] !~ ,&no-r JCN
.Audio0/adsr INC DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr INC DEO &no-r
[ #05 ] !~ ,&no-left JCN
.Audio0/volume DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/volume DEO &no-left
[ #06 ] !~ ,&no-right JCN
.Audio0/volume DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/volume DEO &no-right
POP
( release ) #00 .Mouse/state DEO
;draw-adsr JSR2
;draw-cursor JSR2
BRK
@play ( pitch -- )
DUP #0c MOD .last-note STZ
.Audio0/pitch DEO
RTN
@draw-cursor ( -- )
( clear last cursor )
;cursor .Screen/addr DEO2
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
#40 .Screen/sprite DEO
( record pointer positions )
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
( colorize on state )
#41 [ .Mouse/state DEI #00 ! ] + .Screen/sprite DEO
RTN
@draw-octave ( -- )
.octave-view/x1 LDZ2 .octave-view/y1 LDZ2
OVR2 OVR2 ;keys-left-icns .last-note LDZ #00 = INC ;draw-key JSR2
OVR2 #0008 ++ OVR2 ;keys-middle-icns .last-note LDZ #02 = INC ;draw-key JSR2
OVR2 #0010 ++ OVR2 ;keys-right-icns .last-note LDZ #04 = INC ;draw-key JSR2
OVR2 #0018 ++ OVR2 ;keys-left-icns .last-note LDZ #05 = INC ;draw-key JSR2
OVR2 #0020 ++ OVR2 ;keys-middle-icns .last-note LDZ #07 = INC ;draw-key JSR2
OVR2 #0028 ++ OVR2 ;keys-middle-icns .last-note LDZ #09 = INC ;draw-key JSR2
SWP2 #0030 ++ SWP2 ;keys-right-icns .last-note LDZ #0b = INC ;draw-key JSR2
.octave-view/x1 LDZ2 #0048 ++ .Screen/x DEO2
;arrow-icns .Screen/addr DEO2
.octave-view/y1 LDZ2 .Screen/y DEO2
#01 .Screen/sprite DEO
;arrow-icns #0008 ++ .Screen/addr DEO2
.octave-view/y1 LDZ2 #0010 ++ .Screen/y DEO2
#01 .Screen/sprite DEO
;font-hex .octave LDZ #03 + #00 SWP 8** ++ .Screen/addr DEO2
.octave-view/y1 LDZ2 #0008 ++ .Screen/y DEO2
#03 .Screen/sprite DEO
RTN
@draw-key ( x* y* addr* color -- )
STH
.Screen/addr DEO2
SWP2 .Screen/x DEO2
DUP2 #0018 ++ SWP2
&loop
( move ) DUP2 .Screen/y DEO2
( draw ) STHkr .Screen/sprite DEO
( incr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
#0008 ++ GTH2k ,&loop JCN
POP2 POP2
POPr
RTN
@draw-adsr ( -- )
( adsr )
.adsr-view/x1 LDZ2 .adsr-view/y1 LDZ2
.Audio0/adsr DEI #04 SFT
;draw-knob JSR2
.adsr-view/x1 LDZ2 #0018 ++ .adsr-view/y1 LDZ2
.Audio0/adsr DEI #0f AND
;draw-knob JSR2
.adsr-view/x1 LDZ2 #0030 ++ .adsr-view/y1 LDZ2
.Audio0/adsr INC DEI #04 SFT
;draw-knob JSR2
.adsr-view/x1 LDZ2 #0048 ++ .adsr-view/y1 LDZ2
.Audio0/adsr INC DEI #0f AND
;draw-knob JSR2
( volume )
.adsr-view/x2 LDZ2 #0028 -- .adsr-view/y1 LDZ2
.Audio0/volume DEI #04 SFT
;draw-knob JSR2
.adsr-view/x2 LDZ2 #0010 -- .adsr-view/y1 LDZ2
.Audio0/volume DEI #0f AND
;draw-knob JSR2
RTN
@draw-wave ( -- )
( clear )
.wave-view/x1 LDZ2
.wave-view/y1 LDZ2
.wave-view/x2 LDZ2 INC2
.wave-view/y2 LDZ2
#00 ;fill-rect JSR2
#01 ;draw-wave-length JSR2
.wave-view/x1 LDZ2 .Screen/x DEO2
( waveform )
#ff #00
&loop
( dotted line )
DUP #01 AND ,&no-dot JCN
.wave-view/y1 LDZ2 #0010 ++ .Screen/y DEO2
#03 .Screen/pixel DEO
&no-dot
DUP TOS .Audio0/addr DEI2 ++ LDA
2/
TOS 4// .wave-view/y1 LDZ2 ++ .Screen/y DEO2
.Screen/x DEI2 INC2 .Screen/x DEO2
( draw ) DUP
.Audio0/length DEI2 NIP >
.Audio0/length DEI2 #0100 !! #0101 == DUP ADD INC .Screen/pixel DEO
INC GTHk ,&loop JCN
POP2
( range )
.wave-view/x1 LDZ2 .Screen/x DEO2
.wave-view/y1 LDZ2 #0010 -- .Screen/y DEO2
.Audio0/addr DEI2 #02 ;draw-short JSR2
.wave-view/x2 LDZ2 #0020 -- .Screen/x DEO2
.Audio0/length DEI2 #02 ;draw-short JSR2
RTN
@draw-wave-length ( color -- )
STH
.wave-view/x1 LDZ2 .Audio0/length DEI2 ++ .Screen/x DEO2
.wave-view/y1 LDZ2 DUP2 #0020 ++ SWP2
&loop
DUP2 .Screen/y DEO2
( draw ) STHkr .Screen/pixel DEO
INC2 GTH2k ,&loop JCN
POP2 POP2
POPr
RTN
@draw-knob ( x* y* value -- )
( load ) STH .Screen/y DEO2 .Screen/x DEO2
;knob-icns .Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
;knob-icns #0008 ++ .Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
;knob-icns #0018 ++ .Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO
.Screen/x DEI2 #0008 -- .Screen/x DEO2
;knob-icns #0010 ++ .Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO
.Screen/x DEI2 #0004 ++ .Screen/x DEO2
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
;font-hex #00 STHkr #30 SFT ++ .Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO
.Screen/x DEI2 #0004 -- #00 #00 STHkr ;knob-offsetx ++ LDA ++ .Screen/x DEO2
.Screen/y DEI2 #0010 -- #00 #00 STHr ;knob-offsety ++ LDA ++ .Screen/y DEO2
;knob-icns #0020 ++ .Screen/addr DEO2
( draw ) #05 .Screen/sprite DEO
RTN
@draw-short ( short* color -- )
STH SWP
DUP #04 SFT TOS 8** ;font-hex ++ .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO
#0f AND TOS 8** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO
DUP #04 SFT TOS 8** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO
#0f AND TOS 8** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHr .Screen/sprite DEO
RTN
@fill-rect ( x1* y1* x2* y2* color -- )
,&color STR
( x1 x2 y1 y2 ) ROT2
&ver
( save ) DUP2 .Screen/y DEO2
STH2 STH2 OVR2 OVR2 SWP2
&hor
( save ) DUP2 .Screen/x DEO2
( draw ) ,&color LDR .Screen/pixel DEO
( incr ) INC2
OVR2 OVR2 GTS2 ,&hor JCN
POP2 POP2 STH2r STH2r
( incr ) INC2
OVR2 OVR2 GTS2 ,&ver JCN
POP2 POP2 POP2 POP2
RTN
&color $1
@within-rect ( x* y* rect -- flag )
STH
( y < rect.y1 ) DUP2 STHkr #02 ADD LDZ2 LTH2 ,&skip JCN
( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN
SWP2
( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN
( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN
POP2 POP2 POPr
#01
RTN
&skip
POP2 POP2 POPr
#00
RTN
@cursor
80c0 e0f0 f8e0 1000
@arrow-icns
0010 387c fe10 1000
0010 1010 fe7c 3810
@notes
30 32 34 35
37 39 3b 3c
@keys-left-icns
7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7e7f
7f7f 7f7f 7f7f 3e00
@keys-middle-icns
1c1c 1c1c 1c1c 1c1c
1c1c 1c1c 1c1c 3e7f
7f7f 7f7f 7f7f 3e00
@keys-right-icns
1f1f 1f1f 1f1f 1f1f
1f1f 1f1f 1f1f 3f7f
7f7f 7f7f 7f7f 3e00
@knob-icns
0003 0c10 2020 4040
00c0 3008 0404 0202
4040 2020 100c 0300
0202 0404 0830 c000
0000 183c 3c18 0000
@knob-offsetx
01 00 00 00 00 01 02 03
05 06 07 08 08 08 08 07
@knob-offsety
07 06 05 03 02 01 00 00
00 00 01 02 03 05 06 07
@font-hex ( 0-F )
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
007c 8280 fc82 827c 007c 8202 1e02 0202
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080
@piano-pcm
8182 8588 8d91 959b a1a6 aaad b2b5 b8bd
c1c7 cbd0 d5d9 dde1 e5e5 e4e4 e1dc d7d1
cbc5 bfb8 b2ac a6a2 9c97 928d 8884 807c
7977 7574 7372 7272 7273 7372 706d 6964
605b 5650 4d49 4643 4342 4244 4548 4a4d
5052 5556 5758 5554 5150 4c4a 4744 423f
3d3c 3a38 3835 3431 3030 2f31 3336 393e
4449 4e54 5a60 666b 7175 7b82 8990 989e
a6ab b1b6 babd bebf bfbe bbb9 b6b3 b0ae
aaa8 a6a3 a19e 9c9a 9997 9696 9798 9b9e
a1a4 a6a9 a9ac adad adae aeaf b0b0 b1b1
b3b3 b4b4 b4b3 b3b1 b0ad abab a9a9 a8a8
a7a5 a19d 9891 8b84 7e77 726e 6b6b 6b6c
6f71 7477 7776 7370 6c65 5e56 4e48 423f
3d3c 3b3a 3a39 3838 3839 393a 3c3e 4146
4a50 575b 6064 686a 6e70 7274 7677 7a7d
@violin-pcm
8186 8d94 9ba0 a3a7 acb1 b5bc c2c7 cacc
cecf d0d1 d3d5 d8db dee1 e3e5 e6e5 e5e3
dfdc d7d0 c8c2 bbb2 a99f 968c 847c 746e
675f 5851 4b43 3e3a 3533 312e 2c2b 2826
2422 2122 2327 2d34 3c44 4c57 5f68 7075
7b80 8487 8789 8a8c 8d90 9397 999c 9ea0
a2a2 a2a0 9c97 9491 8f8e 908f 918f 8e88
827a 726a 6058 5047 423f 3f40 4245 4748
4949 4746 4545 4a4f 5863 717f 8b9a a6b1
b8be c1c1 bfbd bab5 b1af acac aeb1 b7bc
c2c9 cfd3 d5d4 d3d3 d1ce cbc6 c0ba b3ab
a39a 8f85 7b72 6c67 6462 605f 5e5d 5b58
5550 4d49 4848 4949 4a4d 5052 5558 5b5e
6164 686c 7074 7677 7979 7a7b 7b7a 7977
7473 6f6e 6b69 696b 6f72 7576 7574 716b
655d 554e 4742 3f3f 4045 4b52 5a62 6b74
@sin-pcm
8083 8689 8c8f 9295 989b 9ea1 a4a7 aaad
b0b3 b6b9 bbbe c1c3 c6c9 cbce d0d2 d5d7
d9db dee0 e2e4 e6e7 e9eb ecee f0f1 f2f4
f5f6 f7f8 f9fa fbfb fcfd fdfe fefe fefe
fffe fefe fefe fdfd fcfb fbfa f9f8 f7f6
f5f4 f2f1 f0ee eceb e9e7 e6e4 e2e0 dedb
d9d7 d5d2 d0ce cbc9 c6c3 c1be bbb9 b6b3
b0ad aaa7 a4a1 9e9b 9895 928f 8c89 8683
807d 7a77 7471 6e6b 6865 625f 5c59 5653
504d 4a47 4542 3f3d 3a37 3532 302e 2b29
2725 2220 1e1c 1a19 1715 1412 100f 0e0c
0b0a 0908 0706 0505 0403 0302 0202 0202
0102 0202 0202 0303 0405 0506 0708 090a
0b0c 0e0f 1012 1415 1719 1a1c 1e20 2225
2729 2b2e 3032 3537 3a3d 3f42 4547 4a4d
5053 5659 5c5f 6265 686b 6e71 7477 7a7d
@tri-pcm
8082 8486 888a 8c8e 9092 9496 989a 9c9e
a0a2 a4a6 a8aa acae b0b2 b4b6 b8ba bcbe
c0c2 c4c6 c8ca ccce d0d2 d4d6 d8da dcde
e0e2 e4e6 e8ea ecee f0f2 f4f6 f8fa fcfe
fffd fbf9 f7f5 f3f1 efed ebe9 e7e5 e3e1
dfdd dbd9 d7d5 d3d1 cfcd cbc9 c7c5 c3c1
bfbd bbb9 b7b5 b3b1 afad aba9 a7a5 a3a1
9f9d 9b99 9795 9391 8f8d 8b89 8785 8381
7f7d 7b79 7775 7371 6f6d 6b69 6765 6361
5f5d 5b59 5755 5351 4f4d 4b49 4745 4341
3f3d 3b39 3735 3331 2f2d 2b29 2725 2321
1f1d 1b19 1715 1311 0f0d 0b09 0705 0301
0103 0507 090b 0d0f 1113 1517 191b 1d1f
2123 2527 292b 2d2f 3133 3537 393b 3d3f
4143 4547 494b 4d4f 5153 5557 595b 5d5f
6163 6567 696b 6d6f 7173 7577 797b 7d7f
@saw-pcm
8282 8183 8384 8685 8888 8889 8a8b 8c8c
8e8e 8f90 9092 9193 9494 9596 9699 9899
9b9a 9c9c 9c9d 9ea0 a1a0 a2a2 a3a5 a4a6
a7a7 a9a8 a9aa aaac adad aeae b0b0 b1b3
b2b4 b5b5 b6b7 b9b8 b9bb babc bdbc bdbe
bfc1 bfc1 c3c1 c4c5 c5c6 c6c7 c9c7 cbca
cbcc cdcd cfcf d2d0 d2d2 d2d5 d4d5 d6d7
d8d8 d9dc d9df dadf dce1 dde5 dce6 dceb
cb1f 1b1e 1c21 1c21 1f23 2025 2127 2329
2529 2829 2a2b 2b2e 2d2f 302f 3231 3234
3334 3536 3836 3939 3a3b 3b3d 3e3d 3f40
4042 4242 4444 4646 4748 474a 4a4b 4d4c
4e4e 4f50 5052 5252 5554 5557 5759 5959
5b5b 5c5d 5d5f 5e60 6160 6264 6365 6566
6867 6969 6a6c 6c6d 6d6e 706f 7071 7174
7475 7576 7777 797a 7a7c 7b7c 7e7d 7f7f

View File

@ -1,65 +1,42 @@
( polycat )
( Polycat:
A cat with one eye, and the hind and tail of a lizard.
Original character by Rekka Bellum )
%RTN { JMP2r }
%2// { #01 SFT2 }
%4// { #02 SFT2 }
%!~ { NEQk NIP }
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
( variables )
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixeld $1 &sprite $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2
|0000
@cat [ &x $2 &y $2 &timer $1 ]
@pointer [ &x $2 &y $2 ]
( program )
@cat &x $2 &y $2 &timer $1
@pointer &x $2 &y $2
|0100 ( -> )
( theme )
#0a3f .System/r DEO2
#05df .System/g DEO2
( theme )
#0a3f .System/r DEO2
#05df .System/g DEO2
#0caf .System/b DEO2
( find center )
.Screen/width DEI2 2// #0008 SUB2 .cat/x STZ2
.Screen/height DEI2 4// DUP2k ADD2 ADD2 #0018 SUB2 .cat/y STZ2
( DOS resolution )
#0140 .Screen/width DEO2
#00c8 .Screen/height DEO2
( vectors )
;on-mouse .Mouse/vector DEO2
;on-frame .Screen/vector DEO2
;draw-polycat JSR2
;draw-ground JSR2
BRK
@on-mouse ( -> )
;draw-cursor JSR2
.Mouse/x DEI2 .cat/x LDZ2 GTH2 #50 SFT
.Mouse/y DEI2 .cat/y LDZ2 GTH2 #60 SFT
ADD #00 SWP ;draw-eye JSR2
BRK
@on-frame ( -> )
.cat/timer LDZ INC [ DUP ] .cat/timer STZ
DUP ,&skip0 JCN #0000 ;draw-tail JSR2 &skip0
[ #10 ] !~ ,&skip1 JCN #0001 ;draw-tail JSR2 &skip1
[ #20 ] !~ ,&skip2 JCN #0002 ;draw-tail JSR2 &skip2
[ #30 ] !~ ,&skip3 JCN #0003 ;draw-tail JSR2 &skip3
[ #40 ] !~ ,&skip4 JCN #0002 ;draw-tail JSR2 &skip4
[ #50 ] !~ ,&skip5 JCN #0001 ;draw-tail JSR2 &skip5
POP
( find center )
.Screen/width DEI2 #01 SFT2 .cat/x STZ2
.Screen/height DEI2 #01 SFT2 .cat/y STZ2
( draw ground )
#f6 .Screen/auto DEO
.cat/y LDZ2 #0018 ADD2 .Screen/y DEO2
.cat/x LDZ2 #0010 SUB2 .Screen/x DEO2
;ground .Screen/addr DEO2
#01 .Screen/sprite DEO
( init )
#ff ;draw-eye/last STA
#ff ;draw-tail/last STA
( set screen mode auto-x )
#05 .Screen/auto DEO
,draw-polycat JSR
BRK
@ -67,84 +44,85 @@ BRK
( ears )
.cat/y LDZ2 .Screen/y DEO2
.cat/x LDZ2 STH2k #0008 SUB2 .Screen/x DEO2
.cat/x LDZ2 #0008 SUB2 .Screen/x DEO2
;ears .Screen/addr DEO2
#81 .Screen/sprite DEO
STH2r .Screen/x DEO2
;ears #0010 ADD2 .Screen/addr DEO2
#81 .Screen/sprite DEO
#0000 ,draw-eye JSR
#0000 ,draw-tail JSR
RTN
@draw-eye ( quad* -- )
.cat/y LDZ2 #0008 ADD2 .Screen/y DEO2
.cat/x LDZ2 STH2k #0008 SUB2 .Screen/x DEO2
DUP2 ;eye ADD2 .Screen/addr DEO2
( draw ) #81 .Screen/sprite DEO
STH2r .Screen/x DEO2
;eye #0010 ADD2 ADD2 .Screen/addr DEO2
( draw ) #81 .Screen/sprite DEO
RTN
@draw-tail ( frame* -- )
#81 .Screen/sprite DEOk DEO
( body )
.cat/y LDZ2 #0010 ADD2 .Screen/y DEO2
.cat/x LDZ2 STH2k #0008 SUB2 .Screen/x DEO2
.cat/x LDZ2 #0008 SUB2 .Screen/x DEO2
;body .Screen/addr DEO2
( draw ) #81 .Screen/sprite DEO
STH2r .Screen/x DEO2
#40 SFT2 ;body #0010 ADD2 ADD2 .Screen/addr DEO2
( draw ) #81 .Screen/sprite DEO
#81 .Screen/sprite DEO
( eye/tail )
#00 ,draw-eye JSR
#00 ;draw-tail ( .. )
RTN
JMP2
@on-mouse ( -> )
.Mouse/x DEI2 .cat/x LDZ2 GTH2 #50 SFT
.Mouse/y DEI2 .cat/y LDZ2 GTH2 #60 SFT
ADD ,draw-eye JSR
.cat/timer LDZ INC [ DUP ] .cat/timer STZ
#04 SFT ,draw-tail JSR
,draw-cursor JSR
BRK
@draw-eye ( quad -- )
DUP ,&last LDR NEQ ,&changed JCN
POP JMP2r &changed
( only redraw on change )
#00 OVR ;eye ADD2 .Screen/addr DEO2
.cat/y LDZ2 #0008 ADD2 .Screen/y DEO2
.cat/x LDZ2 #0008 SUB2 .Screen/x DEO2
#81 .Screen/sprite DEOk DEO
,&last STR
JMP2r
&last $1
@draw-tail ( frame -- )
STHk ,&last LDR NEQ ,&changed JCN
POPr JMP2r &changed
( only redraw on change )
STHr #00 OVR ;frames ADD2 LDA
#00 SWP #40 SFT2 ;body/tail ADD2
.Screen/addr DEO2
.cat/x LDZ2 .Screen/x DEO2
.cat/y LDZ2 #0010 ADD2 .Screen/y DEO2
#81 .Screen/sprite DEO
,&last STR
JMP2r
&last $1
@draw-cursor ( -- )
( clear last cursor )
;cursor .Screen/addr DEO2
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
( last cursor )
;cursor STH2k .Screen/addr DEO2
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
#40 .Screen/sprite DEO
( record pointer positions )
( new cursor )
STH2r .Screen/addr DEO2
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
#41 .Mouse/state DEI #00 NEQ ADD .Screen/sprite DEO
( colorize on state )
#41 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/sprite DEO
JMP2r
RTN
@draw-ground ( -- )
.cat/y LDZ2 #0018 ADD2 .Screen/y DEO2
.cat/x LDZ2 #0010 SUB2 .Screen/x DEO2
;ground .Screen/addr DEO2
#10 #00
&loop
( draw ) #01 .Screen/sprite DEO
( sety ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
( setx ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
( incr ) INC
GTHk ,&loop JCN
POP2
RTN
@cursor
80c0 e0f0 f8e0 1000
@ears
@cursor
80c0 e0f0 f8e0 1000
@frames
00 01 02 03 02 01 00 00
00 00 00 00 00 00 00 00
@ears
081c 3e3e 7f7f ffff 081c 3e3e 7f7f fffc
081c 3c3e 7e7e ffff 081c 3c3e 7e7e ff1f
@eye
081c 3c3e 7e7e ffff 081c 3c3e 7e7e ff1f
@eye
ffff ffff ff7f 3f0f f7ef cfe7 f07c 3f0f
ffff ffff fffe fcf0 87c3 c183 071e fcf0
ffff ffff ff7f 3f0f f0e1 c1e0 f07c 3f0f
@ -153,16 +131,15 @@ RTN
ffff ffff fffe fcf0 0783 c1c3 871e fcf0
ffff ffff ff7f 3f0f f0e0 c1e1 f07c 3f0f
ffff ffff fffe fcf0 07f3 f9fb f71e fcf0
@body
@body
0707 0707 0302 0200 0107 0707 0300 0000
&tail
e0f0 f0e0 e080 8000 c0f2 f9f9 fef8 b000
e0f0 f0e0 e080 8000 c0f2 f9f9 fef8 b000
e0f0 f0e0 e080 8000 c0f2 faf9 fef8 b000
e0f0 f0e0 e080 8000 c0f1 faf9 fef8 b000
0707 0707 0f08 1000 0307 0707 0f00 0000
e0e0 e0e0 e080 8000 f2f9 f9fe b884 8400
@ground
e0e0 e0e0 e080 8000 f2f9 f9fe b884 8400
@ground
bf00 5c02 0202 020c ef10 6f90 8080 8074
ff00 fe01 0100 0116 fd00 3c40 4040 4028
ff00 fe01 0100 0116 fd00 3c40 4040 4028

View File

@ -1,82 +0,0 @@
( pseudo-random number generator,
based on two 16-bit xorshift algorithms by George Marsaglia
http://www.jstatsoft.org/v08/i14/paper )
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
( variables )
|0000
( program )
|0100 ( -> )
( init )
;on-frame .Screen/vector DEO2
( seed prng (must be nonzero) )
#00 .DateTime/second DEI
#00 .DateTime/minute DEI #60 SFT2 EOR2
#00 .DateTime/hour DEI #c0 SFT2 EOR2 ;prng2/x STA2
#00 .DateTime/hour DEI #04 SFT2
#00 .DateTime/day DEI #10 SFT2 EOR2
#00 .DateTime/month DEI #60 SFT2 EOR2
.DateTime/year DEI2 #a0 SFT2 EOR2 ;prng2/y STA2
;prng2/x LDA2 ;prng2/y LDA2 EOR2
ORAk ,&non-zero JCN INC2 &non-zero
;prng/seed STA2
( theme )
#0fe5 .System/r DEO2
#0fc5 .System/g DEO2
#0f25 .System/b DEO2
BRK
@on-frame ( -> )
#c0
&loop
,draw-pixel JSR
INC
DUP ,&loop JCN
POP
BRK
@draw-pixel
,prng2 JSR
#00 SWP .Screen/x DEO2
#00 SWP .Screen/y DEO2
#01 .Screen/pixel DEO
JMP2r
@prng ( -- number* )
( returns the next number in a 65,535-long sequence,
which is never zero but every other 16-bit number
appears once before the sequence repeats )
( http://www.retroprogramming.com/2017/07/xorshift-pseudorandom-numbers-in-z80.html )
,&seed LDR2
DUP2 #70 SFT2 EOR2
DUP2 #09 SFT2 EOR2
DUP2 #80 SFT2 EOR2
,&seed STR2k POP
JMP2r
&seed $2
@prng2 ( -- number* )
( returns the next number in a (2^32-1)-long sequence )
( http://b2d-f9r.blogspot.com/2010/08/16-bit-xorshift-rng-now-with-more.html )
,&x LDR2
DUP2 #50 SFT2 EOR2
DUP2 #03 SFT2 EOR2
,&y LDR2 DUP2 ,&x STR2
DUP2 #01 SFT2 EOR2 EOR2
,&y STR2k POP
JMP2r
&x $2
&y $2

View File

@ -1,159 +0,0 @@
( devices )
( uxnasm rule110.tal rule110.rom && uxnemu rule110.rom )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%2* { #10 SFT } %2/ { #01 SFT } %2** { #10 SFT2 } %2// { #01 SFT2 }
%4* { #20 SFT } %4/ { #02 SFT } %4** { #20 SFT2 } %4// { #02 SFT2 }
%8* { #30 SFT } %8/ { #03 SFT } %8** { #30 SFT2 } %8// { #03 SFT2 }
%10* { #40 SFT } %10/ { #04 SFT } %10** { #40 SFT2 } %10// { #04 SFT2 }
%20* { #50 SFT } %20/ { #05 SFT } %20** { #50 SFT2 } %20// { #05 SFT2 }
%2MOD { #01 AND } %2MOD2 { #0001 AND2 }
%4MOD { #03 AND } %4MOD2 { #0003 AND2 }
%8MOD { #07 AND } %8MOD2 { #0007 AND2 }
%10MOD { #0f AND } %10MOD2 { #000f AND2 }
%ROL2 { DUP2 #0f SFT2 SWP2 #10 SFT2 ++ }
%ROR2 { DUP2 #f0 SFT2 SWP2 #01 SFT2 ++ }
%DEBUG { ;print-hex/byte JSR2 #0a18 DEO }
%DEBUG2 { ;print-hex JSR2 #0a18 DEO }
%RTN { JMP2r }
%WIDTH { #0020 }
%STEPS { #30 }
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|0000
@input
|0100
( set system colors )
#0ff7 .System/r DEO2
#0f0e .System/g DEO2
#0f0c .System/b DEO2
;on-mouse .Mouse/vector DEO2
( set size )
#0080 .Screen/width DEO2
#0180 .Screen/height DEO2
( seed ) #0001 ;input STA2
,render JSR
BRK
@render ( -- )
STEPS #00
&loop
( update )
DUP 2* LDZ2k
;rule-110 JSR2
ROT INC INC STZ2
( draw )
DUP ,draw-line JSR
INC GTHk ,&loop JCN
POP2
RTN
@draw-line ( line -- )
STHk #00 SWP 8** .Screen/y DEO2
#1000
&loop
DUP #00 SWP 8** .Screen/x DEO2
( shift ) INCk #10 SWP -
( get address ) STHkr 2* LDZ2
( bit ) ROT SFT2 #0001 AND2
( get sprite ) 8** ;cell-icns ++ .Screen/addr DEO2
#01 STHkr #00 = + .Screen/sprite DEO
INC GTHk ,&loop JCN
POP2
POPr
RTN
@rule-110 ( value* -- value* )
#0000 ,&res STR2
ROL2 STH2
#1000
&loop
( get 3-bits ) STH2kr #e000 AND2 #0d SFT2 ;rule ++ LDA STH
( get result ) DUP #40 SFT #00 STHr ROT SFT2
( reset ) ROR2 ROR2 ROR2
( save ) ,&res LDR2 ++ ,&res STR2
STH2r ROR2 STH2
INC GTHk ,&loop JCN
POP2
POP2r
,&res LDR2
RTN
&res $2
@rule
00 01 01 01 00 01 01 00
@on-mouse ( -> )
( clear last cursor )
;mouse-icn .Screen/addr DEO2
,&x LDR2 .Screen/x DEO2
,&y LDR2 .Screen/y DEO2
#40 .Screen/sprite DEO
( record pointer positions )
.Mouse/x DEI2 DUP2 ,&x STR2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 ,&y STR2 .Screen/y DEO2
( colorize on state )
#43 [ .Mouse/state DEI #00 ! ] - .Screen/sprite DEO
( on click )
.Mouse/state DEI #00 ! JMP BRK
( toggle bit )
.input LDZ2k
#0001 .Mouse/x DEI2 8// #000f SWP2 -- NIP #40 SFT SFT2 EOR2
ROT STZ2
;render JSR2
( release ) #00 .Mouse/state DEO
BRK
&x $2 &y $2
@print-hex ( value* -- )
SWP ,&byte JSR
&byte ( byte -- )
STHk #04 SFT ,&parse JSR #18 DEO
STHr #0f AND ,&parse JSR #18 DEO
RTN
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 + RTN
&above #57 + RTN
RTN
@mouse-icn
80c0 e0f0 f8e0 1000
@cell-icns
7c82 8282 8282 7c00
7cfe fefe fefe 7c00

View File

@ -1,229 +1,165 @@
( uxnasm projects/examples/demos/snake.tal bin/snake.rom && uxnemu bin/snake.rom )
( uxnemu snake.rom )
%+ { ADD } %- { SUB } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%2/ { #01 SFT } %2* { #10 SFT }
%8// { #03 SFT2 } %8** { #30 SFT2 }
%MOD { DIVk MUL SUB }
%MAX { LTHk JMP SWP POP }
%RTN { JMP2r }
%TOS { #00 SWP }
%BRK? { #01 JCN BRK }
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller &vector $2 &button $1 &key $1
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
|000
@arena &w $1 &h $1
@apple &pos &x $1 &y $1
@snake &pos &x $1 &y $1 &direction $1 &length $1 &dead $1 &tail $40
%DIFFICULTY { #06 }
|100
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
( variables )
|0000
( program )
@arena
&w $1 &h $1 &timer $1
@apple
&x $1 &y $1
@snake
&direction $1 &length $1 &dead $1
&x $1 &y $1
&tail
|0100 ( -> )
( theme )
#0f7e .System/r DEO2
#0fe6 .System/g DEO2
@on-reset ( -> )
( | theme )
#0f7e .System/r DEO2
#0fe6 .System/g DEO2
#0f62 .System/b DEO2
( vectors )
( | vectors )
;on-frame .Screen/vector DEO2
;on-button .Controller/vector DEO2
( resize )
( | resize )
#00c8 .Screen/width DEO2
#0100 .Screen/height DEO2
( set arena )
.Screen/width DEI2 8// NIP .arena/w STZ
.Screen/height DEI2 8// NIP .arena/h STZ
;reset JSR2
BRK
( | set arena )
.Screen/width DEI2 #03 SFT2 .arena/w STZ
POP .Screen/height DEI2 #03 SFT2 .arena/h STZ
POP [ LIT2 01 -Screen/auto ] DEO
reset BRK
@on-frame ( -> )
.arena/timer LDZ INC DUP .arena/timer STZ
DIFFICULTY = BRK?
( clear ) #00 ;draw-snake JSR2
( update ) ;move JSR2
( draw ) #02 .snake/dead LDZ + ;draw-snake JSR2
#83 ;draw-apple JSR2
( score ) .snake/length LDZ #41 ;draw-score JSR2
( reset ) #00 .arena/timer STZ
BRK
[ LIT &f $1 ] INCk ,&f STR
#04 GTH ?{ BRK }
[ LIT2 00 _&f ] STR
#00 <draw-snake>
<move>
[ LIT2 02 -snake/dead ] LDZ ADD <draw-snake>
#83 <draw-apple>
<draw-score>
BRK
@on-button ( -> )
.Controller/button DEI
DUP #08 ! ,&no-escape JCN
;reset JSR2
&no-escape
#04 SFT DUP #00 = ,&skip JCN
DUP .snake/direction STZ
&skip
POP
BRK
.Controller/button DEI
( ) DUP #f0 AND ?&arrow
( ) #0f AND ?&button
BRK
&arrow ( button -> )
#04 SFT .snake/direction STZ
BRK
&button ( -> )
reset BRK
@reset ( -- )
#00 <draw-snake>
#00 <draw-apple>
[ LIT2 00 -snake/dead ] STZ
[ LIT2 00 -snake/length ] STZ
[ LIT2 00 -snake/direction ] STZ
.arena/w LDZ #01 SFT #01 SUB .snake/x STZ
.arena/h LDZ #01 SFT #01 SUB .snake/y STZ
#03 <draw-snake>
!<add-apple>
#00 ;draw-snake JSR2
#00 ;draw-apple JSR2
.arena/w LDZ 2/ #01 - .snake/x STZ
.arena/h LDZ 2/ #01 - .snake/y STZ
#00 .snake/dead STZ
#00 .snake/length STZ
#00 .snake/direction STZ
#03 ;draw-snake JSR2
;add-apple JSR2
RTN
@move ( -- )
( tail )
.snake/x LDZ2 STH2
.snake/length LDZ #00
&loop
( pop ) DUP 2* .snake/tail + LDZ2 STH2 SWP2r
( push ) DUP 2* .snake/tail + STH2r ROT STZ2
INC GTHk ,&loop JCN
POP2
POP2r
.snake/dead LDZ #00 = JMP RTN
@<move> ( -- )
( | copy tail )
[ LITr -snake/pos ] LDZ2r .snake/length LDZ #00
&>loop ( -- )
DUPk ADD .snake/tail ADD LDZ2k STH2
SWP2r STH2r ROT STZ2
INC GTHk ?&>loop
POP2 POP2r
( ) .snake/dead LDZ ?&end
.snake/direction LDZ
DUP #01 ! ,&no-up JCN
.snake/y LDZ #01 -
.arena/h LDZ MAX
.snake/y STZ
&no-up
DUP #02 ! ,&no-down JCN
.snake/y LDZ INC
.arena/h LDZ MOD
.snake/y STZ
&no-down
DUP #04 ! ,&no-left JCN
.snake/x LDZ #01 -
.arena/w LDZ MAX
.snake/x STZ
&no-left
DUP #08 ! ,&no-right JCN
.snake/x LDZ INC
.arena/w LDZ MOD
.snake/x STZ
&no-right
( ) DUP #01 NEQ ?{
.snake/y LDZk #01 SUB .arena/h set-pos }
DUP #02 NEQ ?{
.snake/y LDZk INC .arena/h set-pos }
DUP #04 NEQ ?{
.snake/x LDZk #01 SUB .arena/w set-pos }
DUP #08 NEQ ?{
.snake/x LDZk INC .arena/w set-pos }
POP
( detect collision with apple )
.snake/x LDZ2 .apple/x LDZ2 NEQ2 ,&no-collision-apple JCN
#00 ;draw-apple JSR2
.snake/length LDZ INC .snake/length STZ
;add-apple JSR2
;move JSR2
&no-collision-apple
( | detect collision with apple )
.snake/pos LDZ2 .apple/pos LDZ2 NEQ2 ?{
#00 <draw-apple>
.snake/length LDZk INC SWP STZ
<add-apple>
!<move> }
( | detect collision with body )
.snake/length LDZ #01
&loop-body
( pop ) DUP 2* .snake/tail + LDZ2
.snake/x LDZ2 NEQ2 ,&no-collision-body JCN
#01 .snake/dead STZ
#03 ;draw-snake JSR2
&no-collision-body
INC GTHk ,&loop-body JCN
POP2
&>loop-body ( -- )
DUPk ADD .snake/tail ADD LDZ2 .snake/pos LDZ2 NEQ2 ?{
[ LIT2 01 -snake/dead ] STZ
#03 <draw-snake> }
INC GTHk ?&>loop-body
POP2 &end JMP2r
RTN
@set-pos ( z mod max -- )
LDZ OVR INC ?{ ROT STZ
POP JMP2r }
DIVk MUL SUB SWP STZ
JMP2r
@add-apple ( -- )
@<add-apple> ( -- )
.DateTime/hour DEI2 .DateTime/minute DEI2 MUL2
( ) DUP2 #1234 MUL2 ADD .arena/w LDZ DIVk MUL SUB .apple/x STZ
( ) #abcd MUL2 ADD .arena/h LDZ DIVk MUL SUB .apple/y STZ
JMP2r
.DateTime/hour DEI2 .DateTime/minute DEI2 MUL2 #1234 MUL2 +
.arena/w LDZ MOD .apple/x STZ
.DateTime/hour DEI2 .DateTime/minute DEI2 MUL2 #abcd MUL2 +
.arena/h LDZ MOD .apple/y STZ
RTN
@draw-snake ( color -- )
(
@|drawing )
@<draw-snake> ( color -- )
STH
( draw tail )
( | draw tail )
;snake-icns .Screen/addr DEO2
.snake/length LDZ #00
&loop
DUP 2* .snake/tail + LDZ TOS 8** .Screen/x DEO2
DUP 2* .snake/tail + INC LDZ TOS 8** .Screen/y DEO2
STHkr .Screen/sprite DEO
INC GTHk ,&loop JCN
[ LIT2 -snake/tail -snake/length ] LDZ DUP ADD OVR ADD SWP
&>loop ( -- )
LDZ2k #0005 SFT2 .Screen/y DEO2
#0005 SFT2 .Screen/x DEO2
DUPr [ LITr -Screen/sprite ] DEOr
INC INC GTHk ?&>loop
POP2
( draw head )
.snake/x LDZ TOS 8** .Screen/x DEO2
.snake/y LDZ TOS 8** .Screen/y DEO2
( | draw head )
.snake/pos LDZ2 #0005 SFT2 .Screen/y DEO2
#0005 SFT2 .Screen/x DEO2
;snake-icns/face .Screen/addr DEO2
STHr .Screen/sprite DEO
[ LITr -Screen/sprite ] DEOr
JMP2r
RTN
@draw-apple ( color -- )
.apple/x LDZ TOS 8** .Screen/x DEO2
.apple/y LDZ TOS 8** .Screen/y DEO2
;apple-chr .Screen/addr DEO2
@<draw-apple> ( color -- )
.apple/x LDZ #0005 SFT2 .Screen/x DEO2
.apple/y LDZ #0005 SFT2 .Screen/y DEO2
STHk ;apple-chr ;fill-icn [ LITr 01 JCNr SWP2 POP2 ] .Screen/addr DEO2
.Screen/sprite DEO
JMP2r
RTN
@<draw-score> ( -- )
#0010 DUP2 .Screen/x DEO2
.Screen/y DEO2
.snake/length LDZ
( x0 ) DUP #04 SFT <draw-num>
( >> )
@draw-score ( score color -- )
@<draw-num> ( num -- )
#000f ROT AND #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
[ LIT2 41 -Screen/sprite ] DEO
JMP2r
STH
#0010 .Screen/x DEO2
#0010 .Screen/y DEO2
DUP #04 SFT TOS 8** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO
#0f AND TOS 8** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHr .Screen/sprite DEO
(
@|assets )
RTN
@snake-icns [ 7eff ffff ffff ff7e ]
&face [ 7eff ffdb ffe7 ff7e ]
( assets )
@apple-chr [
0000 76ff ffff 7e3c 1008 0000 0000 0000 ]
@snake-icns
7eff ffff ffff ff7e
&face
7eff ffdb ffe7 ff7e
@apple-chr
0000 76ff ffff 7e3c
1008 0000 0000 0000
@font-hex ( 0-F )
@fill-icn [ ffff ffff ffff ffff ]
@font-hex [
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
@ -231,5 +167,5 @@ RTN
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080
007c 8280 f080 827c 007c 8280 f080 8080 ]

View File

@ -1,417 +0,0 @@
( Dev/Screen )
%RTN { JMP2r }
%++ { INC2 }
%2// { #01 SFT2 }
%4// { #02 SFT2 }
%4** { #20 SFT2 }
%8** { #30 SFT2 }
%8+ { #0008 ADD2 }
%STEP8 { #33 SFT2 }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
( variables )
|0000
@color $1
@selection $1
@center [ &x $2 &y $2 ]
@pointer [ &x $2 &y $2 ]
@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@window [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 &w $2 &h $2 ]
@slider [ &x1 $2 &y $2 &x2 $2 &pos $2 ]
@theme [
&r1 $1 &r2 $1 &r3 $1 &r4 $1
&g1 $1 &g2 $1 &g3 $1 &g4 $1
&b1 $1 &b2 $1 &b3 $1 &b4 $1
]
( program )
|0100 ( -> )
( theme )
#027f .System/r DEO2
#04e7 .System/g DEO2
#06c4 .System/b DEO2
( vectors )
;on-mouse .Mouse/vector DEO2
( size window )
#00b0 .window/w STZ2
#0050 .window/h STZ2
( center window )
.Screen/width DEI2 2// .window/w LDZ2 2// SUB2 .window/x1 STZ2
.Screen/height DEI2 2// .window/h LDZ2 2// SUB2 .window/y1 STZ2
#01 .theme/r1 STZ #02 .theme/g1 STZ #03 .theme/b1 STZ
#04 .theme/r2 STZ #06 .theme/g2 STZ #07 .theme/b2 STZ
#0a .theme/r3 STZ #09 .theme/g3 STZ #08 .theme/b3 STZ
#0c .theme/r4 STZ #0b .theme/g4 STZ #0d .theme/b4 STZ
( find screen center )
.Screen/width DEI2 2// .center/x STZ2
.Screen/height DEI2 2// .center/y STZ2
;update-theme JSR2
;draw-background JSR2
;draw-window JSR2
BRK
@on-mouse ( -> )
;draw-cursor JSR2
.Mouse/state DEI #01 JCN [ BRK ]
.Mouse/y DEI2 .window/y1 LDZ2 SUB2 STEP8
DUP2 #0010 NEQ2 ,&no-touch-red JCN
.Mouse/x DEI2 .window/x1 LDZ2 #0060 ADD2 LTH2 ,&no-touch-red JCN
.Mouse/x DEI2 .window/x1 LDZ2 #009c ADD2 GTH2 ,&no-touch-red JCN
( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 4// NIP ;theme/r1 #00 .selection LDZ ADD2 STA
&no-touch-red
DUP2 #0020 NEQ2 ,&no-touch-green JCN
.Mouse/x DEI2 .window/x1 LDZ2 #0060 ADD2 LTH2 ,&no-touch-green JCN
.Mouse/x DEI2 .window/x1 LDZ2 #009c ADD2 GTH2 ,&no-touch-green JCN
( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 4// NIP ;theme/g1 #00 .selection LDZ ADD2 STA
&no-touch-green
DUP2 #0030 NEQ2 ,&no-touch-blue JCN
.Mouse/x DEI2 .window/x1 LDZ2 #0060 ADD2 LTH2 ,&no-touch-blue JCN
.Mouse/x DEI2 .window/x1 LDZ2 #009c ADD2 GTH2 ,&no-touch-blue JCN
( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 4// NIP ;theme/b1 #00 .selection LDZ ADD2 STA
&no-touch-blue
DUP2 #0040 NEQ2 ,&no-touch-radio JCN
.Mouse/x DEI2 .window/x1 LDZ2 #0050 ADD2 LTH2 ,&no-touch-radio JCN
.Mouse/x DEI2 .window/x1 LDZ2 #008c ADD2 GTH2 ,&no-touch-radio JCN
.Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0050 SUB2 STEP8 2// #0008 DIV2 NIP .selection STZ
&no-touch-radio
POP2
;update-theme JSR2
;draw-cursor JSR2
;draw-background JSR2
;draw-window JSR2
BRK
@update-theme ( -- )
#08 DEI #0f AND .theme/r1 LDZ #40 SFT ADD #08 DEO
#0a DEI #0f AND .theme/g1 LDZ #40 SFT ADD #0a DEO
#0c DEI #0f AND .theme/b1 LDZ #40 SFT ADD #0c DEO
#08 DEI #f0 AND .theme/r2 LDZ ADD #08 DEO
#0a DEI #f0 AND .theme/g2 LDZ ADD #0a DEO
#0c DEI #f0 AND .theme/b2 LDZ ADD #0c DEO
#09 DEI #0f AND .theme/r3 LDZ #40 SFT ADD #09 DEO
#0b DEI #0f AND .theme/g3 LDZ #40 SFT ADD #0b DEO
#0d DEI #0f AND .theme/b3 LDZ #40 SFT ADD #0d DEO
#09 DEI #f0 AND .theme/r4 LDZ ADD #09 DEO
#0b DEI #f0 AND .theme/g4 LDZ ADD #0b DEO
#0d DEI #f0 AND .theme/b4 LDZ ADD #0d DEO
RTN
@draw-background ( -- )
( draw hor line )
#0000 .Screen/x DEO2 .center/y LDZ2 .Screen/y DEO2
.Screen/width DEI2 #0000 ( to/from )
&draw-hor
( draw ) #01 .Screen/pixel DEO
( incr ) #0002 ADD2 DUP2 .Screen/x DEO2
GTH2k ,&draw-hor JCN
POP2 POP2
( draw ver line )
.center/x LDZ2 .Screen/x DEO2 #0000 .Screen/y DEO2
.Screen/height DEI2 #0000 ( to/from )
&draw-ver
( draw ) #02 .Screen/pixel DEO
( incr ) #0002 ADD2 DUP2 .Screen/y DEO2
GTH2k ,&draw-ver JCN
POP2 POP2
( draw blending modes )
;preview_icn .Screen/addr DEO2
#0010 .Screen/y DEO2
#0800
&draw-pixel1
( move ) #00 OVR #30 SFT #0010 ADD2 .Screen/x DEO2
( draw ) DUP .Screen/pixel DEO
( incr ) INC
GTHk ,&draw-pixel1 JCN
POP2
#0018 .Screen/y DEO2
#0800
&draw-pixel2
( move ) #00 OVR #30 SFT #0010 ADD2 .Screen/x DEO2
( draw ) DUP #08 ADD .Screen/pixel DEO
( incr ) INC
GTHk ,&draw-pixel2 JCN
POP2
#0020 .Screen/y DEO2
#0800
&draw-icn1
( move ) #00 OVR #30 SFT #0010 ADD2 .Screen/x DEO2
( draw ) DUP .Screen/sprite DEO
( incr ) INC
GTHk ,&draw-icn1 JCN
POP2
#0028 .Screen/y DEO2
#0800
&draw-icn2
( move ) #00 OVR #30 SFT #0010 ADD2 .Screen/x DEO2
( draw ) DUP #08 ADD .Screen/sprite DEO
( incr ) INC
GTHk ,&draw-icn2 JCN
POP2
#0030 .Screen/y DEO2
#0800
&draw-chr1
( move ) #00 OVR #30 SFT #0010 ADD2 .Screen/x DEO2
( draw ) DUP #80 ADD .Screen/sprite DEO
( incr ) INC
GTHk ,&draw-chr1 JCN
POP2
#0038 .Screen/y DEO2
#0800
&draw-chr2
( move ) #00 OVR #30 SFT #0010 ADD2 .Screen/x DEO2
( draw ) DUP #88 ADD .Screen/sprite DEO
( incr ) INC
GTHk ,&draw-chr2 JCN
POP2
RTN
@draw-window ( -- )
.window/x1 LDZ2 .window/w LDZ2 ADD2 .window/x2 STZ2
.window/y1 LDZ2 .window/h LDZ2 ADD2 .window/y2 STZ2
.window/x1 LDZ2 .window/y1 LDZ2 .window/x2 LDZ2 .window/y2 LDZ2 #02 ;fill-rect JSR2
.window/x1 LDZ2 .window/y1 LDZ2 .window/x2 LDZ2 .window/y2 LDZ2 #01 ;line-rect JSR2
.window/x1 LDZ2 #0002 SUB2 .window/y1 LDZ2 #0002 SUB2 .window/x2 LDZ2 #0002 ADD2 .window/y2 LDZ2 #0002 ADD2 #01 ;line-rect JSR2
.window/x1 LDZ2 #0008 ADD2 .window/y1 LDZ2 #0010 ADD2 ;red_txt #05 ;draw-label JSR2
.window/x1 LDZ2 #0038 ADD2 .Screen/x DEO2
.System/r DEI2 #08 ;draw-short JSR2
.window/x1 LDZ2 #0008 ADD2 .window/y1 LDZ2 #0020 ADD2 ;green_txt #05 ;draw-label JSR2
.window/x1 LDZ2 #0038 ADD2 .Screen/x DEO2
.System/g DEI2 #08 ;draw-short JSR2
.window/x1 LDZ2 #0008 ADD2 .window/y1 LDZ2 #0030 ADD2 ;blue_txt #05 ;draw-label JSR2
.window/x1 LDZ2 #0038 ADD2 .Screen/x DEO2
.System/b DEI2 #08 ;draw-short JSR2
.window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0010 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/r1 .selection LDZ ADD LDA 4** #01 ;draw-slider JSR2
.window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0020 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/g1 .selection LDZ ADD LDA 4** #01 ;draw-slider JSR2
.window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0030 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/b1 .selection LDZ ADD LDA 4** #01 ;draw-slider JSR2
.window/x1 LDZ2 #0050 ADD2 .Screen/x DEO2
.window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2
;radio_icns #00 .selection LDZ #00 EQU 8** ADD2 .Screen/addr DEO2
#05 .Screen/sprite DEO
.window/x1 LDZ2 #0060 ADD2 .Screen/x DEO2
.window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2
;radio_icns #00 .selection LDZ #01 EQU 8** ADD2 .Screen/addr DEO2
#05 .Screen/sprite DEO
.window/x1 LDZ2 #0070 ADD2 .Screen/x DEO2
.window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2
;radio_icns #00 .selection LDZ #02 EQU 8** ADD2 .Screen/addr DEO2
#05 .Screen/sprite DEO
.window/x1 LDZ2 #0080 ADD2 .Screen/x DEO2
.window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2
;radio_icns #00 .selection LDZ #03 EQU 8** ADD2 .Screen/addr DEO2
#05 .Screen/sprite DEO
RTN
@draw-cursor ( -- )
( clear last cursor )
;pointer_icn .Screen/addr DEO2
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
#40 .Screen/sprite DEO
( record pointer positions )
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
#43 .Mouse/state DEI #00 NEQ DUP ADD SUB .Screen/sprite DEO
RTN
@draw-slider ( x1* y* x2* pos* color -- )
( load ) .color STZ .slider/pos STZ2 .slider/x2 STZ2 .slider/y STZ2 .slider/x1 STZ2
.slider/x1 LDZ2 .Screen/x DEO2
.slider/y LDZ2 .Screen/y DEO2
;halftone_icn .Screen/addr DEO2
;slidera_icn .Screen/addr DEO2
( draw ) #05 .Screen/sprite DEO
;sliderb_icn .Screen/addr DEO2
&loop
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( draw ) #05 .Screen/sprite DEO
.Screen/x DEI2 .slider/x2 LDZ2 #0008 ADD2 LTH2 ,&loop JCN
( incr ) .Screen/x DEI2 #0004 ADD2 .Screen/x DEO2
;sliderc_icn .Screen/addr DEO2
( draw ) #05 .Screen/sprite DEO
.slider/x1 LDZ2 .slider/pos LDZ2 ADD2 .Screen/x DEO2
;sliderd_icn .Screen/addr DEO2
( draw ) #0a .Screen/sprite DEO
RTN
@fill-rect ( x1* y1* x2* y2* color -- )
.color STZ
STH2 ROT2 ROT2 STH2 ( x2 x1 / y2 y1 )
&ver
( save ) STH2kr .Screen/y DEO2
OVR2 OVR2
&hor
( save ) DUP2 .Screen/x DEO2
( draw ) .color LDZ .Screen/pixel DEO
( incr ) INC2
GTH2k ,&hor JCN
POP2 POP2
( incr ) INC2r
GTH2kr STHr ,&ver JCN
POP2 POP2 POP2r POP2r
RTN
@line-rect ( x1* y1* x2* y2* color -- )
( load ) .color STZ .rect/y2 STZ2 .rect/x2 STZ2 DUP2 .Screen/y DEO2 .rect/y1 STZ2 DUP2 .Screen/x DEO2 .rect/x1 STZ2
&hor
( incr ) .Screen/x DEI2 ++ .Screen/x DEO2
( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
.Screen/x DEI2 .rect/x2 LDZ2 LTH2 ,&hor JCN
.rect/y1 LDZ2 .Screen/y DEO2
&ver
( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ .Screen/pixel DEO
( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .color LDZ .Screen/pixel DEO
( incr ) .Screen/y DEI2 ++ .Screen/y DEO2
.Screen/y DEI2 .rect/y2 LDZ2 ++ LTH2 ,&ver JCN
RTN
@draw-label ( x* y* addr* color -- )
STH STH2
.Screen/y DEO2
.Screen/x DEO2
STH2r
&loop
LDAk #00 SWP 8**
;font ADD2 .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO
( incr ) ++
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
LDAk ,&loop JCN
POP2 POPr
RTN
@draw-short ( short* color -- )
STH SWP
DUP #04 SFT #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO
#0f AND #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2
.Screen/x DEI2 8+ .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO
DUP #04 SFT #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2
.Screen/x DEI2 8+ .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO
#0f AND #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2
.Screen/x DEI2 8+ .Screen/x DEO2
( draw ) STHr .Screen/sprite DEO
RTN
@red_txt [ "Red 00 ]
@green_txt [ "Green 00 ]
@blue_txt [ "Blue 00 ]
@pointer_icn [ 80c0 e0f0 f8e0 1000 ]
@halftone_icn [ aa55 aa55 aa55 aa55 ]
@slidera_icn [ 3f7f ffff ffff 7f3f ]
@sliderb_icn [ ffff ffff ffff ffff ]
@sliderc_icn [ fcfe ffff ffff fefc ]
@sliderd_icn [ 003c 7e7e 7e7e 3c00 ]
@preview_icn
183c 66db db66 3c18
0000 183c 3c18 0000
@radio_icns
3c42 8181 8181 423c
3c42 99bd bd99 423c
@font-hex
003c 464a 5262 3c00 0018 0808 0808 1c00
003c 4202 3c40 7e00 003c 421c 0242 3c00
000c 1424 447e 0400 007e 407c 0242 3c00
003c 407c 4242 3c00 007e 0204 0810 1000
003c 423c 4242 3c00 003c 4242 3e02 3c00
003c 4242 7e42 4200 007c 427c 4242 7c00
003c 4240 4042 3c00 007c 4242 4242 7c00
007e 4078 4040 7e00 007e 4078 4040 4000
@font ( spectrum-zx font )
0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000
0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000
007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000
0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800
0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800
003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038
0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000
0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000
0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400
0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000
0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800
0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000
003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00
0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000
003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810
0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800
003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00
0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00
0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200
0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00
007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00
00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200
0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00
0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00
0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00
0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c
0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400
0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800
0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800
0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800
0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00
0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c

View File

@ -0,0 +1,430 @@
( dev/audio-tests )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|30 @Audio0 [ &vector $2 &position $2 &output $1 &duration $2 &pad $1 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|40 @Audio1 [ &vector $2 &position $2 &output $1 &duration $2 &pad $1 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|50 @Audio2 [ &vector $2 &position $2 &output $1 &duration $2 &pad $1 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|60 @Audio3 [ &vector $2 &position $2 &output $1 &duration $2 &pad $1 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|80 @Controller &vector $2 &button $1 &key $1
|0100 @on-reset ( -> )
( | theme )
#0f8f .System/r DEO2
#0f8f .System/g DEO2
#0f80 .System/b DEO2
( | vectors )
;on-frame .Screen/vector DEO2
;on-button .Controller/vector DEO2
#0000 .Audio0/vector DEO2
;on-audio1 .Audio1/vector DEO2
;on-audio2 .Audio2/vector DEO2
;on-audio3 .Audio3/vector DEO2
( | setup kick )
;kick .Audio0/addr DEO2
;kick/end ;kick SUB2 .Audio0/length DEO2
#ff .Audio0/volume DEO
#00ff .Audio0/adsr DEO2
( | setup sine )
;sine .Audio1/addr DEO2
;sine/end ;sine SUB2
.Audio1/length DEO2
#ff .Audio1/volume DEO
#01ff .Audio1/adsr DEO2
#00c0 .Audio1/duration DEO2
( | setup sine )
;sine .Audio2/addr DEO2
;sine/end ;sine SUB2
.Audio2/length DEO2
#ff .Audio2/volume DEO
#2200 .Audio2/adsr DEO2
#00c0 .Audio2/duration DEO2
( | setup sine )
;sine .Audio3/addr DEO2
;sine/end ;sine SUB2
.Audio3/length DEO2
#ff .Audio3/volume DEO
#0fff .Audio3/adsr DEO2
#00c0 .Audio3/duration DEO2
( | start )
#00 .Audio0/pitch DEO
BRK
@on-button ( -> )
.Controller/button DEI #02 AND ?play-kick
BRK
@play-kick ( -> )
#3c #80 ORA .Audio0/pitch DEO
BRK
@get-note ( offset* -- )
#001f AND2 ;melody ADD2 LDA
JMP2r
@on-audio1 ( -> )
[ LIT2 00 &f $1 ] INCk ,&f STR
get-note .Audio1/pitch DEO
BRK
@on-audio2 ( -> )
[ LIT2 00 &f $1 ] INCk ,&f STR
get-note #0c SUB .Audio2/pitch DEO
BRK
@on-audio3 ( -> )
[ LIT2 00 &f $1 ] INCk ,&f STR
get-note #18 SUB .Audio3/pitch DEO
BRK
@on-frame ( -> )
BRK
@melody [
54 52 54 4f 4b 4f 48 00
54 52 54 4f 4b 4f 48 00
54 56 57 56 57 54 56 54
56 52 54 52 54 50 54 00 ]
@sine [
8083 8689 8c8f 9295 989b 9ea1 a4a7 aaad
b0b3 b6b9 bbbe c1c3 c6c9 cbce d0d2 d5d7
d9db dee0 e2e4 e6e7 e9eb ecee f0f1 f2f4
f5f6 f7f8 f9fa fbfb fcfd fdfe fefe fefe
fffe fefe fefe fdfd fcfb fbfa f9f8 f7f6
f5f4 f2f1 f0ee eceb e9e7 e6e4 e2e0 dedb
d9d7 d5d2 d0ce cbc9 c6c3 c1be bbb9 b6b3
b0ad aaa7 a4a1 9e9b 9895 928f 8c89 8683
807d 7a77 7471 6e6b 6865 625f 5c59 5653
504d 4a47 4542 3f3d 3a37 3532 302e 2b29
2725 2220 1e1c 1a19 1715 1412 100f 0e0c
0b0a 0908 0706 0505 0403 0302 0202 0202
0102 0202 0202 0303 0405 0506 0708 090a
0b0c 0e0f 1012 1415 1719 1a1c 1e20 2225
2729 2b2e 3032 3537 3a3d 3f42 4547 4a4d
5053 5659 5c5f 6265 686b 6e71 7477 7a7d ] &end
@kick [
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7e7f 7e7e
7e7e 7e7e 7e7e 7e7e 7d7d 7d7d 7c7c 7c7c
7c7c 7c7c 7b7b 787a 7576 7775 7a78 7a7a
7b7a 7c7b 7a7c 7879 7a78 7d7b 7f7e 7b7d
6e75 6c6d 8779 a799 949e 5a72 5451 8975
9b9e 657e 3f4a 403f 4e42 725f 9386 a09c
999f 8290 6675 585b 6157 7168 7475 6d73
6f6d 7c74 807e 727a 626a 5e60 6863 7a72
8682 8486 737b 6569 6864 7b74 8786 8186
7579 7372 7875 7b7b 7d7b 837e 8a86 888c
7c85 7077 706f 8076 968a a29c 9ba0 8b94
7d84 7f7d 8984 9790 a19c a4a3 9ea1 9a9c
999a 9999 9a99 9b99 a49f aeaa b2b4 a8ae
9ea1 9f9c a9a3 b3af b7b6 b6b8 b2b4 b1b1
b1b0 b4b2 b4b4 b3b4 b5b4 bab7 bdbb bdbd
bebe bebe babc b9b9 bdbb c0bf c3c2 c2c3
bebf bdbd c0bf c0c2 bbbc bdb9 c5c2 c7c8
c3c6 bec0 bbbb bdbb bfbd c0c0 bcbf b9bb
b9b9 bdba bebe b8bc b1b5 b1b1 b3b2 b2b2
abae a9aa acab b2af b4b3 b2b3 acb0 a4a8
9ca0 9499 8a8f 8184 837f 9288 a09b a1a4
969d 8c90 8989 8a88 8789 8084 777c 6c72
6468 6563 6665 6a68 6d6c 6d6e 696b 6266
5d5f 5b5c 5b5b 5a5b 5658 5354 5152 4e4f
4b4c 494a 4647 4445 4142 3f40 3c3d 3b3c
383a 3637 3535 3234 3031 2f2f 2d2e 2c2c
292a 2728 2626 2425 2324 2222 2121 1f20
1e1f 1d1e 1c1c 1f1e 1e1e 1f1f 1f1f 1c1d
1b1c 1b1b 1a1a 1a1a 1c1b 1b1c 1b1a 1b1b
1b1b 1a1b 1b1b 1c1c 1d1c 1d1d 201e 2121
2021 2020 2020 2221 2222 2423 2524 2827
2929 2929 2a29 2b2a 2d2d 2e2e 2f2e 3231
3434 3334 3533 3836 3c3a 3d3d 3e3d 3f3e
4241 4543 4645 4646 4746 4a48 4f4c 5351
5554 5555 5656 5957 5b5a 5d5c 605e 6462
6766 6968 6a69 6e6c 7371 7676 7476 7171
7572 7e78 8682 8889 8588 8283 8483 8a86
8f8d 9191 9593 9896 9b99 9e9d a09f a1a1
a1a1 a4a3 a8a6 acaa afad b2b1 b4b3 b7b5
bbba bcbb bdbc bebe bfbf c0bf c4c2 c7c6
c8c7 c9c9 cbca cdcc cfcf d1d0 d3d2 d5d4
d6d6 d7d7 dad8 dcdb dddc dedd dfde e0df
e1e1 e2e2 e5e4 e6e5 e7e6 e8e7 e8e8 e9e9
eaea ebeb eceb edec eded eeee efee f0ef
eff0 efef f0ef f0f0 f1f1 f1f1 f2f2 f1f2
eff0 eeef eced edec eded eded eeee eeee
edee ecec ebeb ebeb eaea e9ea e9e9 e7e8
e6e7 e3e4 e3e3 e3e3 e2e3 e1e2 e0e0 dee0
dddd dbdc dadb d9da d7d8 d6d6 d4d5 d2d3
d1d1 ced0 cccd cbcc c9ca c7c8 c5c6 c4c5
c2c3 c0c1 bfc0 bcbd babb b8b9 b7b7 b5b6
b2b3 b0b1 adae abac a9aa a7a8 a6a7 a3a5
a1a2 9fa0 9d9e 9a9b 9899 9596 9293 9091
8e8f 8d8d 8b8c 888a 8486 8082 7d7f 7b7c
7a7b 7a7a 797a 7678 7274 6e70 6a6d 6568
6263 6261 6362 6464 6264 5c60 5659 5254
4e50 4a4c 4b4a 4e4c 4d4e 4c4d 4a4b 4347
3c3f 3638 3535 3635 3938 3939 3637 3335
2e30 292b 2627 2625 2727 2627 2525 2324
2021 1f1f 1d1e 1a1b 191a 1819 1718 1516
1314 1213 1112 1011 0f10 0e0f 0c0d 0a0b
0a0a 0909 0809 0708 0707 0606 0505 0405
0404 0303 0203 0202 0101 0101 0202 0202
0101 0101 0000 0000 0000 0000 0201 0403
0404 0404 0303 0203 0302 0504 0405 0505
0606 0707 0808 0808 0a09 0c0b 0c0c 0c0c
0c0d 0c0c 0e0d 1110 1312 1515 1515 1615
1616 1817 1919 1b1a 1d1c 1f1d 2120 2322
2424 2625 2727 2827 2a29 2c2a 2e2d 302f
3231 3433 3635 3837 3a39 3a3a 3c3b 3f3e
4241 4443 4645 4847 4a49 4b4a 4d4c 4f4e
5150 5453 5655 5958 5b5a 5c5c 5e5d 6160
6362 6564 6766 6968 6b6a 6d6c 6f6e 7271
7574 7777 7878 7979 7b7a 7d7c 7f7e 8281
8584 8786 8988 8b8a 8c8c 8e8d 8f8e 9291
9694 9897 9a99 9a9a 9b9a 9d9c 9f9e a1a0
a3a2 a6a4 a8a7 abaa aead aeae adad aeae
b0af b3b1 b6b4 b8b6 bcba bebd bdbd bcbc
bcbb bebc c0bf c2c1 c5c4 c8c6 cbc9 cbcb
cbcb cccb cdcc cecd cfce d0cf d1d0 d5d3
d6d6 d5d6 d6d5 d6d6 d7d7 d8d8 d9d8 dad9
dada dbdb dedd dfdf dedf dddd dfdd e0e0
e3e1 e4e4 e4e4 e3e3 e0e2 e0e0 e4e2 e6e5
e6e6 e5e6 e2e4 e2e2 e4e2 e6e5 e7e6 e7e7
e7e7 e7e7 e7e7 e8e8 e7e8 e4e5 e4e4 e6e5
e6e6 e6e6 e6e6 e6e6 e6e6 e5e6 e3e5 e2e3
e3e2 e4e4 e4e4 e4e4 e4e4 e4e4 e3e3 e2e3
e1e1 e0e0 dfdf dfdf dfdf dbdd dbdb dcdb
dadb dada dbda dadb d8d9 d6d7 d6d5 d7d7
d6d7 d4d5 d1d2 d1d1 d1d1 d0d1 cecf cdcd
cdcd cbcc cacb c9ca c7c8 c6c6 c5c6 c5c5
c5c5 c4c4 c1c3 bfc0 bfbf bfbf bebf babc
b8b9 b7b7 b7b7 b6b6 b5b5 b3b4 b3b3 b1b2
afb0 aeae adad acad aaab a9a9 a9a9 a8a9
a5a7 a2a3 a1a1 a1a1 a2a1 a1a1 9ea0 9b9c
9899 9797 9797 9897 9999 9999 9798 9495
9192 8e8f 8b8c 8a8a 8a8a 8a8a 8a8a 898a
8889 8586 8183 7f80 7e7e 7f7e 7f7f 7f7f
7d7e 7b7c 797a 7778 7677 7676 7676 7676
7475 7273 7071 6f6f 6e6e 6c6d 6b6c 696a
6969 6969 6969 6969 6768 6667 6465 6364
6263 6061 5f60 5f5f 5f5f 5f5f 5e5f 5d5d
5b5c 595a 5859 5757 5757 5858 5858 5757
5757 5657 5455 5454 5354 5353 5253 5152
5050 4f50 4f4f 5050 4f4f 4e4f 4e4e 4d4d
4e4e 4e4e 4e4e 4d4e 4c4c 4a4b 494a 4949
4949 4949 4949 4949 4949 4848 4747 4847
4848 4748 4747 4647 4646 4646 4546 4445
4444 4444 4444 4444 4343 4343 4343 4343
4343 4343 4242 4141 4040 3f3f 3f3f 4040
4141 4041 3e3f 3d3d 3d3d 3d3d 3d3d 3e3e
3d3d 3d3d 3c3d 3b3c 3a3b 393a 3939 3a39
3b3a 3b3b 3a3b 3839 3838 3738 3637 3636
3736 3838 3838 3738 3637 3435 3333 3534
3435 3233 3332 3333 3534 3334 3233 3132
3131 3232 3232 3232 3232 3232 3132 2e2f
2e2e 2f2e 3030 3030 3030 3030 3030 3030
3030 3030 3030 3030 3030 3030 3030 3030
3030 3030 3030 3030 3030 3030 3030 3030
3030 3030 3131 3332 3434 3435 3333 3333
3333 3433 3635 3737 3636 3636 3636 3837
3a39 3a3a 3939 3a3a 3c3b 3c3c 3b3b 3c3b
3e3d 403f 4040 4040 4140 4242 4343 4443
4544 4746 4847 4848 4948 4a4a 4b4a 4c4c
4d4c 4f4e 504f 5151 5151 5251 5453 5554
5656 5857 5a59 5b5b 5c5c 5d5d 5f5e 605f
6160 6261 6463 6564 6666 6867 6968 6a69
6c6b 6e6d 6f6f 7070 7171 7372 7574 7676
7877 7978 7a7a 7c7b 7e7d 7f7f 8180 8281
8483 8584 8686 8887 8a89 8b8a 8c8c 8e8d
908f 9190 9392 9493 9695 9897 9998 9a9a
9b9a 9d9c 9f9e a1a0 a2a2 a4a3 a5a5 a6a6
a7a7 a9a8 aaa9 acab aead b0af b1b0 b2b1
b4b3 b5b4 b6b5 b8b7 bab9 bcbb bdbc bebd
bfbe c1c0 c3c3 c3c3 c4c3 c5c4 c7c6 c9c8
cbca cccb cccc cecd cfcf cfcf d1cf d4d3
d5d4 d5d5 d6d6 d8d7 dad9 dcdb dcdc dddd
dedd dddd dddd dfde e2e1 e3e2 e3e3 e3e3
e3e3 e4e3 e4e4 e7e5 e9e8 e9e9 eaea eaea
ebea ebeb ebeb ecec edec eeee efef eeef
eeee eeee efef efef efef f0f0 f0f0 f0f0
f1f0 f1f1 f1f1 f1f1 f1f1 f1f1 f1f1 f2f1
f2f2 f2f2 f2f2 f2f2 f2f2 f1f2 f0f0 efef
f0ef f0f0 eff0 eeef eeee efee efef efef
eeef eced ebeb ebeb ebeb e9ea e9e9 e8e8
e7e7 e6e6 e5e6 e5e5 e4e5 e3e4 e2e2 e1e2
e0e0 dfdf dede ddde dcdc dbdb dadb d8d9
d7d7 d6d7 d4d5 d3d4 d1d2 d0d0 cecf cccd
cbcc cacb caca c8c9 c6c7 c4c5 c2c3 c0c1
bfc0 bebf bdbd bbbc b9ba b8b9 b6b7 b4b5
b2b3 b0b1 afaf adae acac aaab a8a9 a5a7
a3a4 a2a3 a0a1 9fa0 9d9e 9b9c 999a 9899
9697 9495 9293 9091 8f8f 8d8e 8b8c 898a
8788 8586 8484 8283 8081 7e7f 7d7e 7b7c
797a 7878 7677 7475 7273 7172 6f70 6e6f
6c6d 6a6b 6869 6767 6566 6465 6262 6061
5f60 5d5e 5c5d 5a5b 595a 5859 5758 5556
5455 5354 5252 5051 4f50 4d4e 4c4d 4b4c
4a4a 4849 4748 4647 4646 4545 4344 4242
4142 4041 3f40 3f3f 3e3e 3d3e 3b3c 3a3b
3a3a 3a3a 3a3a 393a 3939 3738 3636 3536
3334 3333 3433 3434 3334 3333 3233 3232
3132 3131 3131 3132 2f31 2e2e 2d2e 2e2e
2f2f 302f 3030 3030 2f30 2e2e 2e2e 2e2e
2e2e 2e2d 2f2e 2f2f 2f2f 2f2f 2f2f 2f2f
2f2f 2f2f 3030 3131 3131 3131 3131 3131
3131 3232 3332 3433 3434 3535 3434 3434
3535 3635 3736 3737 3838 3838 3838 3939
3a3a 3b3b 3c3c 3d3c 3d3d 3e3d 3e3e 3f3f
403f 4140 4241 4342 4444 4544 4545 4645
4746 4747 4848 4949 4a4a 4b4b 4c4c 4d4c
4e4e 4f4f 5050 5150 5251 5353 5454 5554
5655 5756 5857 5959 5a59 5b5a 5c5b 5d5c
5e5e 5f5e 6060 6161 6262 6362 6463 6565
6666 6767 6868 6969 6a6a 6b6b 6d6c 6e6d
6f6e 706f 7170 7171 7272 7373 7574 7675
7676 7777 7978 7a79 7b7a 7b7b 7c7c 7d7d
7e7e 7f7f 8080 8181 8281 8382 8483 8484
8585 8686 8787 8888 8989 8a8a 8b8a 8b8b
8c8b 8d8c 8e8d 8f8e 8f8f 9090 9090 9191
9191 9292 9393 9494 9594 9595 9695 9696
9796 9797 9898 9998 9999 9a99 9a9a 9a9a
9a9a 9b9b 9c9b 9c9c 9c9c 9d9d 9e9d 9e9e
9f9e 9f9f 9f9f 9f9f 9f9f 9f9f 9f9f a0a0
a0a0 a1a1 a1a1 a1a1 a1a1 a1a1 a2a2 a2a2
a2a2 a2a2 a2a2 a2a2 a3a2 a3a3 a2a2 a2a2
a2a2 a2a2 a2a2 a2a2 a3a3 a3a3 a3a3 a3a3
a3a3 a2a3 a2a2 a2a2 a2a2 a2a2 a2a2 a2a2
a2a2 a1a1 a1a1 a1a1 a1a1 a1a1 a1a1 a1a1
a1a1 a0a1 a0a0 a0a0 a0a0 9f9f 9f9f 9f9f
9e9f 9e9e 9e9e 9e9e 9e9e 9d9d 9d9d 9d9d
9c9d 9c9c 9c9c 9b9b 9b9b 9b9b 9a9b 9a9a
9a9a 9a9a 9999 9999 9899 9898 9898 9898
9798 9797 9697 9696 9596 9595 9595 9595
9495 9494 9394 9393 9393 9393 9292 9292
9191 9191 9191 9091 9090 9090 8f8f 8e8f
8e8e 8e8e 8d8e 8d8d 8d8d 8d8d 8c8d 8c8c
8b8c 8b8b 8b8b 8a8a 8a8a 8a8a 8989 8989
8989 8888 8888 8788 8787 8787 8787 8687
8686 8686 8585 8585 8585 8485 8484 8484
8484 8383 8383 8383 8283 8282 8282 8282
8282 8282 8181 8181 8181 8080 8080 8080
8080 8080 8080 8080 7f7f 7f7f 7f7f 7f7f
7e7f 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
7e7e 7d7e 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
7d7d 7d7d 7e7d 7e7e 7e7e 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7f7f 7f7f 7f7f 7f7f 7f7f
7f7f 7f7f 7f7f 7f7f 8080 8080 8080 8080
8080 8080 8080 8080 8080 8181 8181 8181
8181 8181 8181 8181 8181 8181 8181 8181
8282 8282 8282 8282 8282 8282 8282 8282
8282 8282 8282 8282 8282 8282 8382 8383
8383 8383 8383 8383 8383 8383 8383 8383
8383 8383 8383 8383 8484 8484 8484 8484
8484 8484 8484 8484 8484 8484 8484 8484
8484 8484 8484 8484 8484 8484 8484 8484
8484 8484 8484 8484 8484 8484 8484 8484
8484 8484 8484 8484 8484 8484 8484 8484
8484 8484 8384 8383 8383 8383 8383 8383
8383 8383 8383 8383 8383 8383 8383 8282
8282 8282 8282 8282 8282 8282 8282 8282
8181 8181 8181 8181 8181 8181 8181 8181
8181 8080 8080 8080 8080 8080 8080 8080
7f80 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
7e7f 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7d7e
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7c7d
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7b7c
7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b
7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a
7a7a 7a7a 7a7a 7979 7979 7979 7979 7979
7979 7979 7979 7979 7979 7979 7979 7979
7979 7979 7979 7979 7979 7979 7878 7878
7878 7878 7878 7878 7878 7878 7878 7878
7878 7878 7878 7878 7878 7978 7879 7979
7878 7878 7878 7878 7979 7979 7979 7979
7979 7979 7979 7979 7979 7979 7979 7979
7979 7979 7979 7979 7979 7979 7979 7979
7979 7979 7979 7a79 7a7a 7a7a 7a7a 7a7a
7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a
7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a
7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b
7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b
7b7b 7b7b 7b7b 7b7b 7c7b 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7d7c 7d7d 7d7d
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
7d7d 7d7d 7d7d 7d7d 7e7e 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7e7e 7e7e 7f7f 7f7f 7f7f
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 8080
8080 8080 8080 8080 8080 8080 8080 8080
8080 8080 8080 8080 8080 8080 8080 8080
8181 8181 8181 8181 8181 8181 8181 8181
8181 8181 8181 8181 8181 8181 8181 8282
8282 8282 8282 8282 8282 8282 8282 8282
8282 8282 8282 8282 8282 8282 8282 8282
8383 8383 8383 8383 8383 8383 8383 8383
8383 8383 8383 8383 8383 8383 8383 8383
8383 8383 8383 8383 8484 8484 8484 8484
8484 8484 8484 8484 8484 8484 8484 8484
8484 8484 8484 8484 8484 8484 8484 8484
8484 8484 8484 8484 8584 8585 8585 8585
8585 8585 8585 8585 8585 8585 8585 8585
8585 8585 8585 8585 8585 8585 8585 8585
8585 8585 8585 8585 8585 8585 8585 8585
8585 8585 8585 8585 8585 8585 8585 8585
8585 8585 8585 8585 8585 8585 8585 8585
8585 8585 8585 8585 8585 8585 8585 8585
8585 8585 8585 8585 8585 8585 8585 8585
8585 8585 8585 8585 8585 8585 8484 8484
8484 8484 8484 8484 8484 8484 8484 8484
8484 8484 8484 8484 8484 8484 8484 8484
8383 8383 8383 8383 8383 8383 8383 8383
8383 8383 8383 8383 8383 8383 8383 8383
8283 8282 8282 8282 8282 8282 8282 8282
8282 8282 8282 8282 8282 8282 8182 8181
8181 8181 8181 8181 8181 8181 8181 8181
8181 8181 8181 8181 8181 8080 8080 8080
8080 8080 8080 8080 8080 8080 8080 8080
8080 8080 8080 8080 8080 7f7f 7f7f 7f7f
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
7f7f 7f7f 7f7f 7f7f 7f7f 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7d7e
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7c7c 7c7c 7d7d 7d7d 7d7d
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
7d7d 7d7d 7e7d 7e7e 7e7e 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7f7f 7f7f
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
7f7f 7f7f 7f7f 7f7f
] &end

View File

@ -1,7 +1,5 @@
( dev/audio )
%MOD { DUP2 DIV MUL SUB }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
@ -57,7 +55,7 @@ BRK
( skip ) .timer LDZ #10 EQU #01 JCN [ BRK ]
( get note )
.counter LDZ #18 MOD #30 ADD
.counter LDZ #18 DIVk MUL SUB #30 ADD
.Audio0/pitch .counter LDZ #03 AND #40 SFT ADD DEO
.counter LDZ INC .counter STZ

View File

@ -1,13 +1,7 @@
( dev/audio )
%2// { #01 SFT2 }
%4** { #20 SFT2 }
%8** { #30 SFT2 }
%20MOD { #1f AND }
%RTN { JMP2r }
%GET-NOTE { #00 SWP ;melody ADD2 LDA }
%GET-HEXCHAR { #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2 }
%GET-HEXCHAR { #00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 }
( devices )
@ -44,8 +38,8 @@
#dd .Audio0/volume DEO ( TODO: turn ON )
( center )
.Screen/width DEI2 2// #0080 SUB2 .offset/x STZ2
.Screen/height DEI2 2// #0040 SUB2 .offset/y STZ2
.Screen/width DEI2 #01 SFT2 #0080 SUB2 .offset/x STZ2
.Screen/height DEI2 #01 SFT2 #0040 SUB2 .offset/y STZ2
;draw JSR2
#02 ;draw-selector JSR2
@ -71,12 +65,12 @@ BRK
&no-down
[ #04 ] NEQk NIP ,&no-left JCN
#00 ;draw-selector JSR2
.selection LDZ #01 SUB 20MOD .selection STZ
.selection LDZ #01 SUB #1f AND .selection STZ
#02 ;draw-selector JSR2
&no-left
[ #08 ] NEQk NIP ,&no-right JCN
#00 ;draw-selector JSR2
.selection LDZ INC 20MOD .selection STZ
.selection LDZ INC #1f AND .selection STZ
#02 ;draw-selector JSR2
&no-right
POP
@ -89,9 +83,9 @@ BRK
( skip ) .timer LDZ #10 EQU #01 JCN [ BRK ]
.progress LDZ
( play note ) DUP GET-NOTE .Audio0/pitch DEO
( erase last ) DUP #01 SUB 20MOD #01 ,draw-note JSR
( erase last ) DUP #01 SUB #1f AND #01 ,draw-note JSR
( draw current ) #01 ,draw-note JSR
( incr ) .progress LDZ INC 20MOD .progress STZ
( incr ) .progress LDZ INC #1f AND .progress STZ
#00 .timer STZ
BRK
@ -104,30 +98,30 @@ BRK
INC GTHk ,&loop JCN
POP2
RTN
JMP2r
@draw-note ( id color -- )
STH STH
( set x ) [ #00 STHkr ] 8** .offset/x LDZ2 ADD2 .Screen/x DEO2
( set y ) [ #00 #00 STHkr ;melody ADD2 LDA ] 4** #0100 SWP2 SUB2 .offset/y LDZ2 ADD2 #0080 ADD2 .Screen/y DEO2
( set x ) [ #00 STHkr ] #30 SFT2 .offset/x LDZ2 ADD2 .Screen/x DEO2
( set y ) [ #00 #00 STHkr ;melody ADD2 LDA ] #20 SFT2 #0100 SWP2 SUB2 .offset/y LDZ2 ADD2 #0080 ADD2 .Screen/y DEO2
( set addr ) ;marker-icn [ #00 .progress LDZ STHr EQU #08 MUL ADD2 ] .Screen/addr DEO2
( draw ) STHr .Screen/sprite DEO
RTN
JMP2r
@draw-selector ( color -- )
STH
[ #00 .selection LDZ ] 8** .offset/x LDZ2 ADD2 .Screen/x DEO2
[ #00 .selection LDZ ] #30 SFT2 .offset/x LDZ2 ADD2 .Screen/x DEO2
#0070 .offset/y LDZ2 ADD2 .Screen/y DEO2
;selector-icn .Screen/addr DEO2
STHkr .Screen/sprite DEO
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
.Screen/y DEI2k #0008 ADD2 ROT DEO2
.selection LDZ GET-NOTE STHr ,draw-byte JSR
RTN
JMP2r
@draw-byte ( byte color -- )
@ -139,7 +133,7 @@ RTN
#0f AND GET-HEXCHAR
( draw ) STHr .Screen/sprite DEO
RTN
JMP2r
@melody
54 52 54 4f 4b 4f 48 ff
@ -180,4 +174,4 @@ RTN
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080
007c 8280 f080 827c 007c 8280 f080 8080

View File

@ -1,23 +0,0 @@
( dev/console )
(
Copies data from stdin to both stdout and stderr.
)
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
( init )
|0100 ( -> )
;on-stdin .Console/vector DEO2
BRK
@on-stdin ( -> )
.Console/read DEI
DUP .Console/write DEO
.Console/error DEO
BRK

View File

@ -1,94 +0,0 @@
( dev/console )
%RTN { JMP2r }
%PRINT { ;print JSR2 }
%BR { #0a .Console/write DEO }
( devices )
|10 @Console [ &pad $8 &write $1 ]
( variables )
|0000
@number [ &started $1 ]
( init )
|0100 ( -> )
;char-txt PRINT #42 .Console/write DEO BR
;byte-txt PRINT #ab ;print-byte JSR2 BR
;short-txt PRINT #cdef ;print-short JSR2 BR
;string-txt PRINT ;hello-word ;print JSR2 BR
;hello-word ;print JSR2
#ffff ;print-short JSR2
;is-word ;print JSR2
#ffff ;print-short-decimal JSR2
BRK
@print ( addr* -- )
&loop
( send ) LDAk .Console/write DEO
( incr ) INC2
( loop ) LDAk ,&loop JCN
POP2
RTN
@print-short ( short* -- )
LIT '0 .Console/write DEO
LIT 'x .Console/write DEO
OVR #04 SFT ,&hex JSR
SWP #0f AND ,&hex JSR
DUP #04 SFT ,&hex JSR
#0f AND ,&hex JMP
&hex
#30 ADD DUP #3a LTH ,&not-alpha JCN
#27 ADD
&not-alpha
.Console/write DEO
RTN
@print-byte ( byte -- )
LIT '0 .Console/write DEO
LIT 'x .Console/write DEO
DUP #04 SFT ,&hex JSR
#0f AND ,&hex JMP
&hex
#30 ADD DUP #39 GTH #27 MUL ADD .Console/write DEO
RTN
@print-short-decimal ( short -- )
#00 .number/started STZ
DUP2 #2710 DIV2 DUP2 ,&digit JSR #2710 MUL2 SUB2
DUP2 #03e8 DIV2 DUP2 ,&digit JSR #03e8 MUL2 SUB2
DUP2 #0064 DIV2 DUP2 ,&digit JSR #0064 MUL2 SUB2
DUP2 #000a DIV2 DUP2 ,&digit JSR #000a MUL2 SUB2
,&digit JSR
.number/started LDZ ,&end JCN
LIT '0 .Console/write DEO
&end
RTN
&digit
NIP
DUP .number/started LDZ ORA #02 JCN
POP JMP2r
LIT '0 ADD .Console/write DEO
#01 .number/started STZ
RTN
@char-txt "char: 20 $1
@byte-txt "byte: 20 $1
@short-txt "short: 20 $1
@string-txt "string: 20 $1
@hello-word "hello 20 "World! 0a 00
@is-word 20 "is 20 00

View File

@ -0,0 +1,16 @@
( usage: uxncli console.read.rom )
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|0100
@on-reset ( -> )
;on-console .Console/vector DEO2
( type something in the console )
BRK
@on-console ( -> )
.Console/read DEI .Console/write DEO
#0a .Console/write DEO
BRK

View File

@ -1,19 +1,108 @@
( dev/console )
( usage: uxncli console.rom arg1 arg2 arg3 Prints Hello Uxn!, and listens for incoming stdin events on enter. )
|00 @System $e &debug
|10 @Console $8 &write
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
( init )
|0000
|0100 ( -> )
@buf
;hello-word
&while
( send ) LDAk .Console/write DEO
INC2 LDAk ,&while JCN
POP2
( show debugger ) #01 .System/debug DEO
|0100
BRK
@on-reset ( -> )
;on-argument .Console/vector DEO2
.Console/type DEI ?{ ;on-stdin .Console/vector DEO2 }
;dict/hello <print-str>
BRK
@on-argument ( -> )
.Console/read DEI .buf skey ?{ BRK }
<print-type>
;dict/yousent <print-str>
LIT "" #18 DEO
;buf <print-str>/
LIT "" #18 DEO
#0a18 DEO
;buf sclr/ .Console/type DEI #04 NEQ ?{
;dict/argend <print-str>
;on-stdin .Console/vector DEO2 }
BRK
@on-stdin ( -> )
.Console/read DEI .buf skey ?{ BRK }
;buf ;dict/quit scmp ?&quit
<print-type>
;dict/yousaid <print-str>
LIT "" #18 DEO
;buf <print-str>/
LIT "" #18 DEO
#0a18 DEO
;buf sclr/ BRK
&quit ( buf* -> )
#800f DEO
BRK
@<print-type> ( -- )
[ LIT2 00 -Console/type ] DEI #01 GTH DUP ADD ;types ADD2
( ) LDA2 !<print-str>/
(
@|stdlib )
@<print-str> ( str* -- )
&w ( -- )
LDAk #18 DEO
INC2 & LDAk ?&w
POP2 JMP2r
@sclr ( str* -- )
&w ( -- )
STH2k #00 STH2r STA
INC2 & LDAk ?&w
POP2 JMP2r
@skey ( key buf -- proc )
OVR #20 LTH ?{
#00 SWP sput #00 JMP2r }
POP2 #01 JMP2r
@scap ( str* -- end* )
&w ( -- )
INC2 & LDAk ?&w
JMP2r
@sput ( chr str* -- )
scap/ STA
JMP2r
@scmp ( a* b* -- f )
STH2
&l ( a* b* -- f )
LDAk LDAkr STHr NEQk ?&d
DUP EOR EQUk ?&d
POP2 INC2 INC2r !&l
&d ( a* c1 c2 b* -- f )
NIP2 POP2r EQU JMP2r
@<phex> ( short* -- )
SWP <phex>/b
&b ( -- )
DUP #04 SFT <phex>/c
&c ( -- )
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO
JMP2r
(
@|assets )
@types
=dict/std =dict/arg
@dict ( )
&hello "Welcome 20 "to 20 "Uxn! 0a $1
&yousaid "You 20 "said: 20 $1
&yousent "You 20 "sent: 20 $1
&std "(std) $1
&arg "(arg) $1
&quit "quit $1
&argend "(argend) 0a $1
@hello-word "Hello 20 "Uxn!

View File

@ -0,0 +1,22 @@
( usage: uxncli console.write.rom )
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|0100
@on-reset ( -> )
( | write )
{ "Hello 20 "Write 0a 00 }
STH2r
&wa ( -- )
LDAk .Console/write DEO
INC2 LDAk ?&wa
POP2
( | error )
{ "Hello 20 "Error 0a 00 }
STH2r
&wb ( -- )
LDAk .Console/error DEO
INC2 LDAk ?&wb
POP2 BRK

View File

@ -1,185 +1,162 @@
( dev/controller/keys )
( Controller: Buttons should highlight on press and display the button and key bytes. )
%+ { ADD } %- { SUB } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%RTN { JMP2r }
%TOS { #00 SWP }
%LTS2 { #8000 ++ SWP2 #8000 ++ >> }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
( variables )
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller &vector $2 &button $1 &key $1
|0000
@center
&x $2
&y $2
@frame
&w $2 &h $2
&x0 $2 &y0 $2
&x1 $2 &y1 $2
@color $1
@rect
&x1 $2 &y1 $2
&x2 $2 &y2 $2
@center &x $2 &y $2
@frame &w $2 &h $2 &x0 $2 &y0 $2 &x1 $2 &y1 $2
( init )
|0100
|0100 ( -> )
( theme )
#0ff7 .System/r DEO2
#0f07 .System/g DEO2
#0f07 .System/b DEO2
( find center )
@on-reset ( -> )
( | theme )
#0fff .System/r DEO2
#0f0f .System/g DEO2
#0f0f .System/b DEO2
( | find center )
.Screen/width DEI2 #01 SFT2 .center/x STZ2
.Screen/height DEI2 #01 SFT2 .center/y STZ2
( place controller )
( | place controller )
#0068 .frame/w STZ2
#0030 .frame/h STZ2
.center/x LDZ2 .frame/w LDZ2 #0002 // -- .frame/x0 STZ2
.center/y LDZ2 .frame/h LDZ2 #0002 // -- .frame/y0 STZ2
.frame/x0 LDZ2 .frame/w LDZ2 ++ .frame/x1 STZ2
.frame/y0 LDZ2 .frame/h LDZ2 ++ .frame/y1 STZ2
( vectors )
.center/x LDZ2 .frame/w LDZ2 #01 SFT2 SUB2 .frame/x0 STZ2
.center/y LDZ2 .frame/h LDZ2 #01 SFT2 SUB2 .frame/y0 STZ2
.frame/x0 LDZ2 .frame/w LDZ2 ADD2 .frame/x1 STZ2
.frame/y0 LDZ2 .frame/h LDZ2 ADD2 .frame/y1 STZ2
( | vectors )
;on-button .Controller/vector DEO2
;draw-controller JSR2
BRK
( | frame )
.frame/x0 LDZ2 .frame/y0 LDZ2 .frame/x1 LDZ2 .frame/y1 LDZ2 #03 <line-rect>
<draw-controller>
BRK
@on-button ( -> )
<draw-controller>
( | print stack on start button )
[ LIT2 08 -Controller/button ] DEI NEQ ?{ #010e DEO }
BRK
;draw-controller JSR2
BRK
@draw-controller ( -- )
(
@|drawing )
@<draw-controller> ( -- )
.Controller/button DEI STH
( | d-pad )
.frame/x0 LDZ2 #0010 ADD2 .Screen/x DEO2
.frame/y0 LDZ2 #0010 ADD2 .Screen/y DEO2
;dpad-up-icn .Screen/addr DEO2
#03 STHkr #04 SFT #01 AND SUB .Screen/sprite DEO
.Screen/y DEI2 #0010 ADD2 .Screen/y DEO2
;dpad-down-icn .Screen/addr DEO2
#03 STHkr #05 SFT #01 AND SUB .Screen/sprite DEO
.Screen/y DEI2 #0008 SUB2 .Screen/y DEO2
.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2
;dpad-left-icn .Screen/addr DEO2
#03 STHkr #06 SFT #01 AND SUB .Screen/sprite DEO
.Screen/x DEI2 #0010 ADD2 .Screen/x DEO2
;dpad-right-icn .Screen/addr DEO2
#03 STHkr #07 SFT #01 AND SUB .Screen/sprite DEO
.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2
;fill-icn .Screen/addr DEO2
[ LIT2 03 -Screen/sprite ] DEO
( | options )
.center/y LDZ2 #0009 ADD2 .Screen/y DEO2
.center/x LDZ2 #0009 SUB2 .Screen/x DEO2
;option-icn .Screen/addr DEO2
#03 STHkr #03 SFT #01 AND SUB .Screen/sprite DEO
.center/x LDZ2 #0004 ADD2 .Screen/x DEO2
;option-icn .Screen/addr DEO2
#03 STHkr #02 SFT #01 AND SUB .Screen/sprite DEO
( | buttons )
.center/y LDZ2 .Screen/y DEO2
.center/x LDZ2 #0018 ADD2 .Screen/x DEO2
;button-icn .Screen/addr DEO2
#03 STHkr #01 SFT #01 AND SUB .Screen/sprite DEO
.Screen/y DEI2 #000a ADD2 .Screen/y DEO2
;font-hex/b .Screen/addr DEO2
[ LIT2 03 -Screen/sprite ] DEO
.center/y LDZ2 .Screen/y DEO2
.center/x LDZ2 #0024 ADD2 .Screen/x DEO2
;button-icn .Screen/addr DEO2
#03 STHr #01 AND SUB .Screen/sprite DEO
.Screen/y DEI2 #000a ADD2 .Screen/y DEO2
;font-hex/a .Screen/addr DEO2
[ LIT2 03 -Screen/sprite ] DEO
.center/x LDZ2 #0010 SUB2 .Screen/x DEO2
.center/y LDZ2 #0010 SUB2 .Screen/y DEO2
[ LIT2 01 -Screen/auto ] DEO
.Controller/button DEI2 <draw-short>
[ LIT2 00 -Screen/auto ] DEO
JMP2r
( frame )
.frame/x0 LDZ2 .frame/y0 LDZ2
.frame/x1 LDZ2 .frame/y1 LDZ2
#01 ;line-rect JSR2
( d-pad )
.frame/x0 LDZ2 #0010 ++ .Screen/x DEO2
.frame/y0 LDZ2 #0010 ++ .Screen/y DEO2
;controller-icn/dpad-up .Screen/addr DEO2
#03 [ STHkr #04 SFT #01 AND DUP + - ] .Screen/sprite DEO
.Screen/y DEI2 #0010 ++ .Screen/y DEO2
;controller-icn/dpad-down .Screen/addr DEO2
#03 [ STHkr #05 SFT #01 AND DUP + - ] .Screen/sprite DEO
.Screen/y DEI2 #0008 -- .Screen/y DEO2
.Screen/x DEI2 #0008 -- .Screen/x DEO2
;controller-icn/dpad-left .Screen/addr DEO2
#03 [ STHkr #06 SFT #01 AND DUP + - ] .Screen/sprite DEO
.Screen/x DEI2 #0010 ++ .Screen/x DEO2
;controller-icn/dpad-right .Screen/addr DEO2
#03 [ STHkr #07 SFT #01 AND DUP + - ] .Screen/sprite DEO
.Screen/x DEI2 #0008 -- .Screen/x DEO2
;controller-icn/dpad .Screen/addr DEO2
#03 .Screen/sprite DEO
@<draw-short> ( short* -- )
SWP <draw-byte>
( options )
.center/y LDZ2 #0009 ++ .Screen/y DEO2
.center/x LDZ2 #0009 -- .Screen/x DEO2
;controller-icn/option .Screen/addr DEO2
#03 [ STHkr #02 SFT #01 AND DUP + - ] .Screen/sprite DEO
.center/x LDZ2 #0004 ++ .Screen/x DEO2
;controller-icn/option .Screen/addr DEO2
#03 [ STHkr #03 SFT #01 AND DUP + - ] .Screen/sprite DEO
@<draw-byte> ( byte -- )
DUP #04 SFT <draw-hex>
( buttons )
.center/y LDZ2 #0000 ++ .Screen/y DEO2
.center/x LDZ2 #0018 ++ .Screen/x DEO2
;controller-icn/button .Screen/addr DEO2
#03 [ STHkr #01 SFT #01 AND - ] .Screen/sprite DEO
.Screen/y DEI2 #000a ++ .Screen/y DEO2
;font-hex #000b #30 SFT2 ++ .Screen/addr DEO2
#03 .Screen/sprite DEO
@<draw-hex> ( char -- )
#00 SWP #0f AND #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
[ LIT2 03 -Screen/sprite ] DEO
JMP2r
.center/y LDZ2 #0000 ++ .Screen/y DEO2
.center/x LDZ2 #0024 ++ .Screen/x DEO2
;controller-icn/button .Screen/addr DEO2
#03 [ STHr #01 AND - ] .Screen/sprite DEO
.Screen/y DEI2 #000a ++ .Screen/y DEO2
;font-hex #000a #30 SFT2 ++ .Screen/addr DEO2
#03 .Screen/sprite DEO
.center/x LDZ2 #0010 -- .Screen/x DEO2
.center/y LDZ2 #0010 -- .Screen/y DEO2
.Controller/button DEI2 #03 ;draw-short JSR2
RTN
( generics )
@draw-short ( short* color -- )
STH SWP
DUP #04 SFT TOS #30 SFT2 ;font-hex ++ .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO
#0f AND TOS #30 SFT2 ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO
DUP #04 SFT TOS #30 SFT2 ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO
#0f AND TOS #30 SFT2 ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHr .Screen/sprite DEO
RTN
@line-rect ( x1* y1* x2* y2* color -- )
( load ) .color STZ DUP2 STH2 .rect/y2 STZ2 .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2
STH2r INC2 STH2r
&ver
( save ) OVR2 .Screen/y DEO2
( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO
( incr ) SWP2 INC2 SWP2
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2
.rect/x1 LDZ2 INC2 .rect/x2 LDZ2 #0001 --
&hor
( save ) OVR2 .Screen/x DEO2
( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO
( incr ) SWP2 INC2 SWP2
OVR2 OVR2 INC2 LTS2 ,&hor JCN
@<line-rect> ( x1* y1* x2* y2* color -- )
STH
DUP2 ,&ver-y2 STR2
,&hor-y2 STR2
DUP2 ,&ver-x2 STR2
,&hor-x2 STR2
DUP2 ,&ver-y1 STR2
,&hor-y1 STR2
DUP2 ,&ver-x1 STR2
,&hor-x1 STR2
( | horizontal )
[ LIT2 &hor-x2 $2 ] INC2 [ LIT2 &hor-x1 $2 ]
&hor ( -- )
DUP2 .Screen/x DEO2
[ LIT2 &hor-y1 $2 ] .Screen/y DEO2
STHkr .Screen/pixel DEOk [ LIT2 &hor-y2 $2 ] .Screen/y DEO2
DEO
INC2 GTH2k ?&hor
POP2 POP2
( | vertical )
[ LIT2 &ver-y2 $2 ] [ LIT2 &ver-y1 $2 ]
&ver ( -- )
DUP2 .Screen/y DEO2
[ LIT2 &ver-x1 $2 ] .Screen/x DEO2
STHkr .Screen/pixel DEOk [ LIT2 &ver-x2 $2 ] .Screen/x DEO2
DEO
INC2 GTH2k ?&ver
POP2 POP2 POPr JMP2r
RTN
(
@|assets )
@controller-icn
&dpad ffff ffff ffff ffff
&dpad-up 7eff e7c3 ffff ffff
&dpad-down ffff ffff c3e7 ff7e
&dpad-left 7fff efcf cfef ff7f
&dpad-right feff f7f3 f3f7 fffe
&option 0000 7eff ff7e 0000
&button 3c7e ffff ffff 7e3c
@fill-icn [ ffff ffff ffff ffff ]
@dpad-up-icn [ 7eff e7c3 ffff ffff ]
@dpad-down-icn [ ffff ffff c3e7 ff7e ]
@dpad-left-icn [ 7fff efcf cfef ff7f ]
@dpad-right-icn [ feff f7f3 f3f7 fffe ]
@option-icn [ 0000 7eff ff7e 0000 ]
@button-icn [ 3c7e ffff ffff 7e3c ]
@font-hex [
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
007c 8280 fc82 827c 00fe 0202 0408 1010
007c 8282 7c82 827c 007c 8282 7e02 827c
&a 007c 8202 7e82 827e &b 00fc 8282
fc82 82fc 007c 8280 8080 827c 00fc 8282
8282 82fc 00fe 8080 fe80 80fe 00fe 8080
f080 8080 ]
@font-hex
003c 4242 4242 3c00 0018 0808 0808 1c00
003c 4202 3c40 7e00 003c 421c 0242 3c00
000c 1424 447e 0400 007e 407c 0242 3c00
003c 407c 4242 3c00 007e 0204 0810 1000
003c 423c 4242 3c00 003c 4242 3e02 3c00
003c 4242 7e42 4200 007c 427c 4242 7c00
003c 4240 4042 3c00 007c 4242 4242 7c00
007e 4078 4040 7e00 007e 4078 4040 4000

View File

@ -1,354 +1,94 @@
( Dev/Time )
( usage: uxncli datetime.rom )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
%4* { #20 SFT }
%10* { #40 SFT }
%2** { #10 SFT2 } %2// { #01 SFT2 }
%4// { #02 SFT2 }
%10** { #40 SFT2 }
%20** { #50 SFT2 }
|0100
%TOS { #00 SWP }
%RTN { JMP2r }
%MOD { DUP2 DIV MUL SUB }
%ABS2 { DUP2 #0f SFT2 EQU #05 JCN #0000 SWP2 -- }
%LTS2 { #8000 ++ SWP2 #8000 ++ GTH2 }
%GTS2 { #8000 ++ SWP2 #8000 ++ LTH2 }
@on-reset ( -> )
<print-date-num>
#0a .Console/write DEO
<print-date-str>
#0a .Console/write DEO
<print-time-num>
#0a .Console/write DEO
<print-doty>
#0a .Console/write DEO
#800f DEO
BRK
%RADIUS { #0040 }
%SCALEX { 2// .center/x LDZ2 ++ RADIUS -- }
%SCALEY { 2// .center/y LDZ2 ++ RADIUS -- }
%12HOURS { #0c MOD }
@<print-date-num> ( -- )
.DateTime/year DEI2k <print-dec>
[ LIT "- ] .Console/write DEO
INC INC DEIk INC <print-dec-pad>
[ LIT "- ] .Console/write DEO
INC DEI !<print-dec-pad>
%IS-UC { DUP #40 > SWP #5b < AND }
%IS-LC { DUP #60 > SWP #7b < AND }
%IS-NUM { DUP #2f > SWP #3a < AND }
@<print-date-str> ( -- )
;dict/date <print-str>
[ LIT2 00 -DateTime/dotw ] DEI #20 SFT ;week-txt ADD2 <print-str>
[ LIT2 20 ", ] #18 DEO
#18 DEO
[ LIT2 00 -DateTime/month ] DEI #20 SFT ;month-txt ADD2 <print-str>
#2018 DEO
[ LIT2 00 -DateTime/day ] DEI <print-dec>
[ LIT2 20 ", ] #18 DEO
#18 DEO
.DateTime/year DEI2 !<print-dec>
( devices )
@<print-time-num> ( -- )
;dict/time <print-str>
.DateTime/hour DEIk <print-dec-pad>
[ LIT2 ": 18 ] DEO
INC DEIk <print-dec-pad>
[ LIT2 ": 18 ] DEO
INC DEI !<print-dec-pad>
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
@<print-str> ( str* -- )
&w ( -- )
LDAk #18 DEO
INC2 LDAk ?&w
POP2 JMP2r
( variables )
@<print-doty> ( -- )
;dict/doty <print-str>
.DateTime/doty DEI2
( >> )
|0000
@<print-dec> ( short* -- )
#2710 [ LIT2r 00fb ]
&w ( -- )
DIV2k #000a DIV2k MUL2 SUB2 SWPr EQUk OVR STHkr EQU AND ?&>skip
DUP <emit-dec>
INCr &>skip
POP2 #000a DIV2 SWPr INCr STHkr ?&w
POP2r POP2 POP2 JMP2r
@last
&day $1 &sec $1
@center
&x $2 &y $2
@date
&x $2 &y $2
@time
&x $2 &y $2
@needles
&hx $2 &hy $2
&mx $2 &my $2
&sx $2 &sy $2
&zx $2 &zy $2
@buf
&d $3 &h $2 &s1 $1 &m $2 &s2 $1 &s $3
@line
&x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2
&dx $2 &dy $2 &e1 $2 &e2 $2 &color $1
@<print-dec-pad> ( byte -- )
#0a DIVk <emit-dec>
DIVk MUL SUB
( >> )
( program )
@<emit-dec> ( byte -- )
LIT "0 ADD #18 DEO
JMP2r
|0100 ( -> )
( theme )
#0ff8 .System/r DEO2
#0f08 .System/g DEO2
#0f08 .System/b DEO2
( resize )
#00f0 .Screen/width DEO2
#0120 .Screen/height DEO2
( vectors )
;on-frame .Screen/vector DEO2
( center )
.Screen/width DEI2 2//
DUP2 .center/x STZ2
DUP2 #0028 -- .date/x STZ2
#0020 -- .time/x STZ2
.Screen/height DEI2 2//
DUP2 .center/y STZ2
DUP2 #0078 -- .date/y STZ2
#006c ++ .time/y STZ2
;draw-watchface JSR2
( time buffer )
LIT ':
DUP .buf/s1 STZ
.buf/s2 STZ
( continue )
@on-frame ( -> )
( once per second )
.DateTime/second DEI
DUP .last/sec LDZ = ,&same-sec JCN
( make time )
.DateTime/hour DEI .buf/h ;decimal JSR2
.DateTime/minute DEI .buf/m ;decimal JSR2
DUP .buf/s ;decimal JSR2
( draw label )
.time/x LDZ2 .Screen/x DEO2
.time/y LDZ2 .Screen/y DEO2
;buf/h ;draw-text JSR2
( draw needles )
#00 ;draw-needles JSR2
;make-needles JSR2
#01 ;draw-needles JSR2
DUP .last/sec STZ
&same-sec
POP
( once per day )
.DateTime/day DEI
DUP .last/day LDZ = ,&same-day JCN
( make date )
DUP .buf/d ;decimal JSR2
( draw label )
.date/x LDZ2 .Screen/x DEO2
.date/y LDZ2 .Screen/y DEO2
.DateTime/dotw DEI 4* TOS ;week-txt ++ ;draw-text JSR2
.DateTime/month DEI 4* TOS ;month-txt ++ ;draw-text JSR2
;buf/d ;draw-text JSR2
DUP .last/day STZ
&same-day
POP
BRK
@draw-needles ( draw -- )
STH
.center/x LDZ2 .center/y LDZ2
OVR2 OVR2
.needles/zx LDZ2 .needles/zy LDZ2 #02 STHkr * ;draw-line JSR2
OVR2 OVR2
.needles/sx LDZ2 .needles/sy LDZ2 #02 STHkr * ;draw-line JSR2
OVR2 OVR2
.needles/mx LDZ2 .needles/my LDZ2 #01 STHkr * ;draw-line JSR2
OVR2 OVR2
.needles/hx LDZ2 .needles/hy LDZ2 #01 STHr * ;draw-line JSR2
( middle )
#0001 -- .Screen/y DEO2 #0001 -- .Screen/x DEO2
;middle-icn .Screen/addr DEO2
#0a .Screen/sprite DEO
RTN
@draw-text ( addr* -- )
( auto addr ) #06 .Screen/auto DEO
&while
LDAk
DUP IS-LC ,&lc JCN
DUP IS-UC ,&uc JCN
DUP IS-NUM ,&num JCN
DUP LIT '/ = ,&slash JCN
DUP LIT ': = ,&colon JCN
POP ;font/blank
&end
.Screen/addr DEO2
#0303 .Screen/sprite DEO .Screen/sprite DEO
.Screen/y DEI2 #0010 -- .Screen/y DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
INC2 LDAk ,&while JCN
POP2
( auto none ) #00 .Screen/auto DEO
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
RTN
&lc #61 - TOS 10** ;font/lc ++ ,&end JMP
&uc #41 - TOS 10** ;font/uc ++ ,&end JMP
&num #30 - TOS 10** ;font/num ++ ,&end JMP
&slash POP ;font/slash ,&end JMP
&colon POP ;font/colon ,&end JMP
@draw-line ( x1* y1* x2* y2* color -- )
( load ) .line/color STZ .line/y0 STZ2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2
.line/x0 LDZ2 .line/x LDZ2 -- ABS2 .line/dx STZ2
.line/y0 LDZ2 .line/y LDZ2 -- ABS2 #0000 SWP2 -- .line/dy STZ2
#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 2** ++ .line/sx STZ2
#ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 2** ++ .line/sy STZ2
.line/dx LDZ2 .line/dy LDZ2 ++ .line/e1 STZ2
&loop
.line/x LDZ2 .Screen/x DEO2
.line/y LDZ2 .Screen/y DEO2
.line/color LDZ .Screen/pixel DEO
[ .line/x LDZ2 .line/x0 LDZ2 == ]
[ .line/y LDZ2 .line/y0 LDZ2 == ] AND ,&end JCN
.line/e1 LDZ2 2** .line/e2 STZ2
.line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN
.line/e1 LDZ2 .line/dy LDZ2 ++ .line/e1 STZ2
.line/x LDZ2 .line/sx LDZ2 ++ .line/x STZ2
&skipy
.line/e2 LDZ2 .line/dx LDZ2 GTS2 ,&skipx JCN
.line/e1 LDZ2 .line/dx LDZ2 ++ .line/e1 STZ2
.line/y LDZ2 .line/sy LDZ2 ++ .line/y STZ2
&skipx
;&loop JMP2
&end
RTN
@draw-watchface ( -- )
#3c00
&loop
( dots )
DUP TOS 2** ;table ++ LDA2
#0018 ;circle JSR2
.Screen/x DEO2 .Screen/y DEO2 #01 .Screen/pixel DEO
( markers )
DUP #05 MOD ,&no-marker JCN
DUP TOS 2** ;table ++ LDA2
STH2k #0018 ;circle JSR2 SWP2
STH2r #001c ;circle JSR2 SWP2
#01 ;draw-line JSR2
&no-marker
INC GTHk ;&loop JCN2
POP2
RTN
@make-needles ( -- )
[ #00 .DateTime/second DEI #1e + #3c MOD ] 2** ;table ++ LDA2
#00a0 ,circle JSR .needles/zx STZ2 .needles/zy STZ2
[ #00 .DateTime/second DEI ] 2** ;table ++ LDA2
#0020 ,circle JSR .needles/sx STZ2 .needles/sy STZ2
[ #00 .DateTime/minute DEI ] 2** ;table ++ LDA2
#0022 ,circle JSR .needles/mx STZ2 .needles/my STZ2
[ #00 .DateTime/hour DEI 12HOURS #20 SFTk NIP ADD ]
( minute offset ) [ #00 .DateTime/minute DEI #0f / ++ ] 2** ;table ++ LDA2
#002a ,circle JSR .needles/hx STZ2 .needles/hy STZ2
RTN
@circle ( cx cy radius* -- y* x* )
STH2 SWP
TOS 10** STH2kr // .center/x LDZ2 ++ #0080 10** STH2kr // --
STH2 SWP2r
TOS 10** STH2kr // .center/y LDZ2 ++ #0080 10** STH2kr // --
POP2r STH2r
RTN
@decimal ( value* zp-label -- )
STH
DUP #0a DIV #30 + STHkr STZ
#0a MOD #30 + STHr INC STZ
RTN
(
@|assets )
@week-txt
"Sun $1 "Mon $1 "Tue $1 "Wed $1 "Thu $1 "Fri $1
"Sat $1
[
"Sun $1 "Mon $1 "Tue $1 "Wed $1
"Thu $1 "Fri $1 "Sat $1 ]
@month-txt
"Jan $1 "Feb $1 "Mar $1 "Apr $1 "May $1 "Jun $1
"Jul $1 "Aug $1 "Sep $1 "Oct $1 "Nov $1 "Dec $1
[
"Jan $1 "Feb $1 "Mar $1 "Apr $1
"May $1 "Jun $1 "Jul $1 "Aug $1
"Sep $1 "Oct $1 "Nov $1 "Dec $1 ]
@table ( 60 positions on a circle )
8000 8d00 9a02 a706 b40b c011 cb18 d520
df2a e734 ee40 f44b f958 fd65 ff72 ff80
ff8d fd9a f9a7 f4b4 eec0 e7cb dfd5 d5df
cbe7 c0ee b4f4 a7f9 9afd 8dff 80ff 72ff
65fd 58f9 4bf4 40ee 34e7 2adf 20d5 18cb
11c0 0bb4 06a7 029a 008d 0080 0072 0265
0658 0b4b 113f 1834 202a 2a20 3418 3f11
4b0b 5806 6502 7200
@middle-icn
40e0 4000 0000 0000
@font
&num
0018 2442 4242 4242 4242 4242 4224 1800
0008 1828 0808 0808 0808 0808 0808 1c00
0018 2442 4202 0202 0408 1020 4040 7e00
0018 2442 0202 0438 0402 0202 0204 7800
000c 0c14 1414 2424 2444 447e 0404 0e00
007e 4040 4040 5864 4202 0202 0204 7800
000c 1020 4040 5864 4242 4242 4224 1800
007e 4202 0204 0404 0808 0810 1010 1000
0018 2442 4242 2418 2442 4242 4224 1800
0018 2442 4242 4242 261a 0202 0408 3000
&uc
0010 1028 2844 4444 8282 fe82 8282 0000
00f8 4442 4242 4478 4442 4242 44f8 0000
003c 4282 8280 8080 8080 8282 423c 0000
00f8 4442 4242 4242 4242 4242 44f8 0000
00fc 4240 4040 4878 4840 4040 42fc 0000
80fe 4240 4040 447c 4440 4040 40e0 0000
003a 4682 8080 8e82 8282 8282 463a 0000
00ee 4444 4444 447c 4444 4444 44ee 0000
0038 1010 1010 1010 1010 1010 1038 0000
000e 0404 0404 0404 0404 4444 2810 0000
00ee 4448 4850 5060 5050 4848 44ee 0000
00e0 4040 4040 4040 4040 4040 42fe 0000
0082 c6c6 c6aa aaaa 9292 9282 8282 0000
00e2 4262 6262 5252 4a4a 4646 42e2 0000
0038 4482 8282 8282 8282 8282 4438 0000
00f8 4442 4242 4244 7840 4040 40f0 0000
0038 4482 8282 8282 8282 829a 643a 0000
00f8 4442 4242 4478 4844 4442 42e2 0000
0010 2844 4440 2010 0804 4444 2810 0000
00fe 9210 1010 1010 1010 1010 1038 0000
00ee 4444 4444 4444 4444 4444 4438 0000
0082 8282 8282 8244 4444 2828 1010 0000
0082 8292 9292 9292 92ba aa44 4444 0000
0042 4242 2424 1818 1824 2442 4242 0000
0082 8282 4444 2828 1010 1010 1038 0000
007e 4204 0408 0810 1020 2040 427e 0000
&lc
0000 0000 0030 0808 3848 4848 4834 0000
0060 2020 202c 3222 2222 2222 322c 0000
0000 0000 001c 2240 4040 4040 221c 0000
000c 0404 0434 4c44 4444 4444 4c36 0000
0000 0000 0018 2424 3c20 2020 2418 0000
000c 1210 1038 1010 1010 1010 1038 0000
0000 0000 0034 4a48 4830 4038 4444 4438
00c0 4040 4058 6444 4444 4444 44ee 0000
0010 0000 0030 1010 1010 1010 1038 0000
0008 0000 0018 0808 0808 0808 0808 2810
0060 2020 2022 2224 2438 2424 2272 0000
0030 1010 1010 1010 1010 1010 1038 0000
0000 0000 00a4 da92 9292 9292 9292 0000
0000 0000 00d8 6444 4444 4444 44ee 0000
0000 0000 0038 4482 8282 8282 4438 0000
0000 0000 00d8 6442 4242 4242 6458 40e0
0000 0000 0034 4c84 8484 8484 4c34 040e
0000 0000 0068 3420 2020 2020 2070 0000
0000 0000 0018 2424 1008 0424 2418 0000
0010 1010 107c 1010 1010 1010 1408 0000
0000 0000 00cc 4444 4444 4444 4c36 0000
0000 0000 00ee 4444 4428 2828 1010 0000
0000 0000 0092 9292 9292 92aa 4444 0000
0000 0000 00ee 4428 1010 1028 44ee 0000
0000 0000 00ee 4444 4448 2828 1010 2040
0000 0000 007c 4408 0810 2020 447c 0000
&colon
0000 0000 0010 1000 0000 0000 1010 0000
&slash
0202 0404 0808 1010 2020 4040 8080 0000
&blank
0000 0000 0000 0000 0000 0000 0000 0000
@dict ( )
&date "The 20 "date 20 "is: 20 $1
&time "The 20 "time 20 "is: 20 $1
&doty "The 20 "day 20 "of 20 "the 20 "year 20 "is: 20 $1

View File

@ -0,0 +1,14 @@
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|0100
@on-reset ( -> )
;filename .File/name DEO2
#0001 .File/length DEO2
&while ( -- )
;&byte .File/read DEO2
.File/success DEI2 ORA ?{ #010f DEO BRK }
[ LIT2 &byte $1 18 ] DEO
!&while
@filename "cat.tal $1

View File

@ -1,133 +0,0 @@
( simple Dev/File reading example )
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( variables )
|0000
( program )
|0100 ( -> )
;try-load JSR2
BRK
@try-load ( -- )
( load contents from file )
#1000 .File/length DEO2
;filename .File/name DEO2
;contents .File/read DEO2
.File/success DEI2 ORA ,&success JCN
( failed to read: bright yellow background )
#f0f7 .System/r DEO2
#f0f7 .System/g DEO2
#00f7 .System/b DEO2
JMP2r
&success
( read successful: dark blue background, show contents )
#00f7 .System/r DEO2
#00f7 .System/g DEO2
#40f7 .System/b DEO2
;contents DUP2 .File/success DEI2 ADD2 SWP2 ;draw JSR2
JMP2r
@draw ( end-ptr* ptr* -- )
EQU2k ,&end JCN
LDAk
DUP #0a EQU ,&linefeed JCN
#0005 SFT2 ;font ADD2
.Screen/addr DEO2
#09 .Screen/sprite DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
&next
INC2
,draw JMP
&linefeed
POP
#0000 .Screen/x DEO2
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
,&next JMP
&end
POP2 POP2
JMP2r
@get-x-advance ( font-char-addr* -- advance* )
( Save two 00 bytes for later use )
#0000 SWP2
( First, load the eight bytes that make up the character )
LDA2k SWP2 #0002 ADD2
LDA2k SWP2 #0002 ADD2
LDA2k SWP2 #0002 ADD2
LDA2
( OR all the bytes together, so we know which columns contain filled pixels )
ORA2 ORA2 ORA2 ORA
( Find the lowest set bit (using one of the 00 bytes at the top, but not consuming it) )
SUBk AND
( Convert the nine possible values (00-80) into an offset into the magic table (00-08). )
( They get jumbled up with these two operations, but each possible value remains unique )
#a3 MUL #16 DIV
( Load the byte from the magic table, return a short (consuming/returning the 00 bytes at the top) )
;&magic ADD2 LDA
JMP2r
( The magic table performs the last bit of arithmetic we want:
* the advance in x should be one more than the number of columns with filled pixels,
* with a maximum of 8, and
* a minimum of 3. )
&magic
03 ( lowest set bit is 00, 0 columns wide )
06 ( lowest set bit is 08, 5 columns wide )
05 ( lowest set bit is 10, 4 columns wide )
08 ( lowest set bit is 02, 7 columns wide )
04 ( lowest set bit is 20, 3 columns wide )
03 ( lowest set bit is 80, 1 column wide )
07 ( lowest set bit is 04, 6 columns wide )
08 ( lowest set bit is 01, 8 columns wide )
03 ( lowest set bit is 40, 2 columns wide )
@font ( spectrum-zx font )
[
0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000
0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000
007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000
0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800
0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800
003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038
0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000
0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000
0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400
0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000
0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800
0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000
003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00
0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000
003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810
0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800
003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00
0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00
0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200
0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00
007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00
00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200
0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00
0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00
0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00
0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c
0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400
0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800
0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800
0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800
0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00
0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c
]
@filename "hello.txt 00
@contents

View File

@ -1,41 +0,0 @@
( simple Dev/File writing example )
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( variables )
|0000
( init )
|0100 ( -> )
;try-save JSR2
BRK
@try-save ( -- )
( save contents to file )
;contents/end ;contents SUB2 .File/length DEO2
;filename .File/name DEO2
;contents .File/write DEO2
.File/success DEI2 ORA ,&success JCN
( failed to write: bright yellow background )
#f0f7 .System/r DEO2
#f0f7 .System/g DEO2
#00f7 .System/b DEO2
JMP2r
&success
( write successful: dark blue background )
#00f7 .System/r DEO2
#00f7 .System/g DEO2
#40f7 .System/b DEO2
JMP2r
@filename "hello.txt 00
@contents "Hello 20 "world, 0a "how 20 "are 20 "you? 0a
&end

View File

@ -1,78 +1,97 @@
( Dev/File )
( File:
Creates a temporary file called file-output.txt,
then read it back in console, print length and delete it. )
%8+ { #0008 ADD2 }
%MEMORY { #1000 }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|10 @Console [ &pad $8 &write $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( variables )
|0000
( init )
|a0 @File0 &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|b0 @File1 &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|0100 ( -> )
( theme )
#0efc .System/r DEO2
#03cc .System/g DEO2
#03ac .System/b DEO2
( load file )
#1000 .File/length DEO2
;srcpath .File/name DEO2
MEMORY .File/read DEO2
.File/success DEI2 ORA ;on-success JCN2
;failedtxt ;print-string JSR2
( write a file with file0 )
;filepath-txt .File0/name DEO2
;part1 ,append JSR
;part2 ,append JSR
( close file before changing device )
.File0/name DEI2k ROT DEO2
( read a file with file1 )
;filepath-txt .File1/name DEO2
,stream JSR
( delete file with file0 )
;filepath-txt .File0/delete DEO2
BRK
@on-success ( -> )
;successtxt ;print-string JSR2
@append ( part* -- )
( draw image )
MEMORY .Screen/addr DEO2
#0000 #0080
&ver
( save ) OVR2 .Screen/y DEO2
#0000 #0080
&hor
( save ) OVR2 .Screen/x DEO2
( draw ) #81 .Screen/sprite DEO
( incr ) .Screen/addr DEI2 #0010 ADD2 .Screen/addr DEO2
( incr ) SWP2 8+ SWP2
LTH2k ,&hor JCN
POP2 POP2
( incr ) SWP2 8+ SWP2
LTH2k ,&ver JCN
POP2 POP2
( save file )
#1000 .File/length DEO2
;dstpath .File/name DEO2
MEMORY .File/write DEO2
DUP2 ;print-str JSR2
DUP2 ;slen JSR2 STH2k .File0/length DEO2
.File0/write DEO2
( print result )
;saved-txt ;print-str JSR2
STH2r ;print JSR2 #2018 DEO
;bytes-txt ;print-str JSR2 #0a18 DEO
BRK
JMP2r
@print-string ( ptr* -- )
LDAk DUP ,&keep-going JCN
POP POP2 JMP2r
@stream ( -- )
&keep-going
.Console/write DEO
INC2
,print-string JMP
#0001 .File1/length DEO2
LIT2r 0000
&stream
;&buf DUP2 .File1/read DEO2 LDA #18 DEO INC2r
.File1/success DEI2 #0000 NEQ2 ,&stream JCN
( print result )
;loaded-txt ;print-str JSR2
STH2r ;print JSR2 #2018 DEO
;bytes-txt ;print-str JSR2 #0a18 DEO
@successtxt "Success! 09 $1
@failedtxt "Failed. 09 $1
JMP2r
&buf $1
@srcpath "projects/pictures/ako10x10.chr $1
@dstpath "bin/image-copy.chr $1
@slen ( str* -- len* )
DUP2 ,scap JSR SWP2 SUB2
JMP2r
@scap ( str* -- end* )
LDAk #00 NEQ JMP JMP2r
&while INC2 LDAk ,&while JCN
JMP2r
@print ( short* -- )
&short ( short* -- ) SWP ,&byte JSR
&byte ( byte -- ) DUP #04 SFT ,&char JSR
&char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO
JMP2r
@print-str ( str* -- )
&while
LDAk #18 DEO
INC2 LDAk ,&while JCN
POP2
JMP2r
@saved-txt "Saved 20 $1
@loaded-txt "Loaded 20 $1
@bytes-txt "bytes. $1
@filepath-txt "file-output.txt $1
@part1
596f 7572 2073 6163 7265 6420 706c 616e
7473 2c20 6966 2068 6572 6520 6265 6c6f
772c 0a4f 6e6c 7920 616d 6f6e 6720 7468
6520 706c 616e 7473 2077 696c 6c20 6772
6f77 2e0a 00
@part2
536f 6369 6574 7920 6973 2061 6c6c 2062
7574 2072 7564 652c 0a54 6f20 7468 6973
2064 656c 6963 696f 7573 2073 6f6c 6974
7564 652e 0a

View File

@ -1,120 +1,186 @@
( dev/mouse )
( Mouse: Paint with 3 colors with each mouse button. )
%RTN { JMP2r }
%ABS2 { DUP2 #0f SFT2 EQU #05 JCN #0000 SWP2 SUB2 }
%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
%2** { #10 SFT2 }
( devices )
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2
|0000
@color $1
@line
&x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2 &dx $2 &dy $2 &e1 $2 &e2 $2
@pointer
&x $2 &y $2 &lastx $2 &lasty $2 &state $1
@length $2
@frame $2
@pen &x $2 &y $2 &x2 $2 &y2 $2
@pointer &x $2 &y $2 &lastx $2 &lasty $2 &state $1
( program )
|0100
|0100 ( -> )
( theme )
#f030 .System/r DEO2
#f04f .System/g DEO2
#f050 .System/b DEO2
( vectors )
@on-reset ( -> )
( | theme )
#48af .System/r DEO2
#59bf .System/g DEO2
#6ace .System/b DEO2
( | vectors )
;on-mouse .Mouse/vector DEO2
;on-frame .Screen/vector DEO2
<draw-mouse>
BRK
BRK
(
@|vectors )
@on-frame ( -> )
.Mouse/state DEI ?{
;run DUP2 JSR2 JSR2 }
BRK
@on-mouse ( -> )
;draw-cursor JSR2
( on down )
.Mouse/state DEI #00 NEQ .pointer/state LDZ #00 EQU #0101 EQU2 ,on-mouse-down JCN
( on drag )
.Mouse/state DEI ,on-mouse-drag JCN
.Mouse/state DEI .pointer/state STZ
BRK
@on-mouse-down ( -> )
( record start position )
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .pointer/lastx STZ2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .pointer/lasty STZ2
.Mouse/state DEI .pointer/state STZ
BRK
@on-mouse-drag ( -> )
( draw line )
.pointer/lastx LDZ2
.pointer/lasty LDZ2
.pointer/x LDZ2
.pointer/y LDZ2
#01 [ .Mouse/state DEI #10 EQU DUP ADD ADD ]
;draw-line JSR2
( record last position )
.Mouse/x DEI2 .pointer/lastx STZ2
.Mouse/y DEI2 .pointer/lasty STZ2
.Mouse/state DEI .pointer/state STZ
BRK
@draw-cursor ( -- )
;pointer-icn .Screen/addr DEO2
( clear last cursor )
( | clear last cursor )
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
#40 .Screen/sprite DEO
;fill-icn .Screen/addr DEO2
[ LIT2 40 -Screen/sprite ] DEO
<draw-mouse>
( | draw new cursor )
;pointer-icn .Screen/addr DEO2
#00 .Screen/auto DEO
.Mouse/x DEI2 DUP2 .pointer/x STZ2
.Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2
.Screen/y DEO2
#45 .Mouse/state DEI #00 NEQ #05 MUL ADD .Screen/sprite DEO
( | on down )
.Mouse/state DEI #00 NEQ .pointer/state LDZ #00 EQU AND ?&down
( | on drag )
.Mouse/state DEI ?&drag
.Mouse/state DEI .pointer/state STZ
BRK
&down ( -> )
#0000 DUP2 .length STZ2
.frame STZ2
<clear-screen>
( | record start position )
.Mouse/x DEI2 DUP2 .pointer/x STZ2
.pointer/lastx STZ2
.Mouse/y DEI2 DUP2 .pointer/y STZ2
.pointer/lasty STZ2
.Mouse/state DEI .pointer/state STZ
BRK
&drag ( -> )
( | record )
;stroke .length LDZ2 #20 SFT2 ADD2 STH2 .pointer/x LDZ2 .pointer/lastx LDZ2 SUB2 STH2kr STA2
.pointer/y LDZ2 .pointer/lasty LDZ2 SUB2 STH2r INC2 INC2 STA2
( | move ptr )
.length LDZ2 INC2 .length STZ2
( | draw line )
.pointer/lastx LDZ2 .pointer/lasty LDZ2 .pointer/x LDZ2 .pointer/y LDZ2 #01 <draw-line>
( | record last position )
.Mouse/x DEI2 DUP2 .pointer/lastx STZ2
DUP2 .pen/x STZ2
.pen/x2 STZ2
.Mouse/y DEI2 DUP2 .pointer/lasty STZ2
DUP2 .pen/y STZ2
.pen/y2 STZ2
.Mouse/state DEI DUP #01 NEQ INC ;run/color STA
.pointer/state STZ
BRK
( draw new cursor )
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
#43 .Mouse/state DEI #00 NEQ DUP ADD SUB .Screen/sprite DEO
(
@|main )
RTN
@run ( -- )
( | read )
;stroke .frame LDZ2 #20 SFT2 ADD2 STH2 .pen/x LDZ2 STH2kr LDA2 ADD2 .pen/x STZ2
.pen/y LDZ2 STH2r INC2 INC2 LDA2 ADD2 .pen/y STZ2
( | line )
.pen/x LDZ2 .pen/y LDZ2 .pen/x2 LDZ2 .pen/y2 LDZ2 .frame LDZ2 #01 SFT2 NIP #01 AND [ LIT &color $1 ] ADD INC <draw-line>
( | history )
.pen/x LDZ2 .pen/x2 STZ2
.pen/y LDZ2 .pen/y2 STZ2
( | incr frame )
.frame LDZ2 INC2 .length LDZ2 INC2
( mod2 ) DIV2k MUL2 SUB2 .frame STZ2
JMP2r
@draw-line ( x1 y1 x2 y2 color -- )
( load ) .color STZ .line/y0 STZ2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2
.line/x0 LDZ2 .line/x LDZ2 SUB2 ABS2 .line/dx STZ2
.line/y0 LDZ2 .line/y LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2
#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 2** ADD2 .line/sx STZ2
#ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 2** ADD2 .line/sy STZ2
.line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
&loop
.line/x LDZ2 .Screen/x DEO2
.line/y LDZ2 .Screen/y DEO2
.color LDZ .Screen/pixel DEO
[ .line/x LDZ2 .line/x0 LDZ2 EQU2 ]
[ .line/y LDZ2 .line/y0 LDZ2 EQU2 ] #0101 EQU2 ,&end JCN
.line/e1 LDZ2 2** .line/e2 STZ2
.line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN
.line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
.line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2
&skipy
.line/e2 LDZ2 .line/dx LDZ2 GTS2 ,&skipx JCN
.line/e1 LDZ2 .line/dx LDZ2 ADD2 .line/e1 STZ2
.line/y LDZ2 .line/sy LDZ2 ADD2 .line/y STZ2
&skipx
;&loop JMP2
&end
@<draw-mouse> ( -- )
( | clear )
#0010 DUP2 .Screen/x DEO2
.Screen/y DEO2
#16 .Screen/auto DEO
;fill-icn .Screen/addr DEO2
#40 .Screen/sprite DEOk
DEO
( | buttons )
#0300
&l ( -- )
#01 OVR #40 SFT SFT .Mouse/state DEI AND #00 EQU ?{
#0010 .Screen/y DEO2
#00 OVR #40 SFT2 ;button-icn ADD2 .Screen/addr DEO2
#45 .Screen/sprite DEO }
INC GTHk ?&l
POP2
( | outline )
#0010 .Screen/y DEO2
;mouse-icn .Screen/addr DEO2
#16 .Screen/auto DEO
#4a .Screen/sprite DEOk
DEO
JMP2r
@<draw-line> ( x1* y1* x2* y2* color -- )
,&color STR
,&y STR2
,&x STR2
,&y2 STR2
,&x2 STR2
,&x LDR2 ,&x2 LDR2 SUB2 abs2 ,&dx STR2
#0000 ,&y LDR2 ,&y2 LDR2 SUB2 abs2 SUB2 ,&dy STR2
#ffff [ LIT2 00 _&x2 ] LDR2 ,&x LDR2 lts2 DUP2 ADD2 ADD2 ,&sx STR2
#ffff [ LIT2 00 _&y2 ] LDR2 ,&y LDR2 lts2 DUP2 ADD2 ADD2 ,&sy STR2
[ LIT2 &dx $2 ] [ LIT2 &dy $2 ] ADD2 STH2
&while ( -- )
[ LIT2 &x2 $2 ] DUP2 .Screen/x DEO2
[ LIT2 &x $2 ] EQU2 [ LIT2 &y2 $2 ] DUP2 .Screen/y DEO2
[ LIT2 &y $2 ] EQU2 [ LIT2 &color $1 -Screen/pixel ] DEO
AND ?&end
STH2kr DUP2 ADD2 DUP2 ,&dy LDR2 lts2 ?&skipy
STH2r ,&dy LDR2 ADD2 STH2 ,&x2 LDR2 [ LIT2 &sx $2 ] ADD2 ,&x2 STR2
&skipy ( -- )
,&dx LDR2 gts2 ?&while
STH2r ,&dx LDR2 ADD2 STH2 ,&y2 LDR2 [ LIT2 &sy $2 ] ADD2 ,&y2 STR2
!&while
&end POP2r JMP2r
@abs2 ( a* -- f )
DUP2 #0f SFT2 EQU ?{ #0000 SWP2 SUB2 }
JMP2r
@lts2 ( a* b* -- f )
#8000 STH2k ADD2 SWP2 STH2r ADD2 GTH2 JMP2r
@gts2 ( a* b* -- f )
#8000 STH2k ADD2 SWP2 STH2r ADD2 LTH2 JMP2r
@<clear-screen> ( -- )
#0000 DUP2 .Screen/x DEO2
.Screen/y DEO2
#80 .Screen/pixel DEO
JMP2r
@fill-icn [ ffff ffff ffff ffff ]
@pointer-icn [ 80c0 e0f0 f8e0 1000 ]
@mouse-icn [
000d 1212 1212 121d 00b0 4848 4848 48b8
1010 1010 1008 0700 0808 0808 0810 e000 ]
@button-icn [
000c 1e1e 1e1e 1e0c 0000 0000 0000 0000
0001 0303 0303 0301 0080 c0c0 c0c0 c080
0000 0000 0000 0000 0030 7878 7878 7830 ]
(
@|memory )
@stroke
RTN
@pointer-icn 80c0 e0f0 f8e0 1000

View File

@ -0,0 +1,152 @@
( All five portraits should look right )
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|0100
( | size )
#00a0 .Screen/width DEO2
#0020 .Screen/height DEO2
( | theme )
#05ae .System/r DEO2
#0a9f .System/g DEO2
#097f .System/b DEO2
( | normal horizontal )
#0000 .Screen/x DEO2
#0000 .Screen/y DEO2
[ LIT2 35 -Screen/auto ] DEO
;img-hor .Screen/addr DEO2
#85 <draw-4times>
( | normal vertical )
#0020 .Screen/x DEO2
#0000 .Screen/y DEO2
[ LIT2 36 -Screen/auto ] DEO
;img-ver .Screen/addr DEO2
#85 <draw-4times>
( | flipped horizontal )
#0058 .Screen/x DEO2
#0000 .Screen/y DEO2
[ LIT2 36 -Screen/auto ] DEO
;img-x-flipped .Screen/addr DEO2
#95 <draw-4times>
( | flipped vertical )
#0060 .Screen/x DEO2
#0018 .Screen/y DEO2
[ LIT2 36 -Screen/auto ] DEO
;img-y-flipped .Screen/addr DEO2
#a5 <draw-4times>
( | flipped horizontal/vertical )
#0098 .Screen/x DEO2
#0018 .Screen/y DEO2
[ LIT2 36 -Screen/auto ] DEO
;img-xy-flipped .Screen/addr DEO2
#b5 <draw-4times>
BRK
@<draw-4times> ( color -- )
.Screen/sprite DEOk DEOk DEOk DEO
JMP2r
@draw-fast ( w h addr* color -- )
,&color STR
.Screen/addr DEO2
SWP #01 SUB #40 SFT #06 ORA .Screen/auto DEO
#00 SWP SUB
&times ( -- )
[ LIT2 &color $1 -Screen/sprite ] DEO
INC DUP ?&times
POP JMP2r
(
@|assets )
@img-ver [
0000 0008 0404 0501 ffff fff7 fbfa f9f9
0000 1000 21ff ffff ffff efde 21ff ffff
2020 0060 f8ff fffc dfdf 9f67 f8ff fffc
0703 2110 0888 c851 e7fb ddee 76b6 d64d
0307 0617 172f 080c fbf7 f6e5 e7cf e8ec
ffef 1fff ff1f 0f37 f7ef 1fff 8f07 0733
fbff ffff fcf8 f3f7 fbf7 fff8 f0f0 f1f1
d3d7 c783 0100 0040 8bc7 d79b 1d3e 3e5e
0e06 0301 0101 0505 eef6 fbfd fdfd f9f9
7bfb 3fff ffff ffff 3b3b 3fff ffff ffff
f7f7 f7ff fff7 fffb f3ff fff3 fbff ffe3
c0e0 e0e4 e5e3 c7cf feee eeea e9eb f7cf
3800 0103 c7ff ffff c6fe fd3b c7ff ffff
ff7f 3f0f a0b8 bebf ff7f 3f5f b1bf bfbf
dfbf fefd fb07 0fdf c387 fefd fb07 efdf
bf7f ffff ffff ffff bf7f ffff ffff ffff ]
@img-hor [
0000 0008 0404 0501 ffff fff7 fbfa f9f9
0307 0617 172f 080c fbf7 f6e5 e7cf e8ec
0e06 0301 0101 0505 eef6 fbfd fdfd f9f9
3800 0103 c7ff ffff c6fe fd3b c7ff ffff
0000 1000 21ff ffff ffff efde 21ff ffff
ffef 1fff ff1f 0f37 f7ef 1fff 8f07 0733
7bfb 3fff ffff ffff 3b3b 3fff ffff ffff
ff7f 3f0f a0b8 bebf ff7f 3f5f b1bf bfbf
2020 0060 f8ff fffc dfdf 9f67 f8ff fffc
fbff ffff fcf8 f3f7 fbf7 fff8 f0f0 f1f1
f7f7 f7ff fff7 fffb f3ff fff3 fbff ffe3
dfbf fefd fb07 0fdf c387 fefd fb07 efdf
0703 2110 0888 c851 e7fb ddee 76b6 d64d
d3d7 c783 0100 0040 8bc7 d79b 1d3e 3e5e
c0e0 e0e4 e5e3 c7cf feee eeea e9eb f7cf
bf7f ffff ffff ffff bf7f ffff ffff ffff ]
@img-x-flipped [
e0c0 8408 1011 138a e7df bb77 6e6d 6bb2
0404 0006 1fff ff3f fbfb f9e6 1fff ff3f
0000 0800 84ff ffff ffff f77b 84ff ffff
0000 0010 2020 a080 ffff ffef df5f 9f9f
cbeb e3c1 8000 0002 d1e3 ebd9 b87c 7c7a
dfff ffff 3f1f cfef dfef ff1f 0f0f 8f8f
fff7 f8ff fff8 f0ec eff7 f8ff f1e0 e0cc
c0e0 60e8 e8f4 1030 dfef 6fa7 e7f3 1737
0307 0727 a7c7 e3f3 7f77 7757 97d7 eff3
efef efff ffef ffdf cfff ffcf dfff ffc7
dedf fcff ffff ffff dcdc fcff ffff ffff
7060 c080 8080 a0a0 776f dfbf bfbf 9f9f
fdfe ffff ffff ffff fdfe ffff ffff ffff
fbfd 7fbf dfe0 f0fb c3e1 7fbf dfe0 f7fb
fffe fcf0 051d 7dfd fffe fcfa 8dfd fdfd
1c00 80c0 e3ff ffff 637f bfdc e3ff ffff ]
@img-y-flipped [
ffff ffc7 0301 0038 ffff ffc7 3bfd fec6
bfbe b8a0 0f3f 7fff bfbf bfb1 5f3f 7fff
df0f 07fb fdfe bfdf dfef 07fb fdfe 87c3
ffff ffff ffff 7fbf ffff ffff ffff 7fbf
0505 0101 0103 060e f9f9 fdfd fdfb f6ee
ffff ffff ff3f fb7b ffff ffff ff3f 3b3b
fbff f7ff fff7 f7f7 e3ff fffb f3ff fff3
cfc7 e3e5 e4e0 e0c0 cff7 ebe9 eaee eefe
0c08 2f17 1706 0703 ece8 cfe7 e5f6 f7fb
370f 1fff ff1f efff 3307 078f ff1f eff7
f7f3 f8fc ffff fffb f1f1 f0f0 f8ff f7fb
4000 0001 83c7 d7d3 5e3e 3e1d 9bd7 c78b
0105 0404 0800 0000 f9f9 fafb f7ff ffff
ffff ff21 0010 0000 ffff ff21 deef ffff
fcff fff8 6000 2020 fcff fff8 679f dfdf
51c8 8808 1021 0307 4dd6 b676 eedd fbe7 ]
@img-xy-flipped [
ffff ffff ffff fefd ffff ffff ffff fefd
fbf0 e0df bf7f fdfb fbf7 e0df bf7f e1c3
fd7d 1d05 f0fc feff fdfd fd8d fafc feff
ffff ffe3 c080 001c ffff ffe3 dcbf 7f63
f3e3 c7a7 2707 0703 f3ef d797 5777 777f
dfff efff ffef efef c7ff ffdf cfff ffcf
ffff ffff fffc dfde ffff ffff fffc dcdc
a0a0 8080 80c0 6070 9f9f bfbf bfdf 6f77
0200 0080 c1e3 ebcb 7a7c 7cb8 d9eb e3d1
efcf 1f3f ffff ffdf 8f8f 0f0f 1fff efdf
ecf0 f8ff fff8 f7ff cce0 e0f1 fff8 f7ef
3010 f4e8 e860 e0c0 3717 f3e7 a76f efdf
8a13 1110 0884 c0e0 b26b 6d6e 77bb dfe7
3fff ff1f 0600 0404 3fff ff1f e6f9 fbfb
ffff ff84 0008 0000 ffff ff84 7bf7 ffff
80a0 2020 1000 0000 9f9f 5fdf efff ffff ]

View File

@ -0,0 +1,94 @@
( screen blending modes )
|00 @System &catch $2 &expansion $2 &pad $2 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|0100
@on-reset ( -> )
( | theme )
#f07f .System/r DEO2
#f0d6 .System/g DEO2
#f0b2 .System/b DEO2
( | size )
#0100 .Screen/width DEO2
#010c .Screen/height DEO2
( | background )
#02 <draw-strippes>
#0080 .Screen/x DEO2
#0000 .Screen/y DEO2
#03 <draw-strippes>
( | 1bpp )
#1000
&l1bg ( -- )
#00 OVR #03 AND #50 SFT2 #0008 ADD2 .Screen/x DEO2
#00 OVR #02 SFT #50 SFT2 #0008 ADD2 .Screen/y DEO2
DUP <draw-circle>
INC GTHk ?&l1bg
POP2
#1000
&l1fg ( -- )
#00 OVR #03 AND #50 SFT2 #0088 ADD2 .Screen/x DEO2
#00 OVR #02 SFT #50 SFT2 #0008 ADD2 .Screen/y DEO2
DUP #40 ORA <draw-circle>
INC GTHk ?&l1fg
POP2
( | 2bpp )
#1000
&l2bg ( -- )
#00 OVR #03 AND #50 SFT2 #0008 ADD2 .Screen/x DEO2
#00 OVR #02 SFT #50 SFT2 #0088 ADD2 .Screen/y DEO2
DUP #80 ORA <draw-circle>
INC GTHk ?&l2bg
POP2
#1000
&l2fg ( -- )
#00 OVR #03 AND #50 SFT2 #0088 ADD2 .Screen/x DEO2
#00 OVR #02 SFT #50 SFT2 #0088 ADD2 .Screen/y DEO2
DUP #c0 ORA <draw-circle>
INC GTHk ?&l2fg
POP2
BRK
@<draw-strippes> ( color -- )
,&color STR
#f2 .Screen/auto DEO
;check-icn .Screen/addr DEO2
#2200
&times ( -- )
[ LIT &color $1 ] .Screen/sprite DEO
INC GTHk ?&times
POP2
JMP2r
@<draw-circle> ( color -- )
#01 .Screen/auto DEO
;circle-chr .Screen/addr DEO2
DUP .Screen/sprite DEO
DUP #10 ORA .Screen/sprite DEO
.Screen/y DEI2k #0008 ADD2 ROT DEO2
DUP #20 ORA .Screen/sprite DEO
DUP #30 ORA .Screen/sprite DEO
@<draw-hex> ( color -- )
.Screen/y DEI2k #000c ADD2 ROT DEO2
#00 SWP #30 SFT ;font-icn ADD2 .Screen/addr DEO2
#09 .Screen/sprite DEO
JMP2r
@check-icn [ 0306 0c18 3060 c081 ]
@circle-chr [
071f 3c70 60e3 c7c7 0000 030f 1f1f 3f3f ]
@font-icn ( 0-f )
[
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
007c 8280 fc82 827c 007c 8202 1e02 0202
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080 ]

View File

@ -0,0 +1,141 @@
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2
|0100
@on-reset ( -> )
#375e .System/r DEO2
#286c .System/g DEO2
#2358 .System/b DEO2
;on-mouse .Mouse/vector DEO2
<draw-guide>
BRK
@on-mouse ( -> )
( | clear background )
#0000 DUP2 .Screen/x DEO2
.Screen/y DEO2
#80 .Screen/pixel DEO
<draw-guide>
( | cursor )
#41 ;cursor-icn <update-cursor>
( | draw portrait )
.Screen/x DEI2k #0008 ADD2 ROT DEO2
.Screen/y DEI2k #0020 SUB2 ROT DEO2
[ LIT2 36 -Screen/auto ] DEO
#81 <draw-portrait>
.Screen/x DEI2k #0010 SUB2 ROT DEO2
.Screen/y DEI2k #0020 SUB2 ROT DEO2
#91 <draw-portrait>
.Screen/x DEI2k #0000 SUB2 ROT DEO2
.Screen/y DEI2k #0020 ADD2 ROT DEO2
#b1 <draw-portrait>
.Screen/x DEI2k #0010 ADD2 ROT DEO2
.Screen/y DEI2k #0020 ADD2 ROT DEO2
#a1 <draw-portrait>
( <draw-box>
.Screen/y DEI2k #0060 SUB2 ROT DEO2
<draw-box> )
BRK
@<draw-portrait> ( color -- )
;portrait-chr .Screen/addr DEO2
.Screen/sprite DEOk DEOk DEOk DEO
JMP2r
@<draw-box> ( -- )
;box-icn .Screen/addr DEO2
#05 .Screen/sprite DEOk DEOk DEOk DEO
JMP2r
@<draw-circle> ( color -- )
#01 .Screen/auto DEO
;circle-chr .Screen/addr DEO2
DUP .Screen/sprite DEO
DUP #10 ORA .Screen/sprite DEO
.Screen/y DEI2k #0008 ADD2 ROT DEO2
DUP #20 ORA .Screen/sprite DEO
#30 ORA .Screen/sprite DEO
JMP2r
@<draw-guide> ( -- )
#0000 DUP2 .Screen/x DEO2 .Screen/y DEO2
#f2 .Screen/auto DEO
;guide-icn .Screen/addr DEO2
#1000
&l ( -- )
#01 .Screen/sprite DEO
INC GTHk ?&l
POP2
( | circles )
#0010 DUP2 .Screen/x DEO2 .Screen/y DEO2
#02 <draw-circle>
.Screen/y DEI2k #0008 ADD2 ROT DEO2
#82 <draw-circle>
.Screen/y DEI2k #0008 ADD2 ROT DEO2
#05 <draw-circle>
.Screen/y DEI2k #0008 ADD2 ROT DEO2
#85 <draw-circle>
.Screen/y DEI2k #0008 ADD2 ROT DEO2
#03 <draw-circle>
.Screen/y DEI2k #0008 ADD2 ROT DEO2
#83 <draw-circle>
.Screen/y DEI2k #0008 ADD2 ROT DEO2
#0a <draw-circle>
.Screen/y DEI2k #0008 ADD2 ROT DEO2
#8a <draw-circle>
JMP2r
@<update-cursor> ( color addr* -- )
[ LIT2 00 -Screen/auto ] DEO
;fill-icn .Screen/addr DEO2
#40 <draw-cursor>
.Mouse/x DEI2 ,<draw-cursor>/x STR2
.Mouse/y DEI2 ,<draw-cursor>/y STR2
.Screen/addr DEO2
@<draw-cursor> ( color -- )
[ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 &y $2 ] .Screen/y DEO2
.Screen/sprite DEO
JMP2r
@guide-icn [ 0101 0101 0101 01ff ]
@fill-icn [ ffff ffff ffff ffff ]
@cursor-icn [ 80c0 e0f0 f8e0 1000 ]
@portrait-chr [
070f 1e1d 1b3b 3b3b f0e0 c0c0 d08b 8080
f76f cf9f 9f5f 5f5f 0000 0007 1c40 4040
fffb f975 7576 7667 0000 3164 0406 0607
efef efef eddd 9e1e 0060 8000 0000 0000
3b2b 280d 0105 0506 8080 8081 e1f1 f1f0
5f6c 639b 0f27 77ab 4060 639b 0f27 67ab
0dc8 b0e5 cded fdfc 0dc8 b0e4 ccec fcfc
5e1e 1c9c 9d1d 5d59 4000 0080 8000 4040
0607 0707 070e 0e0e f0f0 f0f0 f0e0 e0e0
fb73 7fb7 bbbf bfdd f373 7b37 3b3f 3f1c
ffff ffff ffff ffff ffff ffff ffff ff7f
dba7 97f7 f7ed dd9d c080 90f0 f0e0 c080
1e0e 0000 0000 0000 c0c0 f0ff ffff ffff
ee03 0000 0000 0000 0e12 fcff ffff ffff
fffc f30f 1f1f 1f3f 9f3c f30f dfdf dfbf
3c80 8080 80c0 c0e0 0003 3fbf bfbf dfef ]
@box-icn [
001f 2050 4844 4241 00ff 0000 0000 0000
00ff 0000 0000 0000 00f8 040a 1222 4282
4040 4040 4040 4040 8040 2010 0804 0201
0102 0408 1020 4080 0202 0202 0202 0202
4040 4040 4040 4040 0102 0408 1020 4080
8040 2010 0804 0201 0202 0202 0202 0202
4142 4448 5020 1f00 0000 0000 0000 ff00
0000 0000 0000 ff00 8242 2212 0a04 f800 ]
@circle-chr [
071f 3c70 60e3 c7c7 0000 030f 1f1f 3f3f ]

View File

@ -0,0 +1,96 @@
( Screen.pixel: test rom for screen pixel drawing )
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|0000
@center &x $2 &y $2
|0100
@on-reset ( -> )
( | theme )
#f07f .System/r DEO2
#f0d6 .System/g DEO2
#f0b2 .System/b DEO2
( | resize )
#00c8 DUP2 .Screen/width DEO2
.Screen/height DEO2
( | find screen center )
.Screen/width DEI2 #01 SFT2 .center/x STZ2
.Screen/height DEI2 #01 SFT2 .center/y STZ2
( | draw )
<draw-bg-fill>
<draw-bg-corners>
<draw-fg-corners>
<draw-pixels>
BRK
@<draw-bg-fill> ( -- )
.center/x LDZ2 .Screen/x DEO2
.center/x LDZ2 .Screen/y DEO2
( | 4-way backgrounds )
#0400
&l ( -- )
DUP DUP #40 SFT #80 ADD ORA .Screen/pixel DEO
INC GTHk ?&l
POP2 JMP2r
@<draw-bg-corners> ( -- )
.center/x LDZ2 #01 SFT2 .Screen/x DEO2
.center/y LDZ2 #01 SFT2 .Screen/y DEO2
#b0 .Screen/pixel DEO
.center/x LDZ2 #01 SFT2 #0003 MUL2 .Screen/x DEO2
.center/y LDZ2 #01 SFT2 .Screen/y DEO2
#a1 .Screen/pixel DEO
.center/x LDZ2 #01 SFT2 #0003 MUL2 .Screen/x DEO2
.center/y LDZ2 #01 SFT2 #0003 MUL2 .Screen/y DEO2
#83 .Screen/pixel DEO
.center/x LDZ2 #01 SFT2 .Screen/x DEO2
.center/y LDZ2 #01 SFT2 #0003 MUL2 .Screen/y DEO2
#92 .Screen/pixel DEO
JMP2r
@<draw-fg-corners> ( -- )
.center/x LDZ2 #02 SFT2 .Screen/x DEO2
.center/y LDZ2 #02 SFT2 .Screen/y DEO2
#f1 .Screen/pixel DEO
.center/x LDZ2 #02 SFT2 #0007 MUL2 .Screen/x DEO2
.center/y LDZ2 #02 SFT2 .Screen/y DEO2
#e3 .Screen/pixel DEO
( clear ) #e0 .Screen/pixel DEO
.center/x LDZ2 #02 SFT2 #0007 MUL2 .Screen/x DEO2
.center/y LDZ2 #02 SFT2 #0007 MUL2 .Screen/y DEO2
#c2 .Screen/pixel DEO
.center/x LDZ2 #02 SFT2 .Screen/x DEO2
.center/y LDZ2 #02 SFT2 #0007 MUL2 .Screen/y DEO2
#d0 .Screen/pixel DEO
JMP2r
@<draw-pixels> ( -- )
( | bottom-left, background )
.center/x LDZ2 #0010 SUB2 .Screen/x DEO2
.center/y LDZ2 .Screen/y DEO2
( auto-x ) #01 .Screen/auto DEO
#00
&bl ( -- )
#00 OVR EQU OVR #0f AND ORA ?{
.center/x LDZ2 #0010 SUB2 .Screen/x DEO2
.Screen/y DEI2k INC2 ROT DEO2 }
DUP #04 SFT OVR #0f AND LTH INC .Screen/pixel DEO
INC DUP ?&bl
POP
( | bottom-right, foreground )
.center/x LDZ2 .Screen/x DEO2
.center/y LDZ2 #0010 SUB2 .Screen/y DEO2
( auto-y ) #02 .Screen/auto DEO
#00
&br ( -- )
#00 OVR EQU OVR #0f AND ORA ?{
.center/y LDZ2 #0010 SUB2 .Screen/y DEO2
.Screen/x DEI2k INC2 ROT DEO2 }
DUP #04 SFT OVR #0f AND GTH INC #40 ORA .Screen/pixel DEO
INC DUP ?&br
POP JMP2r

View File

@ -1,172 +1,201 @@
( dev/screen )
( Screen:
Draws a table of all possible sprite arrangements. )
%RTN { JMP2r }
%2/ { #01 SFT }
%4/ { #02 SFT }
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
( variables )
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1
|0000
@count $2
@center
&x $2 &y $2
( init )
@center &x $2 &y $2
|0100 ( -> )
( vector )
;on-frame .Screen/vector DEO2
( theme )
( theme )
#f07f .System/r DEO2
#f0e0 .System/g DEO2
#f0c0 .System/b DEO2
#f0e0 .System/g DEO2
#f0c0 .System/b DEO2
( gba screen size 00f0 x 00a0 )
( nds screen size 0100 x 00c0 )
#0100 .Screen/width DEO2
#00b0 .Screen/height DEO2
( find screen center )
.Screen/width DEI2 #01 SFT2 #0020 SUB2 .center/x STZ2
.Screen/width DEI2 #01 SFT2 .center/x STZ2
.Screen/height DEI2 #01 SFT2 .center/y STZ2
( draw )
;draw-table JSR2
;draw-sprites JSR2
;draw-1bpp JSR2
;draw-2bpp JSR2
;draw-pixels JSR2
draw-size
draw-sprites
draw-1bpp
draw-2bpp
BRK
(
@|vectors )
@on-frame ( -> )
.count LDZ2 INC2 [ DUP2 ] .count STZ2
.center/x LDZ2 #0048 ADD2 .Screen/x DEO2
.center/y LDZ2 #0050 SUB2 .Screen/y DEO2
( scroll background )
[ LIT2 &f $2 ] INC2k ,&f STR2
#01 SFT2
#001f AND2
#0040 SUB2
DUP2 .Screen/x DEO2
.Screen/y DEO2
;patt-icn draw-fill
( color ) #01 STH
.center/x LDZ2 #0070 SUB2 .Screen/x DEO2
.center/y LDZ2 #0048 SUB2 .Screen/y DEO2
;anim-chr ,&f LDR2 #00ff AND2 #02 SFT #07 AND #40 SFT ADD2 .Screen/addr DEO2
#8f .Screen/sprite DEO
SWP
DUP #04 SFT [ #00 SWP ] #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO
#0f AND [ #00 SWP ] #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO
DUP #04 SFT [ #00 SWP ] #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO
#0f AND [ #00 SWP ] #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
( draw ) STHr .Screen/sprite DEO
draw-size
draw-sprites
draw-1bpp
draw-2bpp
BRK
@draw-table ( -- )
#10 #00
&loop
DUP #30 SFT #00 SWP ;font-hex ADD2 .Screen/addr DEO2
( x-axis )
DUP #30 SFT #00 SWP
.center/x LDZ2 #0040 SUB2 ADD2 .Screen/x DEO2
.center/y LDZ2 #0050 SUB2 .Screen/y DEO2
( draw ) #01 .Screen/sprite DEO
( y-axis )
DUP #30 SFT #00 SWP
.center/y LDZ2 #0040 SUB2 ADD2 .Screen/y DEO2
.center/x LDZ2 #0050 SUB2 .Screen/x DEO2
( draw ) #01 .Screen/sprite DEO
INC GTHk ,&loop JCN
POP2
RTN
(
@|drawing )
@draw-sprites ( -- )
;preview_icn .Screen/addr DEO2
#00 #00
( horizontal )
.center/x LDZ2 #0060 SUB2 .Screen/x DEO2
.center/y LDZ2 #0048 SUB2 .Screen/y DEO2
;font-icn .Screen/addr DEO2
#f6 .Screen/auto DEO
#05 .Screen/sprite DEO
( vertical )
.center/x LDZ2 #0070 SUB2 .Screen/x DEO2
.center/y LDZ2 #0038 SUB2 .Screen/y DEO2
;font-icn .Screen/addr DEO2
#f5 .Screen/auto DEO
#05 .Screen/sprite DEO
( table )
#00 .Screen/auto DEO
;preview-chr .Screen/addr DEO2
#00
&loop
( move ) DUP #0f AND #40 SFT 2/ #00 SWP
.center/x LDZ2 #0040 SUB2 ADD2 .Screen/x DEO2
( move ) DUP #f0 AND 2/ #00 SWP
.center/y LDZ2 #0040 SUB2 ADD2 .Screen/y DEO2
( move ) #00 OVR #0f AND #30 SFT
.center/x LDZ2 #0060 SUB2 ADD2 .Screen/x DEO2
( move ) #00 OVR #f0 AND #01 SFT
.center/y LDZ2 #0038 SUB2 ADD2 .Screen/y DEO2
( draw ) DUP .Screen/sprite DEO
INC NEQk ,&loop JCN
POP2
RTN
INC DUP ?&loop
POP
JMP2r
@draw-1bpp ( -- )
#10 #00
#1000
&loop
( color ) STHk
( y ) DUP 4/ [ #00 SWP ] #40 SFT2
[ .center/y LDZ2 #0040 SUB2 ADD2 ] STH2
( x ) DUP #03 AND [ #00 SWP ] #40 SFT2 #0040 ADD2
[ .center/x LDZ2 #0008 ADD2 ADD2 ]
STH2r STHr #00 ;draw-circle JSR2
INC GTHk ,&loop JCN
( y ) #00 OVR #42 SFT2
.center/y LDZ2 #0038 SUB2 ADD2 STH2
( x ) #00 OVR #03 AND #40 SFT2 #0040 ADD2
.center/x LDZ2 #0010 SUB2 ADD2
STH2r STHr #00 draw-circle
INC GTHk ?&loop
POP2
RTN
JMP2r
@draw-2bpp ( -- )
#10 #00
#1000
&loop
( color ) STHk
( y ) DUP 4/ [ #00 SWP ] #40 SFT2
[ .center/y LDZ2 ADD2 ] STH2
( x ) DUP #03 AND [ #00 SWP ] #40 SFT2 #0040 ADD2
[ .center/x LDZ2 #0008 ADD2 ADD2 ]
STH2r STHr #80 ;draw-circle JSR2
INC GTHk ,&loop JCN
( y ) #00 OVR #42 SFT2
.center/y LDZ2 #0008 ADD2 ADD2 STH2
( x ) #00 OVR #03 AND #40 SFT2 #0040 ADD2
.center/x LDZ2 #0010 SUB2 ADD2
STH2r STHr #80 draw-circle
INC GTHk ?&loop
POP2
RTN
JMP2r
@draw-circle ( x* y* color depth -- )
ADD STH
;preview_icn .Screen/addr DEO2
;preview-chr .Screen/addr DEO2
.Screen/y DEO2
.Screen/x DEO2
#01 .Screen/auto DEO
STHr .Screen/sprite DEOk
#02 .Screen/auto DEO
SWP #10 ADD SWP DEOk
.Screen/x DEI2k #0008 SUB2 ROT DEO2
#01 .Screen/auto DEO
SWP #10 ADD SWP DEOk
SWP #10 ADD SWP DEO
#00 STHkr ADD .Screen/sprite DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
#10 STHkr ADD .Screen/sprite DEO
.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
#20 STHkr ADD .Screen/sprite DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
#30 STHr ADD .Screen/sprite DEO
JMP2r
RTN
@draw-fill ( patt* color -- )
@draw-pixels ( -- )
.center/y LDZ2 #0040 SUB2 .Screen/y DEO2
.center/x LDZ2 #0048 ADD2 .Screen/x DEO2
#00 .Screen/pixel DEO
.center/x LDZ2 #0049 ADD2 .Screen/x DEO2
#01 .Screen/pixel DEO
.center/x LDZ2 #004a ADD2 .Screen/x DEO2
#02 .Screen/pixel DEO
.center/x LDZ2 #004b ADD2 .Screen/x DEO2
#03 .Screen/pixel DEO
.Screen/addr DEO2
[ LIT2 01 -Screen/auto ] DEO
.Screen/x DEI2 ,&anchor STR2
.Screen/width DEI2 #03 SFT2 NIP #08 ADD ,&x STR
.Screen/height DEI2 #03 SFT2 NIP #08 ADD #00
&h
DUP #02 SFT STH
[ LIT &x $1 ] #00
&w
DUP #02 SFT STHkr ADD #01 AND .Screen/sprite DEO
INC GTHk ?&w
.Screen/y DEI2k #0008 ADD2 ROT DEO2
[ LIT2 &anchor $2 ] .Screen/x DEO2
POP2 POPr
INC GTHk ?&h
POP2
RTN
JMP2r
@preview_icn [
0f38 675f dfbf bfbf 0007 1820 2344 4848
@draw-size ( -- )
@font-hex
#01 .Screen/auto DEO
.center/x LDZ2 #0030 ADD2 .Screen/x DEO2
.center/y LDZ2 #0048 SUB2 .Screen/y DEO2
.Screen/width DEI2 draw-dec
;x-icn .Screen/addr DEO2
#01 .Screen/sprite DEO
.Screen/height DEI2
@draw-dec ( short* -- )
#00 ,&z STR
#2710 draw-dec/parse
#03e8 draw-dec/parse
#0064 draw-dec/parse
#000a draw-dec/parse
NIP
&emit
DUP [ LIT &z $1 ] EQU ?&skip
#ff ,&z STR #00 OVR #30 SFT ;font-icn ADD2 .Screen/addr DEO2
#01 .Screen/sprite DEO
&skip
POP
JMP2r
&parse DIV2k DUP ,&emit JSR MUL2 SUB2 JMP2r
(
@|assets )
@patt-icn [
aa55 aa55 aa55 aa55 ]
@x-icn [
0000 0018 1800 0000 ]
@preview-chr [
0f38 675f dfbf bfbf 0007 1820 2344 4848 ]
@font-icn ( 0-f ) [
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
@ -174,4 +203,15 @@ RTN
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080
007c 8280 f080 827c 007c 8280 f080 8080 [
@anim-chr [
0000 0018 1800 0000 c381 0000 0000 81c3
0000 183c 3c18 0000 0000 0000 0000 0000
0018 3c7e 7e3c 1800 0000 0000 0000 0000
3c7e ffe7 e7ff 7e3c 0000 0018 1800 0000
ffff e7c3 c3e7 ffff 0000 183c 3c18 0000
ffe7 c381 81c3 e7ff 0018 3c7e 7e3c 1800
c381 0000 0000 81c3 3c7e ffe7 e7ff 7e3c
0000 0000 0000 0000 ffff e7c3 c3e7 ffff
0000 0000 0000 0000 ffe7 c381 81c3 e7ff ]

View File

@ -0,0 +1,56 @@
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|100
@on-reset ( -> )
;buf <pstr>
#2018 DEO
;buf <pstr>
#0a18 DEO
( | copy left )
;buf #0006 ADD2 ;mmu-cpyl/a STA2
;buf #0003 ADD2 ;mmu-cpyl/b STA2
;mmu-cpyl .System/expansion DEO2
;buf <pstr>
#2018 DEO
;res1 <pstr>
#0a18 DEO
( | copy right )
;buf #0003 ADD2 ;mmu-cpyr/a STA2
;buf #0009 ADD2 ;mmu-cpyr/b STA2
;mmu-cpyr .System/expansion DEO2
;buf <pstr>
#2018 DEO
;res2 <pstr>
#0a18 DEO
( | copy left )
;buf #0009 ADD2 ;mmu-cpyl/a STA2
;buf #0006 ADD2 ;mmu-cpyl/b STA2
;mmu-cpyl .System/expansion DEO2
;buf <pstr>
#2018 DEO
;res3 <pstr>
#0a18 DEO
( | memset )
;buf #0003 ADD2 ;mmu-fill/a STA2
;mmu-fill .System/expansion DEO2
;buf <pstr>
#2018 DEO
;res4 <pstr>
#0a18 DEO
BRK
@<pstr> ( str* -- )
LDAk #18 DEO
INC2 LDAk ?<pstr>
POP2 JMP2r
@buf [ "......[hello]..... $1 ]
@res1 [ "...[hello]lo]..... $1 ]
@res2 [ "...[hello[hello].. $1 ]
@res3 [ "...[he[hello]lo].. $1 ]
@res4 [ "...-------------.. $1 ]
@mmu-fill [ 00 000d 0000 &a $2 2d ]
@mmu-cpyl [ 01 0007 0000 &a $2 0000 &b $2 ]
@mmu-cpyr [ 02 0007 0000 &a $2 0000 &b $2 ]

View File

@ -1,92 +1,56 @@
( brainfuck interpreter )
( usage: cat program.bf | uxncli brainfuck.rom )
%!~ { NEQk NIP }
%DEC { #01 SUB }
%DEC2 { #0001 SUB2 }
%DECr { LITr 01 SUBr }
%RTN { JMP2r }
%HALT { #0101 #0e DEO2 }
%EMIT { #18 DEO }
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
%MEMORY { #8000 }
|0100
|0000
@on-reset ( -> )
;on-console .Console/vector DEO2
BRK
@ptr $2
@on-console ( -> )
.Console/read DEI DUP #20 GTH ?{
POP <eval>
#0000 .Console/vector DEO2
#010f DEO
BRK }
[ LIT2 &ptr =program ] INC2k ,&ptr STR2
STA
BRK
|0100 ( -> )
@<eval> ( -- )
[ LIT2r =on-console/ptr ] LDA2r ;program
&while ( -- )
LDAk [ LIT "+ ] NEQ ?{ LDAkr STHr INC STH2kr STA }
LDAk [ LIT "- ] NEQ ?{ LDAkr STHr #01 SUB STH2kr STA }
LDAk [ LIT "> ] NEQ ?{ INC2r }
LDAk [ LIT "< ] NEQ ?{ [ LIT2r 0001 ] SUB2r }
LDAk [ LIT ". ] NEQ ?{ LDAkr [ LITr 18 ] DEOr }
LDAk [ LIT "[ ] NEQ ?{ goto-next }
LDAk [ LIT "] ] NEQ ?{ goto-back }
INC2 LDAk ?&while
POP2 POP2r JMP2r
MEMORY .ptr STZ2
@goto-next ( `mem* prg* -- )
OVR2r LDAr STHr ?{ JMP2r }
[ LITr 00 ] INC2
&loop ( -- )
LDAk [ LIT "[ ] NEQ ?{ INCr }
LDAk [ LIT "] ] NEQ ?{
STHkr ?{ POPr JMP2r }
[ LITr 01 ] SUBr }
INC2 !&loop
;program
&while
LDAk ,op JSR
INC2 LDAk ,&while JCN
POP2
@goto-back ( `mem* prg* -- )
OVR2r LDAr STHr ?{ JMP2r }
[ LITr 00 ] #0001 SUB2
&loop ( -- )
LDAk [ LIT "] ] NEQ ?{ INCr }
LDAk [ LIT "[ ] NEQ ?{
STHkr ?{ POPr JMP2r }
[ LITr 01 ] SUBr }
#0001 SUB2 !&loop
HALT
BRK
@program
@op ( op -- )
( Move the pointer to the right )
LIT '> !~ ,&movr JCN [ .ptr LDZ2k INC2 ROT STZ2 POP RTN ] &movr
( Move the pointer to the left )
LIT '< !~ ,&movl JCN [ .ptr LDZ2k DEC2 ROT STZ2 POP RTN ] &movl
( Increment the memory cell at the pointer )
LIT '+ !~ ,&incr JCN [ .ptr LDZ2 STH2k LDA INC STH2r STA POP RTN ] &incr
( Decrement the memory cell at the pointer )
LIT '- !~ ,&decr JCN [ .ptr LDZ2 STH2k LDA DEC STH2r STA POP RTN ] &decr
( Output the character signified by the cell at the pointer )
LIT '. !~ ,&emit JCN [ .ptr LDZ2 LDA EMIT POP RTN ] &emit
( Jump past the matching ] if the cell at the pointer is 0 )
LIT '[ !~ ,&next JCN [ POP ,goto-next JSR RTN ] &next
( Jump back to the matching [ if the cell at the pointer is nonzero )
LIT '] !~ ,&prev JCN [ POP ,goto-back JSR RTN ] &prev
POP
RTN
@goto-next ( -- )
.ptr LDZ2 LDA #00 EQU JMP RTN
( depth ) LITr 00
INC2
&loop
LDAk LIT '[ NEQ JMP INCr
LDAk LIT '] NEQ ,&no-end JCN
STHkr #00 EQU ,&end JCN
DECr
&no-end
INC2 LDAk ,&loop JCN
&end
( depth ) POPr
RTN
@goto-back ( -- )
.ptr LDZ2 LDA #00 NEQ JMP RTN
( depth ) LITr 00
DEC2
&loop
LDAk LIT '] NEQ JMP INCr
LDAk LIT '[ NEQ ,&no-end JCN
STHkr #00 EQU ,&end JCN
DECr
&no-end
DEC2 LDAk ,&loop JCN
&end
( depth ) POPr
RTN
@program ( Hello World! )
"++++++++[>++++[>++>+++>+++>+<<<<
"-]>+>+>->>+[<]<-]>>.>---.+++++++
"..+++.>>.<-.<.+++.------.-------
"-.>>+.>++.

View File

@ -0,0 +1,47 @@
( Fibonacci: Numbers made of the two numbers before it )
|0100
@on-reset
#0019 #0001
&l ( -- )
( index ) DUP2 pdec #2018 DEO
( recursive ) DUP2 fib pdec #2018 DEO
( tail-recursive ) DUP2 #0000 #0001 ROT2 fibr pdec
( lb ) #0a18 DEO
POP2 POP2 INC2 GTH2k ?&l
POP2 POP2
( end ) #800f DEO
BRK
(
@|recursive )
@fib ( num* -- numfib* )
#0001 GTH2k ?&>ok
POP2 JMP2r &>ok
SUB2k fib STH2
INC2 SUB2 fib STH2r
ADD2 JMP2r
(
@|tail-recursive )
@fibr ( a* b* num* -- a* b* numfib* )
#0001 NEQ2k ?&>no-1
POP2 POP2 DUP2 JMP2r &>no-1
SUB2 STH2
SWP2 OVR2 ADD2 STH2r !fibr
(
@|stdlib )
@pdec ( short* -- )
#2710 LIT2r 00fb
&w ( -- )
DIV2k #000a DIV2k MUL2 SUB2 SWPr EQUk OVR STHkr EQU AND ?&>skip
DUP LIT "0 ADD #18 DEO
INCr &>skip
POP2 #000a DIV2 SWPr INCr STHkr ?&w
POP2r POP2 POP2 JMP2r

View File

@ -1,43 +1,20 @@
( FizzBuzz: a program that prints the integers from 1 to 100.
for multiples of three, print "Fizz"
for multiples of five, print "Buzz"
for multiples of both three and five, print "FizzBuzz" )
( Print the first 30 numbers using the following rules:
| If n is divisible by 3, print "fizz"
| If n is divisible by 5, print "buzz"
| If n is divisible by both, print "fizzbuzz"
| Else, print the number )
%MOD { DIVk MUL SUB }
%HALT { #01 #0f DEO }
%EMIT { #18 DEO }
%RTN { JMP2r }
@fizzbuzz ( -> )
#1e00
&>loop ( length i -- )
DUP fizz OVR buzz ORA ?{ DUP <dec> }
#0a18 DEO
INC GTHk ?&>loop
POP2 BRK
@program
@fizz ( n -- ) #03 DIVk MUL SUB ?{ #01 ;Dict/fizz !<str> } #00 JMP2r
@buzz ( n -- ) #05 DIVk MUL SUB ?{ #01 ;Dict/buzz !<str> } #00 JMP2r
@<dec> ( n -- ) DUP #0a DIV /d #0a DIVk MUL SUB &d #30 ADD #18 DEO JMP2r
@<str> ( s* -- ) LDAk #18 DEO INC2 LDAk ?<str> POP2 JMP2r
@Dict &fizz "Fizz $1 &buzz "Buzz $1
|0100 ( -> )
#6400
&loop
LITr 00
DUP #03 MOD ,&no3 JCN ;fizz-txt ;print-str JSR2 INCr &no3
DUP #05 MOD ,&no5 JCN ;buzz-txt ;print-str JSR2 INCr &no5
STHr ,&resume JCN
( print decimal )
DUPk #0a DIV #30 ADD EMIT
#0a MOD #30 ADD EMIT
&resume
( add linebreak ) #0a EMIT
INC GTHk ,&loop JCN
POP2
HALT
BRK
@print-str ( addr* -- )
&loop
LDAk EMIT
INC2 LDAk ,&loop JCN
POP2
RTN
@fizz-txt "Fizz $1
@buzz-txt "Buzz $1

View File

@ -0,0 +1,2 @@
>++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.>>++++++[<+++++++>-]<++.------------.>++++++[<+++++++++>-]<+.<.+++.------.--------.>>>++++[<++++++++>-]<+.

View File

@ -0,0 +1,70 @@
( Pig:
Each turn you roll a die and add the total to your points.
You can stop at any time and keep that total, or keep rolling.
If you ever roll a 1 you lose all the points you accrued. )
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|0000 @t $1 ( Total saved )
|0100 @game ( -> )
#00 .t STZ
;input-main .Console/vector DEO2
,input-main/main JMP
@roll ( -- dice )
[ LIT2 &r f793 ]
( 5*R+35 ) #0005 MUL2 #0023 ADD2
( R-R/6547*6547 ) DUP2 #1993 DIV2 #1993 MUL2 SUB2
DUP2 #c5 DEI2 ADD2 ,&r STR2 ADD ( mod ) #06 DIVk MUL SUB
JMP2r
@input-main ( -> )
.Console/read DEI
LIT "0 EQUk NIP ,&no JCN
LIT "1 EQUk NIP ,&yes JCN
( ignore other inputs )
POP
BRK
&no ( char -- )
POP ;score-txt ,pstr JSR .t LDZ ,pdec JSR ;byte-txt ,&halt JMP
&yes ( char -- )
POP ,roll JSR ;rolled-txt ,pstr JSR INCk ,pdec/d JSR DUP ,&not-bust JCN
&bust ( char -- )
POP ;bust-txt
&halt ( msg* -- )
,pstr JSR #0a .Console/write DEO #010f DEO BRK
&not-bust ( dice -- )
INC .t LDZ ADD .t STZ
&main ( -- )
;total-txt ,pstr JSR .t LDZ ,pdec JSR ;roll-txt ,pstr JSR BRK
@pdec ( value -- )
DUP #0a DIV ,&emit JSR
&d #0a DIVk MUL SUB ,&emit JSR
#0a .Console/write DEO
JMP2r
&emit #30 ADD .Console/write DEO JMP2r
@pstr ( str* -- )
&while
LDAk DUP LIT "_ EQU #3f MUL SUB .Console/write DEO
INC2 LDAk ,&while JCN
POP2
JMP2r
@total-txt "Your_current_total_is:_ $1
@roll-txt "Would_you_like_to_roll?_(0_no,_1_yes)_ $1
@score-txt "Your_score_is:_ $1
@rolled-txt "You_rolled:_ $1
@bust-txt "Busted! $1
@byte-txt "Goodbye. $1

View File

@ -1,57 +1,36 @@
(
An integer greater than one is called a prime number
( Primes:
An integer greater than one is called a prime number
if its only positive divisors are one and itself. )
%RTN { JMP2r }
%HALT { #0101 #0e DEO2 }
%MOD2 { DIV2k MUL2 SUB2 }
%EMIT { #18 DEO }
|0100 ( -> ) @reset
|0100 ( -> ) @main
#0000 #0001
#0000 INC2k
&loop
DUP2 ,is-prime JSR #00 EQU ,&skip JCN
DUP2 ,print-hex/short JSR
#20 EMIT
DUP2 not-prime ?&skip
DUP2 print/short #2018 DEO
&skip
INC2 NEQ2k ,&loop JCN
INC2 NEQ2k ?&loop
POP2 POP2
HALT
( halt ) #010f DEO
BRK
@is-prime ( number* -- flag )
@not-prime ( number* -- flag )
DUP2 #0001 NEQ2 ,&not-one JCN
POP2 #00 RTN
&not-one
STH2k
( range ) #01 SFT2 #0002
DUP2 ,&t STR2
( range ) #01 SFT2 #0002 LTH2k ?&fail
&loop
STH2kr OVR2 MOD2 #0000 NEQ2 ,&continue JCN
POP2 POP2
POP2r #00 RTN
&continue
INC2 GTH2k ,&loop JCN
POP2 POP2
POP2r #01
[ LIT2 &t $2 ] OVR2 ( mod2 ) DIV2k MUL2 SUB2 ORA ?&continue
&fail POP2 POP2 #01 JMP2r &continue
INC2 GTH2k ?&loop
POP2 POP2 #00
RTN
JMP2r
@print-hex ( value* -- )
&short ( value* -- )
SWP ,&echo JSR
&byte ( value -- )
,&echo JSR
RTN
@print ( short* -- )
&echo ( value -- )
STHk #04 SFT ,&parse JSR EMIT
STHr #0f AND ,&parse JSR EMIT
RTN
&parse ( value -- char )
DUP #09 GTH ,&above JCN #30 ADD RTN &above #09 SUB #60 ADD RTN
&short ( short* -- ) SWP print/byte
&byte ( byte -- ) DUP #04 SFT print/char
&char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO
RTN
JMP2r

View File

@ -0,0 +1 @@
a001 38a0 0100 b460 0011 a020 1817 2121 aa20 fff2 2222 a080 0f17 0004 6000 0006 8004 1f60 0000 800f 1c06 8009 0a80 271a 1880 3018 8018 176c

View File

@ -0,0 +1,17 @@
( uxncli sierpinski.rom )
@sierpinski ( -> )
( mask ) [ LIT2r 0a18 ] [ LIT2r 2018 ]
( size ) [ LIT2 &size 1001 ] SUB
&>ver ( -- )
DUP INCk
&>pad ( length -- )
DEOkr
#01 SUB DUP ?&>pad
&>fill ( length i -- )
ANDk DUP2r ?{ POP2r ORA2kr } DEOr DEOkr
INC ADDk ,&size LDR LTH ?&>fill
POP2 OVR2r DEOr
#01 SUB INCk ?&>ver
POP POP2r POP2r BRK

View File

@ -1,45 +1,41 @@
( Subleq: The subleq instruction subtracts the contents at address a from the contents at address b, stores the result at address b, and then, if the result is not positive, jumps to address c. If the result is positive, execution proceeds to the next instruction in sequence. )
( uxnasm subleq.tal subleq.rom && uxncli subleq.rom )
%EMIT { #18 DEO }
%HALT { #0101 #0e DEO2 }
%RTN { JMP2r }
%GET { #10 SFT2 ;program ADD2 LDA2 }
%SET { #10 SFT2 ;program ADD2 STA2 }
|0000 @a $2 @b $2 @c $2
|0100
( pointer ) #0000
&while
,eval JSR
DUP2 #8000 LTH2 ,&while JCN
@on-reset ( -> )
#0000
&while ( -- )
eval DUP2 #8000 LTH2 ?&while
POP2
HALT
BRK
( halt ) #010f DEO
BRK
@eval ( ip* -- ip* )
DUP2 GET .a STZ2
INC2 DUP2 GET .b STZ2
INC2 DUP2 GET .c STZ2
DUP2 get ,&a STR2
INC2 DUP2 get ,&b STR2
INC2 DUP2 get ,&c STR2
INC2
( I/O )
.a LDZ2 #ffff NEQ2 ,&noin JCN
( nothing. ) ,&end JMP2 &noin
.b LDZ2 #ffff NEQ2 ,&noout JCN
.a LDZ2 GET NIP EMIT ,&end JMP &noout
( SUBLEQ )
.b LDZ2 GET .a LDZ2 GET SUB2 .b LDZ2 SET
( SET )
.b LDZ2 GET #0001 SUB2 #8000 LTH2 ,&end JCN
POP2 .c LDZ2 &end
( | I/O )
[ LIT2 &a $2 ] #ffff EQU2 ?&input
[ LIT2 &b $2 ] #ffff EQU2 ?&output
( | SUBLEQ )
( sub ) ,&b LDR2 get ,&a LDR2 get SUB2 DUP2
( write ) ,&b LDR2 DUP2 ADD2 ;program ADD2 STA2
( leq ) #0001 SUB2 #8000 LTH2 ?&end
POP2 [ LIT2 &c $2 ] &end JMP2r
&input ( -- )
( TODO ) JMP2r
&output ( -- )
,&a LDR2 get NIP #18 DEO
JMP2r
RTN
@get ( a* -- b* )
DUP2 ADD2 ;program ADD2 LDA2 JMP2r
@program ( hello world )
000f 0011 ffff 0011 ffff ffff 0010 0001
ffff 0010 0003 ffff 000f 000f 0000 0000
ffff 0048 0065 006c 006c 006f 002c 0020
0077 006f 0072 006c 0064 0021 000a 0000
[
000f 0011 ffff 0011 ffff ffff 0010 0001
ffff 0010 0003 ffff 000f 000f 0000 0000
ffff 0048 0065 006c 006c 006f 002c 0020
0077 006f 0072 006c 0064 0021 000a 0000 ]

View File

@ -0,0 +1,12 @@
@on-reset ( -> )
#0b #14 #18 tak
#010e DEO
BRK
@tak ( z y x -- res )
LTHk ?{ POP2 JMP2r }
ROT ROTk ROTk
( x-1 ) #01 SUB tak STH
( y-1 ) #01 SUB tak STH
( z-1 ) #01 SUB tak STHr STHr !tak

View File

@ -1,78 +0,0 @@
( GUI Animation )
%2// { #01 SFT2 }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|0000
@dvd [ &x $2 &y $2 &dx $1 &dy $1 ]
( program )
|0100 ( -> )
( theme )
#4cfd .System/r DEO2
#4cf3 .System/g DEO2
#dcf2 .System/b DEO2
( vectors )
;on-frame .Screen/vector DEO2
( starting position )
.Screen/width DEI2 2// .dvd/x STZ2
.Screen/height DEI2 2// .dvd/y STZ2
#01 ;draw-dvd JSR2
BRK
@on-frame ( -> )
( clear ) #00 ;draw-dvd JSR2
( case: hit-right ) .dvd/x LDZ2 .Screen/width DEI2 #0020 SUB2 EQU2
( case: hit-left ) .dvd/x LDZ2 #0000 EQU2
#0000 EQU2 ,&no-flipx JCN
.dvd/dx LDZ #00 EQU .dvd/dx STZ &no-flipx
( case: hit-bottom ) .dvd/y LDZ2 .Screen/height DEI2 #0010 SUB2 EQU2
( case: hit-top ) .dvd/y LDZ2 #0000 EQU2
#0000 EQU2 ,&no-flipy JCN
.dvd/dy LDZ #00 EQU .dvd/dy STZ &no-flipy
( incr ) .dvd/x LDZ2 #0001 #00 .dvd/dx LDZ #00 EQU DUP2 ADD2 SUB2 ADD2 .dvd/x STZ2
( incr ) .dvd/y LDZ2 #0001 #00 .dvd/dy LDZ #00 EQU DUP2 ADD2 SUB2 ADD2 .dvd/y STZ2
( draw ) #01 ;draw-dvd JSR2
BRK
@draw-dvd ( color -- )
( stash ) STH
;dvd_icn .Screen/addr DEO2
[ .dvd/y LDZ2 #0010 ADD2 ] .dvd/y LDZ2
&ver
DUP2 .Screen/y DEO2
[ .dvd/x LDZ2 #0020 ADD2 ] .dvd/x LDZ2
&hor
DUP2 .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO
( next ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
( incr ) #0008 ADD2
GTH2k ,&hor JCN
POP2 POP2
( incr ) #0008 ADD2
GTH2k ,&ver JCN
POP2 POP2
( destroy ) POPr
JMP2r
@dvd_icn [
001f 3f38 3838 787f 00fe fe7e 7777 e3c3
000f 1f3b 7b77 e7c7 00fc fe8f 8707 0efc
7f00 000f ff7f 0700 0301 00ff f0f8 ff00
8700 00ff 7f7f ff00 f000 00e0 fcfc 8000
]

View File

@ -0,0 +1,93 @@
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 &pad $4 &scrolly &scrolly-hb $1 &scrolly-lb $1
|0100
@on-reset ( -> )
#5c0f .System/r DEO2
#6d0f .System/g DEO2
#6d0f .System/b DEO2
#0038 DUP2 .Screen/width DEO2
.Screen/height DEO2
;on-mouse .Mouse/vector DEO2
;button-chr <draw-button>
BRK
@on-frame ( -> )
[ LIT2 18 &time 00 ] INCk ,&time STR
EQU ?{ BRK }
#0000 .Screen/vector DEO2
;button-chr/up <draw-button>
[ LIT2 "! 18 ] DEO
BRK
@on-mouse ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #42 ADD ;pointer-icn <update-pointer>
.Mouse/state DEI ?{ BRK }
.Mouse/x DEI2 .Mouse/y DEI2 within-button ?{ BRK }
;button-chr/down <draw-button>
;on-frame .Screen/vector DEO2
#10 ;on-frame/time STA
[ LIT2 00 -Mouse/state ] DEO
BRK
@within-button ( x* y* -- f )
#0010 SUB2 #0018 LTH2 STH
#0010 SUB2 #0018 LTH2 STHr AND JMP2r
(
@|drawing )
@<draw-button> ( addr* -- )
[ LIT2 26 -Screen/auto ] DEO
#0010 DUP2 .Screen/x DEO2
.Screen/y DEO2
.Screen/addr DEO2
[ LIT2 81 -Screen/sprite ] DEOk DEOk DEO
JMP2r
@<update-pointer> ( color addr* -- )
[ LIT2 00 -Screen/auto ] DEO
;fill-icn .Screen/addr DEO2
#40 <draw-pointer>
.Mouse/x DEI2 ,<draw-pointer>/x STR2
.Mouse/y DEI2 ,<draw-pointer>/y STR2
.Screen/addr DEO2
@<draw-pointer> ( color -- )
[ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 &y $2 ] .Screen/y DEO2
.Screen/sprite DEO
JMP2r
(
@|assets )
@fill-icn [ ffff ffff ffff ffff ]
@pointer-icn [ 80c0 e0f0 f8e0 1000 ]
@button-chr
&up [
0000 1f3f 3f3f 3f3f 001f 3f7f 7f7f 7f7f
0000 ffff ffff ffff 00ff ffff ffff ffff
0000 f8fc fcfc fcfc 00f8 fcfe fefe fefe
3f3f 3f3f 3f3f 3f3f 7f7f 7f7f 7f7f 7f7f
e7e7 e781 c3e7 ffff ffff ffff ffff ffff
fcfc fcfc fcfc fcfc fefe fefe fefe fefe
3f3f 3f3f 3f1f 0000 7f7f 7f5f 4020 1f00
ffff ffff ffff 0000 ffff ffff 0000 ff00
fcfc fcfc fcf8 0000 fefe fefa 0204 f800 ]
&down [
0000 001f 3f3f 3f3f 0000 1f3f 7f7f 7f7f
0000 00ff ffff ffff 0000 ffff ffff ffff
0000 00f8 fcfc fcfc 0000 f8fc fefe fefe
3f3f 3f3f 3f3f 3f3f 7f7f 7f7f 7f7f 7f7f
ffe7 e7e7 81c3 e7ff ffff ffff ffff ffff
fcfc fcfc fcfc fcfc fefe fefe fefe fefe
3f3f 3f3f 3f1f 0000 7f7f 7f7f 5f20 1f00
ffff ffff ffff 0000 ffff ffff ff00 ff00
fcfc fcfc fcf8 0000 fefe fefe fa04 f800 ]

View File

@ -1,10 +1,5 @@
( GUI Hover )
%RTN { JMP2r }
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
@ -15,7 +10,6 @@
@color $1
@pointer [ &x $2 &y $2 &sprite $2 ]
@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@r1 [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@r2 [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@r3 [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@ -80,43 +74,46 @@ BRK
@within-rect ( x* y* rect -- flag )
STH
( y < rect.y1 ) DUP2 STHkr #02 ADD LDZ2 LTH2 ,&skip JCN
( y < rect.y1 ) DUP2 STHkr INC INC LDZ2 LTH2 ,&skip JCN
( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN
SWP2
( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN
( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN
POP2 POP2 POPr
#01
RTN
JMP2r
&skip
POP2 POP2 POPr
#00
RTN
JMP2r
@line-rect ( x1* y1* x2* y2* color -- )
( load ) .color STZ
STH2k .rect/y2 STZ2 .rect/x2 STZ2
STH2k .rect/y1 STZ2 .rect/x1 STZ2
STH2r STH2r SWP2
&ver
( save ) DUP2 .Screen/y DEO2
( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO
( incr ) INC2
OVR2 OVR2 GTS2 ,&ver JCN
POP2 POP2
.rect/x1 LDZ2 .rect/x2 LDZ2 SWP2
STH
DUP2 ,&ver-y2 STR2 ,&hor-y2 STR2
DUP2 ,&ver-x2 STR2 ,&hor-x2 STR2
DUP2 ,&ver-y1 STR2 ,&hor-y1 STR2
DUP2 ,&ver-x1 STR2 ,&hor-x1 STR2
( horizontal )
[ LIT2 &hor-x2 $2 ] INC2 [ LIT2 &hor-x1 $2 ]
&hor
( save ) DUP2 .Screen/x DEO2
( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO
( incr ) INC2
OVR2 OVR2 GTS2 ,&hor JCN
DUP2 .Screen/x DEO2
[ LIT2 &hor-y1 $2 ] .Screen/y DEO2 STHkr .Screen/pixel DEOk
[ LIT2 &hor-y2 $2 ] .Screen/y DEO2 DEO
INC2 GTH2k ,&hor JCN
POP2 POP2
( vertical )
[ LIT2 &ver-y2 $2 ] [ LIT2 &ver-y1 $2 ]
&ver
DUP2 .Screen/y DEO2
[ LIT2 &ver-x1 $2 ] .Screen/x DEO2 STHkr .Screen/pixel DEOk
[ LIT2 &ver-x2 $2 ] .Screen/x DEO2 DEO
INC2 GTH2k ,&ver JCN
POP2 POP2
POPr
RTN
JMP2r
@pointer_icn [ 80c0 e0f0 f8e0 1000 ]
@hand_icn [ 4040 4070 f8f8 f870 ]

View File

@ -1,138 +1,475 @@
( GUI Labels )
%RTN { JMP2r }
%2// { #01 SFT2 }
%8** { #30 SFT2 }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
( variables )
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|0000
@label [ &x $2 &y $2 &color $1 &addr $2 ]
@center [ &x $2 &y $2 ]
( program )
@center &x $2 &y $2
|0100
( theme )
#0f0f .System/r DEO2
#0fff .System/g DEO2
#0ff0 .System/b DEO2
( theme )
#a0dc .System/r DEO2
#a0dc .System/g DEO2
#a0dc .System/b DEO2
( find screen center )
.Screen/width DEI2 2// .center/x STZ2
.Screen/height DEI2 2// .center/y STZ2
.Screen/width DEI2 #01 SFT2 .center/x STZ2
.Screen/height DEI2 #01 SFT2 .center/y STZ2
( draw ver line )
.center/x LDZ2 .Screen/x DEO2 #0000 .Screen/y DEO2
&draw-ver
( draw ) #02 .Screen/pixel DEO
( incr ) .Screen/y DEI2 #0002 ADD2 .Screen/y DEO2
.Screen/y DEI2 .Screen/height DEI2 LTH2 ,&draw-ver JCN
( dashed line )
#02 .Screen/auto DEO
#0000 .Screen/y DEO2
.center/x LDZ2 .Screen/x DEO2
.Screen/height DEI2 #0000
&ver
DUP #01 AND .Screen/pixel DEO
INC2 GTH2k ,&ver JCN
POP2 POP2
.center/x LDZ2 .center/y LDZ2 #0010 SUB2 #0c ;text1 ;draw-label-left JSR2
.center/x LDZ2 .center/y LDZ2 #0c ;text2 ;draw-label-middle JSR2
.center/x LDZ2 .center/y LDZ2 #0010 ADD2 #0c ;text3 ;draw-label-right JSR2
.center/x LDZ2 .center/y LDZ2 #0020 ADD2 #0c ;text4 ;draw-label-middle JSR2
.center/x LDZ2 .center/y LDZ2 #0030 ADD2 #0c ;text5 ;draw-label-middle JSR2
( left )
.center/x LDZ2 .Screen/x DEO2
.center/y LDZ2 #0018 SUB2 .Screen/y DEO2
;left-txt ,draw-uf2 JSR
RTN
( center )
.center/x LDZ2 .Screen/x DEO2
.center/y LDZ2 .Screen/y DEO2
;center-txt ,draw-uf2-center JSR
@draw-label-left ( x y color addr -- )
( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2 .Screen/x DEO2
.label/addr LDZ2
&loop
( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
( incr ) INC2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
LDAk ,&loop JCN
( right )
.center/x LDZ2 .Screen/x DEO2
.center/y LDZ2 #0018 ADD2 .Screen/y DEO2
;right-txt ,draw-uf2-right JSR
BRK
@get-uf2-width ( text* -- width* )
LIT2r 0000
&while
LDAk #0000 ROT ;font ADD2 LDA STH2 ADD2r
INC2 LDAk ,&while JCN
POP2
STH2r
JMP2r
@draw-uf2-center ( text* -- )
DUP2 ,get-uf2-width JSR #01 SFT2 STH2
.Screen/x DEI2k STH2r SUB2 ROT DEO2
,draw-uf2 JMP
@draw-uf2-right ( text* -- )
DUP2 ,get-uf2-width JSR STH2
.Screen/x DEI2k STH2r SUB2 ROT DEO2
@draw-uf2 ( text* -- )
#15 .Screen/auto DEO
&while
LDAk #20 SUB #00 SWP
DUP2 #50 SFT2 ;font/glyphs ADD2 .Screen/addr DEO2
;font ADD2 LDA STHk #00 SWP .Screen/x DEI2 ADD2
#01 .Screen/sprite DEOk STHr #08 LTH ,&thin JCN DEOk &thin POP2
.Screen/x DEO2
INC2 LDAk ,&while JCN
POP2
RTN
JMP2r
@draw-label-middle ( x y color addr -- )
( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2
( align ) .label/addr LDZ2 ;get-text-length JSR2 8** 2// SUB2 .Screen/x DEO2
.label/addr LDZ2
&loop
( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
( incr ) INC2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
LDAk ,&loop JCN
POP2
@left-txt "Left 20 "Aligned 20 "Label $1
@center-txt "Center 20 "Aligned 20 "Label $1
@right-txt "Right 20 "Aligned 20 "Label $1
RTN
@draw-label-right ( x y color addr -- )
( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2
( align ) .label/addr LDZ2 ;get-text-length JSR2 8** SUB2 .Screen/x DEO2
.label/addr LDZ2
&loop
( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
( incr ) INC2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
LDAk ,&loop JCN
POP2
RTN
@get-text-length ( label* -- length )
#0000 ( counter )
&loop
( incr ) INC2 OVR2 OVR2 ADD2
LDA ,&loop JCN
NIP2
RTN
@font ( spectrum-zx font )
[
0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000
0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000
007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000
0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800
0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800
003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038
0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000
0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000
0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400
0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000
0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800
0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000
003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00
0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000
003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810
0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800
003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00
0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00
0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200
0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00
007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00
00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200
0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00
0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00
0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00
0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c
0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400
0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800
0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800
0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800
0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00
0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c
]
@text1 [ "Left 20 "Aligned 00 ]
@text2 [ "Middle 20 "Aligned 00 ]
@text3 [ "Right 20 "Aligned 00 ]
@text4 [ "even 00 ]
@text5 [ "odd 00 ]
@font ( venice14 )
0505 0809 080c 0d05 0707 0a09 0609 0608
0808 0808 0908 0808 0808 0505 0708 0709
000d 0a08 0b0a 090a 0c08 070c 090e 0c09
0a09 0c08 090b 0a0d 0d0a 0906 0806 0809
0509 0807 0a07 0708 0906 0609 050f 0a08
0908 0707 060a 090e 0a09 0807 0507 0800
0d0d 080a 0c09 0b09 0909 0909 0907 0707
0707 0606 0606 0a08 0808 0808 0a0a 0a0a
0000 0000 0000 000a 0000 0005 0000 1009
0000 0000 0000 0000 0000 0000 0000 0c08
0905 0000 0000 000a 0a00 080d 0d09 0e0c
090c 0808 0505 0000 0907 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
&glyphs ( starting at #20 )
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 3030 3030 3030 3000 3030 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 2424 2400 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 1212 7f24 24fe 4848 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 1038 5450 7038 1c14 5438 1000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 3748 494b 360d 1a32 6241 0000 0000
0000 c0c0 8000 0080 4040 4080 0000 0000
0000 1c22 261c 1835 6343 463c 0000 0000
0000 0000 0000 e090 1020 8060 0000 0000
0000 2020 2000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0008 1030 2060 6060 6020 3010 0800 0000
0000 0000 0000 0000 0000 0000 0000 0000
0020 1018 080c 0c0c 0c08 1810 2000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0012 0c3f 0c12 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0008 0808 7f08 0808 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 3030 1020 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 7f00 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 3030 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0206 040c 0818 1030 2060 4000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 3c66 6666 6666 6666 663c 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0818 3818 1818 1818 183c 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 3c46 8606 0c18 3060 c2fc 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 7e8c 1830 7c06 4686 8c78 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 040c 1c2c 4c8d fe0c 0c1e 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 7c62 6078 0c06 0606 4c38 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 1c22 606c 7666 6666 663c 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 7e86 060c 0c18 1830 3030 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 3c66 6666 3c66 6666 663c 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 3c66 6666 666e 3606 4438 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0030 3000 0000 3030 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0030 3000 0000 3030 1020 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0c18 3060 3018 0c00 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 7e00 7e00 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 6030 180c 1830 6000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 3c46 0606 0c18 1000 1010 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0001 0200 0001 0306 7f98 30e0 0000 0000
00c0 6060 e0e0 6060 e060 6038 0000 0000
0010 7eb3 b333 3e31 3131 31ff 0000 0000
0000 0000 0000 0080 8080 8000 0000 0000
0000 7cc2 c2c4 c0c0 c0c2 c478 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0010 7fb1 b030 3030 3030 30ff 0000 0000
0000 0080 c0c0 c0c0 c0c0 8000 0000 0000
0010 7fb0 b030 3e30 3030 30ff 0000 0000
0000 8080 0000 0000 0040 8000 0000 0000
0010 7fb0 b030 3e30 3030 30e0 0000 0000
0000 8080 0000 0000 0000 0000 0000 0000
0000 3f61 c2c0 cfc3 c3c7 cb73 0000 0000
0000 0000 0000 0000 0040 8000 0000 0000
0000 71b1 b131 7fb1 3131 31e1 0000 0000
00e0 8080 8080 8080 8090 a0c0 0000 0000
0000 7898 9818 1818 1819 1a1c 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 7898 9818 1818 1818 1818 1810 20c0
0000 0000 0000 0000 0000 0000 0000 0000
0000 70b1 b336 3c38 3c36 33e1 0000 0000
0000 c080 0000 0000 0010 20c0 0000 0000
0000 3860 6060 6060 6060 61fe 0000 0000
0000 0000 0000 0000 0080 0000 0000 0000
0000 70b8 bd2e 2420 2020 20c0 0000 0000
0000 70e0 6060 6060 6064 6870 0000 0000
0000 70b8 bc2e 2723 2120 20c0 0000 0000
0000 6040 4040 40c0 c0c0 4040 0000 0000
0000 3c46 c3c3 c3c3 c3c2 4438 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 7fb1 b131 313f 3030 30e0 0000 0000
0000 0080 8080 8000 0000 0000 0000 0000
0000 3c46 c3c3 c3c3 c3d3 4a3c 0402 0000
0000 0000 0000 0000 0000 0000 0000 0000
0010 7fb1 b131 313f 3633 31e0 0000 0000
0000 0080 8080 8000 0000 90e0 0000 0000
0000 7cc2 e470 381c 4e86 c67c 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 7f8c 8c0c 0c0c 0c0c 0c38 0000 0000
0000 8000 0000 0000 0000 0000 0000 0000
0000 61e1 6161 6161 6365 6931 0000 0000
0000 8080 8080 8080 80a0 c080 0000 0000
0000 61e3 6161 6163 666c 7870 0000 0000
0000 0080 8080 8000 0000 0000 0000 0000
0000 60e0 6060 6266 6e76 6747 0000 0000
0000 2070 3030 3030 60c0 8000 0000 0000
0000 60b0 980d 0707 0d18 3060 0000 0000
0000 3060 c080 0000 80c8 6830 0000 0000
0000 61e1 6161 6161 6163 6539 0101 021c
0000 8080 8080 8080 8080 8080 8000 0000
0000 7f83 860c 1830 60c0 c1fe 0000 0000
0000 0000 0000 0000 0080 0000 0000 0000
0078 6060 6060 6060 6060 6060 7800 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 4060 2030 1018 080c 0406 0200 0000
0000 0000 0000 0000 0000 0000 0000 0000
0078 1818 1818 1818 1818 1818 7800 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0010 2844 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 00ff 0000 0000
0000 0000 0000 0000 0000 0080 0000 0000
0040 2010 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 007e c6c6 c6ce d766 0000 0000
0000 0000 0000 0000 0080 0000 0000 0000
0070 c0c0 c0dc e6c6 c6c6 ccf8 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 007c c4c0 c0c4 c870 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0003 0606 067e c6c6 c6ce d667 0000 0000
0080 0000 0000 0000 0040 8000 0000 0000
0000 0000 007c c4c8 d0e2 c478 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
001c 3030 3078 3030 3030 3030 3030 20c0
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 007e c6c6 c6ce d666 0604 0830
0000 0000 0000 0000 0000 0000 0000 0000
0070 c0c0 c0ce d6e6 c6c6 c7c6 0000 0000
0000 0000 0000 0000 0080 0000 0000 0000
0000 2040 0060 e060 6064 6870 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 1020 0030 70b0 3030 3030 3020 4080
0000 0000 0000 0000 0000 0000 0000 0000
0070 c0c0 c0d8 e4c4 f8d8 cdc6 0000 0000
0000 0000 0000 0000 0080 0000 0000 0000
0070 c0c0 c0c0 c0c0 c0c8 d0e0 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0067 eb73 6363 6363 0000 0000
0000 0000 0038 5898 181a 1c18 0000 0000
0000 0000 0067 eb73 6363 6363 0000 0000
0000 0000 0000 0000 0040 8000 0000 0000
0000 0000 007c c6c6 c6c6 cc78 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 006e f363 6363 667c 6060 60c0
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 007e c6c6 c6ce d666 0606 0706
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 006c f060 6060 7060 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0078 c4c0 780c 8c78 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0020 60f8 6060 6064 6870 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0063 e363 6367 6b33 0000 0000
0000 0000 0000 0000 0040 8000 0000 0000
0000 0000 0042 e763 6264 6870 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0042 e763 676b 7363 0000 0000
0000 0000 0010 3818 1020 4080 0000 0000
0000 0000 0061 b21c 0c16 2341 0000 0000
0000 0000 0000 0000 0000 4080 0000 0000
0000 0000 0063 e363 6367 6b33 0302 0438
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 007e 860c 1830 61fe 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 1830 3030 3060 3030 3030 3018 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 2020 2020 2020 2020 2020 2020 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 3018 1818 180c 1818 1818 1830 0000
0000 0000 0000 0000 0000 0000 0000 0000
4c00 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0001 0200 0001 0306 7f98 30e0 0000 0000
00c0 6060 e0e0 6060 e060 6038 0000 0000
0001 0200 0001 0306 7f98 30e0 0000 0000
c0c0 6060 e0e0 6060 e060 6038 0000 0000
0000 7cc2 c2c4 c0c0 c0c2 c478 1010 2000
0000 0000 0000 0000 0000 0000 0000 0000
0010 7fb0 b030 3e30 3030 30ff 0000 0000
0000 8080 0000 0000 0040 8000 0000 0000
1300 70b8 bc2e 2723 2120 20c0 0000 0000
0000 6040 4040 40c0 c0c0 4040 0000 0000
0000 3c46 c3c3 c3c3 c3c2 4438 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 61e1 6161 6161 6365 6931 0000 0000
0000 8080 8080 8080 80a0 c080 0000 0000
0008 1000 007e c6c6 c6ce d766 0000 0000
0000 0000 0000 0000 0080 0000 0000 0000
0010 0800 007e c6c6 c6ce d766 0000 0000
0000 0000 0000 0000 0080 0000 0000 0000
1028 4400 007e c6c6 c6ce d766 0000 0000
0000 0000 0000 0000 0080 0000 0000 0000
0000 2400 007e c6c6 c6ce d766 0000 0000
0000 0000 0000 0000 0080 0000 0000 0000
0032 4c00 007e c6c6 c6ce d766 0000 0000
0000 0000 0000 0000 0080 0000 0000 0000
1824 2418 007e c6c6 c6ce d766 0000 0000
0000 0000 0000 0000 0080 0000 0000 0000
0000 0000 007c c4c0 c0c4 c870 1010 2000
0000 0000 0000 0000 0000 0000 0000 0000
0008 1000 007c c4c8 d0e2 c478 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0020 1000 007c c4c8 d0e2 c478 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
1028 4400 007c c4c8 d0e2 c478 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 4800 007c c4c8 d0e2 c478 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0020 4000 0060 e060 6064 6870 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0040 2000 0060 e060 6064 6870 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
2050 8800 0060 e060 6064 6870 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 9000 0060 e060 6064 6870 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0019 2600 0067 eb73 6363 6363 0000 0000
0000 0000 0000 0000 0040 8000 0000 0000
0008 1000 007c c6c6 c6c6 cc78 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0020 1000 007c c6c6 c6c6 cc78 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
1028 4400 007c c6c6 c6c6 cc78 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 2400 007c c6c6 c6c6 cc78 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0032 4c00 007c c6c6 c6c6 cc78 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0008 1000 0063 e363 6367 6b33 0000 0000
0000 0000 0000 0000 0040 8000 0000 0000
0010 0800 0063 e363 6367 6b33 0000 0000
0000 0000 0000 0000 0040 8000 0000 0000
0814 2200 0063 e363 6367 6b33 0000 0000
0000 0000 0000 0000 0040 8000 0000 0000
0000 2400 0063 e363 6367 6b33 0000 0000
0000 0000 0000 0000 0040 8000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 1e33 3333 3631 3131 33e6 0000 0000
0000 0000 0000 0000 8080 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0010 2040 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0001 0200 0001 0306 7f98 30e1 0000 0000
00c0 7f61 e0e0 7c60 e060 61fe 0000 0000
0000 3d42 c7cb cbd3 d3e2 44b8 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 007d c6c6 c6cf d663 0000 0000
0000 0000 00e0 2040 8010 20c0 0000 0000
0000 0000 007c c6ce d6e6 cc78 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0808 0008 1830 6060 623c 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 6060 0060 6060 6060 6060 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0009 1224 4824 1209 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0024 1209 0409 1224 0000 0000
0000 0000 0000 0000 8000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0001 0200 0001 0306 7f98 30e0 0000 0000
00c0 6060 e0e0 6060 e060 6038 0000 0000
0001 0200 0001 0306 7f98 30e0 0000 0000
00c0 6060 e0e0 6060 e060 6038 0000 0000
4c00 3c46 c3c3 c3c3 c3c2 4438 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 3f47 c3c3 c3c3 c3c3 473b 0000 0000
0000 f808 0000 e000 0004 08f0 0000 0000
0000 0000 007d c6c6 c6c7 ce79 0000 0000
0000 0000 00e0 2040 8010 20c0 0000 0000
0000 0000 0000 7f00 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 7f00 0000 0000 0000 0000
0000 0000 0000 e000 0000 0000 0000 0000
0000 2448 6c6c 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 3636 1224 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 2040 6060 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 3030 1020 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 2400 0063 e363 6367 6b33 0302 0438
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0070 98ce 6438 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000

View File

@ -0,0 +1,148 @@
( GUI Monospace )
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
( variables )
|0000
( program )
|0100
( theme )
#f05d .System/r DEO2
#f0cd .System/g DEO2
#f0ad .System/b DEO2
( draw hello world )
#0010 .Screen/x DEO2
#0010 .Screen/y DEO2
;hello-txt #01 ;draw-uf1 JSR2
( draw long text )
#0010 .Screen/x DEO2
#0030 .Screen/y DEO2
;long-txt #02 ;draw-uf1-linebreaks JSR2
BRK
@draw-uf1 ( string* color -- )
#01 .Screen/auto DEO
STH
&while
( get sprite ) LDAk #20 SUB #00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO
INC2 LDAk ,&while JCN
POPr
POP2
JMP2r
@draw-uf1-linebreaks ( string* color -- )
.Screen/x DEI2 ,&anchor STR2
#01 .Screen/auto DEO
STH
&while
LDAk #0a NEQ ,&no-lb JCN
( rewind ) LIT2 &anchor $2 .Screen/x DEO2
( skip line ) .Screen/y DEI2k #0008 ADD2 ROT DEO2
,&end JMP
&no-lb
( get sprite ) LDAk #20 SUB #00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO
&end
INC2 LDAk ,&while JCN
POPr
POP2
JMP2r
@hello-txt "Hello 20 "Uxn! $1
@long-txt
5275 7374 6963 2043 6f6d 7075 7469 6e67
2072 6566 6572 7320 746f 2074 6865 2063
6f6e 7374 7275 6374 696f 6e20 0a6f 6620
6361 6c63 756c 6174 696f 6e20 6d61 6368
696e 6573 2075 7369 6e67 2070 7265 2d69
6e64 7573 7472 6961 6c20 0a6f 7220 6576
656e 2070 7265 2d68 6973 746f 7269 6320
7465 6368 6e6f 6c6f 6779 2e20 0a0a 4974
2072 6576 6561 6c73 2061 2068 6973 746f
7279 206f 6620 636f 6d70 7574 696e 6720
6173 2074 6865 200a 7061 7374 696d 6520
6f66 2064 696c 6574 7461 6e74 6573 2c20
616d 6174 6575 7220 7363 6965 6e74 6973
7473 0a61 6e64 2074 6162 756c 6174 6f72
7320 7768 6f20 636f 6e73 7472 7563 7420
6d61 6368 696e 6573 2074 6f20 0a6d 616e
6970 756c 6174 6520 6162 7374 7261 6374
2073 796d 626f 6c73 2077 6974 6820 6e6f
2070 7261 6374 6963 616c 200a 6170 706c
6963 6174 696f 6e2e 2041 7320 7468 6573
6520 6d61 6368 696e 6573 2061 7265 2067
656e 6572 616c 6c79 200a 6c65 7373 2065
6666 6963 6965 6e74 2074 6861 6e20 636f
6e76 656e 7469 6f6e 616c 2070 656e 6369
6c20 616e 6420 0a70 6170 6572 2063 6f6d
7075 7461 7469 6f6e 2c20 7468 6579 2061
6c6c 7564 6520 746f 2061 206d 6f72 6520
0a65 7069 6375 7265 616e 2070 7261 6374
6963 6520 6f66 2063 6f6d 7075 7469 6e67
2066 6f72 2070 6c65 6173 7572 6520 0a72
6174 6865 7220 7468 616e 2070 726f 6475
6374 696f 6e2e
@font ( bbcmicro )
0000 0000 0000 0000 1818 1818 1800 1800
6c6c 6c00 0000 0000 3636 7f36 7f36 3600
0c3f 683e 0b7e 1800 6066 0c18 3066 0600
386c 6c38 6d66 3b00 0c18 3000 0000 0000
0c18 3030 3018 0c00 3018 0c0c 0c18 3000
0018 7e3c 7e18 0000 0018 187e 1818 0000
0000 0000 0018 1830 0000 007e 0000 0000
0000 0000 0018 1800 0006 0c18 3060 0000
3c66 6e7e 7666 3c00 1838 1818 1818 7e00
3c66 060c 1830 7e00 3c66 061c 0666 3c00
0c1c 3c6c 7e0c 0c00 7e60 7c06 0666 3c00
1c30 607c 6666 3c00 7e06 0c18 3030 3000
3c66 663c 6666 3c00 3c66 663e 060c 3800
0000 1818 0018 1800 0000 1818 0018 1830
0c18 3060 3018 0c00 0000 7e00 7e00 0000
3018 0c06 0c18 3000 3c66 0c18 1800 1800
3c66 6e6a 6e60 3c00 3c66 667e 6666 6600
7c66 667c 6666 7c00 3c66 6060 6066 3c00
786c 6666 666c 7800 7e60 607c 6060 7e00
7e60 607c 6060 6000 3c66 606e 6666 3c00
6666 667e 6666 6600 7e18 1818 1818 7e00
3e0c 0c0c 0c6c 3800 666c 7870 786c 6600
6060 6060 6060 7e00 6377 7f6b 6b63 6300
6666 767e 6e66 6600 3c66 6666 6666 3c00
7c66 667c 6060 6000 3c66 6666 6a6c 3600
7c66 667c 6c66 6600 3c66 603c 0666 3c00
7e18 1818 1818 1800 6666 6666 6666 3c00
6666 6666 663c 1800 6363 6b6b 7f77 6300
6666 3c18 3c66 6600 6666 663c 1818 1800
7e06 0c18 3060 7e00 7c60 6060 6060 7c00
0060 3018 0c06 0000 3e06 0606 0606 3e00
183c 6642 0000 0000 0000 0000 0000 00ff
1c36 307c 3030 7e00 0000 3c06 3e66 3e00
6060 7c66 6666 7c00 0000 3c66 6066 3c00
0606 3e66 6666 3e00 0000 3c66 7e60 3c00
1c30 307c 3030 3000 0000 3e66 663e 063c
6060 7c66 6666 6600 1800 3818 1818 3c00
1800 3818 1818 1870 6060 666c 786c 6600
3818 1818 1818 3c00 0000 367f 6b6b 6300
0000 7c66 6666 6600 0000 3c66 6666 3c00
0000 7c66 667c 6060 0000 3e66 663e 0607
0000 6c76 6060 6000 0000 3e60 3c06 7c00
3030 7c30 3030 1c00 0000 6666 6666 3e00
0000 6666 663c 1800 0000 636b 6b7f 3600
0000 663c 183c 6600 0000 6666 663e 063c
0000 7e0c 1830 7e00 0c18 1870 1818 0c00
1818 1800 1818 1800 3018 180e 1818 3000
316b 4600 0000 0000 ffff ffff ffff ffff

View File

@ -0,0 +1,449 @@
( GUI Picture )
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|0100
( theme )
#f0f7 .System/r DEO2
#f00e .System/g DEO2
#f00c .System/b DEO2
#0010
DUP2 .Screen/x DEO2
.Screen/y DEO2
;akane20x10 #20 #10 #01 draw-icn
#0100 .Screen/x DEO2
#0028 .Screen/y DEO2
#1010 ;dafu10x10 #0a draw-fast
BRK
@draw-icn ( addr* width height color -- )
#05 .Screen/auto DEO
,&color STR
,&height STR
,&width STR
.Screen/addr DEO2
.Screen/x DEI2
,&x STR2
[ LIT2 00 &height $1 ] SUB
&ver
[ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 00 &width $1 ] SUB
&hor
[ LIT &color $1 ] .Screen/sprite DEO
INC DUP ?&hor
POP
.Screen/y DEI2k #0008 ADD2 ROT DEO2
INC DUP ?&ver
POP
#00 .Screen/auto DEO
JMP2r
( makes use of the auto byte )
@draw-fast ( w h addr* color -- )
,&color STR
.Screen/addr DEO2
SWP #01 SUB #40 SFT #06 ORA .Screen/auto DEO
#00 SWP SUB
&loop
[ LIT2 &color $1 -Screen/sprite ] DEO
INC DUP ?&loop
POP
JMP2r
@akane20x10
0000 0000 0000 0000 2b41 2341 2b41 2341
8881 8081 8880 8080 0a00 2000 8800 2000
8004 2004 8804 2a04 0000 0000 8000 0000
0307 0f0f 0f1f 1f5f ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff fff7 ffff efdf
fbf7 efd7 efdf af5f fffd fbfd fbf5 ebd7
eaf5 ead5 ead5 aa55 ab55 ab55 ab57 ab57
fbf7 ebd7 ebd7 ab57 ffff ffff ffff fbf7
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff fefc
80c0 8000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 2a54 2a54 2a54 2a54
8800 2200 8800 2200 8800 2200 8800 2200
0000 0000 0000 0000 2b41 2341 2b41 2341
8880 8080 8880 a080 8800 2000 8800 2000
8a05 2a05 8f0f 2a15 aa55 aafd ffff aa45
bf7f ff7f ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff fefd ffff ffff ffff be7c
ffff ffff 8a00 0200 befd fafd fe1f 2307
bf5f bf7d bad5 eaf5 ead5 aa55 aa55 aa55
aa55 aa55 aa55 aa55 aa55 aa55 aa55 ab57
af57 af7f ffc5 a307 fbf7 ff9f 1f1f 8f9f
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff fefd faf5 eaff ff5f
0055 aa55 aaff ffff 0055 aa55 aaff ffff
0055 aadf aaff ffff aa55 aad5 aaff ffff
8840 aa77 aaff ffff 8800 aaff aaff ffff
0000 0000 0000 0000 2b41 2341 2b41 2241
8800 a000 8800 a004 8804 2004 8000 2240
8810 0810 a010 2010 0200 0000 0000 0000
bf3f 3f1f 0f07 0303 ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffd7 ab55
faf5 faf5 eaf5 eaf5 f870 e240 8840 8240
8800 2200 8841 233f 8f1f 3f7f ffff ffff
fadd eac1 e2c1 c2c1 aa55 aa55 aa55 aa55
aa55 aa55 aa54 a040 ae54 a854 a855 2f07
8f1f 1f3f bfff ffff 8f87 8f85 8205 2a05
ffdf af5f bf7f bf77 ffff ffff ffff ffff
fefd f8c0 80c0 80c0 aa55 2a15 0a15 0a15
ab55 8000 8000 8000 fe55 0200 0800 2200
aa55 2200 8800 2200 eb77 2a54 2a54 2a54
ff55 2000 8800 2000 ff55 0000 0000 2000
0000 0000 0000 0000 2a41 2241 2b41 2341
8804 a004 8004 a004 0840 aa40 8850 8210
a010 2040 a040 2040 0000 0000 0000 0000
0301 0000 0000 0000 ffff ff7f 7f3f 3b07
ffff ffff ffff ffff ffff ffff ffff ffff
feff fefd fefd fefd aa55 aa55 aa55 aa55
eaf5 fafd fafd fefd 8840 a250 a854 aa54
bf1f 2f07 8800 8055 ffff fefc e800 0a54
8201 2000 8000 8010 aa54 2800 0000 0000
0000 0000 0000 0000 0301 0000 0000 0200
fefc fa70 8801 aa50 8a05 0a05 0201 0303
ef57 af5f af5f bf7f ffff ffff ffff ffff
c0c0 a2c0 8880 a280 0a15 0a15 8a15 0a15
0000 0000 8000 2000 0800 0200 0800 2000
0800 2200 8800 0000 2a54 2a55 2a55 2a57
8800 2000 a0ff ffff 8000 2000 a8ff ffff
0000 0000 0000 0001 ab41 a341 ab5f ffff
8004 a804 8eff ffff 8010 a200 a0c0 e2c1
8040 80c0 80c0 8000 0000 0000 0000 0000
0000 0000 0000 0000 0301 0101 0000 0000
ffff ffff ff7f 1f0f ffff ffff ffff ffff
fefd feff feff ffff aa55 aa55 aa55 aad5
feff feff fe7f fe7f aa54 aa55 aa55 aa54
0000 0000 0000 0000 0000 0000 0000 0000
0800 0000 0000 0000 0000 0000 0000 0000
0000 0001 0205 0a05 8040 2040 e070 e040
0000 0000 0000 0000 0307 0307 0707 0f07
ffff ffff ffff ffff ffff fefc fefc fcfc
8207 3f7f 7f7f 7f7f 8aff ffff ffff ffff
08c0 faf8 fcfc feff 8800 2000 8800 2000
0000 2000 0000 0000 2b57 2f57 2b55 2a54
ffff ffff ffff ffff ffff ffff ffff ffff
0b03 0307 0707 0f1f ffff ffff ffff ffff
ffff ffff ffff ffff e0f1 f9f1 faf3 faf7
8000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0707 0301 0000 0000 ffff ffff ff7f 3f1f
ffff ffff ffff ffff eaf5 fafd feff ffff
fe7d be7f be7d ffff aa54 aa54 aa54 aad5
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0201 0000 0000 0001 e040 0000 0000 0040
0000 0000 0000 0000 0f07 0f07 0f0f 0f1f
ffff ffff fffe fcfc f8f0 c280 0800 2200
be7f 3e15 8a01 2205 ff5f af55 ab55 ab55
feff ffff ffff bf7f 8000 2000 8800 a201
8800 2000 0000 00f7 2854 2854 2854 28f4
ff7f bf57 af5f 2f57 ffff ffff ffff ffff
0f1f 0f07 0707 0707 ffff ffff ffff ffff
ffff ffff fefd faf5 e2c4 8604 8844 a854
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0f03 0100 0000 0000
ffff ff7f 0f07 0a05 ffff ffff ffff ff7f
ffff ffff ffff ffff eaf5 fafd feff ffff
8000 8040 a0d0 e8d4 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0200 0000 0000 0000 8000 0000 0000 0000
0000 0000 0001 0305 0f1f 3f7c f8f0 8201
e8c4 2a11 a840 a200 8800 2200 2005 2000
8215 2e57 2a55 aa55 aa55 aa55 aa55 3a15
fe7c f8f0 e840 a250 0307 2f1f 8f1f 2f0f
ffff ffff ffff ffff f8fc fefc feff fef0
ab57 2b15 0a55 0a01 ffff feff ea55 8040
0301 0005 aa10 0805 ffff ff5f aa05 2000
eaf5 ead5 aa55 aa41 8810 b810 2070 2040
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0204 0a10
0000 0000 a805 2200 0000 0000 0040 2805
0a05 0a10 2a41 a200 af57 a840 8844 0a10
ffff ff7f 8f01 2004 ffff ffff ffff ff7f
aed5 aad5 aad5 aad5 80c0 a85d ab55 aa55
0000 0000 a054 aa55 0000 0000 0000 a055
0000 0000 0000 0045 0000 0071 fa7c faf0
0810 a240 0800 2001 0a04 0254 a850 8200
0800 2200 8800 2200 8800 2200 8804 2a00
8a05 2201 8a01 2001 a8d0 a0c4 8a54 a040
2801 2000 8800 0250 8f01 8240 a011 2211
af55 a040 8051 a815 e0c0 c240 8800 a200
0840 2200 aa10 2214 2a05 2000 8800 2200
8a00 2000 8000 2200 2a00 2200 8800 2200
a214 2301 8000 2210 e040 80c0 6070 2010
0000 0000 0000 0000 0000 0000 0000 0000
0000 0001 0204 0814 2840 a200 8800 2200
8800 2200 8800 2200 8b10 2240 0800 a200
a855 2200 8800 2200 2040 a240 a810 2a04
8810 2200 0845 a800 bf7f 3a11 3805 2301
aa55 aa55 aa55 aa55 aa55 aa55 aa55 aa55
aa55 aa55 aa55 aa55 aa55 aa55 aa75 fa7f
ef75 bb5d bb5f bb5f f8f8 fafc f8fc fcfc
8800 2201 8801 2201 0800 2200 0801 2204
8800 2200 0850 2800 8010 0240 a810 2210
8a01 2000 8800 2200 0800 a200 8800 2240
a840 2200 a800 2200 8801 2a04 8805 2204
8add aa45 8a14 2015 8800 a200 8800 a280
8804 2804 8004 2204 8800 2200 8800 2200
8800 0200 8840 0240 8800 2200 8800 2001
8800 0240 8800 2200 b010 1810 b810 1810
0000 0000 0000 0000 0000 0000 0000 0001
0810 2240 8800 a200 8800 2200 8800 2201
8801 2241 8a00 a204 8800 2200 8800 2200
8800 2200 8800 2200 8a00 2201 8800 2200
8a01 2200 0800 a200 0a05 aa75 aa05 2201
aa55 aa55 aa55 aa55 aa55 aa55 aa55 aa55
aa55 aa55 aa55 aa55 bf7f bf5f af47 8301
bbd7 fbf1 f8fd feff fefc fefc fefe fefe
8801 2241 2a05 2200 0040 8200 8800 0200
0000 a204 a840 2200 0a50 8200 8800 2200
a010 2200 8801 2200 8800 2200 2800 a240
a800 2205 8205 2205 8a04 2254 a855 ab55
3e15 2a75 ead5 aa55 82d5 ea75 aa75 aa75
a85c aa50 a850 aa50 8800 2200 8800 2200
0800 a200 8800 a200 8a01 2000 8801 2001
0800 2200 8800 2200 8810 2810 8814 2804
0000 0000 0000 0000 0204 0004 0810 0210
8800 2200 8800 2200 8801 2001 8801 2200
0804 2a00 0810 a200 8800 2200 8800 2200
8800 2200 8800 2200 8800 2200 8801 2200
0840 0240 a800 a210 8800 2200 8800 2200
2a14 2200 8800 2200 aa00 8040 a804 2200
a800 0000 0000 8050 0000 0000 0000 0001
ff7f 3f1f 3f71 8200 feff feff ffff ff7f
8800 2200 88f0 fafc a804 2200 aa11 0210
8800 2200 0800 a200 8800 2200 8800 2200
8800 2200 8800 2200 0840 2240 a800 221f
8a01 2205 8205 befd a850 a854 a855 a955
ff7f ffdd badd ba5d eaf5 ea75 ea75 ead5
a850 aa50 a850 a250 8800 2a04 8a00 2200
0800 0250 0800 0254 8011 2200 8800 2201
0800 2055 aa55 aad5 8810 2040 a040 a040
0000 0000 0000 0200 2800 2240 0840 0240
8800 2200 8800 2200 8800 2200 8800 2200
8800 2200 8800 2200 8800 2200 8800 2200
8800 2200 8800 2200 8800 2200 8800 2200
0850 2210 881c 2804 8800 2200 8800 2200
8800 2200 8800 2200 8800 2200 8800 2200
8a05 2200 8004 0f1f 0244 a818 9810 b2f0
8800 2200 8800 2200 bf1f 2f1f 8f0f 2f07
feff ffff ffff ffff 0090 e2f0 e0f0 f8fc
8840 2200 a800 2210 8800 2200 8800 2200
8800 2200 8800 2200 9f1f 2f0f 8f07 2305
fefd fefd fefd fefd ab51 aa57 aa57 ae55
ba5d ba55 aa55 aa55 ead5 ead5 aad5 aad5
a857 bf7f ff7f ffff afff ffff ffff ffff
80f5 ffff ffff ffff 8855 faf0 f8f8 f8fd
aad5 aa55 2a55 2a55 a075 aa40 a040 a055
0850 aa01 0201 0055 0840 8240 2800 2270
8800 2200 8800 2200 8800 2200 8800 2200
8800 2200 8800 2200 8800 2200 8800 2200
8800 2200 8800 2200 8800 2200 8800 2200
8a01 2001 8800 2200 8800 a2c0 a850 2834
8800 2200 8800 2200 8800 2200 8800 2200
bf7f ff7f ff7f 7f7f e8f0 e2f0 f0f0 fafc
8800 2200 8800 2200 8f0f 2f1f 9f1f 3f7f
ffff ffff fffd fefd fcfd fef5 aa55 ab57
0050 e0f1 fafd eed5 0874 ae57 af5f be5d
8800 22c0 b85c aa5c 8a04 2200 8800 2200
fe7d 3e3d be1d 2e05 ae55 ae55 ae7d ee5d
ab55 ab55 ab57 aa57 aa55 ab55 ab57 ab57
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff fefc
ead5 eaf5 eaf5 aa15 bf5f bf5f bf5d aa51
feff ffff ff75 aa40 e8f0 eae4 e064 a210
8800 2200 8800 2200 8800 2200 8800 2200
8800 2200 8800 2200 8800 2200 8800 2201
8800 2005 8810 2200 8800 8200 8800 2200
8800 2200 8800 2200 ba14 2a05 8607 2301
0800 2210 0804 a200 8800 2201 8a04 2850
7f7f ff7f 3f1f 3f1f fcfe ffff ffff f8fc
8801 8fff ffff fe7d ffff ffff ebd7 af57
feff ead7 abd5 aa55 ab55 aa55 ab75 faf5
aed7 aa57 fa50 a0c1 be5f fa50 0000 0255
b878 f87c 2f17 aa40 8800 2200 8840 2010
8a05 2a05 0a1d 0a1d ae5d ae5d ae5d ee5d
aa55 ae55 aa5d ba55 af5f ab5f bb77 ab77
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff fefc fefc fefc feff
0a15 0a05 0a05 0255 a850 a850 a850 a854
8040 0000 0800 0814 2211 2010 2010 2210
8800 2200 0800 2200 8800 2200 8800 2200
8800 2200 8800 2200 8a04 2a10 a840 0200
0800 2200 8800 2015 8800 2200 8800 a800
8800 2200 8800 2240 8801 2201 8801 2001
88c0 aad5 aad5 aa55 2000 ba55 aa55 aa57
8f1f af5f afff bf7f fafd fcfc faf5 faff
3a55 0e07 0301 80c0 aa55 eaf5 fbff ff7f
aa55 ab7f ffff ffff fb75 f8f0 e0c0 80c0
8a14 0800 0000 0000 aa00 0000 0000 0000
0004 0201 0001 0001 2010 2040 8880 a001
3e15 2040 e0f4 feff ef55 0000 0000 80d0
fa55 0a15 0a15 0a15 bf77 a347 a347 83c7
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
feff feff ffff aad5 af57 af57 ab57 ab55
ffff ffff ffff aa55 e8f0 e2e0 e8e0 a240
8800 2200 8800 2200 8800 2200 8800 2200
8801 2204 8000 2810 0800 2204 8810 2240
2040 2200 8800 2200 8800 2200 8800 2200
8000 2a04 8a00 2211 8a07 2e0d 8a1d 3a7d
aa55 aa55 aa55 aa55 ae55 af57 ab55 abff
ffff ffff ffff ffff ffff ffff ffff ffff
e0c0 e0f0 f8f0 f8f0 3f1f 0f07 0301 0001
ffff ffff fefe fefc 8000 8000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0001 0001 0000 0000 8303 8343 8343 8343
ffff ffff ffff ffff faff ffff ffff fbf7
bafd ffff bfdf ff5f ef7f ffff af5f af5f
ffff ffff ffff ffff ffff ffff ffff ffff
@dafu10x10
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0001 0000 0000 010f 7fff
0000 002f ffff ffff 0000 00fd ffff ffff
0000 0000 e0fc ffff 0000 0000 0000 00e0
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0107 071f
071f 3fff fffc f3cf ffff f8c7 3fff ffff
e82f fbfb fbfb fbfb 02ff ffff ffff ffff
bf41 feff ffff ffff fcff 1fe3 fcff ffff
00d0 fcff 7fd2 ffff 0000 00c0 f0f8 5efe
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0103 0f1f 3f7e 5f7e f9f3 cf9f 7fff
3f7f ffff ffff ffff ffff ffff ffff ffff
f9fb fbf9 fdf9 fdfd ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff feff fefe
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0001 002f 1f1f 1f1f
e907 ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
fdfd fdfd fcff fd45 ffff ffff ffff ed37
ffff ffff ffff b76c ffff ffff ffff ff0b
ffff ffff ffff ffff fefc fcfc f8fc f8f8
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 1f1f 1f0f 0f07 0703
ffff ffff ffff ffff ffff ffff fffe fdf5
ffff fceb 8fbf 7fff f48b 7fff ffff ffff
bffe fefa f8fc fdff ffff 7f3f 3f7f bfff
ffff ffff ffff ffff f8ff ffff ffff ffff
7fd7 ffff ffff ffff f0f0 f0e0 e0e0 e0e0
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0301 0100 0000 0000
ffff fffc 7d33 3f1f ef9f 7fff ffff ffff
ffff ffff ffff f4cb ffff ffff e807 ffff
ffff ffa0 00c0 0197 ffff 5007 1f03 5eff
ffff a5ff ff6d bfff ffff 4de8 ff7f 6fff
ffff ffbf a7fe fefe f0e0 f0e0 f0e0 b0d0
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
1f0f 0f0f 0f0e 0e12 fefa f5cf bfff ffff
3fff ffff ffff ffff ffff ffff ffff ffff
f8e0 e0c0 e040 c040 7f7f 5f2f 7b1b 0f0f
ffff ffff ffff ffff ffff ffff ffff ffff
ffff fcfd fbf5 f9d4 50f0 f0e0 f0f0 e060
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
1a1a 150f 0d07 1100 7fff ffff fdff ffe1
ffff ffff baff ff55 ffff ffaa fdff fe00
c040 d708 f0eb a800 0fa6 7f2f 3fd0 021a
d7bf fff7 086a b8b0 feff e914 a000 0000
ab20 e078 0000 0000 e0c0 d6e1 4084 0204
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0402 010a 0200 0000 7876 39b0 5078 9018
0892 71a9 2112 1210 aa00 ff01 7692 0000
a01e 3628 8488 4484 a5a0 0000 0080 8000
2003 070d 3815 0260 feff 7b69 9e60 0000
90e0 8080 0000 0000 c004 8020 8890 8888
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0300 0000 0000 0000 2848 8008 4428 0c04
1211 1201 1d14 2a29 1200 0016 dd55 22a9
4084 44ca 8a0d 5800 0000 0800 a02e d105
1000 0000 0080 6a11 0000 0000 0000 8865
0100 0100 0101 005e 2080 2040 4000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0600 0a05 0303 0300
50a0 8040 8000 8000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
ad00 0000 0000 0000 510a 0000 0000 0000
2214 0002 0200 0406 0000 0000 0000 0080
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0021 010f 0407 0812 2e5c de3e
4000 c060 f0f0 f878 0000 0000 0000 0000
0000 0000 0000 0000 0000 502d 0200 157f
0040 a000 0000 e0f8 0000 0000 0000 0000
060f 0f1f 1737 336b a01c e3f0 feff ffff
0000 407a 05c0 f0fc 0000 0000 807c 0300
0000 0000 0000 a05a 0000 0000 0000 0004
0000 0000 0000 030c 0001 0514 53a7 0f3f
265c 5df9 f3e7 c7cf fbfd fbfb fbfb fbfb
7c7e 7fbf bfff bfff 0000 0090 c0e0 f0f8
0101 0101 0001 0020 7fc8 ff1b c6f0 7f78
fc5c ec08 b858 30e0 0108 0001 0103 0707
6b5b dbdf bbbf bb7f ffff ffff ffff ffff
fefe fcfc f9f3 f3f7 6079 fffe fcfc f9f3
0540 823f 7fff ffff d02c 03f8 feff ffff
3040 800e 3f7f ffff 7f7f 7fff 7f7f 7f7f
9fdf 9f9f df9f 9fdf fbfb fbf3 fbfb fbfb
efff fff7 fffd ffff fefe ffff ffff ff7f
0000 80e0 f0fc ffff 1f02 0000 0001 01e1
c000 00a8 b050 590b 0f1f 1e7d 7dff ffff
7f7f ffff ffff ffff ffff ffff ffff ffff
e7ef cfdf 9f3f 7f3f f3e7 efcf dfbf bf3f
ffff ffff ffff ffff fffe fcf8 f0f0 e0c0
ffff ffff ffff ffff bfbf bfbf dfdf dfcf
9fcf 9fcf dfcf dfcf f7fb fbf7 fbfb fbfb
ffff ffff ffff ffff ffd7 f7fd feff ffff
ffff ffff 7f9e e8e0 ffff fff5 8000 0001
4f47 66a4 7056 4b43 fffe 8001 015f ffff
ffbf 1f7f ffff ffff fefe fcfe fdf9 fbfb
7fff feff fefe fcfe 7f7f 7f7f ffff ffff
ffff fffe fefc f8f8 8183 070f 1f3f 3f7f
ffff ffff 7f3f 9f8f efef eff7 f7f7 f7f7
dfcf efdf cfff cfef fbfb fbf9 fdfd fbfc
ffff fffe f4c0 8000 fffc e080 0000 0000
8000 0000 0000 0000 0506 0802 0300 0000
4925 2365 a2b2 1191 ffff ffff ff05 0000
ffff ffff ff7f 0307 fbfb ffff ffff ffff
fcfd fcfe fdfd fdfd ffff ffff ffff ffff
f0e0 e1c3 8387 0f1f ffff ffff ffff fffe

View File

@ -1,121 +0,0 @@
( GUI Proportional font )
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
( variables )
|0000
( program )
|0100
( theme ) #0f9f .System/r DEO2 #0f3f .System/g DEO2 #0f30 .System/b DEO2
#0000 ;draw JSR2
#0001 ;draw JSR2
#0002 ;draw JSR2
BRK
@draw ( extra-spacing* -- )
STH2
;text
&loop
LDAk
DUP #00 EQU ,&end JCN
DUP #0a EQU ,&linefeed JCN
#0005 SFT2 ;font ADD2
DUP2 .Screen/addr DEO2
#09 .Screen/sprite DEO
,get-x-advance JSR .Screen/x DEI2 ADD2 STH2kr ADD2 .Screen/x DEO2
&next
INC2
,&loop JMP
&linefeed
POP
#0000 .Screen/x DEO2
#0008 .Screen/y DEI2 ADD2 STH2kr ADD2 .Screen/y DEO2
,&next JMP
&end
POP POP2 POP2r
JMP2r
@get-x-advance ( font-char-addr* -- advance* )
( Save two 00 bytes for later use )
#0000 SWP2
( First, load the eight bytes that make up the character )
LDA2k SWP2 #0002 ADD2
LDA2k SWP2 #0002 ADD2
LDA2k SWP2 #0002 ADD2
LDA2
( OR all the bytes together, so we know which columns contain filled pixels )
ORA2 ORA2 ORA2 ORA
( Find the lowest set bit (using one of the 00 bytes at the top, but not consuming it) )
SUBk AND
( Convert the nine possible values (00-80) into an offset into the magic table (00-08). )
( They get jumbled up with these two operations, but each possible value remains unique )
#a3 MUL #16 DIV
( Load the byte from the magic table, return a short (consuming/returning the 00 bytes at the top) )
;&magic ADD2 LDA
JMP2r
( The magic table performs the last bit of arithmetic we want:
* the advance in x should be one more than the number of columns with filled pixels,
* with a maximum of 8, and
* a minimum of 3. )
&magic
03 ( lowest set bit is 00, 0 columns wide )
06 ( lowest set bit is 08, 5 columns wide )
05 ( lowest set bit is 10, 4 columns wide )
08 ( lowest set bit is 02, 7 columns wide )
04 ( lowest set bit is 20, 3 columns wide )
03 ( lowest set bit is 80, 1 column wide )
07 ( lowest set bit is 04, 6 columns wide )
08 ( lowest set bit is 01, 8 columns wide )
03 ( lowest set bit is 40, 2 columns wide )
@font ( spectrum-zx font, with each character moved to be flush left in its cell )
[
0000 0000 0000 0000 0000 4800 fc78 0000 0000 4800 7884 0000 0000 d8f8 f870 2000
0020 70f8 f870 2000 0070 70f8 d820 7000 0020 70f8 f820 7000 0000 00c0 c000 0000
00fc 8484 8484 fc00 0000 6090 9060 0000 0030 4884 8448 3000 003c 0c74 9490 6000
0070 88d8 20f8 2000 0030 2020 20e0 e000 007c 4444 44cc cc00 0000 2088 0088 2000
0000 80c0 e0c0 8000 0000 2060 e060 2000 0040 e000 00e0 4000 00a0 a0a0 a000 a000
007c 9494 7414 1400 0018 608c c418 6000 0000 0000 0000 ffff 0040 e000 e040 00e0
0020 70a8 2020 2000 0020 2020 a870 2000 0000 1008 fc08 1000 0000 2040 fc40 2000
0000 8080 fc00 0000 0000 0048 cc48 0000 0000 2070 f800 0000 0000 00f8 7020 0000
0000 0000 0000 0000 0080 8080 8000 8000 00a0 a000 0000 0000 0048 fc48 48fc 4800
0020 78a0 7028 f020 0084 0810 2040 8400 0060 9064 9888 7400 0040 8000 0000 0000
0040 8080 8080 4000 0080 4040 4040 8000 0000 5020 f820 5000 0000 2020 f820 2000
0000 0000 0040 4080 0000 0000 f000 0000 0000 0000 0000 8000 0000 0810 2040 8000
0078 8c94 a4c4 7800 0060 a020 2020 f800 0078 8404 7880 fc00 0078 8438 0484 7800
0010 3050 90fc 1000 00fc 80f8 0484 7800 0078 80f8 8484 7800 00fc 0408 1020 2000
0078 8478 8484 7800 0078 8484 7c04 7800 0000 0080 0000 8000 0000 4000 0040 4080
0000 2040 8040 2000 0000 00f8 00f8 0000 0000 8040 2040 8000 0078 8404 1800 1000
0078 84b4 a884 7800 0030 4884 fc84 8400 00f8 84f8 8484 f800 0078 8480 8084 7800
00f0 8884 8488 f000 00fc 80f8 8080 fc00 007c 8080 f880 8000 0078 8480 9c84 7800
0084 84fc 8484 8400 00f8 2020 2020 f800 0004 0404 8484 7800 0088 90e0 9088 8400
0080 8080 8080 fc00 0084 ccb4 8484 8400 0084 c4a4 948c 8400 0078 8484 8484 7800
00f8 8484 f880 8000 0078 8484 a494 7800 00f8 8484 f888 8400 0078 8078 0484 7800
00fe 1010 1010 1000 0084 8484 8484 7800 0084 8484 8448 3000 0084 8484 b4cc 8400
0084 4830 3048 8400 0082 4428 1010 1000 00fc 0810 2040 fc00 00c0 8080 8080 c000
0080 4020 1008 0400 00c0 4040 4040 c000 0020 5088 0000 0000 0000 0000 0000 fc00
0080 4000 0000 0000 0000 7008 7888 7800 0080 80f0 8888 f000 0000 7880 8080 7800
0008 0878 8888 7800 0000 7088 f080 7800 0060 80e0 8080 8000 0000 7088 8878 0870
0080 80b0 c888 8800 0040 00c0 4040 2000 0010 0010 1010 9060 0080 90a0 c0a0 9000
0080 8080 8080 6000 0000 d0a8 a8a8 a800 0000 b0c8 8888 8800 0000 7088 8888 7000
0000 f088 88f0 8080 0000 7888 8878 080c 0000 b0c0 8080 8000 0000 7080 7008 f000
0040 40f0 4040 3000 0000 8888 8888 7000 0000 8888 5050 2000 0000 88a8 a8a8 5000
0000 8850 2050 8800 0000 8888 8878 0870 0000 f810 2040 f800 0060 4080 8040 6000
0080 8080 8080 8000 00c0 4020 2040 c000 0000 0064 9800 0000 3c42 99a1 a199 423c
]
@text "Are 20 "proportional 20 "fonts 20 "a 20 "good 20 "idea? 0a 0a
"The 20 "jury 20 "is 20 "still 20 "out, 20 "but 20 "one 20 "thing 20 "is 20 "certain: 0a
"it 20 "is 20 "possible 20 "to 20 "print 20 "with 20 "these 20 "fonts 20 "in 20 "Uxn. 0a 0a 0a 00

View File

@ -1,19 +1,8 @@
( GUI Shapes )
%RTN { JMP2r }
%8++ { #0008 ADD2 }
%2** { #10 SFT2 }
%4** { #20 SFT2 }
%2// { #01 SFT2 }
%4// { #02 SFT2 }
%ABS2 { DUP2 #0f SFT2 EQU #05 JCN #0000 SWP2 SUB2 }
%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
%SIZE-TO-RECT {
STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2
} ( x y w h -- x1 y1 x2 y2 )
%WIDTH { #0100 } %HEIGHT { #00a0 }
( devices )
@ -41,24 +30,24 @@
#f03c .System/g DEO2
#f03f .System/b DEO2
( background ) ;checker_icn #03 ;cover-pattern JSR2
( background ) ;checker-icn #03 ;cover-pattern JSR2
.Screen/width DEI2 2// WIDTH 2// SUB2 #0008 ADD2
.Screen/height DEI2 2// HEIGHT 2// SUB2 #0008 ADD2
.Screen/width DEI2 #01 SFT2 WIDTH #01 SFT2 SUB2 #0008 ADD2
.Screen/height DEI2 #01 SFT2 HEIGHT #01 SFT2 SUB2 #0008 ADD2
WIDTH HEIGHT
SIZE-TO-RECT #02 ;fill-rect JSR2
STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2 #02 ;fill-rect JSR2
.Screen/width DEI2 2// WIDTH 2// SUB2
.Screen/height DEI2 2// HEIGHT 2// SUB2
.Screen/width DEI2 #01 SFT2 WIDTH #01 SFT2 SUB2
.Screen/height DEI2 #01 SFT2 HEIGHT #01 SFT2 SUB2
WIDTH HEIGHT
SIZE-TO-RECT #01 ;fill-rect JSR2
STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2 #01 ;fill-rect JSR2
.Screen/width DEI2 2// WIDTH 2// SUB2 #0008 ADD2
.Screen/height DEI2 2// HEIGHT 2// SUB2 #0008 ADD2
.Screen/width DEI2 #01 SFT2 WIDTH #01 SFT2 SUB2 #0008 ADD2
.Screen/height DEI2 #01 SFT2 HEIGHT #01 SFT2 SUB2 #0008 ADD2
WIDTH #0010 SUB2 HEIGHT #0010 SUB2
SIZE-TO-RECT #03 ;line-rect JSR2
STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2 #03 ;line-rect JSR2
.Screen/width DEI2 2// .Screen/height DEI2 2// WIDTH 4// #02 ;draw-circle JSR2
.Screen/width DEI2 #01 SFT2 .Screen/height DEI2 #01 SFT2 WIDTH #02 SFT2 #02 ;draw-circle JSR2
#0010 #0030 #0068 #02 ;line-hor JSR2
#0020 #0058 #0078 #02 ;line-ver JSR2
@ -70,13 +59,13 @@ BRK
( load ) .color STZ #0001 SUB2 .line/y0 STZ2 #0001 SUB2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2
.line/x0 LDZ2 .line/x LDZ2 SUB2 ABS2 .line/dx STZ2
.line/y0 LDZ2 .line/y LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2
#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 2** ADD2 .line/sx STZ2
#ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 2** ADD2 .line/sy STZ2
#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 #10 SFT2 ADD2 .line/sx STZ2
#ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 #10 SFT2 ADD2 .line/sy STZ2
.line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
&loop
.line/x LDZ2 .Screen/x DEO2 .line/y LDZ2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
.line/x LDZ2 .line/x0 LDZ2 EQU2 .line/y LDZ2 .line/y0 LDZ2 EQU2 #0101 EQU2 ,&end JCN
.line/e1 LDZ2 2** .line/e2 STZ2
.line/x LDZ2 .line/x0 LDZ2 EQU2 .line/y LDZ2 .line/y0 LDZ2 EQU2 AND ,&end JCN
.line/e1 LDZ2 #10 SFT2 .line/e2 STZ2
.line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN
.line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
.line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2
@ -89,32 +78,34 @@ BRK
&end
RTN
JMP2r
@line-rect ( x1* y1* x2* y2* color -- )
( load ) STH
STH2k ,&y2 STR2 ,&x2 STR2
STH2k ,&y1 STR2 ,&x1 STR2
STH2r STH2r SWP2
&ver
( save ) DUP2 .Screen/y DEO2
( draw ) ,&x1 LDR2 .Screen/x DEO2 STHkr .Screen/pixel DEO
( draw ) ,&x2 LDR2 .Screen/x DEO2 STHkr .Screen/pixel DEO
( incr ) INC2
OVR2 OVR2 GTS2 ,&ver JCN
POP2 POP2
,&x1 LDR2 ,&x2 LDR2 SWP2
STH
DUP2 ,&ver-y2 STR2 ,&hor-y2 STR2
DUP2 ,&ver-x2 STR2 ,&hor-x2 STR2
DUP2 ,&ver-y1 STR2 ,&hor-y1 STR2
DUP2 ,&ver-x1 STR2 ,&hor-x1 STR2
( horizontal )
[ LIT2 &hor-x2 $2 ] INC2 [ LIT2 &hor-x1 $2 ]
&hor
( save ) DUP2 .Screen/x DEO2
( draw ) ,&y1 LDR2 .Screen/y DEO2 STHkr .Screen/pixel DEO
( draw ) ,&y2 LDR2 .Screen/y DEO2 STHkr .Screen/pixel DEO
( incr ) INC2
OVR2 INC2 OVR2 GTS2 ,&hor JCN
POP2 POP2 POPr
DUP2 .Screen/x DEO2
[ LIT2 &hor-y1 $2 ] .Screen/y DEO2 STHkr .Screen/pixel DEOk
[ LIT2 &hor-y2 $2 ] .Screen/y DEO2 DEO
INC2 GTH2k ,&hor JCN
POP2 POP2
( vertical )
[ LIT2 &ver-y2 $2 ] [ LIT2 &ver-y1 $2 ]
&ver
DUP2 .Screen/y DEO2
[ LIT2 &ver-x1 $2 ] .Screen/x DEO2 STHkr .Screen/pixel DEOk
[ LIT2 &ver-x2 $2 ] .Screen/x DEO2 DEO
INC2 GTH2k ,&ver JCN
POP2 POP2
POPr
RTN
&x1 $2 &y1 $2 &x2 $2 &y2 $2
JMP2r
@fill-rect ( x1* y1* x2* y2* color -- )
@ -133,27 +124,27 @@ RTN
OVR2 OVR2 GTS2 ,&ver JCN
POP2 POP2 POP2 POP2
RTN
JMP2r
&color $1
@draw-circle ( xc yc r color -- )
( load ) .color STZ .circle/r STZ2 .circle/yc STZ2 .circle/xc STZ2
#0000 .circle/x STZ2 .circle/r LDZ2 .circle/y STZ2
.circle/r LDZ2 2** .circle/d STZ2
.circle/r LDZ2 #10 SFT2 .circle/d STZ2
( draw ) ;&seg JSR2
&loop
( incr ) .circle/x LDZ2 INC2 .circle/x STZ2
.circle/d LDZ2 #0001 LTS2 ,&else JCN
( decr ) .circle/y LDZ2 #0001 SUB2 .circle/y STZ2
.circle/x LDZ2 .circle/y LDZ2 SUB2 4** .circle/d LDZ2 ADD2 .circle/d STZ2
.circle/x LDZ2 .circle/y LDZ2 SUB2 #20 SFT2 .circle/d LDZ2 ADD2 .circle/d STZ2
;&end JMP2
&else
.circle/x LDZ2 4** .circle/d LDZ2 ADD2 .circle/d STZ2
.circle/x LDZ2 #20 SFT2 .circle/d LDZ2 ADD2 .circle/d STZ2
&end
( draw ) ;&seg JSR2
.circle/y LDZ2 .circle/x LDZ2 #0001 SUB2 GTS2 ,&loop JCN
RTN
JMP2r
&seg
.circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
.circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
@ -164,7 +155,7 @@ RTN
.circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
.circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
RTN
JMP2r
@cover-pattern ( addr* color -- )
@ -182,7 +173,7 @@ RTN
POP2 POP2
POPr
RTN
JMP2r
@line-hor ( x0* x1* y* color -- )
@ -194,7 +185,7 @@ RTN
INC2 GTH2k ,&loop JCN
POP2 POP2 POPr
RTN
JMP2r
@line-ver ( x* y0* y1* color -- )
@ -206,6 +197,7 @@ RTN
INC2 GTH2k ,&loop JCN
POP2 POP2 POPr
RTN
JMP2r
@checker_icn [ f0f0 f0f0 0f0f 0f0f ]
@checker-icn
f0f0 f0f0 0f0f 0f0f

View File

@ -1,9 +1,4 @@
( gui/terminal )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
( GUI Terminal )
( devices )
@ -24,7 +19,7 @@
( theme )
#0f0f .System/r DEO2
#0ff0 .System/g DEO2
#00ff .System/b DEO2
#0fff .System/b DEO2
( vectors )
;on-button .Controller/vector DEO2
@ -39,22 +34,22 @@ BRK
@on-button ( -> )
.Controller/key DEI
DUP #00 ! ,&no-null JCN
DUP ,&no-null JCN
POP BRK
&no-null
DUP #0d ! ,&no-enter JCN
DUP #0d NEQ ,&no-enter JCN
#00 ;draw-input JSR2
;validate JSR2
;buffer #0080 ;mclr JSR2
#01 ;draw-input JSR2
&no-enter
DUP #08 ! ,&no-backspace JCN
DUP #08 NEQ ,&no-backspace JCN
#00 ;draw-input JSR2
;buffer ;spop JSR2
#01 ;draw-input JSR2
&no-backspace
DUP STHk #1f > STHr #7b < #0101 !! ,&no-valid JCN
;buffer ;slen JSR2 #007f >> ,&no-valid JCN
DUP STHk #1f GTH STHr #7b LTH #0101 NEQ2 ,&no-valid JCN
;buffer ;slen JSR2 #007f GTH2 ,&no-valid JCN
STHk ;buffer STHr ;sput JSR2
#01 ;draw-input JSR2
&no-valid
@ -65,7 +60,7 @@ BRK
@validate ( -- )
#0010 .Screen/x DEO2
.Screen/height DEI2 #0040 -- .Screen/y DEO2
.Screen/height DEI2 #0040 SUB2 .Screen/y DEO2
( clear )
#8000
@ -80,7 +75,7 @@ BRK
LIT 22 #02 ;draw-char JSR2
;buffer #03 ;draw-str JSR2
LIT 22 #02 ;draw-char JSR2
LIT '. #02 ;draw-char JSR2
LIT ". #02 ;draw-char JSR2
JMP2r
@ -88,9 +83,9 @@ JMP2r
STH
#0010 .Screen/x DEO2
.Screen/height DEI2 #0020 -- .Screen/y DEO2
.Screen/height DEI2 #0020 SUB2 .Screen/y DEO2
( marker ) LIT '> #03 ;draw-char JSR2
( marker ) LIT "> #03 ;draw-char JSR2
;buffer STHr ;draw-str JSR2
@ -110,10 +105,10 @@ JMP2r
@draw-char ( char color -- )
SWP
[ #20 - #00 SWP #40 SFT2 ;font ++ ] .Screen/addr DEO2
[ #20 SUB #00 SWP #40 SFT2 ;font ADD2 ] .Screen/addr DEO2
.Screen/sprite DEOk DEO
.Screen/y DEI2 #0010 -- .Screen/y DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
.Screen/y DEI2 #0010 SUB2 .Screen/y DEO2
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
JMP2r
@ -121,13 +116,13 @@ JMP2r
@slen ( str* -- len* )
DUP2 ,scap JSR SWP2 --
DUP2 ,scap JSR SWP2 SUB2
JMP2r
@scap ( str* -- str-end* )
( clamp ) LDAk #00 ! JMP JMP2r
( clamp ) LDAk #00 NEQ JMP JMP2r
&while INC2 LDAk ,&while JCN
JMP2r
@ -140,14 +135,14 @@ JMP2r
@spop ( str* -- )
( clamp ) LDAk #00 ! JMP JMP2r
#00 ROT ROT ,scap JSR #0001 -- STA
( clamp ) LDAk #00 NEQ JMP JMP2r
#00 ROT ROT ,scap JSR #0001 SUB2 STA
JMP2r
@mclr ( addr* len* -- )
OVR2 ++ SWP2
OVR2 ADD2 SWP2
&loop
STH2k #00 STH2r STA
INC2 GTH2k ,&loop JCN

View File

@ -0,0 +1,83 @@
( uxnemu timer.rom )
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller &vector $2 &button $1 &key $1
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
|100
@on-reset ( -> )
;on-control .Controller/vector DEO2
#0080 DUP2 .Screen/width DEO2
.Screen/height DEO2
#f074 DUP2 .System/r DEO2
DUP2 .System/g DEO2
.System/b DEO2
Timer/start BRK
@on-control ( -> )
.Controller/button DEI
( A ) DUP #01 NEQ ?{ Timer/pause }
( B ) DUP #02 NEQ ?{ Timer/start }
POP BRK
(
@|Objects )
@Timer ( * )
&on-frame ( -> )
[ LIT &paused $1 ] ?{
[ LIT2 3c &frame 00 ] INCk ,&frame STR
EQU ?&on-second }
BRK
&on-second ( -> )
[ LIT2 00 _&frame ] STR
[ LIT2 ff &time $1 ] ADD DUP ?{ /end }
,&time STR
/<draw> BRK
&start ( -- )
[ LIT2 0f _&time ] STR
[ LIT2 00 _&paused ] STR
[ LIT2 0f _&frame ] STR
;&on-frame .Screen/vector DEO2
!&<draw>
&pause ( -- )
[ LIT2 00 _&paused ] LDR EQU
( ) INCk <set-dec-color>
,&paused STR
!&<draw>
&end ( -- )
#0000 .Screen/vector DEO2
#06 <set-dec-color>
!&<draw>
&<draw> ( -- )
,&time LDR !<draw-dec>
(
@|drawing )
@<set-dec-color> ( color -- )
;<draw-num>/color STA
JMP2r
@<draw-dec> ( dec -- )
#0010 DUP2 .Screen/x DEO2
.Screen/y DEO2
[ LIT2 01 -Screen/auto ] DEO
DUP
( x0 ) #0a DIV <draw-num>
( 0x ) #0a DIVk MUL SUB
( >> )
@<draw-num> ( num -- )
#00 SWP #30 SFT2 ;numbers-icns ADD2 .Screen/addr DEO2
[ LIT2 &color 01 -Screen/sprite ] DEO
JMP2r
@numbers-icns [
38c6 c6c6 c6c6 c638 8c78 1818 1818 187e
3c4e 860e 1c38 72fe 807e 0c10 7c0e 8e7c
0e1c 1c3c 6cff 0c1e c6f8 40c0 fc0e ce7c
3ac4 c0c0 fcce ce7c 807e 3e0c 1830 60c0
807c cece 7cce ce7c 807c cece 7c18 3060 ]

View File

@ -1,63 +0,0 @@
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
( variables )
|0000
@scroll [ &x $2 &y $2 &wait $1 ]
|0100 ( -> )
#90ff .System/r DEO2 #9000 .System/g DEO2 #900f .System/b DEO2
#08e0 .Screen/width DEI2 #01 SFT2 SUB2 .scroll/x STZ2
#09b0 .scroll/y STZ2
;frame .Screen/vector DEO2
#30 .scroll/wait STZ
BRK
@frame ( -> )
#ffff
&loop
DUP2 ,row JSR
INC2
DUP2 .Screen/height DEI2 LTH2 ,&loop JCN
POP2
.scroll/wait LDZ ,&noscroll JCN
.scroll/y LDZ2 INC2 .scroll/y STZ2
BRK
&noscroll
.scroll/wait LDZ #01 SUB .scroll/wait STZ
BRK
@row ( y* -- )
DUP2 .Screen/y DEO2
.scroll/y LDZ2 ADD2
.Screen/width DEI2
&loop
#0001 SUB2
OVR2 OVR2 .scroll/x LDZ2 ADD2 EOR2 DUP2 #0013 DIV2 #0013 MUL2 SUB2
DUP #00 EQU ,&draw JCN
DUP #05 EQU ,&draw JCN
POP2
&rest
DUP2 ORA ,&loop JCN
POP2 POP2
JMP2r
#15 .Screen/pixel DEO
JMP2r
&draw
OVR2 .Screen/x DEO2
#05 ADD .Screen/pixel DEO
.Screen/y DEI2
DUP2 INC2 .Screen/y DEO2
#00 .Screen/pixel DEO
.Screen/y DEO2
POP
,&rest JMP

BIN
projects/fonts/816.uf1 Normal file

Binary file not shown.

BIN
projects/fonts/cream.uf2 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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