Jump to content
Sign in to follow this  

About This Club

DASM is an assembler that's commonly used to develop for the Atari 2600, Atari 7800, and Fairchild Channel F VES.

  1. What's new in this club
  2. Unfortunately 32 bit is the limit here. If expressions would all access to generated code, one could create tables in uninitialized segments and read from these.
  3. "nnn$ Local label, much like ‘.name’, except that defining a non-local label has the effect that SUBROUTINE has on‘.name’." IMO this should be worded/explained better, maybe with an example. AFAIK code can be like this: name$ some code Label some code name$ So "Label" starts a new local label scope.
  4. While this works, it is IMO pretty odd and not easy to understand especially later on.
  5. XASM has a number of quite useful tricks. E.g. pseudo-ops for conditional branches or 16 bit addresses, the smart use of ':' for concatenating and the index post-increments/decrements. I wonder if we should extend DASM similar or maybe provide a macro file which replicates them. Sometimes the latter will not be possible though. xasm.html
  6. You can change it so the shift = next power of 2 up from maximum # symbols. And then you can squash lots more in. For the given example, 0/1/2, then we need 2 bits, so the shift is 2. Building the array is a bit trickier... ARRAY = (SYM1<<4)|(SYM2<<2)|(SYM3<<0) ... where SYM1..SYM3 are values in the range 0..2
  7. Interesting approach. Thanks! Now we only need something for a large number of symbol variations.
  8. Mmh. How about using operators? Works for a small # symbols. SWITCH = 0 ; or 1 or 2 ARRAY = $0F0A07 SYMBOL = ((ARRAY >> (8*SWITCH)) & $FF It works up to the size of numbers held by dasm. Perhaps, though, you could extend this by using the string functions Not quite sure how they work though
  9. The current manual is missing an example for DV and EQM. Here is one from Robot City: CHANCE EQM ((255*..+100/2)/100) RandomDirs DV CHANCE 0, 5, 15, 35 ; game 1 DV CHANCE 0, 4, 12, 28 DV CHANCE 0, 3, 9, 21 DV CHANCE 0, 2, 6, 14 DV CHANCE 0, 1, 3, 7 ; game 5 This creates 20 bytes using the expressing defined by CHANCE. For game 1 the bytes created are 0, 12, 38, 89 (which are about 0, 5, 15 and 35% of 255). Another example: PAL_VAL EQM (..*PAL_ROWS + NTSC_ROWS/2)/NTSC_ROWS This converts NTSC scanlines into PAL scanlines. BTW: Both examples are rounding, not truncating the results.
  10. Instead of doing this ... IF SWITCH = 0 SYMBOL = 7 ENDIF IF SWITCH = 1 SYMBOL = 10 ENDIF IF SWITCH = 2 SYMBOL = 15 ENDIF ... I am looking for an easier way. Something like ... ARRAY = 7, 10, 15 SYMBOL = ARRAY[SWITCH] would be nice. Is there something like this existing in DASM?
  11. That would make sense. Thanks
  12. That's what I always assumed too.
  13. D for Dillon, I assume.
  14. Hi there, Does anyone know why Matt named this DASM?
  15. Sure. I am trying to understand this completely to get this fixed for Stella first.
  16. Of course anyone is welcome to make these changes - but if you don't have the knowledge/tools to do the changes, just write 'em up and I'll be happy to add them to the manual and get the PDF done.
  17. Back to topic. Maybe we should add some more description for the files created. While IMO the listing file is pretty straightforward, the symbol file IMO needs some more doc. E.g. local labels (inside subroutines and macros) are prefixed with a counter which should be explained. Also the usual '(R )' can also contain a 2nd flag 'S' which should be documented. Though I haven't seen that one yet. Also it should be explained that symbols without flags are superfluous.
  18. Have you tried doing what is done for RAM? ; .U means uninitialized, does not end up in ROM SEG.U ; value for first label ORG 1000 Label1: ds 1 Label2: ds 1 Label3: ds 1 Label4: ds 1 ... The labels would be assigned 1000, 1001, 1002, 1003, etc
  19. There's no auto-incrementing label names or values. I think the only way you can manage this with names is dynamic labels, and for values by using SET with whatever incrementing you need. I'm not sure exactly what you mean by arbitrary, since you can name dynamic labels as you like. Here's a example of creating a series of incrementing dynamic labels, which take on different values. I took this from the 7800basic zonememory.asm file and simplified a bit. (for the sake of having a clear example not cluttered up by various 7800basic memory allocation options) DLINDEX SET 0 REPEAT WZONECOUNT TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) ; create symbols in the form "ZONE#ADDRESS" that point to the memory for each zone ZONE,DLINDEX,"ADDRESS" = TMPMEMADDRESS DLINDEX SET DLINDEX + 1 REPEND
  20. I couldn't find anything in the documentation that matched, but is there a way to have label values auto increment? E.g. you set the value of the first label, then just supply the names of the subsequent labels, and these will be given incrementing values in order. I get how I could do it via dynamic labels, but is there a way with arbitrary label names?
  21. Thanks for the explanation. In my case, the argument is already a quoted string, not a label, so = is correct and my comment about setstr was superfluous.
  22. SETSTR makes a string literally from a symbol name. SET evaluates the value of the stuff on the right side of the SET command, and assigns that value to the symbol. Using = is the same as SET, except it's a constant symbol assignment, where you can repeatedly use SET to assign different values to the same symbol. (This is particularly useful when you want to generate look-up-table data instead of using constants, but by no means the only use for SET) This code... processor 6502 org $1000 MAC testset myset1 = {1} myset2 SET {1} mysetstr SETSTR {1} echo "myset1 is",myset1 echo "myset2 is",myset2 echo "mysetstr is",mysetstr ENDM mylabel testset mylabel ...will result in this output during the assembly... DASM 2.20.14-SNAPSHOT /usr/local/bin/dasm scratch.asm -f3 -sscratch.symbol.txt -lscratch.listing.txt -I. -I../includes -oscratch.bin myset1 is $1000 myset2 is $1000 mysetstr is mylabel Complete. (0) This is the main use case for SETSTR - so you can have a macro report which symbol it was called with.
  23. Ah. I was not aware of the 2.20.14 release. 2.20.13 does not support 'setstr'. TBH I’m not clear on the difference between 'set' and 'setstr'. The = seems to work fine in this case.
  24. Very nice. But AFAIK the latest DASM supports 'setstr'.
  25. I often want to check the top nybble, and there might be uses (bankswitching?) to check other ranges. This version can check any number of bits on either the high side or the low side. This also uses no global symbols. The trick to getting rid of them was to assign a local label from the parameter in the leaf macro. mac samebits ; {numbits, addr1, addr2, mask, side} list localoff .numbits = {1} .addr1 = {2} .addr2 = {3} .mask = {4} .side = {5} ; current dasm doesn't have setstr .addr1masked = .addr1 & .mask .addr2masked = .addr2 & .mask if .addr1masked == .addr2masked .SAMEBITS_EXISTS ; defined if non-masked bits are equal endif ifnconst .SAMEBITS_EXISTS echo "ERROR: ", .side, " ", .numbits, "bits difference (", .addr1, ",", .addr2, ")" err endif endm mac samelow ; {numbits, addr1, addr2} samebits {1}, {2}, {3}, [1<<[{1}]]-1 & $FFFF, "low" endm mac samehigh ; {numbits, addr1, addr2} samebits {1}, {2}, {3}, ~[[1<<[16-[{1}]]]-1] & $FFFF, "high" endm mac prevsamelowas ; {numbits, addr} samelow [{1}], .-1, [{2}] endm mac nextsamelowas ; {numbits, addr} samelow [{1}], ., [{2}] endm mac prevsamehighas ; {numbits, addr} samehigh [{1}], .-1, [{2}] endm mac nextsamehighas ; {numbits, addr} samehigh [{1}], ., [{2}] endm mac prevsamehigh8as ; {addr} ; deprecated: use prevsamehighas instead prevsamehighas 8, [{1}] endm mac nextsamehigh8as ; {addr} ; deprecated: use nextsamehighas instead nextsamehighas 8, [{1}] endm
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...