It is currently Fri Oct 19, 2018 10:20 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Thu Oct 04, 2018 1:40 am 
Offline

Joined: Thu Aug 20, 2015 3:09 am
Posts: 411
Oziphantom wrote:
I've been stung by this soooo many times, I got the assembler dev to add a warning to the assembler for me. Never again!

Gilbert wrote:
Yeah. I think missing #s is a very common mistake in 6502 assembly in general, and it's sometimes hard to spot, in which in some cases the stuff still work most of the time(such as what I once encountered in my short demo).

I've been thinking of writing my own assembler, since I can't seem to find one picky enough to stop me doing dumb stuff. Maybe I should start a thread for common bugs I should make it look out for?

Oziphantom wrote:
Code:
{
  int SomeVar = something
  bunch of code here
}

int thing = SomeVar + otherThing.

:shock:

How did that compile. Why did that compile. Who wrote that compiler!?

Bregalad wrote:
I'm glad someone finally agrees with me on this.

Me too! We should start a C-haters club.

I kid. Though in all seriousness, I think the reason it's so popular is that every major OS is written in it. Thus anyone wanting to write code for any popular platform has to deal with it at some level. And anyone who writes an OS in anything else is forced to provide compatibility or fade into obscurity.

I've looked at loads of other programming languages in search of an alternative, but they all have one thing in common: they're not freestanding. They've all got great big libraries full of exception handling, garbage collection and Shinki knows what else that they haul around everywhere. The only people who are interested in freestanding programming languages are the OS devs, and they're all using stuff like C, because everyone uses C for OS development. It's a vicious cycle.

I've been trying to break the cycle - for me at least - by coming up with a freestanding language that's safer/stricter than C, but I'm a self-taught high school dropout. What would I know.


Top
 Profile  
 
PostPosted: Thu Oct 04, 2018 2:03 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 615
Rahsennor wrote:
Oziphantom wrote:
I've been stung by this soooo many times, I got the assembler dev to add a warning to the assembler for me. Never again!

Gilbert wrote:
Yeah. I think missing #s is a very common mistake in 6502 assembly in general, and it's sometimes hard to spot, in which in some cases the stuff still work most of the time(such as what I once encountered in my short demo).

I've been thinking of writing my own assembler, since I can't seem to find one picky enough to stop me doing dumb stuff. Maybe I should start a thread for common bugs I should make it look out for?

http://tass64.sourceforge.net/ see the diagnostic and warning areas at the end
constant result, possibly changeable to 'lda'
could be shorter by using 'xxx' instead
could be simpler by using 'xxx' instead
immediate addressing mode suggested
independent result, possibly changeable to 'lda'
label defined instead of variable multiplication for compatibility
possible jmp ($xxff) bug
possibly redundant as ...
possibly redundant if last 'jsr' is changed to 'jmp'
possibly redundant indexing with a constant value
duplicate definition
shadow definition
symbol is defined in an upper scope as well and is used ambiguously


Rahsennor wrote:
Oziphantom wrote:
Code:
{
  int SomeVar = something
  bunch of code here
}

int thing = SomeVar + otherThing.

:shock:

How did that compile. Why did that compile. Who wrote that compiler!?

I don't know, or that either. NDAs forbid me from saying which compiler, and where we got it from, but lets just say for a very large and popular console.

Rahsennor wrote:
Bregalad wrote:
I'm glad someone finally agrees with me on this.

Me too! We should start a C-haters club.

I kid. Though in all seriousness, I think the reason it's so popular is that every major OS is written in it. Thus anyone wanting to write code for any popular platform has to deal with it at some level. And anyone who writes an OS in anything else is forced to provide compatibility or fade into obscurity.

I've looked at loads of other programming languages in search of an alternative, but they all have one thing in common: they're not freestanding. They've all got great big libraries full of exception handling, garbage collection and Shinki knows what else that they haul around everywhere. The only people who are interested in freestanding programming languages are the OS devs, and they're all using stuff like C, because everyone uses C for OS development. It's a vicious cycle.

I've been trying to break the cycle - for me at least - by coming up with a freestanding language that's safer/stricter than C, but I'm a self-taught high school dropout. What would I know.

