Show Image File additions/fixes

* Make ESC key close
* Fix cursor glitch when closing if over menu
* Don't overlap input/window params - maybe fix MD bug?
This commit is contained in:
Joshua Bell 2017-09-18 19:50:16 -07:00
parent c39a8a5816
commit 2f1e20099d
4 changed files with 53 additions and 31 deletions

View File

@ -186,11 +186,11 @@ A2D_HIDE_CURSOR := $26
A2D_GET_INPUT := $2A A2D_GET_INPUT := $2A
;; (input length 0 bytes) ;; (input length 0 bytes)
;; (output length 5 bytes) ;; (output length 5 bytes)
;; .byte state (0=up, 1=press, 2=release, 3=key, 4=held) ;; .byte state (A2D_INPUT_*)
;; if state is not 3: ;; if state is A2D_INPUT_KEY:
;; .byte key (ASCII code; high bit clear) ;; .byte key (ASCII code; high bit clear)
;; .byte modifiers (0=none, 1=open-apple, 2=closed-apple, 3=both) ;; .byte modifiers (0=none, 1=open-apple, 2=closed-apple, 3=both)
;; if state is 3: ;; if state otherwise:
;; .word xcoord ;; .word xcoord
;; .word ycoord ;; .word ycoord

View File

@ -1,6 +1,6 @@
;;; HGR to DHR - Aux Mem Bytes ;;; HR to DHR - Aux Mem Bytes
hgr_to_dhr_aux: hr_to_dhr_aux:
.byte $00, $01, $06, $07, $18, $19, $1e, $1f .byte $00, $01, $06, $07, $18, $19, $1e, $1f
.byte $60, $61, $66, $67, $78, $79, $7e, $7f .byte $60, $61, $66, $67, $78, $79, $7e, $7f
.byte $00, $01, $06, $07, $18, $19, $1e, $1f .byte $00, $01, $06, $07, $18, $19, $1e, $1f
@ -34,8 +34,8 @@ hgr_to_dhr_aux:
.byte $00, $03, $0c, $0f, $30, $33, $3c, $3f .byte $00, $03, $0c, $0f, $30, $33, $3c, $3f
.byte $40, $43, $4c, $4f, $70, $73, $7c, $7f .byte $40, $43, $4c, $4f, $70, $73, $7c, $7f
;;; HGR to DHR - Main Mem Bytes ;;; HR to DHR - Main Mem Bytes
hgr_to_dhr_main: hr_to_dhr_main:
.byte $00, $80, $00, $80, $00, $80, $00, $80 .byte $00, $80, $00, $80, $00, $80, $00, $80
.byte $00, $80, $00, $80, $00, $80, $00, $80 .byte $00, $80, $00, $80, $00, $80, $00, $80
.byte $03, $83, $03, $83, $03, $83, $03, $83 .byte $03, $83, $03, $83, $03, $83, $03, $83

View File

