General Category > Programming

BASM: Best ASseMbler in my desk room.

<< < (5/6) > >>

ralferoo:

--- Quote from: krusty on 13:17, 15 October 21 ---
--- Code: ---    repeat RASTER_HEIGHT, loop

        ticker start @raster_line_duration
            ld a, (hl)
            out (c), a

            if {loop} != RASTER_HEIGHT
                inc hl
            endif
        ticker stop

        nop 64-@raster_line_duration

    endr

--- End code ---

--- End quote ---
I think I need this in my life! I'm sick of writing code like this:

--- Code: ---...
        ld hl,(palette+12)      ;5      L1+32

        defs line+1-32          ;       L1+ 1
        exx                     ;1      L1+ 2
        in a,(c)                ;4      L1+ 6
        xor c                   ;1      L1+ 7     ; check for edge
        call m,new_found_edge   ;3/5    L1+10   
        ld l,(hl)               ;2      L1+12     ; update counter
        exx                     ;1      L1+13

        ld a,#10                ;2      L1+15
        inc c                   ;1      L1+16 
        out (c),c               ;4      L1+20
        out (c),l               ;4      L1+24  ; colour 12
        out (c),a               ;4      L1+28
        inc c                   ;1      L1+29

        defs line+1-29          ;       L1+ 1
        exx                     ;1   L1+13...

--- End code ---

ralferoo:

--- Quote from: GUNHED on 21:08, 05 November 21 ---Can I call mine TASManian DEVil ??

--- End quote ---
Not CPC related, but TASM was Borland's Turbo Assembler on PC. About 1/10 the price of Microsoft's MASM, much faster and optionally compatible with its bugs.

ralferoo:
Also, very timely seeing this thread. Last night, I encountered a particularly nasty bug in pasmo...


In some cases, where I had a value defines as "symbol equ -63"
Using that symbol with "ld de,symbol" assembled as "ld de,0". In the end, I had to change the value from -63 to 0-63 and suddenly it worked. Interestingly, this only affected 2 of about 20 such labels, the rest were done correctly.


In another case, I had "symbol_a equ -56" and "symbol_b equ -35+symbol_a" turned the "ld de,symbol_b" into something +ve.


What's weirder is that I can't understand how I was using this as my primary Z80 assembler for about 5 years and never noticed these problems before! But seemingly all of my old code does assemble correctly still.

krusty_benediction:

--- Quote from: ralferoo on 01:12, 10 December 21 --- Also, very timely seeing this thread. Last night, I encountered a particularly nasty bug in pasmo... In some cases, where I had a value defines as "symbol equ -63" Using that symbol with "ld de,symbol" assembled as "ld de,0". In the end, I had to change the value from -63 to 0-63 and suddenly it worked. Interestingly, this only affected 2 of about 20 such labels, the rest were done correctly. In another case, I had "symbol_a equ -56" and "symbol_b equ -35+symbol_a" turned the "ld de,symbol_b" into something +ve. What's weirder is that I can't understand how I was using this as my primary Z80 assembler for about 5 years and never noticed these problems before! But seemingly all of my old code does assemble correctly still.
--- End quote ---

so you can give a try to ours ;)But as I am the single user over the world, you may encounter bugs the first time you assemble your code. Would be happy to fix them.I'm using basm for the current demo screen I am coding and it works like a charm.I'm even able to assemble such piece of code:
font_char_address
    .current_char_relative_position = 0
    repeat NB_CHARS, char
        dw fonte + .current_char_relative_position*8
        .current_char_width = memory(fonte_width_table + ({char}-1))
        .current_char_width = max(1, ceil(.current_char_width/8))
        .current_char_relative_position = .current_char_relative_position + .current_char_width
    endr

norecess:

--- Quote from: krusty_benediction on 09:15, 10 December 21 ---I'm even able to assemble such piece of code:
font_char_address
    .current_char_relative_position = 0
    repeat NB_CHARS, char
        dw fonte + .current_char_relative_position*8
        .current_char_width = memory(fonte_width_table + ({char}-1))
        .current_char_width = max(1, ceil(.current_char_width/8))
        .current_char_relative_position = .current_char_relative_position + .current_char_width
    endr
--- End quote ---
If your assembler is able to support that, that's pretty cool ! :)
But, in my opinion this goes too far.
When I need to generate such complex data, I prefer using a real IDE where I'm able to inspect generated data through a debugging session (from the IDE). The generator also outputs a human-readable text assembly file (eventually with a comment when required etc.). And finally, I can also create symbols for data that matters in the array.

Random examples as implemented in Sonic GX:

--- Code: ---   ALIGN 2
Level2_UniqueGroundPositions:
Level2_UniqueGroundPosition_0:
   dw 0 + 32 ; Roof0
   dw 432 ; Ground0
   dw 0 + 32 ; Roof1
   dw 432 ; Ground1
   dw 0 + 32 ; Roof2
   dw 432 ; Ground2
Level2_UniqueGroundPosition_1:
   dw 0 + 32 ; Roof0
   dw 448 ; Ground0
   dw 0 + 32 ; Roof1
   dw 448 ; Ground1
   dw 0 + 32 ; Roof2
   dw 448 ; Ground2
Level2_UniqueGroundPosition_2:
   dw 0 + 32 ; Roof0
   dw 480 ; Ground0
   dw 0 + 32 ; Roof1
   dw 480 ; Ground1
   dw 0 + 32 ; Roof2
   dw 480 ; Ground2
Level2_UniqueGroundPosition_3:
   dw 0 + 32 ; Roof0
   dw 496 ; Ground0
   dw 0 + 32 ; Roof1
   dw 496 ; Ground1
   dw 0 + 32 ; Roof2
   dw 496 ; Ground2
Level2_UniqueGroundPosition_4:
   dw 0 + 32 ; Roof0
   dw 752 ; Ground0
   dw 0 + 32 ; Roof1
   dw 752 ; Ground1
   dw 0 + 32 ; Roof2
   dw 752 ; Ground2
--- End code ---


--- Code: ---Level2_MapPointers:
   db #80 + ROM_Level2_MapData
   db #80 + ROM_Tileset1_X0Y0
   db #80 + ROM_Tileset1_X1Y1
   db #B8 + ROM_Tileset1_X1Y0
   db #B8 + ROM_Tileset1_X0Y1
   db #B8 + ROM_Tileset1_TileOpcodeOffsets
   dw Tileset1_2MostUsedBytes
   db 0 ; HasVegetables 0=False 1=True
   dw Level2_UniqueGroundPositionIndices
   dw Level2_UniqueGroundPositions
   dw 0
   dw 0
   dw Level2_RingSliceIndices
   dw Level2_SpriteVisibility
   db 1
   db 1 + NbCharRows - 30
   dw _TILESET1_PALETTE
   db 1 ; 0=Fog 1=Water 2=Disabled (ColorCycling)
   dw 602 ; BossFightCameraTilePosX
   dw 0 ; wBossFightXOffset
   dw Music_BridgeZone_Start
   dw ManageSprites_Level23
   dw CollideSprites_Level23
   db 0 ; IsVertical
   db 1 ; HasBackgroundRasters
   db #80 + ROM_Level2_BigIndices
   dw Level2_PackedBigIndices
   db #80 + ROM_Level2_BigTileset
   dw ROM_Level2_BigTileset_ZX0

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version
Powered by SMFPacks Reactions Mod
Powered by SMFPacks Alerts Pro Mod
Powered by SMFPacks Mentions Pro Mod