Commodore once wrote an OS in BCPL this was not looked on favorably and the switch to ASM and C was a massive improvement loved by all. The thing is you need something like C so you can actually hit a memory location, the higher level languages are great but when you need to do INT 5 they are kind of lost at sea.


Top
 Profile  
 
PostPosted: Thu Oct 04, 2018 3:26 am 
Offline
User avatar

Joined: Fri Jan 24, 2014 9:05 am
Posts: 159
Location: Hungary
It just happens too often that you accidentally end up using zero page memory access instead of an immediate value. Had the 6502 assembly language been originally developed to require you to prefix both immedate values and memory accesses, this kind of mistake would slip through much less often.

Whenever I find an instance of this happening during my debugging process, I get the urge for an ultimate facepalm.


Top
 Profile  
 
PostPosted: Thu Oct 04, 2018 6:43 pm 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 2005
Location: Fukuoka, Japan
@Rahsennor

The reason I like C (to some degree) it that in the dos days, it was a lot of fun to use that and allowed to access the hardware instead of using asm. With Turbo C, you could even add inline asm so it was quite useful. I did use Quick Basic 4.5 or TP 7 but TC was the one I had the most fond memories.

Didn't do any OS programming though. Still, I guess this may be why I like the C syntax. Doesn't mean I like Java though :lol:

@Oziphantom

That's a nasty one :lol: Sometime it's not because it's from a big company that it means there is no bug ^^;;

@Gilbert

Loom.. Fond memory of that too under dos. I remember using that with my new "non continuous read" cd-rom on my 286 with 1 meg of ram!... ^^;;

@za909

I think ca65 had some < to let it know it was some zero page value (many of Shiru's example had that) but it was causing all kind of warning in 2.17 so I just removed them.


Top
 Profile  
 
PostPosted: Fri Oct 05, 2018 2:13 am 
Online

Joined: Tue Oct 06, 2015 10:16 am
Posts: 812
That's one thing turning me off from official console dev. Having to use their (crappy) compiler, in their (crappy) IDE, and most probably on (ewwww) Windows too. I doubt any of them would be amenable to taking a binary from a homebrew toolchain, even if it was compliant with every spec.


Top
 Profile  
 
PostPosted: Fri Oct 05, 2018 2:31 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7548
Location: Chexbres, VD, Switzerland
Quote:
what are you calling its concurrents? B? or Comal?

Quote:
Me too! We should start a C-haters club.
[...]
I've been trying to break the cycle - for me at least - by coming up with a freestanding language that's safer/stricter than C, but I'm a self-taught high school dropout. What would I know.

The direct concurents to C was Pascal, and then Ada (which was itself largely inspired by pascal). Both are stricter and safer.
Higher level languages with automatic memory management are not direct concurrents as they do not have the same purpose.


Top
 Profile  
 
PostPosted: Fri Oct 05, 2018 1:59 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2150
Location: Minneapolis, Minnesota, United States
tokumaru wrote:
I can tell you that I'm way too obsessed about coding mistakes to just roll back and carry on when something seemingly unrelated breaks! Whenever that happens to me, I spend as much time as it takes to figure out *exactly* what went wrong, otherwise something even more sinister may end up happening in the future...


I am the same way. I don't accept not knowing why something works or doesn't work, especially considering that I have direct access to the individual instructions being read by the processor, and can set breakpoints to see the status of registers at basically every moment in time. The chances that the instructions aren't being interpreted by the emulator correctly are extremely slim, so it's a coding mistake almost 100% of the time.

The only time I've used a solution where I didn't understand why it fixed my problem was with a PHP script I was writing for a website. In the script, I called a MySQL routine and tried to then use the same "connection" to execute a MySQL query afterwards. The call to the routine would work, but I kept getting errors right when trying to run the second query. I would remove the call to the routine, and the second query would work. I would replace the call to the routine with another query, and both would work. I could not figure it out, and based on my research, it really looked like I should have been able to do that. My solution was to use two different "connections" to the database (one for the call to the routine, and another for the query), and it started working. I never understood why I had to do that, and it still bothers me today!


Top
 Profile  
 
PostPosted: Fri Oct 05, 2018 9:36 pm 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 2005
Location: Fukuoka, Japan
@Celius

Hey, long time no see :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group