This worked in simulation. Might try in real 1802 with slowish stepping.
C:\Users\Dell\Documents\1802_Data\a18\WorkingApril282020\intsPractice1.lst
0000 START ORG 0
0000 7b seq
0001 f8 03 ldi $03 ;careful, we have some nops up there.
0003 b2 phi 2 ;R2 is stack pointer
0004 f8 45 ldi $45
0006 a2 plo 2 ;R2=stack pointer now points to $00ff
0007 e2 sex 2 ;X now pnts to R2, the stack pointer. 00ff
0008 f8 00 ldi HIGH(ISR)
000a b1 phi 1
000b f8 55 ldi LOW(ISR)
000d a1 plo 1
000e loop0
000e f8 2d ldi $2d ;want output this byte on channel 1
0010 73 stxd
0011 12 inc 2
;here P=0 and X=2
; enableinterrupts
; sex 0 ;P=0 currently
; ret ;
; DB $20 ;ret will use this. Now P=0,X=2. Interrupts enabled
; disableinterrupts
; sex 0 ;P=0 currently
; dis ;
; DB $20 ;dis will use this.Now P=0,X=2 and interrupts disabled
0012 loop1
0012 61 out 1
0013 30 12 br loop1
0053 ORG $0053
0053 exit ;leave ISR here
0053 42 lda 2 ;put back DB
0054 71 dis ;same as ret but disable interrupts
;ret ;X,P get old values. Enable interrupts
0055 ORG $0055
0055 ISR ;get R1 to point here for interrupts. T = XP
0055 22 dec 2 ;R=2 is stack ptr. Point to free space
0056 78 sav ;T goes to MR(X)
0057 22 dec 2 ;fresh slot on stack
0058 52 str 2 ;D goes on stack
0059 c4 nop ;do other stuff
005a 30 53 br exit ;leave main part of ISR
0345 ORG $345
0345 11 22 33 0f DB $11,$22,$33,$0f,$55
0349 55
03fb ORG $3fb
03fb c4 nop
03fc c4 nop
03fd c4 nop
03fe c4 nop
03ff c4 nop
0400 END
0055 ISR 0000 START 0053 exit 000e loop0
0012 loop1
Subscribe to:
Post Comments (Atom)
Pi Pico and other Boards
Got a new Pi Pico and it looks very promising. Want to use Oled display with it.
-
Think I've got it. On 1802 I/O is almost like DMA. For OUT 1 (0x61) the byte cycle after instruction fetch puts the address in R(x) ...
-
Where we are at 23/3/2020 with 1802 project. Have 1802 hooked up to Arduino Mega2650 and running little programs that, for instance turn Q ...
-
JUst completed Mega 2650 board shield with 1802 on it. Used EasyEDA and sent design to JLPCB. Here's Schematic: and here's the p...
No comments:
Post a Comment