Skip to content

Commit

Permalink
New DA: Screenshot; rename "Screen Dump" to "Print Screen"
Browse files Browse the repository at this point in the history
The new DA writes out a graphics file named "Screenshot" to the
application directory i.e. where DeskTop.system lives. If there is an
existing file it will be overwritten. It lives in Extras, but it is
most useful when added to the Apple Menu or as a Shortcut.

Also, to make it easier to distinguish this DA (especially in
localized builds), the "Screen Dump" DA was renamed to "Print Screen"
  • Loading branch information
inexorabletash committed Dec 26, 2024
1 parent b82b9f2 commit 99f61f1
Show file tree
Hide file tree
Showing 16 changed files with 154 additions and 23 deletions.
4 changes: 3 additions & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ Project Page: https://github.com/a2stuff/a2d
* Detect Pravetz 8A/C
* Detect Passport MIDI card
* Show duplicate SmartPort device names with counts.
* Screen Dump
* Print Screen
* Renamed from "Screen Dump"
* Improve use of SSC and IW2.
* Show alert on startup if no SSC found.
* Don't corrupt "File" on menu bar. ([#810](https://github.com/a2stuff/a2d/issues/810))
Expand All @@ -53,6 +54,7 @@ Project Page: https://github.com/a2stuff/a2d
* Show alert on startup if no printer card found.
* Options: Add option to show invisible files.
* Calendar: Allow modifiers when clicking, double-modifiers for decade. ([#693](https://github.com/a2stuff/a2d/issues/693))
* New DA (in Extras): "Screenshot" - saves screenshot file to application directory.

### Misc

Expand Down
6 changes: 4 additions & 2 deletions desk.acc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@

* [Darkness](darkness.s)
* A debugging tool that paints the whole screen a dark pattern.
* [Screen Dump](screen.dump.s)
* Dumps a screenshot to an ImageWriter II attached to a Super Serial Card in Slot 1.
* [Print Screen](print.screen.s)
* Prints a screenshot to an ImageWriter II attached to a Super Serial Card in Slot 1.
* [Screenshot](screenshot.dump.s)
* Saves a screenshot to the application directory.
* [Benchmark](benchmark.s)
* Measures CPU speed using VBL.

Expand Down
8 changes: 4 additions & 4 deletions desk.acc/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ find.files Apple.Menu optional
key.caps Apple.Menu optional
run.basic.here Apple.Menu optional
sort.directory Apple.Menu optional
cd.remote Extras extra
benchmark Extras extra
cd.remote Extras extra
darkness Extras extra
sci.calc Extras extra
screen.dump Extras extra
print.catalog Extras extra
print.screen Extras extra
round.corners Extras extra

sci.calc Extras extra
screenshot Extras extra
2 changes: 1 addition & 1 deletion desk.acc/screen.dump.s → desk.acc/print.screen.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
;;; ============================================================
;;; SCREEN.DUMP - Desk Accessory
;;; PRINT.SCREEN - Desk Accessory
;;;
;;; Dumps the contents of the graphics screen to an ImageWriter
;;; printer connected to a Super Serial Card in Slot 1.
Expand Down
3 changes: 2 additions & 1 deletion desk.acc/res/filenames.res.da
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
.define res_filename_puzzle "Gade"
.define res_filename_sort_directory "Sort.Mappe"
.define res_filename_eyes "Ojne"
.define res_filename_screen_dump "Skaerm.Dump"
.define res_filename_print_screen "Print.Skaerm"
.define res_filename_screenshot "Skaermbillede"
.define res_filename_run_basic_here "Kore.BASIC.Her"
.define res_filename_key_caps "Noglehaetter"
.define res_filename_find_files "Finde.Filer"
Expand Down
3 changes: 2 additions & 1 deletion desk.acc/res/filenames.res.de
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
.define res_filename_puzzle "Puzzle"
.define res_filename_sort_directory "Dir.Sortieren"
.define res_filename_eyes "Augen"
.define res_filename_screen_dump "Bildschirm.Drck"
.define res_filename_print_screen "Druckbildschirm"
.define res_filename_screenshot "Bildschirmfoto"
.define res_filename_run_basic_here "BASIC.Hier"
.define res_filename_key_caps "Tastenkappen"
.define res_filename_find_files "Dateien.Suchen"
Expand Down
3 changes: 2 additions & 1 deletion desk.acc/res/filenames.res.en
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
.define res_filename_puzzle "Puzzle"
.define res_filename_sort_directory "Sort.Directory"
.define res_filename_eyes "Eyes"
.define res_filename_screen_dump "Screen.Dump"
.define res_filename_print_screen "Print.Screen"
.define res_filename_screenshot "Screenshot"
.define res_filename_run_basic_here "Run.BASIC.Here"
.define res_filename_key_caps "Key.Caps"
.define res_filename_find_files "Find.Files"
Expand Down
3 changes: 2 additions & 1 deletion desk.acc/res/filenames.res.es
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
.define res_filename_puzzle "Puzzle"
.define res_filename_sort_directory "Ordenar.Dir"
.define res_filename_eyes "Ojos"
.define res_filename_screen_dump "Imprimir.Pantal"
.define res_filename_print_screen "Imprimir.Pantal"
.define res_filename_screenshot "Captura.Pantal"
.define res_filename_run_basic_here "BASIC.Aqui"
.define res_filename_key_caps "Mayusculas"
.define res_filename_find_files "Buscar.Archivos"
Expand Down
3 changes: 2 additions & 1 deletion desk.acc/res/filenames.res.fr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
.define res_filename_puzzle "Puzzle"
.define res_filename_sort_directory "Repertoire.Tri"
.define res_filename_eyes "Yeux"
.define res_filename_screen_dump "Imprimer.Ecran"
.define res_filename_print_screen "Imprimer.Ecran"
.define res_filename_screenshot "Capture.Ecran"
.define res_filename_run_basic_here "Basic.Ici"
.define res_filename_key_caps "Touches"
.define res_filename_find_files "Recherche.Fich"
Expand Down
3 changes: 2 additions & 1 deletion desk.acc/res/filenames.res.it
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
.define res_filename_puzzle "Puzzle"
.define res_filename_sort_directory "Ordina.Dir"
.define res_filename_eyes "Occhi"
.define res_filename_screen_dump "Stampa.Schermo"
.define res_filename_print_screen "Stampa.Schermo"
.define res_filename_screenshot "Schermata"
.define res_filename_run_basic_here "Apri.BASIC.Qui"
.define res_filename_key_caps "Tastiera"
.define res_filename_find_files "Cerca.File"
Expand Down
3 changes: 2 additions & 1 deletion desk.acc/res/filenames.res.nl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
.define res_filename_puzzle "Puzzel"
.define res_filename_sort_directory "Sorteer.Map"
.define res_filename_eyes "Ogen"
.define res_filename_screen_dump "Scherm.Dump"
.define res_filename_print_screen "Afdruk.Scherm"
.define res_filename_screenshot "Schermafdruk"
.define res_filename_run_basic_here "BASIC.Hier"
.define res_filename_key_caps "Toetsenbord"
.define res_filename_find_files "Zoek.Bestanden"
Expand Down
3 changes: 2 additions & 1 deletion desk.acc/res/filenames.res.pt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
.define res_filename_puzzle "Puzzle"
.define res_filename_sort_directory "Ordenar.Dir"
.define res_filename_eyes "Olhos"
.define res_filename_screen_dump "Imprimem.A.Tela"
.define res_filename_print_screen "Imprimem.A.Tela"
.define res_filename_screenshot "Captura.Tela"
.define res_filename_run_basic_here "BASIC.Aqui"
.define res_filename_key_caps "Letras.Teclado"
.define res_filename_find_files "Procurar.Arquiv"
Expand Down
3 changes: 2 additions & 1 deletion desk.acc/res/filenames.res.sv
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
.define res_filename_puzzle "Pussel"
.define res_filename_sort_directory "Sortera.Katalog"
.define res_filename_eyes "Ogon"
.define res_filename_screen_dump "Skarmdump"
.define res_filename_print_screen "Utskrift.Skarm"
.define res_filename_screenshot "Skarmdump"
.define res_filename_run_basic_here "Kor.BASIC.Har"
.define res_filename_key_caps "Nyckellayout"
.define res_filename_find_files "Hitta.Filer"
Expand Down
118 changes: 118 additions & 0 deletions desk.acc/screenshot.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
;;; ============================================================
;;; SCREENSHOT - Desk Accessory
;;;
;;; Saves the contents of the graphics screen to a file.
;;; ============================================================

.include "../config.inc"

.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/macros.inc"
.include "../inc/prodos.inc"
.include "../mgtk/mgtk.inc"
.include "../common.inc"
.include "../desktop/desktop.inc"

;;; ============================================================

DA_HEADER
DA_START_MAIN_SEGMENT

;;; ============================================================

jmp start

;;; ============================================================

kBlockSize = $200
BLOCK_BUFFER := DA_IO_BUFFER - kBlockSize
.assert .lobyte(BLOCK_BUFFER) = 0, error, "page align"

DEFINE_CREATE_PARAMS create_params, filename, ACCESS_DEFAULT, FT_GRAPHICS, $2000
DEFINE_OPEN_PARAMS open_params, filename, DA_IO_BUFFER
DEFINE_WRITE_PARAMS write_block_params, BLOCK_BUFFER, kBlockSize
DEFINE_WRITE_PARAMS write_screen_params, $2000, $2000
DEFINE_CLOSE_PARAMS close_params


filename:
PASCAL_STRING "Screenshot"


;;; ============================================================

start: JUMP_TABLE_MGTK_CALL MGTK::HideCursor
jsr JUMP_TABLE_HILITE_MENU

JUMP_TABLE_MLI_CALL CREATE, create_params
bcc :+
cmp #ERR_DUPLICATE_FILENAME
bne done
:
JUMP_TABLE_MLI_CALL OPEN, open_params
bcs done
lda open_params::ref_num
sta write_block_params::ref_num
sta write_screen_params::ref_num
sta close_params::ref_num

;; ----------------------------------------
;; Aux Segment

;; Mark Graphics file as "560 x 192 Black & White"
;; See File Type Note $08
sta SET80STORE
sta PAGE2ON
lda #2
sta $2000+$78
sta PAGE2OFF
sta CLR80STORE

;; Can't write it with 80STORE on since banking not guaranteed
;; during ProDOS I/O (e.g. aux RAM disks), so do it block by
;; block.
ptr := $06
copy16 #$2000, ptr
ldy #$00

block_loop:
sta SET80STORE
sta PAGE2ON
: lda (ptr),y
sta BLOCK_BUFFER,y
iny
bne :-
inc ptr+1
: lda (ptr),y
sta BLOCK_BUFFER+$100,y
iny
bne :-
inc ptr+1
sta PAGE2OFF
sta CLR80STORE

JUMP_TABLE_MLI_CALL WRITE, write_block_params

lda ptr+1
cmp #$40
bne block_loop

;; ----------------------------------------
;; Write main segment

;; Just write directly
JUMP_TABLE_MLI_CALL WRITE, write_screen_params

close: JUMP_TABLE_MLI_CALL CLOSE, close_params

done: jsr JUMP_TABLE_HILITE_MENU
JUMP_TABLE_MGTK_CALL MGTK::ShowCursor
rts


;;; ============================================================

DA_END_MAIN_SEGMENT

;;; ============================================================
2 changes: 1 addition & 1 deletion inc/prodos.inc
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ DRIVER_COMMAND_FORMAT = 3
.endmacro


.macro DEFINE_OPEN_PARAMS name, pn, io, rn
.macro DEFINE_OPEN_PARAMS name, pn, io
.if .xmatch(.string(pn), "pathname")
;; If 'pathname' is passed then expansion yields a circular reference.
.error "Can't pass 'pathname' label to DEFINE_*_PARAMS"
Expand Down
10 changes: 5 additions & 5 deletions res/notes/testplan.md
Original file line number Diff line number Diff line change
Expand Up @@ -1136,12 +1136,12 @@ With Sci.Calc:

* Launch DeskTop. Open a window with at least two files. Apple Menu > Find Files. Type "*" and click Search. Press Down Arrow once. Type Return. Press Down Arrow again. Verify that only one entry in the list appears highlighted.

## Screen Dump
## Print Screen

* Configure a system with an SSC in Slot 1 and an ImageWriter II. Invoke the Screen Dump DA. Verify it prints a screenshot.
* Configure a system with a non-SSC in Slot 1. Invoke the Screen Dump DA. Verify nothing happens.
* Configure a system with an SSC in Slot 1 and an ImageWriter II. Invoke the Screen Dump DA. Invoke the Print Catalog DA. Verify that the catalog is printed on separate lines, not all overprinted on the same line onto one.
* Using MAME (e.g. via Ample), configure a system with an SSC in Slot 1 and a Serial Printer. Invoke the Screen Dump DA. Verify that the File menu is not corrupted.
* Configure a system with an SSC in Slot 1 and an ImageWriter II. Invoke the Print Screen DA. Verify it prints a screenshot.
* Configure a system with a non-SSC in Slot 1. Invoke the Print Screen DA. Verify nothing happens.
* Configure a system with an SSC in Slot 1 and an ImageWriter II. Invoke the Print Screen DA. Invoke the Print Catalog DA. Verify that the catalog is printed on separate lines, not all overprinted on the same line onto one.
* Using MAME (e.g. via Ample), configure a system with an SSC in Slot 1 and a Serial Printer. Invoke the Print Screen DA. Verify that the File menu is not corrupted.

# Shortcuts (Module)

Expand Down

0 comments on commit 99f61f1

Please sign in to comment.