@ -33,8 +33,8 @@ for (my $i = 0; $i < 256; ++$i) {
} }
print "\n"; print "\n";
print ";;; HGR to DHR - Aux Mem Bytes\n"; print ";;; HR to DHR - Aux Mem Bytes\n";
print "hgr_to_dhr_aux:\n"; print "hr_to_dhr_aux:\n";
for (my $i = 0; $i < 256; $i += 8) { for (my $i = 0; $i < 256; $i += 8) {
print " .byte "; print " .byte ";
for (my $j = 0; $j < 8; ++$j) { for (my $j = 0; $j < 8; ++$j) {
@ -44,8 +44,8 @@ for (my $i = 0; $i < 256; $i += 8) {
print "\n"; print "\n";
} }
print "\n"; print "\n";
print ";;; HGR to DHR - Main Mem Bytes\n"; print ";;; HR to DHR - Main Mem Bytes\n";
print "hgr_to_dhr_main:\n"; print "hr_to_dhr_main:\n";
for (my $i = 0; $i < 256; $i += 8) { for (my $i = 0; $i < 256; $i += 8) {
print " .byte "; print " .byte ";
for (my $j = 0; $j < 8; ++$j) { for (my $j = 0; $j < 8; ++$j) {

View File

@ -2,6 +2,7 @@
.org $800 .org $800
.include "apple2.inc" .include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc" .include "../inc/prodos.inc"
.include "../inc/auxmem.inc" .include "../inc/auxmem.inc"
.include "a2d.inc" .include "a2d.inc"
@ -188,7 +189,7 @@ data: .res 64, 0
params_end: params_end:
;;; ---------------------------------------- ;;; ----------------------------------------
window_id := $64 window_id := 100
.proc line_pos .proc line_pos
left: .word 0 left: .word 0
@ -198,6 +199,16 @@ base: .word 0
.proc input_params ; queried to track mouse-up .proc input_params ; queried to track mouse-up
state: .byte $00 state: .byte $00
;;; if state is A2D_INPUT_KEY
key := *
modifiers := *+1
;;; otherwise
xcoord := *
ycoord := *+2
.res 4 ; space for both
.endproc .endproc
default_width := 560 default_width := 560
@ -355,13 +366,12 @@ end: rts
sta read_params::ref_num sta read_params::ref_num
sta close_params::ref_num sta close_params::ref_num
A2D_CALL A2D_HIDE_CURSOR
jsr stash_menu jsr stash_menu
;; create window
A2D_CALL A2D_CREATE_WINDOW, window_params A2D_CALL A2D_CREATE_WINDOW, window_params
A2D_CALL A2D_SET_STATE, window_params::box A2D_CALL A2D_SET_STATE, window_params::box
jsr show_file jsr show_file
A2D_CALL A2D_SHOW_CURSOR
A2D_CALL $2B ; ??? A2D_CALL $2B ; ???
;; fall through ;; fall through
@ -373,18 +383,31 @@ end: rts
.proc input_loop .proc input_loop
A2D_CALL A2D_GET_INPUT, input_params A2D_CALL A2D_GET_INPUT, input_params
lda input_params::state lda input_params::state
cmp #1 ; was clicked? cmp #A2D_INPUT_DOWN ; was clicked?
bne input_loop ; nope, keep waiting beq exit
cmp #A2D_INPUT_KEY ; any key?
beq on_key
bne input_loop
on_key:
lda input_params::modifiers
bne input_loop
lda input_params::key
cmp #KEY_ESCAPE
beq exit
bne input_loop
exit:
A2D_CALL A2D_HIDE_CURSOR
A2D_CALL A2D_DESTROY_WINDOW, window_params A2D_CALL A2D_DESTROY_WINDOW, window_params
DESKTOP_CALL DESKTOP_REDRAW_ICONS DESKTOP_CALL DESKTOP_REDRAW_ICONS
jsr unstash_menu jsr unstash_menu
A2D_CALL A2D_SHOW_CURSOR
rts ; exits input loop rts ; exits input loop
.endproc .endproc
.proc show_file .proc show_file
A2D_CALL A2D_HIDE_CURSOR
jsr get_file_eof jsr get_file_eof
;; If bigger than $2000, assume DHR ;; If bigger than $2000, assume DHR
@ -397,22 +420,21 @@ end: rts
sbc #^(hires_size+1) sbc #^(hires_size+1)
bcs dhr bcs dhr
jsr show_shr_file jsr show_hr_file
jmp close jmp close
dhr: jsr show_dhr_file dhr: jsr show_dhr_file
close: jsr close_file close: jsr close_file
A2D_CALL A2D_SHOW_CURSOR
rts rts
.endproc .endproc
.proc show_shr_file .proc show_hr_file
sta PAGE2OFF sta PAGE2OFF
jsr read_file jsr read_file
jsr close_file jsr close_file
jsr hgr_to_dhr jsr hr_to_dhr
rts rts
.endproc .endproc
@ -434,9 +456,9 @@ close: jsr close_file
;;; Convert single hires to double hires ;;; Convert single hires to double hires
;;; Assumes the image is loaded to MAIN $2000 and ;;; Assumes the image is loaded to MAIN $2000 and
;;; relies on the hgr_to_dhr.inc table. ;;; relies on the hr_to_dhr.inc table.
.proc hgr_to_dhr .proc hr_to_dhr
ptr := $06 ptr := $06
rows := 192 rows := 192
cols := 40 cols := 40
@ -462,10 +484,10 @@ cloop: lda (ptr),y
;; complex case - need to spill in bit from prev col and store ;; complex case - need to spill in bit from prev col and store
lda hgr_to_dhr_aux,x lda hr_to_dhr_aux,x
sta PAGE2ON sta PAGE2ON
sta (ptr),y sta (ptr),y
lda hgr_to_dhr_main,x lda hr_to_dhr_main,x
ora spill ; apply previous spill bit (to bit 6) ora spill ; apply previous spill bit (to bit 6)
sta PAGE2OFF sta PAGE2OFF
sta (ptr),y sta (ptr),y
@ -478,10 +500,10 @@ cloop: lda (ptr),y
hibitset: hibitset:
;; simple case - no bit spillage ;; simple case - no bit spillage
lda hgr_to_dhr_aux,x lda hr_to_dhr_aux,x
sta PAGE2ON sta PAGE2ON
sta (ptr),y sta (ptr),y
lda hgr_to_dhr_main,x lda hr_to_dhr_main,x
sta PAGE2OFF sta PAGE2OFF
sta (ptr),y sta (ptr),y
@ -614,4 +636,4 @@ cloop: lda (src),y
.endproc .endproc
.include "inc/hires_table.inc" .include "inc/hires_table.inc"
.include "inc/hgr_to_dhr.inc" .include "inc/hr_to_dhr.inc"