mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 19:28:05 +11:00
basic: add sleep command
also fix broken "peek"
This commit is contained in:
parent
9602f9b983
commit
7761cebb0a
@ -114,3 +114,6 @@ of 0x002b into `a`'s MSB.
|
|||||||
address. For example, `poke 42 0x102+0x40` puts `0x42` in memory address
|
address. For example, `poke 42 0x102+0x40` puts `0x42` in memory address
|
||||||
0x2a (MSB is ignored) and `doke 42 0x102+0x40` does the same as poke, but also
|
0x2a (MSB is ignored) and `doke 42 0x102+0x40` does the same as poke, but also
|
||||||
puts `0x01` in memory address 0x2b.
|
puts `0x01` in memory address 0x2b.
|
||||||
|
|
||||||
|
**sleep**: Sleep a number of "units" specified by the supplied expression. A
|
||||||
|
"unit" depends on the CPU clock speed. At 4MHz, it is roughly 8 microseconds.
|
||||||
|
@ -272,6 +272,7 @@ basPEEK:
|
|||||||
ret nz
|
ret nz
|
||||||
ld d, 0
|
ld d, 0
|
||||||
call varAssign
|
call varAssign
|
||||||
|
cp a ; ensure Z
|
||||||
ret
|
ret
|
||||||
|
|
||||||
basPOKE:
|
basPOKE:
|
||||||
@ -308,6 +309,17 @@ basDOKE:
|
|||||||
ld (ix+1), h
|
ld (ix+1), h
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
basSLEEP:
|
||||||
|
call rdExpr
|
||||||
|
ret nz
|
||||||
|
push ix \ pop hl
|
||||||
|
.loop:
|
||||||
|
ld a, h ; 4T
|
||||||
|
or l ; 4T
|
||||||
|
ret z ; 5T
|
||||||
|
dec hl ; 6T
|
||||||
|
jr .loop ; 12T
|
||||||
|
|
||||||
; direct only
|
; direct only
|
||||||
basCmds1:
|
basCmds1:
|
||||||
.dw basBYE
|
.dw basBYE
|
||||||
@ -334,4 +346,6 @@ basCmds2:
|
|||||||
.db "deek", 0, 0
|
.db "deek", 0, 0
|
||||||
.dw basDOKE
|
.dw basDOKE
|
||||||
.db "doke", 0, 0
|
.db "doke", 0, 0
|
||||||
|
.dw basSLEEP
|
||||||
|
.db "sleep", 0
|
||||||
.db 0xff, 0xff, 0xff ; end of table
|
.db 0xff, 0xff, 0xff ; end of table
|
||||||
|
Loading…
Reference in New Issue
Block a user