8bitworkshop - online IDE now supports NES

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

User avatar
Memblers
Site Admin
Posts: 3770
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

8bitworkshop - online IDE now supports NES

Post by Memblers » Tue Aug 20, 2019 9:44 am

I found this to be pretty impressive:
https://8bitworkshop.com/

I first saw it when it supported Atari 2600 only, and now it also supports NES, some (I think 8080-based) arcade hardware, Apple ][, and even custom Verilog machines. I've never seen such an IDE for Verilog before, that provides audio and video output.

Plenty of NES example code is there, in C and assembly.

edit: Project is GPL3, and may be run locally.
https://github.com/sehugg/8bitworkshop

User avatar
slembcke
Posts: 170
Joined: Fri Nov 24, 2017 2:40 pm

Re: 8bitworkshop - online IDE now supports NES

Post by slembcke » Tue Aug 20, 2019 12:40 pm

Wow! I saw this come up in my Twitter or RSS feeds a few days ago and bookmarked it. This is really quite impressive though. Not that it would replace my local setup, but maybe I can get some more local gamedevs interested in retro-dev. :D

User avatar
zeroone
Posts: 929
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: 8bitworkshop - online IDE now supports NES

Post by zeroone » Tue Aug 20, 2019 1:08 pm

That looks really impressive. Is it really possible to develop a game in C? What about the function call stack frame performance hits, etc.? How do you break a C program up into swappable banks? I guess I'm really asking, is this a toy or can you really do something with this?

User avatar
rainwarrior
Posts: 7669
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: 8bitworkshop - online IDE now supports NES

Post by rainwarrior » Tue Aug 20, 2019 1:27 pm

zeroone wrote:Is it really possible to develop a game in C? What about the function call stack frame performance hits, etc.? How do you break a C program up into swappable banks? I guess I'm really asking, is this a toy or can you really do something with this?
This IDE will let you do C or assembly, some of the examples are in C, some aren't. This thing seems to provide the cc65 toolchain which will do either.

Whether you can make a game in C is a different topic/question, but yes you can, and lots of people have at this point. It seems to have used shiru's neslib as a starting point. Banking is possible too.

I'm not really sure how this IDE handles banking... it seems to have a bankswitching example, but doesn't look like it provides access to a CFG file to set it up? There's a "memory map" view which looks kinda like a CFG file but I can't figure out how to edit it. Doesn't seem to have any documentation?

User avatar
NOOPr
Posts: 64
Joined: Tue Feb 27, 2018 10:41 am
Location: Brazil
Contact:

Re: 8bitworkshop - online IDE now supports NES

Post by NOOPr » Tue Aug 20, 2019 3:12 pm

rainwarrior wrote:Doesn't seem to have any documentation?
You have to pay for it: https://www.amazon.com/gp/product/10759 ... e2c322d80a

User avatar
DRW
Posts: 1913
Joined: Sat Sep 07, 2013 2:59 pm

Re: 8bitworkshop - online IDE now supports NES

Post by DRW » Wed Aug 21, 2019 10:57 am

zeroone wrote:Is it really possible to develop a game in C?
Yes it is.
zeroone wrote:What about the function call stack frame performance hits, etc.?
When writing NES games in C, you're better off using only global variables. This way, you don't need to have a stack for parameters and local variables. Otherwise, yes, the performance can suffer immensely.
(You can simulate function calls with parameters by declaring macros, so your code still looks clean.)
zeroone wrote:How do you break a C program up into swappable banks?
In the same way you do this in Assembly. The cc65 compiler lets you put code and data into segments by using #pragma and then code-name, rodata-name, bss-name:
https://cc65.github.io/doc/cc65.html#s7
Available now: My game "City Trouble".
Sales website: https://megacatstudios.com/products/city-trouble
Gameplay: https://youtu.be/Eee0yurkIW4
Download website: http://www.denny-r-walter.de/city.htm

Drag
Posts: 1285
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: 8bitworkshop - online IDE now supports NES

Post by Drag » Wed Aug 21, 2019 7:27 pm

I recognize some of those graphics. ;)

This is wayyyy cool, I remember running across those books on Amazon, definitely interested.

JRoatch
Formerly 43110
Posts: 388
Joined: Wed Feb 05, 2014 7:01 am
Location: us-east
Contact:

Re: 8bitworkshop - online IDE now supports NES

Post by JRoatch » Wed Aug 21, 2019 8:20 pm

I also instantly recognized the font (and the entire order of the chr sheet.)

User avatar
Memblers
Site Admin
Posts: 3770
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: 8bitworkshop - online IDE now supports NES

Post by Memblers » Thu Aug 22, 2019 12:08 am

It looks like the project is GPL3, and can be run locally if needed:
https://github.com/sehugg/8bitworkshop

I've noticed when making changes (in the Verilog compiler at least) if the video starts getting jittery, hitting the start/stop recording button clears it up.

aquasnake
Posts: 40
Joined: Fri Sep 13, 2019 11:22 pm

Re: 8bitworkshop - online IDE now supports NES

Post by aquasnake » Sat Sep 14, 2019 1:37 am

DRW wrote:
zeroone wrote:Is it really possible to develop a game in C?
Yes it is.
zeroone wrote:What about the function call stack frame performance hits, etc.?
When writing NES games in C, you're better off using only global variables. This way, you don't need to have a stack for parameters and local variables. Otherwise, yes, the performance can suffer immensely.
(You can simulate function calls with parameters by declaring macros, so your code still looks clean.)
zeroone wrote:How do you break a C program up into swappable banks?
In the same way you do this in Assembly. The cc65 compiler lets you put code and data into segments by using #pragma and then code-name, rodata-name, bss-name:
https://cc65.github.io/doc/cc65.html#s7
yes, cc65 takes 1 page(256 bytes at least) for running stack to call functions, but i insist on c environment.

aquasnake
Posts: 40
Joined: Fri Sep 13, 2019 11:22 pm

Re: 8bitworkshop - online IDE now supports NES

Post by aquasnake » Sat Sep 14, 2019 4:53 am

also u can define globle ver. in zero-page, and extern them in c file. then u can save the memory. but be careful, cc65 also use zero-page as its own system low-level funcs and bootloader usage. DO NOT ACCESS OVER $60(Hex), in another word, u can use 96 bytes of ram space in zero-page freely

User avatar
rainwarrior
Posts: 7669
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: 8bitworkshop - online IDE now supports NES

Post by rainwarrior » Sat Sep 14, 2019 7:24 pm

aquasnake wrote:cc65 takes 1 page(256 bytes at least) for running stack to call functions
You can set this up to use far less than 256 bytes. 64 bytes is probably more than adequate for most purposes.

Adjusting it for this 8bitworkshop IDE thing might be impossible though, unfortunately.
aquasnake wrote:also u can define globle ver. in zero-page, and extern them in c file. then u can save the memory. but be careful, cc65 also use zero-page as its own system low-level funcs and bootloader usage. DO NOT ACCESS OVER $60(Hex), in another word, u can use 96 bytes of ram space in zero-page freely
The cc65 runtime takes 26 bytes of zeropage. I don't know where you get the number 96 from, because there should be 240 bytes free. On top of this, you should not be using raw hex addresses for your variables. Reserve them in the ZEROPAGE segment, and the linker will ensure they don't overlap with anything else allocated there.

aquasnake
Posts: 40
Joined: Fri Sep 13, 2019 11:22 pm

Re: 8bitworkshop - online IDE now supports NES

Post by aquasnake » Sun Sep 15, 2019 12:24 am

rainwarrior wrote:
aquasnake wrote:cc65 takes 1 page(256 bytes at least) for running stack to call functions
You can set this up to use far less than 256 bytes. 64 bytes is probably more than adequate for most purposes.

Adjusting it for this 8bitworkshop IDE thing might be impossible though, unfortunately.
aquasnake wrote:also u can define globle ver. in zero-page, and extern them in c file. then u can save the memory. but be careful, cc65 also use zero-page as its own system low-level funcs and bootloader usage. DO NOT ACCESS OVER $60(Hex), in another word, u can use 96 bytes of ram space in zero-page freely
The cc65 runtime takes 26 bytes of zeropage. I don't know where you get the number 96 from, because there should be 240 bytes free. On top of this, you should not be using raw hex addresses for your variables. Reserve them in the ZEROPAGE segment, and the linker will ensure they don't overlap with anything else allocated there.
;; FIXME: optimize zeropage usage

SCREEN_PTR = $62 ;2
CRAM_PTR = $64 ;2
CHARCOLOR = $66
BGCOLOR = $67
RVS = $68
CURS_X = $69
CURS_Y = $6a

tickcount = $6b ;2

VBLANK_FLAG = $70

ringbuff = $0200
ringwrite = $71
ringread = $72
ringcount = $73

ppuhi = $74
ppulo = $75
ppuval = $76

screenrows = (30-1)
charsperline = 32
xsize = charsperline

cc65 normally use $62 to $80 for system usage, and they are stored at fixed address.
only below $62 here is safe to use, so i suggest not to over $60. and over $80, there maybe exist other stack

User avatar
rainwarrior
Posts: 7669
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: 8bitworkshop - online IDE now supports NES

Post by rainwarrior » Sun Sep 15, 2019 12:41 am

I strongly recommend that you stop hard-coding addresses and use reservations instead:

Code: Select all

.zeropage
SCREEN_PTR: .res 2
CRAM_PTR: .res 2
CHARCOLOR: .res 1
BGCOLOR: .res 1
RVS: .res 1
CURS_X: .res 1
CURS_Y: .res 1
; etc.
As for what you're doing with $80-$FF I have no idea what you've set up there, but that's not a normal CC65 thing. You are doing something custom that has reserved that, I guess.

User avatar
Memblers
Site Admin
Posts: 3770
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: 8bitworkshop - online IDE now supports NES

Post by Memblers » Sun Sep 15, 2019 2:42 am

rainwarrior wrote: I'm not really sure how this IDE handles banking... it seems to have a bankswitching example, but doesn't look like it provides access to a CFG file to set it up? There's a "memory map" view which looks kinda like a CFG file but I can't figure out how to edit it. Doesn't seem to have any documentation?
I just noticed there's an example that shows how to include a CFG (guess what it's based on):
https://8bitworkshop.com/projects/?n=ne ... 65-example
other projects not listed inside the IDE: https://8bitworkshop.com/projects/

Code: Select all

;; Modified by @sehugg for @8bitworkshop
;; - load example.cfg file
;; - omit crt0 and neslib libs
;;
;#resource "example.cfg"
;#define CFGFILE example.cfg
;#define LIBARGS ,
;; end of special instructions

Post Reply