Search found 16 matches

by Movax12
Wed Sep 10, 2014 1:06 am
Forum: Programming
Topic: Need help with a loop that has 16 bit counter
Replies: 19
Views: 3334

Re: Need help with a loop that has 16 bit counter

What's wrong with #240 ?..
Oops.
Well this code was based off of just clearing the nametable with a single value..
This change should fix it:


; replace symbol names with your names..
; PPU_NAMETABLEADDRESS - where you want to write
; p - your pointer
; myData - data you want to write
; PPU ...
by Movax12
Tue Sep 09, 2014 6:04 pm
Forum: Programming
Topic: Need help with a loop that has 16 bit counter
Replies: 19
Views: 3334

Re: Need help with a loop that has 16 bit counter

You can directly INC or DEC a memory location without using a register.

Replace:

LDA pointerLo
CLC
ADC #$01
STA pointerLo


with:


INC pointerlo


But anyway, here is a suggested way of doing things that is simple.. if you make sure your data is a multiple of 4 bytes (4 bytes of data, 8 ...
by Movax12
Tue Sep 02, 2014 8:10 am
Forum: Programming
Topic: Do registers really make code easier to write?
Replies: 14
Views: 2149

Re: Do registers really make code easier to write?

I use a macro that I named 'mb' (Move Byte). It can output the correct code to move a byte from one location to to another:


; move from one memory location to another, use A by default:
mb foo := bar
; move using .X:
mb x, foo := bar


You can probably guess why code is output. Also, it can ...
by Movax12
Sat Aug 23, 2014 4:49 am
Forum: Programming
Topic: Functions in assembly
Replies: 39
Views: 10175

Re: Functions in assembly

That code should work. Be aware, however that if the macro is used inside a different scope than the destination label, the parameter 'address' might not be resolved to what you expect. I think this may be the problem.
by Movax12
Thu Aug 21, 2014 6:24 pm
Forum: Programming
Topic: Functions in assembly
Replies: 39
Views: 10175

Re: Functions in assembly

An example of what I have working in ca65 (the macro language is quite powerful once you really get the hang of it..):
Needs a bit of polishing, but works well as is.

In the 'header' file: (this file would have to be included in both the library, and the main source (like in C) )

declarefunc ...
by Movax12
Sun Jun 22, 2014 7:58 pm
Forum: Programming
Topic: Anti piracy block help
Replies: 12
Views: 1445

Re: Anti piracy block help

It would be a challenge to some that understand basic hardware and how to flash a ROM and build a cart. Some people that have the ability to do that don't know how to debug software. But anyone who has the ability and motivation will be able to figure out any software based anti-copy protection.
by Movax12
Mon Nov 04, 2013 5:18 pm
Forum: Programming
Topic: High level macros
Replies: 10
Views: 1758

Re: High level macros

Hi,

It may need some polish, but I updated the documentation on the wiki for ca65hl:

https://www.assembla.com/spaces/ca65hl/wiki
by Movax12
Mon Oct 28, 2013 11:52 pm
Forum: Programming
Topic: what assembler is this?
Replies: 1
Views: 519

Re: what assembler is this?

by Movax12
Wed Oct 23, 2013 2:20 am
Forum: Programming
Topic: High level macros
Replies: 10
Views: 1758

Re: High level macros

FOR added to the devel branch: https://www.assembla.com/code/ca65hl/git/nodes/devel

I changed how it works from the first example I posted.

1)C-style of loop:
for ( <thing to do 1st>, <Flag to test - continue while true >, <stuff to do at end of loop> )

Example:


for ( x := #$3, not negative ...
by Movax12
Wed Oct 16, 2013 4:51 pm
Forum: Programming
Topic: High level macros
Replies: 10
Views: 1758

Re: High level macros

Implemented FOR; devel branch on assembla will be updated in the next few days.

http://i.imgur.com/KkUbyEA.png
by Movax12
Mon Oct 14, 2013 4:03 pm
Forum: Programming
Topic: High level macros
Replies: 10
Views: 1758

Re: High level macros

My macros now feature support for parentheses in expressions! Although I am confident everything is working I would consider this untested, beta code.

https://www.assembla.com/code/ca65hl/git/nodes/devel

Following the same rules as the previous version, you can test 'expressions' that represent or ...
by Movax12
Tue Oct 01, 2013 10:36 pm
Forum: Programming
Topic: A sensible macro engine
Replies: 42
Views: 13058

Re: A sensible macro engine

White Flame, or anyone, please could you give a useful example showing why a recursive macro would be worth having?
Thanks
Ed

A ca65 macro that allows one to enter a line (no length limit) of data as space seperated hex values (as in a hex editor).
Untested.
Example:


hex 01 03 a0 ba 23 43 fe ...
by Movax12
Sat Sep 14, 2013 8:45 pm
Forum: Programming
Topic: High level macros
Replies: 10
Views: 1758

Re: High level macros

I'm glad to see the interest in this growing!
:)
It also chooses which instructions to use based on whether a branch distance is outside the -128 to +127 range (which would be a really big program structure, but it can happen, especially with a CASE statement).
ca65 will stop with an error if a ...
by Movax12
Sat Sep 14, 2013 3:33 pm
Forum: Programming
Topic: High level macros
Replies: 10
Views: 1758

High level macros

Hi,

I'd like to let everyone here know about the macros I have been working on for high-level like coding with the 6502. My target is NES, so no 65c02 or better features are targeted. Maybe in the future they will be.

I've been working on and using these macros for some time. I use them often and ...
by Movax12
Wed Aug 07, 2013 1:08 am
Forum: Programming
Topic: Getting Memory of variable
Replies: 8
Views: 1884

Re: Getting Memory of variable

With ca65.

Hello world for a commodore PET

[...]
Msg: .byte "Hello, World!", CR, 0

; display the value if Msg in hex..
.out .sprintf("Address of Msg:%04X", Msg)



If you don't want to refer to debug info. EDIT: Actually this probably won't work since the address won't be known until link. :(