moved font include into 4x8 driver
[bz80asm.git] / output.zas
blob41e3eeaeadc832e65d9cbbba7ab1f14074bd4651
1 WIDTH: defb  30  ;PRINT WIDTH
4 ; A: code
5 ; should preserve registers (except A and F)
6 ;OSWRCH:
9 ;OUT - SEND CHARACTER OR KEYWORD
10 ;   Inputs: A = character (>=10, <128)
11 ;           A = Token (<10, >=128)
12 ;  Destroys: A,F
14 EMIT:
15   jp    OSWRCH
18 printstr:
19   dec   hl
20 .loop:
21   inc   hl
22   ld    a,(hl)
23   and   #7f
24   call  EMIT
25   bit   7,(hl)
26   jr    z,.loop
27   ret
29 printstrnl:
30   call  printstr
31   ld    a,13
32   jp    EMIT
35 EXPR_ERR_NO_LOCAL_LABELS_YET equ BZ80ASM.EXPR_ERR_USERDEF+0
37 errmsg_table:
38   defx  "number expected"
39   defx  "string expected"
40   defx  "')' expected"
41   defx  "division by 0"
42   defx  "relative jump dest too far"
43   defx  "unknown label"
44   defx  "invalid label name"
45   defx  "duplicate label"
46   defx  "bad syntax"
47   ; user-defined errors starts here
48   defx  "local labels are not implemented yet"
51 expr_error_jrfar_cb:
52   ld    a,BZ80ASM.EXPR_ERR_JR_TOO_FAR
53   ; you can simply "RET" from here
54   jp    BZ80ASM.PARSE_EXPR_ERROR_A
56 expr_error_cb:
57   ; find message
58   ld    hl,errmsg_table
59 .loop:
60   dec   a
61   jr    z,.msgfound
62 .skipmsg:
63   bit   7,(hl)
64   inc   hl
65   jr    z,.skipmsg
66   jr    .loop
68 .msgfound:
69   call  printstrnl
71   ld    sp,(BZ80ASM.ASM_SP0)
72   scf
73   ret