6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue May 14, 2024 1:24 am

All times are UTC




Post new topic Reply to topic  [ 123 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9  Next
Author Message
PostPosted: Sat Aug 27, 2016 2:06 pm 
Offline

Joined: Wed Jun 25, 2014 4:28 pm
Posts: 21
barrym95838 wrote:
Are you using version C?


Yes, I went for small as my KIM Uno has only a tiny bit of free ROM space left... to the point where every byte matters. Which is as it should be.

Also, in the 1K RAM available inside the KIM, you can only write a couple dozen lines of VTL-02 code before running out of memory. Many of the demo programs won't fit unless you unlock the (KIM Uno's, not KIM-1) second K of RAM/EEPROM, but that is cheating... I tucked the VTL-02 keyboard buffer in the 128 byte RIOT RAM 'pocket' to get some extra breathing space.

Quote:
BTW, you speak German, right? Why do you think that German speakers seem to like VTL-02 more than anyone else here?


Not natively (Dutch, really), but maybe its tight code appeals to the engineering mind that spawns Porsches etc as well? Not an engineer myself but I too get this great esthetic satisfaction from studying the 6502 code gems. Like microchess, or Woz's 550 byte disassembler. VTL-02 fits in there...

Regards,

Oscar.


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 29, 2016 5:43 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1929
Location: Sacramento, CA, USA
oscarv wrote:
... a tiny bit of free ROM space left... to the point where every byte matters. Which is as it should be.

That's a very "retro" attitude, and it's nice to hear that I'm not alone with that attitude. I was quite disappointed when I failed to fit the ROMable code into 768 bytes like the 6800 version, but the 16-bit X register of the 6800 seemed to be the key, and the only way to do that on a 65xx would be to target a 65c802 or 65c816 ... an interesting challenge, but one for which I haven't found time to attempt.

Quote:
... maybe its tight code appeals to the engineering mind that spawns Porsches etc as well?

I used to love Porsches, and I still think they deliver an amazing driving experience, but I can't afford to own one, and even if I could, the maintenance on those lovely beasts has become unreasonably tedious:
http://www.26thstreetauto.com/Blog/?pos ... eplacement

Quote:
... microchess, or Woz's 550 byte disassembler. VTL-02 fits in there...

That's far more credit than I deserve. Jennings and Wozniak were true innovators ... I just performed a successful port of something I thought was pretty neat. But thank you very much for the kind sentiment anyway.

Mike B.


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 27, 2016 12:46 am 
Offline

Joined: Sat Jun 04, 2016 10:22 pm
Posts: 483
Location: Australia
I've had a (rather quick) look at the code, and I'm somewhat confused as to how I'd port it to another 6502-based computer(as in a different memory map). The motivation for this is that I would like to implement VTL-02 in the one I'm building, which I suspect has a radically different memory map. (VTL-02 looks easier to implement than EhBASIC, in my inexperienced opinion)
Do you have any pointers as to what to start with?


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 27, 2016 8:55 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
This is how I adopted VTL02c for the Kowalski emulator. The disabled section (commented out) section is the original apple 2 memory map:
Code:
;-----------------------------------------------------;
; Equates for a 48K+ Apple 2 (original, +, e, c, gs)
;ESC      = 27       ; "Cancel current input line" key
;BS       = 8        ; "Delete last keypress" key
;OP_OR    = '!'      ; Bit-wise OR operator
;linbuf   = $0200    ; input line buffer
;prgm     = $0800    ; VTL02B program grows from here
;himem    = $8000    ;   ... up to the top of user RAM
;vtl02c   = $8000    ; interpreter cold entry point
;                     (warm entry point is startok)
;KBD      = $c000    ; 128 + keypress if waiting
;KEYIN    = $fd0c    ; apple monitor keyin routine
;COUT     = $fded    ; apple monitor charout routine
;-----------------------------------------------------;
; Equates for the Kowalski 6502 simulator
ESC      = 27       ; "Cancel current input line" key
BS       = 8        ; "Delete last keypress" key
OP_OR    = '|'      ; Bit-wise OR operator
linbuf   = $0200    ; input line buffer
prgm     = $0400    ; VTL02B program grows from here
himem    = $F000    ;   ... up to the top of user RAM
vtl02c   = $FC00    ; interpreter cold entry point
;                     (warm entry point is startok)
io_area  = $f000      ;configure simulator terminal I/O
acia_tx  = io_area+1  ;acia tx data register
acia_rx  = io_area+4  ;acia rx data register
;=====================================================;
The zero page area is fixed from $80 - $ff.

