Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

This is fun!


I was looking at the sync function recommended in the Programming Techniques doc. It seems to me that you want to set the delay timer before running the main loop (aka after doing the busy wait), so that the speed will be consistent regardless of the time taken by the rest of the code.
code:
: sync
    loop
        v0 := delay
        if v0 != 0 then
    again
    v0 := 2
    delay := v0
;

Adbot
ADBOT LOVES YOU

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Because this runs so slow, I think the time the main game code takes to execute will almost always be significant.

I also came up with this debug version that turns on the buzzer if the game code runs over-time:
code:
: sync
    v0 := delay
    v1 := 4
    if v0 == 0 then buzzer := v1
    loop
        v0 := delay
        if v0 != 0 then
    again
    delay := v1
;
The buzzer always goes off on the first call, unless you init the delay timer to be non-zero at startup.

taqueso fucked around with this message at 20:33 on May 17, 2014

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Very nice, especially tabs in the editor! Any chance of getting the ability to define named numeric constants?

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Thank you, that is a big improvement in DRY. I was wishing for register aliasing last night, too!

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Lime posted:

code:
i := board i += va load v0
I've been putting multiple statements on one line, too. I've been using double spaces to separate them, which seems to be just enough visual whitespace.
code:
i := board  i += va  load v0

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

That looks pretty awesome IJ. I have 1/2 of a game in the works, but I haven't been able to spend time on it in awhile. Hopefully I can try the new debugging tools out soon.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Tann posted:

I made a game called civiliz8n click here to play



I'm pretty happy with it so far, I might expand on it a bit by improving the art/adding a splash screen/high score board?

Anyway, play my game and make a game for octojam folks!

This looks cool, will give it a play when I get home.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Is there a benchmark function for Octo to find out how many instructions/sec or /frame it can do on a certain PC?

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Internet Janitor posted:

Not presently. Are you volunteering to write 2DMark '77?

OK, sure. :)

I was thinking of approaching it from the other direction -- that is, running a program and counting cycles in the emulator. But this was fun to make. I am not certain this is error free by any means, but it gets numbers close to what I calculate. I edited the octo cycles/frame dropdown and it works at 100000 but not 1000000.







https://johnearnest.github.io/Octo/index.html?gist=08bbd489f8f6c5bc317a2f68a1a3b378
https://github.com/jdeeny/chipmark77

I suppose that .08 is a bug.

taqueso fucked around with this message at 03:05 on Jun 13, 2016

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Mastigophoran posted:

I tried this on a few devices, a samsung s2, an iPad mini 4 and running from 1 to 6 instances on my laptop, all report 60.08kOps - is this technique working as expected?

If the emulator is running at 1000 cycles/frame then it should report 60 kOPS. 1000 cycles/frame * 60 frames/sec = 60000 cycles/sec = 60k cycles/sec. It is only interesting if you can run the emulator without any cycle delay.

taqueso fucked around with this message at 00:36 on Jun 13, 2016

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Dr. Stab posted:

I saw this thread was bumped so I had to make a program.

Like all good programs, it's a modified version of the sample person program



http://johnearnest.github.io/Octo/index.html?gist=6a3642baee4a53f8c6b2484eaa0fd3df

WASD - move cursor
V - draw
C - erase
1 2 3 - choose brush
Z X - choose layer

Your sample picture doesn't do this justice. Nice job.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

proof of concept:

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Here are some multiply routines I wrote, maybe they will be useful to someone else.


https://johnearnest.github.io/Octo/index.html?gist=3a3020a531951c5964ebc5741a172596
https://github.com/jdeeny/chip8-multiply

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:


Now with 16-bit multiply:

https://johnearnest.github.io/Octo/index.html?gist=ee560a92af35eed00cc74aa5dfca94cd

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Centripetal Horse posted:

Please tell me this is going to be Scorched Earth: CHIP-8 Edition.
Yeah, that was the idea.


Mastigophoran posted:

So, uuhhhhh, think I ought to link you to one of the submissions for octojam II: http://octojam.com/octojam-ii/games/t8nks

That is indeed pretty nice, really polished.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Mastigophoran posted:

Aw man, hope that I didn't just rain on your parade. IIRC both T8nks and Octopeg (the latter of which I made) only support at most a single pixel of movement per projectile per frame, so, they kinda each have their limitations which could be overcome with a more focussed development.

First off, Octopeg is really, really good. The motion of the ball feels 'right'. I want it to have some audio, then it would be pretty much perfect and could have been a hit game in 1982. Way better than Popcorn!.* I need to check out the octopeg source more later.

