Jump to content
IGNORED

MADS Knowledge-Base


Recommended Posts

oops, thanks pps I'd forgotten about listing the example with the rc pic for aking, I've had my head in fixing Druid for NTSC this evening.

 

 

 

so... I assume you wanted the text intro before the raster converter picture which can be done like so ..

 

 

;
; Hello screen
;

sdmctl    = $022F

sdlstl    = $0230
sdlsth    = $0231

skctl    = $D20F

color0    = $02C4                ; OS color REGISTERS
color1    = $02C5
color2    = $02C6
color3    = $02C7
color4    = $02C8

;--------------------------------

    org $1800

; Screen data

line1    dta d '      PRESENTING    '
line2    dta d '   the big program  '
line3    dta d '               By (your name)         '
line4    dta d '   PLEASE STAND BY   '

; Display list

dlist    dta $70,$70,$70,$70,$70,$70,$70,$70,$46,a(line1),$70,$70,$70,$70,$47,a(line2),$70,$42,a(line3),$70,$70,$70,$70,$46,a(line4)
    dta $70,$70,$70,$70,$70,$41,a(dlist)

init    nop                ; Switching color registers for nicely colored display
    lda color3
    sta color1
    lda color4
    sta color2

    mva #0 sdmctl            ; Turn Antic off for a moment ...

    mwa #dlist sdlstl        ; ... while we store our new display list's address in the os display pointer

    mva #$22 sdmctl            ; ... so we'll turn antic back on now

_kbd    lda skctl            ; wait for key bounce loop
    and #4
    bne _kbd

    jmp $5800            ; execute the included raster converter image

;-------
    org $2000

    opt h-                ; include the binary file with opt h- to remove the file header
    ins 'AtariForce.xex'
    opt h+

;-------
    ini init
;-------

example.xex

Edited by Tezz
Link to comment
Share on other sites

 

oops, thanks pps I'd forgotten about listing the example with the rc pic for aking, I've had my head in fixing Druid for NTSC this evening.

 

 

 

so... I assume you wanted the text intro before the raster converter picture which can be done like so ..

;
; Hello screen
;

sdmctl    = $022F

sdlstl    = $0230
sdlsth    = $0231

skctl    = $D20F

color0    = $02C4                ; OS color REGISTERS
color1    = $02C5
color2    = $02C6
color3    = $02C7
color4    = $02C8

;--------------------------------

    org $1800

; Screen data

line1    dta d '      PRESENTING    '
line2    dta d '   the big program  '
line3    dta d '               By (your name)         '
line4    dta d '   PLEASE STAND BY   '

; Display list

dlist    dta $70,$70,$70,$70,$70,$70,$70,$70,$46,a(line1),$70,$70,$70,$70,$47,a(line2),$70,$42,a(line3),$70,$70,$70,$70,$46,a(line4)
    dta $70,$70,$70,$70,$70,$41,a(dlist)

init    nop                ; Switching color registers for nicely colored display
    lda color3
    sta color1
    lda color4
    sta color2

    mva #0 sdmctl            ; Turn Antic off for a moment ...

    mwa #dlist sdlstl        ; ... while we store our new display list's address in the os display pointer

    mva #$22 sdmctl            ; ... so we'll turn antic back on now

_kbd    lda skctl            ; wait for key bounce loop
    and #4
    bne _kbd

    jmp $5800            ; execute the included raster converter image

;-------
    org $2000

    opt h-                ; include the binary file with opt h- to remove the file header
    ins 'AtariForce.xex'
    opt h+

;-------
    ini init
;-------

got some errors :?

 

but pps 's rutine assembled both programs without problems

Link to comment
Share on other sites

  • 4 weeks later...

I just tried the cool feature .segment, but it didn´t work as expected (Message: "Value out of Range" for each .endseg)

Until I used the newest version :) So everything is just fine!

 

BTW: I saw the size of the mads.exe in the three last versions and it was 214016 bytes each. Why is it exactly 209 KB?

Link to comment
Share on other sites

Now I ran into a problem with mads: One file of my source code doesn´t compile any more after upgrading to a new version (see above: upgrade needed for .segment)

I striped the problem down to this:


SHEARED_SCROLL = 0

	org $2400
main:
	jmp main
.if SHEARED_SCROLL
ScrollLineOffsetFractAdd_
	.rept 85
	dta <(((#*25*256)/1000 + 64)*2/1)
	.endr
ScrollLineOffsetFixAdd_
	.rept 85
	dta >(((#*25*256)/1000 + 64)*2/1)
	.endr
.else
ScrollLineOffsetFractAdd_
	.rept 85
	dta <(80)
	.endr
ScrollLineOffsetFixAdd_
	.rept 85
	dta >(80)
	.endr
.endif

	
; ----- start address ------------------------------------------	
	run main
 				                  				                 

The MADS console output is

0,stop


with output files of 0-size length

Link to comment
Share on other sites

Now I ran into a problem with mads:

 

Interesting. If you strip it right down to this, it still doesn't compile:


flag = 0

	org $2400

	.if flag
		.rept 85
			.byte 0
		.endr
	.else
		.byte 1
	.endif

Doesn't seem to like REPT in the positive clause of an IF condition. I also noticed empty IF/ELSE clauses cause an error.

Edited by flashjazzcat
Link to comment
Share on other sites

Latest MADS ends with rather ambiguous "0,stop" message and produces no object file when compiling the Ultimate 1MB PBI ROM. Absolutely no clue given to what's causing the problem. Is there a debug mode so I can at least find the offending line of source code?

 

Last one which works (fortunately) is the MADS build in post #93. The one a couple of posts later has a gloss saying that "REPT" has been rewritten, etc... maybe something got screwed up there, but it's hard to know what. Will have to stick with the post #93 version for now.

Edited by flashjazzcat
Link to comment
Share on other sites

Regression with .fl in 1.9.7 build 53: it is no longer able to encode numbers smaller than 1e-10.

 

 

    opt    h-
    org    $2000
    .fl    1e-20
    :10 dta 0

    .fl    1e-15
    :10 dta 0

    .fl    1e-12
    :10 dta 0

    .fl    1e-11
    :10 dta 0

    .fl    1e-10
    :10 dta 0

    .fl    1e-9
    :10 dta 0

    .fl    1e-5
    :10 dta 0

 

1.9.7 build 10:

 

00000000: 36 01 00 00 00 00
00000010: 38 10 00 00 00 00
00000020: 3A 01 00 00 00 00
00000030: 3A 10 00 00 00 00
00000040: 3B 01 00 00 00 00
00000050: 3B 10 00 00 00 00
00000060: 3D 10 00 00 00 00

 

1.9.7 build 53:

 

00000000: 00 00 00 00 00 00
00000010: 00 00 00 00 00 00
00000020: 00 00 00 00 00 00
00000030: 00 00 00 00 00 00
00000040: 3B 01 00 00 00 00
00000050: 3B 10 00 00 00 00
00000060: 3D 10 00 00 00 00
Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

Just stumbled across this one:

 

mva #0 Ds1[0].ReturnCode
This puts $00 into the proper element of struct Ds1.

 

mva #0 Ds1 [0].ReturnCode
However, the second example (note space between struct name and array index) always stores $00 in the first byte of the struct. Edited by flashjazzcat
Link to comment
Share on other sites

Using Mads 1.9.8 B5

 

 

If I do this,

 

.var .byte count=0

LDA enemyData[count].defaultY

 

If I compile the above, I get "ERROR: Constant expression violates subrange bounds"

 

If however, I use

 

LDA enemyData[0].defaultY or LDA enemyData[1].defaultY

 

then it compiles and works.

 

What I do not understand is that previously I have declared

enemyData dta enemyDataStruct [2]

 

As count=0, it isn't out of bounds... but it reports that it is.

 

I guess the problem is due to the compiler knowing that 'count' could be set to a value greater than/equal to 2.

 

How can I refer to a structure which is indexed by a variable?? I don't want to have to write code for each and every enemy, I will have many enemies in my game, which is better represented as an array.

Link to comment
Share on other sites

There are 2 standard approaches for this "object based" access:

 

Assume objects have 4 attribute "a","b","c","d" of size 1 byte each.

 

Approach 1: Column based

 

NUMBER_OF_ENEMIES = 10

 

.local enemies

a .ds NUMBER_OF_ENEMIES

b .ds NUMBER_OF_ENEMIES

c .ds NUMBER_OF_ENEMIES

d .ds NUMBER_OF_ENEMIES

.endl

 

ldx #enemy_id

lda enemies.a,x

..

lda enemies.b,x

..

 

Approach 2: Row based

 

lda #enemy_id

asl

asl

tax

lda enemies.a,x

..

lda enemies.b,x

..

 

 

.local enemies

a = enemies+0

b = enemies+1

c = enemies+2

d = enemies+3

 

.ds NUMBER_OF_ENEMIES*4

.endl

 

the 2nd approach can also be written as structs probably, I'm simply more accustomed to this notation.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
MADS 1.9.8 build 5



The following code crashes.



65 92E2 A5 8E C9 B7 B0 03 + #if .byte PLAYER0X > #GAME_RIGHT_BORDER

66 92F0 A5 C8 C9 03 D0 05 #if .byte ROOM_X = #WORLD_WIDTH-1

67 92F6 C6 8E DEC PLAYER0X

68 92F8 4C 05 93 #else

69 92FB E6 C8 INC ROOM_X

70 92FD A9 01 85 A0 MVA #1 SCREEN_COMPLETE

71 9301 A9 40 LDA #GAME_LEFT_BORDER

72 9303 85 8E STA PLAYER0X

73 9305 #end

74 ;#else ; Leave this else in, even if it does nothing as the game crashes without it

75 9305 #end


The next block of code is the same as the above block of code,except an 'else' has been added. This works fine.


65 92E2 A5 8E C9 B7 90 1A + #if .byte PLAYER0X > #GAME_RIGHT_BORDER

66 92EA A5 C8 C9 03 D0 05 #if .byte ROOM_X = #WORLD_WIDTH-1

67 92F0 C6 8E DEC PLAYER0X

68 92F2 4C FF 92 #else

69 92F5 E6 C8 INC ROOM_X

70 92F7 A9 01 85 A0 MVA #1 SCREEN_COMPLETE

71 92FB A9 40 LDA #GAME_LEFT_BORDER

72 92FD 85 8E STA PLAYER0X

73 92FF #end

74 92FF 4C 02 93 #else ; Leave this else in, even if it does nothing as the game crashes without it

75 9302 #end

Edited by snicklin
Link to comment
Share on other sites

Oops, spoke too soon on the .FL fix -- it is losing significant digits between 10^-3 and 10^-9 (MADS 1.9.8 build 5):

 

 

    48 20F0 3E 12 34 56 79 00           .fl     1.23456789e-3
    49 20F6 00 00 00 00 00 00 +         :10 dta 0
    50
    51 2100 3E 01 23 45 68 00           .fl     1.23456789e-4
    52 2106 00 00 00 00 00 00 +         :10 dta 0
    53
    54 2110 3D 12 34 57 00 00           .fl     1.23456789e-5
    55 2116 00 00 00 00 00 00 +         :10 dta 0
    56
    57 2120 3D 01 23 46 00 00           .fl     1.23456789e-6
    58 2126 00 00 00 00 00 00 +         :10 dta 0
    59
    60 2130 3C 12 35 00 00 00           .fl     1.23456789e-7
    61 2136 00 00 00 00 00 00 +         :10 dta 0
    62
    63 2140 3C 01 23 00 00 00           .fl     1.23456789e-8
    64 2146 00 00 00 00 00 00 +         :10 dta 0
    65
    66 2150 3B 12 00 00 00 00           .fl     1.23456789e-9
    67 2156 00 00 00 00 00 00 +         :10 dta 0
    68
    69 2160 3B 01 00 00 00 00           .fl     1.23456789e-10
    70 2166 00 00 00 00 00 00 +         :10 dta 0
    71
    72 2170 3A 12 34 56 78 90           .fl     1.23456789e-11
    73 2176 00 00 00 00 00 00 +         :10 dta 0
    74
    75 2180 3A 01 23 45 67 89           .fl     1.23456789e-12
    76 2186 00 00 00 00 00 00 +         :10 dta 0
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...