Since in the Kowalski simulator console I/O changes from being supported by the Monitor ROM to raw hardware (a simulated ACIA), you must also change the I/O subroutines (inkey, inch, outch):
Code:
;============ Original I/O subroutines ===============;
;-----------------------------------------------------;
; Check for user keypress and return with (cc) if none
;   is pending.  Otherwise, fall through to inch
;   and return with (cs).
; 6 bytes
;inkey:
;    lda  KBD        ; is there a keypress waiting?
;    asl
;    bcc  outrts     ;   no: return with (cc)
; - - - - - - - - - - - - - - - - - - - - - - - - - - ;
; Read key from stdin into a, echo, (cs)
; drop stack and abort to "OK" prompt if ctrl-C
; 16 bytes
;inch:
;    sty  dolr       ; save y reg
;    jsr  KEYIN      ; get a char from keyboard
;    ldy  dolr       ; restore y reg
;    and  #$7f       ; strip apple's hi-bit
;    cmp  #$03       ; ctrl-C?
;    bne  outch      ;   no: echo to terminal
;    jmp  start      ;   yes: abort to "OK" prompt
; - - - - - - - - - - - - - - - - - - - - - - - - - - ;
; Print ASCII char in a to stdout, (cs)
; 9 bytes
;outch:
;    pha             ; save original char
;    ora  #$80       ; apples prefer "high" ASCII
;    jsr  COUT       ; emit char via apple monitor
;    pla             ; restore original char
;    sec             ; (by contract with callers)
;outrts:
;    rts
;-----------------------------------------------------;
;========== 2m5 SBC emulator I/O subroutines ============;
;-----------------------------------------------------;
; Check for user keypress and return if none
;   is pending.  Otherwise, check for ctrl-C and
;   return after next keypress.
;
inkey:
    lda  acia_rx    ; Is there a character waiting?
    beq  inkeyr     ;   no: return
    cmp  #3         ; is ctrl-c
    beq  istart     ;   yes: abort to OK prompt
inkeyp:
    lda  acia_rx    ; pause until next key
    beq  inkeyp
    cmp  #3         ; is ctrl-c
    beq  istart     ;   yes: abort to OK prompt
inkeyr:
    rts
; - - - - - - - - - - - - - - - - - - - - - - - - - - ;
; Read key from stdin into a, echo, (cs)
; Dump stack and abort to "OK" prompt if ctrl-C
; 16 bytes
inch:
    lda  acia_rx    ; get character from rx register
    beq  inch       ; wait for character !=0
    cmp  #10        ; remove line feed to allow paste
    beq  inch       ; in the Kowalski I/O window
inch2:
    cmp  #$03       ; ctrl-C?
    bne  outch      ;   no: echo to terminal
istart:
    jmp  start      ;   yes: abort to "OK" prompt
; - - - - - - - - - - - - - - - - - - - - - - - - - - ;
; Print ascii char in a to stdout, (cs)
; 16 bytes
outch:
    cmp  #13        ; add line feed to carriage return
    bne  skip_cr
    lda  #10
    sta  acia_tx
    lda  #13
skip_cr:
    sta  acia_tx    ; emit char via transmit register
    sec             ; (by contract with callers)
    rts
;-----------------------------------------------------;

Assembler options at the beginning of the source code may have to be changed or must be set manually depending on the assembler used:
Code:
; In the Kowalski 6502 simulator some of the options
; below must be set manually.
;
;    .lf  vtl02ca2.lst  (set listfile in menu:
;                        Simulator->Options->Assembler)
;    .cr  6502
    .opt  Proc6502
;
; to run with I/O set terminal active:
;    Menu                     or   Key
;    Simulator->Options->Simulator [Ctrl-E]
;    Simulator->Assemble           [F7]
;    Simulator->Debugger           [F6]
;    Simulator->Run                [F5]
;    View->Input/output            [Alt-5]
;
;    .tf  vtl02ca2.obj,ap1  (optional save output to
;                             file: File->Save Code)
There are some slight syntax differences to the original assembler.
    Referring to the low (none to <) or high (/ to >) byte of a word.
    Directives (2 letters to full word)