I hadn't really looked through the jam site before now, there is a lot of cool projects there. I did look at the t8nks source a bit and my trajectory method seems to be more physics based than their what-works-nicely-in-8bit method. I will admit that when I saw their intro graphic I was a bit dejected because it looks drat good and so much better than my programmer art.

No worries about raining on anything, I just thought that a projectile game would be somewhat hard to make and satisfyingly challenging. I still haven't gotten things to work out nicely without overflows and keeping the precision I want (you can see the jitter in the sample gif).

* I just realized I've only played Popcorn! on a black and white TV. I didn't know it had color.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

I'm solving equations approximating a projectile's trajectory (like you would use in high-school physics class) for x and y each frame and incrementing a fixed-point time value.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

I was wondering if anyone had determined the execution time for CHIP-8 instructions on the COSMAC VIP. I couldn't find that, but I realized I could count instructions* in the ROM to find out. I stumbled upon this annotated disassembly of the ROM and figured I should post it:

http://laurencescotford.co.uk/wp-content/uploads/2013/08/CHIP-8-Interpreter-Disassembly.pdf

Could also be used to decide on the 'correct' behavior for instructions with quirks.

* It would require counting cycles, some RCA 1802 operations take longer than others.

taqueso fucked around with this message at 17:37 on Jul 14, 2016

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Fiduciary posted:

Very nice, and interesting approach.

I was working on a set of 16 bit operations for Octo some time last year. but I never got so far as any kind of visual demonstration. But who, really, needs a good excuse to write basic math and logic operators in assembly?


Anyway, here it is http://johnearnest.github.io/Octo/index.html?gist=56ab7aa02a1633e095d736d324605a34

Very nice job. Your implementation is quite a bit faster than mine (293 cycles vs 568 cycles). I just tried inlining the 4-bit shifts in my version and got it down to 473 cycles. I considered doing shift-add but my intuition was telling me it would be slower.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Internet Janitor posted:

interpreter in the wild today supports this feature, but there's one problem- on the HP it's not a hex font, it's just 0-9:
Crazy. I wonder why they would have only included 0-9? Seems impossible for the author to not know the original Chip8 font has 16 entries.

quote:

In summary, for best compatibility with SCHIP 1.1:
  • Avoid using bighex characters greater than 9.
  • Do not produce ROMs which use the last byte of RAM. (Reading and writing it during execution is fine.)
  • Do not allow i to increment past 0xFFF.

Thank you, that is nice to know.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Is octojam3 going to have a theme?

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:


I hacked out a little tool that turns true-type fonts into octo code. Designed around proportional fonts with varying widths. There are a bunch of things that could be done to this, but it does mostly what I need for the moment, though I expect to want > 8x8px at some point. Feel free to make improvements. :)

It would be nice if Octo supported ASCII character literals.

Test it out at: http://johnearnest.github.io/Octo/index.html?gist=7d2d9f3301a1e8d13d85b5b10af50e1e
Code at: https://github.com/jdeeny/octofont/tree/master





Also, cool to see OctoJam stayed on the HN front page all day

taqueso fucked around with this message at 07:09 on Oct 2, 2016

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Yep, using ASCII is definitely inefficient, but I wanted to keep use of the font simple because I don't provide any tools to encode strings. ASCII will be especially inefficient if the font converter gets support for sparse glyph tables (currently the table has empty glyphs wasting space). After sleeping on it, I think a decent solution is to have the font converter output constant definitions for each character that is included in the font.

: my_string 3, CH_H, CH_I, CH_EXCLAMATION
is fairly reasonable to edit and not too far from
: my_string 3, 'H', 'I', '!'

My imagined Octo character literal support didn't include string literals, I figured that could be handled in an application specific manner.

e: If octo did have ASCII string support, the font converter could include an ASCII->font-specific-encoding function in the output. It would rewrite the strings in place with the custom character encoding. It would only need to be run at startup.

taqueso fucked around with this message at 19:41 on Oct 2, 2016

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Tann posted:

I just realised I should post this here!

Working on a basic platformer to see if I can get it feeling nice. Had a bug in the collision code which was pretty funny.



Except for the flying into space part, the platforms popping up seems like it could be a gameplay element.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Awesome work Mastigophoran!



I wanted a PRNG so I could save state and 'replay' earlier sequences of numbers, so I implemented a 64-bit LFSR based PRNG:
https://github.com/jdeeny/octo-lfsr64

