summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
21c909d)
- The INTERRUPT macro inserts the right jump instruction (rjmp/jmp) in the interrupt vector table.
* new functions: dram_read[w]_pp, dram_write[w]_pp
- read/write byte/word with address autoincrement.
* Affected files:
- avr/macros.inc
- avr/hw-uart.asm
- avr/sw-uart.asm
- avr/remainders.asm
- avr/init.asm
- avr/dram-8bit.asm
- avr/dram-8bit.asm
- avr/avrcpm.asm
- avr/config.inc
git-svn-id: svn://cu.loc/avr-cpm/trunk/avrcpm/avr@108
57430480-672e-4586-8877-
bcf8adbbf3b7
.include "hw-uart.asm"
.include "dram-4bit.asm"
#endif
.include "hw-uart.asm"
.include "dram-4bit.asm"
#endif
.include "remainders.asm"
; >>>-------------------------------------- Virtual Devices
.include "remainders.asm"
; >>>-------------------------------------- Virtual Devices
; <<<-------------------------------------- File System Management
; .include "z80int.asm" ;Old 8080 interpreter.
; .include "8080int.asm" ;New 8080 interpreter.
; <<<-------------------------------------- File System Management
; .include "z80int.asm" ;Old 8080 interpreter.
; .include "8080int.asm" ;New 8080 interpreter.
-; .include "8080int-t3.asm"
-; .include "8080int-t3-jmp.asm"
- .include "8080int-jmp.asm"
+; .include "8080int-t3.asm" ;Another 8080 interpreter
+; .include "8080int-t3-jmp.asm" ;Can't get enough
+ .include "8080int-jmp.asm" ;
.equ MEMFILL = 1
.equ STACK_DBG = 0
.equ PRINT_PC = 0
.equ MEMFILL = 1
.equ STACK_DBG = 0
.equ PRINT_PC = 0
#define MMC_SPI2X 1 /* 0 = SPI CLK/4, 1 = SPI CLK/2 */
#define MMC_SPI2X 1 /* 0 = SPI CLK/4, 1 = SPI CLK/2 */
+; -------------------------------------------------------------------
+
+dram_readw_pp:
+ rcall dram_read
+ adiw x,1
+ push temp
+ rcall dram_read
+ adiw x,1
+ mov temp2,temp
+ pop temp
+ ret
+
+dram_read_pp:
+ rcall dram_read
+ adiw x,1
+ ret
+
+; -------------------------------------------------------------------
+
+dram_writew_pp:
+ push temp2
+ rcall dram_write
+ adiw x,1
+ pop temp
+dram_write_pp:
+ rcall dram_write
+ adiw x,1
+ ret
+
+; -------------------------------------------------------------------
; vim:set ts=8 noet nowrap
; vim:set ts=8 noet nowrap
+; -------------------------------------------------------------------
+
+dram_readw_pp:
+ rcall dram_read
+ adiw x,1
+ push temp
+ rcall dram_read
+ adiw x,1
+ mov temp2,temp
+ pop temp
+ ret
+
+dram_read_pp:
+ rcall dram_read
+ adiw x,1
+ ret
+
+; -------------------------------------------------------------------
+
+dram_writew_pp:
+ rcall dram_write
+ adiw x,1
+ mov temp,temp2
+dram_write_pp:
+ rcall dram_write
+ adiw x,1
+ ret
+
+
+; -------------------------------------------------------------------
+; vim:set ts=8 noet nowrap
; Save received character in a circular buffer. Do nothing if buffer overflows.
; Save received character in a circular buffer. Do nothing if buffer overflows.
-rxint:
- .org URXCaddr
- rjmp rxint ; USART receive int.
+; USART receive interrupt
+
+ INTERRUPT URXCaddr
push temp
in temp,sreg
push temp
push temp
in temp,sreg
push temp
-txint:
- .org UDREaddr
- rjmp txint ; USART transmit int.
+; USART transmit interrupt
+
+ INTERRUPT UDREaddr
push temp
in temp,sreg
push temp
push temp
in temp,sreg
push temp
; Various functions: init, (RAM) disk, mmc, timer
; Various functions: init, (RAM) disk, mmc, timer
-; This file needs to get split up.
;
; Copyright (C) 2010 Sprite_tm
; Copyright (C) 2010 Leo C.
;
; Copyright (C) 2010 Sprite_tm
; Copyright (C) 2010 Leo C.
ramtestw:
mov temp,xh
eor temp,xl
ramtestw:
mov temp,xh
eor temp,xl
brcc ramtestw
printstring "wait..."
ldi temp2,8
ramtestwl:
ldi temp,255
brcc ramtestw
printstring "wait..."
ldi temp2,8
ramtestwl:
ldi temp,255
ldiw x,0
ramfillw:
ldi temp,MEMFILL_VAL
ldiw x,0
ramfillw:
ldi temp,MEMFILL_VAL
printnewline
printstring "Partinit done."
printnewline
printstring "Partinit done."
- rcall dsk_cboot ;init (de)blocking buffer\r
+ rcall dsk_cboot ;init (de)blocking buffer
-; Read first sector of first CP/M partition
+; Read first sector of first CP/M partition (ipl)
lds xl,hostparttbl+1
lds xh,hostparttbl+2
lds xl,hostparttbl+1
lds xh,hostparttbl+2
lds yh,hostparttbl+4
rcall mmcReadSect
lds yh,hostparttbl+4
rcall mmcReadSect
- rcall dsk_cboot ;init (de)blocking buffer
+; rcall dsk_cboot ;init (de)blocking buffer
;First sector of disk or first CP/M partition is in hostbuf.
;First sector of disk or first CP/M partition is in hostbuf.
ldiw x,IPLADDR
iplwriteloop:
ld temp,z+
ldiw x,IPLADDR
iplwriteloop:
ld temp,z+
cpi zl,low(hostbuf+128)
brne iplwriteloop
cpi zh,high(hostbuf+128)
cpi zl,low(hostbuf+128)
brne iplwriteloop
cpi zh,high(hostbuf+128)
sbci @0h, high(-@1)
.endm
sbci @0h, high(-@1)
.endm
+;------------------------------------------------
+; sub 16 bit constant from register pair
+
+.macro subiw
+ subi @0l, low(@1)
+ sbci @0h, high(@1)
+.endm
+
;------------------------------------------------
; Move single bit between two registers
;
;------------------------------------------------
; Move single bit between two registers
;
+;------------------------------------------------
+;
+;
+;
+.macro INTERRUPT
+ .set pos_ = PC
+ .org @0 ; vector address
+ .if abs(pos_ - PC) > 2048
+ jmp pos_
+ .else
+ rjmp pos_ ; jump to handler
+ .endif
+ .org pos_ ; restore PC
+.endm
+
;------------------------------------------------
; Print string.
; printstring "String"
;------------------------------------------------
; Print string.
; printstring "String"
; ------------------- DRAM Refresh Interrupt --------------------
.cseg
; ------------------- DRAM Refresh Interrupt --------------------
.cseg
-; refresh interupt; exec 2 cbr cycles
-refrint: ;4
- .org OC2Aaddr
- rjmp refrint ; tim2cmpa
+; Refresh interupt; exec 2 cbr cycles
+
+ INTERRUPT OC2Aaddr
+
sbis P_RAS,ram_ras ;2
reti
; CAS RAS
sbis P_RAS,ram_ras ;2
reti
; CAS RAS
; ****************************************************************************
; ****************************************************************************
-sysclockint:
- .org OC1Baddr ; Timer/Counter1 Compare Match B
- rjmp sysclockint ; 1ms system timer
+; Timer/Counter1 Compare Match B interrupt
+
+ INTERRUPT OC1Baddr
+
push zl
in zl,SREG
push zl
push zl
in zl,SREG
push zl
;------------------------------------------------------------------
.cseg
;------------------------------------------------------------------
.cseg
-srxint:
- .org ICP1addr ; Timer/Counter1 Input Capture
- rjmp srxint ; Soft UART: RX
+; Timer/Counter1 Input Capture interrupt
+
+ INTERRUPT ICP1addr
;----------------------------------------------------------------------
.cseg
;----------------------------------------------------------------------
.cseg
-stxint:
- .org OC1Aaddr ; Timer/Counter1 Compare Match A
- rjmp stxint ; Soft UART: TX
+; Timer/Counter1 Compare Match A interrupt
+
+ INTERRUPT OC1Aaddr