AtariAge Forums: AtariAge Forums -> DanBoris' Tech Blog

Jump to content

Subscribe to DanBoris' Tech Blog        RSS Feed

Procedure Calls 1

Let's take a break from looking at Action! math and take a look at procedure calls. We will start up with something that is trivially simple:

Proc test()ReturnProc main()   Test()Return



0E61: 4C 64 0E    JMP  $0E64      0E64: 60          RTS        0E65: 4C 68 0E    JMP  $0E68      0E68: 20 61 0E    JSR  $0E61      0E6B: 60          RTS     


Our main procedure starts at 0E68 and it begins with a call to procedure Test using a JSR. The procedure Test starts at 0E61 which immediately jumps to the RTS since the procedure is empty. What I haven’t been able to figure out is why the JMP instruction is there since it doesn’t jump over anything. I have yet to find a case where it actually jumps over something.

Next let’s look at how simple parameter passing is done:

Proc test(byte I)ReturnProc main()Test(1)Return



...

CARD Math Part 2

In my last post I showed how the Action! compiler produces some pretty optimized code for CARD math under certain circumstances. This time I will show the more general case which should be pretty familiar to anyone who has done 6502 programming.

Here is the Action! program and it’s dis-assembly:

CARD IPROC MAIN()I=2I=I+2RETURN


0E6C: .BYTE 00,000E6E: 4C 71 0E    JMP  $0E71      ;I=20E71: A0 00       LDY  #$00     0E73: 8C 6D 0E    STY  $0E6D      0E76: A9 02       LDA  #$02     0E78: 8D 6C 0E    STA  $0E6C    ;I=I+2  0E7B: 18          CLC        0E7C: AD 6C 0E    LDA  $0E6C      0E7F: 69 02       ADC  #$02     0E81: 8D 6C 0E    STA  $0E6C      0E84: AD 6D 0E    LDA  $0E6D      0E87: 69 00       ADC  #$00     0E89: 8D 6D 0E    STA  $0E6D      0E8C: 60          RTS         


Most of what is here we have discussed before so I won’t go into great detail. As you can see since I is initialized to the value 2 the INY...

CARD Math Part 1

I can’t believe it’s been over a year since my last blog post, time sure does fly! I thought it was about time to get back to some posts and continue my Action! language topic.

Last time I talked about BYTE math, this time we will start looking at CARDinal math. In Action the CARD data type is a two byte unsigned value. Here is the first piece of Action! code:

CARD IPROC MAIN()I=1I=I+1RETURN


Here is the resulting disassembly:

0E6A: .BYTE #$00,#$000E6C: 4C 6F 0E    JMP  $0E6F      0E6F: A0 00       LDY  #$00     0E71: 8C 6B 0E    STY  $0E6B      0E74: C8          INY        0E75: 8C 6A 0E    STY  $0E6A      0E78: EE 6A 0E    INC  $0E6A      0E7B: D0 03       BNE  $0E80      0E7D: EE 6B 0E    INC  $0E6B   


We start at memory location $E6A where two bytes are set aside for variable I, and then as usual we have a JMP to that start of the code.

The next four instructions assign the value 1 to I and you can see a...

7800 Sprites

One of the trickier parts of the 7800’s MARIA graphics chip is understanding how to setup the display lists and display list list (DL and DLL). Even trying to put a single sprite on the screen can be tricky. In this article I will explain how to setup these data structures to get a simple sprite on the screen.

In this example we will take a very narrow scenario just to explain the basics of how to get a sprite on the screen. I will show how to display a single 16 line high by 1 byte wide sprite. If you want to see complete code on how to do this take a look at my 7800 Sprite Demo source code. For more details on the DLL and DL structure see the 7800 Software Guide. Both these files are available on my site http://www.atarihq.c...anb/a7800.shtml.

The first step is to setup the Display List List (DLL). Since we will be using 16 line high sprites the zones will also be 16 lines high, so this will give us 12 zones for a total of 192 lines. The first byte of each DLL entry will be...

Action!: Byte Math

Next let’s look at some simple byte variable manipulation. Here is the first sample Action program:

BYTE IPROC MAIN()I=1I=I+2RETURN


And the assembly code

24B3: .byte $0024B4: JMP  $24B7	  24B7: LDY  #$01	 24B9: STY  $24B3	  24BC: CLC		24BD: LDA  $24B3	  24C0: ADC  #$02	 24C2: STA  $24B3	  24C5: RTS
...
  • (8 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »

July 2010

S M T W T F S
    123
45678910
11121314151617
18192021222324
252627282930 31

Recent Entries

Recent Comments