소스 검색

zasm: make the instruction table fixed

Looping is easier
pull/10/head
Virgil Dupras 5 년 전
부모
커밋
38e40bfc16
1개의 변경된 파일7개의 추가작업 그리고 9개의 파일을 삭제
  1. +7
    -9
      apps/zasm/zasm.asm

+ 7
- 9
apps/zasm/zasm.asm 파일 보기

@@ -2,7 +2,8 @@


; *** Consts *** ; *** Consts ***
ARGSPEC_SINGLE_CNT .equ 7 ARGSPEC_SINGLE_CNT .equ 7
ARGSPEC_TBL_CNT .equ 12
ARGSPEC_TBL_CNT .equ 12
INSTR_TBL_PRIMARYC_CNT .equ 25


; *** Code *** ; *** Code ***
.org USER_CODE .org USER_CODE
@@ -229,18 +230,16 @@ matchPrimaryRow:
parseLine: parseLine:
call readLine call readLine
push de push de
ld de, instTBlPrimary
ld de, instrTBlPrimaryC
ld b, INSTR_TBL_PRIMARYC_CNT
.loop: .loop:
ld a, (de) ld a, (de)
cp 0
jr z, .nomatch ; we reached last entry
call matchPrimaryRow call matchPrimaryRow
jr z, .match jr z, .match
ld a, 7 ld a, 7
call JUMP_ADDDE call JUMP_ADDDE
jr .loop

.nomatch:
djnz .loop
; no match
xor a xor a
pop de pop de
ret ret
@@ -283,7 +282,7 @@ argspecTbl:
; 1 byte for arg constant ; 1 byte for arg constant
; 1 byte for 2nd arg constant ; 1 byte for 2nd arg constant
; 1 byte for upcode ; 1 byte for upcode
instTBlPrimary:
instrTBlPrimaryC:
.db "ADD", 0, 'A', 'h', 0x86 ; ADD A, HL .db "ADD", 0, 'A', 'h', 0x86 ; ADD A, HL
.db "CCF", 0, 0, 0, 0x3f ; CCF .db "CCF", 0, 0, 0, 0x3f ; CCF
.db "CPL", 0, 0, 0, 0x2f ; CPL .db "CPL", 0, 0, 0, 0x2f ; CPL
@@ -309,7 +308,6 @@ instTBlPrimary:
.db "RRA", 0, 0, 0, 0x1f ; RRA .db "RRA", 0, 0, 0, 0x1f ; RRA
.db "RRCA", 0, 0, 0x0f ; RRCA .db "RRCA", 0, 0, 0x0f ; RRCA
.db "SCF", 0, 0, 0, 0x37 ; SCF .db "SCF", 0, 0, 0, 0x37 ; SCF
.db 0


; *** Variables *** ; *** Variables ***
; enough space for 4 chars and a null ; enough space for 4 chars and a null


불러오는 중...
취소
저장