From 9b84076f0a3db7be57325f2251b4cc3b725df8f7 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 1 Oct 2018 13:40:32 +0100 Subject: [PATCH] sam: update to new irq, tty logic --- Kernel/platform-sam/sam.s | 20 +++++++++++++++++++- Kernel/platform-sam/sam_vt.s | 31 +++++++------------------------ Kernel/platform-sam/tricks.s | 1 + 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Kernel/platform-sam/sam.s b/Kernel/platform-sam/sam.s index 68304b55..de2cdd3f 100644 --- a/Kernel/platform-sam/sam.s +++ b/Kernel/platform-sam/sam.s @@ -22,6 +22,7 @@ .globl _platform_copier_l .globl _platform_copier_h .globl _keyscan + .globl _int_disabled ; exported debugging tools .globl _platform_monitor @@ -66,6 +67,9 @@ _platform_reboot: out (250), a ; ROM appears low rst 0 ; bang +_int_disabled: + .db 1 + ; ----------------------------------------------------------------------------- ; We have discard mapped high up so we can map stuff under it ; during setup. All of discard gets reclaimed when init is run @@ -176,14 +180,28 @@ map_page_low: or #0x20 ; force ROM off out (250),a ret +; +; The video map requires interrupt disables. Do the disable in +; map_video. Save the old state in af' and then restore int in +; unmap_video +; +; map_video: + ld a,(_int_disabled) + ex af,af' + di in a,(250) ld (video_save),a ld a,#VIDEO_LOW jr map_page_low unmap_video: ld a,(video_save) - jr map_page_low + call map_page_low + ex af,af' + or a + ret nz + ei + ret _program_vectors: ; we are called, with interrupts disabled, by both newproc() and crt0 diff --git a/Kernel/platform-sam/sam_vt.s b/Kernel/platform-sam/sam_vt.s index 6eb46f32..045f327d 100644 --- a/Kernel/platform-sam/sam_vt.s +++ b/Kernel/platform-sam/sam_vt.s @@ -32,7 +32,6 @@ .globl map_video .globl unmap_video - .globl ___hard_di _fontdata_8x8_exp2 .equ 0x6000 ; in video bank @@ -63,30 +62,21 @@ base_addr: ; hell out of everything else. For now just di. 32K/32K splits suck ; _scroll_up: - call ___hard_di - push af call map_video ld hl,#1024 ld de,#0 ld bc,#24576-1024 -ldir_pop: ldir pop_unmap: - call unmap_video - pop af - ret c - ei - ret + jp unmap_video _scroll_down: - call ___hard_di - push af call map_video ld hl,#24575-1024 ld de,#24575 ld bc,#24576 lddr - jr pop_unmap + jp unmap_video _plot_char: pop hl ; return @@ -95,8 +85,6 @@ _plot_char: push bc push de push hl - call ___hard_di - push af call base_addr ld h,#0 ld l,c @@ -168,15 +156,13 @@ plot_loop_slow: ex af,af' dec a jr nz, plot_loop_slow - jr pop_unmap + jp unmap_video _clear_lines: pop hl pop de push de push hl - call ___hard_di - push af ld a,d ; count (0-23) ld d,#0 ; Now how much to copy ? @@ -192,7 +178,8 @@ _clear_lines: inc de dec bc ld (hl),#0 - jp ldir_pop + ldir + jp unmap_video _clear_across: pop hl @@ -202,9 +189,6 @@ _clear_across: push de push hl - call ___hard_di - push af - call base_addr call map_video @@ -224,7 +208,7 @@ wipe_rowpair: inc d ; to worry about carries just restore low, inc high dec l jr nz, wipe_line - jp pop_unmap + jp unmap_video _vtwipe: call map_video @@ -233,8 +217,7 @@ _vtwipe: ld bc,#24575 ld (hl),#0 ldir - call unmap_video - ret + jp unmap_video ; ; TODO ; diff --git a/Kernel/platform-sam/tricks.s b/Kernel/platform-sam/tricks.s index 127d4f31..b507876b 100644 --- a/Kernel/platform-sam/tricks.s +++ b/Kernel/platform-sam/tricks.s @@ -111,6 +111,7 @@ skip_copyback: ; if we pre-empted in an ISR IRQ's stay off, if not they get enabled ld a, (U_DATA__U_ININTERRUPT) + ld (_int_disabled), a or a ret nz ei -- 2.34.1