I'm sure this could be better, I would love comments or tips on improving the quality of the output. It does OK with ENT but it doesn't pass everything from CAcert's test

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Dr. Stab posted:

I'm having a bit of a problem with audio sync.

http://johnearnest.github.io/Octo/index.html?gist=e5626b6bfc50473d98ff8d13824e0419

For me, this stays in sync as long as it never lags or pauses. If I wait 1 minute, then pause, a whole bunch of sound will play while it is paused. It seems like as long as sound is continuous, the time at which I tell a sound to play and the time at which it actually gets played drift further and further apart as more sounds are queued to play.

What do you mean by pause? Hitting 'I'? The buffer will be played out even if your code doesn't run to put more stuff in it. At least for me on chrome, it is only playing a little bit more, not a bunch. You are doing better on the audio than I ever did while messing around. I couldn't seem to get things to sync right to play the next buffer-full without hiccuping.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Tann posted:

Been working with a friend and we're getting somewhere with level generation now!



Keep jamming everyone! And there's plenty of time to start now if you haven't already.

Looks like it is coming along nicely! Are the levels being generated from hand-made elements?

Mine is starting to take shape too. If anyone wants to help with sprites, PM me, that would be wonderful.


I added a profiling feature to Octo a couple days ago, so now you can hit 'P' to see what parts of the program are running the most.

It currently groups instructions based on the label, but it doesn't combine groups if there is a gap between them. That mostly happens with if statements that are always false. I feel like I should change it so those are combined as well. Thoughts?

taqueso fucked around with this message at 16:04 on Oct 13, 2016

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Tann posted:

Yeah, it stitches together chunks based on entry/exit point!
The effect is really nice, it feels like the whole level was hand drawn as one piece.

Tann posted:

Looking good, it's almost a shame to see you use extra colours because otherwise you can run it on original hardware!
Nah, it is using xo-chip extensions all over, plus it is more than 4k so I need i to be 16-bit. What it needs is more color, I just haven't gotten around to it yet :)

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Here is what I've been working on for Octojam - https://johnearnest.github.io/Octo/index.html?gist=a2466cd36cae59f8870bfe2ef9ab2661 I'm starting to feel crunched for time and thought I'd post it and get some feedback or maybe find someone that wants to help.

I wanted to make something really large (in chip8 terms) and this is already up to 9kB. It is supposed to be a roguelike, but it doesn't yet have any monsters to fight, so right now it is just a 16-level 64x64 tile find-the-stairs 'adventure'. QWEADZXC move around, S activates stairs. F overlays a debug map on the screen. Stair travel currently teleports you to the first down stair in the new level, instead of moving you to the appropriate matching stairs. The minimap is not yet retained when you return to a level. The hex number displayed is just debugging for in-game time. That area of the screen will eventually hold the text event log ("You hit the rat."). You can use the debug map to help find the stairs, and to show that the levels are the same when you return to them.

If anyone wants to write some code, make sprites, or really anything else at all, let me know and I'll make the github public. The octo source is created by combining several smaller modules, some that are generated by python scripts, so you don't need to edit this as a single huge file. The share link above is hacked to run at 10k cycles/frame, so it will run 10x slower in the final version (that means level load times of around a minute). There are lots of places where the code could be improved, so hopefully it will end up a little better than that.

Off the top of my head, a couple things that could be improved to make level gen faster:
  • The LFSR I posted earlier didn't have good enough output, so I changed the program to advance state several times between random numbers. The LFSR could be changed to use taps chosen for minimal correlation rather than just simply maximum period. Or it could be replaced with xoroshiro128+ or similar.
  • The code that finds the unreachable areas could be combined with the code that turns generic walls into specific walls based on the surrounding walls. The code from those functions that checks what is in the surrounding tiles could be improved with multi-byte loads.

taqueso fucked around with this message at 04:09 on Oct 20, 2016

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Buffis posted:

I added the game to the octojam page and added a cover image.
Everything looks alright at the edit screen, but nothing seems to work in the submissions list.
http://www.awfuljams.com/octojam-iii/games

Maybe worth looking at?

Probably just the issues with github/dns today, the submissions worked OK when I looked a couple days ago. Wish I could check out your submission, but no github for me right now.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

I just glanced at this the other day and didn't notice you posted more than a gif. Great idea, and the code is surprisingly short. It seems to let you connect to the middle of a piece, but I imagine it would be difficult to stop that without making it quite a bit slower.

taqueso fucked around with this message at 05:18 on Oct 28, 2016

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

