Skip to content

Commit

Permalink
maybe runs on rev m?
Browse files Browse the repository at this point in the history
  • Loading branch information
mateoconlechuga committed Aug 25, 2019
1 parent 77178de commit 2a467b3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
54 changes: 31 additions & 23 deletions include/app.inc
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,7 @@ macro app_private
dec hl
dec hl
push hl
ld a,$d1
ld mb,a
ld.sis sp,$987e
call.is .unlock and $ffff
call .unlock
pop hl
ld de,(app.end)
or a,a
Expand Down Expand Up @@ -161,34 +158,45 @@ macro app_private
inc hl
jr .relocate
.endrelocate:
call.is .lock and $ffff
ld a,$d0
ld mb,a
call .lock
xor a,a
ret

assume adl = 0

.unlock:
ld bc,$24
ld a,$8c
out0 ($24),a
ld c,4
in0 a,(6)
or c
out0 (6),a
out0 ($28),c
ret.l
call .write
ld bc,$06
call .read
or a,4
call .write
ld bc,$28
ld a,$4
jq .write
.lock:
xor a
out0 ($28),a
in0 a,(6)
ld bc,$28
xor a,a
call .write
ld bc,$06
call .read
res 2,a
out0 (6),a
call .write
ld bc,$24
ld a,$88
out0 ($24),a
ret.l
jq .write

.write:
ld de,$C979ED
ld hl,ti.heapBot - 3
ld (hl),de
jp (hl)

.read:
ld de,$C978ED
ld hl,ti.heapBot - 3
ld (hl),de
jp (hl)

assume adl = 1
.continue:
end macro

Expand Down
2 changes: 1 addition & 1 deletion src/flash.asm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ flash_unlock:
jp write_port

flash_lock:
ld bc,$24
ld bc,$28
xor a,a
call write_port
ld bc,$06
Expand Down

0 comments on commit 2a467b3

Please sign in to comment.