Jump to content

Photo

MADS Knowledge-Base


273 replies to this topic

#251 snicklin OFFLINE  

snicklin

    River Patroller

  • 2,107 posts
  • Location:Australia

Posted Mon Sep 1, 2014 4:55 PM

I've just set up a Facebook group for Atari 8-bit MADS programming if you're interested....

https://www.facebook...12071495526234/



#252 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • Topic Starter
  • 13,662 posts
  • Location:United Kingdom

Posted Tue Sep 2, 2014 4:37 AM

Joined!

#253 snicklin OFFLINE  

snicklin

    River Patroller

  • 2,107 posts
  • Location:Australia

Posted Tue Sep 2, 2014 3:59 PM

There's no content in there yet, so just feel free to put whatever relevant content that you like in. I need to find a balance between there and here, as here should be the main place for storing the information.

 

I know, in there I'll delete all the non-relevant stuff and keep it as a concise repository.



#254 snicklin OFFLINE  

snicklin

    River Patroller

  • 2,107 posts
  • Location:Australia

Posted Tue Sep 2, 2014 4:55 PM

I've now added some content in, i.e. links to other content.

 

The idea is that anyone who is into MADS can go to one place and gather lots of joined up information about MADS development.

 

Any waffle / non-relevant content I will delete, so that people don't have to sift through stuff to find what they want. This thread here serves a good purpose in that it allows people to communicate more, but the FB page is more for people who want to go somewhere and gather information.

 

Please feel free to add content and short code samples. Anything longer than say 10 or 15 lines should be linked to instead.



#255 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • Topic Starter
  • 13,662 posts
  • Location:United Kingdom

Posted Fri Oct 31, 2014 3:30 PM

When source code becomes sufficiently large and complex (c. 22,000 lines) and / or contains NMB instructions / requires several passes / has lots of local ranges (not really sure what the trigger is), any missing label error results in "The compiler process ended with return code 2", and an aborted attempt at dumping the error to the console (the output is cut off half way through the line, resulting in WUDSN being unable to parse it).

The issue appears confined to nonexistent label errors, which are nevertheless fairly common in huge projects. In the exact same source code, I tried "STM $600" when no macro called "STM" exists, and the proper error message (Users/Jon/Documents/workspace/A8GUI/branches/GUI Cart/guilib.s (794) ERROR: Undeclared macro STM (BANK=1)) was produced.

#256 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • Topic Starter
  • 13,662 posts
  • Location:United Kingdom

Posted Sat Nov 1, 2014 4:11 AM

Update: this appears to be related to code optimisation (-v option) in the free Pascal compiler under OS X 10.6.8 with XCode 4.2. Usually I compile with:

fpc -Mdelphi -v mads.pas

However, the following seems to fix the issue:

fpc -Mdelphi mads.pas

#257 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • Topic Starter
  • 13,662 posts
  • Location:United Kingdom

Posted Mon Jan 12, 2015 9:28 AM

Bug in relocatable file format:

WindowData	.struct
	Status			.byte	; (0=closed, 1=normal, 2=maximized, 3=minimized, +128=open window centered [will be always reset after opening])
	flags			.byte	; [bit0]=display 8x8 pixel application icon (in the upper left edge)
					; [bit1]=window is resizeable
					; [bit2]=display close button
					; [bit3]=display tool bar (below the menu bar)
					; [bit4]=display title bar
					; [bit5]=display info bar (below the title bar)
					; [bit6]=display status bar (at the bittom of the window)
					; [bit7]=internal - set to 0 before opening for the first time
	attributes		.byte	; [bit0]=adjust x size of the window content to the x size of the window
					; [bit1]=adjust y size of the window content to the y size of the window
					; [bit2]=Window will not be displayed in the task bar
					; [bit3]=Window is not moveable
					; [bit4]=Window is a super window: other windows, who point on it (see byte 51), can't get the focus position
					; [bit5]=*reserved* (set to 0)
					; [bit6]=Window has a horizontal scroll bar
					; [bit7]=Window has a vertical scroll bar
	Appearance		.byte	; [bit0]=Drop Shadow Border
					; [bit1]=Double Border
	ProcessID		.byte	; Process ID of the window's owner
	x			.word	; x position, if window is not maximized
	y			.word	; y position, if window is not maximized
	Width			.word	; width, if window is not maximized
	Height			.word	; height, if window is not maximized
	ClientX			.word
	ClientY			.word
	ClientWidth		.word
	ClientHeight		.word
	WorkXOffs		.word	; x offset of the displayed window content
	WorkYOffs		.word	; y offset of the displayed window content
	WorkWidth		.word	; width of the total window content
	WorkHeight		.word	; height of the total window content
	MinWidth		.word	; minimal possible width of the window
	MinHeight		.word	; minimal possible height of the window
	MaxWidth		.word	; maximum possible width of the window
	MaxHeight		.word 	; maximum possible height of the window
	RectList		.byte	; first node of window's rectangle list
	Title			.word	; address of the title line text (terminated by 0)
	Info			.word	; address of the info line text (terminated by 0)
	WinContent		.word 	; address of the CONTROL GROUP DATA RECORD for the window content
	.ends


