From b3d818da39f340b64939874a3d7270410de0e23a Mon Sep 17 00:00:00 2001 From: marcobaye Date: Sat, 30 Jun 2018 20:59:42 +0000 Subject: [PATCH] ACME_Lib: added some more comments git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@99 4df02467-bbd4-4a76-a152-e7ce94205b78 --- ACME_Lib/cbm/c128/kernal.a | 10 +++--- ACME_Lib/cbm/c64/cia2.a | 7 ++++ ACME_Lib/cbm/kernal.a | 72 ++++++++++++++++++++++++++++---------- 3 files changed, 67 insertions(+), 22 deletions(-) diff --git a/ACME_Lib/cbm/c128/kernal.a b/ACME_Lib/cbm/c128/kernal.a index 085e933..e8b1ad4 100644 --- a/ACME_Lib/cbm/c128/kernal.a +++ b/ACME_Lib/cbm/c128/kernal.a @@ -9,7 +9,7 @@ lib_cbm_c128_kernal_a = 1 !address { k_spin_spout = $ff47 k_close_all = $ff4a - k_c64mode = $ff4d + k_c64mode = $ff4d ; enter c64 mode (so does not return) k_dma_call = $ff50 k_boot_call = $ff53 k_phoenix = $ff56 @@ -18,17 +18,19 @@ lib_cbm_c128_kernal_a = 1 k_swapper = $ff5f k_dlchr = $ff62 k_pfkey = $ff65 - k_setbnk = $ff68 + k_setbnk = $ff68 ; set banks for file name and load/save calls k_getcfg = $ff6b k_jsrfar = $ff6e k_jmpfar = $ff71 k_indfet = $ff74 k_indsta = $ff77 k_indcmp = $ff7a - k_primm = $ff7d + k_primm = $ff7d ; "print immediate" - output string without having to setup a pointer: + ; string must follow JSR $ff7d in memory, code execution will resume after terminating zero. + ; A/X/Y are preserved k_release_number = $ff80 } -!source ; $ff81-$fff5 is backward compatible to older machines +!source ; $ff81-$fff5 is mostly compatible to older machines ; $fff6/$fff7 are unused (ff ff) !address { k_indirect128mode = $fff8 ; indirect vector, without JMP command! diff --git a/ACME_Lib/cbm/c64/cia2.a b/ACME_Lib/cbm/c64/cia2.a index c1c8877..cf2690a 100644 --- a/ACME_Lib/cbm/c64/cia2.a +++ b/ACME_Lib/cbm/c64/cia2.a @@ -5,6 +5,13 @@ lib_cbm_c64_cia2_a = 1 !address { cia2_pra = $dd00 + ; %7....... DATA in (0 means GND) + ; %.6...... CLK in (0 means GND) + ; %..5..... DATA out (inverted, 1 means GND) + ; %...4.... CLK out (inverted, 1 means GND) + ; %....3... ATN out (inverted, 1 means GND) + ; %.....2.. PA2 (pin M at user port, 0 means GND) + ; %......10 VIC bank (inverted, so value $3 means address $0000) cia2_prb = $dd01 cia2_ddra = $dd02 cia2_ddrb = $dd03 diff --git a/ACME_Lib/cbm/kernal.a b/ACME_Lib/cbm/kernal.a index 46f2647..9d4818f 100644 --- a/ACME_Lib/cbm/kernal.a +++ b/ACME_Lib/cbm/kernal.a @@ -8,8 +8,10 @@ lib_cbm_kernal_a = 1 ; There are alternative names for some calls. !address { + ; for additional c128 calls, see k_cint = $ff81 k_ioinit = $ff84 + ; cbm-ii rom starts here: k_ramtas = $ff87 k_restor = $ff8a k_vector = $ff8d @@ -27,24 +29,58 @@ lib_cbm_kernal_a = 1 k_listen = $ffb1:k_listn = $ffb1 k_talk = $ffb4 k_readss = $ffb7 - k_setlfs = $ffba - k_setnam = $ffbd ; A is length, X is ptr-low, Y is ptr-high - k_open = $ffc0 - k_close = $ffc3:k_close_A = $ffc3 - k_chkin = $ffc6:k_chkin_X = $ffc6 - k_chkout = $ffc9:k_chkout_X = $ffc9:k_ckout = $ffc9 - k_clrchn = $ffcc:k_clrch = $ffcc - k_chrin = $ffcf:k_basin = $ffcf - k_chrout = $ffd2:k_basout = $ffd2:k_bsout = $ffd2 - k_load = $ffd5:k_load_AXY = $ffd5 ; A means verify, YYXX is desired load address (if channel == 0), returns end+1 in YYXX - k_save = $ffd8:k_save_AXY = $ffd8 ; A is zp address of start ptr(!), YYXX is end address (+1) - k_settim = $ffdb - k_rdtim = $ffde - k_stop = $ffe1 - k_getin = $ffe4:k_get = $ffe4 + k_setlfs = $ffba ; set file parameters (A = logical file number, X = device, Y = secondary address) + k_setnam = $ffbd ; set file name (A = length, YYXX = pointer) + ; pet rom starts here: + ; i/o calls: most of these set C on error. in that case, A holds error code. + k_open = $ffc0 ; open channel/file (call setlfs/setnam before!) + k_close = $ffc3:k_close_A = $ffc3 ; close channel/file (A = logical file number) + k_chkin = $ffc6:k_chkin_X = $ffc6 ; set input channel (X = logical file number) + k_chkout = $ffc9:k_chkout_X = $ffc9:k_ckout = $ffc9 ; set output channel (X = logical file number) + k_clrchn = $ffcc:k_clrch = $ffcc ; restore default input/output channels + k_chrin = $ffcf:k_basin = $ffcf ; read byte from current input channel (not the same as $ffe4, see note* below) + ; A is result byte + ; X is preserved + ; Y gets clobbered by tape access (preserved by disk access) + k_chrout = $ffd2:k_basout = $ffd2:k_bsout = $ffd2 ; send byte to current output channel + ; A/X/Y are preserved + k_load = $ffd5:k_load_AXY = $ffd5 ; load file to memory, or verify (call setlfs/setnam before!) + ; A: zero means LOAD, nonzero means VERIFY + ; YYXX is desired load address (only used if secondary address == 0), returns end address plus 1 + k_save = $ffd8:k_save_AXY = $ffd8 ; save memory to file (call setlfs/setnam before!) + ; A is zp address of start ptr(!) + ; YYXX is end address plus 1 + k_settim = $ffdb ; set time + k_rdtim = $ffde ; read time + k_stop = $ffe1 ; check STOP key + k_getin = $ffe4:k_get = $ffe4 ; get input byte (not the same as $ffcf, see note* below) + ; A is result byte + ; X is preserved + ; Y gets clobbered by tape access (preserved by disk access) k_clall = $ffe7 k_udtim = $ffea - k_scrorg = $ffed - k_plot = $fff0:k_plot_CXY = $fff0 ; get/set cursor (to set, clear carry. X/Y are y/x!) - k_iobase = $fff3 + ; pet rom stops here!? + k_scrorg = $ffed ; returns screen size (X = number of columns, Y = number of lines) + ; CAUTION: the c128 uses a new format: + ; c128: X/Y now return maximum values in current window (so 0..39/0..24 instead of 40/25). + ; c128: A returns max column on current screen (39 or 79) + k_plot = $fff0:k_plot_CXY = $fff0 ; get/set cursor (X is line, Y is column) + ; C = 0: set cursor position. + ; C = 1: read cursor position. + k_iobase = $fff3 ; returns first i/o address (i.e. memory limit) in YYXX + ; cbm-ii: $dc00 + ; vic20: $9110 + ; c64: $d000 + ; 264: $fd00 + ; c128: $d000 } + +;note* +; the difference between CHRIN and GETIN depends on the current input device: +; input device 0 (keyboard): CHRIN reads from input buffer, GETIN reads from keyboard buffer +; (the same difference as between INPUT and GET in basic) +; input device 2 (rs232): CHRIN does some error handling, GETIN may just return zero on error. +; roughly speaking, CHRIN returns a "processed" byte while GETIN returns a "raw" byte. +; for devices on the IEC bus there should be no difference between the two calls. +; when reading from the console (keyboard/screen), a zero byte means "no data". +; do not expect a valid Z flag in this case! some devices may clobber the Z flag.