msbasic/poke.s

119 lines
2.7 KiB
ArmAsm
Raw Normal View History

2008-10-13 02:14:07 +00:00
.segment "CODE"
2008-10-13 10:25:01 +00:00
.ifndef CONFIG_NO_POKE
; ----------------------------------------------------------------------------
; EVALUATE "EXP1,EXP2"
;
; CONVERT EXP1 TO 16-BIT NUMBER IN LINNUM
; CONVERT EXP2 TO 8-BIT NUMBER IN X-REG
; ----------------------------------------------------------------------------
GTNUM:
jsr FRMNUM
jsr GETADR
; ----------------------------------------------------------------------------
; EVALUATE ",EXPRESSION"
; CONVERT EXPRESSION TO SINGLE BYTE IN X-REG
; ----------------------------------------------------------------------------
COMBYTE:
jsr CHKCOM
jmp GETBYT
; ----------------------------------------------------------------------------
; CONVERT (FAC) TO A 16-BIT VALUE IN LINNUM
; ----------------------------------------------------------------------------
GETADR:
lda FACSIGN
.ifdef APPLE
nop ; PATCH
nop
.else
bmi GOIQ
.endif
lda FAC
cmp #$91
bcs GOIQ
jsr QINT
lda FAC_LAST-1
ldy FAC_LAST
sty LINNUM
sta LINNUM+1
rts
2008-10-13 02:14:07 +00:00
; ----------------------------------------------------------------------------
; "PEEK" FUNCTION
; ----------------------------------------------------------------------------
PEEK:
2008-10-17 05:34:16 +00:00
.ifdef CONFIG_PEEK_SAVE_LINNUM
2008-10-13 10:42:49 +00:00
lda LINNUM+1
2008-10-13 02:14:07 +00:00
pha
2008-10-13 10:42:49 +00:00
lda LINNUM
2008-10-13 02:14:07 +00:00
pha
.endif
jsr GETADR
ldy #$00
.ifdef CBM1
2008-10-18 06:59:14 +00:00
; disallow PEEK between $C000 and $DFFF
2008-10-13 02:14:07 +00:00
cmp #$C0
bcc LD6F3
cmp #$E1
bcc LD6F6
LD6F3:
.endif
2008-10-13 10:42:49 +00:00
.ifdef CBM2
2008-10-13 02:14:07 +00:00
nop ; patch that disables the compares above
nop
nop
nop
nop
nop
nop
nop
.endif
lda (LINNUM),y
tay
2008-10-17 05:34:16 +00:00
.ifdef CONFIG_PEEK_SAVE_LINNUM
2008-10-13 02:14:07 +00:00
pla
2008-10-13 10:42:49 +00:00
sta LINNUM
2008-10-13 02:14:07 +00:00
pla
2008-10-13 10:42:49 +00:00
sta LINNUM+1
2008-10-13 02:14:07 +00:00
.endif
LD6F6:
jmp SNGFLT
; ----------------------------------------------------------------------------
; "POKE" STATEMENT
; ----------------------------------------------------------------------------
POKE:
jsr GTNUM
txa
ldy #$00
sta (LINNUM),y
rts
; ----------------------------------------------------------------------------
; "WAIT" STATEMENT
; ----------------------------------------------------------------------------
WAIT:
jsr GTNUM
stx FORPNT
ldx #$00
jsr CHRGOT
2008-10-16 07:42:48 +00:00
.ifdef CONFIG_EASTER_EGG
2008-10-13 02:14:07 +00:00
beq EASTER_EGG
.else
beq L3628
.endif
jsr COMBYTE
L3628:
stx FORPNT+1
ldy #$00
L362C:
lda (LINNUM),y
eor FORPNT+1
and FORPNT
beq L362C
RTS3:
rts
2008-10-13 10:18:55 +00:00
.endif /* KBD */