Window0	dta WindowData [0] (0, 0, \ ; Status, Flags
			WindowAttributes.Desktop, 0, 0, 0, 14, 320, 186, \	; attrib, style, process ID, x, y, width, height
			0, 0, 320, 186, \ ; client x, y, width, height
			0, 0, 320, 186, 320, 186, 320, 186, 0, \	; workxoffs, workyoffs, workwidth, workheight, minwidth, minheight, maxwidth, maxheight, appicon
			0, 0, DesktopControlList)

The last struct member in "Window0" is a WORD, but the relocation table references only the LSB in the type "B" relocation table (highlighted below):

 

Capture.PNG

 

The WORD in question has offset $0488, but as you can see it's referenced only in the byte list. Needless to say, this is causes the relocating loader to fail and the program to crash. Working around this bug will require me to completely abandon STRUCTS in my project...


Edited by flashjazzcat, Mon Jan 12, 2015 9:35 AM.


#258 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • Topic Starter
  • 13,662 posts
  • Location:United Kingdom

Posted Tue Jan 13, 2015 7:01 PM

Many thanks to Tebe for quick fix of the above issue. Testing now. :)



#259 JAC! OFFLINE  

JAC!

    Stargunner

  • 1,700 posts
  • Always looking for GFX and MSX for my demos
  • Location:Lebach, Germany

Posted Thu Feb 5, 2015 4:36 PM

Its there a native way of setting the byte used in fill mode (OPT F+)?

It defaults to $FF which is fine in most cases, but I'd need $00.
Of course I can play around with align/rept to do this, but maybe there's a simpler way.



#260 tebe OFFLINE  

tebe

    Dragonstomper

  • 738 posts
  • Location:Poland

Posted Fri Feb 6, 2015 12:16 PM

.align expression, fill_value



#261 JAC! OFFLINE  

JAC!

    Stargunner

  • 1,700 posts
  • Always looking for GFX and MSX for my demos
  • Location:Lebach, Germany

Posted Fri Feb 6, 2015 5:52 PM

Yes, I first thought that would not work. But as long as "expression" evaluates to a value (=absolute address) greater than the current PC/"*", it should work.



#262 JAC! OFFLINE  

JAC!

    Stargunner

  • 1,700 posts
  • Always looking for GFX and MSX for my demos
  • Location:Lebach, Germany

Posted Sat Feb 21, 2015 5:12 AM

Hi tebe, the attached source compiles with return code 2 and no error/warning message in the build 2014-06-22. With older versions I correctly get "Undeclared label L3F96 (BANK=0)"

 

 

Attached Files



#263 tebe OFFLINE  

tebe

    Dragonstomper

  • 738 posts
  • Location:Poland

Posted Wed Mar 4, 2015 1:54 PM

l38b5 sta l3f96
D:\!Delphi\mads\test\HyperE-COM.asm (182) ERROR: Undeclared label L3F96 (BANK=0)
stx l3f9b
D:\!Delphi\mads\test\HyperE-COM.asm (183) ERROR: Undeclared label L3F9B (BANK=0)

Attached Files



#264 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • Topic Starter
  • 13,662 posts
  • Location:United Kingdom

Posted Sun May 31, 2015 9:33 AM

Wondering why this doesn't compile correctly:
 

LastBank	.macro
	.align $DFD8
	LJSRCode
	.align $e000,$ff
	.ifdef Incognito
	.rept 4096
	.byte $FF
	.endr
	.endif
	.endm
	
	
LJSRCode	.macro ; call with address of routine-1 in x,a and bank in y (note only the processor status is preserved on return)
	jsr Exec
	php		; target's RTS comes here
	dec BankSp
	ldx BankSp
	lda BankStack,x
	sta BANK ; activate bank
	plp
    	rts
Exec
	pha ; save address
	txa
	pha
	sty BANK ; activate bank
	tya
	inc BankSp
	ldx BankSp ; save bank # on stack
	sta BankStack,x
	rts		; jumps to target
	.endm

The ".align" pseudo-op immediately after the nested call to "LJSRCode" doesn't execute. I tested nested macro calls elsewhere and they do work, but perhaps there's something about the specific context here preventing it from working?

 

EDIT: Actually, getting rid of the nested call and replacing it with literal code doesn't help. And I notice that neither of the .align pseudo-ops work if there's a macro call or any code between them. Puzzling.

 

Aha... turns out that .align N without the optional fill parameter doesn't output any bytes at all even when the assembler's in fill mode. Changing it to ".align $DFD8,$FF" fixed it. :)


Edited by flashjazzcat, Sun May 31, 2015 9:52 AM.


#265 ascrnet OFFLINE  

ascrnet

    Chopper Commander

  • 162 posts
  • Location:Santiago, Chile

Posted Thu Jun 4, 2015 7:54 PM

Hi all,
 
Mads compile on Ubuntu 14.04, but I have doubts with messages saying when compiling:

ascrnet@ascrnet-Inspiron-3443:~/A8/Mads$ fpc -Mdelphi -vh -O3 mads.pas
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling mads.pas
mads.pas(20,2) Note: APPTYPE is not supported by the target OS
mads.pas(1044,5) Note: Local variable "i" is assigned but never used
mads.pas(9360,26) Hint: Local variable "par" does not seem to be initialized
mads.pas(9836,27) Hint: Local variable "par" does not seem to be initialized
Linking mads
/usr/bin/ld.bfd: aviso: link.res contiene secciones de salida. ¿Olvidó -T?
14997 lines compiled, 0.4 sec 
4 hint(s) issued
2 note(s) issued

this good or I have to add some parameter in the compilation?

regards



#266 tebe OFFLINE  

tebe

    Dragonstomper

  • 738 posts
  • Location:Poland

Posted Thu Jun 4, 2015 11:46 PM

it's good



#267 ascrnet OFFLINE  

ascrnet

    Chopper Commander

  • 162 posts
  • Location:Santiago, Chile

Posted Sat Jun 6, 2015 1:49 PM

it's good

 

ahhhh ok, thanks :-D



#268 1NG OFFLINE  

1NG

    Chopper Commander

  • 150 posts
  • Location:Lübeck, Germany

Posted Wed Jul 15, 2015 3:06 PM

First, many thanks for the Mads Assembler! Great tool!

 

In my actual code I have

	mva #255 TextMessageStatus
StillScrolling
	dec hpos
	lda hpos
	and #3
	
	sta HSCROL

This compiles to

2EF7: A9 FF             LDA #$FF
2EF9: 8D 2A B4          STA TEXTMESSAGESTATUS
2EFC: 00 29     STILLSCROLLING BRK #$29
2EFE: B4 AD             LDY $AD,X
2F00: 29 B4             AND #$B4
2F02: 29 03             AND #$03
2F04: 8D 04 D4          STA HSCROL

B429 HPOS
B42A TEXTMESSAGESTATUS

The DEC looks faulty with its $00 instead of $CE
Debugging with source in Altirra was strange :-) Looking at the disassembly showed the problem of course.



#269 1NG OFFLINE  

1NG

    Chopper Commander

  • 150 posts
  • Location:Lübeck, Germany

Posted Wed Jul 15, 2015 3:13 PM

And I have another question: I want to have a list of entries and their high/low bytes

hightable   dta h(label1, label2, label3, label4, label5)
lowtable    dta l(label1, label2, label3, label4, label5)

label1 ins "data\file1.dat"
label2 ins "data\file2a.dat"
label3 ins "data\file3x.dat"
label4 ins "data\file4.dat"
label5 ins "data\file5.dat"

This is the way I do it now. But this is some work if I want to insert something between label3 and label4 (or have to use label3b)

Is there a way to use .rept or something?

 

Thank you!



#270 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • Topic Starter
  • 13,662 posts
  • Location:United Kingdom

Posted Thu Jul 16, 2015 5:50 AM

Are you sure your code isn't doing a rogue write of 0 to $2EFC some place?
  • 1NG likes this

#271 1NG OFFLINE  

1NG

    Chopper Commander

  • 150 posts
  • Location:Lübeck, Germany

Posted Thu Jul 16, 2015 12:04 PM

Are you sure your code isn't doing a rogue write of 0 to $2EFC some place?

No :)  The error is alway 30 cm in front of the screen.

The new code works, but I wondered if that was the problem, so I used the repository and got the old source out again. And with the wonderful Altirra command

ba w 2200 L1000 

I was able to check my code. And it wrote a zero to the location! Nasty bug. :-o

(I wasn't able to get the ba command running with a hexadecimal length of F00. How is the syntax for that?)

 

Thank you for the help! :thumbsup:



#272 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • Topic Starter
  • 13,662 posts
  • Location:United Kingdom

Posted Thu Jul 16, 2015 12:12 PM

(I wasn't able to get the ba command running with a hexadecimal length of F00. How is the syntax for that?)


You mean watch for a write across a whole page?

I use:

bx "write >= $200 and write <= $2FF"

#273 1NG OFFLINE  

1NG

    Chopper Commander

  • 150 posts
  • Location:Lübeck, Germany

Posted Thu Jul 16, 2015 12:18 PM

You mean watch for a write across a whole page?

I use:

bx "write >= $200 and write <= $2FF"

Very nice workaround!



#274 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • Topic Starter
  • 13,662 posts
  • Location:United Kingdom

Posted Wed Dec 14, 2016 2:37 PM

Feature request. MADS already allows a custom header in standard binaries (via ORG), but how about allowing custom headers in the native (not SDX) relocatable format? Since there isn't a main/extended segment type in the relocatable file format, I need some other way of flagging to my loader/linker that a segment should be relocated into main memory or into an extended bank. For that matter, some other information in the header (stack/proc pointers) isn't used by my loader and is just skipped. Obviously I can hack the header in a hex editor, but it would be useful to change it at compile time somehow (or even just define bits of the CONFIG or UNUSED byte).


Edited by flashjazzcat, Wed Dec 14, 2016 2:38 PM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users