I realized that you could just keep everything on an 8x8 grid to avoid connecting to the middle of a piece. And rotation could be added if you put all four orientations in the sprite table and keep them 32-byte aligned so they can be conveniently masked.

I noticed you use vX += -1 in your code. For some reason I didn't think that was possible and I've been using vX += 255 in everything I've been writing.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Buffis posted:

I think I'm pretty done with my entry this year.
There's a few minor tweaks that I may end up doing, but overall, this should be done now.

I present:

Binding of COSMAC: Octoberth
https://johnearnest.github.io/Octo/index.html?gist=d3d2ecb2f0ac2075f636e7d3ec60e786

WASD to move. F to shoot.

Sortof a very simplified Isaac demake for SCHIP. Wont run on any hardware or anything (needs to run at 1000 cycles), but plays pretty alright.

42 screens across three floors with an exciting boss battle at the end!

Gonna make a more thorough tech writeup at some point as well, but there's honestly nothing insane going on or anything.

The section starting at ": room" is where the levels are stored. There's 42 levels that are 6 bytes each. Two of these bytes needs to be reset each time the game is restarted, so these get copied over the title screen on game startup, so that restoring is possible.

Pretty happy that I managed to squeeze quit a lot of stuff in there. A big 300b or so title screen, semidecent animations for ending and death. Hats, scorekeeping, multiple floors, a continue system (restart on current floor), and a bunch of other small things.

It's probably still possible to get this maybe 200b smaller or so and squeeze in more stuff, but at this point I'm feeling pretty OK with the game as is.

Try it out, and report any bugs found!

Finally got around to trying this out. It works really well and the player movement feels good. I managed to get through one locked door and I was feeling pretty good about that until I saw that their are 40 or so rooms in the game.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

I got so much crap done in the last two days but it still isn't quite complete.
http://johnearnest.github.io/Octo/index.html?gist=2481036c7a85b4b9c9b7a7612ca36901

It loads in the background now, but it makes keypress response nasty while it is happening.



secret hacked fast version shhh

taqueso fucked around with this message at 08:15 on Nov 1, 2016

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Nice IJ. I immediately wondered how the macro system would handle use of labels inside the macro. It works but I had to pass in a unique label so I could instantiate the macro more than once. Would you be interested in a PR that adds a unique counter to the end of labels inside macros that are used more than once?

code:
# Memory address is in registers addrhi and addrlo, which must be an adjacent register pair
# Data will be loaded from that address into registers deststart through destend
:macro indirect-load addrhi addrlo deststart destend label {
	i := label
	save addrhi - addrlo
	0xF0 0x00 
	: label
	0x00 0x00
	load deststart - destend
}

: main
# Load v0-v3 with data from 0x400
v5 := 0x04    v6 := 0x00
indirect-load v5 v6 v0 v3 label1
:breakpoint first

# Reverse load v1-v0 with data from 0x403
v5 := 0x04    v6 := 0x03
indirect-load v5 v6 v1 v0 label2
:breakpoint theend

:org 0x400
0x10 0x20 0x30 0x40 0x50
e: those compile time calculations are going to make a lot of stuff easier to program without resorting to external tools

taqueso fucked around with this message at 17:32 on Aug 14, 2017

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Is it possible to concatenate two tokens?

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

It's all good, you can Octojam from anywhere in the world that has internet.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Internet Janitor posted:

I've been thinking about this. Might be worth adding a :suffix for such a purpose.
First, I have to say the new metaprogramming features are really great. I feel a lot more productive. A big feature of macros I didn't appreciate at first is flexibility. With a function, the ABI is fixed, but you can use any registers you want in a macro, assuming you pass them in as parameters.

An example of concatenation being useful: I have been making some macros for 16-bit math, and I would really like to be able to use MACRO_ADD_U16 v01 v23 and have it turn v01 (etc) into v01-hi and v01-lo, which I would define as aliases for v0 and v1. Currently, I invoke the macro as MACRO_ADD_U16 v0 v1 v2 v3 which works but is more cumbersome and error prone. I tried making a macro that defined v01 as { v0 v1 }, but octo doesn't seem to like to expand macros that are parameters.

Another thing I've been wishing for is a way to conditionally compile, something like :if { expression-evaluating-to-zero-or-nonzero } { <octo commands here> }. I have some macros I want to disable when not debugging, so I make two definitions, one with an empty body, and only define the one I want. It would be nice if that could happen to a bunch of macros with a single :const change.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

It's October :spooky:

Adbot
ADBOT LOVES YOU

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Octojam livestream is happening now: http://twitch.tv/awfuljams

  • Locked thread