brent_hamel's Recent Forum Activity

  • I'm not sure I understand what how a "TAB" character in the SpriteFont with a custom width would work... It's also the pressing of the Tab key that's the issue... I can already send the ascii byte code for Tab to the binaryData, and when it gets retrieved as Text, it works properly, the issue is that I can't seem to use the Tab key to send that byte data... it works fine if I wire it to a different key

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm definitely using SpriteFonts as opposed to regular text objects. So I do know the dedicated character widths (monospaced fonts are king!)

    I suppose that given that I know the structure of the different types of "lines" that can exist in 6502 code, perhaps attacking at on a line-by-line basic might be best.

    Lines can contain: directives, opcodes, constant labels, address labels, variables, addresses in their various modes, etc, and comments of course. But proper formatting is required for the assembler to work properly, so I can always enforce that directly and have a much more predictable set of possibilities in terms of what each line might look like.

    I'll be implementing an actual blinking cursor at some point as well, plus text highlighting, copy/pasting, etc... So trying to solve the visualizationof these sooner than later I think is key.

    What would be nice, is if there was a way to return an XY position of a token within the spritefont's display box, and then send it over to a tilemap, as masking with a tilemap is something I've done in the past and can work quite well, assuming you know where the character location to mask is.

  • Part of the goal if this editor is to be able to save and load external files that will work and behave correctly inside of other editors as well. Primarily Notepad++.

  • I'm currently using SpriteFonts inside of my own "focused" panel to manually accept the keybaord input, as the keypresses are being directly translated into their ascii byte data sent to a binaryData object, which is then being parsed and displayed by the SpriteFont... I can't say I see anywhere to give an id to SpriteFont, perhaps under the "tags" section?

  • I'm working on a text/code editor for my 6502 Emulator and am looking for a way to be able to colour code elements of text for syntax highlighting and whatnot, but do not want to use BBCode, as it cancels out the use of [], which is something I don't want to do...

    I was thinking of using multiple text object overlaid on top of each other, with each using the "colour" property set to different colours, and then duplicating all the text from the main object, into the coloured ones, and possible replacing all the text that isn't what I want coloured with spaces?

    I'm feeling kinda lost on this one, so any suggestions are welcome...

    Once I have a basic code editor in place, and a simple display output, I'll gladly upload a version of this project for people to play with is they want. It's getting close to being something useable! (Even if only very basic and simple atm)

  • So I'm making a code editor for my 6502 Emulator, and obviously indenting is a big part of keeping code clean and readable... I would like to use TAB for this, as obviously that's the key used in every other text/coding app ever... There must be a way to do that in a C3 app, no?

  • I'm a BIG fan of the SpriteFont plugin btw, and its always my goto for onscreen text, so its nice to see how well it fares compared to other options... That said... its STILL missing 2 super important features imo:

    - the ability to have preloaded or load a different image through events (this would facilitate being able to change fonts on a whim, or even animating them)

    - the ability to change the character set through events (this would help support other lanuages WAY more easily imo)

    I also really wish there was support for HEX values without having to manually convert things to string all the time, as I'm SURE that process slows things down a bunch, as I'm having to do it a TON

    Also... regarding the set/get/toggleBit() functions... if I have a decimal value of 15, which is %1111 in binary, and I try to toggleBit( binNum, 7 ) can I safely expect the new number to be %10001111 (143 in decimal) or will it just do nothing as 15 has no bit7?

    A quick search suggests that JS allows interacting with numbers in Decimal, Binary. Hex AND has a number of bitwise operations it can perform (again please remember that I know next to nothing about JS or other modern languages... so please forgive me if I'm wrong on this) so it seems odd that C3 has left those out of its even system?

    Am I just outgrowing the scope of what the event system was built to facilitate in terms of developers using it? I ask as I really love using the Event Sheet format, but I'm starting to really feel its sluggishness and limitations... (unless I'm just using it poorly, which is also super plausible)

  • I'm starting out with an NES as the version of a 6502 I'm emulating. There are onyl small tweaks here and there to make it run as an Atari 2600, or a Sega Master System (at least in terms of the CPU each uses, as they're all variants of the standard 6502)

    The NES uses 2k or ram, so that's what I've implemented here. My goal is to have built in debugging much like the NES emulator Mesen, thus trying to push what is viewable in realtime... that said, I'm most likely going to move to a page by page view instead of all at once, both for efficiency's sake as well as what I have showing on the screen in general with regards to layout, modules, etc.

    Most 6502 setups generally start their code running at BusAddress $8000, the last 6 bytes of the program are typically reserved as Vector addresses which tell the system where to jump to for NMI, IRQ/BRK, and RESET/POWER ON.

    As far as how the CPU interacts with RAM, the only real caveat is that the Stack is always ranging from addresses $0100 to $01FF, with the pointer decrementing when values are pushed to the Stack, and incrementing when pulled. The Stack pointer always wraps with the page its on. So decrementing beyond $0100 will jump it back to $01FF, etc

    I currently have all the opcodes in place. I have verified (to the best of my ability with the emulator in its current state) all of the legal opcodes and their addressing modes. The illegal ones are in and functional (with the exception of illegal opcodes marked unstable... the CPU will read and execute them, but as far as the emulator is concerned, they're the same as a NOP) but not verified yet.

    I've been having ChatGPT make small 6502 programs for testing (sure is fun having to double check its work all the time lol it gets addressing modes confused regularily), as well as some small programs from a tutorial series on NES programming I purchased from Pikuma.com about a year ago.

    I've done everything in events so far, as I've mentioned not knowing any JS yet... that said, someone kindly posted a JS example in a different post of mine regarding drawing pixels to the Canvas object, and I have modified that enough to generate a noise image at 60fps (when RAM isn't updating) when the emulator is "off" and showing a solid pre-programmed BG color when "on" (none of this is can actually be affected by a 6502 program...YET!)

    For the bitwise operators, I actually built my own DECtoHEX, DECtoBIN, BINtoDEC, BINtoHEX, HEXtoBIN, and HEXtoDEC funations BEFORE realizing there were getbit() setbit() togglebit() already built into C3... So I'm in the process of converting those over. Until now I've been using a lot of tokenat( binString, targetBit, "" ) which I assume is slow given that its dealing with strings and text comparisons.

    I haven't benchmarked anything yet, as I'm still in the "does it all work properly" and the "how can I make what I've got the most effective/efficient" stages... though the goal is to be able to load and run 6502 programs at full speed, including NES roms for this particular iteration.

    One of my project files is a 2D array of the actual instruction layout of the 6502 chip as seen at https://www.masswerk.at/6502/6502_instruction_set.html, so using my HEXtoDEC function, I can:

    - read a Hex byte from the program, and directly reference the Opcode, Addressing Mode, and expected byte count

    - collect the value of the data bytes (either 0, 1 or 2) to send to the Opcode Function

    - execute the Opcode function, which then calls the addressing mode function (this sends back Memory and Address16 values back to the Opcode function), which then completes the operation, which then either sets the program counter manually (such as for Branches, Jumps, Interrupts, etc) or increments it normally through the program.

    * I haven't included the cycle values yet, but its on my TODO list, to try and get it accurate enough for playing games and running programs and having them behave the way they would on real hardware, at least as far as the user experience is concerned.

    I do recognize the need to move probably most if not all of this to JS, I've just zero experience aside form the snippet I'm using for my little display element, and will likely need to either find some really good tutorials (ideally relating to JS in C3 specifically) or see if I can find/make a friend who might help guide me. As prior to Construct apps the only actual programming experience I have is some Visual Basic from the late 90s... I'm better with 6502 than I am with any "modern" languages, in that 6502 is all I've ever tried to learn lol

    And yes... TONS of events... This project is definitely NOT for the free version...

    The eventual goal for this project (assuming I can get the emulator fast enough to run at 60fps during full playback with debugging, etc) is to create a 6502 SDK, which includes:

    - code editor (I've already prototyped this to the point where I will likely start working on it as my next step)

    - emulator for in-app testing/playing/debugging.

    - chr editor (akin to Aseprite as far as making tiles and sprite graphics goes)

    - sound editing (I have actually done a little bit of playing with WebAudio in JS, and between that and the WebMIDI plugin, intend on making a very basic sound and music editor... I've spent years using both Modplug Tracker and FL Studio for all my sound and music production, so replicating those features is a task, but not an unfamiliar one)

    This is intended to only support nrom format intitially. As far as NES stuff goes, mappers and whatnot might be considered later... I think I've got more than enough on my plate with this currently lol

  • I wound up going back to using 2048 separate spriteFont instances and manually hooked up a RamViewerUpdate for each opcode that directly affects either a Ram value, or the Stack Pointer, so while not ideal, I'm now running at 50tps alongside my 256x240 pixel display generating a full screen of random grayscale pixels every tick.

    I don't mind learning to use JS inside of Construct... I've just been finding it incredibly difficult to find reference that seems to work properly or integrate. I'm finding the ways C3 and JS are linked in terms of using scripting to be super unintuitive (alongside simply not knowing any JS to begin with)

    so as it sits right now... any opcode that triggers a direct change to a value in RAM, also calls a viewer update for the instance of SpriteFont that has a variable storing the RAM address its displaying. Its still not really fast enough at 50tps, as eventually I want to be drawing a full display every tick at 60tps and use the webAudio API to replicate my own version of a sound chip... but its closer than it was...

    Next up will likely be the code editor that will allow you to input your own 6502 code, and it'll be runnable

    EDIT: When add an fps counter to my GUI rather than run in debug mode, other than a brief bottlenack when first "powering on" the emulator that I need to explore, it runs pretty dang close to 60tps (I'm assuming the "fps" expression still means ticks rather then the rejigged frames per second that shows 0 if nothing is being redrawn on screen)

  • Is there any kind of "On Value Changed" trigger that one could use with the array plugin, so that I don't have to update all my values, and can only update the ones that are changed when it happens?

  • Unfortunately, after converting to using a single SpriteFont object, and constructing the ram values and formatting through a series of loops (and using some BBCode to highlight specific things) I now have a whopping framerate of 15 ticks per second...

    Surely there must be a way to do this... there are plenty of programs I see that can update as many if not more values at 60tps... is this a case of wrong tool (Construct 3) for the job (6502 Emulator with some basic visual feedback)?

    I can't say I've used an HTML element before, so I'm not quite sure where to start with that, but if it'd be faster than I'll have a look.

    Is there a way to only update a specific part of my text layout? Like say settokenat(string, index, separator) or something similar... I'm starting to feel that there is no solution that will be "fast" enough to be useful

  • Hey all,

    (A quick preface: I've been learning 6502 Assembly, but don't know any higher level languages at all, and have been a Scirra customer since the Construct Classic days. So I feel pretty well versed in the various iterations of Construct, but have no appliable programming knowledge I can use elsewhere aside from logic design.)

    So I'm working on a 6502 emulator in C3 as a fun personal challenge, and I've got everything working properly. My biggest hurdle, is how to monitor the RAM values in realtime to make sure the opcodes and all their addressing modes are behaving the way I'm intending them to.

    Curently, I have 2048 text objects all displaying 2 characters each to represent ram in hex values (boy, do I wish C3 allowed me to work in hex without having to use strings everywhere...). There must be a better way to do this to not have it brutally bog everything down.

    I'm currently doing this all through the event sheets as well, as I'm only JUST starting to feel brave enough to attempt to learn some JavaScript (and JavaScript inside C3 no less).

    I've been able to use a bit of JS to successfully update my display canvas with generated noise when my emulator is "off" and to display a pre-set colour as a BG colour when on. Previous attempts at doing this through events proved way too slow, so I'm wondering if the event sheet system is just inherently way slowly do to the amount of abstraction it adds, and if so... how do I achieve my goal with JS (if events are indeed incapable of keeping up)

    Thanks so much in advance

    - Brent

    PS: The emulator works for all the 6502 mini-programs I've written for it, and some test programs that I've found online. If all goes well, I could turn this into a fantasy console capable of running actual "real" programs. Or maybe convert it into an Apple ][, NES, Atari 2600, or Master System emulator. I really want to believe that a C3 app can achieve this... Am I crazy?

brent_hamel's avatar

brent_hamel

Member since 31 Dec, 2009

None one is following brent_hamel yet!

Trophy Case

  • 14-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies