Jump to content
IGNORED

MADS Knowledge-Base


Recommended Posts

tim(), .time etc. this functionality will have a limited range of applications

universal solution:

For /f "tokens=1-4 delims=/-" %%a in ("%DATE%") do (
    SET YYYY=%%a
    SET MM=%%b
    SET DD=%%c
)

For /f "tokens=1-4 delims=/:.," %%a in ("%TIME%") do (
    SET HH24=%%a
    SET MI=%%b
    SET SS=%%c
    SET FF=%%d
)

mads.exe time.asm -pl -d:year=%YYYY% -d:month=%MM% -d:day=%DD% -d:hour=%HH24% -d:minute=%MI% -d:second=%SS%

http://stackoverflow.com/questions/1192476/windows-batch-script-format-date-and-time

http://stackoverflow.com/questions/4248220/how-can-i-retrieve-the-seconds-part-of-time-in-cmd

time_date.zip

Edited by tebe
  • Like 1
Link to comment
Share on other sites

Having an excellent cross-platform tool like MADS and then forcing poeple to use platform specific batch scripts really brings me down. Every C compiler offers __DATE__ and __TIME__... :-(

Edited by JAC!
  • Like 3
Link to comment
Share on other sites

  • 3 weeks later...

 

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

float .FL fixed (line 9033: if x<1e-2)

 

line 777: pass_max = 20

 

.rept bug fixed

 

.rept 4
/* lda #0
*/ nop
.endr

mads_02.02.2014.zip

Link to comment
Share on other sites

Is there a way to find out the length of the file imported to an array using ".GET"? I wand to do

 

MAIN.ASM

.GET "TEXT.TXT"

ICL "INCLUDE.ASM"

 

INCLUDE.ASM

.SAV // Store the file content here, but .SAV has the length as mandatory parameter

Link to comment
Share on other sites

There is something about the the behaviour of .zpvar and .var that puzzles me:
.zpvar does not need an address at the end, but .var does. Is this correct behaviour?
see code below. The line ".var c1 .byte" throws an error:

pagezero_start	=	$a0
.zpvar	a	.byte = pagezero_start
.zpvar	b,c	.byte
.zpvar	d	:10	.byte
.zpvar	e	.byte	; this all works...

highmem_start	=	$ec00
.var	a1,b1	.byte	= highmem_start
.var	c1	.byte	; ...but this line gives an error: "varstest.asm (11) ERROR: Variable address out of range"

	ORG 4096
	RUN start_main
start_main
	nop
Link to comment
Share on other sites

Is there a way to find out the length of the file imported to an array using ".GET"? I wand to do

 

MAIN.ASM

.GET "TEXT.TXT"

ICL "INCLUDE.ASM"

 

INCLUDE.ASM

.SAV // Store the file content here, but .SAV has the length as mandatory parameter

 

.filesize 'filename'

.filesize('filename')

.len 'filename'

.len('filename')

  • Like 1
Link to comment
Share on other sites

 

There is something about the the behaviour of .zpvar and .var that puzzles me:

.zpvar does not need an address at the end, but .var does. Is this correct behaviour?

see code below. The line ".var c1 .byte" throws an error:

pagezero_start	=	$a0
.zpvar	a	.byte = pagezero_start
.zpvar	b,c	.byte
.zpvar	d	:10	.byte
.zpvar	e	.byte	; this all works...

highmem_start	=	$ec00
.var	a1,b1	.byte	= highmem_start
.var	c1	.byte	; ...but this line gives an error: "varstest.asm (11) ERROR: Variable address out of range"

	ORG 4096
	RUN start_main
start_main
	nop

its correct

 

.zpvar = expression

 

.var is different, stored data if detected ORG, .ENDP, .ENDL

.local temp
.var a,b,c .word
 
 nop
.endl             ; -> stored A,B,C (word)
org $ec00
.var a1,b1 .byte = $8000
.var c1 .byte
 
; a1,b1 - > $8000
; c1 -> $ec00

in your example, ORG is missing, undefined adress

 

you need segment (.var not working with segment, probably bug)

.segdef high_mem, $ec00, $100,rw
 
org $8000
 
.segment high_mem
a1 .byte
b1 .byte
c1 .byte
.endseg
 
nop
nop
 
.segment high_mem
d .word
e .word
.endseg
 
nop
nop
Edited by tebe
Link to comment
Share on other sites

Hello tebe,

you need segment (.var not working with segment, probably bug)


Segment is not quite what I need, it also writes the segment to the obx file (which is not needed). The output of mads -l:

     1                 .segdef highmem, $ec00, 512, rw
     2
     3                     ORG 2048
     4                 .segment highmem
     5 FFFF> EC00-EDFF> 00 00 + a1    :256    .byte
     6 ED00 00 00 00 00 00 00 + a2    :256    .byte
     7 EE00            .endseg

I only want the addresses of the labels, so I found a workaround using struct:

.struct highmem_struct
    pm_0    :256    .byte
    pm_1    :256    .byte
    pm_2    :256    .byte
    pm_3    :256    .byte
.ends

.var    highmem    highmem_struct    =    $f000
Link to comment
Share on other sites

Hello,

 

I have a problem with simple code dealing with byte variables. Instead of byte values assigned in i, j and n byte variables the program shows word values for the first two variables. I tried also with dta b, dta l and dta h... but it didn't work either. Please tell me where in the code is the problem, thanks!

 

MADS program

============

 

org $3200
main
.var i, j, n .byte
mva #20 i
mva #50 j
mva #120 n
jsr printf
.by $9b 'i = %' $9b 0
dta a(i)
jsr printf
.by $9b 'j = '
dta c'%',$9b,0
dta a(j)
jsr printf
.by $9b 'n = %' $9b $9b 0
dta a(n)
jmp *
.link 'libraries/stdio/lib/printf.obx'
run main
Output
======
i = 12820
j = 30770
n = 120

 

vars.obx

vars.asm

post-7301-0-57458200-1392404658_thumb.png

Link to comment
Share on other sites

another question...

 

when I am using .macro

 

and want to do something like this

 

.macro calc

lda :1

sta :2

.endm

 

reference

 

calc buffer,output

 

I got an illegal adressing mode error while compiling?

Depends how you're calling it. This may be relevant if you require immediate addressing:

ldax .macro	" "	; load a,x pair
	.if :1 = '#'
		lda #< :2
		ldx #> :2
	.else
		lda :2
		ldx :2+1
	.endif
	.endm

Also this:

 

http://atariage.com/forums/topic/192375-mads-macrosprocedures/?do=findComment&comment=2907500

Edited by flashjazzcat
Link to comment
Share on other sites

ok... can someone explain why this not work?

What are the parenthesis for? What's "+#" supposed to do? If you call it with simply ":10 calc buffer", will it not work?

 

EDIT: Answer to that is - yes it will compile as ":10 calc buffer", but I don't know whether it compiles into the code you expect it to produce.

Edited by flashjazzcat
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...