tebe Posted January 14, 2014 Share Posted January 14, 2014 (edited) 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 January 14, 2014 by tebe 1 Quote Link to comment Share on other sites More sharing options...
+JAC! Posted January 15, 2014 Share Posted January 15, 2014 (edited) 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 January 15, 2014 by JAC! 3 Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted January 15, 2014 Author Share Posted January 15, 2014 It'll be easier to just manually edit the source, after all that. Now: I wonder how multiple native relocatable segments are coming, so I can finally make some decisions about GUI executables and linking loader? Quote Link to comment Share on other sites More sharing options...
tebe Posted February 2, 2014 Share Posted February 2, 2014 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 Quote Link to comment Share on other sites More sharing options...
+JAC! Posted February 7, 2014 Share Posted February 7, 2014 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 Quote Link to comment Share on other sites More sharing options...
+tzeb Posted February 9, 2014 Share Posted February 9, 2014 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 Quote Link to comment Share on other sites More sharing options...
tebe Posted February 9, 2014 Share Posted February 9, 2014 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') 1 Quote Link to comment Share on other sites More sharing options...
tebe Posted February 9, 2014 Share Posted February 9, 2014 (edited) 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 February 9, 2014 by tebe Quote Link to comment Share on other sites More sharing options...
+tzeb Posted February 10, 2014 Share Posted February 10, 2014 tebe, thanks for your explanation. I'll try the segments. Quote Link to comment Share on other sites More sharing options...
+tzeb Posted February 10, 2014 Share Posted February 10, 2014 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 Quote Link to comment Share on other sites More sharing options...
Gury Posted February 14, 2014 Share Posted February 14, 2014 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 Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted February 14, 2014 Author Share Posted February 14, 2014 (edited) Does printf.obx even handle 8-bit numeric output? It's outputting words all the time, but the MSB of n happens to be zero. Edited February 14, 2014 by flashjazzcat Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted February 16, 2014 Share Posted February 16, 2014 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? Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted February 16, 2014 Author Share Posted February 16, 2014 (edited) 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 February 16, 2014 by flashjazzcat Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted February 16, 2014 Share Posted February 16, 2014 ok... can someone explain why this not work? .macro calc clc lda :1 adc :1+1 adc :1+2 adc :1+81 lsr lsr sta offset1+1 clc lda :1+1 adc :1+2 adc :1+3 adc :1+82 lsr lsr sta offset2+1 offset1 lda nibble0x offset2 ora nibblex0 sta :1-80 .endm ... :10 calc (buffer+#) Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted February 16, 2014 Share Posted February 16, 2014 this produces an error "illegal character" at line ADC :1+1 Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted February 16, 2014 Author Share Posted February 16, 2014 (edited) 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 February 16, 2014 by flashjazzcat Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted February 16, 2014 Share Posted February 16, 2014 Well the macro should generate code Buffer Buffer+1 Buffer+2 ... That should be the buffer+# Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted February 16, 2014 Share Posted February 16, 2014 Which the macro should add the offsets to... Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted February 16, 2014 Author Share Posted February 16, 2014 I see. Well, :10 lda ## works, but # doesn't seem to work when it's passed to a macro. Looks a bit convoluted anyway: you could just use .REPT and a temporary label as an address counter. Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted February 16, 2014 Share Posted February 16, 2014 And how would you pass the updated values then with rept? Because there normally I use #, too??? Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted February 16, 2014 Author Share Posted February 16, 2014 Well, you're basically adding the repetition counter to buffer to make an offset, correct? Perhaps something like this: ?ptr equ buffer .rept 10 calc ?ptr ?ptr equ ?ptr+1 .endr Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted February 17, 2014 Share Posted February 17, 2014 it compiles but does not work as it will insert zeropage values... the buffer is located at $a440 but the macro inserts LDA $20 at LDA :1 Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted February 17, 2014 Share Posted February 17, 2014 ok... seems to work now... as I got a " " there... which then produced $20 ZP adress. Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted February 17, 2014 Author Share Posted February 17, 2014 Jolly good. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.