zasm: support multiple elements in .dw and .db

This commit is contained in:
Virgil Dupras 2019-05-17 15:39:28 -04:00
parent b0318f4891
commit 16922da3d4
2 changed files with 8 additions and 2 deletions

View File

@ -27,16 +27,20 @@ directiveHandlers:
handleDB: handleDB:
push hl push hl
.loop:
call readWord call readWord
ld hl, scratchpad ld hl, scratchpad
call parseLiteral call parseLiteral
ld a, ixl ld a, ixl
call ioPutC call ioPutC
call readComma
jr z, .loop
pop hl pop hl
ret ret
handleDW: handleDW:
push hl push hl
.loop:
call readWord call readWord
ld hl, scratchpad ld hl, scratchpad
call parseExpr call parseExpr
@ -45,6 +49,8 @@ handleDW:
call ioPutC call ioPutC
ld a, h ld a, h
call ioPutC call ioPutC
call readComma
jr z, .loop
pop hl pop hl
ret ret

View File

@ -5,9 +5,9 @@ label1:
ld hl, label2 ld hl, label2
.dw label2 .dw label2
; comment ; comment
.db 42 .db 42, 54
label2: .dw 0x42 label2: .dw 0x42
.dw 3742 .dw 3742, 0xffff
.dw 0x3742 .dw 0x3742
ld a, (label1) ld a, (label1)
rla \ rla rla \ rla