The whole source for the Kowalski simulator is here: https://github.com/Klaus2m5/VTL02/blob/ ... l02ca2.65s

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 27, 2016 3:09 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1929
Location: Sacramento, CA, USA
BigEd successfully ported VTL02 to the Beeb, which reserves the top half of zero-page. So, although VTL02 must claim 128 bytes of zero-page, it can be modified to something other than $80 .. $ff. The only changes necessary are in the equates and in the convp: subroutine ... perhaps Ed could share his mods here.

Also, since VTL02 only expects to use the top half of page 1, it should be possible to move the line input buffer to $0100, at least in my versions. Very long input lines approaching 128 chars may need to be trimmed, but these are "edge" cases ... typical VTL02 programs should be fine. Programs that use ridiculous levels of sub-expression nesting will blow out the argument stack in zp long before they blow out the hardware stack at run-time.

Mike B.


Last edited by barrym95838 on Thu Oct 27, 2016 3:23 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 27, 2016 3:20 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
I did have modest success, but was never totally happy with the result. I think I needed to improve the handling of Escape conditions so the user can break out of a loop.

I can't see the source - I fear it's on the disk belonging to a laptop which is no longer in service. A good lesson that I should have done the work somewhere public like github. I may be able to find it. I did post the binary, so in principle one could see how much was changed, but it would take effort.


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 27, 2016 4:43 pm 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
BigEd wrote:
I did have modest success, but was never totally happy with the result. I think I needed to improve the handling of Escape conditions so the user can break out of a loop.
In my version (VTL02sg) I put a check for [CTRL-C] & [CTRL-Z] into the GOTO handler. See "goto_abort:". In the original VTL02c GOTO is just a variable (# = the current line number). A minimalistic GOTO handler would be required to allow an escape from an unconditional loop.

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 27, 2016 5:03 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1929
Location: Sacramento, CA, USA
BigEd wrote:
... I can't see the source - I fear it's on the disk belonging to a laptop which is no longer in service. A good lesson that I should have done the work somewhere public like github. I may be able to find it. I did post the binary, so in principle one could see how much was changed, but it would take effort.

You PM'd me some type of diff file last year ... perhaps this would be helpful?

Attachment:
vtl02b-beeb.patch.txt [6.68 KiB]
Downloaded 141 times


Mike B.


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 27, 2016 5:31 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
Thanks, yes, that should help!


Top
 Profile  
Reply with quote  
PostPosted: Sat Oct 29, 2016 3:56 am 
Offline

Joined: Sat Jun 04, 2016 10:22 pm
Posts: 483
Location: Australia
Thanks for the pointers, Klaus! I shall get to work on it, probably once I have hardware assembled and working.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 09, 2017 8:37 pm 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 575
I have never heard about VTL before, so I skimmed through this thread and read the PDF. It is a really neat language.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 09, 2017 10:03 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1929
Location: Sacramento, CA, USA
I think that it's really neat too, for its economy and convenience. As far as interpreters go, it's no slouch in the speed department either. I have a tentative port to my 65m32 project (I don't have it in front of me, but I think it's <300 words of machine code), and I might just use it in place of my monitor and eForth, until I get them completed and debugged. Of course, VTLm32 isn't debugged either ... no rest for the wicked ...

Mike B.

[Edit: The VTLm32 interpreter environment fits in 245 32-bit words of ROMable 65m32 machine code (roughly the same code bit density as the 6502, but with 32-bit instead of 16-bit variables). Although it would be extremely foolish to "ROM" it until it was tested properly ...]


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 05, 2017 4:04 pm 
Offline

Joined: Thu Aug 31, 2017 1:37 am
Posts: 32
How do you possibly shift the zero page variables into $0A and up?

Edit: There is data going into $02, I need it to go up to $0A.


Last edited by Gradius2000 on Tue Sep 05, 2017 4:31 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 05, 2017 4:26 pm 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
see here: viewtopic.php?f=2&t=2612&p=55861#p48132

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 05, 2017 4:42 pm 
Offline

Joined: Thu Aug 31, 2017 1:37 am
Posts: 32
Klaus2m5 wrote:

Still confusing, where in the code does it insert data to $02 on my github page?
https://github.com/GradiusLover2000/JudyOS/blob/master/vtl02/vtl02.asm


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 123 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: