diff --git a/apps/zasm/directive.asm b/apps/zasm/directive.asm index 080d82f..81aa3e5 100644 --- a/apps/zasm/directive.asm +++ b/apps/zasm/directive.asm @@ -1,17 +1,20 @@ ; *** CONSTS *** -D_DB .equ 0x00 -D_BAD .equ 0xff +.equ D_DB 0x00 +.equ D_DW 0x01 +.equ D_BAD 0xff ; *** CODE *** ; 4 bytes per row, fill with zero directiveNames: .db ".DB", 0 + .db ".DW", 0 ; This is a list of handlers corresponding to indexes in directiveNames directiveHandlers: .dw handleDB + .dw handleDW handleDB: push de @@ -29,13 +32,30 @@ handleDB: pop de ret +handleDW: + push de + push hl + call toWord + ld de, scratchpad + ld a, 8 + call readWord + ld hl, scratchpad + call parseNumber + ld a, ixl + ld (direcData), a + ld a, ixh + ld (direcData+1), a + ld a, 2 + pop hl + pop de + ret ; Reads string in (HL) and returns the corresponding ID (D_*) in A. Sets Z if ; there's a match. getDirectiveID: push bc push de - ld b, 1 + ld b, D_DW+1 ; D_DW is last ld c, 4 ld de, directiveNames call findStringInList @@ -53,6 +73,7 @@ parseDirective: add a, a ld de, directiveHandlers call JUMP_ADDDE + call JUMP_INTODE ld ixh, d ld ixl, e pop de diff --git a/apps/zasm/emul/glue.asm b/apps/zasm/emul/glue.asm index f612f20..4ad8c23 100644 --- a/apps/zasm/emul/glue.asm +++ b/apps/zasm/emul/glue.asm @@ -9,6 +9,7 @@ jp strncmp jp addDE jp upcase jp unsetZ +jp intoDE init: di diff --git a/apps/zasm/emul/user.inc b/apps/zasm/emul/user.inc index c8e77d5..5abc544 100644 --- a/apps/zasm/emul/user.inc +++ b/apps/zasm/emul/user.inc @@ -7,3 +7,4 @@ JUMP_STRNCMP .equ 0x02 JUMP_ADDDE .equ 0x05 JUMP_UPCASE .equ 0x08 JUMP_UNSETZ .equ 0x0b +JUMP_INTODE .equ 0x0e diff --git a/apps/zasm/tests/test1.asm b/apps/zasm/tests/test1.asm index 812b7d7..c0a802f 100644 --- a/apps/zasm/tests/test1.asm +++ b/apps/zasm/tests/test1.asm @@ -3,3 +3,5 @@ inc a ; comment ; comment .db 42 + .dw 42 + .dw 3742