From 083ed795ec22cc51c3ee0f06bc0daf07c41fe266 Mon Sep 17 00:00:00 2001 From: Philip Zembrod Date: Tue, 18 Jun 2024 19:39:35 +0200 Subject: [PATCH] Port taskdemo.fth to the X16, directly writing to VERA's VRAM. --- 6502/C64/src/taskdemo-x16.fth | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 6502/C64/src/taskdemo-x16.fth diff --git a/6502/C64/src/taskdemo-x16.fth b/6502/C64/src/taskdemo-x16.fth new file mode 100644 index 0000000..4d1682c --- /dev/null +++ b/6502/C64/src/taskdemo-x16.fth @@ -0,0 +1,33 @@ +\ Taskdemo for X16 + +: taskmark ; \needs cbm>scr : cbm>scr ; + +\ This method of writing directly into the X16's screen memory +\ is a bit hacky and relies on the default settings that the +\ Kernal uses for text mode. +: scrstart ( -- adr) $b000 ; +: ctrl@ ( -- b ) $9f25 c@ ; +: addr-sel@ ( -- 0/1 ) ctrl@ 1 and ; +: datax! ( c -- ) $9f23 addr-sel@ + c! ; +: addrx-l/m! ( u -- ) $9f20 ! ; +: scr! ( scrcode vram-addr -- ) + addrx-l/m! datax! ; + +Variable counter counter off + +$100 $100 Task Background + +: >count ( n -) + Background 1 pass + counter ! + BEGIN counter @ -1 counter +! ?dup + WHILE pause 0 <# #s #> dup >r + 0 DO pause dup I + c@ cbm>scr + scrstart I 2* + scr! LOOP drop + bl r> 2* scrstart + scr! + REPEAT + BEGIN stop REPEAT ; \ stop's forever +: wait Background sleep ; +: go Background wake ; + +multitask $1000 >count page