mirror of https://github.com/falsovsky/z80.git
Nao repetir os push e pop
This commit is contained in:
parent
f4a32b91eb
commit
d28d4a1e76
|
|
@ -24,19 +24,20 @@ main
|
||||||
ld hl, brainfuck
|
ld hl, brainfuck
|
||||||
read_bf
|
read_bf
|
||||||
ld a,(hl)
|
ld a,(hl)
|
||||||
|
push hl
|
||||||
|
|
||||||
; EOF
|
; EOF
|
||||||
cp 0
|
cp 0
|
||||||
jr z, end_main
|
jr z, end_main
|
||||||
|
|
||||||
; >
|
; >
|
||||||
cp OP_INC_DP
|
cp OP_INC_DP
|
||||||
jr z, F_INC_DP
|
jr z, F_INC_DP
|
||||||
|
|
||||||
; <
|
; <
|
||||||
cp OP_DEC_DP
|
cp OP_DEC_DP
|
||||||
jr z, F_DEC_DP
|
jr z, F_DEC_DP
|
||||||
|
|
||||||
; +
|
; +
|
||||||
cp OP_INC_VAL
|
cp OP_INC_VAL
|
||||||
jr z, F_INC_VAL
|
jr z, F_INC_VAL
|
||||||
|
|
@ -44,55 +45,47 @@ read_bf
|
||||||
; +
|
; +
|
||||||
cp OP_DEC_VAL
|
cp OP_DEC_VAL
|
||||||
jr z, F_DEC_VAL
|
jr z, F_DEC_VAL
|
||||||
|
|
||||||
; .
|
; .
|
||||||
cp OP_OUT
|
cp OP_OUT
|
||||||
jr z, F_OUT
|
jr z, F_OUT
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
pop hl
|
||||||
inc hl
|
inc hl
|
||||||
jr read_bf
|
jr read_bf
|
||||||
|
|
||||||
end_main
|
end_main
|
||||||
pop bc ; Tira o BC da stack
|
pop bc ; Tira o BC da stack
|
||||||
ret ; Sai para o BASIC
|
ret ; Sai para o BASIC
|
||||||
|
|
||||||
F_INC_DP
|
F_INC_DP
|
||||||
push hl
|
|
||||||
ld hl, (memory_pos)
|
ld hl, (memory_pos)
|
||||||
inc hl
|
inc hl
|
||||||
ld (memory_pos), hl
|
ld (memory_pos), hl
|
||||||
pop hl
|
|
||||||
jr continue
|
jr continue
|
||||||
|
|
||||||
F_DEC_DP
|
F_DEC_DP
|
||||||
push hl
|
|
||||||
ld hl, (memory_pos)
|
ld hl, (memory_pos)
|
||||||
dec hl
|
dec hl
|
||||||
ld (memory_pos), hl
|
ld (memory_pos), hl
|
||||||
pop hl
|
|
||||||
jr continue
|
jr continue
|
||||||
|
|
||||||
F_INC_VAL
|
F_INC_VAL
|
||||||
push hl
|
|
||||||
ld hl, (memory_pos)
|
ld hl, (memory_pos)
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
inc a
|
inc a
|
||||||
ld (hl), a
|
ld (hl), a
|
||||||
pop hl
|
|
||||||
jr continue
|
jr continue
|
||||||
|
|
||||||
F_DEC_VAL
|
F_DEC_VAL
|
||||||
push hl
|
|
||||||
ld hl, (memory_pos)
|
ld hl, (memory_pos)
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
dec a
|
dec a
|
||||||
ld (hl), a
|
ld (hl), a
|
||||||
pop hl
|
|
||||||
jr continue
|
jr continue
|
||||||
|
|
||||||
F_OUT
|
F_OUT
|
||||||
push hl
|
|
||||||
ld hl, (memory_pos)
|
ld hl, (memory_pos)
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
rst $10
|
rst $10
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue